Open phucluke opened 1 year ago
@phucluke are you able to see if you can read this service/characteristic with nrf Connect on your Android phone?
From the adb logs, there should be a bunch more data in theory about the underlying BLE protocol between those entries you've logged there. Are you able to extra this and include it also?
I guess the last fairly normal question is does this happen across all android versions/devices, or only specific ones?
Hi @peitschie Thanks for your support. with nrf Connect, I was able to scan and connect the service/characteristic. Here is the screenshot: The value needs to be decoded to show but what we need is to get the data first. We tested on some kind of android devices and got the same issue.
Have you tried reading the values in nrf Connect via those up/down arrows next to the Unknown Characteristic heading there?
Hi @peitschie I got nothing when clicking on the down arrow on nrf Connet but we could get data with Bluefruit Connect
@phucluke can you try using this characteristic UUID instead? ADAFFF02-C332-42A8-93BD-25E905756CB8
Based on adafruit's documentation, it seems their 16-bit UUID is not a standard Bluetooth one: https://github.com/adafruit/bluetooth-low-energy#adafruit
Just to confirm this, in the connect
callback you should receive a device info object that has a list of all the services and characteristics discovered on the device. Can you paste that here as well?
Hi @peitschie,
I tried but getting error: Characteristic adafff02-c332-42a8-93bd-25e905756cb8 not found
I also tried to build and install the app for an iOS device and could get the data. It happened only on Android.
Here is the peripheral object got in the connect callback:
{
"name": "BLE-9909",
"id": "C0:00:00:00:51:40",
"advertising": {},
"rssi": -80,
"services": [
"1800",
"1801",
"180a",
"180f",
"ff01"
],
"characteristics": [
{
"service": "1800",
"characteristic": "2a00",
"properties": [
"Read"
]
},
{
"service": "1800",
"characteristic": "2a01",
"properties": [
"Read"
]
},
{
"service": "1800",
"characteristic": "2a04",
"properties": [
"Read"
]
},
{
"service": "1801",
"characteristic": "2a05",
"properties": [
"Indicate"
],
"descriptors": [
{
"uuid": "2902"
}
]
},
{
"service": "180a",
"characteristic": "2a23",
"properties": [
"Read"
]
},
{
"service": "180a",
"characteristic": "2a24",
"properties": [
"Read"
]
},
{
"service": "180a",
"characteristic": "2a25",
"properties": [
"Read"
]
},
{
"service": "180a",
"characteristic": "2a26",
"properties": [
"Read"
]
},
{
"service": "180a",
"characteristic": "2a27",
"properties": [
"Read"
]
},
{
"service": "180a",
"characteristic": "2a28",
"properties": [
"Read"
]
},
{
"service": "180a",
"characteristic": "2a29",
"properties": [
"Read"
]
},
{
"service": "180a",
"characteristic": "2a2a",
"properties": [
"Read"
]
},
{
"service": "180a",
"characteristic": "2a50",
"properties": [
"Read"
]
},
{
"service": "180f",
"characteristic": "2a19",
"properties": [
"Read",
"Notify"
],
"descriptors": [
{
"uuid": "2902"
},
{
"uuid": "2908"
}
]
},
{
"service": "ff01",
"characteristic": "ff02",
"properties": [
"Read",
"Write",
"Notify"
],
"descriptors": [
{
"uuid": "2902"
},
{
"uuid": "2901"
}
]
},
{
"service": "ff01",
"characteristic": "ff10",
"properties": [
"Read"
],
"descriptors": [
{
"uuid": "2901"
}
]
}
]
}
If you're able to help with debugging a bit, we might be able to dig a bit more.
That error is thrown here: https://github.com/don/cordova-plugin-ble-central/blob/master/src/android/Peripheral.java#L775C54-L781
Are you able to get Android studio attached and drop a breakpoint there so you step through findWritableCharacteristic
?
I wonder if the issue is that we are looking for the expanded characteristicUUID
, but the service discovery only sees the short one here https://github.com/don/cordova-plugin-ble-central/blob/master/src/android/Peripheral.java#L817
If you can help me figure out what getUuid
returns for the ff02
characteristic there, I can probably figure out the code changes to make this function.
Hi @peitschie
I very much appreciate your support.
I was debugging on findReadableCharacteristic
and it was fine to get the characteristic
And I found the exception here
I experienced the same issue and jumped to this thread from Internet search.
Great if we can have any solution for it. Thanks.
@phucluke unfortunately I've got no great insights here 🤔
The fact that this fails in both this plugin and nrf Connect means it's more likely a quirk in the peripheral, but I'm stumped as to why Bluefruit functions better here.
Bluefruit's own code here seems to be following exactly the same pattern as this plugin: https://github.com/adafruit/Bluefruit_LE_Connect_Android_V2/blob/master/app/src/main/java/com/adafruit/bluefruit/le/connect/ble/central/BlePeripheral.java#L706
Unfortunately, I don't have any access to a local device to try anything out myself.
Are there any support forums within the adafruit community that might have some ideas?
Hi team,
I'm building a cordova app for Android for reading data from device BLE-9909 Meter Powered by YINMIK. The scanning and connecting with plugin are fine except the reading data. I'm getting the following error. Could you please provide a direction? Thanks. Notes: Reading battery service 0x180F/characteristics 0x2A19 works on Android except the service FF01/characteristics FF02. The issue doesn't happen on BLE browser.
Here is the code snippet:
And device document