Bluetooth BlueZ LE远程使用功能

Bluetooth BlueZ LE远程使用功能,bluetooth,bluetooth-lowenergy,bluez,Bluetooth,Bluetooth Lowenergy,Bluez,我用BlueZ来处理可编程设备。我从源代码处编译了它,并围绕它编写了一个包装器 我在搜索这一点点信息: “LE Read Remote Used Features”命令的用途是什么 它可以读取哪些功能 连接到可扩展设备时,这是必需的吗 连接后禁用查询是否安全 是否可以增加接收此命令响应的超时时间 我的问题是,我的解决方案已经适用于某些设备(可以连接到它们),但对于特定的设备,很多时候由于超时而导致连接失败 我已经在连接失败时使用btmon创建了一个嗅探: # btmon Bluetooth

我用BlueZ来处理可编程设备。我从源代码处编译了它,并围绕它编写了一个包装器

我在搜索这一点点信息:

  • “LE Read Remote Used Features”命令的用途是什么
  • 它可以读取哪些功能
  • 连接到可扩展设备时,这是必需的吗
  • 连接后禁用查询是否安全
  • 是否可以增加接收此命令响应的超时时间
我的问题是,我的解决方案已经适用于某些设备(可以连接到它们),但对于特定的设备,很多时候由于超时而导致连接失败

我已经在连接失败时使用btmon创建了一个嗅探:

# btmon
Bluetooth monitor ver 5.50
= Note: Linux version 4.19.97-v7l+ (armv7l)                            0.742019
= Note: Bluetooth subsystem version 2.22                               0.742027
= New Index: AA:BB:CC:DD:EE:FF (Primary,UART,hci0)              [hci0] 0.742030
= Open Index: AA:BB:CC:DD:EE:FF                                 [hci0] 0.742033
= Index Info: AA:BB:CC:D.. (Cypress Semiconductor Corporation)  [hci0] 0.742035
@ MGMT Open: bluetoothd (privileged) version 1.14             {0x0001} 0.742038
@ MGMT Open: btmon (privileged) version 1.14                  {0x0002} 0.742321
< HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7   #1 [hci0] 4.737267
        Type: Passive (0x00)
        Interval: 60.000 msec (0x0060)
        Window: 30.000 msec (0x0030)
        Own address type: Public (0x00)
        Filter policy: Ignore not in white list (0x01)
> HCI Event: Command Complete (0x0e) plen 4                  #2 [hci0] 4.737714
      LE Set Scan Parameters (0x08|0x000b) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2       #3 [hci0] 4.737767
        Scanning: Enabled (0x01)
        Filter duplicates: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4                  #4 [hci0] 4.738160
      LE Set Scan Enable (0x08|0x000c) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 42                    #5 [hci0] 6.099681
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Public (0x00)
        Address: FF:EE:DD:CC:BB:AA
        Data length: 30
        Flags: 0x06
          LE General Discoverable Mode
          BR/EDR Not Supported
        Company: Apple, Inc. (76)
          Type: iBeacon (2)
          UUID: 669a0c20-0008-6c91-e411-015500e22ea9
          Version: 48661.62728
          TX power: -59 dB
        RSSI: -78 dBm (0xb2)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2       #6 [hci0] 6.099747
        Scanning: Disabled (0x00)
        Filter duplicates: Disabled (0x00)
> HCI Event: Command Complete (0x0e) plen 4                  #7 [hci0] 6.101862
      LE Set Scan Enable (0x08|0x000c) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Create Connection (0x08|0x000d) plen 25    #8 [hci0] 6.101916
        Scan interval: 60.000 msec (0x0060)
        Scan window: 60.000 msec (0x0060)
        Filter policy: White list is not used (0x00)
        Peer address type: Public (0x00)
        Peer address: FF:EE:DD:CC:BB:AA
        Own address type: Public (0x00)
        Min connection interval: 30.00 msec (0x0018)
        Max connection interval: 50.00 msec (0x0028)
        Connection latency: 0 (0x0000)
        Supervision timeout: 420 msec (0x002a)
        Min connection length: 0.000 msec (0x0000)
        Max connection length: 0.000 msec (0x0000)
> HCI Event: Command Status (0x0f) plen 4                    #9 [hci0] 6.102446
      LE Create Connection (0x08|0x000d) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 19                   #10 [hci0] 7.476997
      LE Connection Complete (0x01)
        Status: Success (0x00)
        Handle: 64
        Role: Master (0x00)
        Peer address type: Public (0x00)
        Peer address: FF:EE:DD:CC:BB:AA
        Connection interval: 48.75 msec (0x0027)
        Connection latency: 0 (0x0000)
        Supervision timeout: 420 msec (0x002a)
        Master clock accuracy: 0x00
@ MGMT Event: Device Connected (0x000b) plen 43        {0x0002} [hci0] 7.477047
        LE Address: FF:EE:DD:CC:BB:AA
        Flags: 0x00000000
        Data length: 30
        Flags: 0x06
          LE General Discoverable Mode
          BR/EDR Not Supported
        Company: Apple, Inc. (76)
          Type: iBeacon (2)
          UUID: 669a0c20-0008-6c91-e411-015500e22ea9
          Version: 48661.62728
          TX power: -59 dB
@ MGMT Event: Device Connected (0x000b) plen 43        {0x0001} [hci0] 7.477047
        LE Address: FF:EE:DD:CC:BB:AA
        Flags: 0x00000000
        Data length: 30
        Flags: 0x06
          LE General Discoverable Mode
          BR/EDR Not Supported
        Company: Apple, Inc. (76)
          Type: iBeacon (2)
          UUID: UUID
          Version: 48661.62728
          TX power: -59 dB
< HCI Command: LE Read Remote Used... (0x08|0x0016) plen 2  #11 [hci0] 7.477210
        Handle: 64
> HCI Event: Command Status (0x0f) plen 4                   #12 [hci0] 7.479342
      LE Read Remote Used Features (0x08|0x0016) ncmd 1
        Status: Success (0x00)
> HCI Event: Command Complete (0x0e) plen 14                #13 [hci0] 7.479357
      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                   #14 [hci0] 7.993969
      LE Read Remote Used Features (0x04)
        Status: Connection Timeout (0x08)
        Handle: 64
        Features: 0x2d 0x00 0x00 0x00 0x00 0x00 0x00 0x00
          LE Encryption
          Extended Reject Indication
          Slave-initiated Features Exchange
          LE Data Packet Length Extension
> HCI Event: Disconnect Complete (0x05) plen 4              #15 [hci0] 7.994591
        Status: Success (0x00)
        Handle: 64
        Reason: Connection Timeout (0x08)
@ MGMT Event: Device Disconnected (0x000c) plen 8      {0x0002} [hci0] 8.027693
        LE Address: FF:EE:DD:CC:BB:AA
        Reason: Connection timeout (0x01)
@ MGMT Event: Device Disconnected (0x000c) plen 8      {0x0001} [hci0] 8.027693
        LE Address: FF:EE:DD:CC:BB:AA
        Reason: Connection timeout (0x01)
#btmon
蓝牙监视器5.50版
=注:Linux版本4.19.97-v7l+(armv7l)0.742019
=注:蓝牙子系统版本2.22 0.742027
=新指数:AA:BB:CC:DD:EE:FF(初级、UART、hci0)[hci0]0.742030
=开放指数:AA:BB:CC:DD:EE:FF[hci0]0.742033
=索引信息:AA:BB:CC:D。。(赛普拉斯半导体公司)[hci0]0.742035
@管理开放:蓝牙(特权)版本1.14{0x0001}0.742038
@管理打开:btmon(特权)版本1.14{0x0002}0.742321
HCI事件:命令完成(0x0e)plen 4#2[hci0]4.737714
LE设置扫描参数(0x08 | 0x000b)ncmd 1
状态:成功(0x00)
HCI事件:命令完成(0x0e)plen 4#4[hci0]4.738160
LE设置扫描启用(0x08 | 0x000c)ncmd 1
状态:成功(0x00)
>HCI事件:LE元事件(0x3e)plen 42#5[hci0]6.099681
乐视广告报道(0x02)
报告数量:1
事件类型:可连接的无方向-ADV_IND(0x00)
地址类型:公共(0x00)
地址:FF:EE:DD:CC:BB:AA
数据长度:30
标志:0x06
通用可发现模式
BR/EDR不受支持
公司:苹果公司(76)
类型:iBeacon(2)
UUID:669a0c20-0008-6c91-e411-015500e22ea9
版本:48661.62728
发射功率:-59分贝
RSSI:-78 dBm(0xb2)
HCI事件:命令完成(0x0e)plen 4#7[hci0]6.101862
LE设置扫描启用(0x08 | 0x000c)ncmd 1
状态:成功(0x00)
HCI事件:命令状态(0x0f)plen 4#9[hci0]6.102446
LE创建连接(0x08 | 0x000d)ncmd 1
状态:成功(0x00)
>HCI事件:LE元事件(0x3e)plen 19#10[hci0]7.476997
LE连接完成(0x01)
状态:成功(0x00)
句柄:64
角色:主机(0x00)
对等地址类型:公共(0x00)
对等地址:FF:EE:DD:CC:BB:AA
连接间隔:48.75毫秒(0x0027)
连接延迟:0(0x0000)
监督超时:420毫秒(0x002a)
主时钟精度:0x00
@管理事件:设备已连接(0x000b)plen 43{0x0002}[hci0]7.477047
LE地址:FF:EE:DD:CC:BB:AA
标志:0x00000000
数据长度:30
标志:0x06
通用可发现模式
BR/EDR不受支持
公司:苹果公司(76)
类型:iBeacon(2)
UUID:669a0c20-0008-6c91-e411-015500e22ea9
版本:48661.62728
发射功率:-59分贝
@管理事件:设备已连接(0x000b)plen 43{0x0001}[hci0]7.477047
LE地址:FF:EE:DD:CC:BB:AA
标志:0x00000000
数据长度:30
标志:0x06
通用可发现模式
BR/EDR不受支持
公司:苹果公司(76)
类型:iBeacon(2)
UUID:UUID
版本:48661.62728
发射功率:-59分贝
HCI事件:命令状态(0x0f)plen 4#12[hci0]7.479342
LE读取远程使用功能(0x08 | 0x0016)ncmd 1
状态:成功(0x00)
>HCI事件:命令完成(0x0e)plen 14#13[hci0]7.479357
LE读取远程使用功能(0x08 | 0x0016)ncmd 1
状态:成功(0x00)
00 00 00 00 00 00 00 00 00 00                    ..........      
>HCI事件:LE元事件(0x3e)plen 12#14[hci0]7.993969
LE读取远程使用的功能(0x04)
状态:连接超时(0x08)
句柄:64
功能:0x2d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
加密
扩展拒绝指示
从机启动的功能交换
数据包长度扩展
>HCI事件:断开Compl
        Handle: 128
 HCI Event: Command Status (0x0f) plen 4      
      LE Read Remote Used Features (0x08|0x0016) ncmd 1
        Status: Success (0x00)
 HCI Event: LE Meta Event (0x3e) plen 11                                                                                                                                                                               
      LE Data Length Change (0x07)
        Handle: 128
        Max TX octets: 251
        Max TX time: 17040
        Max RX octets: 251
        Max RX time: 17040
 HCI Event: LE Meta Event (0x3e) plen 12                                                                                                                                                                               
      LE Read Remote Used Features (0x04)
        Status: Success (0x00)
        Handle: 128
        Features: 0x7f 0xfb 0x46 0x07 0x00 0x00 0x00 0x00
          LE Encryption
          Connection Parameter Request Procedure
          Extended Reject Indication
          Slave-initiated Features Exchange
          LE Ping
          LE Data Packet Length Extension
          LL Privacy
          LE 2M PHY
          Stable Modulation Index - Transmitter
          LE Coded PHY
          LE Extended Advertising
          LE Periodic Advertising
          Channel Selection Algorithm #2
          LE Power Class 1
          Unknown features (0x0000000007460000)