首页 > 解决方案 > 错误:未找到属性 (0x0a) - 当我尝试订阅 Arduino Nano 33 BLE Sense 上的 BLE 特性时

问题描述

我正在使用Noble.js连接我的Arduino Nano 33 BLE Sense。一切正常,而不是订阅。当我尝试通过 订阅时characteristic.subscribe([callback(error)]);,我在 上看到以下内容sudo btmon,相关部分如下:

ACL Data RX: Handle 64 flags 0x02 dlen 9                                                                                     
  ATT: Error Response (0x01) len 4
    Read By Type Request (0x08)
    Handle: 0x0013
    Error: Attribute Not Found (0x0a)

如果我们从这里检查标志,它会说同样的事情。我可以通过通用 BLE 应用程序订阅,没有任何问题。那么,我该如何进一步调试呢?

BlueZ 版本是 5.50。

完整btmon日志:

> HCI Event: LE Meta Event (0x3e) plen 18                                                                                      #101 [hci0] 216.091528
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Scan response - SCAN_RSP (0x04)
        Address type: Public (0x00)
        Address: 09:16:8C:47:5F:71 (OUI 09-16-8C)
        Data length: 6
        Name (complete): Nano
        RSSI: -73 dBm (0xb7)
    < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2                            #166 [hci0] 20.855945
        Scanning: Disabled (0x00)
        Filter duplicates: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4                                       #167 [hci0] 20.856820
      LE Set Scan Enable (0x08|0x000c) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Create Connection (0x08|0x000d) plen 25                         #168 [hci0] 20.861549
        Scan interval: 60.000 msec (0x0060)
        Scan window: 30.000 msec (0x0030)
        Filter policy: White list is not used (0x00)
        Peer address type: Public (0x00)
        Peer address: 09:16:8C:47:5F:71 (OUI 09-16-8C)
        Own address type: Public (0x00)
        Min connection interval: 7.50 msec (0x0006)
        Max connection interval: 15.00 msec (0x000c)
        Connection latency: 0 (0x0000)
        Supervision timeout: 2000 msec (0x00c8)
        Min connection length: 2.500 msec (0x0004)
        Max connection length: 3.750 msec (0x0006)
> HCI Event: Command Status (0x0f) plen 4                                         #169 [hci0] 20.862080
      LE Create Connection (0x08|0x000d) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 19                                         #170 [hci0] 21.168187
      LE Connection Complete (0x01)
        Status: Success (0x00)
        Handle: 64
        Role: Master (0x00)
        Peer address type: Public (0x00)
        Peer address: 09:16:8C:47:5F:71 (OUI 09-16-8C)
        Connection interval: 15.00 msec (0x000c)
        Connection latency: 0 (0x0000)
        Supervision timeout: 2000 msec (0x00c8)
        Master clock accuracy: 0x00
@ MGMT Event: Device Connected (0x000b) plen 13                               {0x0002} [hci0] 21.168288
        LE Address: 09:16:8C:47:5F:71 (OUI 09-16-8C)
        Flags: 0x00000000
        Data length: 0
@ MGMT Event: Device Connected (0x000b) plen 13                               {0x0001} [hci0] 21.168288
        LE Address: 09:16:8C:47:5F:71 (OUI 09-16-8C)
        Flags: 0x00000000
        Data length: 0
< HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2                  #171 [hci0] 21.168529
        Handle: 64
> HCI Event: Command Status (0x0f) plen 4                                         #172 [hci0] 21.169549
      LE Read Remote Used Features (0x08|0x0016) ncmd 1
        Status: Success (0x00)
> HCI Event: Command Complete (0x0e) plen 14                                      #173 [hci0] 21.169670
      LE Read Remote Used Features (0x08|0x0016) ncmd 1
        Status: Success (0x00)
        00 00 00 00 00 00 00 00 00 00                    ..........      
> HCI Event: LE Meta Event (0x3e) plen 12                                         #174 [hci0] 21.187752
      LE Read Remote Used Features (0x04)
        Status: Success (0x00)
        Handle: 64
        Features: 0x2f 0x00 0x00 0x00 0x00 0x00 0x00 0x00
          LE Encryption
          Connection Parameter Request Procedure
          Extended Reject Indication
          Slave-initiated Features Exchange
          LE Data Packet Length Extension
< ACL Data TX: Handle 64 flags 0x00 dlen 7                                        #175 [hci0] 21.196651
      ATT: Exchange MTU Request (0x02) len 2
        Client RX MTU: 256
> ACL Data RX: Handle 64 flags 0x02 dlen 7                                        #176 [hci0] 21.232587
      ATT: Exchange MTU Response (0x03) len 2
        Server RX MTU: 247
< ACL Data TX: Handle 64 flags 0x00 dlen 11                                       #177 [hci0] 21.236291
      ATT: Read By Group Type Request (0x10) len 6
        Handle range: 0x0001-0xffff
        Attribute group type: Primary Service (0x2800)
> HCI Event: Number of Completed Packets (0x13) plen 5                            #178 [hci0] 21.262750
        Num handles: 1
        Handle: 64
        Count: 2
> ACL Data RX: Handle 64 flags 0x02 dlen 24                                       #179 [hci0] 21.278151
      ATT: Read By Group Type Response (0x11) len 19
        Attribute data length: 6
        Attribute group list: 3 entries
        Handle range: 0x0001-0x0005
        UUID: Generic Access Profile (0x1800)
        Handle range: 0x0006-0x0009
        UUID: Generic Attribute Profile (0x1801)
        Handle range: 0x000a-0x0013
        UUID: Environmental Sensing (0x181a)
< ACL Data TX: Handle 64 flags 0x00 dlen 11                                       #180 [hci0] 21.280267
      ATT: Read By Group Type Request (0x10) len 6
        Handle range: 0x0014-0xffff
        Attribute group type: Primary Service (0x2800)
> ACL Data RX: Handle 64 flags 0x02 dlen 9                                        #181 [hci0] 21.307537
      ATT: Error Response (0x01) len 4
        Read By Group Type Request (0x10)
        Handle: 0x0014
        Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 64 flags 0x00 dlen 11                                       #182 [hci0] 21.310329
      ATT: Read By Type Request (0x08) len 6
        Handle range: 0x0001-0x0005
        Attribute type: Characteristic (0x2803)
> HCI Event: Number of Completed Packets (0x13) plen 5                            #183 [hci0] 21.322723
        Num handles: 1
        Handle: 64
        Count: 2
> ACL Data RX: Handle 64 flags 0x02 dlen 20                                       #184 [hci0] 21.337681
      ATT: Read By Type Response (0x09) len 15
        Attribute data length: 7
        Attribute data list: 2 entries
        Handle: 0x0002
        Value: 020300002a
        Handle: 0x0004
        Value: 020500012a
< ACL Data TX: Handle 64 flags 0x00 dlen 11                                       #185 [hci0] 21.340017
      ATT: Read By Type Request (0x08) len 6
        Handle range: 0x0006-0x0009
        Attribute type: Characteristic (0x2803)
> ACL Data RX: Handle 64 flags 0x02 dlen 13                                       #186 [hci0] 21.367572
      ATT: Read By Type Response (0x09) len 8
        Attribute data length: 7
        Attribute data list: 1 entry
        Handle: 0x0007
        Value: 200800052a
< ACL Data TX: Handle 64 flags 0x00 dlen 11                                       #187 [hci0] 21.368173
      ATT: Read By Type Request (0x08) len 6
        Handle range: 0x000a-0x0013
        Attribute type: Characteristic (0x2803)
> HCI Event: Number of Completed Packets (0x13) plen 5                            #188 [hci0] 21.382744
        Num handles: 1
        Handle: 64
        Count: 2
> ACL Data RX: Handle 64 flags 0x02 dlen 27                                       #189 [hci0] 21.398165
      ATT: Read By Type Response (0x09) len 22
        Attribute data length: 7
        Attribute data list: 3 entries
        Handle: 0x000b
        Value: 120c006e2a
        Handle: 0x000e
        Value: 120f006f2a
        Handle: 0x0011
        Value: 1212006d2a
< ACL Data TX: Handle 64 flags 0x00 dlen 11                                       #190 [hci0] 21.398694
      ATT: Read By Type Request (0x08) len 6
        Handle range: 0x0009-0x0009
        Attribute type: Characteristic (0x2803)
> ACL Data RX: Handle 64 flags 0x02 dlen 9                                        #191 [hci0] 21.427558
      ATT: Error Response (0x01) len 4
        Read By Type Request (0x08)
        Handle: 0x0009
        Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 64 flags 0x00 dlen 11                                       #192 [hci0] 21.428283
      ATT: Read By Type Request (0x08) len 6
        Handle range: 0x0013-0x0013
        Attribute type: Characteristic (0x2803)
> HCI Event: Number of Completed Packets (0x13) plen 5                            #193 [hci0] 21.442725
        Num handles: 1
        Handle: 64
        Count: 2
> ACL Data RX: Handle 64 flags 0x02 dlen 9                                        #194 [hci0] 21.472559
      ATT: Error Response (0x01) len 4
        Read By Type Request (0x08)
        Handle: 0x0013
        Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 64 flags 0x00 dlen 11                                       #195 [hci0] 21.474417
      ATT: Read By Type Request (0x08) len 6
        Handle range: 0x000b-0x000d
        Attribute type: Client Characteristic Configuration (0x2902)
> ACL Data RX: Handle 64 flags 0x02 dlen 9                                        #196 [hci0] 21.502541
      ATT: Error Response (0x01) len 4
        Read By Type Request (0x08)
        Handle: 0x000b
        Error: Attribute Not Found (0x0a)
> HCI Event: Number of Completed Packets (0x13) plen 5                            #197 [hci0] 21.661765
        Num handles: 1
        Handle: 64
        Count: 1

我正在使用ArduinoBLE库。在 Arduino 方面。通知功能通过以下方式添加:

BLEShortCharacteristic temperatureCharacteristic( BLE_UUID_TEMPERATURE, BLERead | BLENotify );

标签: node.jsarduinobluetoothraspberry-pibluetooth-lowenergy

解决方案


推荐阅读