rchAutoConnectGet (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

All

Firmware version:

1.54.00


This function will query the primary server configuration to determine if the connection to the RTCU Communication Hub will be opened automatically when the network interface is opened.

To query the fallback configuration use rchFallbackGet or SockGetGWParm.

 

Input:        

None

 

Returns: BOOL

TRUE if the connection will be opened, FALSE if not.

 

Declaration:

FUNCTION rchAutoConnectGet : BOOL;
 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM example;
VAR
  parm  : rchConfigGet;
  reset : BOOL := FALSE;
END_VAR;
 
// Check the RTCU Communication Hub settings
parm();
IF NOT rchAutoConnectGet() THEN
  rchAutoConnectSet(enable := ON);
  reset := TRUE;
END_IF;
IF NOT parm.enabled OR parm.secure OR parm.port <> 5001 OR
  parm.CryptKey[1] <> 0 OR parm.CryptKey[2] <> 0 OR
  parm.CryptKey[3] <> 0 OR parm.CryptKey[4] <> 0 OR
  parm.CryptKey[5] <> 0 OR parm.CryptKey[6] <> 0 OR
  parm.CryptKey[7] <> 0 OR parm.CryptKey[8] <> 0 OR
  parm.CryptKey[9] <> 0 OR parm.CryptKey[10] <> 0 OR
  parm.CryptKey[11] <> 0 OR parm.CryptKey[12] <> 0 OR
  parm.CryptKey[13] <> 0 OR parm.CryptKey[14] <> 0 OR
  parm.CryptKey[15] <> 0 OR parm.CryptKey[16] <> 0 OR
  parm.iface <> 2 OR strCompare(str1 := parm.address, str2 := "gw.rtcu.dk") <> 0 OR
  strCompare(str1 := parm.loginkey, str2 := "AABBCCDD") <> 0 THEN
  // Update settings
  rchConfigSet(enable := TRUE,
              address := "gw.rtcu.dk",
              port := 5001,
              iface := 2,
              loginkey := "AABBCCDD",
              secure := FALSE);
  reset := TRUE;
END_IF;
IF reset THEN
  // Reset device before the changes are used
  boardReset();
END_IF;
 
// Start network
netOpen(iface := 2);
 
BEGIN
END;
END_PROGRAM;