Understanding long and short form of UUID

佐手、 提交于 2020-01-25 02:53:08

问题


I am trying to learn some bluetooth programming in android
I have been able to make a rudimentary program that discovers and connects to a (currently just a single) development board with Bluetooth features built in
I want to be able to send commands to the board as well as receive messages from it using RFCOMM
I have been told that I will probably not be able to move any further without knowing the UUID for the board as well as the phone
While digging around for this, I found out that the board uses a UUID of 0xFFFF foir it's custom Service Disocvery Protocol, and I also found from here that it is possible in SDP to represent some selected range of UUID's using only 16 bits, which can be expanded to 128-bits, but I am not able to find out how to do this expansion and the link given in the page seems to be broken
Could some one please provide an easy explanation of what UUID's are (in terms of Bluetooth and specifically in terms of RFCOMM), what is their significance for me in bluetooth programming, and how can I get a 128-bit uuid from the 16-bit version that my board uses?
Thanks in advance.


回答1:


Universally Unique Identifiers are mainly used in Bluetooth Low Energy (BLE) in order to access a functionality of a hardware sensor in an electronic kit for instance. As an example, if we have a kit with an integrated Accelerometer Sensor and Gyroscope Sensor that can be enabled using Bluetooth with a Smartphone device (connected to the kit), then you have to use UUIDs to tell the kit that you actually want to access the Accelerometer Service of the kit.

UUIDs are 128-bit values. Following UUID is an example of the SensorTag device:

F000AAAA-0451-4000-B000-000000000000

where AAAA is the important 16 bits (0xAAAA) that is used as an "ID" for every service.

The accelerometer service in the kit has following UUID:

F000AA10-0451-4000-B000-000000000000

and the gyroscope sensor requires following UUID to access its service

F000AA50-0451-4000-B000-000000000000

If you then perform any Bluetooth operation to the remote device with one of those UUIDs, then it will know, which service you're trying to access.



来源:https://stackoverflow.com/questions/27656306/understanding-long-and-short-form-of-uuid

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