netGetMonitorParam (Functionblock)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Firmware version:

4.70 / 1.30.00


This function will read out the parameters for the network monitoring service previously set by using the netSetMonitorParam function.

 

 

Input:

iface : SINT (default 1)

The network interface. 1 = Cellular network, 2 = LAN network, etc. (See Network)

Please note that currently only monitoring of the cellular network is supported.

 

 

Output:

Status : INT

1

- Success.

0

- Interface not available or not supported.

-1

- Illegal network interface.

 

Enabled : BOOL

Determines whether the network monitor service is enabled.

 

method : SINT

The method used by the network monitoring service to check the health of the connection.

1 = DNS lookup, 2 = Ping address.

 

MaxAttempt : INT

Maximum number of failed health check attempts before the necessary recovery actions are initiated.

 

AliveFreq : DINT

The number of seconds between successful health checks.

 

ping1 : DINT

The IP address of the primary server. (only used by ping)

 

ping2 : DINT

The IP address of the secondary server. (only used by ping)

 

Declaration:

FUNCTION_BLOCK netGetMonitorParam;
VAR_INPUT
   iface      : SINT := 1;
END_VAR;
VAR_OUTPUT
   status     : INT;
   Enabled    : BOOL;
   method     : SINT;
   MaxAttempt : INT;
   AliveFreq  : DINT;
   ping1      : DINT;
   ping2      : DINT;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
   monitor : netGetMonitorParam;
END_VAR;
 
// Check settings
monitor(iface := _NET_IFACE_CELLULAR);
IF NOT monitor.Enabled OR monitor.method <> 1 OR monitor.MaxAttempt <> 3 OR monitor.AliveFreq <> 180 THEN
   // Set network monitor parameters
   netSetMonitorParam(iface:=_NET_IFACE_CELLULAR, Enabled := TRUEmethod := 1MaxAttempt := 3, AliveFreq := 180);
   boardReset();
END_IF;
 
// Turn on power to the GSM module
gsmPower(power := ON);
gprsOpen();
 
BEGIN
   ...
END;
END_PROGRAM;