Reading Characteristic Data

Ask, and ye shall receive.
speezcode
Posts: 6
Joined: 17:05, 04 Oct 2014

Reading Characteristic Data

Postby speezcode » 02:20, 07 Oct 2014

Hi All,

Sorry if this is a newbie question...

I've explored BLE Explorer and BLE Scan.. and even tweaked these a little and got some awesome results.. I'm getting service and characteristic data!

My device is a WICED-Sense kit, which has 5 sensors built into it (pretty cool; e.g. gyroscope, accelerometer, temperature, etc) - I'm still hunting for documentation that maps the UUIDs to the specific sensors that I'm interested in, but in the meantime - how can read the data from the characteristic? In other words, I'm getting back what looks like encoded data:

Example
LOG: Characteristic:
LOG: UUID: 00002a24-0000-1000-8000-00805f9b34fb
LOG: Data: 0001%00%00%00%00
LOG: Characteristic:
LOG: UUID: 00002a23-0000-1000-8000-00805f9b34fb
LOG: Data: %A5%DC%BD%C1%8B%06%89%85

..how can I read what the "data" values are? ...I tried "fromUtf8" and eventually started to get URI Malformed errors...

Any thoughts? --thanks, Mike

User avatar
Eric
Posts: 16
Joined: 15:32, 18 Nov 2013
Location: Stockholm, Sweden
Contact:

Re: Reading Characteristic Data

Postby Eric » 18:27, 07 Oct 2014

Hi!

Look into the WICED-Sense kit iOS app's source code and see if you can find the answer of how the data is coded. You can find the source code here: http://community.broadcom.com/docs/DOC-1648

Additionally there might be some documentation regarding it at http://community.broadcom.com/community ... on/content . I looked around a bit for documentation but didn't find any.

You need to be registered on the WICED Community to get access to these pages, register here if you didn't already: http://community.broadcom.com/login.jsp ... rOnly=true
Hacker, tinkerer
EvoThings

ardiri
Posts: 58
Joined: 16:13, 28 May 2014

Re: Reading Characteristic Data

Postby ardiri » 01:55, 08 Oct 2014

you may want to take a look at these pages:

https://developer.bluetooth.org/gatt/ch ... sHome.aspx
http://www.spinics.net/lists/linux-blue ... 31603.html
https://github.com/grundid/bletools/blo ... attDb.java

Code: Select all

   { "00002a24-0000-1000-8000-00805f9b34fb", "Model Number String" },
    { "00002a23-0000-1000-8000-00805f9b34fb", "System ID" },


those are the two characteristics you mention - it seems there is a standard set of UUID's within GATT definition - so this is what these two characteristics represent. you can find out a lot more about the specific characteristics you mentioned here:

https://developer.bluetooth.org/gatt/ch ... tem_id.xml
https://developer.bluetooth.org/gatt/ch ... string.xml

in regards to the information stored - it looks like your tool is reaching back the data and doing a URL encoding of the raw data stream.

Code: Select all

%A5%DC%BD%C1%8B%06%89%85


means

Code: Select all

data[] = 0xa5, 0xdc, 0xbd, 0xc1, 0x8d, 0x06, 0x89, 0x85


it then needs to be mapped to the specific BT data values:

Code: Select all

system id
.manufacturer_id = 0xa5dcbdc18d
.organization_uniq_id = 0x068985


you may have to check exactly the rules for endianess however, i couldn't find that at first glance.

hopefully that answers your questions! :)
// Aaron
Chief Technology Officer
Evothings AB http://www.evothings.com/

speezcode
Posts: 6
Joined: 17:05, 04 Oct 2014

Re: Reading Characteristic Data

Postby speezcode » 16:28, 09 Oct 2014

Thanks Guys - both replies were helpful in giving me clues about what I needed..

In case anyone else is interested in WICED-sense; the interesting UUIDs are (obtained from the WICED sense community site):

Code: Select all

Primary Service UUID: 739298b6-87b6-4984-a5dc-bdc18b068985
Notification Descriptor UUID: 00002902-0000-1000-8000-00805f9b34fb
Data Characteristic UUID: 33ef9113-3b55-413e-b553-fea1eaada459


..For grabbing data, I found that if I ran the raw data returned from the device through Int8Array() I got the values I needed

Code: Select all

new Int8Array(data)


Cheers.

User avatar
micke
Posts: 256
Joined: 20:49, 18 Nov 2013

Re: Reading Characteristic Data

Postby micke » 20:06, 28 Oct 2014

Great findings, thanks for reporting!

I usually use Uint8Array, which might be safer if you rely on getting unsigned byte values.

Best regards, Mikael


Return to “Questions and answers”

Who is online

Users browsing this forum: No registered users and 5 guests