This function will return details about the last sensor notification event received.
To get the ID of the sender related to the event, please call rfbcWaitEvent before this function.
Known sensor values:
Device
|
Description
|
HM-Sec-MDIR
|
First value is a motion detection counter since boot.
Motion detection will be reported with a 4-5 minutes interval when continuous motion is detected.
|
Input:
None.
Output:
ch : INT
The channel on the sensor which has been changed.
v1 : INT
First sensor value.
v2 : INT
Second sensor value.
Returns: INT
0
|
-
|
Ok. Event cleared.
|
-1
|
-
|
Interface is not open (see rfbcOpen).
|
-4
|
-
|
RF communication is not available.
|
-5
|
-
|
Event is not present.
|
Declaration:
FUNCTION rfbcSensorEventReceive : INT;
VAR_INPUT
ch : ACCESS INT;
v1 : ACCESS INT;
v2 : ACCESS INT;
END_VAR;
Example:
INCLUDE rtcu.inc
FUNCTION GetSensorEvent;
VAR_INPUT
id : DINT;
END_VAR;
VAR
ch : INT;
v1 : INT;
v2 : INT;
END_VAR;
rfbcSensorEventReceive(ch := ch, v1 := v1, v2 := v2);
DebugFmt(message := "Channel \1 on sensor \4 reports \2 and \3.",
v1 := ch v4 := id, v2 := v1, v3 := v2);
END_FUNCTION;
THREAD_BLOCK rfbcMonitor;
VAR
event : INT := 0;
hisId : DINT;
broadcast : BOOL;
END_VAR;
WHILE event <> -1 DO
event := rfbcWaitEvent(timeout := -1, id := hisId, broadcast := broadcast);
CASE event OF
...
5 : GetSensorEvent(id := hisId);
...
ELSE
DebugFmt(message := "rfbcWaitEvent - event=\1", v1 := event);
END_CASE;
END_WHILE;
END_THREAD_BLOCK;
|