BLE<Bluetooth> : How to interpret nRF logs for BLE

Solution 1:

The logs are about the connection, discovery of services and subscription to a characteristic all concepts of BLE.

A device acting as Central after completing the connection with a peripheral device, discovers the services that the peripheral offers and subsequently subscribes to the characteristic discovered.

Here a guide

knowing this, it's easy interpreting the logs.

Success Response

Connection

V 12:56:50.091 Connecting to DD:70:98:0A:EB:B1... D 12:56:50.092 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M) D 12:56:50.715 [Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED D
12:56:50.722 [Callback] Connection state changed with status: 0 and new state: CONNECTED (2) I 12:56:50.722 Connected to DD:70:98:0A:EB:B1

Discovering services/characteristics and list them. Services and characteristics are identified by hex value and UUIDs.

V 12:56:50.749 Discovering services... D 12:56:50.749 gatt.discoverServices() I 12:56:51.050 Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms) D
12:56:51.418 [Callback] Services discovered with status: 0 I
12:56:51.418 Services discovered V 12:56:51.448 Generic Access (0x1800)

  • Device Name [R] (0x2A00)
  • Appearance [R] (0x2A01)
  • Peripheral Preferred Connection Parameters [R] (0x2A04)
  • Central Address Resolution [R] (0x2AA6) Generic Attribute (0x1801)
  • Service Changed [I] (0x2A05) Client Characteristic Configuration (0x2902) Unknown Service (569a1101-b87f-490c-92cb-11ba5ea5167c)
  • Unknown Characteristic [N] (569a2000-b87f-490c-92cb-11ba5ea5167c) Client Characteristic Configuration (0x2902)
  • Unknown Characteristic [W WNR] (569a2001-b87f-490c-92cb-11ba5ea5167c)
  • Unknown Characteristic [N] (569a2002-b87f-490c-92cb-11ba5ea5167c) Client Characteristic Configuration (0x2902)
  • Unknown Characteristic [W WNR] (569a2003-b87f-490c-92cb-11ba5ea5167c)

Subscription to a characteristic

12:56:51.448 gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb,true) D 12:56:51.450 gatt.setCharacteristicNotification(569a2000-b87f-490c-92cb-11ba5ea5167c, true) D 12:56:51.452 gatt.setCharacteristicNotification(569a2002-b87f-490c-92cb-11ba5ea5167c, true) I 12:56:51.484 Connection parameters updated (interval: 48.75ms, latency: 0, timeout: 5000ms) V 12:57:12.847 Enabling notifications for 569a2000-b87f-490c-92cb-11ba5ea5167c

Values coming from the subscribed characteristic. The values are in hex format.

I 12:58:13.986 Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 07-23 A
12:58:13.986 "(0x) 07-23" received

The strange values you see in the Bad Response ("AT", "%S" "&W") are the hex to ASCII translation of data received. The app tries to translate the bytes received from the characteristic into ASCII characters. Example

I 14:50:20.914 Notification received from 569a2000-b87f-490c92cb-11ba5ea5167c, value: (0x) 41-54, "AT" A
14:50:20.914 "(0x) 41-54, "AT"" received

Hex value Ascii
0x41 A
0x54 T

So 0x 41 54 -->AT