1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-08-22 00:06:48 +02:00

BluetoothSwpSBF77: Implement request to perform measurement (Beurer BF950 and SBF77);

This commit is contained in:
Krisjans Blukis
2021-08-07 19:19:10 +03:00
parent 6013508cca
commit 9f3227086a

View File

@@ -36,6 +36,7 @@ class BluetoothGattUuidSBF77 extends BluetoothGattUuid {
public static final UUID CHARACTERISTIC_SBF77_USER_LIST = fromShortCode(0x0001); public static final UUID CHARACTERISTIC_SBF77_USER_LIST = fromShortCode(0x0001);
public static final UUID CHARACTERISTIC_SBF77_INITIALS = fromShortCode(0x0002); public static final UUID CHARACTERISTIC_SBF77_INITIALS = fromShortCode(0x0002);
public static final UUID CHARACTERISTIC_SBF77_ACTIVITY_LEVEL = fromShortCode(0x0004); public static final UUID CHARACTERISTIC_SBF77_ACTIVITY_LEVEL = fromShortCode(0x0004);
public static final UUID CHARACTERISTIC_SBF77_TAKE_MEASUREMENT = fromShortCode(0x0006);
} }
public class BluetoothSwpSBF77 extends BluetoothStandardWeightProfile { public class BluetoothSwpSBF77 extends BluetoothStandardWeightProfile {
@@ -70,6 +71,15 @@ public class BluetoothSwpSBF77 extends BluetoothStandardWeightProfile {
BluetoothGattUuidSBF77.CHARACTERISTIC_SBF77_ACTIVITY_LEVEL, parser.getValue()); BluetoothGattUuidSBF77.CHARACTERISTIC_SBF77_ACTIVITY_LEVEL, parser.getValue());
} }
@Override
protected void requestMeasurement() {
BluetoothBytesParser parser = new BluetoothBytesParser(new byte[]{0});
parser.setIntValue(0x00, FORMAT_UINT8, 0);
Timber.d(String.format("requestMeasurement 0x0006 magic: 0x00"));
writeBytes(BluetoothGattUuidSBF77.SERVICE_CUSTOM_SBF77,
BluetoothGattUuidSBF77.CHARACTERISTIC_SBF77_TAKE_MEASUREMENT, parser.getValue());
}
@Override @Override
protected void setNotifyVendorSpecificUserList() { protected void setNotifyVendorSpecificUserList() {
if (setNotificationOn(BluetoothGattUuidSBF77.SERVICE_CUSTOM_SBF77, if (setNotificationOn(BluetoothGattUuidSBF77.SERVICE_CUSTOM_SBF77,