WebAPI/WebMobileConnection/Multi-SIM: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
Line 70: Line 70:


=== Current Architecture ===
=== Current Architecture ===
This is the current architecture supporting a single SIM card. Only one mobile connection to handle all event.
This is the current architecture supporting a single SIM card. Only one mobile connection to handle all events for ICC/Network/Data functions.


[[File:CurrMobileConnectionMgr.png|480x640px|MobileConnection Architecture]]
[[File:CurrMobileConnectionMgr.png|480x640px|MobileConnection Architecture]]

Revision as of 07:09, 15 November 2012

Proposal: WebMobileConnection API for Multi-SIM

Currently B2G supports a single SIM architecture. This proposal wants to extend it for supporting multi-SIMs. Here, we introduce a central 'nsIDOMMozMobileConnectionManager' to manage several nsIDOMMozMobileConnection objects. One nsIDOMMozMobileConnection object is binded to a physical SIM slot.

nsIDOMMozMobileConnectionManager will handle the interactive and synchronizing functions between nsIDOMMozMobileConnection objects in the future. For example, when data connection via SIM1 is no longer available, nsIDOMMobileConnectionManager will establish data connection via SIM2 for upper layers.

Web API

Following are what we create for nsIDOMMozMobileConnectionManager.

interface nsIDOMMozMobileConnectionManager : nsIDOMEventTarget {

 readonly attribute jsval mobileConnections;
 readonly attribute nsIDOMMozMobileConnection defaultMobileConnection;

};

We don't modify the interface of nsIDOMMozMobileConnectionInfo to minimize the coding effort of gaia.

interface nsIDOMMozMobileConnectionInfo : nsISupports {

 readonly attribute DOMString state;
 readonly attribute bool connected;
 readonly attribute bool emergencyCallsOnly;
 readonly attribute bool roaming;
 readonly attribute nsIDOMMozMobileNetworkInfo network;
 readonly attribute DOMString type;
 readonly attribute jsval signalStrength;
 readonly attribute jsval relSignalStrength;
 readonly attribute nsIDOMMozMobileCellInfo cell;

};

Use Case

Listen Connection Status

  • Current B2G (Single SIM)
     ...
     var conn = window.navigator.mozMobileConnection;
     if (conn) {
       conn.addEventListener('voicechange', this);
       conn.addEventListener('datachange', this);
     ...
  • Multi-SIMs
     ...
     var conn = window.navigator.mozMobileConnectionManager.defaultMobileConnection;
     if (conn) {
       conn.addEventListener('voicechange', this);
       conn.addEventListener('datachange', this);
     ...

Get ICC Status

  • Current B2G (Single SIM)
     ...
       var mobileConnection=window.navigator.mozMobileConnection;
       var req = mobileConnection.getCardLock('pin');
     ...
  • Multi-SIMs
     ...
     var mobileConnection= window.navigator.mozMobileConnectionManager.defaultMobileConnection;
     var req = mobileConnection.getCardLock('pin');
     ...

Proposal: Architecture

Current Architecture

This is the current architecture supporting a single SIM card. Only one mobile connection to handle all events for ICC/Network/Data functions.

MobileConnection Architecture

Proposal Architecture for Multi-SIM

This is the proposal architecture supporting the multi-SIM card. To add 'MobileConnectionManager' to manage all MobileConnection objects. The MobileConnectionManager creates the MobileConnection object for every SIM and the MobileConnection handles the ICC/Network/Data functions for SIM. The MobileConnectionManager only handles the interactive and synchronizing functions between SIMs.

New MobileConnection Architecture

RIL Implementation

Discussion