1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-26 10:35:50 +01:00

Merge branch 'master' into background-javascript

This commit is contained in:
Andreas Shimokawa 2017-09-28 17:31:45 +02:00
commit e6d939e5cb
8 changed files with 48 additions and 3 deletions

View File

@ -1,5 +1,8 @@
### Changelog ### Changelog
#### Version 0.21.3
* Amazfit Bip: Auto-switch language on connect (English, Simplified Chinese, Traditional Chinese), requires FW 0.0.9.14+
#### Version 0.21.2 #### Version 0.21.2
* Amazfit Bip: Support flashing CEP and ALM files for AGPS * Amazfit Bip: Support flashing CEP and ALM files for AGPS
* Amazfit Bip: Initial experimental support for fetching logs from the watch * Amazfit Bip: Initial experimental support for fetching logs from the watch

View File

@ -26,8 +26,8 @@ android {
targetSdkVersion 25 targetSdkVersion 25
// note: always bump BOTH versionCode and versionName! // note: always bump BOTH versionCode and versionName!
versionName "0.21.2" versionName "0.21.3"
versionCode 103 versionCode 104
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
} }
buildTypes { buildTypes {

View File

@ -19,6 +19,8 @@ package nodomain.freeyourgadget.gadgetbridge.devices.amazfitbip;
import java.util.UUID; import java.util.UUID;
import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBand2Service.ENDPOINT_DISPLAY;
public class AmazfitBipService { public class AmazfitBipService {
public static final UUID UUID_CHARACTERISTIC_WEATHER = UUID.fromString("0000000e-0000-3512-2118-0009af100700"); public static final UUID UUID_CHARACTERISTIC_WEATHER = UUID.fromString("0000000e-0000-3512-2118-0009af100700");
@ -26,4 +28,8 @@ public class AmazfitBipService {
public static final byte[] COMMAND_REQUEST_GPS_VERSION = new byte[]{0x0e}; public static final byte[] COMMAND_REQUEST_GPS_VERSION = new byte[]{0x0e};
public static final byte COMMAND_ACTIVITY_DATA_TYPE_DEBUGLOGS = 0x07; public static final byte COMMAND_ACTIVITY_DATA_TYPE_DEBUGLOGS = 0x07;
public static final byte[] COMMAND_SET_LANGUAGE_SIMPLIFIED_CHINESE = new byte[]{ENDPOINT_DISPLAY, 0x13, 0x00, 0x00};
public static final byte[] COMMAND_SET_LANGUAGE_TRADITIONAL_CHINESE = new byte[]{ENDPOINT_DISPLAY, 0x13, 0x00, 0x01};
public static final byte[] COMMAND_SET_LANGUAGE_ENGLISH = new byte[]{ENDPOINT_DISPLAY, 0x13, 0x00, 0x02};
} }

View File

@ -56,11 +56,13 @@ public class AmazfitBipFirmwareInfo extends Mi2FirmwareInfo {
crcToVersion.put(27668, "0.0.8.96"); crcToVersion.put(27668, "0.0.8.96");
crcToVersion.put(60173, "0.0.8.97"); crcToVersion.put(60173, "0.0.8.97");
crcToVersion.put(3462, "0.0.8.98"); crcToVersion.put(3462, "0.0.8.98");
crcToVersion.put(55420, "0.0.9.14");
// resources // resources
crcToVersion.put(12586, "RES 0.0.8.74"); crcToVersion.put(12586, "RES 0.0.8.74");
crcToVersion.put(34068, "RES 0.0.8.88"); crcToVersion.put(34068, "RES 0.0.8.88");
crcToVersion.put(59839, "RES 0.0.8.96-98"); crcToVersion.put(59839, "RES 0.0.8.96-98");
crcToVersion.put(50401, "RES 0.0.9.14");
// gps // gps
crcToVersion.put(61520, "GPS 9367,8f79a91,0,0,"); crcToVersion.put(61520, "GPS 9367,8f79a91,0,0,");

View File

@ -27,6 +27,7 @@ import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.ByteOrder; import java.nio.ByteOrder;
import java.util.Locale;
import java.util.SimpleTimeZone; import java.util.SimpleTimeZone;
import java.util.UUID; import java.util.UUID;
@ -55,6 +56,10 @@ public class AmazfitBipSupport extends MiBand2Support {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitBipSupport.class); private static final Logger LOG = LoggerFactory.getLogger(AmazfitBipSupport.class);
public AmazfitBipSupport() {
super(LOG);
}
@Override @Override
public NotificationStrategy getNotificationStrategy() { public NotificationStrategy getNotificationStrategy() {
return new AmazfitBipTextNotificationStrategy(this); return new AmazfitBipTextNotificationStrategy(this);
@ -267,10 +272,31 @@ public class AmazfitBipSupport extends MiBand2Support {
return this; return this;
} }
private AmazfitBipSupport setLanguage(TransactionBuilder builder) {
String language = Locale.getDefault().getLanguage();
String country = Locale.getDefault().getCountry();
LOG.info("Setting watch language, phone language = " + language + " country = " + country);
byte[] command;
if (language.equals("zh")) {
if (country.equals("TW") || country.equals("HK") || country.equals("MO")) { // Taiwan, Hong Kong, Macao
command = AmazfitBipService.COMMAND_SET_LANGUAGE_TRADITIONAL_CHINESE;
} else {
command = AmazfitBipService.COMMAND_SET_LANGUAGE_SIMPLIFIED_CHINESE;
}
} else {
command = AmazfitBipService.COMMAND_SET_LANGUAGE_ENGLISH;
}
builder.write(getCharacteristic(MiBand2Service.UUID_CHARACTERISTIC_3_CONFIGURATION), command);
return this;
}
@Override @Override
public void phase2Initialize(TransactionBuilder builder) { public void phase2Initialize(TransactionBuilder builder) {
super.phase2Initialize(builder); super.phase2Initialize(builder);
LOG.info("phase2Initialize..."); LOG.info("phase2Initialize...");
setLanguage(builder);
requestGPSVersion(builder); requestGPSVersion(builder);
} }
} }

View File

@ -154,7 +154,11 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport {
private boolean alarmClockRinging; private boolean alarmClockRinging;
public MiBand2Support() { public MiBand2Support() {
super(LOG); this(LOG);
}
public MiBand2Support(Logger logger) {
super(logger);
addSupportedService(GattService.UUID_SERVICE_GENERIC_ACCESS); addSupportedService(GattService.UUID_SERVICE_GENERIC_ACCESS);
addSupportedService(GattService.UUID_SERVICE_GENERIC_ATTRIBUTE); addSupportedService(GattService.UUID_SERVICE_GENERIC_ATTRIBUTE);
addSupportedService(GattService.UUID_SERVICE_HEART_RATE); addSupportedService(GattService.UUID_SERVICE_HEART_RATE);

View File

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<changelog> <changelog>
<release version="0.21.3" versioncode="104">
<change>Amazfit Bip: Auto-switch language on connect (English, Simplified Chinese, Traditional Chinese), requires FW 0.0.9.14+</change>
</release>
<release version="0.21.2" versioncode="103"> <release version="0.21.2" versioncode="103">
<change>Amazfit Bip: Support flashing CEP and ALM files for AGPS</change> <change>Amazfit Bip: Support flashing CEP and ALM files for AGPS</change>
<change>Amazfit Bip: Initial experimental support for fetching logs from the watch</change> <change>Amazfit Bip: Initial experimental support for fetching logs from the watch</change>

View File

@ -0,0 +1 @@
* Amazfit Bip: Auto-switch language on connect (English, Simplified Chinese, Traditional Chinese), requires FW 0.0.9.14+