How to force report of a new status to the platform? | Thales IoT Developer Community
July 16, 2015 - 5:14pm, 3779 views
How can I force the update of a Sensor new value to be sent immediately, instead of waiting a poll from the agent?
Example: I want to send a button pressed event (GPIO status change) as soon as it's detected. For instant detection, I have a InPortListener attached to the correspondent InPort. That works. But on UserGuide, the BooleanSensor part states: "Creation of the custom implementation of BooleanSensor class (only the getValue() method ***** to be implemented)". This is for polling. What about asynchronous updates? Is there a way to force a new poll, or notify the Sensor (or some other class) of this new value AND send this new value to the cloud right away?
You can call the stateChanged(boolean newState) method of BooleanSensor class.
The same rules as for monitoring apply here - report on up and report on down settings are checked before sending to the cloud.
Ok, it worked - thanks!