Hi there,
Due to the difficulties of parsing MMI code on gaia, we are working on |*Bug 1058398* <
https://bugzilla.mozilla.org/show_bug.cgi?id=1058398> - [meta][B2G][Telephony] streamline mobileConnection.sendMMI(), mobileConnection.cancelMMI() and telephony.dial()| to provide full MMI support on gecko.
* The 1st goal is, gaia doesn't have to distinguish if a string is a call number or a MMI code. mozTelephony.dial() would do all the magic for API users.
More details:*Bug 889737* <
https://bugzilla.mozilla.org/show_bug.cgi?id=889737> - [MMI] Unify both sendMMI() and dial() functions
* The 2nd one is,to provide a separate API for user to send data within a ussd session, becausewhen you are in a USSD session the rules of MMI don't apply to the data being exchanged in that session.
More details:*Bug 1058397* <
https://bugzilla.mozilla.org/show_bug.cgi?id=1058397> - [B2G][Telephony] add UssdSession API
Thus, acceptance criteria are summarized as:
1a. use telephony to dial an MMI code in addition to a normal call number
1b. know the dialling number is an MMI code ASAP so that we could show a different UI
1c. know the response of that MMI code request
2. when receiving a ussd, could reply in that ussd session
== Proposal of Goal #1 ==
To achieve those criteria, we propose:
telephony.dial("some number here") will return a promise and there are 3 possible consequences:
1. rejected when error occur.
2. resolved as a TelephonyCall => it's a call
3. resolved as an DOMRequest => it's an MMI code request, and gecko is currently handle the request. When the request finishes, 'success' or 'error' event will be triggered on DOMRequest object.
In sum, the new API looks:
partial interface Telephony
{
Promise<(TelephonyCall or DOMRequest)> dial(DOMString number, optional unsigned long serviceId);
};
And, we don't need "MobileConnection::SendMMI" anymore.
== Proposal of Goal #2 ==
When user receives a ussdreceived event, user could reply in that session.
partial interface Telephony
{
attribute EventHandler onussdreceived;
};
interface USSDReceivedEvent : Event
{
readonly attribute unsingned long serviceId;
readonly attribute DOMString? message;
readonly attribute MozUssdSession? session;
};
USSDReceivedEvent::SessionEnded is removed because in the new API user could tell if the session is terminated from the nullable session. If session is null, that means it's ended.
interface MozUssdSession
{
DOMRequest send(DOMString ussd);
};
With the new design, "MobileConnection::Onussdreceived" is removed as well as MobileConnection::CancelMMI().
CancelMMI was designed for cancelling any existing ussd session when we init the dialer appto make sure we're not accidentally sending the data on an existing session.
If you are interested in the API change, welcome to visit bugzilla and join our discussion there! Thank you :)
Best regards,
Hsinyi
--
Hsin-Yi Tsai 蔡欣宜
Mozilla Taiwan
T:
+886-2-87861100 ext:312
ht...@mozilla.com