navMessageReceiveX (Functionblock)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

MX2, AX9, CX1 pro/flex/warp, SX1, MX2 turbo/encore/warp, AX9 turbo, NX-200, NX-400, NX-900

Firmware version:

2.20 / 1.00.00

Nav. API level:

2


navMessageReceiveX is an extended version of navMessageReceive and returns a text message received from the navigation device.

 

If the navigation device does not support API level 2, the function will work as navMessageReceive, and extended data will not be accessible.

 

Note that the text message is only valid after a "message received" event is raised; the event will be removed when this function block is called.

A "message received" event is raised when the user writes a text message or sends a quick message.

 

 

Input:

None.

 

 

Output:

time : DINT

The timestamp when the text message was sent from the navigation device.

 

id : INT

This message is a reply to the text message with this unique ID.

The ID will be zero on navigation devices that do not support message threading, or if it is not a reply.

 

message : STRING

The received text message.

 

ready : BOOL

TRUE:

If data is ready.

FALSE:

If data is not ready.

 

Declaration:

FUNCTION_BLOCK navMessageReceiveX;
VAR_OUTPUT
  id     : INT;
  time   : DINT;
  message : STRING;
  ready   : BOOL;
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
VAR
  msgRcv : navMessageReceiveX;
END_VAR;
 
FUNCTION ReadMessage;
  msgRcv();
  IF msgRcv.ready THEN
    DebugMsg(message := "*** message received ***");
    DebugFmt(message := "-time=\4", v4 := msgRcv.time);
    DebugFmt(message := "-last=\1", v1 := msgRcv.id);
    DebugMsg(message := "-text=" + msgRcv.message);
  END_IF;
END_FUNCTION;
 
THREAD_BLOCK navMonitor;
VAR
  event : INT := 0;
END_VAR;
 
WHILE event <> -1 DO
  event := navWaitEvent(timeout := -1);
  CASE event OF
     ...
    2: ReadMessage();
     ...
  END_CASE;
END_WHILE;
END_THREAD_BLOCK;