示例#1
0
  protected void parseLog(ArrayList<byte[]>... logs) {
    final StringBuilder r = new StringBuilder();

    for (final ArrayList<byte[]> log : logs) {
      if (log == null) continue;

      if (r.length() > 0) r.append("<br />--------------");

      for (final byte[] v : log) {
        final int cash = Util.toInt(v, 5, 4);
        if (cash > 0) {
          r.append("<br />")
              .append(
                  String.format(
                      "%02X%02X.%02X.%02X %02X:%02X ",
                      v[16], v[17], v[18], v[19], v[20], v[21], v[22]));

          final char t = (v[9] == TRANS_CSU || v[9] == TRANS_CSU_CPX) ? '-' : '+';

          r.append(t).append(Util.toAmountString(cash / 100.0f));

          final int over = Util.toInt(v, 2, 3);
          if (over > 0) r.append(" [o:").append(Util.toAmountString(over / 100.0f)).append(']');

          r.append(" [").append(Util.toHexString(v, 10, 6)).append(']');
        }
      }
    }

    this.log = r.toString();
  }
示例#2
0
  protected void parseBalance(Iso7816.Response data) {
    if (!data.isOkey() || data.size() < 4) {
      cash = null;
      return;
    }

    int n = Util.toInt(data.getBytes(), 0, 4);
    if (n > 100000 || n < -100000) n -= 0x80000000;

    cash = Util.toAmountString(n / 100.0f);
  }