WebAPI/WebIccManager/Multi-SIM: Difference between revisions
< WebAPI
Jump to navigation
Jump to search
(→Stk) |
|||
| Line 45: | Line 45: | ||
==== Stk ==== | ==== Stk ==== | ||
*Current B2G: | *Current B2G: | ||
var icc = navigator.mozMobileConnection.icc; | |||
icc.onstkcommand = function (evt) { | icc.onstkcommand = function (evt) { | ||
var command = evt.command; | var command = evt.command; | ||
| Line 51: | Line 52: | ||
} | } | ||
} | } | ||
icc.sendStkResponse(command, response); | |||
* Multi-SIM: | * Multi-SIM: | ||
var iccManager = navigator.mozIccManager; | |||
var icc = iccManager.getIccById(iccId); | var icc = iccManager.getIccById(iccId); | ||
icc.onstkcommand = function (evt) { | icc.onstkcommand = function (evt) { | ||
| Line 60: | Line 64: | ||
} | } | ||
} | } | ||
icc.sendStkResponse(command, response); | |||
Revision as of 11:14, 24 September 2013
Proposal: WebIccManager API for Multi-SIM
Currently B2G supports a single SIM architecture. This proposal wants to extend WebIccManager to support multi-SIMs. In multi-SIM device, each SIM card is independent and has it own information and operation. Here we introduce multiple nsIDOMMozIcc objects, each instance represents a icc card, you can use iccId as index to get corresponding icc object.
Web API
interface nsIDOMMozIcc : nsIDOMEventTarget
{
readonly attribute nsIDOMMozMobileICCInfo iccInfo;
readonly attribute DOMString cardState;
readonly attribute long retryCount;
nsIDOMDOMRequest getCardLock(in DOMString lockType);
nsIDOMDOMRequest unlockCardLock(in jsval info);
nsIDOMDOMRequest setCardLock(in jsval info);
void sendStkResponse(in jsval command, in jsval response);
void sendStkMenuSelection(in unsigned short itemIdentifier, in boolean helpRequested);
void sendStkTimerExpiration(in jsval timer);
void sendStkEventDownload(in jsval event);
nsIDOMDOMRequest readContacts(in DOMString contactType);
nsIDOMDOMRequest updateContact(in DOMString contactType, in nsIDOMContact contact, [optional] in DOMString pin2);
nsIDOMDOMRequest iccOpenChannel(in DOMString aid);
nsIDOMDOMRequest iccExchangeAPDU(in long channel, in jsval apdu);
nsIDOMDOMRequest iccCloseChannel(in long channe);
[implicit_jscontext] attribute jsval onstkcommand;
[implicit_jscontext] attribute jsval onstksessionend;
[implicit_jscontext] attribute jsval onicccardlockerror;
[implicit_jscontext] attribute jsval oniccinfochange;
[implicit_jscontext] attribute jsval oncardstatechange;
}
interface nsIDOMMozIccManager : nsIDOMEventTarget
{
readonly attribute jsval iccIds;
nsIDOMMozIcc getIccById(in DOMString iccId);
[implicit_jscontext] attribute jsval oniccadd;
[implicit_jscontext] attribute jsval oniccremove;
}
Use Case
Stk
- Current B2G:
var icc = navigator.mozMobileConnection.icc;
icc.onstkcommand = function (evt) {
var command = evt.command;
switch (command.typeOfCommand) {
...
}
}
icc.sendStkResponse(command, response);
- Multi-SIM:
var iccManager = navigator.mozIccManager;
var icc = iccManager.getIccById(iccId);
icc.onstkcommand = function (evt) {
var command = evt.command;
switch (command.typeOfCommand) {
...
}
}
icc.sendStkResponse(command, response);