gsmGetStatus (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

1.00 / 1.00.00


This returns the status for the GSM network connection.

 

Input:                

None.

 

Returns: SINT

0

- gsmPower has not been called.

1

- Not connected to GSM network.

2

- Connected to Home Net.

3

- Searching for provider.

4

- Access to GSM network denied.

5

- Roaming.

 

Declaration:

FUNCTION gsmGetStatus : SINT;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM gsmExample;
VAR
  provider : gsmGetProviderList;
  i       : INT;
END_VAR;
 
gsmPower(power:=ON);
WHILE NOT gsmConnected() DO Sleep(delay:=100); END_WHILE;
 
IF gsmGetStatus() = 5 THEN
  provider();
  IF provider.status = 0 THEN
    FOR i := 1 TO 16 DO
        IF provider.LAI[i] > 0 THEN
          IF provider.State[i] = 1 THEN
              gsmSetProvider(Provider:=provider.lai[i]);
              EXIT;
          END_IF;
        END_IF;  
    END_FOR;
  END_IF;
END_IF;
 
BEGIN
END;
 
END_PROGRAM;