WebAPI/WebMobileConnection/Multi-SIM: Difference between revisions
Line 4: | Line 4: | ||
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. | 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 jsval mobileConnections; | ||
readonly attribute nsIDOMMozMobileConnection defaultMobileConnection; | 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 DOMString state; | ||
readonly attribute bool connected; | readonly attribute bool connected; | ||
readonly attribute bool emergencyCallsOnly; | readonly attribute bool emergencyCallsOnly; | ||
readonly attribute bool roaming; | readonly attribute bool roaming; | ||
readonly attribute nsIDOMMozMobileNetworkInfo network; | readonly attribute nsIDOMMozMobileNetworkInfo network; | ||
readonly attribute DOMString type; | readonly attribute DOMString type; | ||
readonly attribute jsval signalStrength; | readonly attribute jsval signalStrength; | ||
readonly attribute jsval relSignalStrength; | readonly attribute jsval relSignalStrength; | ||
readonly attribute nsIDOMMozMobileCellInfo cell; | readonly attribute nsIDOMMozMobileCellInfo cell; | ||
}; | }; | ||
=== Use Case === | === Use Case === |
Revision as of 07:50, 20 February 2013
Proposal: WebMobileConnectionManager 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'); ...
Implementation
Use nsIMozNavigatorMobileConnectionManager to instead of nsIMozNavigatorMobileConnection in nsINavigatorMobileConnection.idl.
interface nsIMozNavigatorMobileConnectionManager: nsISupports {
readonly attribute nsIDOMMozMobileConnectionManager mozMobileConnectionManager;
};
Add subscription ID in the interface of nsIMobileConnectionProvider.idl and change the implementation of getCardState, getIccInfo, getVoiceConnectionInfo, getDataConnectionInfo, and getNetworkSelectionMode.
interface nsIMobileConnectionProvider: nsISupports {
void registerMobileConnectionMsg(in unsigned long subscriptionId); DOMString getCardState(in unsigned long subscriptionId); nsIDOMMozMobileICCInfo getIccInfo(in unsigned long subscriptionId); nsIDOMMozMobileConnectionInfo getVoiceConnectionInfo(in unsigned long subscriptionId); nsIDOMMozMobileConnectionInfo getDataConnectionInfo(in unsigned long subscriptionId); DOMString getNetworkSelectionMode(in unsigned long subscriptionId); nsIDOMDOMRequest getNetworks(in nsIDOMWindow window, in unsigned long subscriptionId); nsIDOMDOMRequest selectNetwork(in nsIDOMWindow window, in nsIDOMMozMobileNetworkInfo network, in unsigned long subscriptionId); nsIDOMDOMRequest selectNetworkAutomatically(in nsIDOMWindow window, in unsigned long subscriptionId); nsIDOMDOMRequest getCardLock(in nsIDOMWindow window, in DOMString lockType, in unsigned long subscriptionId); nsIDOMDOMRequest unlockCardLock(in nsIDOMWindow window, in jsval info, in unsigned long subscriptionId); nsIDOMDOMRequest setCardLock(in nsIDOMWindow window, in jsval info, in unsigned long subscriptionId); nsIDOMDOMRequest sendMMI(in nsIDOMWindow window, in DOMString mmi, in unsigned long subscriptionId); nsIDOMDOMRequest cancelMMI(in nsIDOMWindow window, in unsigned long subscriptionId); void sendStkResponse(in nsIDOMWindow window, in jsval command, in jsval response); void sendStkMenuSelection(in nsIDOMWindow window, in unsigned short itemIdentifier, in boolean helpRequested); void sendStkEventDownload(in nsIDOMWindow window, in jsval event);
};
The data structures of cardState, iccInfo, voiceConnectionInfo, dataConnectionInfo, and networkSelectionMode are changed to be the array format in RILContentHelper.js for storing the information among different SIM.
// nsIRILContentHelper cardState: [], iccInfo: [], voiceConnectionInfo: [], dataConnectionInfo: [], networkSelectionMode: [],
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.
Proposal Architecture for Multi-SIM
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.
RIL Implementation
- Please refer to WebTelephony/Multi-SIM RIL implementation .