This function will authenticate the user ID that has been received from the navigation device.
This function must be called when the status of navUserIDReceiveX returns 2 (user ID is ready, authentication is required).
Input:
accept : BOOL
Set to TRUE to accept the user, set to FALSE to reject the user.
Returns: INT
0
|
- Success.
|
-1
|
- Navigation interface is not open.
|
-2
|
- Error communicating with navigation device.
|
-3
|
- No user ID is waiting for authentication.
|
-11
|
- This is not supported by navigation device.
|
-12
|
- Navigation interface is busy.
|
Declaration:
FUNCTION navUserIDAuthenticate : INT;
VAR_INPUT
accept : BOOL;
END_VAR;
Example:
INCLUDE rtcu.inc
VAR
userID : navUserIDReceiveX;
END_VAR;
FUNCTION ReadUserID;
userID();
IF userID.status > 0 THEN
DebugMsg(message := "*** user ID received ***");
DebugFmt(message := "-time=\4", v4 := userID.time);
DebugFmt(message := "-idx= \1", v1 := userID.index);
DebugMsg(message := "-user=" + userID.user);
DebugMsg(message := "-pass=" + userID.password);
END_IF;
IF userID.status = 2 THEN
navUserIDAuthenticate(accept := TRUE);
END_IF;
END_FUNCTION;
THREAD_BLOCK navMonitor;
VAR
event : INT := 0;
END_VAR;
WHILE event <> -1 DO
event := navWaitEvent(timeout := -1);
CASE event OF
...
6: ReadUserID();
...
END_CASE;
END_WHILE;
END_THREAD_BLOCK;
|