001package com.pax.dal;
002
003import com.pax.dal.exceptions.WLTaxDevException;
004
005public interface IWLTax {
006
007        /**
008         * <div class="zh">打开设备。</div> <div class="en">Open Device.</div>
009         *
010         * @throws WLTaxDevException WLTaxDevException
011         *
012         * @since V4.11.00
013         */
014        void fiscalSPIOpen()throws WLTaxDevException;
015
016        /**
017         * <div class="zh">关闭设备。</div> <div class="en">Close device.</div>
018         *
019         * @throws WLTaxDevException WLTaxDevException
020         *
021         * @since V4.11.00
022         */
023        void fiscalSPIClose()throws WLTaxDevException;
024
025        /**
026         * <div class="zh">检查设备是否打开。</div> <div class="en">Check whether the device is turned on.</div>
027         *
028         * @return <div class="zh">true 打开; false 关闭 </div>
029         *         <div class="en">Open true; false Close.</div>
030         *
031         * @throws WLTaxDevException WLTaxDevException
032         *
033         * @since V4.11.00
034         */
035        boolean fiscalSPIIsOpened()throws WLTaxDevException;
036
037        /**
038         * <div class="zh">获取设备版本信息。</div> <div class="en">Obtain device version information.</div>
039         *
040         * @return <div class="zh">设备版本信息。</div>
041         *         <div class="en">Version integer value which is indicating version of the Device. To get this value, the Device must be opened.</div>
042         *
043         * @throws WLTaxDevException WLTaxDevException
044         *
045         * @since V4.11.00
046         */
047        String fiscalSPIGetVersion()throws WLTaxDevException;
048
049        /**
050         * <div class="zh">获取设备是否处于Busy状态。</div> <div class="en">Gets whether the device is Busy.</div>
051         *
052         * @param nDeviceID <div class="zh">nDeviceID = FISCAL_MODULE_ID表示财政模块,以后该值可以用于任何其他模块。</div>
053         *             <div class="en">nDeviceID = FISCAL_MODULE_ID indicating fiscal module, in the future this value could be used for any other module.</div>
054         *
055         * @return <div class="zh">true:处于Busy状态,falss:不是处于Busy状态。</div>
056         *         <div class="en">true, if the busy signal of the fiscal board is set; else false.</div>
057         *
058         * @throws WLTaxDevException WLTaxDevException
059         *
060         * @since V4.11.00
061         */
062        boolean fiscalSPIIsBusy(int nDeviceID)throws WLTaxDevException;
063
064        /**
065         * <div class="zh">重置设备。</div> <div class="en">Reset device.</div>
066         *
067         * @param nDeviceID <div class="zh">nDeviceID = FISCAL_MODULE_ID表示财政模块,以后该值可以用于任何其他模块。</div>
068         *             <div class="en">nDeviceID = FISCAL_MODULE_ID indicating fiscal module, in the future this value could be used for any other module.</div>
069         *
070         * @return <div class="zh">true:成功,false:失败</div>
071         *         <div class="en">true, if the busy signal of the fiscal board is set; else false.</div>
072         *
073         * @throws WLTaxDevException WLTaxDevException
074         *
075         * @since V4.11.00
076         */
077        boolean fiscalSPIReset(int nDeviceID)throws WLTaxDevException;
078
079        /**
080         * <div class="zh">该API为设备提供SPI设置。</div> <div class="en">This API provides SPI settings to the device. Such as clock frequency.</div>
081         *
082         * @param nDeviceID <div class="zh">nDeviceID = FISCAL_MODULE_ID表示财政模块,以后该值可以用于任何其他模块。</div>
083         *             <div class="en">nDeviceID = FISCAL_MODULE_ID indicating fiscal module, in the future this value could be used for any other module.</div>
084         *
085         * @param frequency <div class="zh">时钟频率。</div>
086         *             <div class="en">Clock frequency.</div>
087         *
088         * @param mode <div class="zh">0 ~ 3 模式(保留,默认为0)。</div>
089         *                         <div class="en">0~3.Mode (reserved, default to 0).</div>
090         *
091         * @param delay <div class="zh">延迟时间,以微秒为单位。</div>
092         *                     <div class="en">Delay time, in microseconds.</div>
093         *
094         * @throws WLTaxDevException WLTaxDevException
095         *
096         * @since V4.11.00
097         */
098        void fiscalSPISetSettings(int nDeviceID,int frequency,int mode,int delay)throws WLTaxDevException;
099
100        /**
101         * <div class="zh">该API用于对设备进行读与写。</div> <div class="en">This API is used to communicate with the module.</div>
102         *
103         * @param nDeviceID <div class="zh">nDeviceID = FISCAL_MODULE_ID表示财政模块,以后该值可以用于任何其他模块。</div>
104         *             <div class="en">nDeviceID = FISCAL_MODULE_ID indicating fiscal module, in the future this value could be used for any other module.</div>
105         *
106         * @param senddata <div class="zh">下发输出给税控的数据,MAX length <= 2048 bytes。</div>
107         *             <div class="en">Send data output to tax control,MAX length &lt; = 2048 bytes.</div>
108         *
109         * @param recvdatalen <div class="zh">设置返回数据长度 ,最大长度 <= 2048 bytes。</div>
110         *             <div class="en">Set the return data length, maximum length <= 2048 bytes.</div>
111         *
112         * @param timeout <div class="zh">超时时间单位ms。</div>
113         *             <div class="en">Timeout value in ms.</div>
114         *
115         * @return <div class="zh"> 税控返回的数据 数据长度根据recvdatalen返回,如果recvdatalen>2048或recvdatalen<=0则默认返回长度为2048用于填充的数组。</div> <div class="en"> The data length returned by tax control is returned according to recvdatalen, if recvdatalen >2048 or recvdatalen <=0 by default returns an array of length 2048 for padding. </div>
116         *
117         * @throws WLTaxDevException WLTaxDevException
118         *
119         * @since V4.11.00
120         */
121        byte[] fiscalSPIWriteRead(int nDeviceID,byte[] senddata,int recvdatalen,int timeout)throws WLTaxDevException;
122}