michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: interface MozIccInfo; michael@0: michael@0: [Pref="dom.icc.enabled"] michael@0: interface MozIcc : EventTarget michael@0: { michael@0: // Integrated Circuit Card Information. michael@0: michael@0: /** michael@0: * Information stored in the device's ICC. michael@0: * michael@0: * Once the ICC becomes undetectable, iccinfochange event will be notified. michael@0: * Also, the attribute is set to null and this MozIcc object becomes invalid. michael@0: * Calling asynchronous functions raises exception then. michael@0: */ michael@0: readonly attribute MozIccInfo? iccInfo; michael@0: michael@0: /** michael@0: * The 'iccinfochange' event is notified whenever the icc info object michael@0: * changes. michael@0: */ michael@0: attribute EventHandler oniccinfochange; michael@0: michael@0: // Integrated Circuit Card State. michael@0: michael@0: /** michael@0: * Indicates the state of the device's ICC. michael@0: * michael@0: * Possible values: 'illegal', 'unknown', 'pinRequired', 'pukRequired', michael@0: * 'personalizationInProgress', 'networkLocked', 'network1Locked', michael@0: * 'network2Locked', 'hrpdNetworkLocked', 'corporateLocked', michael@0: * 'serviceProviderLocked', 'ruimCorporateLocked', 'ruimServiceProviderLocked', michael@0: * 'networkPukRequired', 'network1PukRequired', 'network2PukRequired', michael@0: * 'hrpdNetworkPukRequired', 'corporatePukRequired', michael@0: * 'serviceProviderPukRequired', 'ruimCorporatePukRequired', michael@0: * 'ruimServiceProviderPukRequired', 'personalizationReady', 'ready', michael@0: * 'permanentBlocked'. michael@0: * michael@0: * Once the ICC becomes undetectable, cardstatechange event will be notified. michael@0: * Also, the attribute is set to null and this MozIcc object becomes invalid. michael@0: * Calling asynchronous functions raises exception then. michael@0: */ michael@0: readonly attribute DOMString? cardState; michael@0: michael@0: /** michael@0: * The 'cardstatechange' event is notified when the 'cardState' attribute michael@0: * changes value. michael@0: */ michael@0: attribute EventHandler oncardstatechange; michael@0: michael@0: // Integrated Circuit Card STK. michael@0: michael@0: /** michael@0: * Send the response back to ICC after an attempt to execute STK proactive michael@0: * Command. michael@0: * michael@0: * @param command michael@0: * Command received from ICC. See MozStkCommand. michael@0: * @param response michael@0: * The response that will be sent to ICC. michael@0: * @see MozStkResponse for the detail of response. michael@0: */ michael@0: [Throws] michael@0: void sendStkResponse(any command, any response); michael@0: michael@0: /** michael@0: * Send the "Menu Selection" envelope command to ICC for menu selection. michael@0: * michael@0: * @param itemIdentifier michael@0: * The identifier of the item selected by user. michael@0: * @param helpRequested michael@0: * true if user requests to provide help information, false otherwise. michael@0: */ michael@0: [Throws] michael@0: void sendStkMenuSelection(unsigned short itemIdentifier, michael@0: boolean helpRequested); michael@0: michael@0: /** michael@0: * Send the "Timer Expiration" envelope command to ICC for TIMER MANAGEMENT. michael@0: * michael@0: * @param timer michael@0: * The identifier and value for a timer. michael@0: * timerId: Identifier of the timer that has expired. michael@0: * timerValue: Different between the time when this command is issued michael@0: * and when the timer was initially started. michael@0: * @see MozStkTimer michael@0: */ michael@0: [Throws] michael@0: void sendStkTimerExpiration(any timer); michael@0: michael@0: /** michael@0: * Send "Event Download" envelope command to ICC. michael@0: * ICC will not respond with any data for this command. michael@0: * michael@0: * @param event michael@0: * one of events below: michael@0: * - MozStkLocationEvent michael@0: * - MozStkCallEvent michael@0: * - MozStkLanguageSelectionEvent michael@0: * - MozStkGeneralEvent michael@0: * - MozStkBrowserTerminationEvent michael@0: */ michael@0: [Throws] michael@0: void sendStkEventDownload(any event); michael@0: michael@0: /** michael@0: * The 'stkcommand' event is notified whenever STK proactive command is michael@0: * issued from ICC. michael@0: */ michael@0: attribute EventHandler onstkcommand; michael@0: michael@0: /** michael@0: * 'stksessionend' event is notified whenever STK session is terminated by michael@0: * ICC. michael@0: */ michael@0: attribute EventHandler onstksessionend; michael@0: michael@0: // Integrated Circuit Card Lock interfaces. michael@0: michael@0: /** michael@0: * Find out about the status of an ICC lock (e.g. the PIN lock). michael@0: * michael@0: * @param lockType michael@0: * Identifies the lock type, e.g. "pin" for the PIN lock, "fdn" for michael@0: * the FDN lock. michael@0: * michael@0: * @return a DOMRequest. michael@0: * The request's result will be an object containing michael@0: * information about the specified lock's status, michael@0: * e.g. {lockType: "pin", enabled: true}. michael@0: */ michael@0: [Throws] michael@0: nsISupports getCardLock(DOMString lockType); michael@0: michael@0: /** michael@0: * Unlock a card lock. michael@0: * michael@0: * @param info michael@0: * An object containing the information necessary to unlock michael@0: * the given lock. At a minimum, this object must have a michael@0: * "lockType" attribute which specifies the type of lock, e.g. michael@0: * "pin" for the PIN lock. Other attributes are dependent on michael@0: * the lock type. michael@0: * michael@0: * Examples: michael@0: * michael@0: * (1) Unlocking the PIN: michael@0: * michael@0: * unlockCardLock({lockType: "pin", michael@0: * pin: "..."}); michael@0: * michael@0: * (2) Unlocking the PUK and supplying a new PIN: michael@0: * michael@0: * unlockCardLock({lockType: "puk", michael@0: * puk: "...", michael@0: * newPin: "..."}); michael@0: * michael@0: * (3) Network depersonalization. Unlocking the network control key (NCK). michael@0: * michael@0: * unlockCardLock({lockType: "nck", michael@0: * pin: "..."}); michael@0: * michael@0: * (4) Network type 1 depersonalization. Unlocking the network type 1 control michael@0: * key (NCK1). michael@0: * michael@0: * unlockCardLock({lockType: "nck1", michael@0: * pin: "..."}); michael@0: * michael@0: * (5) Network type 2 depersonalization. Unlocking the network type 2 control michael@0: * key (NCK2). michael@0: * michael@0: * unlockCardLock({lockType: "nck2", michael@0: * pin: "..."}); michael@0: * michael@0: * (6) HRPD network depersonalization. Unlocking the HRPD network control key michael@0: * (HNCK). michael@0: * michael@0: * unlockCardLock({lockType: "hnck", michael@0: * pin: "..."}); michael@0: * michael@0: * (7) Corporate depersonalization. Unlocking the corporate control key (CCK). michael@0: * michael@0: * unlockCardLock({lockType: "cck", michael@0: * pin: "..."}); michael@0: * michael@0: * (8) Service provider depersonalization. Unlocking the service provider michael@0: * control key (SPCK). michael@0: * michael@0: * unlockCardLock({lockType: "spck", michael@0: * pin: "..."}); michael@0: * michael@0: * (9) RUIM corporate depersonalization. Unlocking the RUIM corporate control michael@0: * key (RCCK). michael@0: * michael@0: * unlockCardLock({lockType: "rcck", michael@0: * pin: "..."}); michael@0: * michael@0: * (10) RUIM service provider depersonalization. Unlocking the RUIM service michael@0: * provider control key (RSPCK). michael@0: * michael@0: * unlockCardLock({lockType: "rspck", michael@0: * pin: "..."}); michael@0: * michael@0: * (11) Network PUK depersonalization. Unlocking the network control key (NCK). michael@0: * michael@0: * unlockCardLock({lockType: "nckPuk", michael@0: * puk: "..."}); michael@0: * michael@0: * (12) Network type 1 PUK depersonalization. Unlocking the network type 1 michael@0: * control key (NCK1). michael@0: * michael@0: * unlockCardLock({lockType: "nck1Puk", michael@0: * pin: "..."}); michael@0: * michael@0: * (13) Network type 2 PUK depersonalization. Unlocking the Network type 2 michael@0: * control key (NCK2). michael@0: * michael@0: * unlockCardLock({lockType: "nck2Puk", michael@0: * pin: "..."}); michael@0: * michael@0: * (14) HRPD network PUK depersonalization. Unlocking the HRPD network control michael@0: * key (HNCK). michael@0: * michael@0: * unlockCardLock({lockType: "hnckPuk", michael@0: * pin: "..."}); michael@0: * michael@0: * (15) Corporate PUK depersonalization. Unlocking the corporate control key michael@0: * (CCK). michael@0: * michael@0: * unlockCardLock({lockType: "cckPuk", michael@0: * puk: "..."}); michael@0: * michael@0: * (16) Service provider PUK depersonalization. Unlocking the service provider michael@0: * control key (SPCK). michael@0: * michael@0: * unlockCardLock({lockType: "spckPuk", michael@0: * puk: "..."}); michael@0: * michael@0: * (17) RUIM corporate PUK depersonalization. Unlocking the RUIM corporate michael@0: * control key (RCCK). michael@0: * michael@0: * unlockCardLock({lockType: "rcckPuk", michael@0: * puk: "..."}); michael@0: * michael@0: * (18) RUIM service provider PUK depersonalization. Unlocking the service michael@0: * provider control key (SPCK). michael@0: * michael@0: * unlockCardLock({lockType: "rspckPuk", michael@0: * puk: "..."}); michael@0: * michael@0: * @return a DOMRequest. michael@0: * The request's result will be an object containing michael@0: * information about the unlock operation. michael@0: * michael@0: * Examples: michael@0: * michael@0: * (1) Unlocking failed: michael@0: * michael@0: * { michael@0: * lockType: "pin", michael@0: * success: false, michael@0: * retryCount: 2 michael@0: * } michael@0: * michael@0: * (2) Unlocking succeeded: michael@0: * michael@0: * { michael@0: * lockType: "pin", michael@0: * success: true michael@0: * } michael@0: */ michael@0: [Throws] michael@0: nsISupports unlockCardLock(any info); michael@0: michael@0: /** michael@0: * Modify the state of a card lock. michael@0: * michael@0: * @param info michael@0: * An object containing information about the lock and michael@0: * how to modify its state. At a minimum, this object michael@0: * must have a "lockType" attribute which specifies the michael@0: * type of lock, e.g. "pin" for the PIN lock. Other michael@0: * attributes are dependent on the lock type. michael@0: * michael@0: * Examples: michael@0: * michael@0: * (1a) Disabling the PIN lock: michael@0: * michael@0: * setCardLock({lockType: "pin", michael@0: * pin: "...", michael@0: * enabled: false}); michael@0: * michael@0: * (1b) Disabling the FDN lock: michael@0: * michael@0: * setCardLock({lockType: "fdn", michael@0: * pin2: "...", michael@0: * enabled: false}); michael@0: * michael@0: * (2) Changing the PIN: michael@0: * michael@0: * setCardLock({lockType: "pin", michael@0: * pin: "...", michael@0: * newPin: "..."}); michael@0: * michael@0: * @return a DOMRequest. michael@0: * The request's result will be an object containing michael@0: * information about the operation. michael@0: * michael@0: * Examples: michael@0: * michael@0: * (1) Enabling/Disabling card lock failed or change card lock failed. michael@0: * michael@0: * { michael@0: * lockType: "pin", michael@0: * success: false, michael@0: * retryCount: 2 michael@0: * } michael@0: * michael@0: * (2) Enabling/Disabling card lock succeed or change card lock succeed. michael@0: * michael@0: * { michael@0: * lockType: "pin", michael@0: * success: true michael@0: * } michael@0: */ michael@0: [Throws] michael@0: nsISupports setCardLock(any info); michael@0: michael@0: /** michael@0: * Retrieve the number of remaining tries for unlocking the card. michael@0: * michael@0: * @param lockType michael@0: * Identifies the lock type, e.g. "pin" for the PIN lock, "puk" for michael@0: * the PUK lock. michael@0: * michael@0: * @return a DOMRequest. michael@0: * If the lock type is "pin", or "puk", the request's result will be michael@0: * an object containing the number of retries for the specified michael@0: * lock. For any other lock type, the result is undefined. michael@0: */ michael@0: [Throws] michael@0: nsISupports getCardLockRetryCount(DOMString lockType); michael@0: michael@0: // Integrated Circuit Card Phonebook Interfaces. michael@0: michael@0: /** michael@0: * Read ICC contacts. michael@0: * michael@0: * @param contactType michael@0: * One of type as below, michael@0: * - 'adn': Abbreviated Dialling Number. michael@0: * - 'fdn': Fixed Dialling Number. michael@0: * michael@0: * @return a DOMRequest. michael@0: */ michael@0: [Throws] michael@0: nsISupports readContacts(DOMString contactType); michael@0: michael@0: /** michael@0: * Update ICC Phonebook contact. michael@0: * michael@0: * @param contactType michael@0: * One of type as below, michael@0: * - 'adn': Abbreviated Dialling Number. michael@0: * - 'fdn': Fixed Dialling Number. michael@0: * @param contact michael@0: * The contact will be updated in ICC. michael@0: * @param [optional] pin2 michael@0: * PIN2 is only required for 'fdn'. michael@0: * michael@0: * @return a DOMRequest. michael@0: */ michael@0: [Throws] michael@0: nsISupports updateContact(DOMString contactType, michael@0: any contact, michael@0: optional DOMString? pin2 = null); michael@0: michael@0: // Integrated Circuit Card Secure Element Interfaces. michael@0: michael@0: /** michael@0: * A secure element is a smart card chip that can hold michael@0: * several different applications with the necessary security. michael@0: * The most known secure element is the Universal Integrated Circuit Card michael@0: * (UICC). michael@0: */ michael@0: michael@0: /** michael@0: * Send request to open a logical channel defined by its michael@0: * application identifier (AID). michael@0: * michael@0: * @param aid michael@0: * The application identifier of the applet to be selected on this michael@0: * channel. michael@0: * michael@0: * @return a DOMRequest. michael@0: * The request's result will be an instance of channel (channelID) michael@0: * if available or null. michael@0: */ michael@0: [Throws] michael@0: nsISupports iccOpenChannel(DOMString aid); michael@0: michael@0: /** michael@0: * Interface, used to communicate with an applet through the michael@0: * application data protocol units (APDUs) and is michael@0: * used for all data that is exchanged between the UICC and the terminal (ME). michael@0: * michael@0: * @param channel michael@0: * The application identifier of the applet to which APDU is directed. michael@0: * @param apdu michael@0: * Application protocol data unit. michael@0: * michael@0: * @return a DOMRequest. michael@0: * The request's result will be response APDU. michael@0: */ michael@0: [Throws] michael@0: nsISupports iccExchangeAPDU(long channel, any apdu); michael@0: michael@0: /** michael@0: * Send request to close the selected logical channel identified by its michael@0: * application identifier (AID). michael@0: * michael@0: * @param aid michael@0: * The application identifier of the applet, to be closed. michael@0: * michael@0: * @return a DOMRequest. michael@0: */ michael@0: [Throws] michael@0: nsISupports iccCloseChannel(long channel); michael@0: michael@0: // Integrated Circuit Card Helpers. michael@0: michael@0: /** michael@0: * Verify whether the passed data (matchData) matches with some ICC's field michael@0: * according to the mvno type (mvnoType). michael@0: * michael@0: * @param mvnoType michael@0: * Mvno type to use to compare the match data. michael@0: * Currently, we only support 'imsi'. michael@0: * @param matchData michael@0: * Data to be compared with ICC's field. michael@0: * michael@0: * @return a DOMRequest. michael@0: * The request's result will be a boolean indicating the matching michael@0: * result. michael@0: * michael@0: * TODO: change param mvnoType to WebIDL enum after Bug 864489 - michael@0: * B2G RIL: use ipdl as IPC in MozIccManager michael@0: */ michael@0: [Throws] michael@0: nsISupports matchMvno(DOMString mvnoType, DOMString matchData); michael@0: };