Skip to content

Commit

Permalink
Merge pull request #53 from mapero/master
Browse files Browse the repository at this point in the history
Add new HW address for Medisana BS444; MagicNumber is current time, fixes wrong timestamp;
  • Loading branch information
oliexdev authored Jul 2, 2017
2 parents 7a16c6e + d68c5a2 commit 0e7e36c
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public boolean isDeviceNameCheck() {
public ArrayList<String> hwAddresses() {
ArrayList hwAddresses = new ArrayList();
hwAddresses.add("E454EB");
hwAddresses.add("F13A88");

return hwAddresses;
}
Expand Down Expand Up @@ -90,7 +91,17 @@ boolean nextBluetoothCmd(int stateNr){
break;
case 3:
// 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);
break;
Expand Down

0 comments on commit 0e7e36c

Please sign in to comment.