mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-22 08:13:43 +02:00
BluetoothSwpSBF77: send user activity level to scale (Beurer BF950 and SBF77);
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
package com.health.openscale.core.bluetooth;
|
package com.health.openscale.core.bluetooth;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import com.health.openscale.core.utils.Converters;
|
||||||
import com.welie.blessed.BluetoothBytesParser;
|
import com.welie.blessed.BluetoothBytesParser;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -34,6 +35,7 @@ class BluetoothGattUuidSBF77 extends BluetoothGattUuid {
|
|||||||
public static final UUID SERVICE_CUSTOM_SBF77 = fromShortCode(0xffff);
|
public static final UUID SERVICE_CUSTOM_SBF77 = fromShortCode(0xffff);
|
||||||
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 class BluetoothSwpSBF77 extends BluetoothStandardWeightProfile {
|
public class BluetoothSwpSBF77 extends BluetoothStandardWeightProfile {
|
||||||
@@ -58,6 +60,16 @@ public class BluetoothSwpSBF77 extends BluetoothStandardWeightProfile {
|
|||||||
Arrays.copyOfRange(parser.getValue(), 0, 3));
|
Arrays.copyOfRange(parser.getValue(), 0, 3));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void writeActivityLevel() {
|
||||||
|
Converters.ActivityLevel al = selectedUser.getActivityLevel();
|
||||||
|
BluetoothBytesParser parser = new BluetoothBytesParser(new byte[]{0});
|
||||||
|
parser.setIntValue(al.toInt() + 1, FORMAT_UINT8, 0);
|
||||||
|
Timber.d(String.format("setCurrentUserData Activity level: %d", al.toInt() + 1));
|
||||||
|
writeBytes(BluetoothGattUuidSBF77.SERVICE_CUSTOM_SBF77,
|
||||||
|
BluetoothGattUuidSBF77.CHARACTERISTIC_SBF77_ACTIVITY_LEVEL, parser.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setNotifyVendorSpecificUserList() {
|
protected void setNotifyVendorSpecificUserList() {
|
||||||
if (setNotificationOn(BluetoothGattUuidSBF77.SERVICE_CUSTOM_SBF77,
|
if (setNotificationOn(BluetoothGattUuidSBF77.SERVICE_CUSTOM_SBF77,
|
||||||
|
Reference in New Issue
Block a user