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;
018
019import com.pax.dal.entity.TrackData;
020import com.pax.dal.exceptions.MagDevException;
021import com.pax.dal.entity.TrackDataByte;
022
023 /**
024  *  <div class="zh">关于磁条卡的API。 如果开启权限检查,需在AndroidManifest下添加权限:"com.pax.permission.MAGCARD"</div>
025  *  <div class="en">API for Magnetic stripe cards. If permission check is enabled, you need to add permission under AndroidManifest: "com.pax.permission.MAGCARD".</div>
026  */
027public interface IMag {
028    /**
029     * <div class="zh"> 打开读卡器 </div> <div class="en"> Open Magnetic Stripe Card Reader </div>
030     * 
031     * @throws MagDevException
032     */
033    public void open() throws MagDevException;
034
035    /**
036     * <div class="zh"> 复位磁头,并清除磁卡缓冲区数据 </div> <div class="en"> Reset magnetic stripe card reader, and clear buffer of
037     * magnetic stripe card. </div>
038     * 
039     * @throws MagDevException
040     */
041    public void reset() throws MagDevException;
042
043    /**
044     * <div class="zh"> 检查是否刷过卡 </div> <div class="en"> Check whether a card is swiped </div>
045     * 
046     * @return <div class="zh"> *
047     *         <ul>
048     *         <li>true -有刷卡</li>
049     *         <li>false -没有刷卡</li>
050     *         </ul>
051     *         </div> <div class="en">
052     *         <ul>
053     *         <li>true -Card swiped</li>
054     *         <li>false -No card swiping</li>
055     *         </ul>
056     *         </div>
057     * 
058     * @throws MagDevException
059     */
060    public boolean isSwiped() throws MagDevException;
061
062    /**
063     * <div class="zh"> 读取磁卡缓冲区的1、2、3磁道的数据 </div> <div class="en"> Read data of track 1, 2, 3 from magnetic stripe card
064     * buffer. </div>
065     * 
066     * @return {@link TrackData}
067     * @throws MagDevException
068     */
069    public TrackData read() throws MagDevException;
070
071    /**
072     * <div class="zh"> 关闭读卡器 </div> <div class="en"> Close Magnetic Stripe Card Reader </div>
073     * 
074     * @throws MagDevException
075     */
076    public void close() throws MagDevException;
077    
078    /**
079     * <div class="zh"> 读取磁卡缓冲区的1、2、3磁道或JIS-II磁道的数据。 </div> <div class="en"> Read data of track 1, 2, 3 or
080     * JIS-II from magnetic stripe card buffer.</div>
081     * 
082     * @return {@link TrackData}
083     * 
084     * @throws MagDevException
085     * @since V3.08.00
086     */
087    TrackData readExt() throws MagDevException;
088    
089    /**
090     * <div class="zh">磁卡功能设置:是否返回磁卡错误码。设置有效周期:设置后直到机器重启或下一次重新设置新的值。</div>
091     * <div class="en">Magnetic card function Settings: whether to return magnetic card error code. Set duration: set until the machine 
092     *  restarts or reset the new value the next time. </div>
093     * 
094     * @param flag <div class="zh">
095     * <ul>
096     *  <li>0:{@link #read()}过滤磁卡错误码(默认模式)。</li>
097     *  <li>1:{@link #read()}返回此卡错误码。</li>
098     * </ul></div> <div class="en">
099     * <ul>
100     *  <li>0:{@link #read()}Filter card error code (default mode).</li>
101     *  <li>1:{@link #read()}Returns the error code for this card.</li>
102     * </ul></div>
103     * 
104     * @throws MagDevException
105     * @since V3.16.00
106     */
107    void setup(byte flag) throws MagDevException;
108
109     /**
110      * <div class="zh"> 读取磁卡缓冲区的1、2、3磁道的数据 </div> <div class="en"> Read data of track 1, 2, 3 from magnetic stripe card
111      * buffer. </div>
112      *
113      * @return {@link TrackDataByte}
114      * @throws MagDevException
115      * @since V4.15.00
116      */
117     TrackDataByte readByte() throws MagDevException;
118
119     /**
120      * <div class="zh"> 读取磁卡缓冲区的1、2、3磁道或JIS-II磁道的数据。 </div> <div class="en"> Read data of track 1, 2, 3 or
121      * JIS-II from magnetic stripe card buffer.</div>
122      *
123      * @return {@link TrackDataByte}
124      *
125      * @throws MagDevException
126      * @since V4.15.00
127      */
128     TrackDataByte readByteExt() throws MagDevException;
129}