This function block returns information about the status and progress of an NMP update as initiated with nmpUpdate.
Note that the progress is only valid after an "NMP Update Progress" event has been raised; the event will be removed when this function block is called.
The status must be 2 before the update can be considered complete, and the user can still cancel the update if he wants to.
Input:
None.
Output:
status : INT
The status of the transfer
2
|
- Update is started on NMP. If update is not forced, the user is allowed to cancel it.
|
1
|
- Transfer in progress.
|
0
|
- Transfer completed.
|
-2
|
- Error communicating with navigation device.
|
-3
|
- Error reading file.
|
-4
|
- The navigation device rejected the transfer.
|
progress : SINT
The progress of the transfer in percent.
ready : BOOL
TRUE:
|
If data is ready.
|
FALSE:
|
If data is not ready.
|
Declaration:
FUNCTION_BLOCK nmpUpdateProgressReceive;
VAR_OUTPUT
status : INT;
progress : SINT;
ready : BOOL;
END_VAR;
Example:
INCLUDE rtcu.inc
VAR
updRcv : nmpUpdateProgressReceive;
END_VAR;
FUNCTION ReadUpdProgress;
updRcv();
IF updRcv.ready THEN
DebugMsg(message := "*** Update progress received ***");
DebugFmt(message := "-status=\1", v1 := updRcv.status);
DebugFmt(message := "-progress=\1", v1 := updRcv.progress);
END_IF;
END_FUNCTION;
THREAD_BLOCK navMonitor;
VAR
event : INT := 0;
END_VAR;
WHILE event <> -1 DO
event := navWaitEvent(timeout := -1);
CASE event OF
...
10: ReadUpdProgress();
...
END_CASE;
END_WHILE;
END_THREAD_BLOCK;
|