/** * 获取卡号 //TODO:yinger 没有使用! * * @return */ public static byte[] getCardNumByte() { byte[] snr = {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff}; byte[] buffer = new byte[100]; int a = 1; // initialize as 1 fail // 0-success 1-fail try { a = cl.MF_Read((byte) 0, (byte) 0, (byte) 1, snr, buffer); } catch (Exception e) { a = -1; } snr[4] = (byte) a; return snr; }
/** 获取卡号(可用) */ public static long getCardNum() { byte[] snr = {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff}; byte[] buffer = new byte[100]; int a = 1; // initialize as 1 fail // 0-success 1-fail try { a = cl.MF_Read((byte) 0, (byte) 0, (byte) 1, snr, buffer); } catch (Exception e) { a = 1; } if (a == 1) { return -1; } else { return bytes2long(snr, 0); } }