I am trying to connect to BC127 using BLE profile from my android phone. I am able to search BLE device But I am not sure how I can retrieve the services available on remote BLE device.I saw several example but all contains the UUID of service. How can I know the UUID of service?
Asked
Active
Viewed 1,875 times
1 Answers
2
After you search BLE device,
you can follow Android developer "http://developer.android.com/samples/BluetoothLeGatt/project.html" to connect device.
In "BluetoothLeService.java", you can get service when you connect to device successfully by gatt.discoverServices()
(You can run that in onConnectionStateChange
).
It will trigger onServicesDiscovered()
;
In onServicesDiscovered()
, try gatt.getServices()
to get list of services, and in every service try service.getCharacteristics()
to get list of Characteristics, and in every Characteristics, try characteristics.getDescriptors()
to get descriptor.
In each Service, Characteristics and descriptor, use getUUID()
to get UUID information.
Hope its useful for you
Thanks, Devin.

Devin
- 286
- 1
- 5
- 14
-
Thank you Devin. Thats what I did But in logcat I am getting "Client registerd, waiting for callback" I searched for this and got that we have to create new thread for ConnectGatt(). I did that also But I dont know whats wrong – SOHAN Mar 10 '15 at 15:13
-
These are the steps I am following 1. Search for BLE device 2. Connect using ConnectGatt() 3. Waiting for callback to call OnConnectionStateChanged() where I called gatt.getServices() to explore the services on remote device. – SOHAN Mar 10 '15 at 15:20