Bluez BLE peripheral advertise custom characteristic with ADV data

℡╲_俬逩灬. 提交于 2020-12-07 15:00:14

问题


Is there a sample app that allows advertising custom UUID and characteristics and with specific ADV data? Bluez has less documentation. Any help is appreciated.


回答1:


Which version of BlueZ do you have? With newer versions of BlueZ (e.g. 5.50) you can use bluetoothctl from the command line to do this as follows:-

#bluetoothctl
[bluetooth]# menu advertise
[bluetooth]# uuids 0x1800 0x1801 0x1802
[bluetooth]# name MyDevice
[bluetooth]# data 0 01 02 03
[bluetooth]# back
[bluetooth]# advertise on

This allows you to set custom UUID, advertising data, and the advertising device name. You can dig through the BlueZ source to see how this is implemented using C.

I hope this helps.



来源:https://stackoverflow.com/questions/53550852/bluez-ble-peripheral-advertise-custom-characteristic-with-adv-data

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