gwClose (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

4.60 / 1.00.00


This function closes the connection to the RTCU Communication Hub.

 

Please also see gwOpen.

 

 

Input:        

None.

 

Returns: INT

1

- Success.

0

- Not available.

-1

- The  RTCU Communication Hub connection is not open.

 

Declaration:

FUNCTION gwClose : INT;
 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  timer   : clockDayTimer;
  rc       : INT;
END_VAR;

 
  // Initialize
  timer(enable:=ON, start_hour:=12, start_minute:=0, stop_hour:=13, stop_minute:=30);
 
BEGIN
  // Manage RTCU Communication Hub connection
  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
    // Connection is ready for work
  END_IF;
END;
END_PROGRAM;