Linux BlueZ custom Manufacturing Scan Response Data

依然范特西╮ 提交于 2021-02-20 04:10:05

问题


I have a custom GATT Server working as a plugin using BlueZ 4.101 on Linux. I am now trying to set custom Scan Response advertising data. I am using LightBlue on iOS to debug my GATT Server and advertising parameters. I tried the following code, and LightBlue can see the Advertising Payload and Device Name, but not the Scan Response data. How do I set custom Scan Response data with BlueZ? Thanks.

# BLE Name
echo "<GATT SERVER> Setting BLE Advertising Name..."
btmgmt -i $BLUETOOTH_DEVICE name "My-Test-Device"

echo "<GATT SERVER> Starting BLE Advertising..."
hciconfig $BLUETOOTH_DEVICE leadv

# Adv Packet
echo "<GATT SERVER> Setting BLE Advertising Packets..."
hcitool -i hci0 cmd 0x08 0x0008 15 02 01 06 11 06 fa d8 43 31 14 09 0c ba e1 14 82 25 11 48 96 16
#                               |  |  |  |  |  | -----------------------------------------------
#                               |  |  |  |  |  |      |
#                               |  |  |  |  |  |      +---- device state service UUID                            
#                               |  |  |  |  |  |
#                               |  |  |  |  |  +- Incomplete List of 128-bit Service Class  UUIDs                        
#                               |  |  |  |  |
#                               |  |  |  |  +- Num bytes in -----------------------------------+
#                               |  |  |  |
#                               |  |  |  +- LE General Discoverable Mode, BR/EDR                     
#                               |  |  |
#                               |  |  +- Flags AD type
#                               |  |
#                               |  +nBytes+                
#                               |
#                               +- Num bytes in -----------------------------------------------+

# Scan Response
echo "<GATT SERVER> Setting BLE Scan Response..."
hcitool -i hci0 cmd 0x08 0x0009 02 01 06 1A FF 02 5E 03 02 01 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

回答1:


Your command to set discovery response does not make any sense. Here is an exemple :

hcitool -i hci0 cmd 0x08 0x0009 14 13 09 74 68 65 20 70 69

  hcitool -i hci0 cmd 0x08 0x0009 : set discovery response
  14 : total payload length
  13 : info payload length
  09 : info type == name
  74 68 65 20 70 69 : info payload => the name in ascii. here "the pi"

Please note that this won't work if you device is not connectable.



来源:https://stackoverflow.com/questions/46431843/linux-bluez-custom-manufacturing-scan-response-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!