WebAPI/WebMobileConnection/Multi-SIM: Difference between revisions

no edit summary
No edit summary
 
(11 intermediate revisions by 3 users not shown)
Line 3: Line 3:


=== Web API ===
=== Web API ===
The change is quite simple, navigator.mozMobileConnection becomes an array of nsIDOMMozMobileConnection obect. API users can use 'serviceId' as an index to access corresponding service object.
The change is quite simple -- navigator.mozMobileConnection becomes an array of nsIDOMMozMobileConnection obect, i.e. navigator.mozMobileConnections. The length of the array is actually the number of services provided on a device. And the index of the array is used as 'serviceId.'


We don't modify the existed interface, like nsIDOMMozMobileConnection, nsIDOMMozMobileConnectionInfo ...etc, to minimize the coding effort of gaia.
We don't modify the existing interface, like nsIDOMMozMobileConnection, nsIDOMMozMobileConnectionInfo ...etc, to minimize the coding effort of gaia.


interface nsIMozNavigatorMobileConnectionManager: nsISupports
{
  // An array of nsIDOMMozMobileConnection.
  readonly attribute jsval mozMobileConnections;
};
  interface nsIDOMMozMobileConnection : nsIDOMEventTarget
  interface nsIDOMMozMobileConnection : nsIDOMEventTarget
  {
  {
   const long ICC_SERVICE_CLASS_DATA = (1 << 1);
   const long ICC_SERVICE_CLASS_VOICE = (1 << 0);
  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);
  const long ICC_SERVICE_CLASS_MAX = (1 << 7);
   
   
   readonly attribute DOMString lastKnownNetwork;
   readonly attribute DOMString lastKnownNetwork;
Line 23: Line 23:
   readonly attribute nsIDOMMozMobileConnectionInfo data;
   readonly attribute nsIDOMMozMobileConnectionInfo data;
   readonly attribute DOMString networkSelectionMode;
   readonly attribute DOMString networkSelectionMode;
   readonly attribute DOMString iccId;
   readonly attribute DOMString iccId; // The iccId of the icc card which is inserted in this client.
 
   nsIDOMDOMRequest getNetworks();
   nsIDOMDOMRequest getNetworks();
   nsIDOMDOMRequest selectNetwork(in nsIDOMMozMobileNetworkInfo network);
   nsIDOMDOMRequest selectNetwork(in nsIDOMMozMobileNetworkInfo network);
   nsIDOMDOMRequest selectNetworkAutomatically();
   nsIDOMDOMRequest selectNetworkAutomatically();
 
  nsIDOMDOMRequest setRoamingPreference(in DOMString mode);
  nsIDOMDOMRequest getRoamingPreference();
 
  nsIDOMDOMRequest setVoicePrivacyMode(in bool enabled);
  nsIDOMDOMRequest getVoicePrivacyMode();
 
   nsIDOMDOMRequest sendMMI(in DOMString mmi);
   nsIDOMDOMRequest sendMMI(in DOMString mmi);
   nsIDOMDOMRequest cancelMMI();
   nsIDOMDOMRequest cancelMMI();
 
   nsIDOMDOMRequest setCallForwardingOption(in nsIDOMMozMobileCFInfo CFInfo);
   nsIDOMDOMRequest setCallForwardingOption(in nsIDOMMozMobileCFInfo CFInfo);
   nsIDOMDOMRequest getCallForwardingOption(in unsigned short reason);
   nsIDOMDOMRequest getCallForwardingOption(in unsigned short reason);
   
  nsIDOMDOMRequest setCallBarringOption(in jsval option);
  nsIDOMDOMRequest getCallBarringOption(in jsval option);
  nsIDOMDOMRequest changeCallBarringPassword(in jsval info);
 
  nsIDOMDOMRequest setCallWaitingOption(in bool enabled);
  nsIDOMDOMRequest getCallWaitingOption();
 
  nsIDOMDOMRequest setCallingLineIdRestriction(in unsigned short clirMode);
  nsIDOMDOMRequest getCallingLineIdRestriction();
 
  nsIDOMDOMRequest exitEmergencyCbMode();
 
   [implicit_jscontext] attribute jsval onvoicechange;
   [implicit_jscontext] attribute jsval onvoicechange;
   [implicit_jscontext] attribute jsval ondatachange;
   [implicit_jscontext] attribute jsval ondatachange;
Line 38: Line 58:
   [implicit_jscontext] attribute jsval ondataerror;
   [implicit_jscontext] attribute jsval ondataerror;
   [implicit_jscontext] attribute jsval oncfstatechange;
   [implicit_jscontext] attribute jsval oncfstatechange;
  [implicit_jscontext] attribute jsval onemergencycbmodechange;
  [implicit_jscontext] attribute jsval onotastatuschange;
  [implicit_jscontext] attribute jsval oniccchange; // Icc card is inserted or removed.
  };
  };


Line 83: Line 106:
       var numberOfServices = window.navigator.mozMobileConnections.length;
       var numberOfServices = window.navigator.mozMobileConnections.length;


=== Implementation ===
=== Internal API and Implementation ===
mozMobileConnection becomes an array of nsIDOMMozMobileConnection in nsINavigatorMobileConnection.idl
Add clientId in the interface of nsIMobileConnectionProvider.idl and change the implementation of getVoiceConnectionInfo, getDataConnectionInfo, and getNetworkSelectionMode.


  interface nsIMozNavigatorMobileConnectionManager: nsISupports
  interface nsIMobileConnectionListener : nsISupports
  {
  {
   // An array of nsIDOMMozMobileConnection.
   void notifyVoiceChanged();
   readonly attribute jsval mozMobileConnections;
   void notifyDataChanged();
  void notifyUssdReceived(in DOMString message, in boolean sessionEnded);
  void notifyDataError(in DOMString message);
  void notifyCFStateChange(in boolean success, in unsigned short action, in unsigned short reason, in DOMString number, in unsigned short timeSeconds, in unsigned short serviceClass);
  void notifyEmergencyCbModeChanged(in boolean active, in unsigned long timeoutMs);
  void notifyOtaStatusChanged(in DOMString status);
  void notifyIccChanged();
  };
  };
Add subscriptionId in the interface of nsIMobileConnectionProvider.idl and change the implementation of getVoiceConnectionInfo, getDataConnectionInfo, and getNetworkSelectionMode.


  interface nsIMobileConnectionProvider: nsISupports
  interface nsIMobileConnectionProvider: nsISupports
  {
  {
   void registerMobileConnectionMsg(in unsigned long serviceId, in nsIMobileConnectionListener listener);
   void registerMobileConnectionMsg(in unsigned long clientId, in nsIMobileConnectionListener listener);
   void unregisterMobileConnectionMsg(in unsigned long serviceId, in nsIMobileConnectionListener listener);
   void unregisterMobileConnectionMsg(in unsigned long clientId, in nsIMobileConnectionListener listener);
 
  nsIDOMMozMobileConnectionInfo getVoiceConnectionInfo(in unsigned long clientId);
  nsIDOMMozMobileConnectionInfo getDataConnectionInfo(in unsigned long clientId);
  DOMString getNetworkSelectionMode(in unsigned long clientId);
  DOMString getIccId(in unsigned long clientId);
 
  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 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, in bool enabled);
  nsIDOMDOMRequest getVoicePrivacyMode(in unsigned long clientId, in nsIDOMWindow window);
    
    
   nsIDOMMozMobileConnectionInfo getVoiceConnectionInfo(in unsigned long subscriptionId);
   nsIDOMDOMRequest sendMMI(in unsigned long clientId, in nsIDOMWindow window, in DOMString mmi);
   nsIDOMMozMobileConnectionInfo getDataConnectionInfo(in unsigned long subscriptionId);
   nsIDOMDOMRequest cancelMMI(in unsigned long clientId, in nsIDOMWindow window);
  DOMString getNetworkSelectionMode(in unsigned long subscriptionId);
    
    
   nsIDOMDOMRequest getNetworks(in unsigned long subscriptionId, in nsIDOMWindow window);
   nsIDOMDOMRequest getCallForwardingOption(in unsigned long clientId, in nsIDOMWindow window, in unsigned short reason);
   nsIDOMDOMRequest selectNetwork(in unsigned long subscriptionId, in nsIDOMWindow window, in nsIDOMMozMobileNetworkInfo network);
   nsIDOMDOMRequest setCallForwardingOption(in unsigned long clientId, in nsIDOMWindow window, in nsIDOMMozMobileCFInfo CFInfo);
  nsIDOMDOMRequest selectNetworkAutomatically(in unsigned long subscriptionId, in nsIDOMWindow window);
    
    
   nsIDOMDOMRequest sendMMI(in unsigned long subscriptionId, in nsIDOMWindow window, in DOMString mmi);
   nsIDOMDOMRequest getCallBarringOption(in unsigned long clientId, in nsIDOMWindow window, in jsval option);
   nsIDOMDOMRequest cancelMMI(in unsigned long subscriptionId, in nsIDOMWindow window);
   nsIDOMDOMRequest setCallBarringOption(in unsigned long clientId, in nsIDOMWindow window, in jsval option);
  nsIDOMDOMRequest changeCallBarringPassword(in unsigned long clientId, in nsIDOMWindow window, in jsval info);
 
  nsIDOMDOMRequest setCallWaitingOption(in unsigned long clientId, in nsIDOMWindow window, in bool enabled);
  nsIDOMDOMRequest getCallWaitingOption(in unsigned long clientId, in nsIDOMWindow window);
 
  nsIDOMDOMRequest setCallingLineIdRestriction(in unsigned long clientId, in nsIDOMWindow window, in unsigned short clirMode);
  nsIDOMDOMRequest getCallingLineIdRestriction(in unsigned long clientId, in nsIDOMWindow window);
 
  nsIDOMDOMRequest exitEmergencyCbMode(in unsigned long clientId, in nsIDOMWindow window);
  };
  };


Line 128: Line 177:
This is the proposal architecture supporting the multi-SIM card.  
This is the proposal architecture supporting the multi-SIM card.  


The 'MobileConnectionManager' creates and manages all MobileConnection objects for every SIM and the main task of MobileConnectionManager is to handle the interactive and synchronizing functions between MobileConnections. All ICC/Network/Data functions of each SIM are still handled by each MobileConnection.
MobileConnection becomes an array of nsIDOMMozMobileConnection obect. API users can use 'serviceId' as an index to access corresponding service object.


[[File:MobileConnection.jpg|480x360px|New MobileConnection Architecture]]
[[File:MobileConnection.jpg|480x360px|New MobileConnection Architecture]]
Line 137: Line 186:


== Status ==
== Status ==
* [https://bugzilla.mozilla.org/show_bug.cgi?id=814629 bug 814629] for WebMobileConnection API. (Ongoing)
* [https://bugzilla.mozilla.org/show_bug.cgi?id=814629 bug 814629] for WebMobileConnection API. (Landed)
* [https://bugzilla.mozilla.org/show_bug.cgi?id=818353 bug 818353] for adding subscriptId in backend implementation. (Ongoing)
* [https://bugzilla.mozilla.org/show_bug.cgi?id=818353 bug 818353] for adding subscriptId in backend implementation. (Landed)
 
[[Category:Web APIs]]
Confirmed users
1,340

edits