Esempio n. 1
0
  /**
   * Returns Last Numbers Dialed in human readable interpretation.
   *
   * @param position Entry position of LND that is to be read.
   * @param showAllHex if true, returns HEX representation of data. If false, returns normal
   *     representation of data.
   * @return Last Numbers Dialed in human readable interpretation.
   */
  public String getLNDString(int position, boolean showAllHex) {
    byte[] LND = null;
    String LNDString = "";
    String contactName = "";
    try {
      worker.getResponse(worker.select(DatabaseOfEF.DF_TELECOM.getFID()));
      LND =
          worker.readRecord(
              position, worker.getResponse(worker.select(DatabaseOfEF.EF_LND.getFID())));

      contactName =
          contactName.concat(Converter.bytesToHex(LND).substring(0, 3 * (LND.length - 14)));
      if (!contactName.matches("[FF ]+")) {
        for (int i = 0; i < LND.length - 14; i++) {
          LNDString = LNDString.concat(Character.toString((char) (int) LND[i]));
        }
        LNDString = LNDString.concat("; ");
      }
      if (LND[LND.length - 14 + 1] == (byte) 0x91) {
        LNDString = LNDString.concat("00");
      }
      for (int i = LND.length - 14 + 2; i <= LND.length - 14 + LND[LND.length - 14]; i++) {
        String b = Converter.byteToHex(LND[i]);
        String c = Converter.swapString(b);
        LNDString = LNDString.concat(c);
      }
    } catch (Exception ex) {
      Logger.getLogger(CardManager.class.getName()).log(Level.SEVERE, null, ex);
    }
    if (showAllHex) {
      return Converter.bytesToHex(LND);
    } else {
      return LNDString;
    }
  }
Esempio n. 2
0
  /**
   * Returns International Mobile Subscriber Identity (IMSI) as IMSI class.
   *
   * @return International Mobile Subscriber Identity (IMSI) as IMSI class.
   */
  public IMSI getIMSI() {
    byte[] input = getEFBytes(DatabaseOfEF.EF_IMSI);
    String IMSIString = "";

    for (int i = 0; i < input.length - 2; i++) {
      String b = Converter.byteToHex(input[i]);
      String c = Converter.swapString(b);
      IMSIString = IMSIString.concat(c);
    }

    return new IMSI(IMSIString);
  }
Esempio n. 3
0
  /**
   * Returns Integrated Circuit Card Identification as ICCID class.
   *
   * @return Returns Integrated Circuit Card Identification as ICCID class.
   */
  public ICCID getICCID() {
    byte[] input = getEFBytes(DatabaseOfEF.EF_ICCID);
    String ICCIDString = "";
    for (int i = 0; i < input.length - 2; i++) {
      String b = Converter.byteToHex(input[i]);
      String c = Converter.swapString(b);
      ICCIDString = ICCIDString.concat(c);
    }

    if (ICCIDString.toUpperCase().contains("F")) {
      ICCIDString = ICCIDString.substring(0, ICCIDString.length() - 1);
    }
    return new ICCID(ICCIDString);
  }
Esempio n. 4
0
  /**
   * Returns Location Information as LOCI class.
   *
   * @return Location Information as LOCI class.
   */
  public LOCI getLOCI() {
    byte[] input = getEFBytes(DatabaseOfEF.EF_LOCI); // ,11
    String loci = "";

    for (int i = 0; i < input.length - 2; i++) {
      String b = Converter.byteToHex(input[i]);
      if ((i > 3) && i <= 8) { // swap only LAI
        String c = Converter.swapString(b);
        loci = loci.concat(c);
      } else {
        loci = loci.concat(b);
      }
    }

    return new LOCI(loci);
  }
Esempio n. 5
0
 /**
  * Returns Mobile Station ISDN Number (telephone number of given SIM card)
  *
  * @param position Entry position of MSISDN that is to be read.
  * @param showAllHex if true, returns HEX representation of data. If false, returns normal
  *     representation of data.
  * @return Mobile Station ISDN Number (telephone number of given SIM card) in human readable
  *     interpretation.
  */
 public String getMSISDNString(int position, boolean showAllHex) {
   byte[] MSISDN = null;
   String MSISDNString = "";
   try {
     worker.getResponse(worker.select(DatabaseOfEF.DF_TELECOM.getFID()));
     MSISDN =
         worker.readRecord(
             position, worker.getResponse(worker.select(DatabaseOfEF.EF_MSISDN.getFID())));
     if (MSISDN[14] != (byte) 0xff) {
       for (int i = 16; i <= 14 + MSISDN[14]; i++) {
         String b = Converter.byteToHex(MSISDN[i]);
         String c = Converter.swapString(b);
         MSISDNString = MSISDNString.concat(c);
       }
     }
   } catch (Exception ex) {
     Logger.getLogger(CardManager.class.getName()).log(Level.SEVERE, null, ex);
   }
   if (showAllHex) {
     return Converter.bytesToHex(MSISDN);
   } else {
     return MSISDNString;
   }
 }
Esempio n. 6
0
 /**
  * Returns Home Public Land Mobile Network search period in minutes.
  *
  * @return Home Public Land Mobile Network search period in minutes.
  */
 public String getHPLMN() {
   return Converter.byteToHex(getEFBytes(DatabaseOfEF.EF_HPLMN)[0]);
 }