From a2eb34b11ac0d92f953ab31f128fdfa600f86bd5 Mon Sep 17 00:00:00 2001 From: Erik Johansson Date: Thu, 15 Nov 2018 21:42:02 +0100 Subject: [PATCH] Use DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION --- .../core/bluetooth/BluetoothBeurerSanitas.java | 7 ++----- .../core/bluetooth/BluetoothCustomOpenScale.java | 4 ++-- .../core/bluetooth/BluetoothDigooDGSO38H.java | 5 +++-- .../bluetooth/BluetoothExcelvanCF36xBLE.java | 4 ++-- .../core/bluetooth/BluetoothExingtechY1.java | 4 ++-- .../core/bluetooth/BluetoothHesley.java | 4 ++-- .../openscale/core/bluetooth/BluetoothMGB.java | 4 ++-- .../core/bluetooth/BluetoothMedisanaBS44x.java | 10 ++++++---- .../core/bluetooth/BluetoothMiScale.java | 16 ++++++++++------ .../core/bluetooth/BluetoothMiScale2.java | 13 ++++++++----- .../core/bluetooth/BluetoothOneByone.java | 3 +-- .../bluetooth/BluetoothTrisaBodyAnalyze.java | 8 ++------ .../core/bluetooth/BluetoothYunmaiSE_Mini.java | 5 ++--- 13 files changed, 44 insertions(+), 43 deletions(-) diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothBeurerSanitas.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothBeurerSanitas.java index a2f400e9..0a411434 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothBeurerSanitas.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothBeurerSanitas.java @@ -61,7 +61,6 @@ public class BluetoothBeurerSanitas extends BluetoothCommunication { UUID.fromString("00002A2A-0000-1000-8000-00805F9B34FB"); private static final UUID PNP_ID = UUID.fromString("00002A50-0000-1000-8000-00805F9B34FB"); - private static final UUID DEVICE_NAME = UUID.fromString("00002A00-0000-1000-8000-00805F9B34FB"); private static final UUID APPEARANCE = @@ -78,9 +77,6 @@ public class BluetoothBeurerSanitas extends BluetoothCommunication { private static final UUID SERVICE_CHANGED = UUID.fromString("00002A05-0000-1000-8000-00805F9B34FB"); - private static final UUID CLIENT_CHARACTERISTICS_CONFIGURATION = - UUID.fromString("00002902-0000-1000-8000-00805F9B34FB"); - private static final UUID CUSTOM_SERVICE_1 = UUID.fromString("0000FFE0-0000-1000-8000-00805F9B34FB"); private static final UUID CUSTOM_CHARACTERISTIC_1 = // read-write @@ -154,7 +150,8 @@ public class BluetoothBeurerSanitas extends BluetoothCommunication { seenUsers = new TreeSet<>(); // Setup notification - setNotificationOn(CUSTOM_SERVICE_1, CUSTOM_CHARACTERISTIC_WEIGHT, CLIENT_CHARACTERISTICS_CONFIGURATION); + setNotificationOn(CUSTOM_SERVICE_1, CUSTOM_CHARACTERISTIC_WEIGHT, + BluetoothGattUuid.DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION); break; case 1: // Say "Hello" to the scale diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothCustomOpenScale.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothCustomOpenScale.java index 52f825d4..311c3786 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothCustomOpenScale.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothCustomOpenScale.java @@ -32,7 +32,6 @@ import timber.log.Timber; public class BluetoothCustomOpenScale extends BluetoothCommunication { private final UUID WEIGHT_MEASUREMENT_SERVICE = UUID.fromString("0000ffe0-0000-1000-8000-00805f9b34fb"); private final UUID WEIGHT_MEASUREMENT_CHARACTERISTIC = UUID.fromString("0000ffe1-0000-1000-8000-00805f9b34fb"); // Bluetooth Modul HM-10 - private final UUID WEIGHT_MEASUREMENT_CONFIG = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb"); private String string_data = new String(); @@ -49,7 +48,8 @@ public class BluetoothCustomOpenScale extends BluetoothCommunication { protected boolean nextInitCmd(int stateNr) { switch (stateNr) { case 0: - setNotificationOn(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_CHARACTERISTIC, WEIGHT_MEASUREMENT_CONFIG); + setNotificationOn(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_CHARACTERISTIC, + BluetoothGattUuid.DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION); break; case 1: Calendar cal = Calendar.getInstance(); diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothDigooDGSO38H.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothDigooDGSO38H.java index a8200df4..a677449b 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothDigooDGSO38H.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothDigooDGSO38H.java @@ -33,7 +33,7 @@ public class BluetoothDigooDGSO38H extends BluetoothCommunication { private final UUID WEIGHT_MEASUREMENT_SERVICE = UUID.fromString("0000fff0-0000-1000-8000-00805f9b34fb"); private final UUID WEIGHT_MEASUREMENT_CHARACTERISTIC = UUID.fromString("0000fff1-0000-1000-8000-00805f9b34fb"); private final UUID EXTRA_MEASUREMENT_CHARACTERISTIC = UUID.fromString("0000fff2-0000-1000-8000-00805f9b34fb"); - private final UUID WEIGHT_MEASUREMENT_DESCRIPTOR = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb"); + public BluetoothDigooDGSO38H(Context context) { super(context); } @@ -61,7 +61,8 @@ public class BluetoothDigooDGSO38H extends BluetoothCommunication { switch (stateNr) { case 0: //Tell device to send us weight measurements - setNotificationOn(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_CHARACTERISTIC, WEIGHT_MEASUREMENT_DESCRIPTOR); + setNotificationOn(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_CHARACTERISTIC, + BluetoothGattUuid.DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION); return false; } diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothExcelvanCF36xBLE.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothExcelvanCF36xBLE.java index 4d675d6c..c4570976 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothExcelvanCF36xBLE.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothExcelvanCF36xBLE.java @@ -32,7 +32,6 @@ public class BluetoothExcelvanCF36xBLE extends BluetoothCommunication { private final UUID WEIGHT_MEASUREMENT_SERVICE = UUID.fromString("0000FFF0-0000-1000-8000-00805f9b34fb"); private final UUID WEIGHT_MEASUREMENT_CHARACTERISTIC = UUID.fromString("0000FFF1-0000-1000-8000-00805f9b34fb"); private final UUID WEIGHT_CUSTOM0_CHARACTERISTIC = UUID.fromString("0000FFF4-0000-1000-8000-00805f9b34fb"); - private final UUID WEIGHT_MEASUREMENT_CONFIG = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb"); private byte[] receivedData = new byte[]{}; @@ -96,7 +95,8 @@ public class BluetoothExcelvanCF36xBLE extends BluetoothCommunication { writeBytes(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_CHARACTERISTIC, configBytes); break; case 1: - setNotificationOn(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_CUSTOM0_CHARACTERISTIC, WEIGHT_MEASUREMENT_CONFIG); + setNotificationOn(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_CUSTOM0_CHARACTERISTIC, + BluetoothGattUuid.DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION); break; default: return false; diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothExingtechY1.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothExingtechY1.java index e7ed5301..00d48241 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothExingtechY1.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothExingtechY1.java @@ -32,7 +32,6 @@ public class BluetoothExingtechY1 extends BluetoothCommunication { private final UUID WEIGHT_MEASUREMENT_SERVICE = UUID.fromString("f433bd80-75b8-11e2-97d9-0002a5d5c51b"); private final UUID WEIGHT_MEASUREMENT_CHARACTERISTIC = UUID.fromString("1a2ea400-75b9-11e2-be05-0002a5d5c51b"); // read, notify private final UUID CMD_MEASUREMENT_CHARACTERISTIC = UUID.fromString("29f11080-75b9-11e2-8bf6-0002a5d5c51b"); // write only - private final UUID WEIGHT_MEASUREMENT_CONFIG = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb"); public BluetoothExingtechY1(Context context) { super(context); @@ -47,7 +46,8 @@ public class BluetoothExingtechY1 extends BluetoothCommunication { protected boolean nextInitCmd(int stateNr) { switch (stateNr) { case 0: - setNotificationOn(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_CHARACTERISTIC, WEIGHT_MEASUREMENT_CONFIG); + setNotificationOn(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_CHARACTERISTIC, + BluetoothGattUuid.DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION); break; case 1: final ScaleUser selectedUser = OpenScale.getInstance().getSelectedScaleUser(); diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothHesley.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothHesley.java index 00fa2b92..348d68ae 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothHesley.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothHesley.java @@ -29,7 +29,6 @@ public class BluetoothHesley extends BluetoothCommunication { private final UUID WEIGHT_MEASUREMENT_SERVICE = UUID.fromString("0000fff0-0000-1000-8000-00805f9b34fb"); private final UUID WEIGHT_MEASUREMENT_CHARACTERISTIC = UUID.fromString("0000fff4-0000-1000-8000-00805f9b34fb"); // read, notify private final UUID CMD_MEASUREMENT_CHARACTERISTIC = UUID.fromString("0000fff1-0000-1000-8000-00805f9b34fb"); // write only - private final UUID WEIGHT_MEASUREMENT_CONFIG = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb"); public BluetoothHesley(Context context) { super(context); @@ -44,7 +43,8 @@ public class BluetoothHesley extends BluetoothCommunication { protected boolean nextInitCmd(int stateNr) { switch (stateNr) { case 0: - setNotificationOn(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_CHARACTERISTIC, WEIGHT_MEASUREMENT_CONFIG); + setNotificationOn(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_CHARACTERISTIC, + BluetoothGattUuid.DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION); break; case 1: byte[] magicBytes = {(byte)0xa5, (byte)0x01, (byte)0x2c, (byte)0xab, (byte)0x50, (byte)0x5a, (byte)0x29}; diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothMGB.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothMGB.java index 0f8c82d8..eb3eeb0e 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothMGB.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothMGB.java @@ -36,7 +36,6 @@ public class BluetoothMGB extends BluetoothCommunication { private static final UUID uuid_service = UUID.fromString("0000ffb0-0000-1000-8000-00805f9b34fb"); private static final UUID uuid_char_cfg = UUID.fromString("0000ffb1-0000-1000-8000-00805f9b34fb"); private static final UUID uuid_char_ctrl = UUID.fromString("0000ffb2-0000-1000-8000-00805f9b34fb"); - private static final UUID uuid_desc_ctrl = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb"); private Calendar now; @@ -87,7 +86,8 @@ public class BluetoothMGB extends BluetoothCommunication { protected boolean nextInitCmd(int stateNr) { switch (stateNr) { case 0: - setNotificationOn(uuid_service, uuid_char_ctrl, uuid_desc_ctrl); + setNotificationOn(uuid_service, uuid_char_ctrl, + BluetoothGattUuid.DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION); now = Calendar.getInstance(); user = OpenScale.getInstance().getSelectedScaleUser(); break; diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothMedisanaBS44x.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothMedisanaBS44x.java index f496b8df..611fc9da 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothMedisanaBS44x.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothMedisanaBS44x.java @@ -32,7 +32,6 @@ public class BluetoothMedisanaBS44x extends BluetoothCommunication { private final UUID CUSTOM3_MEASUREMENT_CHARACTERISTIC = UUID.fromString("00008a20-0000-1000-8000-00805f9b34fb"); // read-only private final UUID CMD_MEASUREMENT_CHARACTERISTIC = UUID.fromString("00008a81-0000-1000-8000-00805f9b34fb"); // write-only private final UUID CUSTOM5_MEASUREMENT_CHARACTERISTIC = UUID.fromString("00008a82-0000-1000-8000-00805f9b34fb"); // indication, read-only - private final UUID WEIGHT_MEASUREMENT_CONFIG = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb"); private ScaleMeasurement btScaleMeasurement; @@ -59,15 +58,18 @@ public class BluetoothMedisanaBS44x extends BluetoothCommunication { switch (stateNr) { case 0: // set indication on for feature characteristic - setIndicationOn(WEIGHT_MEASUREMENT_SERVICE, FEATURE_MEASUREMENT_CHARACTERISTIC, WEIGHT_MEASUREMENT_CONFIG); + setIndicationOn(WEIGHT_MEASUREMENT_SERVICE, FEATURE_MEASUREMENT_CHARACTERISTIC, + BluetoothGattUuid.DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION); break; case 1: // set indication on for weight measurement - setIndicationOn(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_CHARACTERISTIC, WEIGHT_MEASUREMENT_CONFIG); + setIndicationOn(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_CHARACTERISTIC, + BluetoothGattUuid.DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION); break; case 2: // set indication on for custom5 measurement - setIndicationOn(WEIGHT_MEASUREMENT_SERVICE, CUSTOM5_MEASUREMENT_CHARACTERISTIC, WEIGHT_MEASUREMENT_CONFIG); + setIndicationOn(WEIGHT_MEASUREMENT_SERVICE, CUSTOM5_MEASUREMENT_CHARACTERISTIC, + BluetoothGattUuid.DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION); break; case 3: // send magic number to receive weight data diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothMiScale.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothMiScale.java index 4d075997..fba8b3e8 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothMiScale.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothMiScale.java @@ -44,7 +44,6 @@ public class BluetoothMiScale extends BluetoothCommunication { private final UUID WEIGHT_MEASUREMENT_CHARACTERISTIC = UUID.fromString("00002a9d-0000-1000-8000-00805f9b34fb"); private final UUID WEIGHT_MEASUREMENT_HISTORY_CHARACTERISTIC = UUID.fromString("00002a2f-0000-3512-2118-0009af100700"); private final UUID WEIGHT_MEASUREMENT_TIME_CHARACTERISTIC = UUID.fromString("00002a2b-0000-1000-8000-00805f9b34fb"); - private final UUID WEIGHT_MEASUREMENT_CONFIG = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb"); public BluetoothMiScale(Context context) { super(context); @@ -122,7 +121,8 @@ public class BluetoothMiScale extends BluetoothCommunication { break; case 2: // set notification on for weight measurement history - setNotificationOn(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_HISTORY_CHARACTERISTIC, WEIGHT_MEASUREMENT_CONFIG); + setNotificationOn(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_HISTORY_CHARACTERISTIC, + BluetoothGattUuid.DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION); break; case 3: // Set on history weight measurement @@ -142,11 +142,13 @@ public class BluetoothMiScale extends BluetoothCommunication { switch (stateNr) { case 0: // set notification on for weight measurement history - setNotificationOn(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_HISTORY_CHARACTERISTIC, WEIGHT_MEASUREMENT_CONFIG); + setNotificationOn(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_HISTORY_CHARACTERISTIC, + BluetoothGattUuid.DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION); break; case 1: // set notification on for weight measurement - setNotificationOn(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_CHARACTERISTIC, WEIGHT_MEASUREMENT_CONFIG); + setNotificationOn(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_CHARACTERISTIC, + BluetoothGattUuid.DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION); break; case 2: // configure scale to get only last measurements @@ -157,11 +159,13 @@ public class BluetoothMiScale extends BluetoothCommunication { break; case 3: // set notification off for weight measurement history - setNotificationOff(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_HISTORY_CHARACTERISTIC, WEIGHT_MEASUREMENT_CONFIG); + setNotificationOff(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_HISTORY_CHARACTERISTIC, + BluetoothGattUuid.DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION); break; case 4: // set notification on for weight measurement history - setNotificationOn(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_HISTORY_CHARACTERISTIC, WEIGHT_MEASUREMENT_CONFIG); + setNotificationOn(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_HISTORY_CHARACTERISTIC, + BluetoothGattUuid.DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION); break; case 5: // invoke receiving history data diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothMiScale2.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothMiScale2.java index 431334b8..2e59c5a7 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothMiScale2.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothMiScale2.java @@ -50,7 +50,6 @@ public class BluetoothMiScale2 extends BluetoothCommunication { private final UUID WEIGHT_MEASUREMENT_SERVICE = UUID.fromString("0000181b-0000-1000-8000-00805f9b34fb"); private final UUID WEIGHT_MEASUREMENT_HISTORY_CHARACTERISTIC = UUID.fromString("00002a2f-0000-3512-2118-0009af100700"); private final UUID WEIGHT_MEASUREMENT_TIME_CHARACTERISTIC = UUID.fromString("00002a2b-0000-1000-8000-00805f9b34fb"); - private final UUID WEIGHT_MEASUREMENT_CONFIG = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb"); private final UUID WEIGHT_MEASUREMENT_BODY_COMPOSITION_FEATURE = UUID.fromString("00002a9b-0000-1000-8000-00805f9b34fb"); private final UUID WEIGHT_MEASUREMENT_BODY_COMPOSITION_MEASUREMENT = UUID.fromString("00002a9c-0000-1000-8000-00805f9b34fb"); @@ -118,7 +117,8 @@ public class BluetoothMiScale2 extends BluetoothCommunication { break; case 2: // set notification on for weight measurement history - setNotificationOn(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_HISTORY_CHARACTERISTIC, WEIGHT_MEASUREMENT_CONFIG); + setNotificationOn(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_HISTORY_CHARACTERISTIC, + BluetoothGattUuid.DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION); break; default: return false; @@ -139,11 +139,13 @@ public class BluetoothMiScale2 extends BluetoothCommunication { break; case 1: // set notification off for weight measurement history - setNotificationOff(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_HISTORY_CHARACTERISTIC, WEIGHT_MEASUREMENT_CONFIG); + setNotificationOff(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_HISTORY_CHARACTERISTIC, + BluetoothGattUuid.DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION); break; case 2: // set notification on for weight measurement history - setNotificationOn(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_HISTORY_CHARACTERISTIC, WEIGHT_MEASUREMENT_CONFIG); + setNotificationOn(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_HISTORY_CHARACTERISTIC, + BluetoothGattUuid.DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION); break; case 3: // invoke receiving history data @@ -173,7 +175,8 @@ public class BluetoothMiScale2 extends BluetoothCommunication { break; case 2: // set notification on for body composition measurement - setNotificationOn(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_BODY_COMPOSITION_MEASUREMENT, WEIGHT_MEASUREMENT_CONFIG); + setNotificationOn(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_BODY_COMPOSITION_MEASUREMENT, + BluetoothGattUuid.DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION); break; default: return false; diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothOneByone.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothOneByone.java index b6dc7ad4..9a4e4860 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothOneByone.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothOneByone.java @@ -36,7 +36,6 @@ public class BluetoothOneByone extends BluetoothCommunication { private final UUID WEIGHT_MEASUREMENT_CHARACTERISTIC_BODY_COMPOSITION = UUID.fromString("0000fff4-0000-1000-8000-00805f9b34fb"); // notify private final UUID CMD_MEASUREMENT_CHARACTERISTIC = UUID.fromString("0000fff1-0000-1000-8000-00805f9b34fb"); // write only - private final UUID WEIGHT_MEASUREMENT_CONFIG = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb"); public BluetoothOneByone(Context context) { @@ -54,7 +53,7 @@ public class BluetoothOneByone extends BluetoothCommunication { case 0: setNotificationOn(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_CHARACTERISTIC_BODY_COMPOSITION, - WEIGHT_MEASUREMENT_CONFIG); + BluetoothGattUuid.DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION); break; case 1: ScaleUser currentUser = OpenScale.getInstance().getSelectedScaleUser(); diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothTrisaBodyAnalyze.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothTrisaBodyAnalyze.java index 5dc9d9cd..abd1d004 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothTrisaBodyAnalyze.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothTrisaBodyAnalyze.java @@ -46,10 +46,6 @@ public class BluetoothTrisaBodyAnalyze extends BluetoothCommunication { private static final UUID WEIGHT_SCALE_SERVICE_UUID = UUID.fromString("00007802-0000-1000-8000-00805f9b34fb"); - // GATT descriptor. - private static final UUID CLIENT_CHARACTERISTIC_CONFIGURATION_DESCRIPTOR_UUID = - UUID.fromString("00002902-0000-1000-8000-00805f9b34fb"); - // GATT service characteristics. private static final UUID MEASUREMENT_CHARACTERISTIC_UUID = UUID.fromString("00008a21-0000-1000-8000-00805f9b34fb"); @@ -135,7 +131,7 @@ public class BluetoothTrisaBodyAnalyze extends BluetoothCommunication { setIndicationOn( WEIGHT_SCALE_SERVICE_UUID, MEASUREMENT_CHARACTERISTIC_UUID, - CLIENT_CHARACTERISTIC_CONFIGURATION_DESCRIPTOR_UUID); + BluetoothGattUuid.DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION); return true; // more commands follow case 1: // Register for notifications of the command upload characteristic. @@ -146,7 +142,7 @@ public class BluetoothTrisaBodyAnalyze extends BluetoothCommunication { setIndicationOn( WEIGHT_SCALE_SERVICE_UUID, UPLOAD_COMMAND_CHARACTERISTIC_UUID, - CLIENT_CHARACTERISTIC_CONFIGURATION_DESCRIPTOR_UUID); + BluetoothGattUuid.DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION); // falls through default: return false; // no more commands diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothYunmaiSE_Mini.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothYunmaiSE_Mini.java index 4fdc7b65..b4317f87 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothYunmaiSE_Mini.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothYunmaiSE_Mini.java @@ -40,8 +40,6 @@ public class BluetoothYunmaiSE_Mini extends BluetoothCommunication { private final UUID WEIGHT_CMD_SERVICE = UUID.fromString("0000ffe5-0000-1000-8000-00805f9b34fb"); private final UUID WEIGHT_CMD_CHARACTERISTIC = UUID.fromString("0000ffe9-0000-1000-8000-00805f9b34fb"); - private final UUID WEIGHT_MEASUREMENT_CONFIG = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb"); - private boolean isMini; public BluetoothYunmaiSE_Mini(Context context, boolean isMini) { @@ -85,7 +83,8 @@ public class BluetoothYunmaiSE_Mini extends BluetoothCommunication { writeBytes(WEIGHT_CMD_SERVICE, WEIGHT_CMD_CHARACTERISTIC, set_time); break; case 2: - setNotificationOn(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_CHARACTERISTIC, WEIGHT_MEASUREMENT_CONFIG); + setNotificationOn(WEIGHT_MEASUREMENT_SERVICE, WEIGHT_MEASUREMENT_CHARACTERISTIC, + BluetoothGattUuid.DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION); break; case 3: byte[] magic_bytes = new byte[]{(byte)0x0d, (byte)0x05, (byte)0x13, (byte)0x00, (byte)0x16};