What's the nRF Connect data format when writing chraracteristics ?

Here is a stacktrace from a device I got using the nRF Connect mobile app on Android.

nRF Connect, 2024-05-11
Device Name (A4:XX:XX:XX:XX:7C)
D 13:40:23.035 [Callback] Connection state changed with status: 8 and new state: DISCONNECTED (0)
E 13:40:23.036 Error 8 (0x8): GATT CONN TIMEOUT
I 13:40:23.036 Disconnected
D 13:40:23.096 [Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED
D 13:40:25.687 gatt.close()
D 13:40:25.691 wait(200)
V 13:40:25.892 Connecting to A4:XX:XX:XX:XX:7C...
D 13:40:25.892 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M)
D 13:40:27.945 [Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
D 13:40:27.948 [Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
I 13:40:27.948 Connected to A4:XX:XX:XX:XX:7C
D 13:40:27.951 wait(1600ms)
I 13:40:29.080 Connection parameters updated (interval: 20.0ms, latency: 49, timeout: 4000ms)
V 13:40:29.551 Discovering services...
D 13:40:29.551 gatt.discoverServices()
D 13:40:29.560 [Callback] Services discovered with status: 0
I 13:40:29.560 Services discovered
V 13:40:29.564 Generic Access (0x1800)
- Device Name [N R] (0x2A00)
- Appearance [R] (0x2A01)
- Peripheral Preferred Connection Parameters [R] (0x2A04)
Generic Attribute (0x1801)
- Service Changed [I] (0x2A05)
Client Characteristic Configuration (0x2902)
Device Information (0x180A)
- PnP ID [R] (0x2A50)
Human Interface Device (0x1812)
- Protocol Mode [R WNR] (0x2A4E)
- Boot Keyboard Input Report [N R] (0x2A22)
Client Characteristic Configuration (0x2902)
- Boot Keyboard Output Report [R W WNR] (0x2A32)
- Report [N R] (0x2A4D)
Client Characteristic Configuration (0x2902)
Report Reference (0x2908)
- Report [N R] (0x2A4D)
Client Characteristic Configuration (0x2902)
Report Reference (0x2908)
- Report [R W WNR] (0x2A4D)
Report Reference (0x2908)
- Report Map [R] (0x2A4B)
External Report Reference (0x2907)
- HID Information [R] (0x2A4A)
- HID Control Point [WNR] (0x2A4C)
Battery Service (0x180F)
- Battery Level [N R] (0x2A19)
Client Characteristic Configuration (0x2902)
Unknown Service (0c6b000a-2f43-7eb4-0646-e5c28162cf6c)
- Unknown Characteristic [N R] (0c6b000b-2f43-7eb4-0646-e5c28162cf6c)
Client Characteristic Configuration (0x2902)
Characteristic User Description (0x2901)
- Unknown Characteristic [R WNR] (0c6b000c-2f43-7eb4-0646-e5c28162cf6c)
Characteristic User Description (0x2901)
D 13:40:29.564 gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true)
D 13:40:29.568 gatt.setCharacteristicNotification(00002a22-0000-1000-8000-00805f9b34fb, true)
D 13:40:29.569 gatt.setCharacteristicNotification(00002a4d-0000-1000-8000-00805f9b34fb, true)
D 13:40:29.570 gatt.setCharacteristicNotification(00002a4d-0000-1000-8000-00805f9b34fb, true)
D 13:40:29.571 gatt.setCharacteristicNotification(00002a19-0000-1000-8000-00805f9b34fb, true)
D 13:40:29.572 gatt.setCharacteristicNotification(0c6b000b-2f43-7eb4-0646-e5c28162cf6c, true)
V 13:41:08.825 Writing command to characteristic 0c6b000c-2f43-7eb4-0646-e5c28162cf6c
D 13:41:08.825 gatt.writeCharacteristic(0c6b000c-2f43-7eb4-0646-e5c28162cf6c, value=0x30055175145E9E72)
I 13:41:08.838 Data written to 0c6b000c-2f43-7eb4-0646-e5c28162cf6c, value: (0x) 30-05-51-75-14-5E-9E-72
A 13:41:08.838 "(0x) 30-05-51-75-14-5E-9E-72" sent
I 13:41:08.880 Notification received from 0c6b000b-2f43-7eb4-0646-e5c28162cf6c, value: (0x) 30-05-51-01-00-00-00-F5
A 13:41:08.880 "(0x) 30-05-51-01-00-00-00-F5" received
V 13:41:38.927 Writing command to characteristic 0c6b000c-2f43-7eb4-0646-e5c28162cf6c
D 13:41:38.927 gatt.writeCharacteristic(0c6b000c-2f43-7eb4-0646-e5c28162cf6c, value=0x2111000000000000000000000000000000000000)
I 13:41:38.932 Data written to 0c6b000c-2f43-7eb4-0646-e5c28162cf6c, value: (0x) 21-11-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
A 13:41:38.932 "(0x) 21-11-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00" sent
I 13:41:39.042 Notification received from 0c6b000b-2f43-7eb4-0646-e5c28162cf6c, value: (0x) 21-12-00-00-0A-D7-A3-3C-C3-F5-A8-3E-00-00-80-3F-00-00-00-00
A 13:41:39.042 "(0x) 21-12-00-00-0A-D7-A3-3C-C3-F5-A8-3E-00-00-80-3F-00-00-00-00" received
I 13:41:39.061 Notification received from 0c6b000b-2f43-7eb4-0646-e5c28162cf6c, value: (0x) 21-12-00-01-C3-F5-A8-3E-00-00-80-3F-00-00-00-00-7B-14-AE-3E
A 13:41:39.061 "(0x) 21-12-00-01-C3-F5-A8-3E-00-00-80-3F-00-00-00-00-7B-14-AE-3E" received
I 13:41:39.062 Notification received from 0c6b000b-2f43-7eb4-0646-e5c28162cf6c, value: (0x) 21-12-00-02-00-00-80-3F-00-00-00-00-0A-D7-A3-3C-C3-F5-A8-3E
A 13:41:39.062 "(0x) 21-12-00-02-00-00-80-3F-00-00-00-00-0A-D7-A3-3C-C3-F5-A8-3E" received


I am trying to use the react native library react-native-ble-plx to write characteristics.

If we take the very first data sent 

V 13:41:08.825 Writing command to characteristic 0c6b000c-2f43-7eb4-0646-e5c28162cf6c
D 13:41:08.825 gatt.writeCharacteristic(0c6b000c-2f43-7eb4-0646-e5c28162cf6c, value=0x30055175145E9E72)
I 13:41:08.838 Data written to 0c6b000c-2f43-7eb4-0646-e5c28162cf6c, value: (0x) 30-05-51-75-14-5E-9E-72
A 13:41:08.838 "(0x) 30-05-51-75-14-5E-9E-72" sent
I 13:41:08.880 Notification received from 0c6b000b-2f43-7eb4-0646-e5c28162cf6c, value: (0x) 30-05-51-01-00-00-00-F5
A 13:41:08.880 "(0x) 30-05-51-01-00-00-00-F5" received

I tried everything:

  • 0x30055175145E9E72
  • (0x) 30-05-51-75-14-5E-9E-72
  • 30-05-51-75-14-5E-9E-72
  • MHgzMDA1NTE3NTE0NUU5RTcy // value in base64

I am looking to get feedback from the device as we can see "received" in the logs.
I always have errors - or no feedback.

My question is How does nRF connect works under the hood to send data? should I send string `30055175145E9E72`? with extra `0x`? or `(0x) ` or not? I am lost.

Related