WebAPI/WebIccManager/Multi-SIM: Difference between revisions

no edit summary
No edit summary
 
(4 intermediate revisions by one other user not shown)
Line 84: Line 84:


Remark: In either single-SIM or multi-SIM scenario, a system message 'icc-stkcommand' is required to launch STK app.
Remark: In either single-SIM or multi-SIM scenario, a system message 'icc-stkcommand' is required to launch STK app.
==== Stk system message ====
*Current B2G:
    window.navigator.mozSetMessageHandler('icc-stkcommand',
      function callHandleSTKCommand(message) {
        var command = message;
        ......
      });
* Multi-SIM:
    window.navigator.mozSetMessageHandler('icc-stkcommand',
      function callHandleSTKCommand(message) {
        var iccId = message.iccId; // The iccId of sim card that propagates this stk command.
        var command = message.command;
        ......
      });


==== Enumerate icc cards detected in device ====
==== Enumerate icc cards detected in device ====
Line 115: Line 131:


==== Icc Object Life Cycle ====
==== Icc Object Life Cycle ====
Icc object only be created when corresponding icc is detected by system. And becomes invalid after the it can not be detected by system any more.
Icc object only be created when corresponding icc is detected by system. And becomes invalid after it can not be detected by system.
* You can use IccManager to monitor this.
* You can use IccManager to monitor this.
     var iccManager = navigator.mozIccManager;
     var iccManager = navigator.mozIccManager;
Line 129: Line 145:
     }
     }


* If you already hold a reference for a specific icc object, you still can know it becomes to invalid via cardState or iccInfo.
* If you already hold a reference for a specific icc object, you can monitor this via cardState or iccInfo.
     var icc = iccManager.getIccById(iccId);
     var icc = iccManager.getIccById(iccId);
      
      
     icc.oncardstatechange = function () {
     icc.oncardstatechange = function () {
       if (icc.cardState === null) {
       if (icc.cardState === null) {
           // System can not detect this icc any more, this icc object becomes to invalid.
           // System can not detect this icc any more, this icc object becomes invalid.
       }
       }
     }
     }
Line 140: Line 156:
     icc.oniccinfochange = function () {
     icc.oniccinfochange = function () {
       if (icc.iccInfo === null) {
       if (icc.iccInfo === null) {
           // System can not detect this icc any more, this icc object becomes to invalid.
           // System can not detect this icc any more, this icc object becomes invalid.
       }
       }
     }
     }
Remark: Once the icc object becomes invalid, calling asynchronous functions raises exception.


=== Implementation ===
=== Implementation ===
Line 151: Line 169:
     void notifyStkCommand(in DOMString aMessage);
     void notifyStkCommand(in DOMString aMessage);
     void notifyStkSessionEnd();
     void notifyStkSessionEnd();
     <del>void notifyIccCardLockError(in DOMString lockType, in unsigned long retryCount);</del> // We are going to remove this in [https://bugzilla.mozilla.org/show_bug.cgi?id=873380 bug 873380]
     <del>void notifyIccCardLockError(in DOMString lockType, in unsigned long retryCount);</del> // This event has already been removed in bug 873380.
     void notifyCardStateChanged();
     void notifyCardStateChanged();
     void notifyIccInfoChanged();
     void notifyIccInfoChanged();
Line 195: Line 213:
* [https://bugzilla.mozilla.org/show_bug.cgi?id=814637 Bug 814637] for WebIccManager API. (Ongoing)
* [https://bugzilla.mozilla.org/show_bug.cgi?id=814637 Bug 814637] for WebIccManager API. (Ongoing)
* [https://bugzilla.mozilla.org/show_bug.cgi?id=926343 Bug 926343] for IccProvider interface. (Landed)
* [https://bugzilla.mozilla.org/show_bug.cgi?id=926343 Bug 926343] for IccProvider interface. (Landed)
[[Category:Web APIs]]
Confirmed users
1,340

edits