rchIsOpen (Function)

Top  Previous  Next

Architecture:

NX32L

Firmware version:

1.54.00


This returns information about whether a 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 rchConnected function must be used.

 

The rchIsOpen function is functionally identical to and interchangeable with the gwIsOpen function.

 

 

Input:        

None.

 

Returns: BOOL

True if connection is opened, false if not.

 

Declaration:

FUNCTION rchIsOpen : 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 connection
   timer();
   IF timer.THEN
      IF NOT rchIsOpen() THEN
         DebugMsg(message := "Starting connection");
         rc := rchOpen();
         IF rc < 1 THEN
            DebugFmt(message := "  rchOpen=\1", v1 := rc);
         END_IF;
      END_IF;
   ELSE
      IF rchIsOpen() THEN
         DebugMsg(message := "Stopping connection");
         rc := rchClose();
         IF rc < 1 THEN
            DebugFmt(message := "  rchClose=\1", v1 := rc);
         END_IF;
      END_IF;
   END_IF;

 
   IF rchConnected() THEN
      // Connection is ready for work
   END_IF;
END;
END_PROGRAM;