This function will open a connection to the RTCU Communication Hub, using the configuration set with sockSetGWParm, rchConfigSet or rchFallbackSet.
Also see gwClose for closing the connection to the RTCU Communication Hub.
Input:
None.
Returns: INT
1
|
- Success.
|
0
|
- Not available.
|
-1
|
- The RTCU Communication Hub connection is already open.
|
-2
|
- Invalid RTCU Communication Hub configuration.
|
Declaration:
FUNCTION gwOpen : INT;
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;
|