Rakesh Polo
Rakesh Polo

Reputation: 461

How to get the name of the service for the corresponding UUID in bluetooth?

I am developing an Bluetooth application, and i need to get the name of the services provided by a particular client Bluetooth device. I am using the following code to get the UUID's.

Code Snippet:

 if(BluetoothDevice.ACTION_UUID.equals(action)) 
 {
 BluetoothDevice device =       intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
 Parcelable[] uuidExtra =    intent.getParcelableArrayExtra(BluetoothDevice.EXTRA_UUID);
 for (int i = 0; i < uuidExtra.length; i++) {
String abc=uuidExtra[i].toString());
 }
 }

I am getting the uuid value as for example "00001000-0000-1000-8000-00805F9B34FB" But i need its corresponding service name like the following.

BrowseGroupDescriptorServiceClassID = 00001001-0000-1000-8000-00805F9B34FB PublicBrowseGroupServiceClass = 00001002-0000-1000-8000-00805F9B34FB

Upvotes: 0

Views: 3745

Answers (2)

Edward Anderson
Edward Anderson

Reputation: 23

By the way,it's different from iOS dev,we can't get service_name or charactistics_name through android public api(except uuid) when connected ,so if we want to extpand ourself service_name or charactistics_name that outside blutetooth SIG defined in remote bluetooth-hardware. we can't fetch target charactistics_name directly(e.g. charactistics.getUUIDName()) (still use mapping add myself charactistics_uuid is not interchangeable)

Upvotes: 0

morynicz
morynicz

Reputation: 2332

On Bluetooth.com you can find list of 16-bit UUID's. They are all transformable to 128-bit ones You got. You just need to check the GATT spec. The only thing left is just mapping the names with UUID's, which You will probably have to write on your own.

Upvotes: 0

Related Questions