Some received data seems to be overwritten by the latter received one on Android 8 with latest SweetBLUE 3.2.7 and UpdateThreadType.HANDLER_THREAD
-
In case of Android 8 tablet, latest SweetBLUE 3.2.7, and using
UpdateThreadType.HANDLER_THREAD
, some data was overwritten by the latter received one as written on Summary of our faced issue.Request
- Let me know what causes this issue if you think of it
- How can we investigate more of the cause of this issue? I tried to set
LogOptions.ALL_ON
and watch the log, but cannot know the cause and how to fix.
Summary of our faced issue
Our environment is below.
- An our peripheral device and a tablet are connected
- The peripheral device notifies and receives data on single characteristic
- The peripheral device notifies data to the tablet in 6 batches as written on below table as
expected cmd
- The data has our defined command (we call it
cmd
) on first byte of the data (our log says it asrawData
) - The
rawData
is event data got from the methodonBleNotify
which is called viaBleNotify().setNotificationListener(onBleNotify)
The peripheral device sends cmds 0x00, 0x09, 0x04, 0x0B, 0x07, and 0x08 in order. We expected that the tablet could receive data on column expected cmd, but actual received data was not in case of Android 8.0.0 + SweetBLUE 3.2.7 +
UpdateThreadType.HANDLER_THREAD
.tablet configuration expected cmd actual pass/fail Android 8.0.0 (HUAWEI MediaPad T5) + SweetBLUE 3.2.7 + UpdateThreadType.HANDLER_THREAD
0x00 -> 0x09 -> 0x04 -> 0x0B -> 0x07 -> 0x08 0x00 -> 0x04 -> 0x08 -> 0x08 -> 0x08 -> 0x08 fail Android 10 (Lenovo YT-X705F) + SweetBLUE 3.2.7 + UpdateThreadType.HANDLER_THREAD
0x00 -> 0x09 -> 0x04 -> 0x0B -> 0x07 -> 0x08 0x00 -> 0x09 -> 0x04 -> 0x0B -> 0x07 -> 0x08 pass Android 8.0.0 (HUAWEI MediaPad T5) + SweetBLUE 3.2.7 + default UpdateThreadType
0x00 -> 0x09 -> 0x04 -> 0x0B -> 0x07 -> 0x08 0x00 -> 0x09 -> 0x04 -> 0x0B -> 0x07 -> 0x08 pass Android 8.0.0 (HUAWEI MediaPad T5) + SweetBLUE 3.2.5 + default UpdateThreadType
0x00 -> 0x09 -> 0x04 -> 0x0B -> 0x07 -> 0x08 0x00 -> 0x09 -> 0x04 -> 0x0B -> 0x07 -> 0x08 pass Android 10 (Lenovo YT-X705F) + SweetBLUE 3.2.5 + default UpdateThreadType
0x00 -> 0x09 -> 0x04 -> 0x0B -> 0x07 -> 0x08 0x00 -> 0x09 -> 0x04 -> 0x0B -> 0x07 -> 0x08 pass Logging with
LogOptions.ALL_ON
Android 8.0.0 + SweetBLUE 3.2.7 +
UpdateThreadType.HANDLER_THREAD
- Failed only in this case. It seems that some internal buffer in SweetBLUE to receive data was overwritten by the latter received one.
12-15 10:12:35.224
: [SweetBLUE] cmd:0 should be received12-15 10:12:35.228
: [SweetBLUE] cmd:9 should be received12-15 10:12:35.228
: [Our app] cmd:0 is received (pass)12-15 10:12:35.234
: [Our app] cmd:4 is received (fail. cmd:9 was expected)12-15 10:12:35.236
: [SweetBLUE] cmd:4 should be received12-15 10:12:35.241
: [Our app] cmd:8 is received (fail. cmd:4 was expected)12-15 10:12:35.243
: [SweetBLUE] cmd:B should be received12-15 10:12:35.246
: [Our app] cmd:8 is received (fail. cmd:B was expected)12-15 10:12:35.246
: [SweetBLUE] cmd:7 should be received12-15 10:12:35.249
: [Our app] cmd:8 is received (fail. cmd:7 was expected)12-15 10:12:35.249
: [SweetBLUE] cmd:8 should be received12-15 10:12:35.252
: [Our app] cmd:8 is received (pass)
12-15 10:12:35.224 5844 6026 D P_BleDevice_ListenerProcessor [Native]: UPDATE(6026) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 10:12:35.227 5844 5844 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 10:12:35.228 5844 5844 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 0001070000000006001300090013 12-15 10:12:35.228 5844 6026 D P_BleDevice_ListenerProcessor [Native]: UPDATE(6026) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 10:12:35.228 5844 5844 I BLE_CORE_PKT_RCV: 0001070000000006001300090013 onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : 0, branchPosition:1 12-15 10:12:35.233 5844 5844 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 10:12:35.233 5844 5844 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 04010116 12-15 10:12:35.234 5844 5844 I BLE_CORE_PKT_RCV: 04010116 onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : 4, branchPosition:1 12-15 10:12:35.236 5844 6026 D P_BleDevice_ListenerProcessor [Native]: UPDATE(6026) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 10:12:35.239 5844 5844 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 10:12:35.240 5844 5844 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 08010004 12-15 10:12:35.241 5844 5844 I BLE_CORE_PKT_RCV: 08010004 onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : 8, branchPosition:1 12-15 10:12:35.243 5844 6026 D P_BleDevice_ListenerProcessor [Native]: UPDATE(6026) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 10:12:35.245 5844 5844 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 10:12:35.246 5844 5844 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 08010004 12-15 10:12:35.246 5844 5844 I BLE_CORE_PKT_RCV: 08010004 onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : 8, branchPosition:1 12-15 10:12:35.246 5844 6026 D P_BleDevice_ListenerProcessor [Native]: UPDATE(6026) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 10:12:35.248 5844 5844 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 10:12:35.248 5844 5844 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 08010004 12-15 10:12:35.249 5844 5844 I BLE_CORE_PKT_RCV: 08010004 onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : 8, branchPosition:1 12-15 10:12:35.249 5844 6026 D P_BleDevice_ListenerProcessor [Native]: UPDATE(6026) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 10:12:35.251 5844 5844 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 10:12:35.252 5844 5844 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 08010004 12-15 10:12:35.252 5844 5844 I BLE_CORE_PKT_RCV: 08010004 onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : 8, branchPosition:1
Android 10 + SweetBLUE 3.2.7 +
UpdateThreadType.HANDLER_THREAD
- No problem in this case
12-15 10:33:54.625 8863 9287 D P_BleDevice_ListenerProcessor [Native]: UPDATE(9287) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 10:33:54.626 8863 8863 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 10:33:54.626 8863 8863 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 0001070000000006001300090013 12-15 10:33:54.627 8863 8863 I BLE_CORE_PKT_RCV: 0001070000000006001300090013 onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : 0, branchPosition:1 12-15 10:33:54.637 8863 9287 D P_BleDevice_ListenerProcessor [Native]: UPDATE(9287) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 10:33:54.639 8863 8863 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 10:33:54.640 8863 8863 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 09010150515146424169062313 12-15 10:33:54.640 8863 8863 I BLE_CORE_PKT_RCV: 09010150515146424169062313 onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : 9, branchPosition:1 12-15 10:33:54.640 8863 9287 D P_BleDevice_ListenerProcessor [Native]: UPDATE(9287) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 10:33:54.641 8863 8863 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 10:33:54.642 8863 8863 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 04010116 12-15 10:33:54.642 8863 9287 D P_BleDevice_ListenerProcessor [Native]: UPDATE(9287) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 10:33:54.642 8863 8863 I BLE_CORE_PKT_RCV: 04010116 onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : 4, branchPosition:1 12-15 10:33:54.644 8863 8863 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 10:33:54.644 8863 8863 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 0B010004 12-15 10:33:54.644 8863 8863 I BLE_CORE_PKT_RCV: 0B010004 onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : B, branchPosition:1 12-15 10:33:54.644 8863 9287 D P_BleDevice_ListenerProcessor [Native]: UPDATE(9287) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 10:33:54.645 8863 8863 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 10:33:54.645 8863 8863 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 070103FB 12-15 10:33:54.646 8863 8863 I BLE_CORE_PKT_RCV: 070103FB onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : 7, branchPosition:1 12-15 10:33:54.646 8863 9287 D P_BleDevice_ListenerProcessor [Native]: UPDATE(9287) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 10:33:54.647 8863 8863 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 10:33:54.647 8863 8863 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 08010004 12-15 10:33:54.647 8863 8863 I BLE_CORE_PKT_RCV: 08010004 onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : 8, branchPosition:1
Android 8.0.0 + SweetBLUE 3.2.7 + default
UpdateThreadType
- No problem in this case
12-15 13:39:50.777 14207 14221 D P_BleDevice_ListenerProcessor [Native]: DON(14221) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 13:39:50.782 14207 14221 D P_BleDevice_ListenerProcessor [Native]: DON(14221) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 13:39:50.783 14207 14207 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 13:39:50.784 14207 14207 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 0001070000000006001300090013 12-15 13:39:50.785 14207 14207 I BLE_CORE_PKT_RCV: 0001070000000006001300090013 onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : 0, branchPosition:1 12-15 13:39:50.785 14207 14221 D P_BleDevice_ListenerProcessor [Native]: DON(14221) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 13:39:50.788 14207 14207 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 13:39:50.789 14207 14207 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 09010150515146424169062313 12-15 13:39:50.789 14207 14665 D P_BleDevice_ListenerProcessor [Native]: BOB(14665) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 13:39:50.789 14207 14207 I BLE_CORE_PKT_RCV: 09010150515146424169062313 onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : 9, branchPosition:1 12-15 13:39:50.791 14207 14207 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 13:39:50.791 14207 14207 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 04010116 12-15 13:39:50.792 14207 14207 I BLE_CORE_PKT_RCV: 04010116 onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : 4, branchPosition:1 12-15 13:39:50.793 14207 14665 D P_BleDevice_ListenerProcessor [Native]: BOB(14665) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 13:39:50.795 14207 14665 D P_BleDevice_ListenerProcessor [Native]: BOB(14665) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 13:39:50.797 14207 14207 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 13:39:50.797 14207 14207 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 0B010004 12-15 13:39:50.797 14207 14207 I BLE_CORE_PKT_RCV: 0B010004 onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : B, branchPosition:1 12-15 13:39:50.799 14207 14207 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 13:39:50.800 14207 14207 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 070103FB 12-15 13:39:50.800 14207 14207 I BLE_CORE_PKT_RCV: 070103FB onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : 7, branchPosition:1 12-15 13:39:50.801 14207 14207 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 13:39:50.801 14207 14207 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 08010004 12-15 13:39:50.801 14207 14207 I BLE_CORE_PKT_RCV: 08010004 onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : 8, branchPosition:1
Android 8.0.0 + SweetBLUE 3.2.5 + default
UpdateThreadType
- No problem in this case
12-15 11:37:41.377 9804 9818 D P_BleDevice_ListenerProcessor [Native]: CAM(9818) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 11:37:41.380 9804 9818 D P_BleDevice_ListenerProcessor [Native]: CAM(9818) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 11:37:41.382 9804 9804 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 11:37:41.382 9804 9804 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 0001070000000006001300090013 12-15 11:37:41.383 9804 9804 I BLE_CORE_PKT_RCV: 0001070000000006001300090013 onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : 0, branchPosition:1 12-15 11:37:41.385 9804 10092 D P_BleDevice_ListenerProcessor [Native]: ABE(10092) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 11:37:41.388 9804 9804 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 11:37:41.388 9804 9804 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 09010150515146424169062313 12-15 11:37:41.388 9804 9804 I BLE_CORE_PKT_RCV: 09010150515146424169062313 onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : 9, branchPosition:1 12-15 11:37:41.390 9804 9804 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 11:37:41.390 9804 9804 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 04010116 12-15 11:37:41.391 9804 9804 I BLE_CORE_PKT_RCV: 04010116 onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : 4, branchPosition:1 12-15 11:37:41.392 9804 10092 D P_BleDevice_ListenerProcessor [Native]: ABE(10092) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 11:37:41.394 9804 10092 D P_BleDevice_ListenerProcessor [Native]: ABE(10092) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 11:37:41.395 9804 9804 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 11:37:41.395 9804 9804 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 0B01017C 12-15 11:37:41.396 9804 9804 I BLE_CORE_PKT_RCV: 0B01017C onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : B, branchPosition:1 12-15 11:37:41.396 9804 9818 D P_BleDevice_ListenerProcessor [Native]: CAM(9818) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 11:37:41.398 9804 9804 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 11:37:41.398 9804 9804 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 070103FB 12-15 11:37:41.398 9804 9804 I BLE_CORE_PKT_RCV: 070103FB onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : 7, branchPosition:1 12-15 11:37:41.399 9804 9804 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 11:37:41.399 9804 9804 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 08010004 12-15 11:37:41.399 9804 9804 I BLE_CORE_PKT_RCV: 08010004 onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : 8, branchPosition:1
Android 10 + SweetBLUE 3.2.5 + default
UpdateThreadType
- No problem in this case
12-15 11:53:28.366 26719 26894 D P_BleDevice_ListenerProcessor [Native]: ABE(26894) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 11:53:28.368 26719 26719 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 11:53:28.368 26719 26719 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 0001070000000006001300090013 12-15 11:53:28.368 26719 26719 I BLE_CORE_PKT_RCV: 0001070000000006001300090013 onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : 0, branchPosition:1 12-15 11:53:28.376 26719 26894 D P_BleDevice_ListenerProcessor [Native]: ABE(26894) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 11:53:28.377 26719 26719 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 11:53:28.377 26719 26894 D P_BleDevice_ListenerProcessor [Native]: ABE(26894) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 11:53:28.377 26719 26719 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 09010150515146424169062313 12-15 11:53:28.377 26719 26719 I BLE_CORE_PKT_RCV: 09010150515146424169062313 onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : 9, branchPosition:1 12-15 11:53:28.378 26719 26894 D P_BleDevice_ListenerProcessor [Native]: ABE(26894) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 11:53:28.379 26719 26894 D P_BleDevice_ListenerProcessor [Native]: ABE(26894) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 11:53:28.381 26719 27759 D P_BleDevice_ListenerProcessor [Native]: CAM(27759) onCharacteristicChanged() [14:B4:57:CD:C7:DC] - characteristic=e7add780-b042-4876-aae1-112855353cc1 12-15 11:53:28.381 26719 26719 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 11:53:28.381 26719 26719 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 04010116 12-15 11:53:28.381 26719 26719 I BLE_CORE_PKT_RCV: 04010116 onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : 4, branchPosition:1 12-15 11:53:28.382 26719 26719 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 11:53:28.382 26719 26719 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 0B01017C 12-15 11:53:28.382 26719 26719 I BLE_CORE_PKT_RCV: 0B01017C onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : B, branchPosition:1 12-15 11:53:28.382 26719 26719 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 11:53:28.383 26719 26719 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 070103FB 12-15 11:53:28.383 26719 26719 I BLE_CORE_PKT_RCV: 070103FB onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : 7, branchPosition:1 12-15 11:53:28.384 26719 26719 I BLE_CORE: onBleNotify type : NOTIFICATION 12-15 11:53:28.384 26719 26719 I BLE_CORE: onCharacteristicChanged uuid : e7add780-b042-4876-aae1-112855353cc1, rawData : 08010004 12-15 11:53:28.385 26719 26719 I BLE_CORE_PKT_RCV: 08010004 onCharacteristicChanged UUID_CHARACTERISTIC_DATA, cmd : 8, branchPosition:1
-
This is a weird one.
Are all of the tests above taken from the same device/tablet?
This is what SweetBlue is doing when listening for notifications from the OS:
@Override public final void onCharacteristicChanged(final P_GattHolder gatt, final BleCharacteristic characteristic) { final byte[] value = characteristic.getValue() == null ? null : characteristic.getValue().clone(); final UUID characteristicUuid = characteristic.getUuid(); m_logger.log_native(LogOptions.LogLevel.DEBUG.nativeBit(), m_device.getMacAddress(), "characteristic=" + characteristicUuid.toString()); m_device.getIManager().getPostManager().runOrPostToUpdateThread(() -> onCharacteristicChanged_updateThread(gatt, characteristic, value)); }
That last method there eventually boils down to any listeners you have registered (there are 3 levels...one you set on the BleNotify object, a device global one, and then an app wide global one. Each of these will be called in that order.)
Can you also list all the BleManagerConfig options you have set?
Seems to be a weird thread problem, but it is unclear how, as each notification event is it's own object, and everything is basically running on the same thread. Only difference would be if you had the option
postCallbacksToMainThread
set totrue
(this is the default, if not explicitly set). But even if this is the case, I don't see how you could get any data corruption on the library/app side.I'll have to think on it a while.
-
@ryanbis Thank you for reply and advice. I answer to your questions one by one.
Are all of the tests above taken from the same device/tablet?
Sorry for my insufficient information. I've updated the table of Summary of our faced issue.
I use HUAWEI MediaPad T5 with Android 8.0.0 and Lenovo YT-X705F with Android 10.Can you also list all the BleManagerConfig options you have set?
I dumped all member of BleManagerConfig instance which we hand over to BleManager.get(). We changed
loggingOptions
as needed andupdateThreadType
only.12-20 14:59:59.391 10905 10905 E BLE_CORE: loggingOptions : com.idevicesinc.sweetblue.LogOptions@4c8969b 12-20 14:59:59.391 10905 10905 E BLE_CORE: timeTrackerSetting : Off 12-20 14:59:59.391 10905 10905 E BLE_CORE: logger : com.idevicesinc.sweetblue.defaults.DefaultLogger@e2d8a38 12-20 14:59:59.391 10905 10905 E BLE_CORE: defaultManagerStates : [Lcom.idevicesinc.sweetblue.BleManagerState;@8d11a11 12-20 14:59:59.391 10905 10905 E BLE_CORE: enableCrashResolver : false 12-20 14:59:59.391 10905 10905 E BLE_CORE: enableCrashResolverForReset : true 12-20 14:59:59.391 10905 10905 E BLE_CORE: stopScanOnPause : true 12-20 14:59:59.397 10905 10905 E BLE_CORE: scanClassicBoostLength : -1secs/-1000millis 12-20 14:59:59.398 10905 10905 E BLE_CORE: infiniteScanInterval : 10secs/10000millis 12-20 14:59:59.398 10905 10905 E BLE_CORE: infinitePauseInterval : 0.5secs/500millis 12-20 14:59:59.398 10905 10905 E BLE_CORE: autoScanDuringOta : false 12-20 14:59:59.398 10905 10905 E BLE_CORE: revertToClassicDiscoveryIfNeeded : true 12-20 14:59:59.398 10905 10905 E BLE_CORE: updateThreadType : HANDLER_THREAD 12-20 14:59:59.398 10905 10905 E BLE_CORE: updateHandler : null 12-20 14:59:59.399 10905 10905 E BLE_CORE: postCallbacksToMainThread : true 12-20 14:59:59.399 10905 10905 E BLE_CORE: manageCpuWakeLock : true 12-20 14:59:59.399 10905 10905 E BLE_CORE: requestBackgroundOperation : false 12-20 14:59:59.399 10905 10905 E BLE_CORE: autoPauseResumeDetection : true 12-20 14:59:59.401 10905 10905 E BLE_CORE: uhOhCallbackThrottle : 30secs/30000millis 12-20 14:59:59.401 10905 10905 E BLE_CORE: manageLastUhOhOnDisk : true 12-20 14:59:59.401 10905 10905 E BLE_CORE: blockingShutdown : false 12-20 14:59:59.402 10905 10905 E BLE_CORE: autoScanDelayAfterResume : 0.5secs/500millis 12-20 14:59:59.402 10905 10905 E BLE_CORE: autoScanDelayAfterBleTurnsOn : -1secs/-1000millis 12-20 14:59:59.402 10905 10905 E BLE_CORE: autoScanPauseTimeWhileAppIsBackgrounded : -1secs/-1000millis 12-20 14:59:59.403 10905 10905 E BLE_CORE: idealMinScanTime : 5secs/5000millis 12-20 14:59:59.403 10905 10905 E BLE_CORE: autoUpdateRate : 0.02secs/20millis 12-20 14:59:59.404 10905 10905 E BLE_CORE: defaultStatePollRate : 0.1secs/100millis 12-20 14:59:59.404 10905 10905 E BLE_CORE: idleUpdateRate : 0.5secs/500millis 12-20 14:59:59.404 10905 10905 E BLE_CORE: minTimeToIdle : 20secs/20000millis 12-20 14:59:59.405 10905 10905 E BLE_CORE: delayBetweenTasks : -1secs/-1000millis 12-20 14:59:59.405 10905 10905 E BLE_CORE: scanReportDelay : 0secs/0millis 12-20 14:59:59.405 10905 10905 E BLE_CORE: defaultScanFilter : null 12-20 14:59:59.405 10905 10905 E BLE_CORE: defaultNativeScanFilterList : [BluetoothLeScanFilter [m_deviceName=null, m_deviceAddress=null, mUuid=null, m_uuidMask=null, m_serviceDataUuid=null, m_serviceData=null, m_serviceDataMask=null, m_manufacturerId=-1, m_manufacturerData=null, m_manufacturerDataMask=null]] 12-20 14:59:59.405 10905 10905 E BLE_CORE: defaultDiscoveryListener : null 12-20 14:59:59.405 10905 10905 E BLE_CORE: scanApi : AUTO 12-20 14:59:59.406 10905 10905 E BLE_CORE: scanPower : AUTO 12-20 14:59:59.406 10905 10905 E BLE_CORE: updateLoopCallback : null 12-20 14:59:59.406 10905 10905 E BLE_CORE: serverFactory : com.idevicesinc.sweetblue.internal.android.IBluetoothServer$DefaultFactory@29c464d 12-20 14:59:59.406 10905 10905 E BLE_CORE: bluetoothManagerImplementation : com.idevicesinc.sweetblue.internal.android.AndroidBluetoothManager@6839502 12-20 14:59:59.406 10905 10905 E BLE_CORE: uuidNameMaps : null 12-20 14:59:59.406 10905 10905 E BLE_CORE: defaultListComparator : com.idevicesinc.sweetblue.BleManagerConfig$DeviceNameComparator@ef93e13