SIM card

group LWCELL_SIM

SIM card manager.

Enums

enum lwcell_sim_state_t

SIM state.

Values:

enumerator LWCELL_SIM_STATE_NOT_INSERTED

SIM is not inserted in socket

enumerator LWCELL_SIM_STATE_READY

SIM is ready for operations

enumerator LWCELL_SIM_STATE_NOT_READY

SIM is not ready for any operation

enumerator LWCELL_SIM_STATE_PIN

SIM is waiting for SIM to be given

enumerator LWCELL_SIM_STATE_PUK

SIM is waiting for PUT to be given

enumerator LWCELL_SIM_STATE_PH_PIN
enumerator LWCELL_SIM_STATE_PH_PUK
enumerator LWCELL_SIM_STATE_END

Functions

lwcell_sim_state_t lwcell_sim_get_current_state(void)

Get current cached SIM state from stack.

Note

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

Returns

Member of lwcell_sim_state_t enumeration

lwcellr_t lwcell_sim_pin_enter(const char *pin, const lwcell_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

lwcellOK on success, member of lwcellr_t enumeration otherwise

lwcellr_t lwcell_sim_pin_add(const char *pin, const lwcell_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 lwcell_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

lwcellOK on success, member of lwcellr_t enumeration otherwise

lwcellr_t lwcell_sim_pin_remove(const char *pin, const lwcell_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

lwcellOK on success, member of lwcellr_t enumeration otherwise

lwcellr_t lwcell_sim_pin_change(const char *pin, const char *new_pin, const lwcell_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

lwcellOK on success, member of lwcellr_t enumeration otherwise

lwcellr_t lwcell_sim_puk_enter(const char *puk, const char *new_pin, const lwcell_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

lwcellOK on success, member of lwcellr_t enumeration otherwise