Bug 1159591 - Part 11: Move MMI consts from ril_consts to telephonyService. r=aknow

This commit is contained in:
Edgar Chen 2015-05-05 19:27:23 +08:00
parent ad33e4480d
commit 9cfef7195a
3 changed files with 284 additions and 282 deletions

View File

@ -2976,135 +2976,6 @@ CALL_BARRING_PROGRAM_TO_FACILITY[CALL_BARRING_PROGRAM_ALL_SERVICE] = ICC_CB_FACI
CALL_BARRING_PROGRAM_TO_FACILITY[CALL_BARRING_PROGRAM_OUTGOING_SERVICE] = ICC_CB_FACILITY_BA_MO;
CALL_BARRING_PROGRAM_TO_FACILITY[CALL_BARRING_PROGRAM_INCOMING_SERVICE] = ICC_CB_FACILITY_BA_MT;
// 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_NO_REPLY] = CALL_FORWARD_REASON_NO_REPLY;
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
this.MMI_SC_IMEI = "06";
// MMI called line presentation service codes
this.MMI_SC_CLIP = "30";
this.MMI_SC_CLIR = "31";
// MMI call waiting service code
this.MMI_SC_CALL_WAITING = "43";
// MMI service code for registration new password as defined in TS 22.030 6.5.4
this.MMI_SC_CHANGE_PASSWORD = "03";
this.MMI_ZZ_BARRING_SERVICE = "330";
// MMI call barring service codes
this.MMI_SC_BAOC = "33";
this.MMI_SC_BAOIC = "331";
this.MMI_SC_BAOICxH = "332";
this.MMI_SC_BAIC = "35";
this.MMI_SC_BAICr = "351";
this.MMI_SC_BA_ALL = "330";
this.MMI_SC_BA_MO = "333";
this.MMI_SC_BA_MT = "353";
// MMI service code key strings.
this.MMI_KS_SC_CALL_BARRING = "scCallBarring";
this.MMI_KS_SC_CALL_FORWARDING = "scCallForwarding";
this.MMI_KS_SC_CLIP = "scClip";
this.MMI_KS_SC_CLIR = "scClir";
this.MMI_KS_SC_PWD = "scPwd";
this.MMI_KS_SC_CALL_WAITING = "scCallWaiting";
this.MMI_KS_SC_PIN = "scPin";
this.MMI_KS_SC_PIN2 = "scPin2";
this.MMI_KS_SC_PUK = "scPuk";
this.MMI_KS_SC_PUK2 = "scPuk2";
this.MMI_KS_SC_CHANGE_PASSWORD = "scChangePassword";
this.MMI_KS_SC_IMEI = "scImei";
this.MMI_KS_SC_USSD = "scUssd";
this.MMI_KS_SC_CALL = "scCall";
// MMI error messages key strings.
this.MMI_ERROR_KS_ERROR = "emMmiError";
this.MMI_ERROR_KS_NOT_SUPPORTED = "emMmiErrorNotSupported";
this.MMI_ERROR_KS_INVALID_ACTION = "emMmiErrorInvalidAction";
this.MMI_ERROR_KS_MISMATCH_PIN = "emMmiErrorMismatchPin";
this.MMI_ERROR_KS_MISMATCH_PASSWORD = "emMmiErrorMismatchPassword";
this.MMI_ERROR_KS_BAD_PIN = "emMmiErrorBadPin";
this.MMI_ERROR_KS_BAD_PUK = "emMmiErrorBadPuk";
this.MMI_ERROR_KS_INVALID_PIN = "emMmiErrorInvalidPin";
this.MMI_ERROR_KS_INVALID_PASSWORD = "emMmiErrorInvalidPassword";
this.MMI_ERROR_KS_NEEDS_PUK = "emMmiErrorNeedsPuk";
this.MMI_ERROR_KS_SIM_BLOCKED = "emMmiErrorSimBlocked";
// MMI status message.
this.MMI_SM_KS_PASSWORD_CHANGED = "smPasswordChanged";
this.MMI_SM_KS_PIN_CHANGED = "smPinChanged";
this.MMI_SM_KS_PIN2_CHANGED = "smPin2Changed";
this.MMI_SM_KS_PIN_UNBLOCKED = "smPinUnblocked";
this.MMI_SM_KS_PIN2_UNBLOCKED = "smPin2Unblocked";
this.MMI_SM_KS_SERVICE_ENABLED = "smServiceEnabled";
this.MMI_SM_KS_SERVICE_ENABLED_FOR = "smServiceEnabledFor";
this.MMI_SM_KS_SERVICE_DISABLED = "smServiceDisabled";
this.MMI_SM_KS_SERVICE_REGISTERED = "smServiceRegistered";
this.MMI_SM_KS_SERVICE_ERASED = "smServiceErased";
this.MMI_SM_KS_SERVICE_INTERROGATED = "smServiceInterrogated";
this.MMI_SM_KS_SERVICE_NOT_PROVISIONED = "smServiceNotProvisioned";
this.MMI_SM_KS_CLIR_PERMANENT = "smClirPermanent";
this.MMI_SM_KS_CLIR_DEFAULT_ON_NEXT_CALL_ON = "smClirDefaultOnNextCallOn";
this.MMI_SM_KS_CLIR_DEFAULT_ON_NEXT_CALL_OFF = "smClirDefaultOnNextCallOff";
this.MMI_SM_KS_CLIR_DEFAULT_OFF_NEXT_CALL_ON = "smClirDefaultOffNextCallOn";
this.MMI_SM_KS_CLIR_DEFAULT_OFF_NEXT_CALL_OFF = "smClirDefaultOffNextCallOff";
this.MMI_SM_KS_CALL_CONTROL = "smCallControl";
// MMI Service class
this.MMI_KS_SERVICE_CLASS_VOICE = "serviceClassVoice";
this.MMI_KS_SERVICE_CLASS_DATA = "serviceClassData";
this.MMI_KS_SERVICE_CLASS_FAX = "serviceClassFax";
this.MMI_KS_SERVICE_CLASS_SMS = "serviceClassSms";
this.MMI_KS_SERVICE_CLASS_DATA_SYNC = "serviceClassDataSync";
this.MMI_KS_SERVICE_CLASS_DATA_ASYNC = "serviceClassDataAsync";
this.MMI_KS_SERVICE_CLASS_PACKET = "serviceClassPacket";
this.MMI_KS_SERVICE_CLASS_PAD = "serviceClassPad";
this.MMI_KS_SERVICE_CLASS_MAPPING = {};
MMI_KS_SERVICE_CLASS_MAPPING[ICC_SERVICE_CLASS_VOICE] = MMI_KS_SERVICE_CLASS_VOICE;
MMI_KS_SERVICE_CLASS_MAPPING[ICC_SERVICE_CLASS_DATA] = MMI_KS_SERVICE_CLASS_DATA;
MMI_KS_SERVICE_CLASS_MAPPING[ICC_SERVICE_CLASS_FAX] = MMI_KS_SERVICE_CLASS_FAX;
MMI_KS_SERVICE_CLASS_MAPPING[ICC_SERVICE_CLASS_SMS] = MMI_KS_SERVICE_CLASS_SMS;
MMI_KS_SERVICE_CLASS_MAPPING[ICC_SERVICE_CLASS_DATA_SYNC] = MMI_KS_SERVICE_CLASS_DATA_SYNC;
MMI_KS_SERVICE_CLASS_MAPPING[ICC_SERVICE_CLASS_DATA_ASYNC] = MMI_KS_SERVICE_CLASS_DATA_ASYNC;
MMI_KS_SERVICE_CLASS_MAPPING[ICC_SERVICE_CLASS_PACKET] = MMI_KS_SERVICE_CLASS_PACKET;
MMI_KS_SERVICE_CLASS_MAPPING[ICC_SERVICE_CLASS_PAD] = MMI_KS_SERVICE_CLASS_PAD;
/**
* CDMA PDU constants
*/

View File

@ -53,41 +53,171 @@ const DIAL_ERROR_RADIO_NOT_AVAILABLE = RIL.GECKO_ERROR_RADIO_NOT_AVAILABLE;
const TONES_GAP_DURATION = 70;
// Consts for MMI.
// MMI procedure as defined in TS.22.030 6.5.2
const MMI_PROCEDURE_ACTIVATION = "*";
const MMI_PROCEDURE_DEACTIVATION = "#";
const MMI_PROCEDURE_INTERROGATION = "*#";
const MMI_PROCEDURE_REGISTRATION = "**";
const MMI_PROCEDURE_ERASURE = "##";
// MMI call forwarding service codes as defined in TS.22.030 Annex B
const MMI_SC_CFU = "21";
const MMI_SC_CF_BUSY = "67";
const MMI_SC_CF_NO_REPLY = "61";
const MMI_SC_CF_NOT_REACHABLE = "62";
const MMI_SC_CF_ALL = "002";
const MMI_SC_CF_ALL_CONDITIONAL = "004";
// MMI service codes for PIN/PIN2/PUK/PUK2 management as defined in TS.22.030
// sec 6.6
const MMI_SC_PIN = "04";
const MMI_SC_PIN2 = "042";
const MMI_SC_PUK = "05";
const MMI_SC_PUK2 = "052";
// MMI service code for IMEI presentation as defined in TS.22.030 sec 6.7
const MMI_SC_IMEI = "06";
// MMI call waiting service code
const MMI_SC_CALL_WAITING = "43";
// MMI service code for registration new password as defined in TS 22.030 6.5.4
const MMI_SC_CHANGE_PASSWORD = "03";
const MMI_ZZ_BARRING_SERVICE = "330";
// MMI call barring service codes
const MMI_SC_BAOC = "33";
const MMI_SC_BAOIC = "331";
const MMI_SC_BAOICxH = "332";
const MMI_SC_BAIC = "35";
const MMI_SC_BAICr = "351";
const MMI_SC_BA_ALL = "330";
const MMI_SC_BA_MO = "333";
const MMI_SC_BA_MT = "353";
// MMI called line presentation service codes
const MMI_SC_CLIP = "30";
const MMI_SC_CLIR = "31";
// MMI service code key strings.
const MMI_KS_SC_CALL_BARRING = "scCallBarring";
const MMI_KS_SC_CALL_FORWARDING = "scCallForwarding";
const MMI_KS_SC_CLIP = "scClip";
const MMI_KS_SC_CLIR = "scClir";
const MMI_KS_SC_PWD = "scPwd";
const MMI_KS_SC_CALL_WAITING = "scCallWaiting";
const MMI_KS_SC_PIN = "scPin";
const MMI_KS_SC_PIN2 = "scPin2";
const MMI_KS_SC_PUK = "scPuk";
const MMI_KS_SC_PUK2 = "scPuk2";
const MMI_KS_SC_CHANGE_PASSWORD = "scChangePassword";
const MMI_KS_SC_IMEI = "scImei";
const MMI_KS_SC_USSD = "scUssd";
const MMI_KS_SC_CALL = "scCall";
// MMI error messages key strings.
const MMI_ERROR_KS_ERROR = "emMmiError";
const MMI_ERROR_KS_NOT_SUPPORTED = "emMmiErrorNotSupported";
const MMI_ERROR_KS_INVALID_ACTION = "emMmiErrorInvalidAction";
const MMI_ERROR_KS_MISMATCH_PIN = "emMmiErrorMismatchPin";
const MMI_ERROR_KS_MISMATCH_PASSWORD = "emMmiErrorMismatchPassword";
const MMI_ERROR_KS_BAD_PIN = "emMmiErrorBadPin";
const MMI_ERROR_KS_BAD_PUK = "emMmiErrorBadPuk";
const MMI_ERROR_KS_INVALID_PIN = "emMmiErrorInvalidPin";
const MMI_ERROR_KS_INVALID_PASSWORD = "emMmiErrorInvalidPassword";
const MMI_ERROR_KS_NEEDS_PUK = "emMmiErrorNeedsPuk";
const MMI_ERROR_KS_SIM_BLOCKED = "emMmiErrorSimBlocked";
// MMI status message.
const MMI_SM_KS_PASSWORD_CHANGED = "smPasswordChanged";
const MMI_SM_KS_PIN_CHANGED = "smPinChanged";
const MMI_SM_KS_PIN2_CHANGED = "smPin2Changed";
const MMI_SM_KS_PIN_UNBLOCKED = "smPinUnblocked";
const MMI_SM_KS_PIN2_UNBLOCKED = "smPin2Unblocked";
const MMI_SM_KS_SERVICE_ENABLED = "smServiceEnabled";
const MMI_SM_KS_SERVICE_ENABLED_FOR = "smServiceEnabledFor";
const MMI_SM_KS_SERVICE_DISABLED = "smServiceDisabled";
const MMI_SM_KS_SERVICE_REGISTERED = "smServiceRegistered";
const MMI_SM_KS_SERVICE_ERASED = "smServiceErased";
const MMI_SM_KS_SERVICE_INTERROGATED = "smServiceInterrogated";
const MMI_SM_KS_SERVICE_NOT_PROVISIONED = "smServiceNotProvisioned";
const MMI_SM_KS_CLIR_PERMANENT = "smClirPermanent";
const MMI_SM_KS_CLIR_DEFAULT_ON_NEXT_CALL_ON = "smClirDefaultOnNextCallOn";
const MMI_SM_KS_CLIR_DEFAULT_ON_NEXT_CALL_OFF = "smClirDefaultOnNextCallOff";
const MMI_SM_KS_CLIR_DEFAULT_OFF_NEXT_CALL_ON = "smClirDefaultOffNextCallOn";
const MMI_SM_KS_CLIR_DEFAULT_OFF_NEXT_CALL_OFF = "smClirDefaultOffNextCallOff";
const MMI_SM_KS_CALL_CONTROL = "smCallControl";
// MMI Service class
const MMI_KS_SERVICE_CLASS_VOICE = "serviceClassVoice";
const MMI_KS_SERVICE_CLASS_DATA = "serviceClassData";
const MMI_KS_SERVICE_CLASS_FAX = "serviceClassFax";
const MMI_KS_SERVICE_CLASS_SMS = "serviceClassSms";
const MMI_KS_SERVICE_CLASS_DATA_SYNC = "serviceClassDataSync";
const MMI_KS_SERVICE_CLASS_DATA_ASYNC = "serviceClassDataAsync";
const MMI_KS_SERVICE_CLASS_PACKET = "serviceClassPacket";
const MMI_KS_SERVICE_CLASS_PAD = "serviceClassPad";
const MMI_PROC_TO_CF_ACTION = {};
MMI_PROC_TO_CF_ACTION[MMI_PROCEDURE_ACTIVATION] = Ci.nsIMobileConnection.CALL_FORWARD_ACTION_ENABLE;
MMI_PROC_TO_CF_ACTION[MMI_PROCEDURE_DEACTIVATION] = Ci.nsIMobileConnection.CALL_FORWARD_ACTION_DISABLE;
MMI_PROC_TO_CF_ACTION[MMI_PROCEDURE_INTERROGATION] = Ci.nsIMobileConnection.CALL_FORWARD_ACTION_QUERY_STATUS;
MMI_PROC_TO_CF_ACTION[MMI_PROCEDURE_REGISTRATION] = Ci.nsIMobileConnection.CALL_FORWARD_ACTION_REGISTRATION;
MMI_PROC_TO_CF_ACTION[MMI_PROCEDURE_ERASURE] = Ci.nsIMobileConnection.CALL_FORWARD_ACTION_ERASURE;
const MMI_SC_TO_CF_REASON = {};
MMI_SC_TO_CF_REASON[MMI_SC_CFU] = Ci.nsIMobileConnection.CALL_FORWARD_REASON_UNCONDITIONAL;
MMI_SC_TO_CF_REASON[MMI_SC_CF_BUSY] = Ci.nsIMobileConnection.CALL_FORWARD_REASON_MOBILE_BUSY;
MMI_SC_TO_CF_REASON[MMI_SC_CF_NO_REPLY] = Ci.nsIMobileConnection.CALL_FORWARD_REASON_NO_REPLY;
MMI_SC_TO_CF_REASON[MMI_SC_CF_NOT_REACHABLE] = Ci.nsIMobileConnection.CALL_FORWARD_REASON_NOT_REACHABLE;
MMI_SC_TO_CF_REASON[MMI_SC_CF_ALL] = Ci.nsIMobileConnection.CALL_FORWARD_REASON_ALL_CALL_FORWARDING;
MMI_SC_TO_CF_REASON[MMI_SC_CF_ALL_CONDITIONAL] = Ci.nsIMobileConnection.CALL_FORWARD_REASON_ALL_CONDITIONAL_CALL_FORWARDING;
const MMI_SC_TO_LOCK_TYPE = {};
MMI_SC_TO_LOCK_TYPE[RIL.MMI_SC_PIN] = Ci.nsIIcc.CARD_LOCK_TYPE_PIN;
MMI_SC_TO_LOCK_TYPE[RIL.MMI_SC_PIN2] = Ci.nsIIcc.CARD_LOCK_TYPE_PIN2;
MMI_SC_TO_LOCK_TYPE[RIL.MMI_SC_PUK] = Ci.nsIIcc.CARD_LOCK_TYPE_PUK;
MMI_SC_TO_LOCK_TYPE[RIL.MMI_SC_PUK2] = Ci.nsIIcc.CARD_LOCK_TYPE_PUK2;
MMI_SC_TO_LOCK_TYPE[MMI_SC_PIN] = Ci.nsIIcc.CARD_LOCK_TYPE_PIN;
MMI_SC_TO_LOCK_TYPE[MMI_SC_PIN2] = Ci.nsIIcc.CARD_LOCK_TYPE_PIN2;
MMI_SC_TO_LOCK_TYPE[MMI_SC_PUK] = Ci.nsIIcc.CARD_LOCK_TYPE_PUK;
MMI_SC_TO_LOCK_TYPE[MMI_SC_PUK2] = Ci.nsIIcc.CARD_LOCK_TYPE_PUK2;
const MMI_PROC_TO_CLIR_ACTION = {};
MMI_PROC_TO_CLIR_ACTION[RIL.MMI_PROCEDURE_ACTIVATION] = Ci.nsIMobileConnection.CLIR_INVOCATION;
MMI_PROC_TO_CLIR_ACTION[RIL.MMI_PROCEDURE_DEACTIVATION] = Ci.nsIMobileConnection.CLIR_SUPPRESSION;
MMI_PROC_TO_CLIR_ACTION[MMI_PROCEDURE_ACTIVATION] = Ci.nsIMobileConnection.CLIR_INVOCATION;
MMI_PROC_TO_CLIR_ACTION[MMI_PROCEDURE_DEACTIVATION] = Ci.nsIMobileConnection.CLIR_SUPPRESSION;
const MMI_SC_TO_CB_PROGRAM = {};
MMI_SC_TO_CB_PROGRAM[RIL.MMI_SC_BAOC] = Ci.nsIMobileConnection.CALL_BARRING_PROGRAM_ALL_OUTGOING;
MMI_SC_TO_CB_PROGRAM[RIL.MMI_SC_BAOIC] = Ci.nsIMobileConnection.CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL;
MMI_SC_TO_CB_PROGRAM[RIL.MMI_SC_BAOICxH] = Ci.nsIMobileConnection.CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL_EXCEPT_HOME;
MMI_SC_TO_CB_PROGRAM[RIL.MMI_SC_BAIC] = Ci.nsIMobileConnection.CALL_BARRING_PROGRAM_ALL_INCOMING;
MMI_SC_TO_CB_PROGRAM[RIL.MMI_SC_BAICr] = Ci.nsIMobileConnection.CALL_BARRING_PROGRAM_INCOMING_ROAMING;
MMI_SC_TO_CB_PROGRAM[RIL.MMI_SC_BA_ALL] = Ci.nsIMobileConnection.CALL_BARRING_PROGRAM_ALL_SERVICE;
MMI_SC_TO_CB_PROGRAM[RIL.MMI_SC_BA_MO] = Ci.nsIMobileConnection.CALL_BARRING_PROGRAM_OUTGOING_SERVICE;
MMI_SC_TO_CB_PROGRAM[RIL.MMI_SC_BA_MT] = Ci.nsIMobileConnection.CALL_BARRING_PROGRAM_INCOMING_SERVICE;
MMI_SC_TO_CB_PROGRAM[MMI_SC_BAOC] = Ci.nsIMobileConnection.CALL_BARRING_PROGRAM_ALL_OUTGOING;
MMI_SC_TO_CB_PROGRAM[MMI_SC_BAOIC] = Ci.nsIMobileConnection.CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL;
MMI_SC_TO_CB_PROGRAM[MMI_SC_BAOICxH] = Ci.nsIMobileConnection.CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL_EXCEPT_HOME;
MMI_SC_TO_CB_PROGRAM[MMI_SC_BAIC] = Ci.nsIMobileConnection.CALL_BARRING_PROGRAM_ALL_INCOMING;
MMI_SC_TO_CB_PROGRAM[MMI_SC_BAICr] = Ci.nsIMobileConnection.CALL_BARRING_PROGRAM_INCOMING_ROAMING;
MMI_SC_TO_CB_PROGRAM[MMI_SC_BA_ALL] = Ci.nsIMobileConnection.CALL_BARRING_PROGRAM_ALL_SERVICE;
MMI_SC_TO_CB_PROGRAM[MMI_SC_BA_MO] = Ci.nsIMobileConnection.CALL_BARRING_PROGRAM_OUTGOING_SERVICE;
MMI_SC_TO_CB_PROGRAM[MMI_SC_BA_MT] = Ci.nsIMobileConnection.CALL_BARRING_PROGRAM_INCOMING_SERVICE;
const CF_ACTION_TO_STATUS_MESSAGE = {};
CF_ACTION_TO_STATUS_MESSAGE[Ci.nsIMobileConnection.CALL_FORWARD_ACTION_ENABLE] = RIL.MMI_SM_KS_SERVICE_ENABLED;
CF_ACTION_TO_STATUS_MESSAGE[Ci.nsIMobileConnection.CALL_FORWARD_ACTION_DISABLE] = RIL.MMI_SM_KS_SERVICE_DISABLED;
CF_ACTION_TO_STATUS_MESSAGE[Ci.nsIMobileConnection.CALL_FORWARD_ACTION_REGISTRATION] = RIL.MMI_SM_KS_SERVICE_REGISTERED;
CF_ACTION_TO_STATUS_MESSAGE[Ci.nsIMobileConnection.CALL_FORWARD_ACTION_ERASURE] = RIL.MMI_SM_KS_SERVICE_ERASED;
CF_ACTION_TO_STATUS_MESSAGE[Ci.nsIMobileConnection.CALL_FORWARD_ACTION_ENABLE] = MMI_SM_KS_SERVICE_ENABLED;
CF_ACTION_TO_STATUS_MESSAGE[Ci.nsIMobileConnection.CALL_FORWARD_ACTION_DISABLE] = MMI_SM_KS_SERVICE_DISABLED;
CF_ACTION_TO_STATUS_MESSAGE[Ci.nsIMobileConnection.CALL_FORWARD_ACTION_REGISTRATION] = MMI_SM_KS_SERVICE_REGISTERED;
CF_ACTION_TO_STATUS_MESSAGE[Ci.nsIMobileConnection.CALL_FORWARD_ACTION_ERASURE] = MMI_SM_KS_SERVICE_ERASED;
const LOCK_TYPE_TO_STATUS_MESSAGE = {};
LOCK_TYPE_TO_STATUS_MESSAGE[Ci.nsIIcc.CARD_LOCK_TYPE_PIN] = RIL.MMI_SM_KS_PIN_CHANGED;
LOCK_TYPE_TO_STATUS_MESSAGE[Ci.nsIIcc.CARD_LOCK_TYPE_PIN2] = RIL.MMI_SM_KS_PIN2_CHANGED;
LOCK_TYPE_TO_STATUS_MESSAGE[Ci.nsIIcc.CARD_LOCK_TYPE_PUK] = RIL.MMI_SM_KS_PIN_UNBLOCKED;
LOCK_TYPE_TO_STATUS_MESSAGE[Ci.nsIIcc.CARD_LOCK_TYPE_PUK2] = RIL.MMI_SM_KS_PIN2_UNBLOCKED;
LOCK_TYPE_TO_STATUS_MESSAGE[Ci.nsIIcc.CARD_LOCK_TYPE_PIN] = MMI_SM_KS_PIN_CHANGED;
LOCK_TYPE_TO_STATUS_MESSAGE[Ci.nsIIcc.CARD_LOCK_TYPE_PIN2] = MMI_SM_KS_PIN2_CHANGED;
LOCK_TYPE_TO_STATUS_MESSAGE[Ci.nsIIcc.CARD_LOCK_TYPE_PUK] = MMI_SM_KS_PIN_UNBLOCKED;
LOCK_TYPE_TO_STATUS_MESSAGE[Ci.nsIIcc.CARD_LOCK_TYPE_PUK2] = MMI_SM_KS_PIN2_UNBLOCKED;
const CLIR_ACTION_TO_STATUS_MESSAGE = {};
CLIR_ACTION_TO_STATUS_MESSAGE[Ci.nsIMobileConnection.CLIR_INVOCATION] = RIL.MMI_SM_KS_SERVICE_ENABLED;
CLIR_ACTION_TO_STATUS_MESSAGE[Ci.nsIMobileConnection.CLIR_SUPPRESSION] = RIL.MMI_SM_KS_SERVICE_DISABLED;
CLIR_ACTION_TO_STATUS_MESSAGE[Ci.nsIMobileConnection.CLIR_INVOCATION] = MMI_SM_KS_SERVICE_ENABLED;
CLIR_ACTION_TO_STATUS_MESSAGE[Ci.nsIMobileConnection.CLIR_SUPPRESSION] = MMI_SM_KS_SERVICE_DISABLED;
const MMI_KS_SERVICE_CLASS_MAPPING = {};
MMI_KS_SERVICE_CLASS_MAPPING[Ci.nsIMobileConnection.ICC_SERVICE_CLASS_VOICE] = MMI_KS_SERVICE_CLASS_VOICE;
MMI_KS_SERVICE_CLASS_MAPPING[Ci.nsIMobileConnection.ICC_SERVICE_CLASS_DATA] = MMI_KS_SERVICE_CLASS_DATA;
MMI_KS_SERVICE_CLASS_MAPPING[Ci.nsIMobileConnection.ICC_SERVICE_CLASS_FAX] = MMI_KS_SERVICE_CLASS_FAX;
MMI_KS_SERVICE_CLASS_MAPPING[Ci.nsIMobileConnection.ICC_SERVICE_CLASS_SMS] = MMI_KS_SERVICE_CLASS_SMS;
MMI_KS_SERVICE_CLASS_MAPPING[Ci.nsIMobileConnection.ICC_SERVICE_CLASS_DATA_SYNC] = MMI_KS_SERVICE_CLASS_DATA_SYNC;
MMI_KS_SERVICE_CLASS_MAPPING[Ci.nsIMobileConnection.ICC_SERVICE_CLASS_DATA_ASYNC] = MMI_KS_SERVICE_CLASS_DATA_ASYNC;
MMI_KS_SERVICE_CLASS_MAPPING[Ci.nsIMobileConnection.ICC_SERVICE_CLASS_PACKET] = MMI_KS_SERVICE_CLASS_PACKET;
MMI_KS_SERVICE_CLASS_MAPPING[Ci.nsIMobileConnection.ICC_SERVICE_CLASS_PAD] = MMI_KS_SERVICE_CLASS_PAD;
let DEBUG;
function debug(s) {
@ -475,7 +605,7 @@ TelephonyService.prototype = {
* MMI full object.
*/
_isTemporaryCLIR: function(aMmi) {
return (aMmi && aMmi.serviceCode === RIL.MMI_SC_CLIR) && aMmi.dialNumber;
return (aMmi && aMmi.serviceCode === MMI_SC_CLIR) && aMmi.dialNumber;
},
/**
@ -488,9 +618,9 @@ TelephonyService.prototype = {
// In temporary mode, MMI_PROCEDURE_ACTIVATION means allowing CLI
// presentation, i.e. CLIR_SUPPRESSION. See TS 22.030, Annex B.
switch (aProcedure) {
case RIL.MMI_PROCEDURE_ACTIVATION:
case MMI_PROCEDURE_ACTIVATION:
return Ci.nsIMobileConnection.CLIR_SUPPRESSION;
case RIL.MMI_PROCEDURE_DEACTIVATION:
case MMI_PROCEDURE_DEACTIVATION:
return Ci.nsIMobileConnection.CLIR_INVOCATION;
default:
return Ci.nsIMobileConnection.CLIR_DEFAULT;
@ -657,27 +787,27 @@ TelephonyService.prototype = {
// Handling of supplementary services within a call as 3GPP TS 22.030 6.5.5
_dialInCallMMI: function(aClientId, aNumber, aCallback) {
let mmiCallback = {
notifyError: () => aCallback.notifyDialMMIError(RIL.MMI_ERROR_KS_ERROR),
notifySuccess: () => aCallback.notifyDialMMISuccess(RIL.MMI_SM_KS_CALL_CONTROL)
notifyError: () => aCallback.notifyDialMMIError(MMI_ERROR_KS_ERROR),
notifySuccess: () => aCallback.notifyDialMMISuccess(MMI_SM_KS_CALL_CONTROL)
};
if (aNumber === "0") {
aCallback.notifyDialMMI(RIL.MMI_KS_SC_CALL);
aCallback.notifyDialMMI(MMI_KS_SC_CALL);
this._hangUpBackground(aClientId, mmiCallback);
} else if (aNumber === "1") {
aCallback.notifyDialMMI(RIL.MMI_KS_SC_CALL);
aCallback.notifyDialMMI(MMI_KS_SC_CALL);
this._hangUpForeground(aClientId, mmiCallback);
} else if (aNumber[0] === "1" && aNumber.length === 2) {
aCallback.notifyDialMMI(RIL.MMI_KS_SC_CALL);
aCallback.notifyDialMMI(MMI_KS_SC_CALL);
this.hangUpCall(aClientId, parseInt(aNumber[1]), mmiCallback);
} else if (aNumber === "2") {
aCallback.notifyDialMMI(RIL.MMI_KS_SC_CALL);
aCallback.notifyDialMMI(MMI_KS_SC_CALL);
this._switchActiveCall(aClientId, mmiCallback);
} else if (aNumber[0] === "2" && aNumber.length === 2) {
aCallback.notifyDialMMI(RIL.MMI_KS_SC_CALL);
aCallback.notifyDialMMI(MMI_KS_SC_CALL);
this._separateCallGsm(aClientId, parseInt(aNumber[1]), mmiCallback);
} else if (aNumber === "3") {
aCallback.notifyDialMMI(RIL.MMI_KS_SC_CALL);
aCallback.notifyDialMMI(MMI_KS_SC_CALL);
this._conferenceCallGsm(aClientId, mmiCallback);
} else {
this._dialCall(aClientId, aNumber, undefined, aCallback);
@ -871,7 +1001,7 @@ TelephonyService.prototype = {
*/
_dialMMI: function(aClientId, aMmi, aCallback) {
let mmiServiceCode = aMmi ?
this._serviceCodeToKeyString(aMmi.serviceCode) : RIL.MMI_KS_SC_USSD;
this._serviceCodeToKeyString(aMmi.serviceCode) : MMI_KS_SC_USSD;
aCallback.notifyDialMMI(mmiServiceCode);
@ -879,51 +1009,51 @@ TelephonyService.prototype = {
// trigger the appropriate RIL request if possible.
switch (mmiServiceCode) {
// Call Forwarding
case RIL.MMI_KS_SC_CALL_FORWARDING:
case MMI_KS_SC_CALL_FORWARDING:
this._callForwardingMMI(aClientId, aMmi, aCallback);
break;
// Change the current ICC PIN number.
case RIL.MMI_KS_SC_PIN:
case MMI_KS_SC_PIN:
// Change the current ICC PIN2 number.
case RIL.MMI_KS_SC_PIN2:
case MMI_KS_SC_PIN2:
this._iccChangeLockMMI(aClientId, aMmi, aCallback);
break;
// Unblock ICC PUK.
case RIL.MMI_KS_SC_PUK:
case MMI_KS_SC_PUK:
// Unblock ICC PUN2.
case RIL.MMI_KS_SC_PUK2:
case MMI_KS_SC_PUK2:
this._iccUnlockMMI(aClientId, aMmi, aCallback);
break;
// IMEI
case RIL.MMI_KS_SC_IMEI:
case MMI_KS_SC_IMEI:
this._getImeiMMI(aClientId, aMmi, aCallback);
break;
// CLIP
case RIL.MMI_KS_SC_CLIP:
case MMI_KS_SC_CLIP:
this._clipMMI(aClientId, aMmi, aCallback);
break;
// CLIR (non-temporary ones)
case RIL.MMI_KS_SC_CLIR:
case MMI_KS_SC_CLIR:
this._clirMMI(aClientId, aMmi, aCallback);
break;
// Change call barring password
case RIL.MMI_KS_SC_CHANGE_PASSWORD:
case MMI_KS_SC_CHANGE_PASSWORD:
this._callBarringPasswordMMI(aClientId, aMmi, aCallback);
break;
// Call barring
case RIL.MMI_KS_SC_CALL_BARRING:
case MMI_KS_SC_CALL_BARRING:
this._callBarringMMI(aClientId, aMmi, aCallback);
break;
// Call waiting
case RIL.MMI_KS_SC_CALL_WAITING:
case MMI_KS_SC_CALL_WAITING:
this._callWaitingMMI(aClientId, aMmi, aCallback);
break;
@ -963,15 +1093,15 @@ TelephonyService.prototype = {
}
let connection = gGonkMobileConnectionService.getItemByServiceId(aClientId);
let action = RIL.MMI_PROC_TO_CF_ACTION[aMmi.procedure];
let reason = RIL.MMI_SC_TO_CF_REASON[aMmi.serviceCode];
let action = MMI_PROC_TO_CF_ACTION[aMmi.procedure];
let reason = MMI_SC_TO_CF_REASON[aMmi.serviceCode];
if (action === Ci.nsIMobileConnection.CALL_FORWARD_ACTION_QUERY_STATUS) {
connection.getCallForwarding(reason, {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIMobileConnectionCallback]),
notifyGetCallForwardingSuccess: function(aCount, aResults) {
aCallback.notifyDialMMISuccessWithCallForwardingOptions(
RIL.MMI_SM_KS_SERVICE_INTERROGATED, aCount, aResults);
MMI_SM_KS_SERVICE_INTERROGATED, aCount, aResults);
},
notifyError: function(aErrorMsg) {
aCallback.notifyDialMMIError(aErrorMsg);
@ -1027,14 +1157,14 @@ TelephonyService.prototype = {
notifyCardLockError: function(aErrorMsg, aRetryCount) {
if (aRetryCount <= 0) {
if (lockType === Ci.nsIIcc.CARD_LOCK_TYPE_PIN) {
aErrorMsg = RIL.MMI_ERROR_KS_NEEDS_PUK;
aErrorMsg = MMI_ERROR_KS_NEEDS_PUK;
}
aCallback.notifyDialMMIError(aErrorMsg);
return;
}
aCallback.notifyDialMMIErrorWithInfo(RIL.MMI_ERROR_KS_BAD_PIN,
aCallback.notifyDialMMIErrorWithInfo(MMI_ERROR_KS_BAD_PIN,
aRetryCount);
},
});
@ -1073,14 +1203,14 @@ TelephonyService.prototype = {
notifyCardLockError: function(aErrorMsg, aRetryCount) {
if (aRetryCount <= 0) {
if (lockType === Ci.nsIIcc.CARD_LOCK_TYPE_PUK) {
aErrorMsg = RIL.MMI_ERROR_KS_SIM_BLOCKED;
aErrorMsg = MMI_ERROR_KS_SIM_BLOCKED;
}
aCallback.notifyDialMMIError(aErrorMsg);
return;
}
aCallback.notifyDialMMIErrorWithInfo(RIL.MMI_ERROR_KS_BAD_PUK,
aCallback.notifyDialMMIErrorWithInfo(MMI_ERROR_KS_BAD_PUK,
aRetryCount);
},
});
@ -1126,8 +1256,8 @@ TelephonyService.prototype = {
* A nsITelephonyDialCallback object.
*/
_clipMMI: function(aClientId, aMmi, aCallback) {
if (aMmi.procedure !== RIL.MMI_PROCEDURE_INTERROGATION) {
aCallback.notifyDialMMIError(RIL.MMI_ERROR_KS_NOT_SUPPORTED);
if (aMmi.procedure !== MMI_PROCEDURE_INTERROGATION) {
aCallback.notifyDialMMIError(MMI_ERROR_KS_NOT_SUPPORTED);
return;
}
@ -1144,13 +1274,13 @@ TelephonyService.prototype = {
// 2 for unknown
switch (aResponse.provisioned) {
case 0:
aCallback.notifyDialMMISuccess(RIL.MMI_SM_KS_SERVICE_DISABLED);
aCallback.notifyDialMMISuccess(MMI_SM_KS_SERVICE_DISABLED);
break;
case 1:
aCallback.notifyDialMMISuccess(RIL.MMI_SM_KS_SERVICE_ENABLED);
aCallback.notifyDialMMISuccess(MMI_SM_KS_SERVICE_ENABLED);
break;
default:
aCallback.notifyDialMMIError(RIL.MMI_ERROR_KS_ERROR);
aCallback.notifyDialMMIError(MMI_ERROR_KS_ERROR);
break;
}
});
@ -1169,7 +1299,7 @@ TelephonyService.prototype = {
_clirMMI: function(aClientId, aMmi, aCallback) {
let connection = gGonkMobileConnectionService.getItemByServiceId(aClientId);
switch (aMmi.procedure) {
case RIL.MMI_PROCEDURE_INTERROGATION:
case MMI_PROCEDURE_INTERROGATION:
connection.getCallingLineIdRestriction({
QueryInterface: XPCOMUtils.generateQI([Ci.nsIMobileConnectionCallback]),
notifyGetClirStatusSuccess: function(aN, aM) {
@ -1179,15 +1309,15 @@ TelephonyService.prototype = {
switch (aM) {
// CLIR not provisioned.
case 0:
statusMessage = RIL.MMI_SM_KS_SERVICE_NOT_PROVISIONED;
statusMessage = MMI_SM_KS_SERVICE_NOT_PROVISIONED;
break;
// CLIR provisioned in permanent mode.
case 1:
statusMessage = RIL.MMI_SM_KS_CLIR_PERMANENT;
statusMessage = MMI_SM_KS_CLIR_PERMANENT;
break;
// Unknown (e.g. no network, etc.).
case 2:
errorMsg = RIL.MMI_ERROR_KS_ERROR;
errorMsg = MMI_ERROR_KS_ERROR;
break;
// CLIR temporary mode presentation restricted.
case 3:
@ -1197,11 +1327,11 @@ TelephonyService.prototype = {
case 0:
// CLIR invocation.
case 1:
statusMessage = RIL.MMI_SM_KS_CLIR_DEFAULT_ON_NEXT_CALL_ON;
statusMessage = MMI_SM_KS_CLIR_DEFAULT_ON_NEXT_CALL_ON;
break;
// CLIR suppression.
case 2:
statusMessage = RIL.MMI_SM_KS_CLIR_DEFAULT_ON_NEXT_CALL_OFF;
statusMessage = MMI_SM_KS_CLIR_DEFAULT_ON_NEXT_CALL_OFF;
break;
default:
errorMsg = RIL.GECKO_ERROR_GENERIC_FAILURE;
@ -1216,11 +1346,11 @@ TelephonyService.prototype = {
case 0:
// CLIR suppression.
case 2:
statusMessage = RIL.MMI_SM_KS_CLIR_DEFAULT_OFF_NEXT_CALL_OFF;
statusMessage = MMI_SM_KS_CLIR_DEFAULT_OFF_NEXT_CALL_OFF;
break;
// CLIR invocation.
case 1:
statusMessage = RIL.MMI_SM_KS_CLIR_DEFAULT_OFF_NEXT_CALL_ON;
statusMessage = MMI_SM_KS_CLIR_DEFAULT_OFF_NEXT_CALL_ON;
break;
default:
errorMsg = RIL.GECKO_ERROR_GENERIC_FAILURE;
@ -1244,8 +1374,8 @@ TelephonyService.prototype = {
},
});
break;
case RIL.MMI_PROCEDURE_ACTIVATION:
case RIL.MMI_PROCEDURE_DEACTIVATION: {
case MMI_PROCEDURE_ACTIVATION:
case MMI_PROCEDURE_DEACTIVATION: {
let clirMode = MMI_PROC_TO_CLIR_ACTION[aMmi.procedure];
connection.setCallingLineIdRestriction(clirMode, {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIMobileConnectionCallback]),
@ -1259,7 +1389,7 @@ TelephonyService.prototype = {
break;
}
default:
aCallback.notifyDialMMIError(RIL.MMI_ERROR_KS_NOT_SUPPORTED);
aCallback.notifyDialMMIError(MMI_ERROR_KS_NOT_SUPPORTED);
break;
}
},
@ -1280,26 +1410,26 @@ TelephonyService.prototype = {
return;
}
if (aMmi.procedure !== RIL.MMI_PROCEDURE_REGISTRATION &&
aMmi.procedure !== RIL.MMI_PROCEDURE_ACTIVATION) {
aCallback.notifyDialMMIError(RIL.MMI_ERROR_KS_INVALID_ACTION);
if (aMmi.procedure !== MMI_PROCEDURE_REGISTRATION &&
aMmi.procedure !== MMI_PROCEDURE_ACTIVATION) {
aCallback.notifyDialMMIError(MMI_ERROR_KS_INVALID_ACTION);
return;
}
if (aMmi.sia !== "" && aMmi.sia !== RIL.MMI_ZZ_BARRING_SERVICE) {
aCallback.notifyDialMMIError(RIL.MMI_ERROR_KS_NOT_SUPPORTED);
if (aMmi.sia !== "" && aMmi.sia !== MMI_ZZ_BARRING_SERVICE) {
aCallback.notifyDialMMIError(MMI_ERROR_KS_NOT_SUPPORTED);
return;
}
let validPassword = aSi => /^[0-9]{4}$/.test(aSi);
if (!validPassword(aMmi.sib) || !validPassword(aMmi.sic) ||
!validPassword(aMmi.pwd)) {
aCallback.notifyDialMMIError(RIL.MMI_ERROR_KS_INVALID_PASSWORD);
aCallback.notifyDialMMIError(MMI_ERROR_KS_INVALID_PASSWORD);
return;
}
if (aMmi.sic !== aMmi.pwd) {
aCallback.notifyDialMMIError(RIL.MMI_ERROR_KS_MISMATCH_PASSWORD);
aCallback.notifyDialMMIError(MMI_ERROR_KS_MISMATCH_PASSWORD);
return;
}
@ -1307,7 +1437,7 @@ TelephonyService.prototype = {
connection.changeCallBarringPassword(aMmi.sib, aMmi.sic, {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIMobileConnectionCallback]),
notifySuccess: function() {
aCallback.notifyDialMMISuccess(RIL.MMI_SM_KS_PASSWORD_CHANGED);
aCallback.notifyDialMMISuccess(MMI_SM_KS_PASSWORD_CHANGED);
},
notifyError: function(aErrorMsg) {
aCallback.notifyDialMMIError(aErrorMsg);
@ -1332,17 +1462,17 @@ TelephonyService.prototype = {
let serviceClass = this._siToServiceClass(aMmi.sib);
switch (aMmi.procedure) {
case RIL.MMI_PROCEDURE_INTERROGATION:
case MMI_PROCEDURE_INTERROGATION:
connection.getCallBarring(program, password, serviceClass, {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIMobileConnectionCallback]),
notifyGetCallBarringSuccess: function(aProgram, aEnabled, aServiceClass) {
if (!aEnabled) {
aCallback.notifyDialMMISuccess(RIL.MMI_SM_KS_SERVICE_DISABLED);
aCallback.notifyDialMMISuccess(MMI_SM_KS_SERVICE_DISABLED);
return;
}
let services = this._serviceClassToStringArray(aServiceClass);
aCallback.notifyDialMMISuccessWithStrings(RIL.MMI_SM_KS_SERVICE_ENABLED_FOR,
aCallback.notifyDialMMISuccessWithStrings(MMI_SM_KS_SERVICE_ENABLED_FOR,
services.length, services);
}.bind(this),
notifyError: function(aErrorMsg) {
@ -1350,15 +1480,15 @@ TelephonyService.prototype = {
},
});
break;
case RIL.MMI_PROCEDURE_ACTIVATION:
case RIL.MMI_PROCEDURE_DEACTIVATION: {
let enabled = (aMmi.procedure === RIL.MMI_PROCEDURE_ACTIVATION);
case MMI_PROCEDURE_ACTIVATION:
case MMI_PROCEDURE_DEACTIVATION: {
let enabled = (aMmi.procedure === MMI_PROCEDURE_ACTIVATION);
connection.setCallBarring(program, enabled, password, serviceClass, {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIMobileConnectionCallback]),
notifySuccess: function() {
aCallback.notifyDialMMISuccess(
enabled ? RIL.MMI_SM_KS_SERVICE_ENABLED
: RIL.MMI_SM_KS_SERVICE_DISABLED
enabled ? MMI_SM_KS_SERVICE_ENABLED
: MMI_SM_KS_SERVICE_DISABLED
);
},
notifyError: function(aErrorMsg) {
@ -1368,7 +1498,7 @@ TelephonyService.prototype = {
break;
}
default:
aCallback.notifyDialMMIError(RIL.MMI_ERROR_KS_NOT_SUPPORTED);
aCallback.notifyDialMMIError(MMI_ERROR_KS_NOT_SUPPORTED);
break;
}
},
@ -1392,17 +1522,17 @@ TelephonyService.prototype = {
let connection = gGonkMobileConnectionService.getItemByServiceId(aClientId);
switch (aMmi.procedure) {
case RIL.MMI_PROCEDURE_INTERROGATION:
case MMI_PROCEDURE_INTERROGATION:
connection.getCallWaiting({
QueryInterface: XPCOMUtils.generateQI([Ci.nsIMobileConnectionCallback]),
notifyGetCallWaitingSuccess: function(aServiceClass) {
if (aServiceClass === Ci.nsIMobileConnection.ICC_SERVICE_CLASS_NONE) {
aCallback.notifyDialMMISuccess(RIL.MMI_SM_KS_SERVICE_DISABLED);
aCallback.notifyDialMMISuccess(MMI_SM_KS_SERVICE_DISABLED);
return;
}
let services = this._serviceClassToStringArray(aServiceClass);
aCallback.notifyDialMMISuccessWithStrings(RIL.MMI_SM_KS_SERVICE_ENABLED_FOR,
aCallback.notifyDialMMISuccessWithStrings(MMI_SM_KS_SERVICE_ENABLED_FOR,
services.length, services);
}.bind(this),
notifyError: function(aErrorMsg) {
@ -1410,16 +1540,16 @@ TelephonyService.prototype = {
},
});
break;
case RIL.MMI_PROCEDURE_ACTIVATION:
case RIL.MMI_PROCEDURE_DEACTIVATION: {
let enabled = (aMmi.procedure === RIL.MMI_PROCEDURE_ACTIVATION);
case MMI_PROCEDURE_ACTIVATION:
case MMI_PROCEDURE_DEACTIVATION: {
let enabled = (aMmi.procedure === MMI_PROCEDURE_ACTIVATION);
let serviceClass = this._siToServiceClass(aMmi.sia);
connection.setCallWaiting(enabled, serviceClass, {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIMobileConnectionCallback]),
notifySuccess: function() {
aCallback.notifyDialMMISuccess(
enabled ? RIL.MMI_SM_KS_SERVICE_ENABLED
: RIL.MMI_SM_KS_SERVICE_DISABLED
enabled ? MMI_SM_KS_SERVICE_ENABLED
: MMI_SM_KS_SERVICE_DISABLED
);
},
notifyError: function(aErrorMsg) {
@ -1429,49 +1559,49 @@ TelephonyService.prototype = {
break;
}
default:
aCallback.notifyDialMMIError(RIL.MMI_ERROR_KS_NOT_SUPPORTED);
aCallback.notifyDialMMIError(MMI_ERROR_KS_NOT_SUPPORTED);
break;
}
},
_serviceCodeToKeyString: function(aServiceCode) {
switch (aServiceCode) {
case RIL.MMI_SC_CFU:
case RIL.MMI_SC_CF_BUSY:
case RIL.MMI_SC_CF_NO_REPLY:
case RIL.MMI_SC_CF_NOT_REACHABLE:
case RIL.MMI_SC_CF_ALL:
case RIL.MMI_SC_CF_ALL_CONDITIONAL:
return RIL.MMI_KS_SC_CALL_FORWARDING;
case RIL.MMI_SC_PIN:
return RIL.MMI_KS_SC_PIN;
case RIL.MMI_SC_PIN2:
return RIL.MMI_KS_SC_PIN2;
case RIL.MMI_SC_PUK:
return RIL.MMI_KS_SC_PUK;
case RIL.MMI_SC_PUK2:
return RIL.MMI_KS_SC_PUK2;
case RIL.MMI_SC_IMEI:
return RIL.MMI_KS_SC_IMEI;
case RIL.MMI_SC_CLIP:
return RIL.MMI_KS_SC_CLIP;
case RIL.MMI_SC_CLIR:
return RIL.MMI_KS_SC_CLIR;
case RIL.MMI_SC_BAOC:
case RIL.MMI_SC_BAOIC:
case RIL.MMI_SC_BAOICxH:
case RIL.MMI_SC_BAIC:
case RIL.MMI_SC_BAICr:
case RIL.MMI_SC_BA_ALL:
case RIL.MMI_SC_BA_MO:
case RIL.MMI_SC_BA_MT:
return RIL.MMI_KS_SC_CALL_BARRING;
case RIL.MMI_SC_CALL_WAITING:
return RIL.MMI_KS_SC_CALL_WAITING;
case RIL.MMI_SC_CHANGE_PASSWORD:
return RIL.MMI_KS_SC_CHANGE_PASSWORD;
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:
return MMI_KS_SC_CALL_FORWARDING;
case MMI_SC_PIN:
return MMI_KS_SC_PIN;
case MMI_SC_PIN2:
return MMI_KS_SC_PIN2;
case MMI_SC_PUK:
return MMI_KS_SC_PUK;
case MMI_SC_PUK2:
return MMI_KS_SC_PUK2;
case MMI_SC_IMEI:
return MMI_KS_SC_IMEI;
case MMI_SC_CLIP:
return MMI_KS_SC_CLIP;
case MMI_SC_CLIR:
return MMI_KS_SC_CLIR;
case MMI_SC_BAOC:
case MMI_SC_BAOIC:
case MMI_SC_BAOICxH:
case MMI_SC_BAIC:
case MMI_SC_BAICr:
case MMI_SC_BA_ALL:
case MMI_SC_BA_MO:
case MMI_SC_BA_MT:
return MMI_KS_SC_CALL_BARRING;
case MMI_SC_CALL_WAITING:
return MMI_KS_SC_CALL_WAITING;
case MMI_SC_CHANGE_PASSWORD:
return MMI_KS_SC_CHANGE_PASSWORD;
default:
return RIL.MMI_KS_SC_USSD;
return MMI_KS_SC_USSD;
}
},
@ -1525,7 +1655,7 @@ TelephonyService.prototype = {
mask <= Ci.nsIMobileConnection.ICC_SERVICE_CLASS_MAX;
mask <<= 1) {
if (mask & aServiceClass) {
services.push(RIL.MMI_KS_SERVICE_CLASS_MAPPING[mask]);
services.push(MMI_KS_SERVICE_CLASS_MAPPING[mask]);
}
}
return services;
@ -1536,22 +1666,22 @@ TelephonyService.prototype = {
// 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.
if (aMmi.procedure !== RIL.MMI_PROCEDURE_REGISTRATION) {
return RIL.MMI_ERROR_KS_INVALID_ACTION;
if (aMmi.procedure !== MMI_PROCEDURE_REGISTRATION) {
return MMI_ERROR_KS_INVALID_ACTION;
}
if (!aMmi.sia || !aMmi.sib || !aMmi.sic) {
return RIL.MMI_ERROR_KS_ERROR;
return MMI_ERROR_KS_ERROR;
}
if (aMmi.sia.length < 4 || aMmi.sia.length > 8 ||
aMmi.sib.length < 4 || aMmi.sib.length > 8 ||
aMmi.sic.length < 4 || aMmi.sic.length > 8) {
return RIL.MMI_ERROR_KS_INVALID_PIN;
return MMI_ERROR_KS_INVALID_PIN;
}
if (aMmi.sib != aMmi.sic) {
return RIL.MMI_ERROR_KS_MISMATCH_PIN;
return MMI_ERROR_KS_MISMATCH_PIN;
}
return null;

View File

@ -1,7 +1,8 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
* http://creativecommons.org/publicdomain/zero/1.0/ */
subscriptLoader.loadSubScript("resource://gre/modules/ril_consts.js", this);
let TS = {};
subscriptLoader.loadSubScript("resource://gre/components/TelephonyService.js", TS);
let NS = {};
subscriptLoader.loadSubScript("resource://gre/modules/DialNumberUtils.jsm", NS);
@ -50,7 +51,7 @@ add_test(function test_parseMMI_USSD() {
let mmi = parseMMI("*123#");
equal(mmi.fullMMI, "*123#");
equal(mmi.procedure, MMI_PROCEDURE_ACTIVATION);
equal(mmi.procedure, TS.MMI_PROCEDURE_ACTIVATION);
equal(mmi.serviceCode, "123");
equal(mmi.sia, undefined);
equal(mmi.sib, undefined);
@ -73,7 +74,7 @@ add_test(function test_parseMMI_sia() {
let mmi = parseMMI("*123*1#");
equal(mmi.fullMMI, "*123*1#");
equal(mmi.procedure, MMI_PROCEDURE_ACTIVATION);
equal(mmi.procedure, TS.MMI_PROCEDURE_ACTIVATION);
equal(mmi.serviceCode, "123");
equal(mmi.sia, "1");
equal(mmi.sib, undefined);
@ -88,7 +89,7 @@ add_test(function test_parseMMI_sib() {
let mmi = parseMMI("*123**1#");
equal(mmi.fullMMI, "*123**1#");
equal(mmi.procedure, MMI_PROCEDURE_ACTIVATION);
equal(mmi.procedure, TS.MMI_PROCEDURE_ACTIVATION);
equal(mmi.serviceCode, "123");
equal(mmi.sia, "");
equal(mmi.sib, "1");
@ -103,7 +104,7 @@ add_test(function test_parseMMI_sic() {
let mmi = parseMMI("*123***1#");
equal(mmi.fullMMI, "*123***1#");
equal(mmi.procedure, MMI_PROCEDURE_ACTIVATION);
equal(mmi.procedure, TS.MMI_PROCEDURE_ACTIVATION);
equal(mmi.serviceCode, "123");
equal(mmi.sia, "");
equal(mmi.sib, "");
@ -118,7 +119,7 @@ add_test(function test_parseMMI_sia_sib() {
let mmi = parseMMI("*123*1*1#");
equal(mmi.fullMMI, "*123*1*1#");
equal(mmi.procedure, MMI_PROCEDURE_ACTIVATION);
equal(mmi.procedure, TS.MMI_PROCEDURE_ACTIVATION);
equal(mmi.serviceCode, "123");
equal(mmi.sia, "1");
equal(mmi.sib, "1");
@ -133,7 +134,7 @@ add_test(function test_parseMMI_sia_sic() {
let mmi = parseMMI("*123*1**1#");
equal(mmi.fullMMI, "*123*1**1#");
equal(mmi.procedure, MMI_PROCEDURE_ACTIVATION);
equal(mmi.procedure, TS.MMI_PROCEDURE_ACTIVATION);
equal(mmi.serviceCode, "123");
equal(mmi.sia, "1");
equal(mmi.sib, "");
@ -148,7 +149,7 @@ add_test(function test_parseMMI_sib_sic() {
let mmi = parseMMI("*123**1*1#");
equal(mmi.fullMMI, "*123**1*1#");
equal(mmi.procedure, MMI_PROCEDURE_ACTIVATION);
equal(mmi.procedure, TS.MMI_PROCEDURE_ACTIVATION);
equal(mmi.serviceCode, "123");
equal(mmi.sia, "");
equal(mmi.sib, "1");
@ -163,7 +164,7 @@ add_test(function test_parseMMI_pwd() {
let mmi = parseMMI("*123****1#");
equal(mmi.fullMMI, "*123****1#");
equal(mmi.procedure, MMI_PROCEDURE_ACTIVATION);
equal(mmi.procedure, TS.MMI_PROCEDURE_ACTIVATION);
equal(mmi.serviceCode, "123");
equal(mmi.sia, "");
equal(mmi.sib, "");
@ -178,7 +179,7 @@ add_test(function test_parseMMI_dial_number() {
let mmi = parseMMI("*123#345");
equal(mmi.fullMMI, "*123#");
equal(mmi.procedure, MMI_PROCEDURE_ACTIVATION);
equal(mmi.procedure, TS.MMI_PROCEDURE_ACTIVATION);
equal(mmi.serviceCode, "123");
equal(mmi.sia, undefined);
equal(mmi.sib, undefined);
@ -198,7 +199,7 @@ add_test(function test_parseMMI_activation() {
let mmi = parseMMI("*00*12*34*56#");
equal(mmi.fullMMI, "*00*12*34*56#");
equal(mmi.procedure, MMI_PROCEDURE_ACTIVATION);
equal(mmi.procedure, TS.MMI_PROCEDURE_ACTIVATION);
equal(mmi.serviceCode, "00");
equal(mmi.sia, "12");
equal(mmi.sib, "34");
@ -213,7 +214,7 @@ add_test(function test_parseMMI_deactivation() {
let mmi = parseMMI("#00*12*34*56#");
equal(mmi.fullMMI, "#00*12*34*56#");
equal(mmi.procedure, MMI_PROCEDURE_DEACTIVATION);
equal(mmi.procedure, TS.MMI_PROCEDURE_DEACTIVATION);
equal(mmi.serviceCode, "00");
equal(mmi.sia, "12");
equal(mmi.sib, "34");
@ -228,7 +229,7 @@ add_test(function test_parseMMI_interrogation() {
let mmi = parseMMI("*#00*12*34*56#");
equal(mmi.fullMMI, "*#00*12*34*56#");
equal(mmi.procedure, MMI_PROCEDURE_INTERROGATION);
equal(mmi.procedure, TS.MMI_PROCEDURE_INTERROGATION);
equal(mmi.serviceCode, "00");
equal(mmi.sia, "12");
equal(mmi.sib, "34");
@ -243,7 +244,7 @@ add_test(function test_parseMMI_registration() {
let mmi = parseMMI("**00*12*34*56#");
equal(mmi.fullMMI, "**00*12*34*56#");
equal(mmi.procedure, MMI_PROCEDURE_REGISTRATION);
equal(mmi.procedure, TS.MMI_PROCEDURE_REGISTRATION);
equal(mmi.serviceCode, "00");
equal(mmi.sia, "12");
equal(mmi.sib, "34");
@ -258,7 +259,7 @@ add_test(function test_parseMMI_erasure() {
let mmi = parseMMI("##00*12*34*56#");
equal(mmi.fullMMI, "##00*12*34*56#");
equal(mmi.procedure, MMI_PROCEDURE_ERASURE);
equal(mmi.procedure, TS.MMI_PROCEDURE_ERASURE);
equal(mmi.serviceCode, "00");
equal(mmi.sia, "12");
equal(mmi.sib, "34");