blob: 4fc7b1c792dfb84a95a01564ecc97c367ad4e1b5 [file] [log] [blame]
liubin281ac462023-07-19 14:22:54 +08001/**
2 *@file ql_mcm_sim.h
3 *@date 2017-05-02
4 *@author
5 *@brief
6 */
7#ifndef __QL_MCM_SIM_H__
8#define __QL_MCM_SIM_H__
9#include "mbtk_type.h"
10
11#include "ql_mcm.h"
12
13#define QL_SIM_IMSI_LEN_MAX 16 /** Maximum length of IMSI data. */
14#define QL_SIM_ICCID_LEN_MAX 20 /** Maximum length of ICCID data. */
15
16typedef uint32 sim_client_handle_type;
17
18typedef enum
19{
20 E_QL_MCM_SIM_SLOT_ID_1 = 0xB01, /**< Identify card in slot 1. */
21 E_QL_MCM_SIM_SLOT_ID_2 = 0xB02, /**< Identify card in slot 2. */
22}E_QL_MCM_SIM_SLOT_ID_TYPE_T;
23
24typedef enum
25{
26 E_QL_MCM_SIM_APP_TYPE_UNKNOWN = 0xB00, /**< Unknown application type */
27 E_QL_MCM_SIM_APP_TYPE_3GPP = 0xB01, /**< Identify the SIM/USIM application on the card. */
28 E_QL_MCM_SIM_APP_TYPE_3GPP2 = 0xB02, /**< Identify the RUIM/CSIM application on the card. */
29 E_QL_MCM_SIM_APP_TYPE_ISIM = 0xB03, /**< Identify the ISIM application on the card. */
30}E_QL_MCM_SIM_APP_TYPE_T;
31
32typedef struct
33{
34 E_QL_MCM_SIM_SLOT_ID_TYPE_T e_slot_id; /**< Indicates the slot to be used. */
35 E_QL_MCM_SIM_APP_TYPE_T e_app; /**< Indicates the type of the application. */
36}QL_SIM_APP_ID_INFO_T; /* Type */
37
38
39#define QL_SIM_MCC_LEN 3 /** Length of the MCC. */
40#define QL_SIM_MNC_MAX 3 /** Maximum length of the MNC. */
41#define QL_SIM_PLMN_NUM_MAX 24 /** Maximum number of PLMN data sets. */
42typedef struct
43{
44 char mcc[QL_SIM_MCC_LEN]; /**< MCC value in ASCII characters.*/
45 uint32_t mnc_len; /**< Must be set to the number of elements in the MNC. */
46 char mnc[QL_SIM_MNC_MAX]; /**< MNC value in ASCII characters.*/
47}QL_SIM_PLMN_INFO_T;
48
49typedef struct
50{
51 uint32_t preferred_operator_list_len; /**< Must be set to the number of elements in preferred_operator_list. */
52 QL_SIM_PLMN_INFO_T preferred_operator_list[QL_SIM_PLMN_NUM_MAX]; /**< Preferred operator list. */
53}QL_SIM_PREFERRED_OPERATOR_LIST_T; /* Message */
54
55
56#define QL_MCM_SIM_PIN_LEN_MAX 8 /** Maximum length of PIN data. */
57typedef enum
58{
59 E_QL_MCM_SIM_PIN_ID_1 = 0xB01, /**< Level 1 user verification. */
60 E_QL_MCM_SIM_PIN_ID_2 = 0xB02, /**< Level 2 user verification. */
61}E_QL_MCM_SIM_PIN_ID_TYPE_T;
62
63typedef struct
64{
65 QL_SIM_APP_ID_INFO_T app_info; /**< Application identification information. */
66 E_QL_MCM_SIM_PIN_ID_TYPE_T pin_id; /**< PIN ID. */
67 uint32_t pin_value_len; /**< Must be set to the number of elements in pin_value. */
68 char pin_value[QL_MCM_SIM_PIN_LEN_MAX]; /* Value of the PIN */
69}QL_SIM_VERIFY_PIN_INFO_T;
70
71/** Changes the PIN value of an application. The application must pass both the
72 new and the old values of the PIN to complete the operation.
73 The same PIN can be used by multiple sessions (i.e., the PIN is shared
74 between GSM and RUIM in an ICC card). The PIN is automatically verified
75 for all the sessions when the command is executed. */
76typedef struct
77{
78 QL_SIM_APP_ID_INFO_T app_info; /**< Application identification information. */
79 E_QL_MCM_SIM_PIN_ID_TYPE_T pin_id; /**< PIN ID. */
80 uint32_t old_pin_value_len; /**< Must be set to the number of elements in old_pin_value. */
81 char old_pin_value[QL_MCM_SIM_PIN_LEN_MAX]; /**< Value of the old PIN as a sequence of ASCII characters. */
82 uint32_t new_pin_value_len; /**< Must be set to the number of elements in new_pin_value. */
83 char new_pin_value[QL_MCM_SIM_PIN_LEN_MAX]; /**< Value of the new PIN as a sequence of ASCII characters. */
84}QL_SIM_CHANGE_PIN_INFO_T;
85
86/** Unblocks a blocked PIN using the PUK code. The client must pass PUK1 to unblock PIN1 or PUK2 to unblock PIN2.
87 The same PIN can be used by multiple sessions (i.e., the PIN is shared between GSM and RUIM in an ICC card).
88 The PIN is automatically verified for all the sessions when the command is executed. */
89typedef struct
90{
91 QL_SIM_APP_ID_INFO_T app_info; /**< Application identification information. */
92 E_QL_MCM_SIM_PIN_ID_TYPE_T pin_id; /**< PIN ID. */
93 uint32_t puk_value_len; /**< Must be set to the number of elements in puk_value. */
94 char puk_value[QL_MCM_SIM_PIN_LEN_MAX]; /**< Value of the PUK as a sequence of ASCII characters. */
95 uint32_t new_pin_value_len; /**< Must be set to the number of elements in new_pin_value. */
96 char new_pin_value[QL_MCM_SIM_PIN_LEN_MAX]; /**< Value of the new PIN as a sequence of ASCII characters. */
97}QL_SIM_UNBLOCK_PIN_INFO_T;
98
99/** Enables the PIN on an application. */
100typedef QL_SIM_VERIFY_PIN_INFO_T QL_SIM_ENABLE_PIN_INFO_T; //Same
101
102/** Disables the PIN of an application, */
103typedef QL_SIM_VERIFY_PIN_INFO_T QL_SIM_DISABLE_PIN_INFO_T; //Same
104
105
106typedef enum
107{
108 E_QL_MCM_SIM_PERSO_FEATURE_TYPE_UNKNOWN = 0xB00, /**< Unknown personalization feature. */
109 E_QL_MCM_SIM_PERSO_FEATURE_TYPE_3GPP_NETWORK = 0xB01, /**< Featurization based on 3GPP MCC and MNC. */
110 E_QL_MCM_SIM_PERSO_FEATURE_TYPE_3GPP_NETWORK_SUBSET = 0xB02, /**< Featurization based on 3GPP MCC, MNC, and IMSI digits 6 and 7. */
111 E_QL_MCM_SIM_PERSO_FEATURE_TYPE_3GPP_SERVICE_PROVIDER = 0xB03, /**< Featurization based on 3GPP MCC, MNC, and GID1. */
112 E_QL_MCM_SIM_PERSO_FEATURE_TYPE_3GPP_CORPORATE = 0xB04, /**< Featurization based on 3GPP MCC, MNC, GID1, and GID2. */
113 E_QL_MCM_SIM_PERSO_FEATURE_TYPE_3GPP_SIM = 0xB05, /**< Featurization based on the 3GPP IMSI. */
114 E_QL_MCM_SIM_PERSO_FEATURE_TYPE_3GPP2_NETWORK_TYPE_1 = 0xB06, /**< Featurization based on 3GPP2 MCC and MNC. */
115 E_QL_MCM_SIM_PERSO_FEATURE_TYPE_3GPP2_NETWORK_TYPE_2 = 0xB07, /**< Featurization based on 3GPP2 IRM code. */
116 E_QL_MCM_SIM_PERSO_FEATURE_TYPE_3GPP2_RUIM = 0xB08, /**< Featurization based on 3GPP2 IMSI_M. */
117}E_QL_MCM_SIM_PERSO_FEATURE_TYPE_T;
118
119typedef enum
120{
121 E_QL_MCM_SIM_PERSO_OPERATION_DEACTIVATE = 0xB00, /**< Disable an active personalization feature. */
122 E_QL_MCM_SIM_PERSO_OPERATION_UNBLOCK = 0xB01, /**< Unblock a personalization feature that has been blocked. */
123}E_QL_MCM_SIM_PERSO_OPERATION_TYPE_T;
124
125
126#define QL_MCM_SIM_CONTROL_KEY_LEN_MAX 16 /** Maximum length of personalization control key data */
127/** Deactivates or unblocks the personalization on the phone.
128 Each feature can be deactivated/unblocked independently of the other features. */
129typedef struct
130{
131 E_QL_MCM_SIM_PERSO_FEATURE_TYPE_T e_feature_type; /**< Indicates the personalization feature to deactivate or unblock. */
132 E_QL_MCM_SIM_PERSO_OPERATION_TYPE_T e_operation; /**< Indicates the operation to perform. */
133 uint32_t ctrl_key_value_len; /**< Must be set to the number of elements in ck_value. */
134 char ctrl_key_value[QL_MCM_SIM_CONTROL_KEY_LEN_MAX];/**< Control key value. This value is a sequence of ASCII characters.*/
135}QL_MCM_SIM_DEPERSONALIZE_INFO_T; /* Type */
136
137
138typedef struct
139{
140 char mcc[5]; /**< MCC value in ASCII characters.*/
141 uint32_t mnc_len; /**< Must be set to the number of elements in the MNC. */
142 char mnc[5]; /**< MNC value in ASCII characters.*/
143}QL_MCM_SIM_NW_PERSONAL_INFO_T;
144
145typedef struct
146{
147 QL_MCM_SIM_NW_PERSONAL_INFO_T network; /**< MCC and MNC network information.*/
148 char digit6; /**< Digit 6 of the IMSI in ASCII character.*/
149 char digit7; /**< Digit 7 of the IMSI in ASCII character.*/
150}QL_MCM_SIM_NW_SUBSET_PERSONAL_INFO_T;
151
152typedef struct
153{
154 QL_MCM_SIM_NW_PERSONAL_INFO_T network; /**< MCC and MNC network information.*/
155 uint8_t gid1; /**< Service provider code found in GID1.*/
156}QL_MCM_SIM_NW_SP_PERSONAL_INFO_T;
157
158typedef struct
159{
160 QL_MCM_SIM_NW_PERSONAL_INFO_T network; /**< MCC and MNC network information.*/
161 uint8_t gid1; /**< Service provider code found in GID1.*/
162 uint8_t gid2; /**< Corporate customer code found in GID2. @newpagetable */
163}QL_MCM_SIM_GW_CORPORATE_PERSONAL_INFO_T;
164
165#define QL_MCM_SIM_MSIN_LEN_MAX 10 /** Maximum length of the MSIN. */
166typedef struct
167{
168 QL_MCM_SIM_NW_PERSONAL_INFO_T network; /**< MCC and MNC network information.*/
169 uint32_t msin_len; /**< Must be set to the number of elements in MSIN. */
170 char msin[QL_MCM_SIM_MSIN_LEN_MAX];/**< MSIN value stored on the card in ASCII characters.*/
171}QL_MCM_SIM_SIM_PERSONAL_INFO_T; /* Type */
172
173typedef struct
174{
175 char irm_code[4];/**< First 4 digits of the IRM-based MIN of IMSI_M in ASCII characters.*/
176}QL_MCM_SIM_1X_NW_TYPE2_PERSONAL_INFO_T;
177
178
179#define QL_MCM_SIM_PERSO_NUM_NW_MAX 85 /** Maximum number of network personalization data sets. */
180#define QL_MCM_SIM_PERSO_NUM_NS_MAX 64 /** Maximum number of network subset personalization data sets. */
181#define QL_MCM_SIM_PERSO_NUM_GW_SP_MAX 64 /** Maximum number of service provider personalization data sets. */
182#define QL_MCM_SIM_PERSO_NUM_GW_CP_MAX 51 /** Maximum number of corporate personalization data sets. */
183#define QL_MCM_SIM_PERSO_NUM_SIM_MAX 32 /** Maximum number of SIM personalization data sets. */
184#define QL_MCM_SIM_PERSO_NUM_1X_NW2_MAX 128 /** Maximum number of network type 2 personalization data sets. */
185
186typedef union
187{
188 QL_MCM_SIM_NW_PERSONAL_INFO_T feature_gw_network_perso[QL_MCM_SIM_PERSO_NUM_NW_MAX]; /**< GW network personalization. */
189 QL_MCM_SIM_NW_SUBSET_PERSONAL_INFO_T feature_gw_network_subset_perso[QL_MCM_SIM_PERSO_NUM_NS_MAX]; /**< GW network subset personalization. */
190 QL_MCM_SIM_NW_SP_PERSONAL_INFO_T feature_gw_sp_perso[QL_MCM_SIM_PERSO_NUM_GW_SP_MAX]; /**< GW service provider personalization. */
191 QL_MCM_SIM_GW_CORPORATE_PERSONAL_INFO_T feature_gw_corporate_perso[QL_MCM_SIM_PERSO_NUM_GW_CP_MAX]; /**< GW corporate personalization. */
192 QL_MCM_SIM_SIM_PERSONAL_INFO_T feature_gw_sim_perso[QL_MCM_SIM_PERSO_NUM_SIM_MAX]; /**< GW SIM personalization. */
193 QL_MCM_SIM_NW_PERSONAL_INFO_T feature_1x_network1_perso[QL_MCM_SIM_PERSO_NUM_NW_MAX]; /**< 1X network type 1 personalization. */
194 QL_MCM_SIM_1X_NW_TYPE2_PERSONAL_INFO_T feature_1x_network2_perso[QL_MCM_SIM_PERSO_NUM_1X_NW2_MAX]; /**< 1X network type 3 personalization. */
195 QL_MCM_SIM_SIM_PERSONAL_INFO_T feature_1x_ruim_perso[QL_MCM_SIM_PERSO_NUM_SIM_MAX]; /* 1x RUIM Personalization */
196}QL_MCM_SIM_PERSONAL_FEATURE_INFO_DATA_T;
197
198/** Request message; Activates and sets the personalization data on the phone. Each feature can be activated
199 independently of one another; however, network data configurations must be consistent across activated personalization
200 modes in order to prevent contradicting featurization, and only one feature can be activated per message.
201 If personalization is already activated, it must first be deactivated before being reactivated with new data. */
202typedef struct
203{
204 uint32_t ctrl_key_value_len; /**< Must be set to the number of elements in ctrl_key_value. */
205 char ctrl_key_value[60]; /**< Control key value. This value is a sequence of ASCII characters.*/
206 E_QL_MCM_SIM_PERSO_FEATURE_TYPE_T e_feature_type;
207 uint32_t feature_data_len; //Valid array count of t_feature_data
208 QL_MCM_SIM_PERSONAL_FEATURE_INFO_DATA_T t_feature_data;
209}QL_MCM_SIM_PERSONALIZE_FEATURE_INFO_T;
210
211
212typedef enum
213{
214 E_QL_MCM_SIM_CARD_STATE_UNKNOWN = 0xB01, /**< Card state unknown. */
215 E_QL_MCM_SIM_CARD_STATE_ABSENT = 0xB02, /**< Card is absent. */
216 E_QL_MCM_SIM_CARD_STATE_PRESENT = 0xB03, /**< Card is present. */
217 E_QL_MCM_SIM_CARD_STATE_ERROR_UNKNOWN = 0xB04, /**< Unknown error state. */
218 E_QL_MCM_SIM_CARD_STATE_ERROR_POWER_DOWN = 0xB05, /**< Power down. */
219 E_QL_MCM_SIM_CARD_STATE_ERROR_POLL_ERROR = 0xB06, /**< Poll error. */
220 E_QL_MCM_SIM_CARD_STATE_ERROR_NO_ATR_RECEIVED = 0xB07, /**< Failed to receive an answer to reset. */
221 E_QL_MCM_SIM_CARD_STATE_ERROR_VOLT_MISMATCH = 0xB08, /**< Voltage mismatch. */
222 E_QL_MCM_SIM_CARD_STATE_ERROR_PARITY_ERROR = 0xB09, /**< Parity error. */
223 E_QL_MCM_SIM_CARD_STATE_ERROR_SIM_TECHNICAL_PROBLEMS= 0xB0A, /**< Card returned technical problems. */
224}E_QL_MCM_SIM_CARD_STATE_TYPE_T; /**< Card state. */
225
226typedef enum
227{
228 E_QL_MCM_SIM_CARD_TYPE_UNKNOWN = 0xB00, /**< Unidentified card type. */
229 E_QL_MCM_SIM_CARD_TYPE_ICC = 0xB01, /**< Card of SIM or RUIM type. */
230 E_QL_MCM_SIM_CARD_TYPE_UICC = 0xB02, /**< Card of USIM or CSIM type. */
231}E_QL_MCM_SIM_CARD_TYPE_T;
232
233typedef enum
234{
235 E_QL_MCM_SIM_PROV_STATE_NONE = 0xB00, /**< Nonprovisioning. */
236 E_QL_MCM_SIM_PROV_STATE_PRI = 0xB01, /**< Primary provisioning subscription. */
237 E_QL_MCM_SIM_PROV_STATE_SEC = 0xB02, /**< Secondary provisioning subscription. */
238}QL_MCM_SIM_SUBSCRIPTION_TYPE_T;
239
240typedef enum
241{
242 E_QL_MCM_SIM_APP_STATE_UNKNOWN = 0xB00, /**< Application state unknown. */
243 E_QL_MCM_SIM_APP_STATE_DETECTED = 0xB01, /**< Detected state. */
244 E_QL_MCM_SIM_APP_STATE_PIN1_REQ = 0xB02, /**< PIN1 required. */
245 E_QL_MCM_SIM_APP_STATE_PUK1_REQ = 0xB03, /**< PUK1 required. */
246 E_QL_MCM_SIM_APP_STATE_INITALIZATING = 0xB04, /**< Initializing. */
247 E_QL_MCM_SIM_APP_STATE_PERSO_CK_REQ = 0xB05, /**< Personalization control key required. */
248 E_QL_MCM_SIM_APP_STATE_PERSO_PUK_REQ = 0xB06, /**< Personalization unblock key required. */
249 E_QL_MCM_SIM_APP_STATE_PERSO_PERMANENTLY_BLOCKED= 0xB07, /**< Personalization is permanently blocked. */
250 E_QL_MCM_SIM_APP_STATE_PIN1_PERM_BLOCKED = 0xB08, /**< PIN1 is permanently blocked. */
251 E_QL_MCM_SIM_APP_STATE_ILLEGAL = 0xB09, /**< Illegal application state. */
252 E_QL_MCM_SIM_APP_STATE_READY = 0xB0A, /**< Application ready state. @newpage */
253}QL_MCM_SIM_APP_STATE_TYPE_T;
254
255typedef enum
256{
257 E_QL_MCM_SIM_PIN_STATE_UNKNOWN = 0xB01, /**< Unknown PIN state. */
258 E_QL_MCM_SIM_PIN_STATE_ENABLED_NOT_VERIFIED = 0xB02, /**< PIN required, but has not been verified. */
259 E_QL_MCM_SIM_PIN_STATE_ENABLED_VERIFIED = 0xB03, /**< PIN required and has been verified. */
260 E_QL_MCM_SIM_PIN_STATE_DISABLED = 0xB04, /**< PIN not required. */
261 E_QL_MCM_SIM_PIN_STATE_BLOCKED = 0xB05, /**< PIN verification has failed too many times and is blocked. Recoverable through PUK verification. */
262 E_QL_MCM_SIM_PIN_STATE_PERMANENTLY_BLOCKED = 0xB06, /**< PUK verification has failed too many times and is not recoverable. */
263}QL_MCM_SIM_PIN_STATE_TYPE_T;
264
265typedef struct
266{
267 QL_MCM_SIM_SUBSCRIPTION_TYPE_T subscription; /**< Type of subscription (i.e., primary, secondary, etc.). */
268 QL_MCM_SIM_APP_STATE_TYPE_T app_state; /**< Current state of the application. */
269 E_QL_MCM_SIM_PERSO_FEATURE_TYPE_T perso_feature; /**< Current personalization state and feature enabled. */
270 uint8_t perso_retries; /**< Number of personalization retries. */
271 uint8_t perso_unblock_retries; /**< Number of personalization unblock retries. */
272 QL_MCM_SIM_PIN_STATE_TYPE_T pin1_state; /**< Current PIN 1 state. */
273 uint8_t pin1_num_retries; /**< Number of PIN 1 retries. */
274 uint8_t puk1_num_retries; /**< Number of PUK 1 retries. */
275 QL_MCM_SIM_PIN_STATE_TYPE_T pin2_state; /**< Current PIN 2 state. */
276 uint8_t pin2_num_retries; /**< Number of PIN 2 retries. */
277 uint8_t puk2_num_retries; /**< Number of PUK 2 retries. */
278}QL_MCM_SIM_CARD_APP_INFO_T;
279
280typedef struct
281{
282 QL_MCM_SIM_CARD_APP_INFO_T app_3gpp; /**< Stores 3GPP application information. */
283 QL_MCM_SIM_CARD_APP_INFO_T app_3gpp2; /**< Stores 3GPP2 application information. */
284 QL_MCM_SIM_CARD_APP_INFO_T app_isim; /**< Stores ISIM application information. */
285}QL_MCM_SIM_CARD_ALL_APP_INFO_T;
286
287typedef struct
288{
289 E_QL_MCM_SIM_CARD_STATE_TYPE_T e_card_state;/**< Current card and card error state. */
290 E_QL_MCM_SIM_CARD_TYPE_T e_card_type; /**< Card type. */
291 QL_MCM_SIM_CARD_ALL_APP_INFO_T card_app_info; /**< Stores all relevant application information. */
292}QL_MCM_SIM_CARD_STATUS_INFO_T;
293
294#define QL_MCM_SIM_PATH_LEN_MAX 20 /** Maximum length of a full file path in ASCII format. */
295typedef struct
296{
297 uint16_t offset; /**< Offset is only required for write file access where data length is indicated.*/
298 uint8_t record_num; /**< Number of records involved in file access. A record number of 0 indicates transparent file access.*/
299 uint32_t path_len; /**< Must be set to the number of elements in the path. */
300 char path[QL_MCM_SIM_PATH_LEN_MAX]; /**< File path in ASCII characters. @newpagetable */
301}QL_MCM_SIM_CARD_FILE_ACCESS_INFO_T;
302
303#define QL_MCM_SIM_DATA_LEN_MAX 4096 /** Maximum size of data to be read/written. */
304typedef struct
305{
306 QL_SIM_APP_ID_INFO_T app_info; /**< Application identification information. */
307 QL_MCM_SIM_CARD_FILE_ACCESS_INFO_T file_access; /**< File access information. */
308 uint32_t data_len; /**< Must be set to the number of elements in data. */
309 uint8_t data[QL_MCM_SIM_DATA_LEN_MAX]; /**< Data to be updated on the card. */
310}QL_MCM_SIM_CARD_WRITE_FILE_INFO_T;
311
312
313/** Request message; Reads data to a specific file on a specified application on the card. The type of file is determined
314 by the record number field, which indicates a transparent file when zero and a record-based file otherwise.*/
315typedef struct
316{
317 QL_SIM_APP_ID_INFO_T app_info; /**< Application identification information. */
318 QL_MCM_SIM_CARD_FILE_ACCESS_INFO_T file_access; /**< File access information. */
319}QL_MCM_SIM_CARD_FILE_INFO_TO_READ_T;
320
321typedef struct
322{
323 uint32_t data_len; /**< Must be set to the number of elements in data. */
324 uint8_t data[QL_MCM_SIM_DATA_LEN_MAX]; /**< Data retrieved from the card. */
325}QL_MCM_SIM_CARD_FILE_DATA_T;
326
327/** Retrieves the size of a specific file on a specified application on the card. */
328typedef struct
329{
330 QL_SIM_APP_ID_INFO_T app_info; /**< Application identification information. */
331 uint32_t path_len; /**< Must be set to the number of elements in path. */
332 char path[QL_MCM_SIM_PATH_LEN_MAX]; /**< File path in ASCII characters.*/
333}QL_MCM_SIM_CARD_GET_FILE_SIZE_INPUT_INFO_T;
334
335typedef enum
336{
337 E_QL_MCM_SIM_FILE_TYPE_UNKNOWN = 0xB00,/**< Unknown file type */
338 E_QL_MCM_SIM_FILE_TYPE_TRANSPARENT = 0xB01,/**< File structure consisting of a sequence of bytes. */
339 E_QL_MCM_SIM_FILE_TYPE_CYCLIC = 0xB02,/**< File structure consisting of a sequence of records, each containing the same fixed size in
340 chronological order. Once all the records have been used, the oldest data is overwritten. */
341 MCM_SIM_FILE_TYPE_LINEAR_FIXED = 0xB03, /**< File structure consisting of a sequence of records, each containing the same fixed size. */
342}E_QL_MCM_SIM_FILE_TYPE_T;
343
344typedef struct
345{
346 E_QL_MCM_SIM_FILE_TYPE_T e_file_type; /**< File type: */
347 uint16_t file_size; /**< Size of transparent files.*/
348 uint16_t record_size; /**< Size of each cyclic or linear fixed file record.*/
349 uint16_t record_count; /**< Number of cyclic or linear fixed file records.*/
350}QL_MCM_SIM_FILE_SIZE_INFO_T;
351
352typedef enum
353{
354 E_QL_MCM_SIM_REFRESH_EVENT = 0xB00, /**< Card refresh event */
355 E_QL_MCM_SIM_CARD_STATUS_UPDATE_EVENT = 0xB01, /**< Card status update event. */
356}E_QL_SIM_NFY_MSG_ID_T;
357
358
359typedef void (*QL_SIM_CardStatusIndMsgHandlerFunc_t)
360(
361 sim_client_handle_type h_sim,
362 E_QL_SIM_NFY_MSG_ID_T e_msg_id,
363 void *pv_data,
364 void *contextPtr
365);
366
367
368int QL_MCM_SIM_Client_Init(sim_client_handle_type *ph_sim);
369
370int QL_MCM_SIM_Client_Deinit(sim_client_handle_type h_sim);
371
372/* Add callback function if anything changed specified by the mask in QL_LOC_Set_Indications*/
373int QL_MCM_SIM_AddRxIndMsgHandler(QL_SIM_CardStatusIndMsgHandlerFunc_t handlerPtr, void* contextPtr);
374
375
376/*===========================================================================
377
378 FUNCTION: QL_MCM_SIM_GetIMSI
379
380===========================================================================*/
381/*
382 @brief
383 Function sends a command to the modem to retrieve the IMSI (for 3GPP)
384 or IMSI_M (for 3GPP2) from the SIM in ASCII form
385
386 @return
387 void
388*/
389/*=========================================================================*/
390E_QL_ERROR_CODE_T QL_MCM_SIM_GetIMSI
391(
392 sim_client_handle_type h_sim,
393 QL_SIM_APP_ID_INFO_T *pt_info, ///< [IN] The SIM identifier info.
394 char *imsi, ///< [OUT] IMSI buffer
395 size_t imsiLen ///< [IN] IMSI buffer length
396);
397
398
399E_QL_ERROR_CODE_T QL_MCM_SIM_GetIMEI
400(
401 sim_client_handle_type h_sim,
402 char *imei, ///< [OUT] IMSI buffer
403 size_t imeiLen ///< [IN] IMSI buffer length
404);
405
406
407/*===========================================================================
408
409 FUNCTION: QL_MCM_SIM_GetICCID
410
411===========================================================================*/
412/*
413 @brief
414 Function sends a command to the modem to retrieve the ICCID from
415 SIM in ASCII form
416
417 @return
418 E_QL_ERROR_CODE_T
419*/
420/*=========================================================================*/
421E_QL_ERROR_CODE_T QL_MCM_SIM_GetICCID
422(
423 sim_client_handle_type h_sim,
424 E_QL_MCM_SIM_SLOT_ID_TYPE_T simId, ///< [IN] The SIM identifier.
425 char *iccid, ///< [OUT] ICCID
426 size_t iccidLen ///< [IN] ICCID buffer length
427);
428
429
430/*===========================================================================
431
432 FUNCTION: QL_MCM_SIM_GetPhoneNumber
433
434===========================================================================*/
435/*
436 @brief
437 Function sends a command to the modem to retrieve the device phone
438 number from MSISDN (for 3GPP) or MDN (for 3GPP2) from the SIM in
439 ASCII form
440
441 @return
442 E_QL_ERROR_CODE_T
443*/
444/*=========================================================================*/
445E_QL_ERROR_CODE_T QL_MCM_SIM_GetPhoneNumber
446(
447 sim_client_handle_type h_sim,
448 QL_SIM_APP_ID_INFO_T *pt_info, ///< [IN] The SIM identifier.
449 char *phone_num, ///< [OUT] phone number
450 size_t phoneLen ///< [IN] phone number buffer length
451);
452
453/*===========================================================================
454
455 FUNCTION: QL_MCM_SIM_GetOperatorPlmnList
456
457===========================================================================*/
458/*
459 @brief
460 Function sends multiple record based read commands to the modem
461 to retrieve a list of operator preffered PLMN.
462
463 @note
464 Function should only be called for SIM/USIM
465
466 @return
467 E_QL_ERROR_CODE_T
468*/
469/*=========================================================================*/
470E_QL_ERROR_CODE_T QL_MCM_SIM_GetOperatorPlmnList
471(
472 sim_client_handle_type h_sim,
473 E_QL_MCM_SIM_SLOT_ID_TYPE_T simId, ///< [IN] The SIM identifier.
474 QL_SIM_PREFERRED_OPERATOR_LIST_T *pt_info ///< [OUT] Preferred operator list
475);
476
477/*===========================================================================
478
479 FUNCTION: QL_MCM_SIM_VerifyPIN
480
481===========================================================================*/
482/*
483 @brief
484 Function sends a command to the modem to verify either PIN1 or PIN2
485
486 @return
487 E_QL_ERROR_CODE_T
488*/
489/*=========================================================================*/
490E_QL_ERROR_CODE_T QL_MCM_SIM_VerifyPIN
491(
492 sim_client_handle_type h_sim,
493 QL_SIM_VERIFY_PIN_INFO_T *pt_info ///< [IN] Verify PIN infor
494);
495
496
497/*===========================================================================
498
499 FUNCTION: QL_MCM_SIM_ChangePin
500
501===========================================================================*/
502/*
503 @brief
504 Function sends a command to the modem to change the value of
505 either PIN1 or PIN2
506
507 @return
508 E_QL_ERROR_CODE_T
509*/
510/*=========================================================================*/
511E_QL_ERROR_CODE_T QL_MCM_SIM_ChangePin
512(
513 sim_client_handle_type h_sim,
514 QL_SIM_CHANGE_PIN_INFO_T *pt_info ///< [IN] Change PIN infor
515);
516
517
518/*===========================================================================
519
520 FUNCTION: QL_MCM_SIM_UnblockPIN
521
522===========================================================================*/
523/*
524 @brief
525 Function sends a command to the modem to unblock a PIN1 or PIN2 that
526 has been blocked
527
528 @return
529 E_QL_ERROR_CODE_T
530*/
531/*=========================================================================*/
532E_QL_ERROR_CODE_T QL_MCM_SIM_UnblockPIN
533(
534 sim_client_handle_type h_sim,
535 QL_SIM_UNBLOCK_PIN_INFO_T *pt_info ///< [IN] Unblock PIN infor
536);
537
538/*===========================================================================
539
540 FUNCTION: QL_MCM_SIM_EnablePIN
541
542===========================================================================*/
543/*
544 @brief
545 Function sends a command to the modem to enable PIN1 or PIN2
546
547 @return
548 E_QL_ERROR_CODE_T
549*/
550/*=========================================================================*/
551E_QL_ERROR_CODE_T QL_MCM_SIM_EnablePIN
552(
553 sim_client_handle_type h_sim,
554 QL_SIM_ENABLE_PIN_INFO_T *pt_info ///< [IN] Enable PIN infor
555);
556
557/*===========================================================================
558
559 FUNCTION: QL_MCM_SIM_DisablePIN
560
561===========================================================================*/
562/*
563 @brief
564 Function sends a command to the modem to disable PIN1 or PIN2
565
566 @return
567 E_QL_ERROR_CODE_T
568*/
569/*=========================================================================*/
570E_QL_ERROR_CODE_T QL_MCM_SIM_DisablePIN
571(
572 sim_client_handle_type h_sim,
573 QL_SIM_DISABLE_PIN_INFO_T *pt_info ///< [IN] Disable PIN infor
574);
575
576
577/*===========================================================================
578
579 FUNCTION: QL_MCM_SIM_GetCardStatus
580
581===========================================================================*/
582/*
583 @brief
584 Function retrieves the server cached card status informations and
585 sends the information to the client
586
587 @return
588 E_QL_ERROR_CODE_T
589*/
590/*=========================================================================*/
591E_QL_ERROR_CODE_T QL_MCM_SIM_GetCardStatus
592(
593 sim_client_handle_type h_sim,
594 E_QL_MCM_SIM_SLOT_ID_TYPE_T simId, ///< [IN] The SIM identifier.
595 QL_MCM_SIM_CARD_STATUS_INFO_T *pt_info ///< [OUT] Cart status infor output
596);
597
598/*===========================================================================
599
600 FUNCTION: QL_MCM_SIM_Depersonalization
601
602===========================================================================*/
603/*
604 @brief
605 Function sends a command to the modem to disable or unblock SIM Lock
606
607 @return
608 E_QL_ERROR_CODE_T
609*/
610/*=========================================================================*/
611E_QL_ERROR_CODE_T QL_MCM_SIM_Depersonalization
612(
613 sim_client_handle_type h_sim,
614 QL_MCM_SIM_DEPERSONALIZE_INFO_T *pt_info ///< [OUT] Depersonalize information
615);
616
617
618/*===========================================================================
619
620 FUNCTION: QL_MCM_SIM_Personalization
621
622===========================================================================*/
623/*
624 @brief
625 Function sends a command to the modem to set the SIM Lock data
626 and concurrently enable SIM Lock.
627
628 @return
629 E_QL_ERROR_CODE_T
630*/
631/*=========================================================================*/
632E_QL_ERROR_CODE_T QL_MCM_SIM_Personalization
633(
634 sim_client_handle_type h_sim,
635 QL_MCM_SIM_PERSONALIZE_FEATURE_INFO_T *pt_info ///< [OUT] Unblock PIN infor
636);
637
638
639/*===========================================================================
640
641 FUNCTION: QL_MCM_SIM_WriteFile
642
643===========================================================================*/
644/*
645 @brief
646 Function will determine whether the request is for transparent or
647 record based write command based on the record number and calls the
648 corresponding function to send the message to the card.
649
650 record number = 0 - transparent
651 record number > 0 - record based
652
653 @return
654 E_QL_ERROR_CODE_T
655*/
656/*=========================================================================*/
657E_QL_ERROR_CODE_T QL_MCM_SIM_WriteFile
658(
659 sim_client_handle_type h_sim,
660 QL_MCM_SIM_CARD_WRITE_FILE_INFO_T *pt_info ///< [OUT] Verify PIN infor
661);
662
663
664/*===========================================================================
665
666 FUNCTION: QL_MCM_SIM_ReadFile
667
668===========================================================================*/
669/*
670 @brief
671 Function will determine whether the request is for transparent or
672 record based read command based on the record number and calls the
673 corresponding function to send the message to the card.
674
675 record number = 0 - transparent
676 record number > 0 - record based
677
678 @return
679 E_QL_ERROR_CODE_T
680*/
681/*=========================================================================*/
682E_QL_ERROR_CODE_T QL_MCM_SIM_ReadFile
683(
684 sim_client_handle_type h_sim,
685 QL_MCM_SIM_CARD_FILE_INFO_TO_READ_T *pt_info, ///< [IN] input file info which to be read
686 QL_MCM_SIM_CARD_FILE_DATA_T *pt_out ///< [OUT] File data of the specified one by pt_info
687);
688
689/*===========================================================================
690
691 FUNCTION: QL_MCM_SIM_GetFileSize
692
693===========================================================================*/
694/*
695 @brief
696 Function sends a command to the modem to retrieve the file type, file
697 size(transparent files) or record size and record count (record based files)
698
699 @return
700 E_QL_ERROR_CODE_T
701*/
702/*=========================================================================*/
703E_QL_ERROR_CODE_T QL_MCM_SIM_GetFileSize
704(
705 sim_client_handle_type h_sim,
706 QL_MCM_SIM_CARD_GET_FILE_SIZE_INPUT_INFO_T *pt_info, ///< [IN] input file info which to be read
707 QL_MCM_SIM_FILE_SIZE_INFO_T *pt_out ///< [OUT] output file size info
708);
709
710
711
712#endif // __QL_MCM_SIM_H__
713