private String readAnrRecord(int recNum, int pbrIndex) {
   byte[] anrRec = null;
   if (!hasRecordIn(mAnrFileRecord, pbrIndex)) return null;
   try {
     anrRec = mAnrFileRecord.get(pbrIndex).get(recNum);
   } catch (IndexOutOfBoundsException e) {
     return null;
   }
   int numberLength = 0xff & anrRec[1];
   if (numberLength > MAX_NUMBER_SIZE_BYTES) {
     Log.e(LOG_TAG, "Invalid number length in anr record");
     return "";
   }
   String anr = PhoneNumberUtils.calledPartyBCDToString(anrRec, 2, numberLength);
   return anr;
 }
예제 #2
0
  /** alphaTag and number are set to null on invalid format */
  @DSComment("Private Method")
  @DSBan(DSCat.PRIVATE_METHOD)
  @DSGenerator(
      tool_name = "Doppelganger",
      tool_version = "2.0",
      generated_on = "2013-12-30 12:59:17.045 -0500",
      hash_original_method = "C94E0153AA9A00481672837ABFA310B4",
      hash_generated_method = "FAE8FCC29597D474481255BC020DEE6C")
  private void parseRecord(byte[] record) {
    try {
      alphaTag = IccUtils.adnStringFieldToString(record, 0, record.length - FOOTER_SIZE_BYTES);

      int footerOffset = record.length - FOOTER_SIZE_BYTES;

      int numberLength = 0xff & record[footerOffset];

      if (numberLength > MAX_NUMBER_SIZE_BYTES) {
        // Invalid number length
        number = "";
        return;
      }

      // Please note 51.011 10.5.1:
      //
      // "If the Dialling Number/SSC String does not contain
      // a dialling number, e.g. a control string deactivating
      // a service, the TON/NPI byte shall be set to 'FF' by
      // the ME (see note 2)."

      number = PhoneNumberUtils.calledPartyBCDToString(record, footerOffset + 1, numberLength);

      extRecord = 0xff & record[record.length - 1];

      emails = null;

    } catch (RuntimeException ex) {
      Log.w(LOG_TAG, "Error parsing AdnRecord", ex);
      number = "";
      alphaTag = "";
      emails = null;
    }
  }
예제 #3
0
    /**
     * Parse and return the SC address prepended to SMS messages coming via the TS 27.005 / AT
     * interface. Returns null on invalid address
     */
    String getSCAddress() {
      int len;
      String ret;

      // length of SC Address
      len = getByte();

      if (len == 0) {
        // no SC address
        ret = null;
      } else {
        // SC address
        try {
          ret = PhoneNumberUtils.calledPartyBCDToString(mPdu, mCur, len);
        } catch (RuntimeException tr) {
          Rlog.d(LOG_TAG, "invalid SC address: ", tr);
          ret = null;
        }
      }

      mCur += len;

      return ret;
    }
예제 #4
0
  /** alphaTag and number are set to null on invalid format */
  private void parseRecord(byte[] record) {
    try {
      alphaTag = IccUtils.adnStringFieldToString(record, 0, record.length - FOOTER_SIZE_BYTES);

      int footerOffset = record.length - FOOTER_SIZE_BYTES;

      int numberLength = 0xff & record[footerOffset];

      if (numberLength > MAX_NUMBER_SIZE_BYTES) {
        // Invalid number length
        number = "";
        return;
      }

      // Please note 51.011 10.5.1:
      //
      // "If the Dialling Number/SSC String does not contain
      // a dialling number, e.g. a control string deactivating
      // a service, the TON/NPI byte shall be set to 'FF' by
      // the ME (see note 2)."

      number = PhoneNumberUtils.calledPartyBCDToString(record, footerOffset + 1, numberLength);

      extRecord = 0xff & record[record.length - 1];

      emails = null;
      additionalNumbers = null;

    } catch (RuntimeException ex) {
      Log.w(LOG_TAG, "Error parsing AdnRecord", ex);
      number = "";
      alphaTag = "";
      emails = null;
      additionalNumbers = null;
    }
  }