Bug 788441: Add alphanumeric parsing. r=vyang, a=tef+
authorVicamo Yang <vyang@mozilla.com>
Sat, 30 Mar 2013 17:02:37 +0800
changeset 118661 b28463f2e718f823eef637b107fe7f2a3aa89107
parent 118660 56c922308fd11af266a8eee6fec2a4c52e884021
child 118662 ccec751a468e42b070f6f2fbeda3ca7da4790ab1
push id73
push uservyang@mozilla.com
push dateSat, 30 Mar 2013 09:03:19 +0000
reviewersvyang, tef
bugs788441
milestone18.0
Bug 788441: Add alphanumeric parsing. r=vyang, a=tef+
dom/system/gonk/ril_worker.js
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -7111,30 +7111,35 @@ let GsmPDUHelper = {
     }
     if (len % 2 == 1) {
       len += 1;
     }
     if (DEBUG) debug("PDU: Going to read address: " + len);
 
     // Type-of-Address
     let toa = this.readHexOctet();
-
-    // Address-Value
-    let addr = this.readSwappedNibbleBcdString(len / 2);
+    let addr = "";
+
+    if ((toa & 0xF0) == PDU_TOA_ALPHANUMERIC) {
+      addr = this.readSeptetsToString(Math.floor(len * 4 / 7), 0,
+          PDU_NL_IDENTIFIER_DEFAULT , PDU_NL_IDENTIFIER_DEFAULT );
+      return addr;
+    }
+    addr = this.readSwappedNibbleBcdString(len / 2);
     if (addr.length <= 0) {
       if (DEBUG) debug("PDU error: no number provided");
       return null;
     }
-    if ((toa >> 4) == (PDU_TOA_INTERNATIONAL >> 4)) {
+    if ((toa & 0xF0) == (PDU_TOA_INTERNATIONAL)) {
       addr = '+' + addr;
     }
 
     return addr;
   },
-  
+
   /**
    * Read Alpha Identifier.
    *
    * @see TS 131.102
    *
    * @param numOctets
    *        Number of octets to be read.
    *