gwIsOpen (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

4.60 / 1.00.00


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;

 
  // 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;