Has anybody else had problems when trying to cancel sensor notifications (for rotation channel) with Platform Services 1.0?
My sensor code is roughly following:
Sensors are started without problem and i get data to my callback as expected. However, calling ISensor.Cancel() returns ErrorCode "1000" and ErrorMessage "Sensors:Cancel:Transaction id is incorrect".Code:var sensorTransactionID; function start() { // ... var so = device.getServiceObject("Service.Sensor","ISensor"); var criteria = { /* proper values for Rotation channel */ }; var registration = so.ISensor.RegisterForNotification(criteria, callback); sensorTransactionID = registration.TransactionID; } function stop() { // ... var so = device.getServiceObject("Service.Sensor","ISensor"); var criteria = { TransactionID: sensorTransactionID }; cancel = so.ISensor.Cancel(criteria); } function callback() { /*...*/ }
I have checked and rechecked that the TransactionID I give to Cancel() is the same that I receive from RegisterForNotification(). How come?
The code above is in its own file sensor.js that I include to my Main.html. The start() and stop() functions are called from another js-file that is also included and used in Main.html.
Too bad if I can't cancel the sensor notifications until the application is closed![]()

Reply With Quote


