This function will wait until an event is raised with an optional timeout.
An event is a notification that something has happened in the navigation interface.
There are 2 types of events:
1. | Events triggered by the application by a request for information (solicited event). |
2. | Events triggered by the Navigation device (unsolicited event). |
The events are queued until appropriate action is taken as described in this table:
navWaitEvent notifies the application of the oldest queued event.
This means that if the appropriate action is not taken, navWaitEvent will continue to report the same event.
Note: waiting for an event by using this function will block the calling thread.
Input:
timeout : INT (-1,0..32000) (default -1)
Timeout period in milliseconds to wait.
0
|
- Disable timeout. The function will return immediately.
|
-1
|
- Wait forever. The function will only return when data is received.
|
Returns: INT
-1
|
- Navigation interface is not open.
|
0
|
- Timeout.
|
1
|
- A message reply is received.
|
2
|
- A message is received.
|
3
|
- A message status is received.
|
4
|
- An ETA is received.
|
5
|
- A stop status is received.
|
6
|
- A user ID is received.
|
7
|
- A user status is received.
|
8
|
- The ID of the GPI is received.
|
9
|
- The GPI transfer progress is updated.
|
10
|
- The NMP update progress is updated.
|
11
|
- A button has been pressed on the NMP.
|
12
|
- A button has been clicked in an NMP dialog.
|
13
|
- A hardware button has been pressed on the NMP.
|
129
|
- A request to refresh the quick message list is received.
|
130
|
- A request to refresh the message reply list is received.
|
131
|
- A request to refresh the user status list is received.
|
132
|
- Connection to a navigation device is established.
|
133
|
- Connection to the navigation device lost.
|
Declaration:
FUNCTION navWaitEvent : INT;
VAR_INPUT
timeout : INT := -1;
END_VAR;
Example:
INCLUDE rtcu.inc
THREAD_BLOCK navMonitor;
VAR
event : INT := 0;
END_VAR;
WHILE event <> -1 DO
event := navWaitEvent(timeout := -1);
CASE event OF
1: ReadMessageReply();
2: ReadMessage();
3: ReadMessageStatus();
4: ReadETA();
5: ReadStopStatus();
6: ReadUserID();
7: ReadUserStatus();
129: DebugMsg(message := "Request for refresh of quick messages");
130: DebugMsg(message := "Request for refresh of message replies");
131: DebugMsg(message := "Request for refresh of user status");
132: DebugMsg(message := "Navigation device present");
133: DebugMsg(message := "Navigation device not present");
ELSE
DebugFmt(message := "navWaitEvent - event=\1", v1 := event);
END_CASE;
END_WHILE;
END_THREAD_BLOCK;
|