Bug 790543 - Part 2: Add SET_UP_EVENT_LIST in RIL. r=philikon
authorYoshi Huang <allstars.chh@mozilla.com>
Tue, 11 Sep 2012 10:57:54 +0800
changeset 108107 7006a89424bfac95719b779d7e677227b011bd37
parent 108106 99ff1aef50a29d583e419c7b05a55bfd1e0826dd
child 108108 447a1f0979e949d6c64ac8c8d15f3a5f8e22f2fb
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewersphilikon
bugs790543
milestone18.0a1
Bug 790543 - Part 2: Add SET_UP_EVENT_LIST in RIL. r=philikon
dom/system/gonk/ril_consts.js
dom/system/gonk/ril_worker.js
--- a/dom/system/gonk/ril_consts.js
+++ b/dom/system/gonk/ril_consts.js
@@ -530,31 +530,33 @@ const COMPREHENSIONTLV_TAG_DURATION = 0x
 const COMPREHENSIONTLV_TAG_ALPHA_ID = 0x05;
 const COMPREHENSIONTLV_TAG_ADDRESS = 0x06;
 const COMPREHENSIONTLV_TAG_TEXT_STRING = 0x0d;
 const COMPREHENSIONTLV_TAG_ITEM = 0x0f;
 const COMPREHENSIONTLV_TAG_ITEM_ID = 0x10;
 const COMPREHENSIONTLV_TAG_RESPONSE_LENGTH = 0x11;
 const COMPREHENSIONTLV_TAG_HELP_REQUEST = 0x15;
 const COMPREHENSIONTLV_TAG_DEFAULT_TEXT = 0x17;
+const COMPREHENSIONTLV_TAG_EVENT_LIST = 0x19;
 const COMPREHENSIONTLV_TAG_ICON_ID = 0x1e;
 const COMPREHENSIONTLV_TAG_ICON_ID_LIST = 0x1f;
 const COMPREHENSIONTLV_TAG_IMMEDIATE_RESPONSE = 0x2b;
 const COMPREHENSIONTLV_TAG_URL = 0x31;
 
 // Device identifiers, see TS 11.14, clause 12.7
 const STK_DEVICE_ID_KEYPAD = 0x01;
 const STK_DEVICE_ID_DISPLAY = 0x02;
 const STK_DEVICE_ID_EARPIECE = 0x03;
 const STK_DEVICE_ID_SIM = 0x81;
 const STK_DEVICE_ID_ME = 0x82;
 const STK_DEVICE_ID_NETWORK = 0x83;
 
 // STK Proactive commands.
 const STK_CMD_REFRESH = 0x01;
+const STK_CMD_SET_UP_EVENT_LIST = 0x05;
 const STK_CMD_SET_UP_CALL = 0x10;
 const STK_CMD_SEND_SS = 0x11;
 const STK_CMD_SEND_USSD = 0x12;
 const STK_CMD_SEND_SMS = 0x13;
 const STK_CMD_SEND_DTMF = 0x14;
 const STK_CMD_LAUNCH_BROWSER = 0x15;
 const STK_CMD_DISPLAY_TEXT = 0x21;
 const STK_CMD_GET_INKEY = 0x22;
@@ -693,16 +695,34 @@ const STK_PRESENTATION_TYPE_NOT_SPECIFIE
 const STK_PRESENTATION_TYPE_DATA_VALUES = 0x01; // Bit 1 is 1, bit 2 is 0.
 const STK_PRESENTATION_TYPE_NAVIGATION_OPTIONS = 0x03; // Bit 1 is 1, bit 2 is 1.
 
 // STK Coding Scheme.
 const STK_TEXT_CODING_GSM_7BIT_PACKED = 0x00;
 const STK_TEXT_CODING_GSM_8BIT = 0x04;
 const STK_TEXT_CODING_UCS2 = 0x08;
 
+// STK Event List.
+const STK_EVENT_TYPE_MT_CALL = 0x00;
+const STK_EVENT_TYPE_CALL_CONNECTED = 0x01;
+const STK_EVENT_TYPE_CALL_DISCONNECTED = 0x02;
+const STK_EVENT_TYPE_LOCATION_STATUS = 0x03;
+const STK_EVENT_TYPE_USER_ACTIVITY = 0x04;
+const STK_EVENT_TYPE_IDLE_SCREEN_AVAILABLE = 0x05;
+const STK_EVENT_TYPE_CARD_READER_STATUS = 0x06;
+const STK_EVENT_TYPE_LANGUAGE_SELECTION = 0x07;
+const STK_EVENT_TYPE_BROWSER_TERMINATION = 0x08;
+const STK_EVENT_TYPE_DATA_AVAILABLE = 0x09;
+const STK_EVENT_TYPE_CHANNEL_STATUS = 0x0a;
+const STK_EVENT_TYPE_SINGLE_ACCESS_TECHNOLOGY_CHANGED = 0x0b;
+const STK_EVENT_TYPE_DISPLAY_PARAMETER_CHANGED = 0x0c;
+const STK_EVENT_TYPE_LOCAL_CONNECTION = 0x0d;
+const STK_EVENT_TYPE_NETWORK_SEARCH_MODE_CHANGED = 0x0e;
+const STK_EVENT_TYPE_BROWSING_STATUS = 0x0f;
+
 /**
  * (U)SIM Services.
  *
  * @see 3GPP TS 51.011 10.3.7 (SIM) and 3GPP TS 31.102 4.2.8 (USIM).
  */
 const GECKO_ICC_SERVICES = {
   sim: {
     ADN: 2,
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -5612,16 +5612,19 @@ let GsmPDUHelper = {
     Buf.writeUint16(0);
   },
 };
 
 let StkCommandParamsFactory = {
   createParam: function createParam(cmdDetails, ctlvs) {
     let param;
     switch (cmdDetails.typeOfCommand) {
+      case STK_CMD_SET_UP_EVENT_LIST:
+        param = this.processSetUpEventList(cmdDetails, ctlvs);
+        break;
       case STK_CMD_SET_UP_MENU:
       case STK_CMD_SELECT_ITEM:
         param = this.processSelectItem(cmdDetails, ctlvs);
         break;
       case STK_CMD_DISPLAY_TEXT:
         param = this.processDisplayText(cmdDetails, ctlvs);
         break;
       case STK_CMD_SET_UP_IDLE_MODE_TEXT:
@@ -5648,16 +5651,37 @@ let StkCommandParamsFactory = {
       default:
         debug("unknown proactive command");
         break;
     }
     return param;
   },
 
   /**
+   * Construct a param for Set Up Event list.
+   *
+   * @param cmdDetails
+   *        The value object of CommandDetails TLV.
+   * @param ctlvs
+   *        The all TLVs in this proactive command.
+   */
+  processSetUpEventList: function processSetUpEventList(cmdDetails, ctlvs) {
+    let ctlv = StkProactiveCmdHelper.searchForTag(
+        COMPREHENSIONTLV_TAG_EVENT_LIST, ctlvs);
+    if (!ctlv) {
+      RIL.sendStkTerminalResponse({
+        command: cmdDetails,
+        resultCode: STK_RESULT_REQUIRED_VALUES_MISSING});
+      throw new Error("Stk Event List: Required value missing : Event List");
+    }
+
+    return ctlv.value || {eventList: null};
+  },
+
+  /**
    * Construct a param for Select Item.
    *
    * @param cmdDetails
    *        The value object of CommandDetails TLV.
    * @param ctlvs
    *        The all TLVs in this proactive command.
    */
   processSelectItem: function processSelectItem(cmdDetails, ctlvs) {
@@ -5915,16 +5939,18 @@ let StkProactiveCmdHelper = {
       case COMPREHENSIONTLV_TAG_ITEM:
         return this.retrieveItem(length);
       case COMPREHENSIONTLV_TAG_ITEM_ID:
         return this.retrieveItemId(length);
       case COMPREHENSIONTLV_TAG_RESPONSE_LENGTH:
         return this.retrieveResponseLength(length);
       case COMPREHENSIONTLV_TAG_DEFAULT_TEXT:
         return this.retrieveDefaultText(length);
+      case COMPREHENSIONTLV_TAG_EVENT_LIST:
+        return this.retrieveEventList(length);
       case COMPREHENSIONTLV_TAG_IMMEDIATE_RESPONSE:
         return this.retrieveImmediaResponse(length);
       case COMPREHENSIONTLV_TAG_URL:
         return this.retrieveUrl(length);
       default:
         debug("StkProactiveCmdHelper: unknown tag " + tag.toString(16));
         Buf.seekIncoming(length * PDU_HEX_OCTET_SIZE);
         return null;
@@ -6090,16 +6116,31 @@ let StkProactiveCmdHelper = {
    *
    * Same as Text String.
    */
   retrieveDefaultText: function retrieveDefaultText(length) {
     return this.retrieveTextString(length);
   },
 
   /**
+   * Event List.
+   */
+  retrieveEventList: function retrieveEventList(length) {
+    if (!length) {
+      // null means an indication to ME to remove the existing list of events
+      // in ME.
+      return null;
+    }
+
+    return {
+      eventList: GsmPDUHelper.readHexOctetArray(length)
+    };
+  },
+
+  /**
    * Immediate Response.
    *
    * | Byte  | Description            | Length |
    * |  1    | Immediate Response Tag |   1    |
    * |  2    | Length = 00            |   1    |
    */
   retrieveImmediaResponse: function retrieveImmediaResponse(length) {
     return {};