i am new to android development with Kotlin, i am developing an app to search for BLE devices. i am able to print the services(uuids) and its characterstics(uuids). i dont have any particular beacon to connect. i am just searching with my app and getting list of ble devices around me. i am randomly connecting to one of them and printing its services to the console. My question is that how can i know for the device i am connecting what it is advertising and what can i read from it. i am not getting any idea from these uuids. please tell me if you need more information regarding this.
printGattTable: Service 00001801-0000-1000-8000-00805f9b34fb
Characteristics:
|--00002a05-0000-1000-8000-00805f9b34fb
Service d0611e78-bbb4-4591-a5f8-487910ae4366
Characteristics:
|--8667556c-9a37-4c91-84ed-54ee27d90049
Service 9fa480e0-4967-4542-9390-d343dc5d04ae
Characteristics:
|--af0badb1-5b99-43cd-917a-a77bc549e3cc
Service 0000180f-0000-1000-8000-00805f9b34fb
Characteristics:
|--00002a19-0000-1000-8000-00805f9b34fb
Service 00001805-0000-1000-8000-00805f9b34fb
Characteristics:
|--00002a2b-0000-1000-8000-00805f9b34fb
|--00002a0f-0000-1000-8000-00805f9b34f
CodePudding user response:
There is no predefined method to convert UUIDs to their respective service name. You would have to write it yourself. You can find a list of assigned 16-bit UUIDs containing the Bluetooth SIG member UUIDs and the GATT Service UUIDs here.
There are also some projects on Github that provide an easy to parse UUID list like the bluetooth-numbers-database.
Keep in mind that a device can also 'hide' its services behind non standard UUIDs, even if they use a standard GATT service. You won't be able to tell what the service is doing in that case unless you find a description in that devices documentation.
CodePudding user response:
On the protocol level there is no such thing as a Service Name. There is only UUID. Therefore what you want to do is impossible. You can try to search online for a mapping from UUID to service names for common services and embed that into your app.