diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothSwpSBF77.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothSwpSBF77.java index b0364f46..c4d71399 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothSwpSBF77.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothSwpSBF77.java @@ -20,6 +20,7 @@ package com.health.openscale.core.bluetooth; import android.content.Context; +import com.health.openscale.core.utils.Converters; import com.welie.blessed.BluetoothBytesParser; 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 CHARACTERISTIC_SBF77_USER_LIST = fromShortCode(0x0001); public static final UUID CHARACTERISTIC_SBF77_INITIALS = fromShortCode(0x0002); + public static final UUID CHARACTERISTIC_SBF77_ACTIVITY_LEVEL = fromShortCode(0x0004); } public class BluetoothSwpSBF77 extends BluetoothStandardWeightProfile { @@ -58,6 +60,16 @@ public class BluetoothSwpSBF77 extends BluetoothStandardWeightProfile { 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 protected void setNotifyVendorSpecificUserList() { if (setNotificationOn(BluetoothGattUuidSBF77.SERVICE_CUSTOM_SBF77,