Bug 793192 - MMI Codes: support call forwarding. Part 1 - RIL; r=marshall_law sr=sicking
authorFernando Jiménez <ferjmoreno@gmail.com>
Wed, 07 Nov 2012 14:13:43 -0800
changeset 112655 c1feb6d4a8b59ba3ad5a376b76f0f8ab43c110f4
parent 112654 ed6ba763f45a78385198abc40462eea424019073
child 112656 8ce4b53fb01505f20a9b4aef8b73e6a6597ca01a
push id17705
push userferjmoreno@gmail.com
push dateThu, 08 Nov 2012 02:26:48 +0000
treeherdermozilla-inbound@85867b1963cf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarshall_law, sicking
bugs793192
milestone19.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 793192 - MMI Codes: support call forwarding. Part 1 - RIL; r=marshall_law sr=sicking
dom/network/interfaces/nsIDOMMobileConnection.idl
dom/system/gonk/ril_consts.js
dom/system/gonk/ril_worker.js
--- a/dom/network/interfaces/nsIDOMMobileConnection.idl
+++ b/dom/network/interfaces/nsIDOMMobileConnection.idl
@@ -8,19 +8,28 @@ interface nsIDOMEventListener;
 interface nsIDOMDOMRequest;
 interface nsIDOMMozMobileICCInfo;
 interface nsIDOMMozMobileConnectionInfo;
 interface nsIDOMMozMobileNetworkInfo;
 interface nsIDOMMozMobileCellInfo;
 interface nsIDOMMozIccManager;
 interface nsIDOMMozMobileCFInfo;
 
-[scriptable, builtinclass, uuid(0540db59-8b4f-41c2-a1b8-4097780558b7)]
+[scriptable, builtinclass, uuid(cc4947eb-aa39-4c25-878d-618dc4d4d2bc)]
 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);
+  const long ICC_SERVICE_CLASS_PACKET = (1 << 6);
+  const long ICC_SERVICE_CLASS_PAD = (1 << 7);
+
   /**
    * Indicates the state of the device's ICC card.
    *
    * Possible values: null, 'absent', 'pinRequired', 'pukRequired',
    * 'networkLocked', 'ready'.
    */
   readonly attribute DOMString cardState;
 
--- a/dom/system/gonk/ril_consts.js
+++ b/dom/system/gonk/ril_consts.js
@@ -1896,31 +1896,60 @@ this.GECKO_RADIO_TECH = [
   "evdob",
   "ehrpd",
   "lte",
   "hspa+",
 ];
 
 this.GECKO_VOICEMAIL_MESSAGE_COUNT_UNKNOWN = -1;
 
+// Call forwarding action. Must be in sync with nsIDOMMozMobileCFInfo interface
+this.CALL_FORWARD_ACTION_DISABLE = 0;
+this.CALL_FORWARD_ACTION_ENABLE = 1;
+this.CALL_FORWARD_ACTION_QUERY_STATUS = 2;
+this.CALL_FORWARD_ACTION_REGISTRATION = 3;
+this.CALL_FORWARD_ACTION_ERASURE = 4;
+
+// Call forwarding reason. Must be in sync with nsIDOMMozMobileCFInfo interface
+this.CALL_FORWARD_REASON_UNCONDITIONAL = 0;
+this.CALL_FORWARD_REASON_MOBILE_BUSY = 1;
+this.CALL_FORWARD_REASON_NO_REPLY = 2;
+this.CALL_FORWARD_REASON_NOT_REACHABLE = 3;
+this.CALL_FORWARD_REASON_ALL_CALL_FORWARDING = 4;
+this.CALL_FORWARD_REASON_ALL_CONDITIONAL_CALL_FORWARDING = 5;
+
 // MMI procedure as defined in TS.22.030 6.5.2
 this.MMI_PROCEDURE_ACTIVATION = "*";
 this.MMI_PROCEDURE_DEACTIVATION = "#";
 this.MMI_PROCEDURE_INTERROGATION = "*#";
 this.MMI_PROCEDURE_REGISTRATION = "**";
 this.MMI_PROCEDURE_ERASURE = "##";
 
+this.MMI_PROC_TO_CF_ACTION = {};
+MMI_PROC_TO_CF_ACTION[MMI_PROCEDURE_ACTIVATION] = CALL_FORWARD_ACTION_ENABLE;
+MMI_PROC_TO_CF_ACTION[MMI_PROCEDURE_DEACTIVATION] = CALL_FORWARD_ACTION_DISABLE;
+MMI_PROC_TO_CF_ACTION[MMI_PROCEDURE_INTERROGATION] = CALL_FORWARD_ACTION_QUERY_STATUS;
+MMI_PROC_TO_CF_ACTION[MMI_PROCEDURE_REGISTRATION] = CALL_FORWARD_ACTION_REGISTRATION;
+MMI_PROC_TO_CF_ACTION[MMI_PROCEDURE_ERASURE] = CALL_FORWARD_ACTION_ERASURE;
+
 // MMI call forwarding service codes as defined in TS.22.030 Annex B
 this.MMI_SC_CFU = "21";
 this.MMI_SC_CF_BUSY = "67";
 this.MMI_SC_CF_NO_REPLY = "61";
 this.MMI_SC_CF_NOT_REACHABLE = "62";
 this.MMI_SC_CF_ALL = "002";
 this.MMI_SC_CF_ALL_CONDITIONAL = "004";
 
+this.MMI_SC_TO_CF_REASON = {};
+MMI_SC_TO_CF_REASON[MMI_SC_CFU] = CALL_FORWARD_REASON_UNCONDITIONAL;
+MMI_SC_TO_CF_REASON[MMI_SC_CF_BUSY] = CALL_FORWARD_REASON_MOBILE_BUSY;
+MMI_SC_TO_CF_REASON[MMI_SC_CF_NOT_REACHABLE] = CALL_FORWARD_REASON_NOT_REACHABLE;
+MMI_SC_TO_CF_REASON[MMI_SC_CF_ALL] = CALL_FORWARD_REASON_ALL_CALL_FORWARDING;
+MMI_SC_TO_CF_REASON[MMI_SC_CF_ALL_CONDITIONAL] = CALL_FORWARD_REASON_ALL_CONDITIONAL_CALL_FORWARDING;
+
 // MMI service codes for PIN/PIN2/PUK/PUK2 management as defined in TS.22.030
 // sec 6.6
 this.MMI_SC_PIN = "04";
 this.MMI_SC_PIN2 = "042";
 this.MMI_SC_PUK = "05";
 this.MMI_SC_PUK2 = "052";
 
 // MMI service code for IMEI presentation as defined in TS.22.030 sec 6.7
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -2371,18 +2371,32 @@ let RIL = {
     switch (sc) {
       // Call forwarding
       case MMI_SC_CFU:
       case MMI_SC_CF_BUSY:
       case MMI_SC_CF_NO_REPLY:
       case MMI_SC_CF_NOT_REACHABLE:
       case MMI_SC_CF_ALL:
       case MMI_SC_CF_ALL_CONDITIONAL:
-        // TODO: Bug 793192 - MMI Codes: support call forwarding.
-        _sendMMIError("CALL_FORWARDING_NOT_SUPPORTED_VIA_MMI");
+        // Call forwarding requires at least an action, given by the MMI
+        // procedure, and a reason, given by the MMI service code, but there
+        // is no way that we get this far without a valid procedure or service
+        // code.
+        options.action = MMI_PROC_TO_CF_ACTION[mmi.procedure];
+        options.rilMessageType = "sendMMI";
+        options.reason = MMI_SC_TO_CF_REASON[sc];
+        options.number = mmi.sia;
+        options.serviceClass = mmi.sib;
+        if (options.action == CALL_FORWARD_ACTION_QUERY_STATUS) {
+          _sendMMIError("CF_QUERY_STATUS_NOT_SUPPORTED");
+          return;
+        }
+
+        options.timeSeconds = mmi.sic;
+        this.setCallForward(options);
         return;
 
       // Change the current ICC PIN number.
       case MMI_SC_PIN:
         // As defined in TS.122.030 6.6.2 to change the ICC PIN we should expect
         // an MMI code of the form **04*OLD_PIN*NEW_PIN*NEW_PIN#, where old PIN
         // should be entered as the SIA parameter and the new PIN as SIB and
         // SIC.