Bug 793186 - MMI Codes: implement sendMMI() and cancelMMI() - Part 1: Rename USSD-MMI; r=philikon

This commit is contained in:
Fernando Jiménez 2012-10-05 16:08:55 +02:00
Родитель b53374cfd5
Коммит 3f59d15b2a
6 изменённых файлов: 68 добавлений и 59 удалений

Просмотреть файл

@ -12,7 +12,7 @@ interface nsIDOMMozMobileNetworkInfo;
interface nsIDOMMozMobileCellInfo; interface nsIDOMMozMobileCellInfo;
interface nsIDOMMozIccManager; interface nsIDOMMozIccManager;
[scriptable, builtinclass, uuid(c07309ee-a424-11e1-a75c-00265511db39)] [scriptable, builtinclass, uuid(f7bddd87-e967-4f97-9481-2042beb86a92)]
interface nsIDOMMozMobileConnection : nsIDOMEventTarget interface nsIDOMMozMobileConnection : nsIDOMEventTarget
{ {
/** /**
@ -201,19 +201,29 @@ interface nsIDOMMozMobileConnection : nsIDOMEventTarget
nsIDOMDOMRequest setCardLock(in jsval info); nsIDOMDOMRequest setCardLock(in jsval info);
/** /**
* Send a USSD message. * Send a MMI message.
* *
* The network reply will be reported via onussdreceived event. * @param mmi
* DOMString containing an MMI string that can be associated to a
* USSD request or other RIL functionality.
* *
* The 'success' event for the request means the USSD message has been sent * @return a nsIDOMDOMRequest
* successfully. * The request's result will be an object containing information
* about the operation.
*
* In case that the MMI code requires sending an USSD request, the DOMrequest
* 'success' event means that the RIL has successfully processed and sent the
* USSD request to the network. The network reply will be reported via
* 'onussdreceived' event. If the MMI code is not associated to a USSD but to
* other RIL request its result, if one is needed, will be notified via the
* returned DOMRequest 'success' or 'error' event.
*/ */
nsIDOMDOMRequest sendUSSD(in DOMString ussd); nsIDOMDOMRequest sendMMI(in DOMString mmi);
/** /**
* Cancel the current USSD session if one exists. * Cancel the current MMI request if one exists.
*/ */
nsIDOMDOMRequest cancelUSSD(); nsIDOMDOMRequest cancelMMI();
/** /**
* The 'cardstatechange' event is notified when the 'cardState' attribute * The 'cardstatechange' event is notified when the 'cardState' attribute

Просмотреть файл

@ -31,8 +31,8 @@ interface nsIMobileConnectionProvider : nsISupports
nsIDOMDOMRequest unlockCardLock(in nsIDOMWindow window, in jsval info); nsIDOMDOMRequest unlockCardLock(in nsIDOMWindow window, in jsval info);
nsIDOMDOMRequest setCardLock(in nsIDOMWindow window, in jsval info); nsIDOMDOMRequest setCardLock(in nsIDOMWindow window, in jsval info);
nsIDOMDOMRequest sendUSSD(in nsIDOMWindow window, in DOMString ussd); nsIDOMDOMRequest sendMMI(in nsIDOMWindow window, in DOMString mmi);
nsIDOMDOMRequest cancelUSSD(in nsIDOMWindow window); nsIDOMDOMRequest cancelMMI(in nsIDOMWindow window);
void sendStkResponse(in nsIDOMWindow window, void sendStkResponse(in nsIDOMWindow window,
in jsval command, in jsval command,

Просмотреть файл

@ -304,24 +304,24 @@ MobileConnection::SetCardLock(const jsval& aInfo, nsIDOMDOMRequest** aDomRequest
} }
NS_IMETHODIMP NS_IMETHODIMP
MobileConnection::SendUSSD(const nsAString& aUSSDString, MobileConnection::SendMMI(const nsAString& aMMIString,
nsIDOMDOMRequest** request) nsIDOMDOMRequest** request)
{ {
if (!mProvider) { if (!mProvider) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
return mProvider->SendUSSD(GetOwner(), aUSSDString, request); return mProvider->SendMMI(GetOwner(), aMMIString, request);
} }
NS_IMETHODIMP NS_IMETHODIMP
MobileConnection::CancelUSSD(nsIDOMDOMRequest** request) MobileConnection::CancelMMI(nsIDOMDOMRequest** request)
{ {
if (!mProvider) { if (!mProvider) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
return mProvider->CancelUSSD(GetOwner(), request); return mProvider->CancelMMI(GetOwner(), request);
} }
} // namespace network } // namespace network

Просмотреть файл

@ -55,11 +55,11 @@ const RIL_IPC_MSG_NAMES = [
"RIL:VoicemailNumberChanged", "RIL:VoicemailNumberChanged",
"RIL:CallError", "RIL:CallError",
"RIL:CardLockResult", "RIL:CardLockResult",
"RIL:UssdReceived", "RIL:USSDReceived",
"RIL:SendUssd:Return:OK", "RIL:SendMMI:Return:OK",
"RIL:SendUssd:Return:KO", "RIL:SendMMI:Return:KO",
"RIL:CancelUssd:Return:OK", "RIL:CancelMMI:Return:OK",
"RIL:CancelUssd:Return:KO", "RIL:CancelMMI:Return:KO",
"RIL:StkCommand", "RIL:StkCommand",
"RIL:StkSessionEnd", "RIL:StkSessionEnd",
"RIL:DataError" "RIL:DataError"
@ -409,27 +409,27 @@ RILContentHelper.prototype = {
return request; return request;
}, },
sendUSSD: function sendUSSD(window, ussd) { sendMMI: function sendMMI(window, mmi) {
debug("Sending USSD " + ussd); debug("Sending MMI " + mmi);
if (!window) { if (!window) {
throw Components.Exception("Can't get window object", throw Components.Exception("Can't get window object",
Cr.NS_ERROR_EXPECTED); Cr.NS_ERROR_EXPECTED);
} }
let request = Services.DOMRequest.createRequest(window); let request = Services.DOMRequest.createRequest(window);
let requestId = this.getRequestId(request); let requestId = this.getRequestId(request);
cpmm.sendAsyncMessage("RIL:SendUSSD", {ussd: ussd, requestId: requestId}); cpmm.sendAsyncMessage("RIL:SendMMI", {mmi: mmi, requestId: requestId});
return request; return request;
}, },
cancelUSSD: function cancelUSSD(window) { cancelMMI: function cancelMMI(window) {
debug("Cancel USSD"); debug("Cancel MMI");
if (!window) { if (!window) {
throw Components.Exception("Can't get window object", throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED); Cr.NS_ERROR_UNEXPECTED);
} }
let request = Services.DOMRequest.createRequest(window); let request = Services.DOMRequest.createRequest(window);
let requestId = this.getRequestId(request); let requestId = this.getRequestId(request);
cpmm.sendAsyncMessage("RIL:CancelUSSD", {requestId: requestId}); cpmm.sendAsyncMessage("RIL:CancelMMI", {requestId: requestId});
return request; return request;
}, },
@ -701,19 +701,19 @@ RILContentHelper.prototype = {
this.fireRequestError(msg.json.requestId, msg.json); this.fireRequestError(msg.json.requestId, msg.json);
} }
break; break;
case "RIL:UssdReceived": case "RIL:USSDReceived":
Services.obs.notifyObservers(null, kUssdReceivedTopic, Services.obs.notifyObservers(null, kUssdReceivedTopic,
msg.json.message); msg.json.message);
break; break;
case "RIL:SendUssd:Return:OK": case "RIL:SendMMI:Return:OK":
case "RIL:CancelUssd:Return:OK": case "RIL:CancelMMI:Return:OK":
request = this.takeRequest(msg.json.requestId); request = this.takeRequest(msg.json.requestId);
if (request) { if (request) {
Services.DOMRequest.fireSuccess(request, msg.json); Services.DOMRequest.fireSuccess(request, msg.json);
} }
break; break;
case "RIL:SendUssd:Return:KO": case "RIL:SendMMI:Return:KO":
case "RIL:CancelUssd:Return:KO": case "RIL:CancelMMI:Return:KO":
request = this.takeRequest(msg.json.requestId); request = this.takeRequest(msg.json.requestId);
if (request) { if (request) {
Services.DOMRequest.fireError(request, msg.json.errorMsg); Services.DOMRequest.fireError(request, msg.json.errorMsg);

Просмотреть файл

@ -69,8 +69,8 @@ const RIL_IPC_MOBILECONNECTION_MSG_NAMES = [
"RIL:GetCardLock", "RIL:GetCardLock",
"RIL:UnlockCardLock", "RIL:UnlockCardLock",
"RIL:SetCardLock", "RIL:SetCardLock",
"RIL:SendUSSD", "RIL:SendMMI",
"RIL:CancelUSSD", "RIL:CancelMMI",
"RIL:SendStkResponse", "RIL:SendStkResponse",
"RIL:SendStkMenuSelection", "RIL:SendStkMenuSelection",
"RIL:SendStkEventDownload", "RIL:SendStkEventDownload",
@ -371,13 +371,13 @@ RadioInterfaceLayer.prototype = {
this.saveRequestTarget(msg); this.saveRequestTarget(msg);
this.setCardLock(msg.json); this.setCardLock(msg.json);
break; break;
case "RIL:SendUSSD": case "RIL:SendMMI":
this.saveRequestTarget(msg); this.saveRequestTarget(msg);
this.sendUSSD(msg.json); this.sendMMI(msg.json);
break; break;
case "RIL:CancelUSSD": case "RIL:CancelMMI":
this.saveRequestTarget(msg); this.saveRequestTarget(msg);
this.cancelUSSD(msg.json); this.cancelMMI(msg.json);
break; break;
case "RIL:SendStkResponse": case "RIL:SendStkResponse":
this.sendStkResponse(msg.json); this.sendStkResponse(msg.json);
@ -507,15 +507,15 @@ RadioInterfaceLayer.prototype = {
case "iccmbdn": case "iccmbdn":
ppmm.broadcastAsyncMessage("RIL:VoicemailNumberChanged", message); ppmm.broadcastAsyncMessage("RIL:VoicemailNumberChanged", message);
break; break;
case "ussdreceived": case "USSDReceived":
debug("ussdreceived " + JSON.stringify(message)); debug("USSDReceived " + JSON.stringify(message));
this.handleUSSDReceived(message); this.handleUSSDReceived(message);
break; break;
case "sendussd": case "sendMMI":
this.handleSendUSSD(message); this.handleSendMMI(message);
break; break;
case "cancelussd": case "cancelMMI":
this.handleCancelUSSD(message); this.handleCancelMMI(message);
break; break;
case "stkcommand": case "stkcommand":
this.handleStkProactiveCommand(message); this.handleStkProactiveCommand(message);
@ -1290,20 +1290,20 @@ RadioInterfaceLayer.prototype = {
handleUSSDReceived: function handleUSSDReceived(ussd) { handleUSSDReceived: function handleUSSDReceived(ussd) {
debug("handleUSSDReceived " + JSON.stringify(ussd)); debug("handleUSSDReceived " + JSON.stringify(ussd));
ppmm.broadcastAsyncMessage("RIL:UssdReceived", ussd); ppmm.broadcastAsyncMessage("RIL:USSDReceived", ussd);
}, },
handleSendUSSD: function handleSendUSSD(message) { handleSendMMI: function handleSendMMI(message) {
debug("handleSendUSSD " + JSON.stringify(message)); debug("handleSendMMI " + JSON.stringify(message));
let messageType = message.success ? "RIL:SendUssd:Return:OK" : let messageType = message.success ? "RIL:SendMMI:Return:OK" :
"RIL:SendUssd:Return:KO"; "RIL:SendMMI:Return:KO";
this._sendRequestResults(messageType, message); this._sendRequestResults(messageType, message);
}, },
handleCancelUSSD: function handleCancelUSSD(message) { handleCancelMMI: function handleCancelMMI(message) {
debug("handleCancelUSSD " + JSON.stringify(message)); debug("handleCancelMMI " + JSON.stringify(message));
let messageType = message.success ? "RIL:CancelUssd:Return:OK" : let messageType = message.success ? "RIL:CancelMMI:Return:OK" :
"RIL:CancelUssd:Return:KO"; "RIL:CancelMMI:Return:KO";
this._sendRequestResults(messageType, message); this._sendRequestResults(messageType, message);
}, },
@ -1521,14 +1521,15 @@ RadioInterfaceLayer.prototype = {
requestId: requestId}); requestId: requestId});
}, },
sendUSSD: function sendUSSD(message) { sendMMI: function sendMMI(message) {
debug("SendUSSD " + JSON.stringify(message)); debug("SendMMI " + JSON.stringify(message));
// TODO: process MMI (in the next patch :) )
message.rilMessageType = "sendUSSD"; message.rilMessageType = "sendUSSD";
this.worker.postMessage(message); this.worker.postMessage(message);
}, },
cancelUSSD: function cancelUSSD(message) { cancelMMI: function cancelMMI(message) {
debug("Cancel pending USSD"); debug("Cancel pending MMI");
message.rilMessageType = "cancelUSSD"; message.rilMessageType = "cancelUSSD";
this.worker.postMessage(message); this.worker.postMessage(message);
}, },

Просмотреть файл

@ -4195,7 +4195,6 @@ RIL[REQUEST_SEND_USSD] = function REQUEST_SEND_USSD(length, options) {
if (DEBUG) { if (DEBUG) {
debug("REQUEST_SEND_USSD " + JSON.stringify(options)); debug("REQUEST_SEND_USSD " + JSON.stringify(options));
} }
options.rilMessageType = "sendussd";
options.success = options.rilRequestError == 0 ? true : false; options.success = options.rilRequestError == 0 ? true : false;
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError]; options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
this.sendDOMMessage(options); this.sendDOMMessage(options);
@ -4204,7 +4203,6 @@ RIL[REQUEST_CANCEL_USSD] = function REQUEST_CANCEL_USSD(length, options) {
if (DEBUG) { if (DEBUG) {
debug("REQUEST_CANCEL_USSD" + JSON.stringify(options)); debug("REQUEST_CANCEL_USSD" + JSON.stringify(options));
} }
options.rilMessageType = "cancelussd";
options.success = options.rilRequestError == 0 ? true : false; options.success = options.rilRequestError == 0 ? true : false;
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError]; options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
this.sendDOMMessage(options); this.sendDOMMessage(options);
@ -4631,7 +4629,7 @@ RIL[UNSOLICITED_ON_USSD] = function UNSOLICITED_ON_USSD() {
if (!message || message == "") { if (!message || message == "") {
return; return;
} }
this.sendDOMMessage({rilMessageType: "ussdreceived", this.sendDOMMessage({rilMessageType: "USSDReceived",
message: message}); message: message});
}; };
RIL[UNSOLICITED_NITZ_TIME_RECEIVED] = function UNSOLICITED_NITZ_TIME_RECEIVED() { RIL[UNSOLICITED_NITZ_TIME_RECEIVED] = function UNSOLICITED_NITZ_TIME_RECEIVED() {