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; }
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])); }