Bug 790541 - B2G STK: Revise implementation of sendICCEnvelopeCommand. r=philikon
authorYoshi Huang <allstars.chh@mozilla.com>
Tue, 11 Sep 2012 10:40:24 +0800
changeset 107575 488d7455150a04ab245d08be5e56d74431828601
parent 107574 104de2989b52b2120d63ad0deb2dc8d52a428b92
child 107576 b359ecd8af2e159dfee1066fe0ea1a39c9f8f2c1
push id15119
push useryhuang@mozilla.com
push dateThu, 20 Sep 2012 06:01:30 +0000
treeherdermozilla-inbound@488d7455150a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersphilikon
bugs790541
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 790541 - B2G STK: Revise implementation of sendICCEnvelopeCommand. r=philikon
dom/system/gonk/ril_worker.js
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -2234,44 +2234,51 @@ let RIL = {
 
   /**
    * Send STK Envelope(Menu Selection) command.
    *
    * @param itemIdentifier
    * @param helpRequested
    */
   sendStkMenuSelection: function sendStkMenuSelection(command) {
+    command.tag = BER_MENU_SELECTION_TAG;
+    command.deviceId = {
+      sourceId :STK_DEVICE_ID_KEYPAD,
+      destinationId: STK_DEVICE_ID_SIM
+    };
     this.sendICCEnvelopeCommand(command);
   },
 
   /**
    * Send REQUEST_STK_SEND_ENVELOPE_COMMAND to ICC.
    *
+   * @param tag
+   * @patam deviceId
    * @param [optioanl] itemIdentifier
    * @param [optional] helpRequested
    */
   sendICCEnvelopeCommand: function sendICCEnvelopeCommand(options) {
     let token = Buf.newParcel(REQUEST_STK_SEND_ENVELOPE_COMMAND);
     let berLen = 4 + /* Size of Device Identifier TLV */
                  (options.itemIdentifier ? 3 : 0) +
                  (options.helpRequested ? 2 : 0);
     let size = (2 + berLen) * 2;
 
     Buf.writeUint32(size);
 
     // Write a BER-TLV
-    GsmPDUHelper.writeHexOctet(BER_MENU_SELECTION_TAG);
+    GsmPDUHelper.writeHexOctet(options.tag);
     GsmPDUHelper.writeHexOctet(berLen);
 
     // Device Identifies
     GsmPDUHelper.writeHexOctet(COMPREHENSIONTLV_TAG_DEVICE_ID |
                                COMPREHENSIONTLV_FLAG_CR);
     GsmPDUHelper.writeHexOctet(2);
-    GsmPDUHelper.writeHexOctet(STK_DEVICE_ID_KEYPAD);
-    GsmPDUHelper.writeHexOctet(STK_DEVICE_ID_SIM);
+    GsmPDUHelper.writeHexOctet(options.deviceId.sourceId);
+    GsmPDUHelper.writeHexOctet(options.deviceId.destinationId);
 
     // Item Identifier
     if (options.itemIdentifier) {
       GsmPDUHelper.writeHexOctet(COMPREHENSIONTLV_TAG_ITEM_ID |
                                  COMPREHENSIONTLV_FLAG_CR);
       GsmPDUHelper.writeHexOctet(1);
       GsmPDUHelper.writeHexOctet(options.itemIdentifier);
     }