1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-07-03 11:33:19 +02:00

TLW64: Support further device settings

* inactivity alarm
* others are unclear
This commit is contained in:
115ek 2020-06-30 21:58:00 +02:00
parent 5c40e71355
commit 8a3174dabd
2 changed files with 15 additions and 0 deletions

View File

@ -35,6 +35,7 @@ public final class TLW64Constants {
public static final byte CMD_FACTORY_RESET = (byte) 0xad;
public static final byte CMD_NOTIFICATION = (byte) 0xc1;
public static final byte CMD_ICON = (byte) 0xc3;
public static final byte CMD_DEVICE_SETTINGS = (byte) 0xd3;
// Notifications
public static final byte NOTIFICATION_HEADER = (byte) 0x01;

View File

@ -173,6 +173,9 @@ public class TLW64Support extends AbstractBTLEDeviceSupport {
case TLW64Constants.CMD_ICON:
LOG.info("Icon is displayed");
return true;
case TLW64Constants.CMD_DEVICE_SETTINGS:
LOG.info("Device settings updated");
return true;
default:
LOG.warn("Unhandled characteristic change: " + characteristicUUID + " code: " + Arrays.toString(data));
return true;
@ -529,6 +532,17 @@ public class TLW64Support extends AbstractBTLEDeviceSupport {
}
builder.write(ctrlCharacteristic, userBytes);
// device settings
builder.write(ctrlCharacteristic, new byte[]{
TLW64Constants.CMD_DEVICE_SETTINGS,
(byte) 0x00, // 1 - turns on inactivity alarm
(byte) 0x3c, // unknown, sniffed by original app
(byte) 0x02, // unknown, sniffed by original app
(byte) 0x03, // unknown, sniffed by original app
(byte) 0x01, // unknown, sniffed by original app
(byte) 0x00 // unknown, sniffed by original app
});
}
private void showIcon(int iconId) {