This returns information about whether the device is connected to the RTCU Communication Hub.
Input:
None.
Returns: BOOL
True if connection is established, false if not.
Declaration:
FUNCTION gwConnected : BOOL;
Example:
INCLUDE rtcu.inc
PROGRAM test;
VAR
incoming : gwReceivePacket;
Buf_in : ARRAY [1..4064] OF SINT;
Buf_out : ARRAY [1..4064] OF SINT;
size : INT;
END_VAR;
gsmPower(power := TRUE);
gprsOpen();
WHILE NOT gwConnected() DO
Sleep(delay := 2000);
END_WHILE;
size := gwPacketSize(nodeid := 2000);
IF size = 0 THEN
size := 480;
END_IF;
incoming.buffer := ADDR(Buf_in);
incoming.maxlength := size;
BEGIN
...
incoming();
IF incoming.sender > 0 THEN
...
END_IF;
...
gwSendPacket(receiver := 2000, buffer := ADDR(Buf_out), length := size);
...
END;
END_PROGRAM;
|