Bug 1112471 - Part 1: Introduce a new API for getting icc service state. r=hsinyi
authorEdgar Chen <echen@mozilla.com>
Mon, 22 Dec 2014 15:57:25 +0800
changeset 235652 d54440baa318f4da1f7923de919caf9f58fbd869
parent 235651 9d9a63e4441fea0df75515af43c4cc8b6414889f
child 235653 a07deec1d2721d1e4647da981d756875f0e88026
push id366
push usercmanchester@mozilla.com
push dateThu, 08 Jan 2015 16:40:24 +0000
reviewershsinyi
bugs1112471
milestone37.0a1
Bug 1112471 - Part 1: Introduce a new API for getting icc service state. r=hsinyi
dom/icc/interfaces/nsIIccProvider.idl
dom/webidl/MozIcc.webidl
--- a/dom/icc/interfaces/nsIIccProvider.idl
+++ b/dom/icc/interfaces/nsIIccProvider.idl
@@ -53,17 +53,17 @@ interface nsIIccChannelCallback : nsISup
    *
    */
   void notifyError(in DOMString error);
 };
 
 /**
  * XPCOM component (in the content process) that provides the ICC information.
  */
-[scriptable, uuid(bf985ee1-14c9-43c6-a471-8ab52fb24b0d)]
+[scriptable, uuid(821bda2b-7abd-44c6-813e-d4bc68d73a0c)]
 interface nsIIccProvider : nsISupports
 {
   // MUST match enum IccCardState in MozIcc.webidl!
   const unsigned long CARD_STATE_UNKNOWN = 0;
   const unsigned long CARD_STATE_READY = 1;
   const unsigned long CARD_STATE_PIN_REQUIRED = 2;
   const unsigned long CARD_STATE_PUK_REQUIRED = 3;
   const unsigned long CARD_STATE_PERMANENT_BLOCKED = 4;
@@ -123,16 +123,19 @@ interface nsIIccProvider : nsISupports
   const unsigned long CARD_CONTACT_TYPE_FDN = 1;
   const unsigned long CARD_CONTACT_TYPE_SDN = 2;
 
   // MUST match with enum IccMvnoType in MozIcc.webidl
   const unsigned long CARD_MVNO_TYPE_IMSI = 0;
   const unsigned long CARD_MVNO_TYPE_SPN = 1;
   const unsigned long CARD_MVNO_TYPE_GID = 2;
 
+  // MUST match with enum IccService in MozIcc.webidl
+  const unsigned long CARD_SERVICE_FDN = 0;
+
   /**
    * Called when a content process registers receiving unsolicited messages from
    * RadioInterfaceLayer in the chrome process. Only a content process that has
    * the 'mobileconnection' permission is allowed to register.
    */
   void registerIccMsg(in unsigned long clientId, in nsIIccListener listener);
   void unregisterIccMsg(in unsigned long clientId, in nsIIccListener listener);
 
@@ -234,9 +237,13 @@ interface nsIIccProvider : nsISupports
 
   /**
    * Helpers
    */
   nsIDOMDOMRequest matchMvno(in unsigned long clientId,
                              in nsIDOMWindow window,
                              in unsigned long mvnoType,
                              in DOMString mvnoData);
+
+  nsISupports getServiceState(in unsigned long clientId,
+                              in nsIDOMWindow window,
+                              in unsigned long service);
 };
--- a/dom/webidl/MozIcc.webidl
+++ b/dom/webidl/MozIcc.webidl
@@ -84,16 +84,21 @@ enum IccContactType
 
 enum IccMvnoType
 {
   "imsi",
   "spn",
   "gid"
 };
 
+enum IccService
+{
+  "fdn"
+};
+
 dictionary IccUnlockCardLockOptions
 {
   required IccLockType lockType;
 
   DOMString? pin = null; // Necessary for lock types: "pin", "pin2", "nck",
                          // "nck1", "nck2", "hnck", "cck", "spck", "rcck",
                          // "rspck".
 
@@ -326,9 +331,22 @@ interface MozIcc : EventTarget
    *        Data to be compared with ICC's field.
    *
    * @return a DOMRequest.
    *         The request's result will be a boolean indicating the matching
    *         result.
    */
   [Throws]
   DOMRequest matchMvno(IccMvnoType mvnoType, DOMString matchData);
+
+  /**
+   * Retrieve the the availability of an icc service.
+   *
+   * @param service
+   *        Identifies the service type.
+   *
+   * @return a Promise
+   *         If succeeds, the promise is resolved with boolean indicating the
+   *         availability of the service. Otherwise, rejected with a DOMError.
+   */
+  [NewObject, Throws]
+  Promise<boolean> getServiceState(IccService service);
 };