This returns information about whether an RTCU Communication Hub connection is opened in the device. The function will not tell if an actual connection is finally established, to determine this the gwConnected() function must be used.
Input:
None.
Returns: BOOL
True if connection is opened, false if not.
Declaration:
FUNCTION gwIsOpen : BOOL;
Example:
INCLUDE rtcu.inc
PROGRAM test;
VAR
timer : clockDayTimer;
rc : INT;
END_VAR;
timer(enable:=ON, start_hour:=12, start_minute:=0, stop_hour:=13, stop_minute:=30);
BEGIN
timer();
IF timer.q THEN
IF NOT gwIsOpen() THEN
DebugMsg(message := "Starting connection");
rc := gwOpen();
IF rc < 1 THEN
DebugFmt(message := " gwOpen=\1", v1 := rc);
END_IF;
END_IF;
ELSE
IF gwIsOpen() THEN
DebugMsg(message := "Stopping connection");
rc := gwClose();
IF rc < 1 THEN
DebugFmt(message := " gwClose=\1", v1 := rc);
END_IF;
END_IF;
END_IF;
IF gwConnected() THEN
END_IF;
END;
END_PROGRAM;
|