netGetMobileParam (Functionblock)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

4.34 / 1.00.00


netGetMobileParam will read out the TCP/IP parameters previously set from the RTCU IDE or by the netSetMobileParam or sockSetTCPIPParm functions.

 

The format of an IP address is the same as returned by the sockGetLocalIP function.

 

Input:

None.

 

Output:

IP : DINT

The IP address of the device.

 

SubnetMask : DINT

The Subnet mask of the device.

 

Gateway : DINT

The TCP/IP gateway the device uses.

 

DNS1 : DINT

The first Domain Name Server the device uses to look up symbolic names.

 

DNS2 : DINT

The second Domain Name Server the device uses to look up symbolic names.

 

Authenticate : INT

The PPP authentication type:

0 = None.

1 = PAP.

2 = CHAP.

3 = PAP/CHAP.

 

Username : STRING

The user name the device uses in order to connect to the mobile network.

 

Password : STRING

The password the device uses in order to connect to the mobile network.

 

APN : STRING

The APN the device uses in order to connect to the mobile network.

 

 

Declaration:

FUNCTION_BLOCK netGetMobileParam;
VAR_OUTPUT
  IP             : DINT;
  SubnetMask     : DINT;
  Gateway        : DINT;
  DNS1           : DINT;
  DNS2           : DINT;
  Username       : STRING;
  Password       : STRING;
  APN            : STRING;
  Authenticate   : INT;
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  mobileParam  : netGetMobileParam;
END_VAR;
 
mobileParam();
IF NOT (mobileParam.IP = 0 AND mobileParam.SubnetMask = 0 AND mobileParam.Gateway = 0 AND
  mobileParam.DNS1 = 0 AND mobileParam.DNS2 = 0 AND mobileParam.Authenticate = 3 AND
  mobileParam.Username = "" AND mobileParam.Password = "" AND mobileParam.APN = "internet") THEN
  // Set APN and keep the default values for the others
  netSetMobileParam(APN := "internet");
END_IF;
 
// Turn on power to the GSM module
gsmPower(power := ON);
netOpen(iface := 1);
BEGIN
 
 // ...
 
END;
 
END_PROGRAM;