le_sim_interface.h

Go to the documentation of this file.
1 
2 
3 /*
4  * ====================== WARNING ======================
5  *
6  * THE CONTENTS OF THIS FILE HAVE BEEN AUTO-GENERATED.
7  * DO NOT MODIFY IN ANY WAY.
8  *
9  * ====================== WARNING ======================
10  */
11 
12 /**
13  * @page c_sim SIM
14  *
15  * @ref le_sim_interface.h "API Reference" <br>
16  * @ref platformConstraintsSim "SIM constraints"
17  *
18  * <HR>
19  *
20  * This file contains prototype definitions for SIM API.
21  *
22  * A subscriber identity module or subscriber identification module (SIM) is an integrated circuit
23  * that securely stores the international mobile subscriber identity (IMSI) and related key used to
24  * identify and authenticate subscribers on M2M devices.
25  *
26  * Most SIM cards can store a number of SMS messages and phone book contacts.
27  *
28  * le_sim_GetSelectedCard() returns the selected SIM card number.
29  *
30  * @section le_sim_binding IPC interfaces binding
31  *
32  * All the functions of this API are provided by the @b modemService.
33  *
34  * Here's a code sample binding to modem services:
35  * @verbatim
36  bindings:
37  {
38  clientExe.clientComponent.le_sim -> modemService.le_sim
39  }
40  @endverbatim
41  *
42  *
43  * @section le_sim_SelectCard Select a card to use
44  * le_sim_SelectCard() function is used to select the SIM identifier. By default, the SIM in slot 1
45  * is used.
46  * Additionally, any Legato SIM API with a SIM card identifier passed in parameter, selects that
47  * SIM identifier. le_sim_GetSelectedCard() returns the current selected card, not necessarily the
48  * one set previously by le_sim_SelectCard().
49  *
50  * @note The SIM selection is not reset persistent; this function has to be called at each start-up.
51  *
52  * @note It is recommended to wait for a SIM handler notification after a new SIM selection before
53  * calling le_sim API functions.
54  *
55  *
56  * A sample code can be seen in the following page:
57  * - @subpage c_simTestSelect
58  *
59  * @section le_sim_id SIM identification information
60  * \b ICCID:
61  * Each SIM is internationally identified by its integrated circuit card identifier (ICCID). ICCIDs
62  * are stored in the SIM cards and engraved or printed on the SIM card body.
63  * The ICCID is defined by the ITU-T recommendation E.118 as the
64  * Primary Account Number. According to E.118, the number is up to 19 digits long, including a
65  * single check digit calculated using the Luhn algorithm. However, the GSM Phase 1 (ETSI
66  * Recommendation GSM 11.11) defined the ICCID length as 10 octets (20 digits) with
67  * operator-specific structure.
68  *
69  * le_sim_GetICCID() API reads the identification number (ICCID).
70  *
71  * Using this API selects the requested SIM.
72  *
73  * \b IMSI:
74  * The International Mobile Subscriber Identity or IMSI is a unique identification associated with
75  * all cellular networks. The IMSI is used in any mobile network that connects with other
76  * networks. For GSM, UMTS and LTE network, this number is provisioned in the SIM card.
77  *
78  * An IMSI is usually presented as a 15 digit long number, but can be shorter. The first 3 digits
79  * are the mobile country code (MCC), are followed by the mobile network code (MNC), either 2
80  * digits (European standard) or 3 digits (North American standard). The length of the MNC depends
81  * on the value of the MCC. The remaining digits are the mobile subscription identification number
82  * (MSIN) within the network's customer base.
83  *
84  * \b EID:
85  * The EID (also called eUICCID) is the unique identifier for the embedded Universal Integrated
86  * Circuit Card (eUICC).
87  * A eUICC is a SIM card with a remote provisioning function, and is designed to not be removed or
88  * changed. It is able to store multiple communication profiles but only one is enabled (recognized
89  * by the device and used for communication). With conventional SIM cards, the ICCID is used as the
90  * unique key to identify the SIM card, but with eUICC, the ICCID is the key used to identify a
91  * profile, and a new identifier is defined, called the eUICCID (EID), which is used as the unique
92  * key for the embedded SIM.
93  * le_sim_GetEID() API reads the EID.
94  *
95  * \b Home \b Network \b Name:
96  * le_sim_GetHomeNetworkOperator() retrieves the Home Network Name.
97  *
98  * le_sim_GetIMSI() API reads the international mobile subscriber identity (IMSI).
99  *
100  * Using this API selects the requested SIM.
101  *
102  * \b Phone \b Number:
103  * le_sim_GetSubscriberPhoneNumber() API reads the Phone Number associated to the SIM.
104  * If the phone number has not been provisioned, it will return the empty string.
105  *
106  * Using this API selects the requested SIM.
107  *
108  * \b Home \b Network \b Information:
109  * - le_sim_GetHomeNetworkOperator()function retrieves the Home Network Name.
110  * - le_sim_GetHomeNetworkMccMnc()function retrieves the Home Network MCC (Mobile Country Code)
111  * and MNC (Mobile Network Code).
112  *
113  * A sample code can be seen in the following page:
114  * - @subpage c_simTestIdentification
115  *
116  * @section le_sim_auth SIM Authentication
117  * le_sim_EnterPIN() enters the PIN (Personal Identification Number) code that's
118  * required before any Mobile equipment functionality can be used.
119  *
120  * Using this API selects the requested SIM.
121  *
122  * le_sim_GetRemainingPINTries() returns the number of remaining PIN entry attempts
123  * before the SIM will become blocked.
124  *
125  * Using this API selects the requested SIM.
126  *
127  * le_sim_GetRemainingPUKTries() returns the number of remaining PUK entry attempts
128  * before the SIM will become blocked.
129  *
130  * Using this API selects the requested SIM.
131  *
132  * le_sim_ChangePIN() must be called to change the PIN code.
133  *
134  * Using this API selects the requested SIM.
135  *
136  * le_sim_Lock() locks the SIM card: it enables requests for the PIN code.
137  *
138  * Using this API selects the requested SIM.
139  *
140  * le_sim_Unlock() unlocks the SIM card: it disables requests for the PIN code.
141  *
142  * Using this API selects the requested SIM.
143  *
144  * le_sim_Unblock() unblocks the SIM card. The SIM card is blocked after X unsuccessful
145  * attempts to enter the PIN. le_sim_Unblock() requires the PUK (Personal Unblocking) code
146  * to set a new PIN code.
147  *
148  * A sample code can be seen in the following page:
149  * - @subpage c_simTestAuthentication
150  *
151  * @section le_sim_state SIM states
152  * le_sim_IsPresent() API advises the SIM is inserted (and locked) or removed.
153  *
154  * Using this API selects the requested SIM.
155  *
156  * le_sim_IsReady() API advises the SIM is ready (PIN code correctly entered
157  * or not required).
158  *
159  * Using this API selects the requested SIM.
160  *
161  * The le_sim_GetState() API retrieves the SIM state:
162  * - LE_SIM_INSERTED : SIM card is inserted and locked.
163  * - LE_SIM_ABSENT : SIM card is absent.
164  * - LE_SIM_READY : SIM card is inserted and unlocked.
165  * - LE_SIM_BLOCKED : SIM card is blocked.
166  * - LE_SIM_BUSY : SIM card is busy.
167  * - LE_SIM_STATE_UNKNOWN : Unknown SIM state.
168  *
169  * Using this API selects the requested SIM.
170  *
171  * A handler function must be registered to receive SIM's state notifications.
172  * le_sim_AddNewStateHandler() API allows the User to register that handler.
173  *
174  * The handler must satisfy the following prototype:
175  * typedef void(*le_sim_NewStateHandlerFunc_t)(@ref le_sim_Id_t simId, @c le_sim_States_t simState);
176  *
177  * When a new SIM's state is notified, the handler is called.
178  *
179  * Call le_sim_GetState() to retrieve the new state of the SIM.
180  *
181  * @note If two (or more) applications have registered a handler function for notifications, they
182  * will all receive it and will be passed the same SIM.
183  *
184  * The application can uninstall the handler function by calling le_sim_RemoveNewStateHandler() API.
185  *
186  * @warning Your platform might need a reboot to detect a SIM insertion or removal.
187  * Please refer to the @ref platformConstraintsSim "SIM constraints" page or your platform
188  * documentation for further details.
189  *
190  * A sample code can be seen in the following page:
191  * - @subpage c_simTestStates
192  *
193  * @section le_sim_profile_switch Local SIM profile switch
194  *
195  * As soon as there are several subscriptions/profiles in the eUICC (multi-profile), and one of
196  * them is dedicated to emergency calls (ex: eCall, ERA-Glonass), local swap is needed to swap as
197  * quickly as possible to the emergency profile in case of need.
198  *
199  * “Local swap” means that the User's application must be able to directly request the eUICC to
200  * swap to Emergency Call Subscription (ECS).
201  *
202  * Local swap puts the eUICC in a temporary state, meaning the commercial subscription is replaced
203  * by emergency subscription for a limited time, event triggering the swap back to commercial
204  * subscription being controlled by the User's application.
205  *
206  * The le_sim_LocalSwapToEmergencyCallSubscription() function requests the multi-profile eUICC to
207  * swap to ECS and to refresh. The User's application must wait for eUICC reboot to be finished and
208  * network connection available.
209  *
210  * The le_sim_LocalSwapToCommercialSubscription() function requests the multi-profile eUICC to swap
211  * back to commercial subscription and to refresh. The User's application must wait for eUICC reboot
212  * to be finished and network connection available.
213  *
214  * The User's application can install an handler with le_sim_AddNewStateHandler() to receive eUICC's
215  * state notifications.
216  *
217  * @warning
218  * - If you use a Morpho or Oberthur card, the SIM_REFRESH PRO-ACTIVE command must be accepted with
219  * le_sim_AcceptSimToolkitCommand() in order to complete the profile swap procedure.
220  * - If you use a Giesecke & Devrient (G&D) card, be sure that your platform has disabled
221  * security restrictions for channel management APDU commands, otherwise local SIM profile switch
222  * could not work.
223  *
224  * The le_sim_IsEmergencyCallSubscriptionSelected() function must be called to get the current
225  * subscription.
226  *
227  * @warning There is no standard method to interrogate the current selected subscription. The
228  * returned value of this function is based on the last executed local swap command. This means
229  * that this function will always return LE_NOT_FOUND error at Legato startup.
230  *
231  * A sample code can be seen in the following page:
232  * - @subpage c_simTestProfileSwitch
233  *
234  * @section le_sim_Reset SIM Reset
235  *
236  * The le_sim_Reset() function resets the SIM card.
237  *
238  * @section le_sim_FPLMNList Read / Write FPLMN List from SIM
239  *
240  * The le_sim_CreateFPLMNList() function creates the empty FPLMN list.
241  *
242  * The le_sim_AddFPLMNOperator() function adds the FPLMN network into FPLMN list.
243  *
244  * The le_sim_WriteFPLMNList() function writes FPLMN list into the SIM.
245  *
246  * The le_sim_ReadFPLMNList() function reads the FPLMN list from the SIM card.
247  *
248  * The le_sim_GetFirstFPLMNOperator() function fetches the first FPLMN operator from FPLMN list.
249  *
250  * The le_sim_GetNextFPLMNOperator() function fetches the next FPLMN operator from FPLMN list.
251  *
252  * The le_sim_DeleteFPLMNList() function releases all allocated resources associated with the
253  * List object.
254  *
255  * @section le_sim_stk SIM Toolkit
256  *
257  * The SIM application Toolkit allows the SIM card to initiate commands or asking input from the
258  * modem to accept/reject SIM operations.
259  *
260  * One of the use case is the remote provisioning of an embedded UICC (eUICC): the eUICC format
261  * supports multiple subscription profiles, which can be remotely provisioned, updated or selected
262  * through SIM Toolkit procedures (Bearer Independent Protocol @em BIP, SIM refresh).
263  *
264  * It is mainly used for in-vehicle emergency call service (eCall).
265  *
266  * An eUICC can be remotely managed to change the Mobile Network Operator subscription.
267  *
268  * The le_sim_AddSimToolkitEventHandler() API registers a handler to be notified of SIM
269  * Toolkit events. The le_sim_RemoveSimToolkitEventHandler() API unregisters the handler.
270  *
271  * The last received SIM Toolkit command can:
272  * - Either be accepted by the device with the le_sim_AcceptSimToolkitCommand() API
273  * - Or be rejected by the device with the le_sim_RejectSimToolkitCommand() API.
274  *
275  * In case the last SIM Toolkit command is a Refresh command (@ref LE_SIM_REFRESH), additional
276  * information can be retrieved:
277  * - The le_sim_GetSimToolkitRefreshStage() API gets the stage of the Refresh command.
278  * - The le_sim_GetSimToolkitRefreshMode() API gets the mode of the Refresh command, as defined in
279  * ETSI TS 102 223 sections 6.4.7 and 8.6.
280  *
281  * A sample code using the SIM Toolkit APIs can be seen in the following page:
282  * - @subpage c_simTestSimToolkit
283  *
284  * Information related to SIM Toolkit platform constraints can be found in the
285  * @ref platformConstraintsStk "SIM Toolkit platform constraints" page.
286  *
287  * @section le_sim_access SIM access
288  *
289  * The application can send an APDU (Application Protocol Data Unit) to the SIM using
290  * le_sim_SendApdu() API. The user must encode the APDU as specified by in recommendation 3GPP
291  * 11.11, 3GPP 51.011, 3GPP 31.102, 3GPP 31.103 or ETSI TS 102 221.
292  * @note Between two successive call to le_sim_SendApdu() API, there is no locking
293  * protection. In this situation, some command types and parameters can modify SIM files
294  * incorrectly.
295  *
296  * Using le_sim_SendCommand(), the application has easier but more limited access to the
297  * SIM database. The command is transmitted to the SIM, which gives information through swi1 and
298  * swi2 about the execution of the command (see 3GPP recommendation previously mentioned for
299  * their coding).
300  * Some parameters are platform dependent, see @subpage platformConstraintsSim "SIM constraints" for
301  * their coding.
302  *
303  * A sample code can be seen in the following page:
304  * - @subpage c_simTestApdu
305  *
306  * <HR>
307  *
308  * Copyright (C) Sierra Wireless Inc.
309  */
310 /**
311  * @file le_sim_interface.h
312  *
313  * Legato @ref c_sim include file.
314  *
315  * Copyright (C) Sierra Wireless Inc.
316  */
317 /**
318  * @page c_simTestProfileSwitch Sample code for Local SIM profile switch
319  *
320  * @include "apps/test/modemServices/sim/simProfileSwap/simTestComp/simTest.c"
321  */
322 /**
323  * @page c_simTestSimToolkit Sample code for Local SIM Toolkit
324  *
325  * @include "apps/test/modemServices/sim/simToolkit/simToolkitComp/simToolkitTest.c"
326  */
327 /**
328  * @page c_simTestAuthentication Sample code for SIM Authentication
329  *
330  * @snippet "apps/test/modemServices/sim/simIntegrationTest/simTestComp/simTest.c" Define
331  * @snippet "apps/test/modemServices/sim/simIntegrationTest/simTestComp/main.c" Print
332  * @snippet "apps/test/modemServices/sim/simIntegrationTest/simTestComp/simTest.c" Authentication
333  */
334 /**
335  * @page c_simTestIdentification Sample code for SIM Identification
336  *
337  * @snippet "apps/test/modemServices/sim/simIntegrationTest/simTestComp/main.c" Print
338  * @snippet "apps/test/modemServices/sim/simIntegrationTest/simTestComp/simTest.c" Identification
339  */
340 /**
341  * @page c_simTestSelect Sample code for SIM Select
342  * @snippet "apps/test/modemServices/sim/simIntegrationTest/simTestComp/simTest.c" Select
343  */
344 /**
345  * @page c_simTestStates Sample code for SIM States
346  *
347  * @snippet "apps/test/modemServices/sim/simIntegrationTest/simTestComp/main.c" Print
348  * @snippet "apps/test/modemServices/sim/simIntegrationTest/simTestComp/simTest.c" Display
349  * @snippet "apps/test/modemServices/sim/simIntegrationTest/simTestComp/simTest.c" State handler
350  * @snippet "apps/test/modemServices/sim/simIntegrationTest/simTestComp/simTest.c" State
351  */
352 /**
353  * @page c_simTestApdu Sample code for SIM access
354  * @snippet "apps/test/modemServices/sim/simIntegrationTest/simTestComp/simTest.c" Apdu
355  */
356 
357 #ifndef LE_SIM_INTERFACE_H_INCLUDE_GUARD
358 #define LE_SIM_INTERFACE_H_INCLUDE_GUARD
359 
360 
361 #include "legato.h"
362 
363 // Interface specific includes
364 #include "le_mdmDefs_interface.h"
365 
366 
367 //--------------------------------------------------------------------------------------------------
368 /**
369  * Type for handler called when a server disconnects.
370  */
371 //--------------------------------------------------------------------------------------------------
372 typedef void (*le_sim_DisconnectHandler_t)(void *);
373 
374 //--------------------------------------------------------------------------------------------------
375 /**
376  *
377  * Connect the current client thread to the service providing this API. Block until the service is
378  * available.
379  *
380  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
381  * called before any other functions in this API. Normally, ConnectService is automatically called
382  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
383  *
384  * This function is created automatically.
385  */
386 //--------------------------------------------------------------------------------------------------
388 (
389  void
390 );
391 
392 //--------------------------------------------------------------------------------------------------
393 /**
394  *
395  * Try to connect the current client thread to the service providing this API. Return with an error
396  * if the service is not available.
397  *
398  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
399  * called before any other functions in this API. Normally, ConnectService is automatically called
400  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
401  *
402  * This function is created automatically.
403  *
404  * @return
405  * - LE_OK if the client connected successfully to the service.
406  * - LE_UNAVAILABLE if the server is not currently offering the service to which the client is
407  * bound.
408  * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
409  * - LE_COMM_ERROR if the Service Directory cannot be reached.
410  */
411 //--------------------------------------------------------------------------------------------------
413 (
414  void
415 );
416 
417 //--------------------------------------------------------------------------------------------------
418 /**
419  * Set handler called when server disconnection is detected.
420  *
421  * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants
422  * to continue without exiting, it should call longjmp() from inside the handler.
423  */
424 //--------------------------------------------------------------------------------------------------
426 (
427  le_sim_DisconnectHandler_t disconnectHandler,
428  void *contextPtr
429 );
430 
431 //--------------------------------------------------------------------------------------------------
432 /**
433  *
434  * Disconnect the current client thread from the service providing this API.
435  *
436  * Normally, this function doesn't need to be called. After this function is called, there's no
437  * longer a connection to the service, and the functions in this API can't be used. For details, see
438  * @ref apiFilesC_client.
439  *
440  * This function is created automatically.
441  */
442 //--------------------------------------------------------------------------------------------------
444 (
445  void
446 );
447 
448 
449 //--------------------------------------------------------------------------------------------------
450 /**
451  * Minimum PIN length (4 digits)
452  */
453 //--------------------------------------------------------------------------------------------------
454 #define LE_SIM_PIN_MIN_LEN 4
455 
456 //--------------------------------------------------------------------------------------------------
457 /**
458  * Maximum PIN length (8 digits)
459  */
460 //--------------------------------------------------------------------------------------------------
461 #define LE_SIM_PIN_MAX_LEN 8
462 
463 //--------------------------------------------------------------------------------------------------
464 /**
465  * Maximum PIN length (8 digits)
466  * One extra byte is added for the null character.
467  */
468 //--------------------------------------------------------------------------------------------------
469 #define LE_SIM_PIN_MAX_BYTES 9
470 
471 //--------------------------------------------------------------------------------------------------
472 /**
473  * PUK length (8 digits)
474  */
475 //--------------------------------------------------------------------------------------------------
476 #define LE_SIM_PUK_MAX_LEN 8
477 
478 //--------------------------------------------------------------------------------------------------
479 /**
480  * PUK length (8 digits)
481  * One extra byte is added for the null character.
482  */
483 //--------------------------------------------------------------------------------------------------
484 #define LE_SIM_PUK_MAX_BYTES 9
485 
486 //--------------------------------------------------------------------------------------------------
487 /**
488  * ICCID length
489  * According to GSM Phase 1
490  */
491 //--------------------------------------------------------------------------------------------------
492 #define LE_SIM_ICCID_LEN 20
493 
494 //--------------------------------------------------------------------------------------------------
495 /**
496  * ICCID length
497  * One extra byte is added for the null character.
498  */
499 //--------------------------------------------------------------------------------------------------
500 #define LE_SIM_ICCID_BYTES 21
501 
502 //--------------------------------------------------------------------------------------------------
503 /**
504  * IMSI length
505  */
506 //--------------------------------------------------------------------------------------------------
507 #define LE_SIM_IMSI_LEN 15
508 
509 //--------------------------------------------------------------------------------------------------
510 /**
511  * IMSI length
512  * One extra byte is added for the null character.
513  */
514 //--------------------------------------------------------------------------------------------------
515 #define LE_SIM_IMSI_BYTES 16
516 
517 //--------------------------------------------------------------------------------------------------
518 /**
519  * APDU length
520  */
521 //--------------------------------------------------------------------------------------------------
522 #define LE_SIM_APDU_MAX_BYTES 255
523 
524 //--------------------------------------------------------------------------------------------------
525 /**
526  * SIM response length
527  */
528 //--------------------------------------------------------------------------------------------------
529 #define LE_SIM_RESPONSE_MAX_BYTES 256
530 
531 //--------------------------------------------------------------------------------------------------
532 /**
533  * SIM file identifier length
534  */
535 //--------------------------------------------------------------------------------------------------
536 #define LE_SIM_FILE_ID_LEN 4
537 
538 //--------------------------------------------------------------------------------------------------
539 /**
540  * SIM file identifier length
541  * One extra byte is added for the null character.
542  */
543 //--------------------------------------------------------------------------------------------------
544 #define LE_SIM_FILE_ID_BYTES 5
545 
546 //--------------------------------------------------------------------------------------------------
547 /**
548  * SIM data command length
549  *
550  */
551 //--------------------------------------------------------------------------------------------------
552 #define LE_SIM_DATA_MAX_BYTES 100
553 
554 //--------------------------------------------------------------------------------------------------
555 /**
556  * SIM file path length
557  */
558 //--------------------------------------------------------------------------------------------------
559 #define LE_SIM_PATH_MAX_LEN 100
560 
561 //--------------------------------------------------------------------------------------------------
562 /**
563  * SIM file path length
564  * One extra byte is added for the null character.
565  */
566 //--------------------------------------------------------------------------------------------------
567 #define LE_SIM_PATH_MAX_BYTES 101
568 
569 //--------------------------------------------------------------------------------------------------
570 /**
571  * eUICC identifier (EID) length
572  */
573 //--------------------------------------------------------------------------------------------------
574 #define LE_SIM_EID_LEN 32
575 
576 //--------------------------------------------------------------------------------------------------
577 /**
578  * eUICC identifier (EID) length
579  * One extra byte is added for the null character.
580  */
581 //--------------------------------------------------------------------------------------------------
582 #define LE_SIM_EID_BYTES 33
583 
584 //--------------------------------------------------------------------------------------------------
585 /**
586  * Reference type for FPLMN list.
587  */
588 //--------------------------------------------------------------------------------------------------
589 typedef struct le_sim_FPLMNList* le_sim_FPLMNListRef_t;
590 
591 
592 //--------------------------------------------------------------------------------------------------
593 /**
594  * SIM states.
595  *
596  */
597 //--------------------------------------------------------------------------------------------------
598 typedef enum
599 {
601  ///< SIM card is inserted and locked.
603  ///< SIM card is absent.
605  ///< SIM card is inserted and unlocked.
607  ///< SIM card is blocked.
609  ///< SIM card is busy.
611  ///< Unknown SIM state.
612 }
614 
615 
616 //--------------------------------------------------------------------------------------------------
617 /**
618  * SIM identifiers.
619  *
620  */
621 //--------------------------------------------------------------------------------------------------
622 typedef enum
623 {
625  ///< Embedded SIM
627  ///< SIM inserted in external slot 1
629  ///< SIM inserted in external slot 2
631  ///< Remote SIM
632  LE_SIM_ID_MAX = 4
633  ///<
634 }
636 
637 
638 //--------------------------------------------------------------------------------------------------
639 /**
640  * Card Manufacturer.
641  *
642  */
643 //--------------------------------------------------------------------------------------------------
644 typedef enum
645 {
647  ///< Oberthur.
649  ///< Gemalto.
651  ///< G&D.
653  ///< Morpho.
655  ///< Valid.
656  LE_SIM_MANUFACTURER_MAX = 5
657  ///<
658 }
660 
661 
662 //--------------------------------------------------------------------------------------------------
663 /**
664  * SIM commands.
665  */
666 //--------------------------------------------------------------------------------------------------
667 typedef enum
668 {
670  ///< Read a file record.
672  ///< Read a transparent elementary file.
674  ///< Update a file record.
676  ///< Update a transparent elementary file.
678  ///< Max value
679 }
681 
682 
683 //--------------------------------------------------------------------------------------------------
684 /**
685  * SIM Toolkit events.
686  */
687 //--------------------------------------------------------------------------------------------------
688 typedef enum
689 {
691  ///< SIM card asks to open a logical channel.
693  ///< SIM card asks for a refresh.
695  ///< Unknown SIM Toolkit event.
696 }
698 
699 
700 //--------------------------------------------------------------------------------------------------
701 /**
702  * SIM Toolkit Refresh modes, defined in ETSI TS 102 223 sections 6.4.7 and 8.6.
703  */
704 //--------------------------------------------------------------------------------------------------
705 typedef enum
706 {
708  ///< Initialization and Full File Change Notification.
710  ///< File Change Notification.
712  ///< Initialization and File Change Notification.
714  ///< Initialization.
716  ///< SIM reset.
718  ///< Application reset.
720  ///< Session reset.
722  ///< Steering of Roaming as defined in 3GPP TS 23.122.
724  ///< Steering of Roaming for I-WLAN
725  ///< as defined in 3GPP TS 24.234.
727  ///< Invalid SIM Toolkit Refresh mode.
728 }
730 
731 
732 //--------------------------------------------------------------------------------------------------
733 /**
734  * SIM Toolkit Refresh stages.
735  */
736 //--------------------------------------------------------------------------------------------------
737 typedef enum
738 {
740  ///< Waiting for OK to refresh.
742  ///< Refresh succeeded.
744  ///< Refresh failed.
746  ///< Invalid SIM Toolkit Refresh stage.
747 }
749 
750 
751 //--------------------------------------------------------------------------------------------------
752 /**
753  * Reference type used by Add/Remove functions for EVENT 'le_sim_NewState'
754  */
755 //--------------------------------------------------------------------------------------------------
756 typedef struct le_sim_NewStateHandler* le_sim_NewStateHandlerRef_t;
757 
758 
759 //--------------------------------------------------------------------------------------------------
760 /**
761  * Reference type used by Add/Remove functions for EVENT 'le_sim_SimToolkitEvent'
762  */
763 //--------------------------------------------------------------------------------------------------
764 typedef struct le_sim_SimToolkitEventHandler* le_sim_SimToolkitEventHandlerRef_t;
765 
766 
767 //--------------------------------------------------------------------------------------------------
768 /**
769  * Handler for sim state changes.
770  *
771  */
772 //--------------------------------------------------------------------------------------------------
773 typedef void (*le_sim_NewStateHandlerFunc_t)
774 (
775  le_sim_Id_t simId,
776  ///< The SIM identifier.
777  le_sim_States_t simState,
778  ///< The SIM state.
779  void* contextPtr
780  ///<
781 );
782 
783 //--------------------------------------------------------------------------------------------------
784 /**
785  * Handler for Sim Toolkit Events.
786  *
787  */
788 //--------------------------------------------------------------------------------------------------
790 (
791  le_sim_Id_t simId,
792  ///< The SIM identifier.
793  le_sim_StkEvent_t stkEvent,
794  ///< The SIM state.
795  void* contextPtr
796  ///<
797 );
798 
799 //--------------------------------------------------------------------------------------------------
800 /**
801  * Add handler function for EVENT 'le_sim_NewState'
802  *
803  * This event provides information on sim state changes.
804  *
805  */
806 //--------------------------------------------------------------------------------------------------
808 (
809  le_sim_NewStateHandlerFunc_t handlerPtr,
810  ///< [IN]
811  void* contextPtr
812  ///< [IN]
813 );
814 
815 //--------------------------------------------------------------------------------------------------
816 /**
817  * Remove handler function for EVENT 'le_sim_NewState'
818  */
819 //--------------------------------------------------------------------------------------------------
821 (
822  le_sim_NewStateHandlerRef_t handlerRef
823  ///< [IN]
824 );
825 
826 //--------------------------------------------------------------------------------------------------
827 /**
828  * Add handler function for EVENT 'le_sim_SimToolkitEvent'
829  *
830  * This event provides information on Sim Toolkit application.
831  *
832  */
833 //--------------------------------------------------------------------------------------------------
835 (
837  ///< [IN]
838  void* contextPtr
839  ///< [IN]
840 );
841 
842 //--------------------------------------------------------------------------------------------------
843 /**
844  * Remove handler function for EVENT 'le_sim_SimToolkitEvent'
845  */
846 //--------------------------------------------------------------------------------------------------
848 (
850  ///< [IN]
851 );
852 
853 //--------------------------------------------------------------------------------------------------
854 /**
855  * Get the current selected card.
856  *
857  * @return Number of the current selected SIM card.
858  */
859 //--------------------------------------------------------------------------------------------------
861 (
862  void
863 );
864 
865 //--------------------------------------------------------------------------------------------------
866 /**
867  * Select a SIM.
868  *
869  * @return LE_FAULT Function failed to select the requested SIM
870  * @return LE_OK Function succeeded.
871  *
872  */
873 //--------------------------------------------------------------------------------------------------
875 (
876  le_sim_Id_t simId
877  ///< [IN] The SIM identifier.
878 );
879 
880 //--------------------------------------------------------------------------------------------------
881 /**
882  * Retrieves the integrated circuit card identifier (ICCID) of the SIM card (20 digits)
883  *
884  * @return LE_OK ICCID was successfully retrieved.
885  * @return LE_OVERFLOW iccidPtr buffer was too small for the ICCID.
886  * @return LE_BAD_PARAMETER Invalid parameters.
887  * @return LE_FAULT The ICCID could not be retrieved.
888  *
889  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
890  * function will not return.
891  */
892 //--------------------------------------------------------------------------------------------------
894 (
895  le_sim_Id_t simId,
896  ///< [IN] The SIM identifier.
897  char* iccid,
898  ///< [OUT] ICCID
899  size_t iccidSize
900  ///< [IN]
901 );
902 
903 //--------------------------------------------------------------------------------------------------
904 /**
905  * Retrieves the identifier for the embedded Universal Integrated Circuit Card identifier (EID)
906  * (32 digits)
907  *
908  * @return LE_OK EID was successfully retrieved.
909  * @return LE_OVERFLOW eidPtr buffer was too small for the EID.
910  * @return LE_BAD_PARAMETER Invalid parameters.
911  * @return LE_FAULT The EID could not be retrieved.
912  *
913  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
914  * function will not return.
915  */
916 //--------------------------------------------------------------------------------------------------
918 (
919  le_sim_Id_t simId,
920  ///< [IN] The SIM identifier.
921  char* eid,
922  ///< [OUT] EID
923  size_t eidSize
924  ///< [IN]
925 );
926 
927 //--------------------------------------------------------------------------------------------------
928 /**
929  * Retrieves the identification number (IMSI) of the SIM card. (max 15 digits)
930  *
931  * @return LE_OVERFLOW The imsiPtr buffer was too small for the IMSI.
932  * @return LE_BAD_PARAMETER The parameters are invalid.
933  * @return LE_FAULT The function failed.
934  * @return LE_TIMEOUT No response was received.
935  * @return LE_OK The function succeeded.
936  *
937  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
938  * function will not return.
939  */
940 //--------------------------------------------------------------------------------------------------
942 (
943  le_sim_Id_t simId,
944  ///< [IN] The SIM identifier.
945  char* imsi,
946  ///< [OUT] IMSI
947  size_t imsiSize
948  ///< [IN]
949 );
950 
951 //--------------------------------------------------------------------------------------------------
952 /**
953  * Verify if the SIM card is present or not.
954  *
955  * @return true SIM card is present.
956  * @return false SIM card is absent
957  *
958  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
959  * function will not return.
960  */
961 //--------------------------------------------------------------------------------------------------
962 bool le_sim_IsPresent
963 (
964  le_sim_Id_t simId
965  ///< [IN] The SIM identifier.
966 );
967 
968 //--------------------------------------------------------------------------------------------------
969 /**
970  * Verify if the SIM is ready (PIN code correctly inserted or not
971  * required).
972  *
973  * @return true PIN is correctly inserted or not required.
974  * @return false PIN must be inserted
975  *
976  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
977  * function will not return.
978  */
979 //--------------------------------------------------------------------------------------------------
980 bool le_sim_IsReady
981 (
982  le_sim_Id_t simId
983  ///< [IN] The SIM identifier.
984 );
985 
986 //--------------------------------------------------------------------------------------------------
987 /**
988  * This function must be called to enter the PIN code.
989  *
990  * @return LE_BAD_PARAMETER The parameters are invalid.
991  * @return LE_NOT_FOUND The function failed to select the SIM card for this operation.
992  * @return LE_UNDERFLOW The PIN code is not long enough (min 4 digits).
993  * @return LE_FAULT The function failed to enter the PIN code.
994  * @return LE_OK The function succeeded.
995  *
996  * @note If PIN code is too long (max 8 digits), it is a fatal error, the
997  * function will not return.
998  *
999  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
1000  * function will not return.
1001  */
1002 //--------------------------------------------------------------------------------------------------
1004 (
1005  le_sim_Id_t simId,
1006  ///< [IN] The SIM identifier.
1007  const char* LE_NONNULL pin
1008  ///< [IN] The PIN code.
1009 );
1010 
1011 //--------------------------------------------------------------------------------------------------
1012 /**
1013  * Change the PIN code.
1014  *
1015  * @return LE_NOT_FOUND Function failed to select the SIM card for this operation.
1016  * @return LE_UNDERFLOW PIN code is/are not long enough (min 4 digits).
1017  * @return LE_FAULT Function failed to change the PIN code.
1018  * @return LE_OK Function succeeded.
1019  *
1020  * @note If PIN code is too long (max 8 digits), it is a fatal error, the
1021  * function will not return.
1022  *
1023  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
1024  * function will not return.
1025  */
1026 //--------------------------------------------------------------------------------------------------
1028 (
1029  le_sim_Id_t simId,
1030  ///< [IN] The SIM identifier.
1031  const char* LE_NONNULL oldpin,
1032  ///< [IN] The old PIN code.
1033  const char* LE_NONNULL newpin
1034  ///< [IN] The new PIN code.
1035 );
1036 
1037 //--------------------------------------------------------------------------------------------------
1038 /**
1039  * Get the number of remaining PIN insertion tries.
1040  *
1041  * @return LE_NOT_FOUND The function failed to select the SIM card for this operation.
1042  * @return LE_BAD_PARAMETER Invalid SIM identifier.
1043  * @return LE_FAULT The function failed to get the number of remaining PIN insertion tries.
1044  * @return A positive value The function succeeded. The number of remaining PIN insertion tries.
1045  *
1046  */
1047 //--------------------------------------------------------------------------------------------------
1049 (
1050  le_sim_Id_t simId
1051  ///< [IN] The SIM identifier.
1052 );
1053 
1054 //--------------------------------------------------------------------------------------------------
1055 /**
1056  * Get the number of remaining PUK insertion tries.
1057  *
1058  * @return LE_OK On success.
1059  * @return LE_NOT_FOUND The function failed to select the SIM card for this operation.
1060  * @return LE_BAD_PARAMETER Invalid SIM identifier.
1061  * @return LE_FAULT The function failed to get the number of remaining PUK insertion tries.
1062  *
1063  * @note If the caller is passing an null pointer to this function, it is a fatal error
1064  * and the function will not return.
1065  *
1066  */
1067 //--------------------------------------------------------------------------------------------------
1069 (
1070  le_sim_Id_t simId,
1071  ///< [IN] The SIM identifier.
1072  uint32_t* remainingPukTriesPtrPtr
1073  ///< [OUT] The number of remaining PUK insertion tries.
1074 );
1075 
1076 //--------------------------------------------------------------------------------------------------
1077 /**
1078  * Unlock the SIM card: it disables the request of the PIN code.
1079  *
1080  * @return LE_NOT_FOUND Function failed to select the SIM card for this operation.
1081  * @return LE_UNDERFLOW PIN code is not long enough (min 4 digits).
1082  * @return LE_FAULT The function failed to unlock the SIM card.
1083  * @return LE_OK Function succeeded.
1084  *
1085  * @note If PIN code is too long (max 8 digits), it is a fatal error, the
1086  * function will not return.
1087  *
1088  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
1089  * function will not return.
1090  */
1091 //--------------------------------------------------------------------------------------------------
1093 (
1094  le_sim_Id_t simId,
1095  ///< [IN] The SIM identifier.
1096  const char* LE_NONNULL pin
1097  ///< [IN] The PIN code.
1098 );
1099 
1100 //--------------------------------------------------------------------------------------------------
1101 /**
1102  * Lock the SIM card: it enables the request of the PIN code.
1103  *
1104  * @return LE_NOT_FOUND Function failed to select the SIM card for this operation.
1105  * @return LE_UNDERFLOW PIN code is not long enough (min 4 digits).
1106  * @return LE_FAULT The function failed to unlock the SIM card.
1107  * @return LE_OK Function succeeded.
1108  *
1109  * @note If PIN code is too long (max 8 digits), it is a fatal error, the
1110  * function will not return.
1111  *
1112  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
1113  * function will not return.
1114  */
1115 //--------------------------------------------------------------------------------------------------
1117 (
1118  le_sim_Id_t simId,
1119  ///< [IN] The SIM identifier.
1120  const char* LE_NONNULL pin
1121  ///< [IN] The PIN code.
1122 );
1123 
1124 //--------------------------------------------------------------------------------------------------
1125 /**
1126  * Unblock the SIM card.
1127  *
1128  * @return LE_NOT_FOUND Function failed to select the SIM card for this operation.
1129  * @return LE_UNDERFLOW PIN code is not long enough (min 4 digits).
1130  * @return LE_BAD_PARAMETER Invalid SIM identifier.
1131  * @return LE_OUT_OF_RANGE PUK code length is not correct (8 digits).
1132  * @return LE_FAULT The function failed to unlock the SIM card.
1133  * @return LE_OK Function succeeded.
1134  *
1135  * @note If new PIN or puk code are too long (max 8 digits), it is a fatal error, the
1136  * function will not return.
1137  *
1138  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
1139  * function will not return.
1140  */
1141 //--------------------------------------------------------------------------------------------------
1143 (
1144  le_sim_Id_t simId,
1145  ///< [IN] The SIM identifier.
1146  const char* LE_NONNULL puk,
1147  ///< [IN] The PUK code.
1148  const char* LE_NONNULL newpin
1149  ///< [IN] The PIN code.
1150 );
1151 
1152 //--------------------------------------------------------------------------------------------------
1153 /**
1154  * Get the SIM state.
1155  *
1156  * @return Current SIM state.
1157  *
1158  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
1159  * function will not return.
1160  */
1161 //--------------------------------------------------------------------------------------------------
1163 (
1164  le_sim_Id_t simId
1165  ///< [IN] The SIM identifier.
1166 );
1167 
1168 //--------------------------------------------------------------------------------------------------
1169 /**
1170  * Get the SIM Phone Number.
1171  *
1172  * @return
1173  * - LE_OK on success
1174  * - LE_OVERFLOW if the Phone Number can't fit in phoneNumberStr
1175  * - LE_BAD_PARAMETER if a parameter is invalid
1176  * - LE_FAULT on any other failure
1177  *
1178  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
1179  * function will not return.
1180  */
1181 //--------------------------------------------------------------------------------------------------
1183 (
1184  le_sim_Id_t simId,
1185  ///< [IN] The SIM identifier.
1186  char* phoneNumberStr,
1187  ///< [OUT] The phone Number.
1188  size_t phoneNumberStrSize
1189  ///< [IN]
1190 );
1191 
1192 //--------------------------------------------------------------------------------------------------
1193 /**
1194  * This function must be called to get the Home Network Name information.
1195  *
1196  * @return
1197  * - LE_OK on success
1198  * - LE_OVERFLOW if the Home Network Name can't fit in nameStr
1199  * - LE_NOT_FOUND if the network is not found
1200  * - LE_BAD_PARAMETER if a parameter is invalid
1201  * - LE_FAULT on any other failure
1202  *
1203  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
1204  * function will not return.
1205  */
1206 //--------------------------------------------------------------------------------------------------
1208 (
1209  le_sim_Id_t simId,
1210  ///< [IN] The SIM identifier.
1211  char* nameStr,
1212  ///< [OUT] the home network Name
1213  size_t nameStrSize
1214  ///< [IN]
1215 );
1216 
1217 //--------------------------------------------------------------------------------------------------
1218 /**
1219  * This function must be called to get the Home Network MCC MNC.
1220  *
1221  * @return
1222  * - LE_OK on success
1223  * - LE_NOT_FOUND if Home Network has not been provisioned
1224  * - LE_FAULT for unexpected error
1225  *
1226  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
1227  * function will not return.
1228  */
1229 //--------------------------------------------------------------------------------------------------
1231 (
1232  le_sim_Id_t simId,
1233  ///< [IN] The SIM identifier.
1234  char* mccPtr,
1235  ///< [OUT] Mobile Country Code
1236  size_t mccPtrSize,
1237  ///< [IN]
1238  char* mncPtr,
1239  ///< [OUT] Mobile Network Code
1240  size_t mncPtrSize
1241  ///< [IN]
1242 );
1243 
1244 //--------------------------------------------------------------------------------------------------
1245 /**
1246  * This function must be called to request the multi-profile eUICC to swap to ECS and to refresh.
1247  * The User's application must wait for eUICC reboot to be finished and network connection
1248  * available.
1249  *
1250  * @return
1251  * - LE_OK on success
1252  * - LE_BAD_PARAMETER invalid SIM identifier
1253  * - LE_BUSY when a profile swap is already in progress
1254  * - LE_FAULT for unexpected error
1255  *
1256  * @warning If you use a Morpho or Oberthur card, the SIM_REFRESH PRO-ACTIVE command must be
1257  * accepted with le_sim_AcceptSimToolkitCommand() in order to complete the profile swap
1258  * procedure.
1259  */
1260 //--------------------------------------------------------------------------------------------------
1262 (
1263  le_sim_Id_t simId,
1264  ///< [IN] The SIM identifier.
1265  le_sim_Manufacturer_t manufacturer
1266  ///< [IN] The card manufacturer.
1267 );
1268 
1269 //--------------------------------------------------------------------------------------------------
1270 /**
1271  * This function must be called to request the multi-profile eUICC to swap back to commercial
1272  * subscription and to refresh.
1273  * The User's application must wait for eUICC reboot to be finished and network connection
1274  * available.
1275  *
1276  * @return
1277  * - LE_OK on success
1278  * - LE_BAD_PARAMETER invalid SIM identifier
1279  * - LE_BUSY when a profile swap is already in progress
1280  * - LE_FAULT for unexpected error
1281  *
1282  * @warning If you use a Morpho or Oberthur card, the SIM_REFRESH PRO-ACTIVE command must be
1283  * accepted with le_sim_AcceptSimToolkitCommand() in order to complete the profile swap
1284  * procedure.
1285  */
1286 //--------------------------------------------------------------------------------------------------
1288 (
1289  le_sim_Id_t simId,
1290  ///< [IN] The SIM identifier.
1291  le_sim_Manufacturer_t manufacturer
1292  ///< [IN] The card manufacturer.
1293 );
1294 
1295 //--------------------------------------------------------------------------------------------------
1296 /**
1297  * This function must be called to get the current subscription.
1298  *
1299  * @return
1300  * - LE_OK on success
1301  * - LE_BAD_PARAMETER invalid SIM identifier or null ECS pointer is passed
1302  * - LE_NOT_FOUND cannot determine the current selected subscription
1303  * - LE_FAULT for unexpected errors
1304  *
1305  * @warning There is no standard method to interrogate the current selected subscription. The
1306  * returned value of this function is based on the last executed local swap command. This means
1307  * that this function will always return LE_NOT_FOUND error at Legato startup.
1308  */
1309 //--------------------------------------------------------------------------------------------------
1311 (
1312  le_sim_Id_t simId,
1313  ///< [IN] The SIM identifier
1314  bool* isEcsPtr
1315  ///< [OUT] true if Emergency Call Subscription (ECS) is selected,
1316  ///< false if Commercial Subscription is selected
1317 );
1318 
1319 //--------------------------------------------------------------------------------------------------
1320 /**
1321  * Accept the last SIM Toolkit command.
1322  *
1323  * @return LE_FAULT Function failed.
1324  * @return LE_OK Function succeeded.
1325  */
1326 //--------------------------------------------------------------------------------------------------
1328 (
1329  le_sim_Id_t simId
1330  ///< [IN] The SIM identifier.
1331 );
1332 
1333 //--------------------------------------------------------------------------------------------------
1334 /**
1335  * Reject the last SIM Toolkit command.
1336  *
1337  * @return LE_FAULT Function failed.
1338  * @return LE_OK Function succeeded.
1339  */
1340 //--------------------------------------------------------------------------------------------------
1342 (
1343  le_sim_Id_t simId
1344  ///< [IN] The SIM identifier.
1345 );
1346 
1347 //--------------------------------------------------------------------------------------------------
1348 /**
1349  * Retrieve the mode of the last SIM Toolkit Refresh command.
1350  * The modes are defined in ETSI TS 102 223 sections 6.4.7 and 8.6.
1351  *
1352  * @return
1353  * - LE_OK The function succeeded.
1354  * - LE_BAD_PARAMETER A parameter is invalid.
1355  * - LE_UNAVAILABLE The last SIM Toolkit command is not a Refresh command.
1356  * - LE_FAULT The function failed.
1357  */
1358 //--------------------------------------------------------------------------------------------------
1360 (
1361  le_sim_Id_t simId,
1362  ///< [IN] The SIM identifier.
1363  le_sim_StkRefreshMode_t* refreshModePtr
1364  ///< [OUT] The Refresh mode.
1365 );
1366 
1367 //--------------------------------------------------------------------------------------------------
1368 /**
1369  * Retrieve the stage of the last SIM Toolkit Refresh command.
1370  *
1371  * @return
1372  * - LE_OK The function succeeded.
1373  * - LE_BAD_PARAMETER A parameter is invalid.
1374  * - LE_UNAVAILABLE The last SIM Toolkit command is not a Refresh command.
1375  * - LE_FAULT The function failed.
1376  */
1377 //--------------------------------------------------------------------------------------------------
1379 (
1380  le_sim_Id_t simId,
1381  ///< [IN] The SIM identifier.
1382  le_sim_StkRefreshStage_t* refreshStagePtr
1383  ///< [OUT] The Refresh stage.
1384 );
1385 
1386 //--------------------------------------------------------------------------------------------------
1387 /**
1388  * Send APDU command to the SIM.
1389  *
1390  * @return
1391  * - LE_OK Function succeeded.
1392  * - LE_FAULT The function failed.
1393  * - LE_BAD_PARAMETER A parameter is invalid.
1394  * - LE_NOT_FOUND The function failed to select the SIM card for this operation.
1395  */
1396 //--------------------------------------------------------------------------------------------------
1398 (
1399  le_sim_Id_t simId,
1400  ///< [IN] The SIM identifier.
1401  const uint8_t* commandApduPtr,
1402  ///< [IN] APDU command.
1403  size_t commandApduSize,
1404  ///< [IN]
1405  uint8_t* responseApduPtr,
1406  ///< [OUT] SIM response.
1407  size_t* responseApduSizePtr
1408  ///< [INOUT]
1409 );
1410 
1411 //--------------------------------------------------------------------------------------------------
1412 /**
1413  * Send a command to the SIM.
1414  *
1415  * @return
1416  * - LE_OK Function succeeded.
1417  * - LE_FAULT The function failed.
1418  * - LE_BAD_PARAMETER A parameter is invalid.
1419  * - LE_NOT_FOUND - The function failed to select the SIM card for this operation
1420  * - The requested SIM file is not found
1421  * - LE_OVERFLOW Response buffer is too small to copy the SIM answer.
1422  * - LE_UNSUPPORTED The platform does not support this operation.
1423  */
1424 //--------------------------------------------------------------------------------------------------
1426 (
1427  le_sim_Id_t simId,
1428  ///< [IN] The SIM identifier.
1429  le_sim_Command_t command,
1430  ///< [IN] The SIM command.
1431  const char* LE_NONNULL fileIdentifier,
1432  ///< [IN] File identifier
1433  uint8_t p1,
1434  ///< [IN] Parameter P1 passed to the SIM
1435  uint8_t p2,
1436  ///< [IN] Parameter P2 passed to the SIM
1437  uint8_t p3,
1438  ///< [IN] Parameter P3 passed to the SIM
1439  const uint8_t* dataPtr,
1440  ///< [IN] data command.
1441  size_t dataSize,
1442  ///< [IN]
1443  const char* LE_NONNULL path,
1444  ///< [IN] path of the elementary file
1445  uint8_t* sw1Ptr,
1446  ///< [OUT] Status Word 1 received from the SIM
1447  uint8_t* sw2Ptr,
1448  ///< [OUT] Status Word 2 received from the SIM
1449  uint8_t* responsePtr,
1450  ///< [OUT] SIM response.
1451  size_t* responseSizePtr
1452  ///< [INOUT]
1453 );
1454 
1455 //--------------------------------------------------------------------------------------------------
1456 /**
1457  * Reset the SIM.
1458  *
1459  * @return
1460  * - LE_FAULT Function failed.
1461  * - LE_OK Function succeeded.
1462  */
1463 //--------------------------------------------------------------------------------------------------
1465 (
1466  le_sim_Id_t simId
1467  ///< [IN] The SIM identifier.
1468 );
1469 
1470 //--------------------------------------------------------------------------------------------------
1471 /**
1472  * Create empty FPLMN list to insert FPLMN operators.
1473  *
1474  * @return
1475  * - Reference to the List object.
1476  * - Null pointer if not able to create list reference.
1477  */
1478 //--------------------------------------------------------------------------------------------------
1480 (
1481  void
1482 );
1483 
1484 //--------------------------------------------------------------------------------------------------
1485 /**
1486  * Add FPLMN network into the newly created FPLMN list.
1487  * If the FPLMNListRef, mcc or mnc is not valid then this function will kill the calling client.
1488  *
1489  * @return
1490  * - LE_FAULT Function failed.
1491  * - LE_OK Function succeeded.
1492  * - LE_OVERFLOW If FPLMN operator can not be inserted into FPLMN list.
1493  */
1494 //--------------------------------------------------------------------------------------------------
1496 (
1497  le_sim_FPLMNListRef_t FPLMNListRef,
1498  ///< [IN] FPLMN list reference.
1499  const char* LE_NONNULL mcc,
1500  ///< [IN] Mobile Country Code.
1501  const char* LE_NONNULL mnc
1502  ///< [IN] Mobile Network Code.
1503 );
1504 
1505 //--------------------------------------------------------------------------------------------------
1506 /**
1507  * Write FPLMN list into the SIM.
1508  * If the FPLMNListRef is not valid then this function will kill the calling client.
1509  *
1510  * @return
1511  * - LE_FAULT Function failed.
1512  * - LE_OK Function succeeded.
1513  *
1514  */
1515 //--------------------------------------------------------------------------------------------------
1517 (
1518  le_sim_Id_t simId,
1519  ///< [IN] The SIM identifier.
1520  le_sim_FPLMNListRef_t FPLMNListRef
1521  ///< [IN] FPLMN list reference.
1522 );
1523 
1524 //--------------------------------------------------------------------------------------------------
1525 /**
1526  * Read FPLMN list from the SIM.
1527  *
1528  * @return
1529  * - Reference to the List object.
1530  * - Null pointer if FPLMN list is not able to read from the SIM.
1531  */
1532 //--------------------------------------------------------------------------------------------------
1534 (
1535  le_sim_Id_t simId
1536  ///< [IN] The SIM identifier.
1537 );
1538 
1539 //--------------------------------------------------------------------------------------------------
1540 /**
1541  * Read the first FPLMN network from the list of FPLMN objects retrieved with
1542  * le_sim_ReadFPLMNList().
1543  * If the FPLMNListRef, mccPtr or mncPtr is not valid then this function will kill the calling
1544  * client.
1545  *
1546  * @return
1547  * - LE_FAULT Function failed.
1548  * - LE_OK Function succeeded.
1549  * - LE_OVERFLOW MCC/MNC string size is greater than string length parameter which has
1550  * been given into this function.
1551  */
1552 //--------------------------------------------------------------------------------------------------
1554 (
1555  le_sim_FPLMNListRef_t FPLMNListRef,
1556  ///< [IN] FPLMN list reference.
1557  char* mccPtr,
1558  ///< [OUT] Mobile Country Code.
1559  size_t mccPtrSize,
1560  ///< [IN]
1561  char* mncPtr,
1562  ///< [OUT] Mobile Network Code.
1563  size_t mncPtrSize
1564  ///< [IN]
1565 );
1566 
1567 //--------------------------------------------------------------------------------------------------
1568 /**
1569  * Read the next FPLMN network from the list of FPLMN objects retrieved with le_sim_ReadFPLMNList().
1570  * If the FPLMNListRef, mccPtr or mncPtr is not valid then this function will kill the calling
1571  * client.
1572  *
1573  * @return
1574  * - LE_FAULT Function failed.
1575  * - LE_OK Function succeeded.
1576  * - LE_OVERFLOW MCC/MNC string size is greater than string length parameter which has
1577  * been given into this function.
1578  */
1579 //--------------------------------------------------------------------------------------------------
1581 (
1582  le_sim_FPLMNListRef_t FPLMNListRef,
1583  ///< [IN] FPLMN list reference.
1584  char* mccPtr,
1585  ///< [OUT] Mobile Country Code.
1586  size_t mccPtrSize,
1587  ///< [IN]
1588  char* mncPtr,
1589  ///< [OUT] Mobile Network Code.
1590  size_t mncPtrSize
1591  ///< [IN]
1592 );
1593 
1594 //--------------------------------------------------------------------------------------------------
1595 /**
1596  * Delete the FPLMN list created by le_sim_ReadFPLMNList() or le_sim_CreateFPLMNList().
1597  * If the FPLMNListRef is not valid then this function will kill the calling client.
1598  *
1599  * @note
1600  * On failure, the process exits, so you don't have to worry about checking the returned
1601  * reference for validity.
1602  */
1603 //--------------------------------------------------------------------------------------------------
1605 (
1606  le_sim_FPLMNListRef_t FPLMNListRef
1607  ///< [IN] FPLMN list reference.
1608 );
1609 
1610 #endif // LE_SIM_INTERFACE_H_INCLUDE_GUARD
le_sim_NewStateHandlerRef_t le_sim_AddNewStateHandler(le_sim_NewStateHandlerFunc_t handlerPtr, void *contextPtr)
Read a transparent elementary file.
Definition: le_sim_interface.h:671
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_sim_Id_t
Definition: le_sim_interface.h:622
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:790
Initialization and Full File Change Notification.
Definition: le_sim_interface.h:707
Invalid SIM Toolkit Refresh mode.
Definition: le_sim_interface.h:726
le_result_t
Definition: le_basics.h:35
File Change Notification.
Definition: le_sim_interface.h:709
le_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)
SIM card is busy.
Definition: le_sim_interface.h:608
le_sim_StkEvent_t
Definition: le_sim_interface.h:688
le_result_t le_sim_GetHomeNetworkMccMnc(le_sim_Id_t simId, char *mccPtr, size_t mccPtrSize, char *mncPtr, size_t mncPtrSize)
Update a transparent elementary file.
Definition: le_sim_interface.h:675
Refresh succeeded.
Definition: le_sim_interface.h:741
le_result_t le_sim_GetFirstFPLMNOperator(le_sim_FPLMNListRef_t FPLMNListRef, char *mccPtr, size_t mccPtrSize, char *mncPtr, size_t mncPtrSize)
Initialization.
Definition: le_sim_interface.h:713
le_result_t le_sim_GetSimToolkitRefreshMode(le_sim_Id_t simId, le_sim_StkRefreshMode_t *refreshModePtr)
Embedded SIM.
Definition: le_sim_interface.h:624
Oberthur.
Definition: le_sim_interface.h:646
le_sim_States_t
Definition: le_sim_interface.h:598
struct le_sim_SimToolkitEventHandler * le_sim_SimToolkitEventHandlerRef_t
Definition: le_sim_interface.h:764
Steering of Roaming as defined in 3GPP TS 23.122.
Definition: le_sim_interface.h:721
SIM card is absent.
Definition: le_sim_interface.h:602
SIM card is inserted and locked.
Definition: le_sim_interface.h:600
Read a file record.
Definition: le_sim_interface.h:669
void(* le_sim_NewStateHandlerFunc_t)(le_sim_Id_t simId, le_sim_States_t simState, void *contextPtr)
Definition: le_sim_interface.h:774
le_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)
Session reset.
Definition: le_sim_interface.h:719
le_sim_FPLMNListRef_t le_sim_ReadFPLMNList(le_sim_Id_t simId)
Max value.
Definition: le_sim_interface.h:677
Waiting for OK to refresh.
Definition: le_sim_interface.h:739
Unknown SIM Toolkit event.
Definition: le_sim_interface.h:694
void le_sim_ConnectService(void)
Refresh failed.
Definition: le_sim_interface.h:743
SIM card asks to open a logical channel.
Definition: le_sim_interface.h:690
le_result_t le_sim_GetIMSI(le_sim_Id_t simId, char *imsi, size_t imsiSize)
Definition: le_sim_interface.h:723
Gemalto.
Definition: le_sim_interface.h:648
Invalid SIM Toolkit Refresh stage.
Definition: le_sim_interface.h:745
SIM card asks for a refresh.
Definition: le_sim_interface.h:692
SIM inserted in external slot 1.
Definition: le_sim_interface.h:626
void le_sim_DisconnectService(void)
struct le_sim_NewStateHandler * le_sim_NewStateHandlerRef_t
Definition: le_sim_interface.h:756
void 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_sim_Manufacturer_t
Definition: le_sim_interface.h:644
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:372
le_sim_StkRefreshStage_t
Definition: le_sim_interface.h:737
Remote SIM.
Definition: le_sim_interface.h:630
Valid.
Definition: le_sim_interface.h:654
le_result_t le_sim_GetSimToolkitRefreshStage(le_sim_Id_t simId, le_sim_StkRefreshStage_t *refreshStagePtr)
int32_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_sim_StkRefreshMode_t
Definition: le_sim_interface.h:705
le_result_t le_sim_RejectSimToolkitCommand(le_sim_Id_t simId)
struct le_sim_FPLMNList * le_sim_FPLMNListRef_t
Definition: le_sim_interface.h:589
le_result_t le_sim_GetSubscriberPhoneNumber(le_sim_Id_t simId, char *phoneNumberStr, size_t phoneNumberStrSize)
SIM card is blocked.
Definition: le_sim_interface.h:606
le_result_t le_sim_Unblock(le_sim_Id_t simId, const char *LE_NONNULL puk, const char *LE_NONNULL newpin)
SIM reset.
Definition: le_sim_interface.h:715
le_result_t le_sim_IsEmergencyCallSubscriptionSelected(le_sim_Id_t simId, bool *isEcsPtr)
G&D.
Definition: le_sim_interface.h:650
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)
Application reset.
Definition: le_sim_interface.h:717
Initialization and File Change Notification.
Definition: le_sim_interface.h:711
Morpho.
Definition: le_sim_interface.h:652
le_sim_Command_t
Definition: le_sim_interface.h:667
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)
SIM inserted in external slot 2.
Definition: le_sim_interface.h:628
le_result_t le_sim_TryConnectService(void)
Unknown SIM state.
Definition: le_sim_interface.h:610
SIM card is inserted and unlocked.
Definition: le_sim_interface.h:604
Update a file record.
Definition: le_sim_interface.h:673