mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-08-28 10:05:35 +02:00
HPlus: Handle more frame types
This commit is contained in:
parent
c9da7548ed
commit
166695f00a
@ -121,6 +121,9 @@ public final class HPlusConstants {
|
||||
public static final byte DATA_DAY_SUMMARY_ALT = 0x39;
|
||||
public static final byte DATA_SLEEP = 0x1A;
|
||||
public static final byte DATA_VERSION = 0x18;
|
||||
public static final byte DATA_VERSION1 = 0x2E;
|
||||
|
||||
public static final byte DATA_UNKNOWN = 0x4d;
|
||||
|
||||
public static final String PREF_HPLUS_SCREENTIME = "hplus_screentime";
|
||||
public static final String PREF_HPLUS_ALLDAYHR = "hplus_alldayhr";
|
||||
|
@ -496,8 +496,15 @@ class HPlusHandlerThread extends GBDeviceIoThread {
|
||||
* @return boolean indicating success or fail
|
||||
*/
|
||||
public boolean processVersion(byte[] data) {
|
||||
int major = data[2] & 0xFF;
|
||||
int minor = data[1] & 0xFF;
|
||||
int major, minor;
|
||||
|
||||
if(data.length == 11){
|
||||
major = data[10] & 0xFF;
|
||||
minor = data[9] & 0xFF;
|
||||
}else {
|
||||
major = data[2] & 0xFF;
|
||||
minor = data[1] & 0xFF;
|
||||
}
|
||||
|
||||
getDevice().setFirmwareVersion(major + "." + minor);
|
||||
|
||||
|
@ -838,6 +838,7 @@ public class HPlusSupport extends AbstractBTLEDeviceSupport {
|
||||
|
||||
switch (data[0]) {
|
||||
case HPlusConstants.DATA_VERSION:
|
||||
case HPlusConstants.DATA_VERSION1:
|
||||
return syncHelper.processVersion(data);
|
||||
|
||||
case HPlusConstants.DATA_STATS:
|
||||
@ -856,9 +857,11 @@ public class HPlusSupport extends AbstractBTLEDeviceSupport {
|
||||
case HPlusConstants.DATA_DAY_SUMMARY:
|
||||
case HPlusConstants.DATA_DAY_SUMMARY_ALT:
|
||||
return syncHelper.processIncomingDaySlotData(data);
|
||||
|
||||
case HPlusConstants.DATA_UNKNOWN:
|
||||
return true;
|
||||
default:
|
||||
LOG.info("Unhandled characteristic change: " + characteristicUUID + " code: " + data[0]);
|
||||
|
||||
LOG.info("Unhandled characteristic change: " + characteristicUUID + " code: " + Arrays.toString(data));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user