| | |
| | | package com.dayu.recharge.card; |
| | | |
| | | import com.dayu.recharge.tools.BcdUtil; |
| | | import com.dayu.recharge.tools.HexUtil; |
| | | import com.dayu.recharge.utils.MornyUtil; |
| | | import com.dayu.recharge.utils.MyCommon; |
| | | |
| | | import java.io.Serializable; |
| | |
| | | */ |
| | | public class ManageCard implements Serializable { |
| | | public String cardType = MyCommon.MANAGE_CRAD;//卡类型 |
| | | public String cardData = "3668F7A30119";//标识码 |
| | | public String cardData = "A0B1C289";//标识码 |
| | | |
| | | |
| | | /** |
| | | * M1卡的0扇区0块通常用于存储一些基本的卡片信息 |
| | | * 第0字节:卡片类型(M1卡为0x08) |
| | | * 第1字节:卡片地址(通常为0x00) |
| | | * 第2-5字节:卡片序列号(4字节) |
| | | * 第6-8字节:卡片制造商代码(3字节) |
| | | * 第9字节:卡片版本 |
| | | * 第10-15字节:预留区域 |
| | | */ |
| | | public byte[] userCard; //用户卡号 |
| | | |
| | | |
| | | public String getCardData() { |
| | | return cardData; |
| | | } |
| | | |
| | | public byte[] toZeroByte() { |
| | | Zero zero = new Zero(); |
| | |
| | | public byte[] toByte() { |
| | | byte[] data = new byte[16]; |
| | | data[0] = HexUtil.hexToByte(cardType); |
| | | byte[] cardDatas = HexUtil.hexToByteArray(cardData); |
| | | for (int i = 0; i < 6; i++) { |
| | | data[i + 1] = cardDatas[i]; |
| | | |
| | | byte[] cardDataByte = HexUtil.hexToByteArray(cardData); |
| | | if (cardDataByte != null) { |
| | | System.arraycopy(cardDataByte, 0, data, 1, cardDataByte.length); |
| | | } |
| | | |
| | | if (userCard!=null){ |
| | | System.arraycopy(userCard, 0, data, 5, userCard.length); |
| | | } |
| | | |
| | | data[15] = getByteSum(data); |
| | | return data; |
| | | } |