diff --git a/dom/icc/interfaces/nsIIccProvider.idl b/dom/icc/interfaces/nsIIccProvider.idl index cbbb7c56a9b..6484b9e550b 100644 --- a/dom/icc/interfaces/nsIIccProvider.idl +++ b/dom/icc/interfaces/nsIIccProvider.idl @@ -20,7 +20,7 @@ interface nsIIccListener : nsISupports /** * XPCOM component (in the content process) that provides the ICC information. */ -[scriptable, uuid(bf802bf0-4df2-11e4-916c-0800200c9a66)] +[scriptable, uuid(38bbc600-76ac-11e4-82f8-0800200c9a66)] interface nsIIccProvider : nsISupports { // MUST match enum IccCardState in MozIcc.webidl! @@ -57,6 +57,29 @@ interface nsIIccProvider : nsISupports const unsigned long CARD_STATE_UNDETECTED = 4294967295; // UINT32_MAX + // MUST match with enum IccLockType in MozIcc.webidl + const unsigned long CARD_LOCK_TYPE_PIN = 0; + const unsigned long CARD_LOCK_TYPE_PIN2 = 1; + const unsigned long CARD_LOCK_TYPE_PUK = 2; + const unsigned long CARD_LOCK_TYPE_PUK2 = 3; + const unsigned long CARD_LOCK_TYPE_NCK = 4; + const unsigned long CARD_LOCK_TYPE_NCK1 = 5; + const unsigned long CARD_LOCK_TYPE_NCK2 = 6; + const unsigned long CARD_LOCK_TYPE_HNCK = 7; + const unsigned long CARD_LOCK_TYPE_CCK = 8; + const unsigned long CARD_LOCK_TYPE_SPCK = 9; + const unsigned long CARD_LOCK_TYPE_RCCK = 10; + const unsigned long CARD_LOCK_TYPE_RSPCK = 11; + const unsigned long CARD_LOCK_TYPE_NCK_PUK = 12; + const unsigned long CARD_LOCK_TYPE_NCK1_PUK = 13; + const unsigned long CARD_LOCK_TYPE_NCK2_PUK = 14; + const unsigned long CARD_LOCK_TYPE_HNCK_PUK = 15; + const unsigned long CARD_LOCK_TYPE_CCK_PUK = 16; + const unsigned long CARD_LOCK_TYPE_SPCK_PUK = 17; + const unsigned long CARD_LOCK_TYPE_RCCK_PUK = 18; + const unsigned long CARD_LOCK_TYPE_RSPCK_PUK = 19; + const unsigned long CARD_LOCK_TYPE_FDN = 20; + /** * Called when a content process registers receiving unsolicited messages from * RadioInterfaceLayer in the chrome process. Only a content process that has @@ -98,18 +121,27 @@ interface nsIIccProvider : nsISupports /** * Card lock interfaces. */ - nsIDOMDOMRequest getCardLockState(in unsigned long clientId, - in nsIDOMWindow window, - in DOMString lockType); + nsIDOMDOMRequest getCardLockEnabled(in unsigned long clientId, + in nsIDOMWindow window, + in unsigned long lockType); nsIDOMDOMRequest unlockCardLock(in unsigned long clientId, in nsIDOMWindow window, - in jsval info); - nsIDOMDOMRequest setCardLock(in unsigned long clientId, - in nsIDOMWindow window, - in jsval info); + in unsigned long lockType, + in DOMString password, + [optional] in DOMString newPin); + nsIDOMDOMRequest setCardLockEnabled(in unsigned long clientId, + in nsIDOMWindow window, + in unsigned long lockType, + in DOMString password, + in boolean enabled); + nsIDOMDOMRequest changeCardLockPassword(in unsigned long clientId, + in nsIDOMWindow window, + in unsigned long lockType, + in DOMString password, + in DOMString newPassword); nsIDOMDOMRequest getCardLockRetryCount(in unsigned long clientId, in nsIDOMWindow window, - in DOMString lockType); + in unsigned long lockType); /** * Phonebook interfaces. diff --git a/dom/webidl/MozIcc.webidl b/dom/webidl/MozIcc.webidl index 5ee5958d7da..ac1517a8b95 100644 --- a/dom/webidl/MozIcc.webidl +++ b/dom/webidl/MozIcc.webidl @@ -2,7 +2,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -enum IccCardState { +enum IccCardState +{ "unknown", // ICC card state is either not yet reported from modem or in an // unknown state. "ready", @@ -49,6 +50,62 @@ enum IccCardState { // and fall in this state. }; +enum IccLockType +{ + "pin", + "pin2", + "puk", + "puk2", + "nck", // Network depersonalization -- network control key (NCK). + "nck1", // Network type 1 depersonalization -- network type 1 control key (NCK1). + "nck2", // Network type 2 depersonalization -- network type 2 control key (NCK2). + "hnck", // HRPD network depersonalization -- HRPD network control key (HNCK). + "cck", // Corporate depersonalization -- corporate control key (CCK). + "spck", // Service provider depersonalization -- service provider control key (SPCK). + "rcck", // RUIM corporate depersonalization -- RUIM corporate control key (RCCK). + "rspck", // RUIM service provider depersonalization -- RUIM service provider control key (RSPCK). + "nckPuk", // Network PUK depersonalization -- network control key (NCK). + "nck1Puk", // Network type 1 PUK depersonalization -- network type 1 control key (NCK1). + "nck2Puk", // Network type 2 PUK depersonalization -- Network type 2 control key (NCK2). + "hnckPuk", // HRPD network PUK depersonalization -- HRPD network control key (HNCK). + "cckPuk", // Corporate PUK depersonalization -- corporate control key (CCK). + "spckPuk", // Service provider PUK depersonalization -- service provider control key (SPCK). + "rcckPuk", // RUIM corporate PUK depersonalization -- RUIM corporate control key (RCCK). + "rspckPuk", // RUIM service provider PUK depersonalization -- service provider control key (SPCK). + "fdn" +}; + +dictionary IccUnlockCardLockOptions +{ + required IccLockType lockType; + + DOMString? pin = null; // Necessary for lock types: "pin", "pin2", "nck", + // "nck1", "nck2", "hnck", "cck", "spck", "rcck", + // "rspck". + + DOMString? puk = null; // Necessary for lock types: "puk", "puk2", "nckPuk", + // "nck1Puk", "nck2Puk", "hnckPuk", "cckPuk", + // "spckPuk", "rcckPuk", "rspckPuk". + + DOMString? newPin = null; // Necessary for lock types: "puk", "puk2". +}; + +dictionary IccSetCardLockOptions +{ + required IccLockType lockType; + + DOMString? pin = null; // Necessary for lock types: "pin", "pin2" + + DOMString? pin2 = null; // Used for enabling/disabling operation. + // Necessary for lock types: "fdn". + + DOMString? newPin = null; // Used for changing password operation. + // Necessary for lock types: "pin", "pin2" + + boolean enabled; // Used for enabling/disabling operation. + // Necessary for lock types: "pin", "fdn" +}; + [Pref="dom.icc.enabled"] interface MozIcc : EventTarget { @@ -159,8 +216,7 @@ interface MozIcc : EventTarget * Find out about the status of an ICC lock (e.g. the PIN lock). * * @param lockType - * Identifies the lock type, e.g. "pin" for the PIN lock, "fdn" for - * the FDN lock. + * Identifies the lock type. * * @return a DOMRequest. * The request's result will be an object containing @@ -168,123 +224,14 @@ interface MozIcc : EventTarget * e.g. {enabled: true}. */ [Throws] - DOMRequest getCardLock(DOMString lockType); + DOMRequest getCardLock(IccLockType lockType); /** * Unlock a card lock. * * @param info * An object containing the information necessary to unlock - * the given lock. At a minimum, this object must have a - * "lockType" attribute which specifies the type of lock, e.g. - * "pin" for the PIN lock. Other attributes are dependent on - * the lock type. - * - * Examples: - * - * (1) Unlocking the PIN: - * - * unlockCardLock({lockType: "pin", - * pin: "..."}); - * - * (2) Unlocking the PUK and supplying a new PIN: - * - * unlockCardLock({lockType: "puk", - * puk: "...", - * newPin: "..."}); - * - * (3) Network depersonalization. Unlocking the network control key (NCK). - * - * unlockCardLock({lockType: "nck", - * pin: "..."}); - * - * (4) Network type 1 depersonalization. Unlocking the network type 1 control - * key (NCK1). - * - * unlockCardLock({lockType: "nck1", - * pin: "..."}); - * - * (5) Network type 2 depersonalization. Unlocking the network type 2 control - * key (NCK2). - * - * unlockCardLock({lockType: "nck2", - * pin: "..."}); - * - * (6) HRPD network depersonalization. Unlocking the HRPD network control key - * (HNCK). - * - * unlockCardLock({lockType: "hnck", - * pin: "..."}); - * - * (7) Corporate depersonalization. Unlocking the corporate control key (CCK). - * - * unlockCardLock({lockType: "cck", - * pin: "..."}); - * - * (8) Service provider depersonalization. Unlocking the service provider - * control key (SPCK). - * - * unlockCardLock({lockType: "spck", - * pin: "..."}); - * - * (9) RUIM corporate depersonalization. Unlocking the RUIM corporate control - * key (RCCK). - * - * unlockCardLock({lockType: "rcck", - * pin: "..."}); - * - * (10) RUIM service provider depersonalization. Unlocking the RUIM service - * provider control key (RSPCK). - * - * unlockCardLock({lockType: "rspck", - * pin: "..."}); - * - * (11) Network PUK depersonalization. Unlocking the network control key (NCK). - * - * unlockCardLock({lockType: "nckPuk", - * puk: "..."}); - * - * (12) Network type 1 PUK depersonalization. Unlocking the network type 1 - * control key (NCK1). - * - * unlockCardLock({lockType: "nck1Puk", - * puk: "..."}); - * - * (13) Network type 2 PUK depersonalization. Unlocking the Network type 2 - * control key (NCK2). - * - * unlockCardLock({lockType: "nck2Puk", - * puk: "..."}); - * - * (14) HRPD network PUK depersonalization. Unlocking the HRPD network control - * key (HNCK). - * - * unlockCardLock({lockType: "hnckPuk", - * puk: "..."}); - * - * (15) Corporate PUK depersonalization. Unlocking the corporate control key - * (CCK). - * - * unlockCardLock({lockType: "cckPuk", - * puk: "..."}); - * - * (16) Service provider PUK depersonalization. Unlocking the service provider - * control key (SPCK). - * - * unlockCardLock({lockType: "spckPuk", - * puk: "..."}); - * - * (17) RUIM corporate PUK depersonalization. Unlocking the RUIM corporate - * control key (RCCK). - * - * unlockCardLock({lockType: "rcckPuk", - * puk: "..."}); - * - * (18) RUIM service provider PUK depersonalization. Unlocking the service - * provider control key (SPCK). - * - * unlockCardLock({lockType: "rspckPuk", - * puk: "..."}); + * the given lock. * * @return a DOMRequest. * The request's error will be an object containing the number of @@ -292,37 +239,14 @@ interface MozIcc : EventTarget * @see IccCardLockError. */ [Throws] - DOMRequest unlockCardLock(any info); + DOMRequest unlockCardLock(optional IccUnlockCardLockOptions info); /** * Modify the state of a card lock. * * @param info * An object containing information about the lock and - * how to modify its state. At a minimum, this object - * must have a "lockType" attribute which specifies the - * type of lock, e.g. "pin" for the PIN lock. Other - * attributes are dependent on the lock type. - * - * Examples: - * - * (1a) Disabling the PIN lock: - * - * setCardLock({lockType: "pin", - * pin: "...", - * enabled: false}); - * - * (1b) Disabling the FDN lock: - * - * setCardLock({lockType: "fdn", - * pin2: "...", - * enabled: false}); - * - * (2) Changing the PIN: - * - * setCardLock({lockType: "pin", - * pin: "...", - * newPin: "..."}); + * how to modify its state. * * @return a DOMRequest. * The request's error will be an object containing the number of @@ -330,14 +254,13 @@ interface MozIcc : EventTarget * @see IccCardLockError. */ [Throws] - DOMRequest setCardLock(any info); + DOMRequest setCardLock(optional IccSetCardLockOptions info); /** * Retrieve the number of remaining tries for unlocking the card. * * @param lockType - * Identifies the lock type, e.g. "pin" for the PIN lock, "puk" for - * the PUK lock. + * Identifies the lock type. * * @return a DOMRequest. * The request's result will be an object containing the number of @@ -345,7 +268,7 @@ interface MozIcc : EventTarget * e.g. {retryCount: 3}. */ [Throws] - DOMRequest getCardLockRetryCount(DOMString lockType); + DOMRequest getCardLockRetryCount(IccLockType lockType); // Integrated Circuit Card Phonebook Interfaces.