Ble Scan service of a device without connecting to it

十年热恋 提交于 2019-12-02 02:52:07

I am not with the android background, but I have understanding of how BLE works.

The characteristics Device Name, UUID=0x2A00 is bundled into GAP (Generic Access), UUID = 0x1800. The GAP is always broadcasted within the advertisement packet from the GATT Server.
A GATT Client should run a discovery scan to receive the advertisement and parse the advertisement packet to receive the GAP descriptor. While you are doing this, technically speaking the connection is yet to be made.

Adressing to:

If I change the name of my device this check will be false, So I look if it was possible to get some uuid of some services that I add to do the check with something that would not change.

Assuming that you want your app to connect only to a particular set of device that has some unique identification. Say for example, a BLE-enabled digital pen configured by you should only connect to your app and no other device gadget should be able to connect with your app. If that is the use case and if you have the liberty to configure the GATT server on the BLE device then you can add some custom characteristics in GAP service on GATT server which will be unique to those devices. Needless to say, you will have to generate a 128-bit custom UUID for that characteristics and the UUID will be known to your application as well. This is more like a work-around solution.

Kindly refer Bluetooth Development Portal for more details.

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