/* NFCard is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. NFCard is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Wget. If not, see <http://www.gnu.org/licenses/>. Additional permission under GNU GPL version 3 section 7 */ package com.zzx.factorytest.nfc.card.pboc; import java.util.ArrayList; import android.content.res.Resources; import com.zzx.factorytest.R; import com.zzx.factorytest.nfc.tech.Iso7816; final class ChanganTong extends PbocCard { private final static byte[] DFN_SRV = { (byte) 0xA0, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x03, (byte) 0x86, (byte) 0x98, (byte) 0x07, (byte) 0x01, }; private ChanganTong(Iso7816.Tag tag, Resources res) { super(tag); name = res.getString(R.string.name_cac); } @SuppressWarnings("unchecked") final static ChanganTong load(Iso7816.Tag tag, Resources res) { /*--------------------------------------------------------------*/ // select PSF (1PAY.SYS.DDF01) /*--------------------------------------------------------------*/ if (tag.selectByName(DFN_PSE).isOkey()) { Iso7816.Response INFO, CASH; /*--------------------------------------------------------------*/ // select Main Application /*--------------------------------------------------------------*/ if (tag.selectByName(DFN_SRV).isOkey()) { /*--------------------------------------------------------------*/ // read card info file, binary (21) /*--------------------------------------------------------------*/ INFO = tag.readBinary(SFI_EXTRA); /*--------------------------------------------------------------*/ // read balance /*--------------------------------------------------------------*/ CASH = tag.getBalance(true); /*--------------------------------------------------------------*/ // read log file, record (24) /*--------------------------------------------------------------*/ ArrayList<byte[]> LOG = readLog(tag, SFI_LOG); /*--------------------------------------------------------------*/ // build result string /*--------------------------------------------------------------*/ final ChanganTong ret = new ChanganTong(tag, res); ret.parseBalance(CASH); ret.parseInfo(INFO, 4, false); ret.parseLog(LOG); return ret; } } return null; } }