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  * @note Some platforms do not support FPLMN APIs. Please refer to the @ref platformConstraintsSim
256  * "SIM constraints" page or your platform documentation for further details.
257  *
258  * @section le_sim_stk SIM Toolkit
259  *
260  * The SIM application Toolkit allows the SIM card to initiate commands or asking input from the
261  * modem to accept/reject SIM operations.
262  *
263  * One of the use case is the remote provisioning of an embedded UICC (eUICC): the eUICC format
264  * supports multiple subscription profiles, which can be remotely provisioned, updated or selected
265  * through SIM Toolkit procedures (Bearer Independent Protocol @em BIP, SIM refresh).
266  *
267  * It is mainly used for in-vehicle emergency call service (eCall).
268  *
269  * An eUICC can be remotely managed to change the Mobile Network Operator subscription.
270  *
271  * The le_sim_AddSimToolkitEventHandler() API registers a handler to be notified of SIM
272  * Toolkit events. The le_sim_RemoveSimToolkitEventHandler() API unregisters the handler.
273  *
274  * The last received SIM Toolkit command can:
275  * - Either be accepted by the device with the le_sim_AcceptSimToolkitCommand() API
276  * - Or be rejected by the device with the le_sim_RejectSimToolkitCommand() API.
277  *
278  * In case the last SIM Toolkit command is a Refresh command (@ref LE_SIM_REFRESH), additional
279  * information can be retrieved:
280  * - The le_sim_GetSimToolkitRefreshStage() API gets the stage of the Refresh command.
281  * - The le_sim_GetSimToolkitRefreshMode() API gets the mode of the Refresh command, as defined in
282  * ETSI TS 102 223 sections 6.4.7 and 8.6.
283  *
284  * A sample code using the SIM Toolkit APIs can be seen in the following page:
285  * - @subpage c_simTestSimToolkit
286  *
287  * Information related to SIM Toolkit platform constraints can be found in the
288  * @ref platformConstraintsStk "SIM Toolkit platform constraints" page.
289  *
290  * @section le_sim_access SIM access
291  *
292  * The SIM card content can be accessed and/or modified by several methods.
293  *
294  * @subsection le_sim_accessApdu APDU
295  *
296  * The application can send an APDU (Application Protocol Data Unit) to the SIM using
297  * le_sim_SendApdu() API. The user must encode the APDU as specified by in recommendation 3GPP
298  * 11.11, 3GPP 51.011, 3GPP 31.102, 3GPP 31.103 or ETSI TS 102 221.
299  * @note Between two successive calls to le_sim_SendApdu() API, there is no locking
300  * protection. In this situation, some command types and parameters can modify SIM files
301  * incorrectly.
302  *
303  * @subsection le_sim_accessCommand Commands
304  *
305  * Using le_sim_SendCommand(), the application has easier but more limited access to the
306  * SIM database. The command is transmitted to the SIM, which gives information through swi1 and
307  * swi2 about the execution of the command (see 3GPP recommendation previously mentioned for
308  * their coding).
309  * Some parameters are platform dependent, see @subpage platformConstraintsSim "SIM constraints" for
310  * their coding.
311  *
312  * @subsection le_sim_accessLogicalChannel Logical channels
313  *
314  * Logical channels are specified by the standard ETSI TS 102 221 in the section 8.7. If they are
315  * supported by the SIM card, logical channels allow to send independent APDUs on the different
316  * channels. In this case:
317  * - the basic channel 0 is always available and opened.
318  * - upon request, the card assigns a number to open a new channel. This channel remains open until
319  * it is explicitly closed or the SIM card is deactivated.
320  *
321  * Use le_sim_OpenLogicalChannel() API to open a logical channel on the SIM card. APDUs can then
322  * be sent to the SIM card with le_sim_SendApduOnChannel(). When the logical channel is not
323  * needed anymore, it can be closed using le_sim_CloseLogicalChannel().
324  *
325  * @subsection le_sim_accessSampleCode Sample code
326  *
327  * A sample code can be seen in the following page:
328  * - @subpage c_simTestApdu
329  *
330  * <HR>
331  *
332  * Copyright (C) Sierra Wireless Inc.
333  */
334 /**
335  * @file le_sim_interface.h
336  *
337  * Legato @ref c_sim include file.
338  *
339  * Copyright (C) Sierra Wireless Inc.
340  */
341 /**
342  * @page c_simTestProfileSwitch Sample code for Local SIM profile switch
343  *
344  * @include "apps/test/modemServices/sim/simProfileSwap/simTestComp/simTest.c"
345  */
346 /**
347  * @page c_simTestSimToolkit Sample code for Local SIM Toolkit
348  *
349  * @include "apps/test/modemServices/sim/simToolkit/simToolkitComp/simToolkitTest.c"
350  */
351 /**
352  * @page c_simTestAuthentication Sample code for SIM Authentication
353  *
354  * @snippet "apps/test/modemServices/sim/simIntegrationTest/simTestComp/simTest.c" Define
355  * @snippet "apps/test/modemServices/sim/simIntegrationTest/simTestComp/main.c" Print
356  * @snippet "apps/test/modemServices/sim/simIntegrationTest/simTestComp/simTest.c" Authentication
357  */
358 /**
359  * @page c_simTestIdentification Sample code for SIM Identification
360  *
361  * @snippet "apps/test/modemServices/sim/simIntegrationTest/simTestComp/main.c" Print
362  * @snippet "apps/test/modemServices/sim/simIntegrationTest/simTestComp/simTest.c" Identification
363  */
364 /**
365  * @page c_simTestSelect Sample code for SIM Select
366  * @snippet "apps/test/modemServices/sim/simIntegrationTest/simTestComp/simTest.c" Select
367  */
368 /**
369  * @page c_simTestStates Sample code for SIM States
370  *
371  * @snippet "apps/test/modemServices/sim/simIntegrationTest/simTestComp/main.c" Print
372  * @snippet "apps/test/modemServices/sim/simIntegrationTest/simTestComp/simTest.c" Display
373  * @snippet "apps/test/modemServices/sim/simIntegrationTest/simTestComp/simTest.c" State handler
374  * @snippet "apps/test/modemServices/sim/simIntegrationTest/simTestComp/simTest.c" State
375  */
376 /**
377  * @page c_simTestApdu Sample code for SIM access
378  * @snippet "apps/test/modemServices/sim/simIntegrationTest/simTestComp/simTest.c" Apdu
379  */
380 
381 #ifndef LE_SIM_INTERFACE_H_INCLUDE_GUARD
382 #define LE_SIM_INTERFACE_H_INCLUDE_GUARD
383 
384 
385 #include "legato.h"
386 
387 // Interface specific includes
388 #include "le_mdmDefs_interface.h"
389 
390 
391 //--------------------------------------------------------------------------------------------------
392 /**
393  * Type for handler called when a server disconnects.
394  */
395 //--------------------------------------------------------------------------------------------------
396 typedef void (*le_sim_DisconnectHandler_t)(void *);
397 
398 //--------------------------------------------------------------------------------------------------
399 /**
400  *
401  * Connect the current client thread to the service providing this API. Block until the service is
402  * available.
403  *
404  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
405  * called before any other functions in this API. Normally, ConnectService is automatically called
406  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
407  *
408  * This function is created automatically.
409  */
410 //--------------------------------------------------------------------------------------------------
412 (
413  void
414 );
415 
416 //--------------------------------------------------------------------------------------------------
417 /**
418  *
419  * Try to connect the current client thread to the service providing this API. Return with an error
420  * if the service is not available.
421  *
422  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
423  * called before any other functions in this API. Normally, ConnectService is automatically called
424  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
425  *
426  * This function is created automatically.
427  *
428  * @return
429  * - LE_OK if the client connected successfully to the service.
430  * - LE_UNAVAILABLE if the server is not currently offering the service to which the client is
431  * bound.
432  * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
433  * - LE_COMM_ERROR if the Service Directory cannot be reached.
434  */
435 //--------------------------------------------------------------------------------------------------
437 (
438  void
439 );
440 
441 //--------------------------------------------------------------------------------------------------
442 /**
443  * Set handler called when server disconnection is detected.
444  *
445  * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants
446  * to continue without exiting, it should call longjmp() from inside the handler.
447  */
448 //--------------------------------------------------------------------------------------------------
450 (
451  le_sim_DisconnectHandler_t disconnectHandler,
452  void *contextPtr
453 );
454 
455 //--------------------------------------------------------------------------------------------------
456 /**
457  *
458  * Disconnect the current client thread from the service providing this API.
459  *
460  * Normally, this function doesn't need to be called. After this function is called, there's no
461  * longer a connection to the service, and the functions in this API can't be used. For details, see
462  * @ref apiFilesC_client.
463  *
464  * This function is created automatically.
465  */
466 //--------------------------------------------------------------------------------------------------
468 (
469  void
470 );
471 
472 
473 //--------------------------------------------------------------------------------------------------
474 /**
475  * Minimum PIN length (4 digits)
476  */
477 //--------------------------------------------------------------------------------------------------
478 #define LE_SIM_PIN_MIN_LEN 4
479 
480 //--------------------------------------------------------------------------------------------------
481 /**
482  * Maximum PIN length (8 digits)
483  */
484 //--------------------------------------------------------------------------------------------------
485 #define LE_SIM_PIN_MAX_LEN 8
486 
487 //--------------------------------------------------------------------------------------------------
488 /**
489  * Maximum PIN length (8 digits)
490  * One extra byte is added for the null character.
491  */
492 //--------------------------------------------------------------------------------------------------
493 #define LE_SIM_PIN_MAX_BYTES 9
494 
495 //--------------------------------------------------------------------------------------------------
496 /**
497  * PUK length (8 digits)
498  */
499 //--------------------------------------------------------------------------------------------------
500 #define LE_SIM_PUK_MAX_LEN 8
501 
502 //--------------------------------------------------------------------------------------------------
503 /**
504  * PUK length (8 digits)
505  * One extra byte is added for the null character.
506  */
507 //--------------------------------------------------------------------------------------------------
508 #define LE_SIM_PUK_MAX_BYTES 9
509 
510 //--------------------------------------------------------------------------------------------------
511 /**
512  * ICCID length
513  * According to GSM Phase 1
514  */
515 //--------------------------------------------------------------------------------------------------
516 #define LE_SIM_ICCID_LEN 20
517 
518 //--------------------------------------------------------------------------------------------------
519 /**
520  * ICCID length
521  * One extra byte is added for the null character.
522  */
523 //--------------------------------------------------------------------------------------------------
524 #define LE_SIM_ICCID_BYTES 21
525 
526 //--------------------------------------------------------------------------------------------------
527 /**
528  * IMSI length
529  */
530 //--------------------------------------------------------------------------------------------------
531 #define LE_SIM_IMSI_LEN 15
532 
533 //--------------------------------------------------------------------------------------------------
534 /**
535  * IMSI length
536  * One extra byte is added for the null character.
537  */
538 //--------------------------------------------------------------------------------------------------
539 #define LE_SIM_IMSI_BYTES 16
540 
541 //--------------------------------------------------------------------------------------------------
542 /**
543  * APDU length
544  */
545 //--------------------------------------------------------------------------------------------------
546 #define LE_SIM_APDU_MAX_BYTES 255
547 
548 //--------------------------------------------------------------------------------------------------
549 /**
550  * SIM response length
551  */
552 //--------------------------------------------------------------------------------------------------
553 #define LE_SIM_RESPONSE_MAX_BYTES 256
554 
555 //--------------------------------------------------------------------------------------------------
556 /**
557  * SIM file identifier length
558  */
559 //--------------------------------------------------------------------------------------------------
560 #define LE_SIM_FILE_ID_LEN 4
561 
562 //--------------------------------------------------------------------------------------------------
563 /**
564  * SIM file identifier length
565  * One extra byte is added for the null character.
566  */
567 //--------------------------------------------------------------------------------------------------
568 #define LE_SIM_FILE_ID_BYTES 5
569 
570 //--------------------------------------------------------------------------------------------------
571 /**
572  * SIM data command length
573  *
574  */
575 //--------------------------------------------------------------------------------------------------
576 #define LE_SIM_DATA_MAX_BYTES 100
577 
578 //--------------------------------------------------------------------------------------------------
579 /**
580  * SIM file path length
581  */
582 //--------------------------------------------------------------------------------------------------
583 #define LE_SIM_PATH_MAX_LEN 100
584 
585 //--------------------------------------------------------------------------------------------------
586 /**
587  * SIM file path length
588  * One extra byte is added for the null character.
589  */
590 //--------------------------------------------------------------------------------------------------
591 #define LE_SIM_PATH_MAX_BYTES 101
592 
593 //--------------------------------------------------------------------------------------------------
594 /**
595  * eUICC identifier (EID) length
596  */
597 //--------------------------------------------------------------------------------------------------
598 #define LE_SIM_EID_LEN 32
599 
600 //--------------------------------------------------------------------------------------------------
601 /**
602  * eUICC identifier (EID) length
603  * One extra byte is added for the null character.
604  */
605 //--------------------------------------------------------------------------------------------------
606 #define LE_SIM_EID_BYTES 33
607 
608 //--------------------------------------------------------------------------------------------------
609 /**
610  * Reference type for FPLMN list.
611  */
612 //--------------------------------------------------------------------------------------------------
613 typedef struct le_sim_FPLMNList* le_sim_FPLMNListRef_t;
614 
615 
616 //--------------------------------------------------------------------------------------------------
617 /**
618  * SIM states.
619  *
620  */
621 //--------------------------------------------------------------------------------------------------
622 typedef enum
623 {
625  ///< SIM card is inserted and locked.
627  ///< SIM card is absent.
629  ///< SIM card is inserted and unlocked.
631  ///< SIM card is blocked.
633  ///< SIM card is busy.
635  ///< Unknown SIM state.
636 }
638 
639 
640 //--------------------------------------------------------------------------------------------------
641 /**
642  * SIM identifiers.
643  *
644  */
645 //--------------------------------------------------------------------------------------------------
646 typedef enum
647 {
649  ///< Embedded SIM
651  ///< SIM inserted in external slot 1
653  ///< SIM inserted in external slot 2
655  ///< Remote SIM
656  LE_SIM_ID_MAX = 4
657  ///<
658 }
660 
661 
662 //--------------------------------------------------------------------------------------------------
663 /**
664  * Card Manufacturer.
665  *
666  */
667 //--------------------------------------------------------------------------------------------------
668 typedef enum
669 {
671  ///< Oberthur.
673  ///< Gemalto.
675  ///< G&D.
677  ///< Morpho.
679  ///< Valid.
680  LE_SIM_MANUFACTURER_MAX = 5
681  ///<
682 }
684 
685 
686 //--------------------------------------------------------------------------------------------------
687 /**
688  * SIM commands.
689  */
690 //--------------------------------------------------------------------------------------------------
691 typedef enum
692 {
694  ///< Read a file record.
696  ///< Read a transparent elementary file.
698  ///< Update a file record.
700  ///< Update a transparent elementary file.
702  ///< Max value
703 }
705 
706 
707 //--------------------------------------------------------------------------------------------------
708 /**
709  * SIM Toolkit events.
710  */
711 //--------------------------------------------------------------------------------------------------
712 typedef enum
713 {
715  ///< SIM card asks to open a logical channel.
717  ///< SIM card asks for a refresh.
719  ///< Unknown SIM Toolkit event.
720 }
722 
723 
724 //--------------------------------------------------------------------------------------------------
725 /**
726  * SIM Toolkit Refresh modes, defined in ETSI TS 102 223 sections 6.4.7 and 8.6.
727  */
728 //--------------------------------------------------------------------------------------------------
729 typedef enum
730 {
732  ///< Initialization and Full File Change Notification.
734  ///< File Change Notification.
736  ///< Initialization and File Change Notification.
738  ///< Initialization.
740  ///< SIM reset.
742  ///< Application reset.
744  ///< Session reset.
746  ///< Steering of Roaming as defined in 3GPP TS 23.122.
748  ///< Steering of Roaming for I-WLAN
749  ///< as defined in 3GPP TS 24.234.
751  ///< eUICC Profile State Change.
753  ///< Invalid SIM Toolkit Refresh mode.
754 }
756 
757 
758 //--------------------------------------------------------------------------------------------------
759 /**
760  * SIM Toolkit Refresh stages.
761  */
762 //--------------------------------------------------------------------------------------------------
763 typedef enum
764 {
766  ///< Waiting for OK to refresh.
768  ///< Refresh succeeded.
770  ///< Refresh failed.
772  ///< Invalid SIM Toolkit Refresh stage.
773 }
775 
776 
777 //--------------------------------------------------------------------------------------------------
778 /**
779  * Reference type used by Add/Remove functions for EVENT 'le_sim_NewState'
780  */
781 //--------------------------------------------------------------------------------------------------
782 typedef struct le_sim_NewStateHandler* le_sim_NewStateHandlerRef_t;
783 
784 
785 //--------------------------------------------------------------------------------------------------
786 /**
787  * Reference type used by Add/Remove functions for EVENT 'le_sim_SimToolkitEvent'
788  */
789 //--------------------------------------------------------------------------------------------------
790 typedef struct le_sim_SimToolkitEventHandler* le_sim_SimToolkitEventHandlerRef_t;
791 
792 
793 //--------------------------------------------------------------------------------------------------
794 /**
795  * Handler for sim state changes.
796  *
797  */
798 //--------------------------------------------------------------------------------------------------
799 typedef void (*le_sim_NewStateHandlerFunc_t)
800 (
801  le_sim_Id_t simId,
802  ///< The SIM identifier.
803  le_sim_States_t simState,
804  ///< The SIM state.
805  void* contextPtr
806  ///<
807 );
808 
809 //--------------------------------------------------------------------------------------------------
810 /**
811  * Handler for Sim Toolkit Events.
812  *
813  */
814 //--------------------------------------------------------------------------------------------------
816 (
817  le_sim_Id_t simId,
818  ///< The SIM identifier.
819  le_sim_StkEvent_t stkEvent,
820  ///< The SIM state.
821  void* contextPtr
822  ///<
823 );
824 
825 //--------------------------------------------------------------------------------------------------
826 /**
827  * Add handler function for EVENT 'le_sim_NewState'
828  *
829  * This event provides information on sim state changes.
830  *
831  */
832 //--------------------------------------------------------------------------------------------------
834 (
835  le_sim_NewStateHandlerFunc_t handlerPtr,
836  ///< [IN]
837  void* contextPtr
838  ///< [IN]
839 );
840 
841 //--------------------------------------------------------------------------------------------------
842 /**
843  * Remove handler function for EVENT 'le_sim_NewState'
844  */
845 //--------------------------------------------------------------------------------------------------
847 (
848  le_sim_NewStateHandlerRef_t handlerRef
849  ///< [IN]
850 );
851 
852 //--------------------------------------------------------------------------------------------------
853 /**
854  * Add handler function for EVENT 'le_sim_SimToolkitEvent'
855  *
856  * This event provides information on Sim Toolkit application.
857  *
858  */
859 //--------------------------------------------------------------------------------------------------
861 (
863  ///< [IN]
864  void* contextPtr
865  ///< [IN]
866 );
867 
868 //--------------------------------------------------------------------------------------------------
869 /**
870  * Remove handler function for EVENT 'le_sim_SimToolkitEvent'
871  */
872 //--------------------------------------------------------------------------------------------------
874 (
876  ///< [IN]
877 );
878 
879 //--------------------------------------------------------------------------------------------------
880 /**
881  * Get the current selected card.
882  *
883  * @return Number of the current selected SIM card.
884  */
885 //--------------------------------------------------------------------------------------------------
887 (
888  void
889 );
890 
891 //--------------------------------------------------------------------------------------------------
892 /**
893  * Select a SIM.
894  *
895  * @return LE_FAULT Function failed to select the requested SIM
896  * @return LE_OK Function succeeded.
897  *
898  */
899 //--------------------------------------------------------------------------------------------------
901 (
902  le_sim_Id_t simId
903  ///< [IN] The SIM identifier.
904 );
905 
906 //--------------------------------------------------------------------------------------------------
907 /**
908  * Retrieves the integrated circuit card identifier (ICCID) of the SIM card (20 digits)
909  *
910  * @return LE_OK ICCID was successfully retrieved.
911  * @return LE_OVERFLOW iccidPtr buffer was too small for the ICCID.
912  * @return LE_BAD_PARAMETER Invalid parameters.
913  * @return LE_FAULT The ICCID could not be retrieved.
914  *
915  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
916  * function will not return.
917  */
918 //--------------------------------------------------------------------------------------------------
920 (
921  le_sim_Id_t simId,
922  ///< [IN] The SIM identifier.
923  char* iccid,
924  ///< [OUT] ICCID
925  size_t iccidSize
926  ///< [IN]
927 );
928 
929 //--------------------------------------------------------------------------------------------------
930 /**
931  * Retrieves the identifier for the embedded Universal Integrated Circuit Card identifier (EID)
932  * (32 digits)
933  *
934  * @return LE_OK EID was successfully retrieved.
935  * @return LE_OVERFLOW eidPtr buffer was too small for the EID.
936  * @return LE_BAD_PARAMETER Invalid parameters.
937  * @return LE_FAULT The EID could not be retrieved.
938  *
939  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
940  * function will not return.
941  */
942 //--------------------------------------------------------------------------------------------------
944 (
945  le_sim_Id_t simId,
946  ///< [IN] The SIM identifier.
947  char* eid,
948  ///< [OUT] EID
949  size_t eidSize
950  ///< [IN]
951 );
952 
953 //--------------------------------------------------------------------------------------------------
954 /**
955  * Retrieves the identification number (IMSI) of the SIM card. (max 15 digits)
956  *
957  * @return LE_OVERFLOW The imsiPtr buffer was too small for the IMSI.
958  * @return LE_BAD_PARAMETER The parameters are invalid.
959  * @return LE_FAULT The function failed.
960  * @return LE_TIMEOUT No response was received.
961  * @return LE_OK The function succeeded.
962  *
963  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
964  * function will not return.
965  */
966 //--------------------------------------------------------------------------------------------------
968 (
969  le_sim_Id_t simId,
970  ///< [IN] The SIM identifier.
971  char* imsi,
972  ///< [OUT] IMSI
973  size_t imsiSize
974  ///< [IN]
975 );
976 
977 //--------------------------------------------------------------------------------------------------
978 /**
979  * Verify if the SIM card is present or not.
980  *
981  * @return true SIM card is present.
982  * @return false SIM card is absent
983  *
984  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
985  * function will not return.
986  */
987 //--------------------------------------------------------------------------------------------------
988 bool le_sim_IsPresent
989 (
990  le_sim_Id_t simId
991  ///< [IN] The SIM identifier.
992 );
993 
994 //--------------------------------------------------------------------------------------------------
995 /**
996  * Verify if the SIM is ready (PIN code correctly inserted or not
997  * required).
998  *
999  * @return true PIN is correctly inserted or not required.
1000  * @return false PIN must be inserted
1001  *
1002  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
1003  * function will not return.
1004  */
1005 //--------------------------------------------------------------------------------------------------
1006 bool le_sim_IsReady
1007 (
1008  le_sim_Id_t simId
1009  ///< [IN] The SIM identifier.
1010 );
1011 
1012 //--------------------------------------------------------------------------------------------------
1013 /**
1014  * This function must be called to enter the PIN code.
1015  *
1016  * @return LE_BAD_PARAMETER The parameters are invalid.
1017  * @return LE_NOT_FOUND The function failed to select the SIM card for this operation.
1018  * @return LE_UNDERFLOW The PIN code is not long enough (min 4 digits).
1019  * @return LE_FAULT The function failed to enter the PIN code.
1020  * @return LE_OK The function succeeded.
1021  *
1022  * @note If PIN code is too long (max 8 digits), it is a fatal error, the
1023  * function will not return.
1024  *
1025  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
1026  * function will not return.
1027  */
1028 //--------------------------------------------------------------------------------------------------
1030 (
1031  le_sim_Id_t simId,
1032  ///< [IN] The SIM identifier.
1033  const char* LE_NONNULL pin
1034  ///< [IN] The PIN code.
1035 );
1036 
1037 //--------------------------------------------------------------------------------------------------
1038 /**
1039  * Change the PIN code.
1040  *
1041  * @return LE_NOT_FOUND Function failed to select the SIM card for this operation.
1042  * @return LE_UNDERFLOW PIN code is/are not long enough (min 4 digits).
1043  * @return LE_FAULT Function failed to change the PIN code.
1044  * @return LE_OK Function succeeded.
1045  *
1046  * @note If PIN code is too long (max 8 digits), it is a fatal error, the
1047  * function will not return.
1048  *
1049  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
1050  * function will not return.
1051  */
1052 //--------------------------------------------------------------------------------------------------
1054 (
1055  le_sim_Id_t simId,
1056  ///< [IN] The SIM identifier.
1057  const char* LE_NONNULL oldpin,
1058  ///< [IN] The old PIN code.
1059  const char* LE_NONNULL newpin
1060  ///< [IN] The new PIN code.
1061 );
1062 
1063 //--------------------------------------------------------------------------------------------------
1064 /**
1065  * Get the number of remaining PIN insertion tries.
1066  *
1067  * @return LE_NOT_FOUND The function failed to select the SIM card for this operation.
1068  * @return LE_BAD_PARAMETER Invalid SIM identifier.
1069  * @return LE_FAULT The function failed to get the number of remaining PIN insertion tries.
1070  * @return A positive value The function succeeded. The number of remaining PIN insertion tries.
1071  *
1072  */
1073 //--------------------------------------------------------------------------------------------------
1075 (
1076  le_sim_Id_t simId
1077  ///< [IN] The SIM identifier.
1078 );
1079 
1080 //--------------------------------------------------------------------------------------------------
1081 /**
1082  * Get the number of remaining PUK insertion tries.
1083  *
1084  * @return LE_OK On success.
1085  * @return LE_NOT_FOUND The function failed to select the SIM card for this operation.
1086  * @return LE_BAD_PARAMETER Invalid SIM identifier.
1087  * @return LE_FAULT The function failed to get the number of remaining PUK insertion tries.
1088  *
1089  * @note If the caller is passing an null pointer to this function, it is a fatal error
1090  * and the function will not return.
1091  *
1092  */
1093 //--------------------------------------------------------------------------------------------------
1095 (
1096  le_sim_Id_t simId,
1097  ///< [IN] The SIM identifier.
1098  uint32_t* remainingPukTriesPtrPtr
1099  ///< [OUT] The number of remaining PUK insertion tries.
1100 );
1101 
1102 //--------------------------------------------------------------------------------------------------
1103 /**
1104  * Unlock the SIM card: it disables the request of the PIN code.
1105  *
1106  * @return LE_NOT_FOUND Function failed to select the SIM card for this operation.
1107  * @return LE_UNDERFLOW PIN code is not long enough (min 4 digits).
1108  * @return LE_FAULT The function failed to unlock the SIM card.
1109  * @return LE_OK Function succeeded.
1110  *
1111  * @note If PIN code is too long (max 8 digits), it is a fatal error, the
1112  * function will not return.
1113  *
1114  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
1115  * function will not return.
1116  */
1117 //--------------------------------------------------------------------------------------------------
1119 (
1120  le_sim_Id_t simId,
1121  ///< [IN] The SIM identifier.
1122  const char* LE_NONNULL pin
1123  ///< [IN] The PIN code.
1124 );
1125 
1126 //--------------------------------------------------------------------------------------------------
1127 /**
1128  * Lock the SIM card: it enables the request of the PIN code.
1129  *
1130  * @return LE_NOT_FOUND Function failed to select the SIM card for this operation.
1131  * @return LE_UNDERFLOW PIN code is not long enough (min 4 digits).
1132  * @return LE_FAULT The function failed to unlock the SIM card.
1133  * @return LE_OK Function succeeded.
1134  *
1135  * @note If PIN code is 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 pin
1147  ///< [IN] The PIN code.
1148 );
1149 
1150 //--------------------------------------------------------------------------------------------------
1151 /**
1152  * Unblock the SIM card.
1153  *
1154  * @return LE_NOT_FOUND Function failed to select the SIM card for this operation.
1155  * @return LE_UNDERFLOW PIN code is not long enough (min 4 digits).
1156  * @return LE_BAD_PARAMETER Invalid SIM identifier.
1157  * @return LE_OUT_OF_RANGE PUK code length is not correct (8 digits).
1158  * @return LE_FAULT The function failed to unlock the SIM card.
1159  * @return LE_OK Function succeeded.
1160  *
1161  * @note If new PIN or puk code are too long (max 8 digits), it is a fatal error, the
1162  * function will not return.
1163  *
1164  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
1165  * function will not return.
1166  */
1167 //--------------------------------------------------------------------------------------------------
1169 (
1170  le_sim_Id_t simId,
1171  ///< [IN] The SIM identifier.
1172  const char* LE_NONNULL puk,
1173  ///< [IN] The PUK code.
1174  const char* LE_NONNULL newpin
1175  ///< [IN] The PIN code.
1176 );
1177 
1178 //--------------------------------------------------------------------------------------------------
1179 /**
1180  * Get the SIM state.
1181  *
1182  * @return Current SIM state.
1183  *
1184  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
1185  * function will not return.
1186  */
1187 //--------------------------------------------------------------------------------------------------
1189 (
1190  le_sim_Id_t simId
1191  ///< [IN] The SIM identifier.
1192 );
1193 
1194 //--------------------------------------------------------------------------------------------------
1195 /**
1196  * Get the SIM Phone Number.
1197  *
1198  * @return
1199  * - LE_OK on success
1200  * - LE_OVERFLOW if the Phone Number can't fit in phoneNumberStr
1201  * - LE_BAD_PARAMETER if a parameter is invalid
1202  * - LE_FAULT on any other failure
1203  *
1204  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
1205  * function will not return.
1206  */
1207 //--------------------------------------------------------------------------------------------------
1209 (
1210  le_sim_Id_t simId,
1211  ///< [IN] The SIM identifier.
1212  char* phoneNumberStr,
1213  ///< [OUT] The phone Number.
1214  size_t phoneNumberStrSize
1215  ///< [IN]
1216 );
1217 
1218 //--------------------------------------------------------------------------------------------------
1219 /**
1220  * This function must be called to get the Home Network Name information.
1221  *
1222  * @return
1223  * - LE_OK on success
1224  * - LE_OVERFLOW if the Home Network Name can't fit in nameStr
1225  * - LE_BAD_PARAMETER if a parameter is invalid
1226  * - LE_FAULT on any other failure
1227  *
1228  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
1229  * function will not return.
1230  *
1231  * @note The home network name can be given even if the device is not registered on the network.
1232  */
1233 //--------------------------------------------------------------------------------------------------
1235 (
1236  le_sim_Id_t simId,
1237  ///< [IN] The SIM identifier.
1238  char* nameStr,
1239  ///< [OUT] the home network Name
1240  size_t nameStrSize
1241  ///< [IN]
1242 );
1243 
1244 //--------------------------------------------------------------------------------------------------
1245 /**
1246  * This function must be called to get the Home Network MCC MNC.
1247  *
1248  * @return
1249  * - LE_OK on success
1250  * - LE_NOT_FOUND if Home Network has not been provisioned
1251  * - LE_FAULT for unexpected error
1252  *
1253  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
1254  * function will not return.
1255  */
1256 //--------------------------------------------------------------------------------------------------
1258 (
1259  le_sim_Id_t simId,
1260  ///< [IN] The SIM identifier.
1261  char* mccPtr,
1262  ///< [OUT] Mobile Country Code
1263  size_t mccPtrSize,
1264  ///< [IN]
1265  char* mncPtr,
1266  ///< [OUT] Mobile Network Code
1267  size_t mncPtrSize
1268  ///< [IN]
1269 );
1270 
1271 //--------------------------------------------------------------------------------------------------
1272 /**
1273  * This function must be called to request the multi-profile eUICC to swap to ECS and to refresh.
1274  * The User's application must wait for eUICC reboot to be finished and network connection
1275  * available.
1276  *
1277  * @return
1278  * - LE_OK on success
1279  * - LE_BAD_PARAMETER invalid SIM identifier
1280  * - LE_BUSY when a profile swap is already in progress
1281  * - LE_FAULT for unexpected error
1282  *
1283  * @warning If you use a Morpho or Oberthur card, the SIM_REFRESH PRO-ACTIVE command must be
1284  * accepted with le_sim_AcceptSimToolkitCommand() in order to complete the profile swap
1285  * procedure.
1286  */
1287 //--------------------------------------------------------------------------------------------------
1289 (
1290  le_sim_Id_t simId,
1291  ///< [IN] The SIM identifier.
1292  le_sim_Manufacturer_t manufacturer
1293  ///< [IN] The card manufacturer.
1294 );
1295 
1296 //--------------------------------------------------------------------------------------------------
1297 /**
1298  * This function must be called to request the multi-profile eUICC to swap back to commercial
1299  * subscription and to refresh.
1300  * The User's application must wait for eUICC reboot to be finished and network connection
1301  * available.
1302  *
1303  * @return
1304  * - LE_OK on success
1305  * - LE_BAD_PARAMETER invalid SIM identifier
1306  * - LE_BUSY when a profile swap is already in progress
1307  * - LE_FAULT for unexpected error
1308  *
1309  * @warning If you use a Morpho or Oberthur card, the SIM_REFRESH PRO-ACTIVE command must be
1310  * accepted with le_sim_AcceptSimToolkitCommand() in order to complete the profile swap
1311  * procedure.
1312  */
1313 //--------------------------------------------------------------------------------------------------
1315 (
1316  le_sim_Id_t simId,
1317  ///< [IN] The SIM identifier.
1318  le_sim_Manufacturer_t manufacturer
1319  ///< [IN] The card manufacturer.
1320 );
1321 
1322 //--------------------------------------------------------------------------------------------------
1323 /**
1324  * This function must be called to get the current subscription.
1325  *
1326  * @return
1327  * - LE_OK on success
1328  * - LE_BAD_PARAMETER invalid SIM identifier or null ECS pointer is passed
1329  * - LE_NOT_FOUND cannot determine the current selected subscription
1330  * - LE_FAULT for unexpected errors
1331  *
1332  * @warning There is no standard method to interrogate the current selected subscription. The
1333  * returned value of this function is based on the last executed local swap command. This means
1334  * that this function will always return LE_NOT_FOUND error at Legato startup.
1335  */
1336 //--------------------------------------------------------------------------------------------------
1338 (
1339  le_sim_Id_t simId,
1340  ///< [IN] The SIM identifier
1341  bool* isEcsPtr
1342  ///< [OUT] true if Emergency Call Subscription (ECS) is selected,
1343  ///< false if Commercial Subscription is selected
1344 );
1345 
1346 //--------------------------------------------------------------------------------------------------
1347 /**
1348  * Accept the last SIM Toolkit command.
1349  *
1350  * @return
1351  * - LE_OK The function succeeded.
1352  * - LE_FAULT The function failed.
1353  */
1354 //--------------------------------------------------------------------------------------------------
1356 (
1357  le_sim_Id_t simId
1358  ///< [IN] The SIM identifier.
1359 );
1360 
1361 //--------------------------------------------------------------------------------------------------
1362 /**
1363  * Reject the last SIM Toolkit command.
1364  *
1365  * @return
1366  * - LE_OK The function succeeded.
1367  * - LE_FAULT The function failed.
1368  */
1369 //--------------------------------------------------------------------------------------------------
1371 (
1372  le_sim_Id_t simId
1373  ///< [IN] The SIM identifier.
1374 );
1375 
1376 //--------------------------------------------------------------------------------------------------
1377 /**
1378  * Retrieve the mode of the last SIM Toolkit Refresh command.
1379  * The modes are defined in ETSI TS 102 223 sections 6.4.7 and 8.6.
1380  *
1381  * @return
1382  * - LE_OK The function succeeded.
1383  * - LE_BAD_PARAMETER A parameter is invalid.
1384  * - LE_UNAVAILABLE The last SIM Toolkit command is not a Refresh command.
1385  * - LE_FAULT The function failed.
1386  */
1387 //--------------------------------------------------------------------------------------------------
1389 (
1390  le_sim_Id_t simId,
1391  ///< [IN] The SIM identifier.
1392  le_sim_StkRefreshMode_t* refreshModePtr
1393  ///< [OUT] The Refresh mode.
1394 );
1395 
1396 //--------------------------------------------------------------------------------------------------
1397 /**
1398  * Retrieve the stage of the last SIM Toolkit Refresh command.
1399  *
1400  * @return
1401  * - LE_OK The function succeeded.
1402  * - LE_BAD_PARAMETER A parameter is invalid.
1403  * - LE_UNAVAILABLE The last SIM Toolkit command is not a Refresh command.
1404  * - LE_FAULT The function failed.
1405  */
1406 //--------------------------------------------------------------------------------------------------
1408 (
1409  le_sim_Id_t simId,
1410  ///< [IN] The SIM identifier.
1411  le_sim_StkRefreshStage_t* refreshStagePtr
1412  ///< [OUT] The Refresh stage.
1413 );
1414 
1415 //--------------------------------------------------------------------------------------------------
1416 /**
1417  * Send APDU command to the SIM.
1418  *
1419  * @return
1420  * - LE_OK Function succeeded.
1421  * - LE_FAULT The function failed.
1422  * - LE_BAD_PARAMETER A parameter is invalid.
1423  * - LE_NOT_FOUND The function failed to select the SIM card for this operation.
1424  */
1425 //--------------------------------------------------------------------------------------------------
1427 (
1428  le_sim_Id_t simId,
1429  ///< [IN] The SIM identifier.
1430  const uint8_t* commandApduPtr,
1431  ///< [IN] APDU command.
1432  size_t commandApduSize,
1433  ///< [IN]
1434  uint8_t* responseApduPtr,
1435  ///< [OUT] SIM response.
1436  size_t* responseApduSizePtr
1437  ///< [INOUT]
1438 );
1439 
1440 //--------------------------------------------------------------------------------------------------
1441 /**
1442  * Send a command to the SIM.
1443  *
1444  * @return
1445  * - LE_OK Function succeeded.
1446  * - LE_FAULT The function failed.
1447  * - LE_BAD_PARAMETER A parameter is invalid.
1448  * - LE_NOT_FOUND - The function failed to select the SIM card for this operation
1449  * - The requested SIM file is not found
1450  * - LE_OVERFLOW Response buffer is too small to copy the SIM answer.
1451  * - LE_UNSUPPORTED The platform does not support this operation.
1452  */
1453 //--------------------------------------------------------------------------------------------------
1455 (
1456  le_sim_Id_t simId,
1457  ///< [IN] The SIM identifier.
1458  le_sim_Command_t command,
1459  ///< [IN] The SIM command.
1460  const char* LE_NONNULL fileIdentifier,
1461  ///< [IN] File identifier
1462  uint8_t p1,
1463  ///< [IN] Parameter P1 passed to the SIM
1464  uint8_t p2,
1465  ///< [IN] Parameter P2 passed to the SIM
1466  uint8_t p3,
1467  ///< [IN] Parameter P3 passed to the SIM
1468  const uint8_t* dataPtr,
1469  ///< [IN] data command.
1470  size_t dataSize,
1471  ///< [IN]
1472  const char* LE_NONNULL path,
1473  ///< [IN] path of the elementary file
1474  uint8_t* sw1Ptr,
1475  ///< [OUT] Status Word 1 received from the SIM
1476  uint8_t* sw2Ptr,
1477  ///< [OUT] Status Word 2 received from the SIM
1478  uint8_t* responsePtr,
1479  ///< [OUT] SIM response.
1480  size_t* responseSizePtr
1481  ///< [INOUT]
1482 );
1483 
1484 //--------------------------------------------------------------------------------------------------
1485 /**
1486  * Reset the SIM.
1487  *
1488  * @return
1489  * - LE_FAULT Function failed.
1490  * - LE_OK Function succeeded.
1491  */
1492 //--------------------------------------------------------------------------------------------------
1494 (
1495  le_sim_Id_t simId
1496  ///< [IN] The SIM identifier.
1497 );
1498 
1499 //--------------------------------------------------------------------------------------------------
1500 /**
1501  * Create empty FPLMN list to insert FPLMN operators.
1502  *
1503  * @return
1504  * - Reference to the List object.
1505  * - Null pointer if not able to create list reference.
1506  */
1507 //--------------------------------------------------------------------------------------------------
1509 (
1510  void
1511 );
1512 
1513 //--------------------------------------------------------------------------------------------------
1514 /**
1515  * Add FPLMN network into the newly created FPLMN list.
1516  * If the FPLMNListRef, mcc or mnc is not valid then this function will kill the calling client.
1517  *
1518  * @return
1519  * - LE_FAULT Function failed.
1520  * - LE_OK Function succeeded.
1521  * - LE_OVERFLOW If FPLMN operator can not be inserted into FPLMN list.
1522  */
1523 //--------------------------------------------------------------------------------------------------
1525 (
1526  le_sim_FPLMNListRef_t FPLMNListRef,
1527  ///< [IN] FPLMN list reference.
1528  const char* LE_NONNULL mcc,
1529  ///< [IN] Mobile Country Code.
1530  const char* LE_NONNULL mnc
1531  ///< [IN] Mobile Network Code.
1532 );
1533 
1534 //--------------------------------------------------------------------------------------------------
1535 /**
1536  * Write FPLMN list into the SIM.
1537  * If the FPLMNListRef is not valid then this function will kill the calling client.
1538  *
1539  * @return
1540  * - LE_FAULT Function failed.
1541  * - LE_OK Function succeeded.
1542  *
1543  */
1544 //--------------------------------------------------------------------------------------------------
1546 (
1547  le_sim_Id_t simId,
1548  ///< [IN] The SIM identifier.
1549  le_sim_FPLMNListRef_t FPLMNListRef
1550  ///< [IN] FPLMN list reference.
1551 );
1552 
1553 //--------------------------------------------------------------------------------------------------
1554 /**
1555  * Read FPLMN list from the SIM.
1556  *
1557  * @return
1558  * - Reference to the List object.
1559  * - Null pointer if FPLMN list is not able to read from the SIM.
1560  */
1561 //--------------------------------------------------------------------------------------------------
1563 (
1564  le_sim_Id_t simId
1565  ///< [IN] The SIM identifier.
1566 );
1567 
1568 //--------------------------------------------------------------------------------------------------
1569 /**
1570  * Read the first FPLMN network from the list of FPLMN objects retrieved with
1571  * le_sim_ReadFPLMNList().
1572  * If the FPLMNListRef, mccPtr or mncPtr is not valid then this function will kill the calling
1573  * client.
1574  *
1575  * @return
1576  * - LE_FAULT Function failed.
1577  * - LE_OK Function succeeded.
1578  * - LE_OVERFLOW MCC/MNC string size is greater than string length parameter which has
1579  * been given into this function.
1580  */
1581 //--------------------------------------------------------------------------------------------------
1583 (
1584  le_sim_FPLMNListRef_t FPLMNListRef,
1585  ///< [IN] FPLMN list reference.
1586  char* mccPtr,
1587  ///< [OUT] Mobile Country Code.
1588  size_t mccPtrSize,
1589  ///< [IN]
1590  char* mncPtr,
1591  ///< [OUT] Mobile Network Code.
1592  size_t mncPtrSize
1593  ///< [IN]
1594 );
1595 
1596 //--------------------------------------------------------------------------------------------------
1597 /**
1598  * Read the next FPLMN network from the list of FPLMN objects retrieved with le_sim_ReadFPLMNList().
1599  * If the FPLMNListRef, mccPtr or mncPtr is not valid then this function will kill the calling
1600  * client.
1601  *
1602  * @return
1603  * - LE_FAULT Function failed.
1604  * - LE_OK Function succeeded.
1605  * - LE_OVERFLOW MCC/MNC string size is greater than string length parameter which has
1606  * been given into this function.
1607  */
1608 //--------------------------------------------------------------------------------------------------
1610 (
1611  le_sim_FPLMNListRef_t FPLMNListRef,
1612  ///< [IN] FPLMN list reference.
1613  char* mccPtr,
1614  ///< [OUT] Mobile Country Code.
1615  size_t mccPtrSize,
1616  ///< [IN]
1617  char* mncPtr,
1618  ///< [OUT] Mobile Network Code.
1619  size_t mncPtrSize
1620  ///< [IN]
1621 );
1622 
1623 //--------------------------------------------------------------------------------------------------
1624 /**
1625  * Delete the FPLMN list created by le_sim_ReadFPLMNList() or le_sim_CreateFPLMNList().
1626  * If the FPLMNListRef is not valid then this function will kill the calling client.
1627  *
1628  * @note
1629  * On failure, the process exits, so you don't have to worry about checking the returned
1630  * reference for validity.
1631  */
1632 //--------------------------------------------------------------------------------------------------
1634 (
1635  le_sim_FPLMNListRef_t FPLMNListRef
1636  ///< [IN] FPLMN list reference.
1637 );
1638 
1639 //--------------------------------------------------------------------------------------------------
1640 /**
1641  * Open a logical channel on the SIM card.
1642  *
1643  * @return
1644  * - LE_OK Function succeeded.
1645  * - LE_BAD_PARAMETER Invalid parameter.
1646  * - LE_FAULT Function failed.
1647  */
1648 //--------------------------------------------------------------------------------------------------
1650 (
1651  uint8_t* channelPtrPtr
1652  ///< [OUT] The number of the opened logical channel.
1653 );
1654 
1655 //--------------------------------------------------------------------------------------------------
1656 /**
1657  * Close a logical channel on the SIM card.
1658  *
1659  * @return
1660  * - LE_OK Function succeeded.
1661  * - LE_FAULT Function failed.
1662  */
1663 //--------------------------------------------------------------------------------------------------
1665 (
1666  uint8_t channel
1667  ///< [IN] The number of the logical channel to close.
1668 );
1669 
1670 //--------------------------------------------------------------------------------------------------
1671 /**
1672  * Send APDU command on a dedicated logical channel.
1673  *
1674  * @return
1675  * - LE_OK Function succeeded.
1676  * - LE_BAD_PARAMETER A parameter is invalid.
1677  * - LE_NOT_FOUND The function failed to select the SIM card for this operation.
1678  * - LE_FAULT The function failed.
1679  */
1680 //--------------------------------------------------------------------------------------------------
1682 (
1683  le_sim_Id_t simId,
1684  ///< [IN] The SIM identifier.
1685  uint8_t channel,
1686  ///< [IN] The logical channel number.
1687  const uint8_t* commandApduPtr,
1688  ///< [IN] APDU command.
1689  size_t commandApduSize,
1690  ///< [IN]
1691  uint8_t* responseApduPtr,
1692  ///< [OUT] SIM response.
1693  size_t* responseApduSizePtr
1694  ///< [INOUT]
1695 );
1696 
1697 #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:695
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:646
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:816
Initialization and Full File Change Notification.
Definition: le_sim_interface.h:731
Invalid SIM Toolkit Refresh mode.
Definition: le_sim_interface.h:752
le_result_t
Definition: le_basics.h:35
File Change Notification.
Definition: le_sim_interface.h:733
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:632
le_sim_StkEvent_t
Definition: le_sim_interface.h:712
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:699
Refresh succeeded.
Definition: le_sim_interface.h:767
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:737
le_result_t le_sim_OpenLogicalChannel(uint8_t *channelPtrPtr)
le_result_t le_sim_GetSimToolkitRefreshMode(le_sim_Id_t simId, le_sim_StkRefreshMode_t *refreshModePtr)
Embedded SIM.
Definition: le_sim_interface.h:648
Oberthur.
Definition: le_sim_interface.h:670
le_sim_States_t
Definition: le_sim_interface.h:622
struct le_sim_SimToolkitEventHandler * le_sim_SimToolkitEventHandlerRef_t
Definition: le_sim_interface.h:790
Steering of Roaming as defined in 3GPP TS 23.122.
Definition: le_sim_interface.h:745
SIM card is absent.
Definition: le_sim_interface.h:626
SIM card is inserted and locked.
Definition: le_sim_interface.h:624
Read a file record.
Definition: le_sim_interface.h:693
void(* le_sim_NewStateHandlerFunc_t)(le_sim_Id_t simId, le_sim_States_t simState, void *contextPtr)
Definition: le_sim_interface.h:800
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:743
le_result_t le_sim_SendApduOnChannel(le_sim_Id_t simId, uint8_t channel, const uint8_t *commandApduPtr, size_t commandApduSize, uint8_t *responseApduPtr, size_t *responseApduSizePtr)
le_sim_FPLMNListRef_t le_sim_ReadFPLMNList(le_sim_Id_t simId)
Max value.
Definition: le_sim_interface.h:701
Waiting for OK to refresh.
Definition: le_sim_interface.h:765
Unknown SIM Toolkit event.
Definition: le_sim_interface.h:718
void le_sim_ConnectService(void)
Refresh failed.
Definition: le_sim_interface.h:769
SIM card asks to open a logical channel.
Definition: le_sim_interface.h:714
le_result_t le_sim_GetIMSI(le_sim_Id_t simId, char *imsi, size_t imsiSize)
Definition: le_sim_interface.h:747
Gemalto.
Definition: le_sim_interface.h:672
Invalid SIM Toolkit Refresh stage.
Definition: le_sim_interface.h:771
SIM card asks for a refresh.
Definition: le_sim_interface.h:716
le_result_t le_sim_CloseLogicalChannel(uint8_t channel)
SIM inserted in external slot 1.
Definition: le_sim_interface.h:650
void le_sim_DisconnectService(void)
struct le_sim_NewStateHandler * le_sim_NewStateHandlerRef_t
Definition: le_sim_interface.h:782
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:668
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:396
le_sim_StkRefreshStage_t
Definition: le_sim_interface.h:763
Remote SIM.
Definition: le_sim_interface.h:654
Valid.
Definition: le_sim_interface.h:678
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)
eUICC Profile State Change.
Definition: le_sim_interface.h:750
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:729
le_result_t le_sim_RejectSimToolkitCommand(le_sim_Id_t simId)
struct le_sim_FPLMNList * le_sim_FPLMNListRef_t
Definition: le_sim_interface.h:613
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:630
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:739
le_result_t le_sim_IsEmergencyCallSubscriptionSelected(le_sim_Id_t simId, bool *isEcsPtr)
G&D.
Definition: le_sim_interface.h:674
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:741
Initialization and File Change Notification.
Definition: le_sim_interface.h:735
Morpho.
Definition: le_sim_interface.h:676
le_sim_Command_t
Definition: le_sim_interface.h:691
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:652
le_result_t le_sim_TryConnectService(void)
Unknown SIM state.
Definition: le_sim_interface.h:634
SIM card is inserted and unlocked.
Definition: le_sim_interface.h:628
Update a file record.
Definition: le_sim_interface.h:697