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 PollingResult {
020
021    private EOperationType operationType;
022    private EReaderType readerType;
023    private String track1;
024    private String track2;
025    private String track3;
026    private byte[] serialInfo;
027    private byte cardType;
028    private byte CID;
029    private byte[] other;
030
031    /**
032     * <div class="zh"> 获取操作结果 </div> <div class="en"> operation type {@link EOperationType} </div>
033     * 
034     * @return
035     */
036    public EOperationType getOperationType() {
037        return operationType;
038    }
039
040    /**
041     * <div class="zh"> 设置操作结果 </div> <div class="en"> set Operation Type </div>
042     * 
043     * @param operationType
044     *            {@link EOperationType}
045     */
046    public void setOperationType(EOperationType operationType) {
047        this.operationType = operationType;
048    }
049
050    /**
051     * <div class="zh"> 获取读卡类型 </div> <div class="en"> get reader type </div>
052     * 
053     * @return
054     */
055    public EReaderType getReaderType() {
056        return readerType;
057    }
058
059    /**
060     * <div class="zh"> 设置读卡器类型 </div> <div class="en"> set reader type </div>
061     * 
062     * @param readerType
063     *            {@link EReaderType}
064     */
065    public void setReaderType(EReaderType readerType) {
066        this.readerType = readerType;
067    }
068
069    /**
070     * <div class="zh"> 磁道1 </div> <div class="en"> track 1 </div>
071     * 
072     * @return
073     */
074    public String getTrack1() {
075        return track1;
076    }
077
078    /**
079     * <div class="zh"> 磁道1 </div> <div class="en"> track 1 </div>
080     * 
081     * @param track1
082     */
083    public void setTrack1(String track1) {
084        this.track1 = track1;
085    }
086
087    /**
088     * <div class="zh"> 磁道2 </div> <div class="en"> track 2 </div>
089     * 
090     * @return
091     */
092    public String getTrack2() {
093        return track2;
094    }
095
096    /**
097     * <div class="zh"> 磁道2 </div> <div class="en"> track 2 </div>
098     * 
099     * @param track2
100     */
101    public void setTrack2(String track2) {
102        this.track2 = track2;
103    }
104
105    /**
106     * <div class="zh"> 磁道3 </div> <div class="en"> track 3 </div>
107     * 
108     * @return
109     */
110    public String getTrack3() {
111        return track3;
112    }
113
114    /**
115     * <div class="zh"> 磁道3 </div> <div class="en"> track 3 </div>
116     * 
117     * @param track3
118     */
119    public void setTrack3(String track3) {
120        this.track3 = track3;
121    }
122
123    /**
124     * <div class="zh"> 非接卡卡片序列号 </div> <div class="en"> RF card serial number </div>
125     * 
126     * @return
127     */
128    public byte[] getSerialInfo() {
129        return serialInfo;
130    }
131
132    /**
133     * <div class="zh"> 非接卡卡片序列号 </div> <div class="en"> RF card serial number </div>
134     * 
135     * @param serialInfo
136     */
137    public void setSerialInfo(byte[] serialInfo) {
138        this.serialInfo = serialInfo;
139    }
140
141    public PollingResult() {
142        operationType = EOperationType.DEFAULT;
143        readerType = EReaderType.DEFAULT;
144        track1 = "";
145        track2 = "";
146        track3 = "";
147        serialInfo = new byte[0];
148        cardType = 0x00;
149        CID = 0x00;
150        other = new byte[0];
151    }
152
153    public enum EOperationType {
154        /**
155         * <div class="zh"> 成功 </div> <div class="en"> success </div>
156         */
157        OK,
158        /**
159         * <div class="zh"> 超时 </div> <div class="en"> timeout </div>
160         */
161        TIMEOUT,
162        /**
163         * <div class="zh"> 取消 </div> <div class="en"> cancel </div>
164         */
165        CANCEL,
166        /**
167         * <div class="zh"> 暂停 </div> <div class="en"> PAUSE </div>
168         * 
169         * @deprecated
170         */
171        PAUSE,
172        DEFAULT;
173
174    }
175
176    /**
177     * <div class="zh"> 获取卡类型, 参考{@link #setCardType(byte)} </div> <div class="en"> get card type
178     * {@link #setCardType(byte)} </div>
179     *
180     * @return
181     * @since V3.19.00
182     */
183    public byte getCardType() {
184        return cardType;
185    }
186
187    /**
188     * <div class="zh"> 设置卡片类型 </div> <div class="en"> set card type </div>
189     *
190     * @param cardType
191     *            <div class="zh">
192     *            <ul>
193     *            <li>'A': 搜寻到A型卡</li>
194     *            <li>'B': 搜寻到B型卡</li>
195     *            <li>'M': 搜寻到m1卡</li>
196     *            </ul>
197     *            </div> <div class="en">
198     *            <ul>
199     *            <li>'A': Found type A card</li>
200     *            <li>'B': Found type B card</li>
201     *            <li>'M': Found type M1 card</li>
202     *            </ul>
203     *            </div>
204     */
205    public void setCardType(byte cardType) {
206        this.cardType = cardType;
207    }
208
209    /**
210     * <div class="zh"> 获取逻辑通道号 </div> <div class="en"> Card ID, points to buffer storing card logical channel number.
211     * The channel number is allocated internally by driver, and range is 0~14. </div>
212     *
213     * @return
214     * @since V3.19.00
215     */
216    public byte getCID() {
217        return CID;
218    }
219
220    /**
221     * <div class="zh"> 设置逻辑通道号,存放卡片逻辑通道号,该通道号由驱动内部分配和指定,取值范围为0~14 </div> <div class="en"> Card ID, points to buffer
222     * storing card logical channel number. The channel number is allocated internally by driver, and range is 0~14.
223     * </div>
224     *
225     * @param cID
226     */
227    public void setCID(byte cID) {
228        CID = cID;
229    }
230
231    /**
232     * @return <div class="zh">Other:len(1字节)+errcode(2字节)+卡片相关信息
233     * <ul>
234     * <li>1.len表示返回信息的总长度,不包括len本身的1个字节</li>
235     * <li>2.对A型卡,Other表示:len[1]+errcode[2]+ATQA[2]+SAK1+[SAK2]+[SAK3]+ATS
236     * <br>SAK1/SAK2/SAK3均为1字节,[SAK2]和[SAK3]表示可选,当SerialInfo为4字节时只有SAK1,当SerialInfo为7字节时包含SAK1和SAK2,当SerialInfo为10字节时包含SAK1,SAK2及SAK3。
237     * ATQA为2字节,其中ATS的长度为len减去已知信息的长度。</li>
238     * <li>3.对M型卡,Other表示:len[1]+errcode[2]+ATQA[2]+SAK1</li>
239     * <li>4.对B型卡,Other表示:len[1]+errcode[2]+ATQB[12]+ATTRIB
240     * <br>ATQB长度为12字节,ATTRIB的长度为len减去已知信息的长度</li>
241     * </ul>
242     * 有关ATS、ATQB、ATQA的详细信息请查阅ISO14443-3、ISO14443-4的相关部分。 </div>
243     * <div class="en"> Other: len (1 byte) + errCode (2 bytes) + card related information
244     * <ul>
245     * <li> 1. len denotes the total length of the returned information, excluding one byte of len itself </li>.
246     * <li> 2. For type A card, Other means len [1] + errCode [2] + ATQA [2] + SAK1 + [SAK2] + [SAK3] + ATS
247     * <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.
248     * ATQA is 2 bytes, where the length of ATS is len minus the length of known information. </li>
249     * <li> 3. For M-card, Other means len [1] + errCode [2] + ATQA [2] + SAK1 </li >
250     * <li> 4. For type B cards, Other means len [1] + errCode [2] + ATQB [12] + ATTRIB
251     * <br> ATQB length is 12 bytes, ATTRIB length is len minus the length of known information </li>.
252     * </ul>
253     * For detailed information on ATS, ATQB and ATQA, please refer to the relevant parts of ISO14443-3 and ISO14443-4.</div>
254     * @since V3.19.00
255     */
256    public byte[] getOther() {
257        return other;
258    }
259
260    /**
261     * <div class="zh"> 存放详细错误代码、卡片响应信息等内容的缓冲区 </div> <div class="en"> Points to buffer storing detailed error code and
262     * card response information </div>
263     *
264     * @param other
265     *            <div class="zh">Other:len(1字节)+errcode(2字节)+卡片相关信息
266     * <ul>
267     * <li>1.len表示返回信息的总长度,不包括len本身的1个字节</li>
268     * <li>2.对A型卡,Other表示:len[1]+errcode[2]+ATQA[2]+SAK1+[SAK2]+[SAK3]+ATS
269     * <br>SAK1/SAK2/SAK3均为1字节,[SAK2]和[SAK3]表示可选,当SerialInfo为4字节时只有SAK1,当SerialInfo为7字节时包含SAK1和SAK2,当SerialInfo为10字节时包含SAK1,SAK2及SAK3。
270     * ATQA为2字节,其中ATS的长度为len减去已知信息的长度。</li>
271     * <li>3.对M型卡,Other表示:len[1]+errcode[2]+ATQA[2]+SAK1</li>
272     * <li>4.对B型卡,Other表示:len[1]+errcode[2]+ATQB[12]+ATTRIB
273     * <br>ATQB长度为12字节,ATTRIB的长度为len减去已知信息的长度</li>
274     * </ul>
275     * 有关ATS、ATQB、ATQA的详细信息请查阅ISO14443-3、ISO14443-4的相关部分。 </div>
276     * <div class="en"> Other: len (1 byte) + errCode (2 bytes) + card related information
277     * <ul>
278     * <li> 1. len denotes the total length of the returned information, excluding one byte of len itself </li>.
279     * <li> 2. For type A card, Other means len [1] + errCode [2] + ATQA [2] + SAK1 + [SAK2] + [SAK3] + ATS
280     * <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.
281     * ATQA is 2 bytes, where the length of ATS is len minus the length of known information. </li>
282     * <li> 3. For M-card, Other means len [1] + errCode [2] + ATQA [2] + SAK1 </li >
283     * <li> 4. For type B cards, Other means len [1] + errCode [2] + ATQB [12] + ATTRIB
284     * <br> ATQB length is 12 bytes, ATTRIB length is len minus the length of known information </li>.
285     * </ul>
286     * For detailed information on ATS, ATQB and ATQA, please refer to the relevant parts of ISO14443-3 and ISO14443-4.</div>
287     */
288    public void setOther(byte[] other) {
289        this.other = other;
290    }
291}