Page 1 of 1

Parallel read data from multi tisensortag

Posted: 18:33, 23 Sep 2015
by lapserdaq
Hi,
i've managed to scan, connect and read data from sensor's services in Angular, but would it be possible somehow to connect and read from multi sensortag parallel eg.

sensortag
.temperatureCallback(temperatureHandler, 1000)
.accelerometerCallback(accelerometerHandler, 1000)
.connectToDevice($scope.devices[i].deviceInfo);

Those callback returns values in circle with specified time.
How can i read data from next device in the same time ? Is it possible to accomplish this with javascript api at all ?
I'm aware that JS processes remains in one thread. I'm trying to simulate parallel tasks using the setTimeout() or setInterval(), but with no luck.
Maybe you can help me somehow ?

One more thing, i've noticed that there's a problem with accelerometer and gyroscope service, it returns values more or less 10 times and stops broadcasting.
Same story is on my app and your official Evothings apps (eg. TISensorTag Sensors), that i've downloaded from Google Play.
I'm using CC2650 Sensors

ps.
Love the job you guys doing :)

Cheers
Michal

Re: Parallel read data from multi tisensortag

Posted: 18:54, 23 Sep 2015
by Fredrik
I haven't tried it, so I don't know if it can work, but what you would want to do is add another sensortag instance (evothings.tisensortag.createInstance), but do scanning on only one of them, wait for two different devices, then connect each instance to a device.

We're aware of the problem with the accelerometer service. It's a bug in the TI firmware. We can't fix it. You might try upgrading the firmware on your tag using the TI's own sensortag app.

Re: Parallel read data from multi tisensortag

Posted: 19:12, 23 Sep 2015
by alex
As I remember, downloading TI's own app for the cc2650 tag brings about a OTA firmware upgrade option once you connect it to the tag, that's probably the easiest way to go about it. It works for iOS, we've done that a couple of times in the past.

Here is a good starter link for altering other properties, like having the tag advertise indefinitely rather than the 2 minutes after a button press, altering the signal strength (in a trade-off for battery life): http://stackoverflow.com/questions/2209 ... definitely

Re: Parallel read data from multi tisensortag

Posted: 20:27, 23 Sep 2015
by lapserdaq
Ok, sensors firmware updated, accelerometer seems working fine now. Thanks.
Still strugling with reading from multi sensors. I'll try manage it with your suggest. If someone had done it please let me know.

Re: Parallel read data from multi tisensortag

Posted: 02:16, 25 Sep 2015
by lapserdaq
Guys would it be possible to add to data returned from callbacks (eg. from temperature, accelelometer) information about device let's say address ?

So in case of temperature it might have look :

before change:
data = [96, 11, 4, 14]

after change:
data = [96, 11, 4, 14], "68:C9:0B:17:BF:03"

That would solve problem with parallel reads from couple sensors.

Re: Parallel read data from multi tisensortag

Posted: 11:04, 25 Sep 2015
by Fredrik
You should be able to add enough state to your callback to know which device it was called on.

For example, if your one-sensor init is like this:

Code: Select all

function initialiseSensorTag() {
   sensortag = evothings.tisensortag.createInstance(
      evothings.tisensortag.CC2650_BLUETOOTH_SMART)

   sensortag
      .statusCallback(statusHandler)
      .errorCallback(errorHandler)
      .temperatureCallback(temperatureHandler, 1000)
}


Then your multi-sensor init could be like this:

Code: Select all

function initialiseSensorTag(tagId) {
   sensortag = evothings.tisensortag.createInstance(
      evothings.tisensortag.CC2650_BLUETOOTH_SMART)

   sensortag
      .statusCallback(statusHandler)
      .errorCallback(errorHandler)
      .temperatureCallback(function(data) { temperatureHandler2(data, tagId); }, 1000)
}

Note the addition of the "tagId".

Re: Parallel read data from multi tisensortag

Posted: 20:52, 28 Sep 2015
by lapserdaq
Great, i did something similar, works as well.
Thank you !