This function reads the network interface used to connect to the RTCU Communication Hub.
This function works similarly to gwGetMedia.
Output:
iface : SINT
The network interface used to connect to the server. (see Network for available interfaces)
Returns: INT
1
|
- Success
|
0
|
- Not supported
|
-1
|
- Error reading media
|
Declaration:
FUNCTION rchInterfaceGet : INT;
VAR_INPUT
iface : ACCESS SINT;
END_VAR;
Example:
INCLUDE rtcu.inc
VAR_INPUT
eth : BOOL;
END_VAR;
VAR_OUTPUT
LED_GPRS : BOOL;
LED_RCH : BOOL;
END_VAR;
PROGRAM example;
VAR
rch_iface : SINT;
END_VAR;
gsmPower(power := ON);
netOpen(iface := 1);
netOpen(iface := 2);
DebugMsg(message:="Program running");
BEGIN
LED_GPRS := netConnected(iface := 1);
LED_RCH := gwConnected();
rchInterfaceGet(iface := rch_iface);
IF rch_iface <> 2 AND eth THEN
rchInterfaceSet(iface := 2);
ELSIF rch_iface <> 1 AND NOT eth THEN
rchInterfaceSet(iface := 1);
END_IF;
END;
END_PROGRAM
|