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

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

Return

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.

Return

lwgsmOK on success, member of lwgsmr_t enumeration otherwise

Parameters
  • [in] pin: Pin code in string format

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

  • [in] evt_arg: Custom argument for event callback function

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

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

Return

lwgsmOK on success, member of lwgsmr_t enumeration otherwise

Parameters
  • [in] pin: Current SIM pin code

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

  • [in] evt_arg: Custom argument for event callback function

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

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.

Return

lwgsmOK on success, member of lwgsmr_t enumeration otherwise

Parameters
  • [in] pin: Current pin code

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

  • [in] evt_arg: Custom argument for event callback function

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

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.

Return

lwgsmOK on success, member of lwgsmr_t enumeration otherwise

Parameters
  • [in] pin: Current pin code

  • [in] new_pin: New pin code

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

  • [in] evt_arg: Custom argument for event callback function

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

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.

Return

lwgsmOK on success, member of lwgsmr_t enumeration otherwise

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

  • [in] new_pin: New PIN code to use

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

  • [in] evt_arg: Custom argument for event callback function

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