All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
pa_sim.h File Reference
#include "legato.h"
#include "interfaces.h"

Go to the source code of this file.

Data Structures

struct  pa_sim_Event_t
 

Macros

#define PA_SIM_CARDID_MAX_LEN   20
 
#define PA_SIM_IMSI_MAX_LEN   15
 
#define PA_SIM_PIN_MAX_LEN   8
 
#define PA_SIM_PUK_MAX_LEN   8
 

Typedefs

typedef char pa_sim_CardId_t [PA_SIM_CARDID_MAX_LEN+1]
 
typedef char pa_sim_Imsi_t [PA_SIM_IMSI_MAX_LEN+1]
 
typedef char pa_sim_Pin_t [PA_SIM_PIN_MAX_LEN+1]
 
typedef char pa_sim_Puk_t [PA_SIM_PUK_MAX_LEN+1]
 
typedef void(* pa_sim_NewStateHdlrFunc_t )(pa_sim_Event_t *eventPtr)
 

Enumerations

enum  pa_sim_PinType_t { PA_SIM_PIN =0, PA_SIM_PIN2 }
 
enum  pa_sim_PukType_t { PA_SIM_PUK =0, PA_SIM_PUK2 }
 

Functions

uint32_t pa_sim_CountSlots (void)
 
le_result_t pa_sim_SelectCard (uint32_t cardNum)
 
le_result_t pa_sim_GetSelectedCard (uint32_t *cardNumPtr)
 
le_result_t pa_sim_GetCardIdentification (pa_sim_CardId_t iccid)
 
le_result_t pa_sim_GetIMSI (pa_sim_Imsi_t imsi)
 
le_result_t pa_sim_GetState (le_sim_States_t *statePtr)
 
le_event_HandlerRef_t pa_sim_AddNewStateHandler (pa_sim_NewStateHdlrFunc_t handler)
 
le_result_t pa_sim_RemoveNewStateHandler (le_event_HandlerRef_t handlerRef)
 
le_result_t pa_sim_EnterPIN (pa_sim_PinType_t type, const pa_sim_Pin_t pin)
 
le_result_t pa_sim_EnterPUK (pa_sim_PukType_t type, const pa_sim_Puk_t puk, const pa_sim_Pin_t pin)
 
le_result_t pa_sim_GetPINRemainingAttempts (pa_sim_PinType_t type, uint32_t *attemptsPtr)
 
le_result_t pa_sim_GetPUKRemainingAttempts (pa_sim_PukType_t type, uint32_t *attemptsPtr)
 
le_result_t pa_sim_ChangePIN (pa_sim_PinType_t type, const pa_sim_Pin_t oldcode, const pa_sim_Pin_t newcode)
 
le_result_t pa_sim_EnablePIN (pa_sim_PinType_t type, const pa_sim_Pin_t code)
 
le_result_t pa_sim_DisablePIN (pa_sim_PinType_t type, const pa_sim_Pin_t code)
 
le_result_t pa_sim_GetSubscriberPhoneNumber (char *phoneNumberStr, size_t phoneNumberStrSize)
 

Detailed Description

Legato Modem SIM Platform Adapter API include file.

Copyright (C) Sierra Wireless, Inc. 2013. All rights reserved. Use of this work is subject to license.

Macro Definition Documentation

#define PA_SIM_CARDID_MAX_LEN   20

Maximum identification number length.

#define PA_SIM_IMSI_MAX_LEN   15

Maximum International Mobile Subscriber Identity length.

#define PA_SIM_PIN_MAX_LEN   8

Maximum PIN Code length.

#define PA_SIM_PUK_MAX_LEN   8

Maximum PUK Code length.

Typedef Documentation

typedef char pa_sim_CardId_t[PA_SIM_CARDID_MAX_LEN+1]

Type definition for an Identification number of the SIM card (20 digit)

typedef char pa_sim_Imsi_t[PA_SIM_IMSI_MAX_LEN+1]

Type definition for an International Mobile Subscriber Identity (16 digit)

typedef void(* pa_sim_NewStateHdlrFunc_t)(pa_sim_Event_t *eventPtr)

Prototype for handler functions used to report that a new SIM state notification.

Parameters
eventThe event notification.
typedef char pa_sim_Pin_t[PA_SIM_PIN_MAX_LEN+1]

Type definition for a pin code (8 digit max)

typedef char pa_sim_Puk_t[PA_SIM_PUK_MAX_LEN+1]

Type definition for a puk code (8 digit max)

Enumeration Type Documentation

Type of PIN.

Enumerator
PA_SIM_PIN 

PIN id.

PA_SIM_PIN2 

PIN2 id.

Type of PUK.

Enumerator
PA_SIM_PUK 

PUK id.

PA_SIM_PUK2 

PUK2 id.

Function Documentation

le_event_HandlerRef_t pa_sim_AddNewStateHandler ( pa_sim_NewStateHdlrFunc_t  handler)

This function must be called to register a handler for new SIM state notification handling.

Returns
A handler reference, which is only needed for later removal of the handler.
Note
Doesn't return on failure, so there's no need to check the return value for errors.
Parameters
[in]handlerThe handler function.
le_result_t pa_sim_ChangePIN ( pa_sim_PinType_t  type,
const pa_sim_Pin_t  oldcode,
const pa_sim_Pin_t  newcode 
)

This function change a code.

Returns
LE_BAD_PARAMETER The parameters are invalid.
LE_NOT_POSSIBLE The function failed.
LE_TIMEOUT No response was received from the SIM card.
LE_OK The function succeeded.
Parameters
[in]typeThe code type
[in]oldcodeOld code
[in]newcodeNew code
uint32_t pa_sim_CountSlots ( void  )

This function counts number of sim card available

Returns
LE_NOT_POSSIBLE The function failed.
LE_TIMEOUT No response was received.
number number of count slots
le_result_t pa_sim_DisablePIN ( pa_sim_PinType_t  type,
const pa_sim_Pin_t  code 
)

This function disables PIN locking (PIN or PIN2).

Returns
LE_BAD_PARAMETER The parameters are invalid.
LE_NOT_POSSIBLE The function failed.
LE_TIMEOUT No response was received from the SIM card.
LE_OK The function succeeded.
Parameters
[in]typeThe code type.
[in]codecode
le_result_t pa_sim_EnablePIN ( pa_sim_PinType_t  type,
const pa_sim_Pin_t  code 
)

This function enables PIN locking (PIN or PIN2).

Returns
LE_BAD_PARAMETER The parameters are invalid.
LE_NOT_POSSIBLE The function failed.
LE_TIMEOUT No response was received from the SIM card.
LE_OK The function succeeded.
Parameters
[in]typeThe pin type
[in]codecode
le_result_t pa_sim_EnterPIN ( pa_sim_PinType_t  type,
const pa_sim_Pin_t  pin 
)

This function enter the PIN code.

Returns
LE_BAD_PARAMETER The parameters are invalid.
LE_NOT_POSSIBLE The function failed.
LE_TIMEOUT No response was received.
LE_OK The function succeeded.
Parameters
[in]typepin type
[in]pinpin code
le_result_t pa_sim_EnterPUK ( pa_sim_PukType_t  type,
const pa_sim_Puk_t  puk,
const pa_sim_Pin_t  pin 
)

This function set the new PIN code.

  • use to set pin code by providing the PUK

All depends on SIM state which must be retrieved by pa_sim_GetState

Returns
LE_BAD_PARAMETER The parameters are invalid.
LE_NOT_POSSIBLE The function failed.
LE_TIMEOUT No response was received.
LE_OK The function succeeded.
Parameters
[in]typepuk type
[in]pukPUK code
[in]pinnew PIN code
le_result_t pa_sim_GetCardIdentification ( pa_sim_CardId_t  iccid)

This function get the card identification (ICCID).

Returns
LE_NOT_POSSIBLE The function failed.
LE_TIMEOUT No response was received.
LE_OK The function succeeded.
Parameters
[out]iccidICCID value
le_result_t pa_sim_GetIMSI ( pa_sim_Imsi_t  imsi)

This function get the International Mobile Subscriber Identity (IMSI).

Returns
LE_NOT_POSSIBLE The function failed.
LE_TIMEOUT No response was received.
LE_OK The function succeeded.
Parameters
[out]imsiIMSI value
le_result_t pa_sim_GetPINRemainingAttempts ( pa_sim_PinType_t  type,
uint32_t *  attemptsPtr 
)

This function get the remaining attempts of a pin code.

Returns
LE_BAD_PARAMETER The parameters are invalid.
LE_NOT_POSSIBLE The function failed.
LE_TIMEOUT No response was received from the SIM card.
LE_OK The function succeeded.
Parameters
[in]typeThe pin type
[out]attemptsPtrThe number of attempts still possible
le_result_t pa_sim_GetPUKRemainingAttempts ( pa_sim_PukType_t  type,
uint32_t *  attemptsPtr 
)

This function get the remaining attempts of a puk code.

Returns
LE_BAD_PARAMETER The parameters are invalid.
LE_NOT_POSSIBLE The function failed.
LE_TIMEOUT No response was received from the SIM card.
LE_OK The function succeeded.
Parameters
[in]typeThe puk type
[out]attemptsPtrThe number of attempts still possible
le_result_t pa_sim_GetSelectedCard ( uint32_t *  cardNumPtr)

This function get the card on which operations are operated.

Returns
LE_NOT_POSSIBLE The function failed.
LE_TIMEOUT No response was received.
LE_OK The function succeeded.
Parameters
[out]cardNumPtrThe card number selected.
le_result_t pa_sim_GetState ( le_sim_States_t statePtr)

This function get the SIM Status.

Returns
LE_NOT_POSSIBLE The function failed.
LE_TIMEOUT No response was received.
LE_OK The function succeeded.
Parameters
[out]statePtrSIM state
le_result_t pa_sim_GetSubscriberPhoneNumber ( char *  phoneNumberStr,
size_t  phoneNumberStrSize 
)

Get the SIM Phone Number.

Returns
  • LE_OK on success
  • LE_OVERFLOW if the Phone Number can't fit in phoneNumberStr
  • LE_NOT_POSSIBLE on any other failure
Parameters
[out]phoneNumberStrThe phone Number
[in]phoneNumberStrSizeSize of phoneNumberStr
le_result_t pa_sim_RemoveNewStateHandler ( le_event_HandlerRef_t  handlerRef)

This function must be called to unregister the handler for new SIM state notification handling.

Note
Doesn't return on failure, so there's no need to check the return value for errors.
le_result_t pa_sim_SelectCard ( uint32_t  cardNum)

This function selects the Card on which all further SIM operations have to be operated.

Returns
LE_NOT_POSSIBLE The function failed.
LE_TIMEOUT No response was received.
LE_OK The function succeeded.
Parameters
[in]cardNumThe card number to be selected.