delayedCall — delayed function call.

Description

void delayedCall(void *func, u16 time[,u32 data]);

Delayed func function call in time seconds. Data parameter is supported in the versions of modules and server firmware after 05.07.2016.

List of parameters
func
Pointer to the function.
time
Time in seconds. Only literal (number) can be as the parameter in the firmwares of CM9 before 20.07.2015. Max number of seconds which is possible to specify 0хFFFF.

Example

<import-script id="524" LAMP="543:45" name="Test for delayedCall function">
void offLamp() {
        	setStatus(LAMP, 0);
        	}
V-ID/LAMP {
        	if(opt0()) {
        	        	delayedCall(offLamp, 5);
        	}
}
</import-script>

<!--With the use of additional parameter:-->
<item type="script" addr="524:250" name="Test for delayedCall function">
void fn(u32 param)
    {
     srvMessage("fn param = %d", param);
    }
    V-ID/V-ADDR
    {
     delayedCall(fn, 1, opt(0));
    }
</import-script>

The result of performing the first example:
On expiry of 5 seconds after switching on the element LAMP will be turned off.
The result of performing the second example:
In a second after clicking the script the message with script status will be displayed in the server log.

Note:
Before the previous call is triggered the 2nd delayed call will be generated but not recorded over the previous one when assigning the delayed recall to one and the same function.