|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
|
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 interface MozIccInfo; |
|
6 |
|
7 [Pref="dom.icc.enabled"] |
|
8 interface MozIcc : EventTarget |
|
9 { |
|
10 // Integrated Circuit Card Information. |
|
11 |
|
12 /** |
|
13 * Information stored in the device's ICC. |
|
14 * |
|
15 * Once the ICC becomes undetectable, iccinfochange event will be notified. |
|
16 * Also, the attribute is set to null and this MozIcc object becomes invalid. |
|
17 * Calling asynchronous functions raises exception then. |
|
18 */ |
|
19 readonly attribute MozIccInfo? iccInfo; |
|
20 |
|
21 /** |
|
22 * The 'iccinfochange' event is notified whenever the icc info object |
|
23 * changes. |
|
24 */ |
|
25 attribute EventHandler oniccinfochange; |
|
26 |
|
27 // Integrated Circuit Card State. |
|
28 |
|
29 /** |
|
30 * Indicates the state of the device's ICC. |
|
31 * |
|
32 * Possible values: 'illegal', 'unknown', 'pinRequired', 'pukRequired', |
|
33 * 'personalizationInProgress', 'networkLocked', 'network1Locked', |
|
34 * 'network2Locked', 'hrpdNetworkLocked', 'corporateLocked', |
|
35 * 'serviceProviderLocked', 'ruimCorporateLocked', 'ruimServiceProviderLocked', |
|
36 * 'networkPukRequired', 'network1PukRequired', 'network2PukRequired', |
|
37 * 'hrpdNetworkPukRequired', 'corporatePukRequired', |
|
38 * 'serviceProviderPukRequired', 'ruimCorporatePukRequired', |
|
39 * 'ruimServiceProviderPukRequired', 'personalizationReady', 'ready', |
|
40 * 'permanentBlocked'. |
|
41 * |
|
42 * Once the ICC becomes undetectable, cardstatechange event will be notified. |
|
43 * Also, the attribute is set to null and this MozIcc object becomes invalid. |
|
44 * Calling asynchronous functions raises exception then. |
|
45 */ |
|
46 readonly attribute DOMString? cardState; |
|
47 |
|
48 /** |
|
49 * The 'cardstatechange' event is notified when the 'cardState' attribute |
|
50 * changes value. |
|
51 */ |
|
52 attribute EventHandler oncardstatechange; |
|
53 |
|
54 // Integrated Circuit Card STK. |
|
55 |
|
56 /** |
|
57 * Send the response back to ICC after an attempt to execute STK proactive |
|
58 * Command. |
|
59 * |
|
60 * @param command |
|
61 * Command received from ICC. See MozStkCommand. |
|
62 * @param response |
|
63 * The response that will be sent to ICC. |
|
64 * @see MozStkResponse for the detail of response. |
|
65 */ |
|
66 [Throws] |
|
67 void sendStkResponse(any command, any response); |
|
68 |
|
69 /** |
|
70 * Send the "Menu Selection" envelope command to ICC for menu selection. |
|
71 * |
|
72 * @param itemIdentifier |
|
73 * The identifier of the item selected by user. |
|
74 * @param helpRequested |
|
75 * true if user requests to provide help information, false otherwise. |
|
76 */ |
|
77 [Throws] |
|
78 void sendStkMenuSelection(unsigned short itemIdentifier, |
|
79 boolean helpRequested); |
|
80 |
|
81 /** |
|
82 * Send the "Timer Expiration" envelope command to ICC for TIMER MANAGEMENT. |
|
83 * |
|
84 * @param timer |
|
85 * The identifier and value for a timer. |
|
86 * timerId: Identifier of the timer that has expired. |
|
87 * timerValue: Different between the time when this command is issued |
|
88 * and when the timer was initially started. |
|
89 * @see MozStkTimer |
|
90 */ |
|
91 [Throws] |
|
92 void sendStkTimerExpiration(any timer); |
|
93 |
|
94 /** |
|
95 * Send "Event Download" envelope command to ICC. |
|
96 * ICC will not respond with any data for this command. |
|
97 * |
|
98 * @param event |
|
99 * one of events below: |
|
100 * - MozStkLocationEvent |
|
101 * - MozStkCallEvent |
|
102 * - MozStkLanguageSelectionEvent |
|
103 * - MozStkGeneralEvent |
|
104 * - MozStkBrowserTerminationEvent |
|
105 */ |
|
106 [Throws] |
|
107 void sendStkEventDownload(any event); |
|
108 |
|
109 /** |
|
110 * The 'stkcommand' event is notified whenever STK proactive command is |
|
111 * issued from ICC. |
|
112 */ |
|
113 attribute EventHandler onstkcommand; |
|
114 |
|
115 /** |
|
116 * 'stksessionend' event is notified whenever STK session is terminated by |
|
117 * ICC. |
|
118 */ |
|
119 attribute EventHandler onstksessionend; |
|
120 |
|
121 // Integrated Circuit Card Lock interfaces. |
|
122 |
|
123 /** |
|
124 * Find out about the status of an ICC lock (e.g. the PIN lock). |
|
125 * |
|
126 * @param lockType |
|
127 * Identifies the lock type, e.g. "pin" for the PIN lock, "fdn" for |
|
128 * the FDN lock. |
|
129 * |
|
130 * @return a DOMRequest. |
|
131 * The request's result will be an object containing |
|
132 * information about the specified lock's status, |
|
133 * e.g. {lockType: "pin", enabled: true}. |
|
134 */ |
|
135 [Throws] |
|
136 nsISupports getCardLock(DOMString lockType); |
|
137 |
|
138 /** |
|
139 * Unlock a card lock. |
|
140 * |
|
141 * @param info |
|
142 * An object containing the information necessary to unlock |
|
143 * the given lock. At a minimum, this object must have a |
|
144 * "lockType" attribute which specifies the type of lock, e.g. |
|
145 * "pin" for the PIN lock. Other attributes are dependent on |
|
146 * the lock type. |
|
147 * |
|
148 * Examples: |
|
149 * |
|
150 * (1) Unlocking the PIN: |
|
151 * |
|
152 * unlockCardLock({lockType: "pin", |
|
153 * pin: "..."}); |
|
154 * |
|
155 * (2) Unlocking the PUK and supplying a new PIN: |
|
156 * |
|
157 * unlockCardLock({lockType: "puk", |
|
158 * puk: "...", |
|
159 * newPin: "..."}); |
|
160 * |
|
161 * (3) Network depersonalization. Unlocking the network control key (NCK). |
|
162 * |
|
163 * unlockCardLock({lockType: "nck", |
|
164 * pin: "..."}); |
|
165 * |
|
166 * (4) Network type 1 depersonalization. Unlocking the network type 1 control |
|
167 * key (NCK1). |
|
168 * |
|
169 * unlockCardLock({lockType: "nck1", |
|
170 * pin: "..."}); |
|
171 * |
|
172 * (5) Network type 2 depersonalization. Unlocking the network type 2 control |
|
173 * key (NCK2). |
|
174 * |
|
175 * unlockCardLock({lockType: "nck2", |
|
176 * pin: "..."}); |
|
177 * |
|
178 * (6) HRPD network depersonalization. Unlocking the HRPD network control key |
|
179 * (HNCK). |
|
180 * |
|
181 * unlockCardLock({lockType: "hnck", |
|
182 * pin: "..."}); |
|
183 * |
|
184 * (7) Corporate depersonalization. Unlocking the corporate control key (CCK). |
|
185 * |
|
186 * unlockCardLock({lockType: "cck", |
|
187 * pin: "..."}); |
|
188 * |
|
189 * (8) Service provider depersonalization. Unlocking the service provider |
|
190 * control key (SPCK). |
|
191 * |
|
192 * unlockCardLock({lockType: "spck", |
|
193 * pin: "..."}); |
|
194 * |
|
195 * (9) RUIM corporate depersonalization. Unlocking the RUIM corporate control |
|
196 * key (RCCK). |
|
197 * |
|
198 * unlockCardLock({lockType: "rcck", |
|
199 * pin: "..."}); |
|
200 * |
|
201 * (10) RUIM service provider depersonalization. Unlocking the RUIM service |
|
202 * provider control key (RSPCK). |
|
203 * |
|
204 * unlockCardLock({lockType: "rspck", |
|
205 * pin: "..."}); |
|
206 * |
|
207 * (11) Network PUK depersonalization. Unlocking the network control key (NCK). |
|
208 * |
|
209 * unlockCardLock({lockType: "nckPuk", |
|
210 * puk: "..."}); |
|
211 * |
|
212 * (12) Network type 1 PUK depersonalization. Unlocking the network type 1 |
|
213 * control key (NCK1). |
|
214 * |
|
215 * unlockCardLock({lockType: "nck1Puk", |
|
216 * pin: "..."}); |
|
217 * |
|
218 * (13) Network type 2 PUK depersonalization. Unlocking the Network type 2 |
|
219 * control key (NCK2). |
|
220 * |
|
221 * unlockCardLock({lockType: "nck2Puk", |
|
222 * pin: "..."}); |
|
223 * |
|
224 * (14) HRPD network PUK depersonalization. Unlocking the HRPD network control |
|
225 * key (HNCK). |
|
226 * |
|
227 * unlockCardLock({lockType: "hnckPuk", |
|
228 * pin: "..."}); |
|
229 * |
|
230 * (15) Corporate PUK depersonalization. Unlocking the corporate control key |
|
231 * (CCK). |
|
232 * |
|
233 * unlockCardLock({lockType: "cckPuk", |
|
234 * puk: "..."}); |
|
235 * |
|
236 * (16) Service provider PUK depersonalization. Unlocking the service provider |
|
237 * control key (SPCK). |
|
238 * |
|
239 * unlockCardLock({lockType: "spckPuk", |
|
240 * puk: "..."}); |
|
241 * |
|
242 * (17) RUIM corporate PUK depersonalization. Unlocking the RUIM corporate |
|
243 * control key (RCCK). |
|
244 * |
|
245 * unlockCardLock({lockType: "rcckPuk", |
|
246 * puk: "..."}); |
|
247 * |
|
248 * (18) RUIM service provider PUK depersonalization. Unlocking the service |
|
249 * provider control key (SPCK). |
|
250 * |
|
251 * unlockCardLock({lockType: "rspckPuk", |
|
252 * puk: "..."}); |
|
253 * |
|
254 * @return a DOMRequest. |
|
255 * The request's result will be an object containing |
|
256 * information about the unlock operation. |
|
257 * |
|
258 * Examples: |
|
259 * |
|
260 * (1) Unlocking failed: |
|
261 * |
|
262 * { |
|
263 * lockType: "pin", |
|
264 * success: false, |
|
265 * retryCount: 2 |
|
266 * } |
|
267 * |
|
268 * (2) Unlocking succeeded: |
|
269 * |
|
270 * { |
|
271 * lockType: "pin", |
|
272 * success: true |
|
273 * } |
|
274 */ |
|
275 [Throws] |
|
276 nsISupports unlockCardLock(any info); |
|
277 |
|
278 /** |
|
279 * Modify the state of a card lock. |
|
280 * |
|
281 * @param info |
|
282 * An object containing information about the lock and |
|
283 * how to modify its state. At a minimum, this object |
|
284 * must have a "lockType" attribute which specifies the |
|
285 * type of lock, e.g. "pin" for the PIN lock. Other |
|
286 * attributes are dependent on the lock type. |
|
287 * |
|
288 * Examples: |
|
289 * |
|
290 * (1a) Disabling the PIN lock: |
|
291 * |
|
292 * setCardLock({lockType: "pin", |
|
293 * pin: "...", |
|
294 * enabled: false}); |
|
295 * |
|
296 * (1b) Disabling the FDN lock: |
|
297 * |
|
298 * setCardLock({lockType: "fdn", |
|
299 * pin2: "...", |
|
300 * enabled: false}); |
|
301 * |
|
302 * (2) Changing the PIN: |
|
303 * |
|
304 * setCardLock({lockType: "pin", |
|
305 * pin: "...", |
|
306 * newPin: "..."}); |
|
307 * |
|
308 * @return a DOMRequest. |
|
309 * The request's result will be an object containing |
|
310 * information about the operation. |
|
311 * |
|
312 * Examples: |
|
313 * |
|
314 * (1) Enabling/Disabling card lock failed or change card lock failed. |
|
315 * |
|
316 * { |
|
317 * lockType: "pin", |
|
318 * success: false, |
|
319 * retryCount: 2 |
|
320 * } |
|
321 * |
|
322 * (2) Enabling/Disabling card lock succeed or change card lock succeed. |
|
323 * |
|
324 * { |
|
325 * lockType: "pin", |
|
326 * success: true |
|
327 * } |
|
328 */ |
|
329 [Throws] |
|
330 nsISupports setCardLock(any info); |
|
331 |
|
332 /** |
|
333 * Retrieve the number of remaining tries for unlocking the card. |
|
334 * |
|
335 * @param lockType |
|
336 * Identifies the lock type, e.g. "pin" for the PIN lock, "puk" for |
|
337 * the PUK lock. |
|
338 * |
|
339 * @return a DOMRequest. |
|
340 * If the lock type is "pin", or "puk", the request's result will be |
|
341 * an object containing the number of retries for the specified |
|
342 * lock. For any other lock type, the result is undefined. |
|
343 */ |
|
344 [Throws] |
|
345 nsISupports getCardLockRetryCount(DOMString lockType); |
|
346 |
|
347 // Integrated Circuit Card Phonebook Interfaces. |
|
348 |
|
349 /** |
|
350 * Read ICC contacts. |
|
351 * |
|
352 * @param contactType |
|
353 * One of type as below, |
|
354 * - 'adn': Abbreviated Dialling Number. |
|
355 * - 'fdn': Fixed Dialling Number. |
|
356 * |
|
357 * @return a DOMRequest. |
|
358 */ |
|
359 [Throws] |
|
360 nsISupports readContacts(DOMString contactType); |
|
361 |
|
362 /** |
|
363 * Update ICC Phonebook contact. |
|
364 * |
|
365 * @param contactType |
|
366 * One of type as below, |
|
367 * - 'adn': Abbreviated Dialling Number. |
|
368 * - 'fdn': Fixed Dialling Number. |
|
369 * @param contact |
|
370 * The contact will be updated in ICC. |
|
371 * @param [optional] pin2 |
|
372 * PIN2 is only required for 'fdn'. |
|
373 * |
|
374 * @return a DOMRequest. |
|
375 */ |
|
376 [Throws] |
|
377 nsISupports updateContact(DOMString contactType, |
|
378 any contact, |
|
379 optional DOMString? pin2 = null); |
|
380 |
|
381 // Integrated Circuit Card Secure Element Interfaces. |
|
382 |
|
383 /** |
|
384 * A secure element is a smart card chip that can hold |
|
385 * several different applications with the necessary security. |
|
386 * The most known secure element is the Universal Integrated Circuit Card |
|
387 * (UICC). |
|
388 */ |
|
389 |
|
390 /** |
|
391 * Send request to open a logical channel defined by its |
|
392 * application identifier (AID). |
|
393 * |
|
394 * @param aid |
|
395 * The application identifier of the applet to be selected on this |
|
396 * channel. |
|
397 * |
|
398 * @return a DOMRequest. |
|
399 * The request's result will be an instance of channel (channelID) |
|
400 * if available or null. |
|
401 */ |
|
402 [Throws] |
|
403 nsISupports iccOpenChannel(DOMString aid); |
|
404 |
|
405 /** |
|
406 * Interface, used to communicate with an applet through the |
|
407 * application data protocol units (APDUs) and is |
|
408 * used for all data that is exchanged between the UICC and the terminal (ME). |
|
409 * |
|
410 * @param channel |
|
411 * The application identifier of the applet to which APDU is directed. |
|
412 * @param apdu |
|
413 * Application protocol data unit. |
|
414 * |
|
415 * @return a DOMRequest. |
|
416 * The request's result will be response APDU. |
|
417 */ |
|
418 [Throws] |
|
419 nsISupports iccExchangeAPDU(long channel, any apdu); |
|
420 |
|
421 /** |
|
422 * Send request to close the selected logical channel identified by its |
|
423 * application identifier (AID). |
|
424 * |
|
425 * @param aid |
|
426 * The application identifier of the applet, to be closed. |
|
427 * |
|
428 * @return a DOMRequest. |
|
429 */ |
|
430 [Throws] |
|
431 nsISupports iccCloseChannel(long channel); |
|
432 |
|
433 // Integrated Circuit Card Helpers. |
|
434 |
|
435 /** |
|
436 * Verify whether the passed data (matchData) matches with some ICC's field |
|
437 * according to the mvno type (mvnoType). |
|
438 * |
|
439 * @param mvnoType |
|
440 * Mvno type to use to compare the match data. |
|
441 * Currently, we only support 'imsi'. |
|
442 * @param matchData |
|
443 * Data to be compared with ICC's field. |
|
444 * |
|
445 * @return a DOMRequest. |
|
446 * The request's result will be a boolean indicating the matching |
|
447 * result. |
|
448 * |
|
449 * TODO: change param mvnoType to WebIDL enum after Bug 864489 - |
|
450 * B2G RIL: use ipdl as IPC in MozIccManager |
|
451 */ |
|
452 [Throws] |
|
453 nsISupports matchMvno(DOMString mvnoType, DOMString matchData); |
|
454 }; |