SIM card

group LWGSM_SIM

SIM card manager.

Enums

enum lwgsm_sim_state_t

SIM state.

Values:

enumerator LWGSM_SIM_STATE_NOT_INSERTED

SIM is not inserted in socket

enumerator LWGSM_SIM_STATE_READY

SIM is ready for operations

enumerator LWGSM_SIM_STATE_NOT_READY

SIM is not ready for any operation

enumerator LWGSM_SIM_STATE_PIN

SIM is waiting for SIM to be given

enumerator LWGSM_SIM_STATE_PUK

SIM is waiting for PUT to be given

enumerator LWGSM_SIM_STATE_PH_PIN
enumerator LWGSM_SIM_STATE_PH_PUK
enumerator LWGSM_SIM_STATE_END

Functions

lwgsm_sim_state_t lwgsm_sim_get_current_state(void)

Get current cached SIM state from stack.

Note

Information is always valid, starting after successful device reset using lwgsm_reset function call

Returns

Member of lwgsm_sim_state_t enumeration

lwgsmr_t lwgsm_sim_pin_enter(const char *pin, const lwgsm_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)

Enter pin code to unlock SIM.

Parameters
  • pin[in] Pin code in string format

  • evt_fn[in] Callback function called when command has finished. Set to NULL when not used

  • evt_arg[in] Custom argument for event callback function

  • blocking[in] Status whether command should be blocking or not

Returns

lwgsmOK on success, member of lwgsmr_t enumeration otherwise

lwgsmr_t lwgsm_sim_pin_add(const char *pin, const lwgsm_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)

Add pin number to open SIM card.

Note

Use this function only if your SIM card doesn’t have PIN code. If you wish to change current pin, use lwgsm_sim_pin_change instead

Parameters
  • pin[in] Current SIM pin code

  • evt_fn[in] Callback function called when command has finished. Set to NULL when not used

  • evt_arg[in] Custom argument for event callback function

  • blocking[in] Status whether command should be blocking or not

Returns

lwgsmOK on success, member of lwgsmr_t enumeration otherwise

lwgsmr_t lwgsm_sim_pin_remove(const char *pin, const lwgsm_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)

Remove pin code from SIM.

Parameters
  • pin[in] Current pin code

  • evt_fn[in] Callback function called when command has finished. Set to NULL when not used

  • evt_arg[in] Custom argument for event callback function

  • blocking[in] Status whether command should be blocking or not

Returns

lwgsmOK on success, member of lwgsmr_t enumeration otherwise

lwgsmr_t lwgsm_sim_pin_change(const char *pin, const char *new_pin, const lwgsm_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)

Change current pin code.

Parameters
  • pin[in] Current pin code

  • new_pin[in] New pin code

  • evt_fn[in] Callback function called when command has finished. Set to NULL when not used

  • evt_arg[in] Custom argument for event callback function

  • blocking[in] Status whether command should be blocking or not

Returns

lwgsmOK on success, member of lwgsmr_t enumeration otherwise

lwgsmr_t lwgsm_sim_puk_enter(const char *puk, const char *new_pin, const lwgsm_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)

Enter PUK code and new PIN to unlock SIM card.

Parameters
  • puk[in] PUK code associated with SIM card

  • new_pin[in] New PIN code to use

  • evt_fn[in] Callback function called when command has finished. Set to NULL when not used

  • evt_arg[in] Custom argument for event callback function

  • blocking[in] Status whether command should be blocking or not

Returns

lwgsmOK on success, member of lwgsmr_t enumeration otherwise