BLE<Bluetooth>:如何解释 BLE 的 nRF 日志

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

我们的 BLE(蓝牙)设备运行良好。大多数时候它都有效,但有时我们会收到错误的响应并收集其日志。这些日志是从 nRF android 应用程序收集的。

这里有一些问题:

  1. 你能解释这种记录行为吗?
  2. 错误响应命令中的“AT”“%S”“&W”有什么意义?
  3. 如果你知道一些好的参考资料;如何解释这些日志?请分享。

成功响应

    nRF Connect, 2021-11-29
G3-00000500 (DD:70:98:0A:EB:B1)
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
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)
D   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
D   12:57:12.847    gatt.setCharacteristicNotification(569a2000-b87f-490c-92cb-11ba5ea5167c, true)
D   12:57:12.850    gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x0100)
I   12:57:12.938    Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 01-00
A   12:57:12.938    "Notifications enabled" sent
V   12:57:12.940    Notifications enabled for 569a2000-b87f-490c-92cb-11ba5ea5167c
V   12:58:13.875    Writing request to characteristic 569a2001-b87f-490c-92cb-11ba5ea5167c
D   12:58:13.875    gatt.writeCharacteristic(569a2001-b87f-490c-92cb-11ba5ea5167c, value=0x07020008805B8B7B)
I   12:58:13.976    Data written to 569a2001-b87f-490c-92cb-11ba5ea5167c, value: (0x) 07-02-00-08-80-5B-8B-7B
A   12:58:13.976    "(0x) 07-02-00-08-80-5B-8B-7B" sent
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
I   12:58:13.988    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 00-21
A   12:58:13.988    "(0x) 00-21" received
I   12:58:13.989    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 0C-00
A   12:58:13.989    "(0x) 0C-00" received
I   12:58:13.990    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 00
A   12:58:13.990    "(0x) 00" received
I   12:58:13.990    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 01-F4
A   12:58:13.990    "(0x) 01-F4" received
I   12:58:13.990    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 03-01-02-00-00-0A-0C-01-00-1E-00-00-00-00-00-00-01-3A-00-00
A   12:58:13.990    "(0x) 03-01-02-00-00-0A-0C-01-00-1E-00-00-00-00-00-00-01-3A-00-00" received
I   12:58:13.990    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) D3-86-BD-79
A   12:58:13.990    "(0x) D3-86-BD-79" received

不良反应

nRF Connect, 2021-11-29
G3-00000500 (DD:70:98:0A:EB:B1)
V   14:49:26.173    Connecting to DD:70:98:0A:EB:B1...
D   14:49:26.174    gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M)
D   14:49:26.610    [Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
I   14:49:26.610    Connected to DD:70:98:0A:EB:B1
D   14:49:26.627    [Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
V   14:49:26.629    Discovering services...
D   14:49:26.629    gatt.discoverServices()
I   14:49:26.945    Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
D   14:49:27.261    [Callback] Services discovered with status: 0
I   14:49:27.261    Services discovered
V   14:49:27.271    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)
D   14:49:27.271    gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true)
D   14:49:27.273    gatt.setCharacteristicNotification(569a2000-b87f-490c-92cb-11ba5ea5167c, true)
D   14:49:27.275    gatt.setCharacteristicNotification(569a2002-b87f-490c-92cb-11ba5ea5167c, true)
I   14:49:27.327    Connection parameters updated (interval: 48.75ms, latency: 0, timeout: 5000ms)
V   14:49:57.013    Enabling notifications for 569a2000-b87f-490c-92cb-11ba5ea5167c
D   14:49:57.013    gatt.setCharacteristicNotification(569a2000-b87f-490c-92cb-11ba5ea5167c, true)
D   14:49:57.015    gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x0100)
I   14:49:57.073    Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 01-00
A   14:49:57.073    "Notifications enabled" sent
V   14:49:57.074    Notifications enabled for 569a2000-b87f-490c-92cb-11ba5ea5167c
V   14:50:08.813    Writing request to characteristic 569a2001-b87f-490c-92cb-11ba5ea5167c
D   14:50:08.813    gatt.writeCharacteristic(569a2001-b87f-490c-92cb-11ba5ea5167c, value=0x07020008805B8B7B)
I   14:50:08.870    Data written to 569a2001-b87f-490c-92cb-11ba5ea5167c, value: (0x) 07-02-00-08-80-5B-8B-7B
A   14:50:08.870    "(0x) 07-02-00-08-80-5B-8B-7B" sent
I   14:50:08.875    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 07-23
A   14:50:08.875    "(0x) 07-23" received
I   14:50:08.876    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 00-21
A   14:50:08.876    "(0x) 00-21" received
I   14:50:08.876    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 0C-00
A   14:50:08.876    "(0x) 0C-00" received
I   14:50:08.876    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 00
A   14:50:08.876    "(0x) 00" received
I   14:50:08.876    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 01-F4
A   14:50:08.876    "(0x) 01-F4" received
I   14:50:08.876    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 03-01-02-00-00-0A-0C-01-00-1E-00-00-00-00-00-00-01-3A-00-00
A   14:50:08.876    "(0x) 03-01-02-00-00-0A-0C-01-00-1E-00-00-00-00-00-00-01-3A-00-00" received
I   14:50:08.876    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) D3-86-BD-79-07-23
A   14:50:08.876    "(0x) D3-86-BD-79-07-23" received
I   14:50:20.914    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 41-54, "AT"
A   14:50:20.914    "(0x) 41-54, "AT"" received
I   14:50:20.915    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 25-53, "%S"
A   14:50:20.915    "(0x) 25-53, "%S"" received
I   14:50:20.915    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 20-30, " 0"
A   14:50:20.915    "(0x) 20-30, " 0"" received
I   14:50:20.916    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 20, " "
A   14:50:20.916    "(0x) 20, " "" received
I   14:50:20.916    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 3D-20, "= "
A   14:50:20.916    "(0x) 3D-20, "= "" received
I   14:50:20.916    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 22-47-33-2D-30-30-30-30-30-35-30-30-22-0D
A   14:50:20.916    "(0x) 22-47-33-2D-30-30-30-30-30-35-30-30-22-0D" received
I   14:50:21.111    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 41-54, "AT"
A   14:50:21.111    "(0x) 41-54, "AT"" received
I   14:50:21.111    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 53-20, "S "
A   14:50:21.111    "(0x) 53-20, "S "" received
I   14:50:21.112    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 31-30, "10"
A   14:50:21.112    "(0x) 31-30, "10"" received
I   14:50:21.112    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 33, "3"
A   14:50:21.112    "(0x) 33, "3"" received
I   14:50:21.112    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 20-3D, " ="
A   14:50:21.112    "(0x) 20-3D, " ="" received
I   14:50:21.113    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 20-30-0D
A   14:50:21.113    "(0x) 20-30-0D" received
I   14:50:21.351    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 41-54, "AT"
A   14:50:21.351    "(0x) 41-54, "AT"" received
I   14:50:21.400    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 53-20, "S "
A   14:50:21.400    "(0x) 53-20, "S "" received
I   14:50:21.400    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 31-30, "10"
A   14:50:21.400    "(0x) 31-30, "10"" received
I   14:50:21.401    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 30, "0"
A   14:50:21.401    "(0x) 30, "0"" received
I   14:50:21.401    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 20-3D, " ="
A   14:50:21.401    "(0x) 20-3D, " ="" received
I   14:50:21.401    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 20-31-32-31-0D
A   14:50:21.401    "(0x) 20-31-32-31-0D" received
I   14:50:21.545    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 41-54, "AT"
A   14:50:21.545    "(0x) 41-54, "AT"" received
I   14:50:21.545    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 26-57, "&W"
A   14:50:21.545    "(0x) 26-57, "&W"" received
I   14:50:21.545    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 0D
A   14:50:21.545    "(0x) 0D" received
I   14:50:38.953    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 41-54, "AT"
A   14:50:38.953    "(0x) 41-54, "AT"" received
I   14:50:38.954    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 25-53, "%S"
A   14:50:38.954    "(0x) 25-53, "%S"" received
I   14:50:38.954    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 20-30, " 0"
A   14:50:38.954    "(0x) 20-30, " 0"" received
I   14:50:38.954    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 20, " "
A   14:50:38.954    "(0x) 20, " "" received
I   14:50:38.955    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 3D-20, "= "
A   14:50:38.955    "(0x) 3D-20, "= "" received
I   14:50:38.955    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 22-47-33-2D-30-30-30-30-30-35-30-30-22-0D
A   14:50:38.955    "(0x) 22-47-33-2D-30-30-30-30-30-35-30-30-22-0D" received
I   14:50:39.145    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 41-54, "AT"
A   14:50:39.146    "(0x) 41-54, "AT"" received
I   14:50:39.148    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 53-20, "S "
A   14:50:39.148    "(0x) 53-20, "S "" received
I   14:50:39.151    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 31-30, "10"
A   14:50:39.151    "(0x) 31-30, "10"" received
I   14:50:39.152    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 33, "3"
A   14:50:39.152    "(0x) 33, "3"" received
I   14:50:39.152    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 20-3D, " ="
A   14:50:39.152    "(0x) 20-3D, " ="" received
I   14:50:39.153    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 20-30-0D
A   14:50:39.153    "(0x) 20-30-0D" received
I   14:50:39.342    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 41-54, "AT"
A   14:50:39.342    "(0x) 41-54, "AT"" received
I   14:50:39.342    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 53-20, "S "
A   14:50:39.342    "(0x) 53-20, "S "" received
I   14:50:39.343    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 31-30, "10"
A   14:50:39.343    "(0x) 31-30, "10"" received
I   14:50:39.343    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 30, "0"
A   14:50:39.343    "(0x) 30, "0"" received
I   14:50:39.343    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 20-3D, " ="
A   14:50:39.343    "(0x) 20-3D, " ="" received
I   14:50:39.344    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 20-31-32-31-0D
A   14:50:39.344    "(0x) 20-31-32-31-0D" received
I   14:50:39.535    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 41-54, "AT"
A   14:50:39.535    "(0x) 41-54, "AT"" received
I   14:50:39.535    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 26-57, "&W"
A   14:50:39.535    "(0x) 26-57, "&W"" received
I   14:50:39.536    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 0D
A   14:50:39.536    "(0x) 0D" received
I   14:50:56.943    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 41-54, "AT"
A   14:50:56.943    "(0x) 41-54, "AT"" received
I   14:50:56.943    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 25-53, "%S"
A   14:50:56.943    "(0x) 25-53, "%S"" received
I   14:50:56.944    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 20-30, " 0"
A   14:50:56.944    "(0x) 20-30, " 0"" received
I   14:50:56.944    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 20, " "
A   14:50:56.944    "(0x) 20, " "" received
I   14:50:56.944    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 3D-20, "= "
A   14:50:56.944    "(0x) 3D-20, "= "" received
I   14:50:56.945    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 22-47-33-2D-30-30-30-30-30-35-30-30-22-0D
A   14:50:56.945    "(0x) 22-47-33-2D-30-30-30-30-30-35-30-30-22-0D" received
I   14:50:57.134    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 41-54, "AT"
A   14:50:57.134    "(0x) 41-54, "AT"" received
I   14:50:57.135    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 53-20, "S "
A   14:50:57.135    "(0x) 53-20, "S "" received
I   14:50:57.135    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 31-30, "10"
A   14:50:57.135    "(0x) 31-30, "10"" received
I   14:50:57.135    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 33, "3"
A   14:50:57.135    "(0x) 33, "3"" received
I   14:50:57.135    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 20-3D, " ="
A   14:50:57.136    "(0x) 20-3D, " ="" received
I   14:50:57.136    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 20-30-0D
A   14:50:57.136    "(0x) 20-30-0D" received
I   14:50:57.330    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 41-54, "AT"
A   14:50:57.330    "(0x) 41-54, "AT"" received
I   14:50:57.330    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 53-20, "S "
A   14:50:57.330    "(0x) 53-20, "S "" received
I   14:50:57.330    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 31-30, "10"
A   14:50:57.330    "(0x) 31-30, "10"" received
I   14:50:57.331    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 30, "0"
A   14:50:57.331    "(0x) 30, "0"" received
I   14:50:57.331    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 20-3D, " ="
A   14:50:57.331    "(0x) 20-3D, " ="" received
I   14:50:57.331    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 20-31-32-31-0D
A   14:50:57.331    "(0x) 20-31-32-31-0D" received
I   14:50:57.573    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 41-54, "AT"
A   14:50:57.573    "(0x) 41-54, "AT"" received
I   14:50:57.573    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 26-57, "&W"
A   14:50:57.573    "(0x) 26-57, "&W"" received
I   14:50:57.573    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 0D
A   14:50:57.573    "(0x) 0D" received
I   14:51:14.978    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 41-54, "AT"
A   14:51:14.978    "(0x) 41-54, "AT"" received
I   14:51:14.979    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 25-53, "%S"
A   14:51:14.979    "(0x) 25-53, "%S"" received
I   14:51:14.979    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 20-30, " 0"
A   14:51:14.979    "(0x) 20-30, " 0"" received
I   14:51:14.980    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 20, " "
A   14:51:14.980    "(0x) 20, " "" received
I   14:51:14.980    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 3D-20, "= "
A   14:51:14.980    "(0x) 3D-20, "= "" received
I   14:51:14.980    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 22-47-33-2D-30-30-30-30-30-35-30-30-22-0D
A   14:51:14.980    "(0x) 22-47-33-2D-30-30-30-30-30-35-30-30-22-0D" received
I   14:51:15.219    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 41-54, "AT"
A   14:51:15.219    "(0x) 41-54, "AT"" received
I   14:51:15.220    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 53-20, "S "
A   14:51:15.220    "(0x) 53-20, "S "" received
I   14:51:15.220    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 31-30, "10"
A   14:51:15.220    "(0x) 31-30, "10"" received
I   14:51:15.220    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 33, "3"
A   14:51:15.220    "(0x) 33, "3"" received
I   14:51:15.222    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 20-3D, " ="
A   14:51:15.222    "(0x) 20-3D, " ="" received
I   14:51:15.223    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 20-30-0D
A   14:51:15.223    "(0x) 20-30-0D" received
I   14:51:15.367    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 41-54, "AT"
A   14:51:15.367    "(0x) 41-54, "AT"" received
I   14:51:15.367    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 53-20, "S "
A   14:51:15.367    "(0x) 53-20, "S "" received
I   14:51:15.367    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 31-30, "10"
A   14:51:15.367    "(0x) 31-30, "10"" received
I   14:51:15.368    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 30, "0"
A   14:51:15.368    "(0x) 30, "0"" received
I   14:51:15.368    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 20-3D, " ="
A   14:51:15.368    "(0x) 20-3D, " ="" received
I   14:51:15.368    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 20-31-32-31-0D
A   14:51:15.368    "(0x) 20-31-32-31-0D" received
I   14:51:15.564    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 41-54, "AT"
A   14:51:15.564    "(0x) 41-54, "AT"" received
I   14:51:15.565    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 26-57, "&W"
A   14:51:15.565    "(0x) 26-57, "&W"" received
I   14:51:15.565    Notification received from 569a2000-b87f-490c-92cb-11ba5ea5167c, value: (0x) 0D
A   14:51:15.565    "(0x) 0D" received

谢谢。

日志是关于连接发现服务和订阅特征BLE的所有概念。

作为Central的设备在完成与外围设备的连接后,发现外围设备提供的服务并随后订阅发现的特性。

这里是guide

知道这一点,解释日志就很容易了。

成功响应

连接

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

发现 services/characteristics 并列出它们。服务和特征由 hex valueUUIDs.

标识

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)

订阅一个特征

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

来自订阅特征的值。 采用十六进制格式。

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

您在错误响应(“AT”、“%S”、“&W”)中看到的奇怪值是接收到的数据的十六进制到 ASCII 的转换。应用程序尝试将从特征接收到的字节转换为 ASCII 字符。 例子

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

所以 0x 41 54 -->AT