le_sim_interface.h
Go to the documentation of this file.
22 * A subscriber identity module or subscriber identification module (SIM) is an integrated circuit23 * that securely stores the international mobile subscriber identity (IMSI) and related key used to44 * le_sim_SelectCard() function is used to select the SIM identifier. By default, the SIM in slot 147 * SIM identifier. le_sim_GetSelectedCard() returns the current selected card, not necessarily the50 * @note The SIM selection is not reset persistent; this function has to be called at each start-up.52 * @note It is recommended to wait for a SIM handler notification after a new SIM selection before61 * Each SIM is internationally identified by its integrated circuit card identifier (ICCID). ICCIDs74 * The International Mobile Subscriber Identity or IMSI is a unique identification associated with80 * digits (European standard) or 3 digits (North American standard). The length of the MNC depends81 * on the value of the MCC. The remaining digits are the mobile subscription identification number87 * A eUICC is a SIM card with a remote provisioning function, and is designed to not be removed or88 * changed. It is able to store multiple communication profiles but only one is enabled (recognized89 * by the device and used for communication). With conventional SIM cards, the ICCID is used as the91 * profile, and a new identifier is defined, called the eUICCID (EID), which is used as the unique175 * typedef void(*le_sim_NewStateHandlerFunc_t)(@ref le_sim_Id_t simId, @c le_sim_States_t simState);181 * @note If two (or more) applications have registered a handler function for notifications, they184 * The application can uninstall the handler function by calling le_sim_RemoveNewStateHandler() API.196 * them is dedicated to emergency calls (ex: eCall, ERA-Glonass), local swap is needed to swap as202 * Local swap puts the eUICC in a temporary state, meaning the commercial subscription is replaced206 * The le_sim_LocalSwapToEmergencyCallSubscription() function requests the multi-profile eUICC to207 * swap to ECS and to refresh. The User's application must wait for eUICC reboot to be finished and210 * The le_sim_LocalSwapToCommercialSubscription() function requests the multi-profile eUICC to swap211 * back to commercial subscription and to refresh. The User's application must wait for eUICC reboot214 * The User's application can install an handler with le_sim_AddNewStateHandler() to receive eUICC's218 * - If you use a Morpho or Oberthur card, the SIM_REFRESH PRO-ACTIVE command must be accepted with221 * security restrictions for channel management APDU commands, otherwise local SIM profile switch257 * The SIM application Toolkit allows the SIM card to initiates commands or asking input from the262 * The embedded UICC (eUICC) format supports multiple subscription profiles, which can be remotely275 * The le_sim_AcceptSimToolkitCommand() allows the device to accept the last SIM Toolkit command.277 * The le_sim_RejectSimToolkitCommand() forbids the device to accept the last SIM Toolkit command.298 * Some parameters are platform dependent, see @subpage platformConstraintsSim "SIM constraints" for330 * @snippet "apps/test/modemServices/sim/simIntegrationTest/simTestComp/simTest.c" Authentication336 * @snippet "apps/test/modemServices/sim/simIntegrationTest/simTestComp/simTest.c" Identification365 //--------------------------------------------------------------------------------------------------369 //--------------------------------------------------------------------------------------------------372 //--------------------------------------------------------------------------------------------------375 * Connect the current client thread to the service providing this API. Block until the service is378 * For each thread that wants to use this API, either ConnectService or TryConnectService must be379 * called before any other functions in this API. Normally, ConnectService is automatically called384 //--------------------------------------------------------------------------------------------------390 //--------------------------------------------------------------------------------------------------393 * Try to connect the current client thread to the service providing this API. Return with an error396 * For each thread that wants to use this API, either ConnectService or TryConnectService must be397 * called before any other functions in this API. Normally, ConnectService is automatically called406 * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).409 //--------------------------------------------------------------------------------------------------415 //--------------------------------------------------------------------------------------------------419 * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants422 //--------------------------------------------------------------------------------------------------429 //--------------------------------------------------------------------------------------------------435 * longer a connection to the service, and the functions in this API can't be used. For details, see440 //--------------------------------------------------------------------------------------------------447 //--------------------------------------------------------------------------------------------------451 //--------------------------------------------------------------------------------------------------454 //--------------------------------------------------------------------------------------------------458 //--------------------------------------------------------------------------------------------------461 //--------------------------------------------------------------------------------------------------466 //--------------------------------------------------------------------------------------------------469 //--------------------------------------------------------------------------------------------------473 //--------------------------------------------------------------------------------------------------476 //--------------------------------------------------------------------------------------------------481 //--------------------------------------------------------------------------------------------------484 //--------------------------------------------------------------------------------------------------489 //--------------------------------------------------------------------------------------------------492 //--------------------------------------------------------------------------------------------------497 //--------------------------------------------------------------------------------------------------500 //--------------------------------------------------------------------------------------------------504 //--------------------------------------------------------------------------------------------------507 //--------------------------------------------------------------------------------------------------512 //--------------------------------------------------------------------------------------------------515 //--------------------------------------------------------------------------------------------------519 //--------------------------------------------------------------------------------------------------522 //--------------------------------------------------------------------------------------------------526 //--------------------------------------------------------------------------------------------------529 //--------------------------------------------------------------------------------------------------533 //--------------------------------------------------------------------------------------------------536 //--------------------------------------------------------------------------------------------------541 //--------------------------------------------------------------------------------------------------544 //--------------------------------------------------------------------------------------------------549 //--------------------------------------------------------------------------------------------------552 //--------------------------------------------------------------------------------------------------556 //--------------------------------------------------------------------------------------------------559 //--------------------------------------------------------------------------------------------------564 //--------------------------------------------------------------------------------------------------567 //--------------------------------------------------------------------------------------------------571 //--------------------------------------------------------------------------------------------------574 //--------------------------------------------------------------------------------------------------579 //--------------------------------------------------------------------------------------------------582 //--------------------------------------------------------------------------------------------------586 //--------------------------------------------------------------------------------------------------590 //--------------------------------------------------------------------------------------------------595 //--------------------------------------------------------------------------------------------------614 //--------------------------------------------------------------------------------------------------619 //--------------------------------------------------------------------------------------------------636 //--------------------------------------------------------------------------------------------------641 //--------------------------------------------------------------------------------------------------660 //--------------------------------------------------------------------------------------------------664 //--------------------------------------------------------------------------------------------------681 //--------------------------------------------------------------------------------------------------685 //--------------------------------------------------------------------------------------------------698 //--------------------------------------------------------------------------------------------------702 //--------------------------------------------------------------------------------------------------706 //--------------------------------------------------------------------------------------------------710 //--------------------------------------------------------------------------------------------------714 //--------------------------------------------------------------------------------------------------719 //--------------------------------------------------------------------------------------------------721 (730 //--------------------------------------------------------------------------------------------------735 //--------------------------------------------------------------------------------------------------737 (746 //--------------------------------------------------------------------------------------------------753 //--------------------------------------------------------------------------------------------------762 //--------------------------------------------------------------------------------------------------766 //--------------------------------------------------------------------------------------------------773 //--------------------------------------------------------------------------------------------------780 //--------------------------------------------------------------------------------------------------789 //--------------------------------------------------------------------------------------------------793 //--------------------------------------------------------------------------------------------------800 //--------------------------------------------------------------------------------------------------806 //--------------------------------------------------------------------------------------------------812 //--------------------------------------------------------------------------------------------------820 //--------------------------------------------------------------------------------------------------827 //--------------------------------------------------------------------------------------------------839 //--------------------------------------------------------------------------------------------------850 //--------------------------------------------------------------------------------------------------863 //--------------------------------------------------------------------------------------------------874 //--------------------------------------------------------------------------------------------------887 //--------------------------------------------------------------------------------------------------898 //--------------------------------------------------------------------------------------------------908 //--------------------------------------------------------------------------------------------------915 //--------------------------------------------------------------------------------------------------926 //--------------------------------------------------------------------------------------------------933 //--------------------------------------------------------------------------------------------------949 //--------------------------------------------------------------------------------------------------958 //--------------------------------------------------------------------------------------------------973 //--------------------------------------------------------------------------------------------------984 //--------------------------------------------------------------------------------------------------994 //--------------------------------------------------------------------------------------------------1001 //--------------------------------------------------------------------------------------------------1014 //--------------------------------------------------------------------------------------------------1023 //--------------------------------------------------------------------------------------------------1038 //--------------------------------------------------------------------------------------------------1047 //--------------------------------------------------------------------------------------------------1062 //--------------------------------------------------------------------------------------------------1071 //--------------------------------------------------------------------------------------------------1088 //--------------------------------------------------------------------------------------------------1099 //--------------------------------------------------------------------------------------------------1108 //--------------------------------------------------------------------------------------------------1115 //--------------------------------------------------------------------------------------------------1128 //--------------------------------------------------------------------------------------------------1139 //--------------------------------------------------------------------------------------------------1153 //--------------------------------------------------------------------------------------------------1164 //--------------------------------------------------------------------------------------------------1176 //--------------------------------------------------------------------------------------------------1191 //--------------------------------------------------------------------------------------------------1193 * This function must be called to request the multi-profile eUICC to swap to ECS and to refresh.1207 //--------------------------------------------------------------------------------------------------1216 //--------------------------------------------------------------------------------------------------1233 //--------------------------------------------------------------------------------------------------1242 //--------------------------------------------------------------------------------------------------1256 //--------------------------------------------------------------------------------------------------1266 //--------------------------------------------------------------------------------------------------1273 //--------------------------------------------------------------------------------------------------1280 //--------------------------------------------------------------------------------------------------1287 //--------------------------------------------------------------------------------------------------1294 //--------------------------------------------------------------------------------------------------1304 //--------------------------------------------------------------------------------------------------1319 //--------------------------------------------------------------------------------------------------1332 //--------------------------------------------------------------------------------------------------1363 //--------------------------------------------------------------------------------------------------1371 //--------------------------------------------------------------------------------------------------1378 //--------------------------------------------------------------------------------------------------1386 //--------------------------------------------------------------------------------------------------1392 //--------------------------------------------------------------------------------------------------1395 * If the FPLMNListRef, mcc or mnc is not valid then this function will kill the calling client.1402 //--------------------------------------------------------------------------------------------------1413 //--------------------------------------------------------------------------------------------------1423 //--------------------------------------------------------------------------------------------------1432 //--------------------------------------------------------------------------------------------------1440 //--------------------------------------------------------------------------------------------------1447 //--------------------------------------------------------------------------------------------------1460 //--------------------------------------------------------------------------------------------------1475 //--------------------------------------------------------------------------------------------------1477 * Read the next FPLMN network from the list of FPLMN objects retrieved with le_sim_ReadFPLMNList().1487 //--------------------------------------------------------------------------------------------------1502 //--------------------------------------------------------------------------------------------------1511 //--------------------------------------------------------------------------------------------------le_sim_NewStateHandlerRef_t le_sim_AddNewStateHandler(le_sim_NewStateHandlerFunc_t handlerPtr, void *contextPtr)bool le_sim_IsPresent(le_sim_Id_t simId)le_result_t le_sim_GetHomeNetworkOperator(le_sim_Id_t simId, char *nameStr, size_t nameStrSize)le_result_t le_sim_GetRemainingPUKTries(le_sim_Id_t simId, uint32_t *remainingPukTriesPtrPtr)void(* le_sim_SimToolkitEventHandlerFunc_t)(le_sim_Id_t simId, le_sim_StkEvent_t stkEvent, void *contextPtr)Definition: le_sim_interface.h:737le_result_t le_sim_LocalSwapToEmergencyCallSubscription(le_sim_Id_t simId, le_sim_Manufacturer_t manufacturer)le_result_t le_sim_ChangePIN(le_sim_Id_t simId, const char *LE_NONNULL oldpin, const char *LE_NONNULL newpin)le_result_t le_sim_SendApdu(le_sim_Id_t simId, const uint8_t *commandApduPtr, size_t commandApduSize, uint8_t *responseApduPtr, size_t *responseApduSizePtr)le_result_t le_sim_GetHomeNetworkMccMnc(le_sim_Id_t simId, char *mccPtr, size_t mccPtrSize, char *mncPtr, size_t mncPtrSize)le_result_t le_sim_GetFirstFPLMNOperator(le_sim_FPLMNListRef_t FPLMNListRef, char *mccPtr, size_t mccPtrSize, char *mncPtr, size_t mncPtrSize)struct le_sim_SimToolkitEventHandler * le_sim_SimToolkitEventHandlerRef_tDefinition: le_sim_interface.h:711void(* le_sim_NewStateHandlerFunc_t)(le_sim_Id_t simId, le_sim_States_t simState, void *contextPtr)Definition: le_sim_interface.h:721le_result_t le_sim_GetICCID(le_sim_Id_t simId, char *iccid, size_t iccidSize)void le_sim_SetServerDisconnectHandler(le_sim_DisconnectHandler_t disconnectHandler, void *contextPtr)le_result_t le_sim_GetNextFPLMNOperator(le_sim_FPLMNListRef_t FPLMNListRef, char *mccPtr, size_t mccPtrSize, char *mncPtr, size_t mncPtrSize)le_result_t le_sim_AcceptSimToolkitCommand(le_sim_Id_t simId)le_sim_FPLMNListRef_t le_sim_ReadFPLMNList(le_sim_Id_t simId)void le_sim_ConnectService(void)le_result_t le_sim_GetIMSI(le_sim_Id_t simId, char *imsi, size_t imsiSize)void le_sim_DisconnectService(void)struct le_sim_NewStateHandler * le_sim_NewStateHandlerRef_tDefinition: le_sim_interface.h:703void le_sim_DeleteFPLMNList(le_sim_FPLMNListRef_t FPLMNListRef)le_result_t le_sim_Reset(le_sim_Id_t simId)le_result_t le_sim_SendCommand(le_sim_Id_t simId, le_sim_Command_t command, const char *LE_NONNULL fileIdentifier, uint8_t p1, uint8_t p2, uint8_t p3, const uint8_t *dataPtr, size_t dataSize, const char *LE_NONNULL path, uint8_t *sw1Ptr, uint8_t *sw2Ptr, uint8_t *responsePtr, size_t *responseSizePtr)le_result_t le_sim_WriteFPLMNList(le_sim_Id_t simId, le_sim_FPLMNListRef_t FPLMNListRef)le_result_t le_sim_AddFPLMNOperator(le_sim_FPLMNListRef_t FPLMNListRef, const char *LE_NONNULL mcc, const char *LE_NONNULL mnc)le_result_t le_sim_SelectCard(le_sim_Id_t simId)le_result_t le_sim_GetEID(le_sim_Id_t simId, char *eid, size_t eidSize)void(* le_sim_DisconnectHandler_t)(void *)Definition: le_sim_interface.h:370int32_t le_sim_GetRemainingPINTries(le_sim_Id_t simId)le_sim_FPLMNListRef_t le_sim_CreateFPLMNList(void)bool le_sim_IsReady(le_sim_Id_t simId)le_sim_SimToolkitEventHandlerRef_t le_sim_AddSimToolkitEventHandler(le_sim_SimToolkitEventHandlerFunc_t handlerPtr, void *contextPtr)void le_sim_RemoveSimToolkitEventHandler(le_sim_SimToolkitEventHandlerRef_t handlerRef)void le_sim_RemoveNewStateHandler(le_sim_NewStateHandlerRef_t handlerRef)le_result_t le_sim_RejectSimToolkitCommand(le_sim_Id_t simId)struct le_sim_FPLMNList * le_sim_FPLMNListRef_tDefinition: le_sim_interface.h:587le_result_t le_sim_GetSubscriberPhoneNumber(le_sim_Id_t simId, char *phoneNumberStr, size_t phoneNumberStrSize)le_result_t le_sim_Unblock(le_sim_Id_t simId, const char *LE_NONNULL puk, const char *LE_NONNULL newpin)le_result_t le_sim_IsEmergencyCallSubscriptionSelected(le_sim_Id_t simId, bool *isEcsPtr)le_result_t le_sim_Unlock(le_sim_Id_t simId, const char *LE_NONNULL pin)le_result_t le_sim_Lock(le_sim_Id_t simId, const char *LE_NONNULL pin)le_sim_Id_t le_sim_GetSelectedCard(void)le_result_t le_sim_EnterPIN(le_sim_Id_t simId, const char *LE_NONNULL pin)le_sim_States_t le_sim_GetState(le_sim_Id_t simId)le_result_t le_sim_LocalSwapToCommercialSubscription(le_sim_Id_t simId, le_sim_Manufacturer_t manufacturer)le_result_t le_sim_TryConnectService(void)