gsmSimSetPIN (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

2.10 / 1.00.00


This function enables or disables the PIN code on the SIM card.

Optionally the PIN code can be changed when enabled.

Only PIN codes with 4 characters are supported.

 

The device must be reset for the changes to take effect.

 

Note: when the PIN code is enabled and/or changed, it is required to call gsmSetPIN so the device knows to use the correct PIN code when accessing the GSM module.

 

 

Input:

enable : BOOL

TRUE:

Enables the PIN code.

FALSE:

Disables the PIN code.

pin : STRING

The current PIN code to use for accessing the SIM card.

Note: the correct PIN code is required when enabling and disabling.

 

pin_new : STRING

The new PIN code.

Note: if this is empty, the PIN code will not be changed.

 

Returns:

0

Success.

1

General error.

2

GSM module is not powered on (see gsmPower()).

3

Failed to enable/disable PIN code.

4

Failed to change PIN code.

5

Illegal PIN code.

 

Declaration:

FUNCTION gsmSimSetPIN : INT;
VAR_INPUT
  enable : BOOL;
  pin     : STRING;
  pin_new : STRING;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
 
// Turn on power to the GSM module (it will now use "1234" as the pincode)
gsmPower(power := TRUE);
 
...
 
// Enable PIN code
gsmSimSetPIN(enable := TRUE, pin := "1234"); // Needs only to be set once
gsmSetPIN(pin :="1234"); // Needs only to be set once (The RTCU stores this information in non-volatile memory)
boardReset();
 
...
 
END_PROGRAM;