Time-triggered auto-update messages
Luos engine provides a standard command to ask a service to retrieve values from a service, called ASK_PUB_CMD
. However, sometimes apps need to poll values from sensors, but the act of repeatedly retriving a value using the ASK_PUB_CMD
command may result in the use of a lot bandwidth and take up valuable resources.
In this kind of polling situation, you can use the time-triggered auto-update features available from any Luos engine service. This feature allows you to ask a service to send you an update of any value each X milliseconds.
To use it, you have to setup targeted service with a message containing a standard time object dictionarySet of objects based on SI metric system that can be transmitted through Luos messages. Any object can easily be converted in other units., but with a specific command associated to it.
For example, to update a service each 10 ms:
time_luos_t time = TimeOD_TimeFrom_ms(10);
msg_t msg;
msg.header.target = id;
msg.header.target_mode = SERVICEIDACK;
TimeOD_TimeToMsg(&time, &msg);
msg.header.cmd = UPDATE_PUB;
Luos_SendMsg(app, &msg);
Services can handle only one time-triggered target, 2 services of the same network can't ask a time-triggered value from the same service.
To prevent any ID movement, auto-update configuration is reset on all services on each detection (see Routing table page for more information).