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;
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
rchConfigSet(enable := TRUE,
address := "gw.rtcu.dk",
port := 5001,
iface := 2,
loginkey := "AABBCCDD",
secure := FALSE);
reset := TRUE;
END_IF;
IF reset THEN
boardReset();
END_IF;
netOpen(iface := 2);
BEGIN
END;
END_PROGRAM;
|