001/*
002 * ===========================================================================================
003 * = COPYRIGHT
004 *          PAX Computer Technology (Shenzhen) Co., Ltd. PROPRIETARY INFORMATION
005 *   This software is supplied under the terms of a license agreement or nondisclosure
006 *   agreement with PAX Computer Technology (Shenzhen) Co., Ltd. and may not be copied or
007 *   disclosed except in accordance with the terms in that agreement.
008 *     Copyright (C) 2017-2023 PAX Computer Technology (Shenzhen) Co., Ltd. All rights reserved.
009 * Description: // Detail description about the function of this module,
010 *             // interfaces with the other modules, and dependencies.
011 * Revision History:
012 * Date                         Author                        Action
013 * 2017/04/01                   PAX                     Create/Add/Modify/Delete
014 * ===========================================================================================
015 */
016 
017package com.pax.dal.entity;
018
019public class PiccCardInfo {
020
021    private byte cardType;
022    private byte[] serialInfo;
023    private byte CID;
024    private byte[] other;
025
026    public PiccCardInfo() {
027        cardType = 0x00;
028        serialInfo = new byte[0];
029        CID = 0x00;
030        other = new byte[0];
031    }
032
033    public PiccCardInfo(byte cardType, byte[] serialInfo, byte cid, byte[] other) {
034        this.cardType = cardType;
035        this.serialInfo = serialInfo;
036        this.CID = cid;
037        this.other = other;
038    }
039
040    /**
041     * <div class="zh"> 获取卡类型, 参考{@link #setCardType(byte)} </div> <div class="en"> get card type
042     * {@link #setCardType(byte)} </div>
043     * 
044     * @return
045     */
046    public byte getCardType() {
047        return cardType;
048    }
049
050    /**
051     * <div class="zh"> 设置卡片类型 </div> <div class="en"> set card type </div>
052     * 
053     * @param cardType
054     *            <div class="zh">
055     *            <ul>
056     *            <li>'A': 搜寻到A型卡</li>
057     *            <li>'B': 搜寻到B型卡</li>
058     *            <li>'M': 搜寻到m1卡</li>
059     *            </ul>
060     *            </div> <div class="en">
061     *            <ul>
062     *            <li>'A': Found type A card</li>
063     *            <li>'B': Found type B card</li>
064     *            <li>'M': Found type M1 card</li>
065     *            </ul>
066     *            </div>
067     */
068    public void setCardType(byte cardType) {
069        this.cardType = cardType;
070    }
071
072    /**
073     * <div class="zh"> 获取卡片序列号 </div> <div class="en"> Points to first address of buffer storing card serial number
074     * information </div>
075     * 
076     * @return
077     */
078    public byte[] getSerialInfo() {
079        return serialInfo;
080    }
081
082    /**
083     * <div class="zh"> 设置卡片序列号 </div> <div class="en"> Points to first address of buffer storing card serial number
084     * information </div>
085     * 
086     * @param serialInfo
087     */
088    public void setSerialInfo(byte[] serialInfo) {
089        this.serialInfo = serialInfo;
090    }
091
092    /**
093     * <div class="zh"> 获取逻辑通道号 </div> <div class="en"> Card ID, points to buffer storing card logical channel number.
094     * The channel number is allocated internally by driver, and range is 0~14. </div>
095     * 
096     * @return
097     */
098    public byte getCID() {
099        return CID;
100    }
101
102    /**
103     * <div class="zh"> 设置逻辑通道号,存放卡片逻辑通道号,该通道号由驱动内部分配和指定,取值范围为0~14 </div> <div class="en"> Card ID, points to buffer
104     * storing card logical channel number. The channel number is allocated internally by driver, and range is 0~14.
105     * </div>
106     * 
107     * @param cID
108     */
109    public void setCID(byte cID) {
110        CID = cID;
111    }
112
113    /**
114     * @return <div class="zh">Other:len(1字节)+errcode(2字节)+卡片相关信息
115     * <ul>
116     * <li>1.len表示返回信息的总长度,不包括len本身的1个字节</li>
117     * <li>2.对A型卡,Other表示:len[1]+errcode[2]+ATQA[2]+SAK1+[SAK2]+[SAK3]+ATS
118     * <br>SAK1/SAK2/SAK3均为1字节,[SAK2]和[SAK3]表示可选,当SerialInfo为4字节时只有SAK1,当SerialInfo为7字节时包含SAK1和SAK2,当SerialInfo为10字节时包含SAK1,SAK2及SAK3。
119     * ATQA为2字节,其中ATS的长度为len减去已知信息的长度。</li>
120     * <li>3.对M型卡,Other表示:len[1]+errcode[2]+ATQA[2]+SAK1</li>
121     * <li>4.对B型卡,Other表示:len[1]+errcode[2]+ATQB[12]+ATTRIB
122     * <br>ATQB长度为12字节,ATTRIB的长度为len减去已知信息的长度</li>
123     * </ul>
124     * 有关ATS、ATQB、ATQA的详细信息请查阅ISO14443-3、ISO14443-4的相关部分。 </div> 
125     * <div class="en"> Other: len (1 byte) + errCode (2 bytes) + card related information
126     * <ul>
127     * <li> 1. len denotes the total length of the returned information, excluding one byte of len itself </li>.
128     * <li> 2. For type A card, Other means len [1] + errCode [2] + ATQA [2] + SAK1 + [SAK2] + [SAK3] + ATS
129     * <br> SAK1/SAK2/SAK3 are 1 byte, [SAK2] and [SAK3] are optional, only SAK1 when SerialInfo is 4 bytes, SAK1 and SAK2 when SerialInfo is 7 bytes, and SAK1, SAK2 and SAK3 when SerialInfo is 10 bytes.
130     * ATQA is 2 bytes, where the length of ATS is len minus the length of known information. </li>
131     * <li> 3. For M-card, Other means len [1] + errCode [2] + ATQA [2] + SAK1 </li >
132     * <li> 4. For type B cards, Other means len [1] + errCode [2] + ATQB [12] + ATTRIB
133     * <br> ATQB length is 12 bytes, ATTRIB length is len minus the length of known information </li>.
134     * </ul>
135     * For detailed information on ATS, ATQB and ATQA, please refer to the relevant parts of ISO14443-3 and ISO14443-4.</div>
136     */
137    public byte[] getOther() {
138        return other;
139    }
140
141    /**
142     * <div class="zh"> 存放详细错误代码、卡片响应信息等内容的缓冲区 </div> <div class="en"> Points to buffer storing detailed error code and
143     * card response information </div>
144     * 
145     * @param other
146     *            <div class="zh">Other:len(1字节)+errcode(2字节)+卡片相关信息
147     * <ul>
148     * <li>1.len表示返回信息的总长度,不包括len本身的1个字节</li>
149     * <li>2.对A型卡,Other表示:len[1]+errcode[2]+ATQA[2]+SAK1+[SAK2]+[SAK3]+ATS
150     * <br>SAK1/SAK2/SAK3均为1字节,[SAK2]和[SAK3]表示可选,当SerialInfo为4字节时只有SAK1,当SerialInfo为7字节时包含SAK1和SAK2,当SerialInfo为10字节时包含SAK1,SAK2及SAK3。
151     * ATQA为2字节,其中ATS的长度为len减去已知信息的长度。</li>
152     * <li>3.对M型卡,Other表示:len[1]+errcode[2]+ATQA[2]+SAK1</li>
153     * <li>4.对B型卡,Other表示:len[1]+errcode[2]+ATQB[12]+ATTRIB
154     * <br>ATQB长度为12字节,ATTRIB的长度为len减去已知信息的长度</li>
155     * </ul>
156     * 有关ATS、ATQB、ATQA的详细信息请查阅ISO14443-3、ISO14443-4的相关部分。 </div> 
157     * <div class="en"> Other: len (1 byte) + errCode (2 bytes) + card related information
158     * <ul>
159     * <li> 1. len denotes the total length of the returned information, excluding one byte of len itself </li>.
160     * <li> 2. For type A card, Other means len [1] + errCode [2] + ATQA [2] + SAK1 + [SAK2] + [SAK3] + ATS
161     * <br> SAK1/SAK2/SAK3 are 1 byte, [SAK2] and [SAK3] are optional, only SAK1 when SerialInfo is 4 bytes, SAK1 and SAK2 when SerialInfo is 7 bytes, and SAK1, SAK2 and SAK3 when SerialInfo is 10 bytes.
162     * ATQA is 2 bytes, where the length of ATS is len minus the length of known information. </li>
163     * <li> 3. For M-card, Other means len [1] + errCode [2] + ATQA [2] + SAK1 </li >
164     * <li> 4. For type B cards, Other means len [1] + errCode [2] + ATQB [12] + ATTRIB
165     * <br> ATQB length is 12 bytes, ATTRIB length is len minus the length of known information </li>.
166     * </ul>
167     * For detailed information on ATS, ATQB and ATQA, please refer to the relevant parts of ISO14443-3 and ISO14443-4.</div>
168     */
169    public void setOther(byte[] other) {
170        this.other = other;
171    }
172
173}