WebAPI/WebMobileConnection/Multi-SIM

From MozillaWiki
Jump to navigation Jump to search

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 create and manage all MobileConnection objects for every SIM and the MobileConnection still handle all ICC/Network/Data functions for SIM. The main task of MobileConnectionManager is to handle the interactive and synchronizing functions between SIMs.

New MobileConnection Architecture

RIL Implementation

Discussion