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 107717 488d7455150a04ab245d08be5e56d74431828601
parent 107716 104de2989b52b2120d63ad0deb2dc8d52a428b92
child 107718 b359ecd8af2e159dfee1066fe0ea1a39c9f8f2c1
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewersphilikon
bugs790541
milestone18.0a1
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);
     }