예제 #1
0
  protected float parseBalance(Iso7816.Response data) {
    float ret = 0f;
    if (data.isOkey() && data.size() >= 4) {
      int n = Util.toInt(data.getBytes(), 0, 4);
      if (n > 1000000 || n < -1000000) n -= 0x80000000;

      ret = n / 100.0f;
    }
    return ret;
  }
예제 #2
0
  protected boolean addLog24(final Iso7816.Response r, ArrayList<byte[]> l) {
    if (!r.isOkey()) return false;

    final byte[] raw = r.getBytes();
    final int N = raw.length - 23;
    if (N < 0) return false;

    for (int s = 0, e = 0; s <= N; s = e) {
      l.add(Arrays.copyOfRange(raw, s, (e = s + 23)));
    }

    return true;
  }
예제 #3
0
  protected void parseInfo21(Application app, Iso7816.Response data, int dec, boolean bigEndian) {
    if (!data.isOkey() || data.size() < 30) {
      return;
    }

    final byte[] d = data.getBytes();
    if (dec < 1 || dec > 10) {
      app.setProperty(SPEC.PROP.SERIAL, Util.toHexString(d, 10, 10));
    } else {
      final int sn = bigEndian ? Util.toIntR(d, 19, dec) : Util.toInt(d, 20 - dec, dec);

      app.setProperty(SPEC.PROP.SERIAL, String.format("%d", 0xFFFFFFFFL & sn));
    }

    if (d[9] != 0) app.setProperty(SPEC.PROP.VERSION, String.valueOf(d[9]));

    app.setProperty(
        SPEC.PROP.DATE,
        String.format(
            "%02X%02X.%02X.%02X - %02X%02X.%02X.%02X",
            d[20], d[21], d[22], d[23], d[24], d[25], d[26], d[27]));
  }