navStopReceive returns the status of a destination.
Note that the destination status is only valid after a "destination status" event is raised; the event will be removed when this function block is called.
A "destination status" event is raised when the status of a destination changes or is requested with navStopRequest.
Input:
None.
Output:
ID : INT
The ID used to identify the destination in navStopSet.
status : INT
The status of the destination.
1
|
- Active. The user is enroute to the destination.
|
2
|
- Done. The user has arrived at the destination.
|
3
|
- Unread inactive. The destination is received but the user has not read the destination comment yet.
|
4
|
- Read inactive. The user has read the destination comment.
|
5
|
- Deleted/not found. The destination has been deleted or could not be found.
|
index : INT
The index of the destination in the route.
ready : BOOL
TRUE:
|
If data is ready.
|
FALSE:
|
If data is not ready.
|
Declaration:
FUNCTION_BLOCK navStopReceive;
VAR_OUTPUT
ID : INT;
status : INT;
index : INT;
ready : BOOL;
END_VAR;
Example:
INCLUDE rtcu.inc
VAR
stopRcv : navStopReceive;
END_VAR;
FUNCTION ReadStopStatus;
stopRcv();
IF stopRcv.ready THEN
DebugMsg(message := "*** stop status received ***");
DebugFmt(message := "-stop=\1", v1 := stopRcv.ID);
DebugFmt(message := "-index=\1", v1 := stopRcv.index);
CASE stopRcv.status OF
1: DebugMsg(message := "-state=Active");
2: DebugMsg(message := "-state=Done");
3: DebugMsg(message := "-state=Unread - inactive");
4: DebugMsg(message := "-state=Read - inactive");
5: DebugMsg(message := "-state=Deleted/Not found");
ELSE
DebugFmt(message := "-state=\1", v1 := stopRcv.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
...
5: ReadStopStatus();
...
END_CASE;
END_WHILE;
END_THREAD_BLOCK;
|