This function reads the media used to connect to the RTCU Communication Hub.
This function works similarly to rchInterfaceGet.
Output:
media : SINT
Media to use for connecting to the RTCU Communication Hub.
0
|
- Mobile network
|
1
|
- Local network media (Ethernet).
|
2
|
- Local network media (USB Ethernet)
|
3
|
- Wireless network media (built-in WLAN or USB WLAN)
|
Returns: INT
1
|
- Success
|
0
|
- Not supported
|
-1
|
- Error reading media
|
Declaration:
FUNCTION gwGetMedia : INT;
VAR_INPUT
media : ACCESS SINT;
END_VAR;
Example:
INCLUDE rtcu.inc
VAR_INPUT
eth : BOOL;
END_VAR;
VAR_OUTPUT
LED_GPRS : BOOL;
LED_GW : BOOL;
END_VAR;
PROGRAM EthernetTest;
VAR
gw_media : SINT;
END_VAR;
gsmPower(power := ON);
gprsOpen();
ethOpen();
DebugMsg(message := "Program running");
BEGIN
LED_GPRS := gprsConnected();
LED_GW := gwConnected();
gwGetMedia(media := gw_media);
IF gw_media = 0 AND eth THEN
gwSetMedia(media := 1);
ELSIF gw_media = 1 AND NOT eth THEN
gwSetMedia(media := 0);
END_IF;
END;
END_PROGRAM;
|