mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-24 09:13:04 +02:00
Merge pull request #53 from mapero/master
Add new HW address for Medisana BS444; MagicNumber is current time, fixes wrong timestamp;
This commit is contained in:
@@ -60,6 +60,7 @@ public class BluetoothMedisanaBS444 extends BluetoothCommunication {
|
|||||||
public ArrayList<String> hwAddresses() {
|
public ArrayList<String> hwAddresses() {
|
||||||
ArrayList hwAddresses = new ArrayList();
|
ArrayList hwAddresses = new ArrayList();
|
||||||
hwAddresses.add("E454EB");
|
hwAddresses.add("E454EB");
|
||||||
|
hwAddresses.add("F13A88");
|
||||||
|
|
||||||
return hwAddresses;
|
return hwAddresses;
|
||||||
}
|
}
|
||||||
@@ -90,7 +91,17 @@ public class BluetoothMedisanaBS444 extends BluetoothCommunication {
|
|||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
// send magic number to receive weight data
|
// send magic number to receive weight data
|
||||||
byte[] magicBytes = new byte[]{(byte)0x02, (byte)0x7B, (byte)0x7B, (byte)0xF6, (byte)0x0D}; // 02:7b:7b:f6:0d
|
Date date = new Date();
|
||||||
|
int unix_timestamp = (int) ((date.getTime() / 1000) - 1262304000) ; // -40 years because unix time starts in year 1970
|
||||||
|
|
||||||
|
byte[] magicBytes = new byte[] {
|
||||||
|
(byte)0x02,
|
||||||
|
(byte)(unix_timestamp),
|
||||||
|
(byte)(unix_timestamp >>> 8),
|
||||||
|
(byte)(unix_timestamp >>> 16),
|
||||||
|
(byte)(unix_timestamp >>> 24)
|
||||||
|
};
|
||||||
|
//byte[] magicBytes = new byte[]{(byte)0x02, (byte)0x7B, (byte)0x7B, (byte)0xF6, (byte)0x0D}; // 02:7b:7b:f6:0d
|
||||||
|
|
||||||
writeBytes(WEIGHT_MEASUREMENT_SERVICE, CMD_MEASUREMENT_CHARACTERISTIC, magicBytes);
|
writeBytes(WEIGHT_MEASUREMENT_SERVICE, CMD_MEASUREMENT_CHARACTERISTIC, magicBytes);
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user