Reputation: 13
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?
Upvotes: 0
Views: 2285
Reputation: 306
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.
Upvotes: 2