Bug 944225 - Part 1: Add set/getPreferredNetworkType() API (idl). r=hsinyi
authorJessica Jong <jjong@mozilla.com>
Wed, 11 Dec 2013 11:14:20 +0800
changeset 159859 d5251436a70af796d4ece1b0b8227275d689d91e
parent 159858 2006551ea7713a56fd7504e53536f7c842415f3d
child 159860 47130d04f60aab5ab68c44f26ff324d102f1051f
push idunknown
push userunknown
push dateunknown
reviewershsinyi
bugs944225
milestone29.0a1
Bug 944225 - Part 1: Add set/getPreferredNetworkType() API (idl). r=hsinyi
dom/network/interfaces/nsIDOMMobileConnection.idl
dom/network/interfaces/nsIMobileConnectionProvider.idl
--- a/dom/network/interfaces/nsIDOMMobileConnection.idl
+++ b/dom/network/interfaces/nsIDOMMobileConnection.idl
@@ -6,17 +6,17 @@
 
 interface nsIDOMEventListener;
 interface nsIDOMDOMRequest;
 interface nsIDOMMozMobileConnectionInfo;
 interface nsIDOMMozMobileNetworkInfo;
 interface nsIDOMMozMobileCellInfo;
 interface nsIDOMMozMobileCFInfo;
 
-[scriptable, builtinclass, uuid(4c8331f9-45f3-479d-ac3f-acb60fcc0583)]
+[scriptable, builtinclass, uuid(f55510a9-8dfc-44f5-90ab-355d1e721808)]
 interface nsIDOMMozMobileConnection : nsIDOMEventTarget
 {
   const long ICC_SERVICE_CLASS_VOICE = (1 << 0);
   const long ICC_SERVICE_CLASS_DATA = (1 << 1);
   const long ICC_SERVICE_CLASS_FAX = (1 << 2);
   const long ICC_SERVICE_CLASS_SMS = (1 << 3);
   const long ICC_SERVICE_CLASS_DATA_SYNC = (1 << 4);
   const long ICC_SERVICE_CLASS_DATA_ASYNC = (1 << 5);
@@ -125,16 +125,50 @@ interface nsIDOMMozMobileConnection : ns
    *
    * Otherwise, the request's onerror will be called, and the request's error
    * will be either 'RadioNotAvailable', 'RequestNotSupported',
    * 'IllegalSIMorME', or 'GenericFailure'
    */
   nsIDOMDOMRequest selectNetworkAutomatically();
 
   /**
+   * Set preferred network type
+   *
+   * @param type
+   *        DOMString indicates the desired preferred network type.
+   *        Possible values: 'wcdma/gsm', 'gsm', 'wcdma', 'wcdma/gsm-auto',
+                             'cdma/evdo', 'cdma', 'evdo', or
+                             'wcdma/gsm/cdma/evdo'.
+   *
+   * If successful, the request's onsuccess will be called.
+   *
+   * Otherwise, the request's onerror will be called, and the request's error
+   * will be either 'RadioNotAvailable', 'RequestNotSupported',
+   * 'InvalidParameter', 'ModeNotSupported' or 'GenericFailure'
+   *
+   * TODO: param "type" should be a WebIDL enum when this interface is converted
+   *       to WebIDL
+   */
+  nsIDOMDOMRequest setPreferredNetworkType(in DOMString type);
+
+  /**
+   * Query current preferred network type
+   *
+   * If successful, the request's onsuccess will be called. And the request's
+   * result will be a string indicating the current preferred network type.
+   * The value will be either 'wcdma/gsm', 'gsm', 'wcdma', 'wcdma/gsm-auto',
+   * 'cdma/evdo', 'cdma', 'evdo', or 'wcdma/gsm/cdma/evdo'.
+   *
+   * Otherwise, the request's onerror will be called, and the request's error
+   * will be either 'RadioNotAvailable', 'RequestNotSupported',
+   * or 'GenericFailure'
+   */
+  nsIDOMDOMRequest getPreferredNetworkType();
+
+  /**
    * Set roaming preference
    *
    * @param mode
    *        DOMString indicates the desired roaming preference.
    *        Possible values: 'home', 'affiliated', or 'any'.
    *
    * If successful, the request's onsuccess will be called.
    *
--- a/dom/network/interfaces/nsIMobileConnectionProvider.idl
+++ b/dom/network/interfaces/nsIMobileConnectionProvider.idl
@@ -30,17 +30,17 @@ interface nsIMobileConnectionListener : 
   void notifyIccChanged();
   void notifyRadioStateChanged();
 };
 
 /**
  * XPCOM component (in the content process) that provides the mobile
  * network information.
  */
-[scriptable, uuid(9a804dc4-6900-46af-8c38-3d0f424672b5)]
+[scriptable, uuid(0e027520-dd87-461d-88a6-c3e46369c03c)]
 interface nsIMobileConnectionProvider : nsISupports
 {
   /**
    * 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 registerMobileConnectionMsg(in unsigned long clientId,
@@ -57,16 +57,22 @@ interface nsIMobileConnectionProvider : 
   nsIDOMDOMRequest getNetworks(in unsigned long clientId,
                                in nsIDOMWindow window);
   nsIDOMDOMRequest selectNetwork(in unsigned long clientId,
                                  in nsIDOMWindow window,
                                  in nsIDOMMozMobileNetworkInfo network);
   nsIDOMDOMRequest selectNetworkAutomatically(in unsigned long clientId,
                                               in nsIDOMWindow window);
 
+  nsIDOMDOMRequest setPreferredNetworkType(in unsigned long clientId,
+                                           in nsIDOMWindow window,
+                                           in DOMString type);
+  nsIDOMDOMRequest getPreferredNetworkType(in unsigned long clientId,
+                                           in nsIDOMWindow window);
+
   nsIDOMDOMRequest setRoamingPreference(in unsigned long clientId,
                                         in nsIDOMWindow window,
                                         in DOMString mode);
   nsIDOMDOMRequest getRoamingPreference(in unsigned long clientId,
                                         in nsIDOMWindow window);
 
   nsIDOMDOMRequest setVoicePrivacyMode(in unsigned long clientId,
                                        in nsIDOMWindow window,