navMessageStatusReceive returns the status of a text message.
Note that the message status is only valid after a "message status" event is raised; the event will be removed when this function block is called.
A "message status" event is raised when the status of a text message changes or is requested with navMessageStatusRequest.
Input:
None.
Output:
ID : INT
The ID used to identify the text message in navMessageSend.
status : SINT
The status of the text message.
1
|
- Unread.
|
2
|
- Read.
|
3
|
- Deleted/not found.
|
ready : BOOL
TRUE:
|
If data is ready.
|
FALSE:
|
If data is not ready.
|
Declaration:
FUNCTION_BLOCK navMessageStatusReceive;
VAR_OUTPUT
ID : INT;
status : SINT;
ready : BOOL;
END_VAR;
Example:
INCLUDE rtcu.inc
VAR
msgSts : navMessageStatusReceive;
END_VAR;
FUNCTION ReadMessageStatus;
msgSts();
IF msgSts.ready THEN
DebugMsg(message := "*** message status received ***");
DebugFmt(message := "-msgid=\1", v1 := msgSts.ID);
CASE msgSts.status OF
1: DebugMsg(message := "-status=Unread");
2: DebugMsg(message := "-status=Read");
3: DebugMsg(message := "-status=Deleted/Not found");
ELSE
DebugFmt(message := "-status=\1", v1 := msgSts.status);
END_CASE;
END_IF;
END_FUNCTION;
THREAD_BLOCK navMonitor;
VAR
event : INT := 0;
END_VAR;
WHILE event <> -1 DO
event := navWaitEvent(timeout := -1);
CASE event OF
...
3: ReadMessageStatus();
...
END_CASE;
END_WHILE;
END_THREAD_BLOCK;
|