File was renamed from app/src/main/java/com/dayu/recharge/card/ConfigureDeviceRegistrationCrad.java |
| | |
| | | package com.dayu.recharge.card; |
| | | package com.dayu.rechargeqh.card; |
| | | |
| | | import com.dayu.recharge.tools.HexUtil; |
| | | import com.dayu.recharge.utils.MyCommon; |
| | | import com.dayu.rechargeqh.dao.AppDatabase; |
| | | import com.dayu.rechargeqh.tools.HexUtil; |
| | | import com.dayu.rechargeqh.utils.MyCommon; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | |
| | | * <p> |
| | | * 为方便现场更换设备时重新注册的问题,配置设备信息卡,首先刷卡,把原设备的注册号和ID号读到卡内,同时卡状态则00修改为FF,再新设备上刷此卡时,注册号和ID号自动写到控制器内,可以直接刷卡使用 |
| | | */ |
| | | public class ConfigureDeviceRegistrationCrad implements Serializable { |
| | | public class ConfigureDeviceRegistrationCrad extends BaseCard implements Serializable { |
| | | public String cardType = MyCommon.CONFIGURATION_CARD_TYPE;//卡类型 |
| | | public String cardData = "A0B1C289";//标识码 |
| | | |
| | |
| | | return cardData; |
| | | } |
| | | |
| | | public byte[] toByte() { |
| | | public byte[] toByte(AppDatabase appDatabase) { |
| | | setCardData(appDatabase, cardType); |
| | | Zero zero = new Zero(); |
| | | return zero.toByte(); |
| | | } |
| | | |
| | | public class Zero extends BaseCard { |
| | | public class Zero { |
| | | public byte[] toByte() { |
| | | byte[] data = new byte[16]; |
| | | data[0] = HexUtil.hexToByte(cardType); |
| | | byte[] cardDatas = HexUtil.hexToByteArray(cardData); |
| | | for (int i = 0; i < 4; i++) { |
| | | data[i + 1] = cardDatas[i]; |
| | | } |
| | | |
| | | System.arraycopy(cardDatas, 0, data, 1, cardDatas.length); |
| | | data[15] = getByteSum(data); |
| | | return data; |
| | | } |