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