How to uniquely identify SensorTags

Ask, and ye shall receive.
TaniaMac
Posts: 2
Joined: 00:31, 28 Apr 2016

How to uniquely identify SensorTags

Postby TaniaMac » 00:52, 28 Apr 2016

Hi

I am developing an app that connects to two SensorTags and am now looking for a way to know and control which of the SensorTags is connected (rather than first the nearest device, and then the second one). Is there a way to read the Unique IDs for each SensorTag (like the UUID when connecting to the TI SensorTag App) to determine which is connected? Or to specify a unique ID and connect only to that SensorTag?

... I have worked on this further and see that the SensorTag app displays the "System ID" which seems unique to each SensorTag. It is available in the Device Information Service as far as I can see. I have tried to read from this but keep getting errors

Code: Select all

   instance.SYSTEM_ID = '00002a23-0000-1000-8000-00805f9b34fb'
...
   instance.device.readServiceCharacteristic(
      instance.DEVICEINFO_SERVICE,
      instance.SYSTEM_ID,
      function(data)
      {
              console.log('BLE readServiceCharacteristic error: ' + evothings.ble.fromUtf8(data));
      },
      function(errorCode)
      {
            console.log('BLE readServiceCharacteristic error: ' + errorCode);
      })



I get the following error:

Code: Select all

 LOG: Error in Success callbackId: BLE177953074 : URIError: URI error
LOG: [ERR] URIError: URI error [hyper/4ddea4ba-dbc2-4286-a12f-ba9740f727bb/ad64a6c5-587c-4575-a256-6e13b06b7839/cordova.js: 314]


This code works for any of the other Device Info characteristics (Manufacturer name, software revision etc).

Any help understanding why the System ID is not available, or how to get is appreciated.

Thanks in advance

Thanks in advance

TaniaMac
Posts: 2
Joined: 00:31, 28 Apr 2016

Re: How to uniquely identify SensorTags

Postby TaniaMac » 04:22, 03 May 2016

For anyone looking - the solution was in the format of the data recieved. Converting the data using fromUtf8 failes. Instead, the solution was to convert to Uint8Array and manipulate the data from there (converting each byte to a hex string).

alex
Posts: 92
Joined: 00:59, 19 Nov 2013

Re: How to uniquely identify SensorTags

Postby alex » 13:43, 16 May 2016

There you go, thanks for getting back to share!

best

Alex


Return to “Questions and answers”

Who is online

Users browsing this forum: Google [Bot] and 27 guests