Page 1 of 1

BLE > How to get details from characteristics?

Posted: 07:57, 27 Aug 2015
by mangopudding
Hi there.

I used the LightBlue app on my Mac to get the details from my heart rate tracker device.

Screen Shot 2015-08-26 at 11.49.12 PM.png
Screen Shot 2015-08-26 at 11.49.12 PM.png (105.46 KiB) Viewed 32200 times


So in my logging code, I can see that I'm getting the right service, characteristic and descriptor info.

Code: Select all

LOG: Connecting...
LOG: Connected to device: MIO GLOBAL-FUSE
LOG: Reading services... (this may take some time)
LOG:   service: 0000180d-0000-1000-8000-00805f9b34fb
LOG:     characteristic: 00002a37-0000-1000-8000-00805f9b34fb
LOG:       descriptor: 00002902-0000-1000-8000-00805f9b34fb
LOG:     characteristic: 00002a38-0000-1000-8000-00805f9b34fb
LOG:   service: 0000180f-0000-1000-8000-00805f9b34fb
LOG:     characteristic: 00002a19-0000-1000-8000-00805f9b34fb
LOG:       descriptor: 00002902-0000-1000-8000-00805f9b34fb
LOG:   service: 6c721826-5bf1-4f64-9170-381c08ec57ee
LOG:     characteristic: 6c722a0a-5bf1-4f64-9170-381c08ec57ee
LOG:     characteristic: 6c722a0b-5bf1-4f64-9170-381c08ec57ee
LOG:     characteristic: 6c722a0c-5bf1-4f64-9170-381c08ec57ee
LOG:       descriptor: 00002902-0000-1000-8000-00805f9b34fb
LOG:   service: 6c721838-5bf1-4f64-9170-381c08ec57ee
LOG:     characteristic: 6c722a80-5bf1-4f64-9170-381c08ec57ee
LOG:     characteristic: 6c722a81-5bf1-4f64-9170-381c08ec57ee
LOG:     characteristic: 6c722a82-5bf1-4f64-9170-381c08ec57ee
LOG:       descriptor: 00002902-0000-1000-8000-00805f9b34fb
LOG:     characteristic: 6c722a83-5bf1-4f64-9170-381c08ec57ee
LOG:       descriptor: 00002902-0000-1000-8000-00805f9b34fb
LOG:     characteristic: 6c722a84-5bf1-4f64-9170-381c08ec57ee
LOG:       descriptor: 00002902-0000-1000-8000-00805f9b34fb
LOG:   service: 0000180a-0000-1000-8000-00805f9b34fb
LOG:     characteristic: 00002a29-0000-1000-8000-00805f9b34fb
LOG:     characteristic: 00002a24-0000-1000-8000-00805f9b34fb
LOG:     characteristic: 00002a25-0000-1000-8000-00805f9b34fb
LOG:     characteristic: 00002a27-0000-1000-8000-00805f9b34fb
LOG:     characteristic: 00002a26-0000-1000-8000-00805f9b34fb
LOG:     characteristic: 00002a28-0000-1000-8000-00805f9b34fb
LOG:     characteristic: 00002a23-0000-1000-8000-00805f9b34fb
LOG: Done disconnecting from device


Is there some example code that will help me get the ASCII details for the characteristic?

Re: BLE > How to get details from characteristics?

Posted: 15:20, 27 Aug 2015
by Fredrik
You want the function "readCharacteristic".

We have no example that reads all characteristics on a device, but our example mbed-custom-gatt reads one characteristic in a fairly straightforward way.

"readCharacteristic" returns not a string, but an ArrayBuffer. You can use evothings.ble.fromUtf8() to try to convert the buffer to a string. Be warned, however: it will throw an exception if the buffer contains unreadable(binary) data. You can surround the call to fromUtf8() with try/catch statements to be on the safe side.

Re: BLE > How to get details from characteristics?

Posted: 16:59, 17 Sep 2015
by biczak
Is there a working example of readCharacteristic() anywhere? I too am trying to read the value of a characteristic and I can not seem to get it to work.

Re: BLE > How to get details from characteristics?

Posted: 12:45, 22 Sep 2015
by Fredrik