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.BatterySipper;
020import com.pax.dal.entity.DeviceInfo;
021import com.pax.dal.entity.EmmcInfo;
022import com.pax.dal.entity.AppNetworkStats;
023
024import java.util.List;
025import java.util.Map;
026
027/**
028 * @since V2.00.01
029 * 
030 */
031public interface IDeviceInfo {
032
033    public interface ProcessUsageListener {
034
035        /**
036         * <div class="zh">系统资源信息 </div>
037         * <div class="en">System resource information</div>
038         * @param cpuTotal
039         *            <div class="zh">设备CPU使用率 </div> <div class="en">Device CPU usage</div>
040         * @param processNames
041         *            <div class="zh">各进程名称 </div> <div class="en">Name of each process</div>
042         * @param cpuUsages
043         *            <div class="zh"> 各进程CPU使用率 </div> <div class="en">CPU usage of each process</div>
044         * @param memUsages
045         *            <div class="zh">各进程memUsages使用情况 </div> <div class="en">memUsages by process</div>
046         */
047        void onResult(float cpuTotal, String[] processNames, float[] cpuUsages, String[] memUsages);
048    }
049
050    /**
051     * <div class="zh">模块支持定义 </div> <div class="en">module support </div>
052     * 
053     * @author Steven.W
054     * 
055     */
056    public static enum ESupported {
057        /**
058         * <div class="zh">支持 </div> <div class="en">support </div>
059         */
060        YES,
061        /**
062         * <div class="zh"> 不支持</div> <div class="en">not support </div>
063         */
064        NO,
065        /**
066         * <div class="zh"> 无效的, 模块未定 </div> <div class="en">invalid </div>
067         */
068        INVALID,
069        /**
070         * <div class="zh"> 未知 </div> <div class="en">unknow </div>
071         */
072        UNKNOWN
073    }
074
075    public interface ResultCallback {
076
077        void onResult(boolean isSucc);
078    }
079
080    /**
081     * <div class="zh">磁条卡模块 </div> <div class="en">mag module </div>
082     */
083    public static final int MODULE_MAG = 1;
084    /**
085     * <div class="zh">ICC模块 </div> <div class="en">icc module</div>
086     */
087    public static final int MODULE_ICC = 2;
088    /**
089     * <div class="zh">PICC模块 </div> <div class="en">picc module</div>
090     */
091    public static final int MODULE_PICC = 3;
092    /**
093     * <div class="zh">PED模块 </div> <div class="en">ped module </div>
094     */
095    public static final int MODULE_PED = 4;
096    /**
097     * <div class="zh">物理键盘模块 </div> <div class="en">keyboard module</div>
098     */
099    public static final int MODULE_KEYBOARD = 5;
100    /**
101     * <div class="zh">打印机模块 </div> <div class="en">printer module </div>
102     */
103    public static final int MODULE_PRINTER = 6;
104    /**
105     * <div class="zh"> 蓝牙模块 </div> <div class="en">Bluetooth module </div>
106     */
107    public static final int MODULE_BT = 7;
108    /**
109     * <div class="zh">钱箱模块 </div> <div class="en">cash box module </div>
110     */
111    public static final int MODULE_CASH_BOX = 8;
112    /**
113     * <div class="zh">客显模块 </div> <div class="en">customer display</div>
114     */
115    public static final int MODULE_CUSTOMER_DISPLAY = 9;
116    /**
117     * <div class="zh"> 以太网模块 </div> <div class="en">Ethernet module</div>
118     */
119    public static final int MODULE_ETHERNET = 10;
120    /**
121     * <div class="zh"> 指纹识别模块</div> <div class="en">fingerprint reader module </div>
122     */
123    public static final int MODULE_FINGERPRINT_READER = 11;
124    /**
125     * <div class="zh"> 重力感应模块</div> <div class="en"> GSensor module</div>
126     */
127    public static final int MODULE_G_SENSOR = 12;
128    /**
129     * <div class="zh">HDMI模块 </div> <div class="en">HDMI module </div>
130     */
131    public static final int MODULE_HDMI = 13;
132    /**
133     * <div class="zh">身份证读卡器模块 </div> <div class="en">ID card reader module </div>
134     */
135    public static final int MODULE_ID_CARD_READER = 14;
136    
137    /**
138     * <div class="zh"> 国密模块 </div> <div class="en">SM module </div>
139     */
140    public static final int MODULE_SM = 15;
141    
142    /**
143     *<div class="zh"> Modem模块 </div> <div class="en">Modem module </div> 
144     */
145    public static final int MODULE_MODEM = 16;
146
147    /**
148     * <div class="zh"> 硬扫码 </div> <div class="en">ScannerHw </div>
149     */
150    public static final int MODULE_SCANNER_HW = 17;
151    
152    /**
153     * <div class="zh"> Wi-Fi模块。 </div> <div class="en">Wi-Fi module.</div>
154     */
155    public static final int MODULE_WIFI = 18;
156    /**
157     * <div class="zh"> Wi-Fi5G</div> <div class="en">Wi-Fi5G</div>
158     */
159    public static final int MODULE_WIFI5G = 19;
160    /**
161     * <div class="zh">正面非接模块(非接模块分为正面非接和背面非接)</div> <div class="en">Front PICC(The PICC module is divided into front PICC and back PICC)</div>
162     */
163    public static final int MODULE_FRONT_PICC = 20;
164    /**
165     * <div class="zh">SD卡槽</div> <div class="en">SD card slot</div>
166     */
167    public static final int MODULE_SD_CARD_SLOT = 21;
168
169    /**
170     * <div class="zh">SIM卡槽</div> <div class="en">SIM card slot</div>
171     */
172    public static final int MODULE_SIM_CARD_SLOT = 22;
173
174    /**
175     * <div class="zh">获取指定时间段的日志文件  (日志级别:警告及以上)</div> <div class="en">Get log files for the specified time period 
176     * (log level: warning and above)</div>
177     * 
178     * @param startDate <div class="zh">开始日期(格式:yyyy-MM-dd)</div> <div class="en">Start date (format: yyyy-MM-dd)</div>
179     * 
180     * @param endDate <div class="zh">结束日期(格式:yyyy-MM-dd)</div> <div class="en">End date (format: yyyy--dd)</div>
181     * 
182     * @return <div class="zh">日志文件的存储路径</div> <div class="en">The storage path for log files</div>
183     * 
184     * @since V3.06.00
185     * 
186     * 和{@link ISys#getAppLogs}接口重复
187     */
188    // public String getAppLogs(String startDate, String endDate);
189
190    /**
191     * <div class="zh">获取系统消耗电池数据情况</div><div class="en">Obtain the data situation of battery consumed by the system.</div>
192     * 
193     * @return <div class="zh">消耗电池数据情况 {@link BatterySipper}</div><div class="en">Battery data consumption</div>
194     * 
195     * @since V3.06.00
196     */
197    public List<BatterySipper> getBatteryUsages();
198
199    /**
200     * <div class="zh"> 获取设备被使用的失败总次数。收集磁条卡的刷卡失败次数和 接触式芯片卡与非接卡的Apdu exchange失败次数</div> <div class="en">Get failed count
201     * for the device be used. collect swipe failed times for MagCard ,and Apdu exchange failed times for ICC and
202     * PICC.</div>
203     * 
204     * @param module
205     *            <div class="zh"> 设备类型类型 :1.磁条卡{@link #MODULE_MAG} 2.接触式芯片卡{@link #MODULE_ICC} 3.非接触式芯片卡
206     *            {@link #MODULE_PICC}</div> <div class="en"> device type:1.MagCard{@link #MODULE_MAG} 2.ICC
207     *            {@link #MODULE_ICC} 3.PICC{@link #MODULE_PICC}</div>
208     * @since V2.00.01
209     * @return <div class="zh">
210     *         <ul>
211     *         <li>>0 返回失败次数</li>
212     *         <li>-1 表示系统不支持</li>
213     *         <li>-2 模块超出定义范围</li>
214     *         </ul>
215     *         </div> <div class="en">
216     *         <ul>
217     *         <li>>0 usage count</li>
218     *         <li>-1 device not support</li>
219     *         <li>-2 not support module</li>
220     *         </ul>
221     *         </div>
222     */
223    public long getFailCount(int module);
224
225    /**
226     * <div class="zh"> 获取所有模块支持情况 </div> <div class="en">get every module support or not</div>
227     * 
228     * @since V2.00.01
229     * @return
230     * 
231     */
232    public Map<Integer, ESupported> getModuleSupported();
233
234    /**
235     * <div class="zh">返回指定模块的支持情况 </div> <div class="en">get the module support or not </div>
236     * 
237     * @param module
238     * @since V2.00.01
239     * @return <div class="zh">是否支持。如果module不在定义范围内,返回INVALID </div> <div class="en">support or not .if module is out of
240     *         defined,return INVALID </div>
241     */
242    public ESupported getModuleSupported(int module);
243    
244    /**
245     * <div class="zh">获取打印状态 </div> <div class="en">get printer status </div>
246     * 
247     * @since V2.00.01
248     * @return <div class="zh">
249     *         <ul>
250     *         <li>0: 正常</li>
251     *         <li>1: 打印机忙</li>
252     *         <li>2: 打印机缺纸</li>
253     *         <li>3: 打印数据包格式错</li>
254     *         <li>4: 打印机故障</li>
255     *         <li>8: 打印机过热</li>
256     *         <li>9: 打印机电压过低</li>
257     *         <li>-16:打印未完成</li>
258     *         <li>-4:打印机未安装字库</li>
259     *         <li>-2:数据包过长</li>
260     *         </ul>
261     *         </div> <div class="en">
262     *         <ul>
263     *         <li>0- Success</li>
264     *         <li>1- Printer is busy</li>
265     *         <li>2- Out of paper</li>
266     *         <li>3- The format of print data packet error</li>
267     *         <li>4- Printer malfunctions</li>
268     *         <li>8- Printer over heats</li>
269     *         <li>9- Printer voltage is too low</li>
270     *         <li>-16- Printing is unfinished</li>
271     *         <li>-4- The printer has not installed font library</li>
272     *         <li>-2- Data package is too long</li>
273     *         </ul>
274     *         </div>
275     */
276    public int getPrinterStatus();
277    
278    /**
279     * <div class="zh"> 获取所有APP在指定网络类型下流量的使用情况。 </div> <div class="en"> get the usage of all APP traffic under the
280     * specified network type. </div>
281     *
282     * @param netType <div class="zh"> 1:表示 Wi-Fi; 2:表示移动网络; 6: 表示以太网; </div> <div class="en"> 1: Wi-Fi; 2: mobile network; 6: LAN;</div>
283     * 
284     * @param start   <div class="zh"> 开始时间,单位毫秒 </div> <div class="en"> start time (ms) </div>
285     * 
286     * @param end     <div class="zh"> 结束时间,单位毫秒 </div> <div class="en"> end time (ms) </div>
287     * 
288     * @return <div class="zh"> map(结构:key:应用名; value:流量 )</div> <div class="en"> map(key:application name value:traffic)</div>
289     * 
290     * @since V3.06.00
291     */
292    public Map<String, Long> getTrafficOfEachApp(int netType, long start, long end);
293
294    /**
295     * <div class="zh"> 获取系统指定网络类型的总使用流量 。 </div> <div class="en"> Gets the total usage traffic of the system specified
296     * network type. </div>
297     *
298     * @param netType <div class="zh"> 1:表示 Wi-Fi; 2:表示移动网络; 6: 表示以太网。 </div> <div class="en"> 1: Wi-Fi; 2: mobile network; 6: LAN.</div>
299     * 
300     * @param start   <div class="zh"> 开始时间,单位毫秒 </div> <div class="en"> start time (ms) </div>
301     * 
302     * @param end     <div class="zh"> 结束时间,单位毫秒 </div> <div class="en"> end time (ms) </div>
303     * 
304     * @return <div class="zh"> 流量 </div> <div class="en"> traffic </div>
305     * 
306     * @since V3.06.00
307     */
308    public long getTrafficTotal(int netType, long start, long end);
309    
310    /**
311     * <div class="zh"> 获取设备被使用的总次数。收集磁条卡的刷卡成功次数和 接触式芯片卡与非接卡的Apdu exchange成功次数</div> <div class="en"> Get total count
312     * for the device be used. collect swipe success times for MagCard ,and Apdu exchange success times for ICC and
313     * PICC. </div>
314     * 
315     * @param module
316     *            <div class="zh"> 设备类型类型 :1.磁条卡{@link #MODULE_MAG} 2.接触式芯片卡{@link #MODULE_ICC} 3.非接触式芯片卡
317     *            {@link #MODULE_PICC}</div> <div class="en"> device type:1.MagCard{@link #MODULE_MAG} 2.ICC
318     *            {@link #MODULE_ICC} 3.PICC{@link #MODULE_PICC}</div>
319     * @since V2.00.01
320     * @return <div class="zh">
321     *         <ul>
322     *         <li>>0 返回使用次数</li>
323     *         <li>-1 表示系统不支持</li>
324     *         <li>-2 模块超出定义范围</li>
325     *         </ul>
326     *         </div> <div class="en">
327     *         <ul>
328     *         <li>>0 usage count</li>
329     *         <li>-1 device not support</li>
330     *         <li>-2 not support module</li>
331     *         </ul>
332     *         </div>
333     */
334    public long getUsageCount(int module);
335    
336    /**
337     * <div class="zh">获取POS设备信息。</div> <div class="en">Get POS device information.</div>
338     *
339     * @return {@link DeviceInfo}
340     * @throws Exception
341     * @since V3.17.00
342     */
343    DeviceInfo getDeviceInfo() throws Exception;
344
345    /**
346     * <div class="zh">模块是否被启用。</div> <div class="en">Whether the module is enabled.</div>
347     *
348     * @param module <div class="zh">
349     *                  <ul>
350     *                      <li>1:MODULE_MAG</li>
351     *                      <li>2:MODULE_ICC</li>
352     *                      <li>3:MODULE_PICC</li>
353     *                      <li>4:MODULE_PED</li>
354     *                      <li>5:MODULE_PRINTER</li>
355     *                      <li>6:MODULE_SCANNER</li>
356     *                  </ul>
357     *               </div>
358     *               <div class="en">
359     *                  <ul>
360     *                      <li>1:MODULE_MAG</li>
361     *                      <li>2:MODULE_ICC</li>
362     *                      <li>3:MODULE_PICC</li>
363     *                      <li>4:MODULE_PED</li>
364     *                      <li>5:MODULE_PRINTER</li>
365     *                      <li>6:MODULE_SCANNER</li>
366     *                  </ul> </div>
367     * @return <div class="zh"></div> <div class="en"></div>
368     * @throws Exception
369     * @since V3.22.00
370     */
371    boolean isModuleEnable(int module) throws Exception;
372
373    /**
374     * <div class="zh">获取电池的循环次数。</div> <div class="en">Get the battery cycle count.</div>
375     *
376     * @return <div class="zh">电池的循环次数。</div> <div class="en">Battery cycle count.</div>
377     * @throws Exception Exception
378     * @since V3.22.00
379     */
380    int getBatteryCycleCount() throws Exception;
381
382    /**
383     * <div class="zh">清除电池数据。注意:设备重启后生效。</div>
384     * <div class="en">Clear battery data. Note: It will take effect after the device restarts.</div>
385     *
386     * @throws Exception Exception
387     * @since V3.27.00
388     */
389    void resetBMSData() throws Exception;
390
391    /**
392     * <div class="zh">设置电池模式。注意:设备重启后生效。</div>
393     * <div class="en">Set battery mode. Note: It will take effect after the device restarts.</div>
394     *
395     * @param mode <div class="zh">电池模式
396     *             <br>0:表示终端自动识别工作模式
397     *             <br>1:设定工作模式为移动模式
398     *             <br>2:设定工作模式为桌面模式</div>
399     *             <div class="en">Battery mode
400     *             <br>0: indicates that the device automatically recognizes the working mode
401     *             <br>1: Set the working mode to mobile mode
402     *             <br>2: Set the working mode to desktop mode</div>
403     * @throws Exception Exception
404     * @since V3.28.00
405     */
406    void setBMSMode(byte mode) throws Exception;
407
408    /**
409     * <div class="zh">设置电池模式。注意:设备重启后生效。</div>
410     * <div class="en">Set battery mode. Note: It will take effect after the device restarts.</div>
411     *
412     * @return <div class="zh">电池模式
413     *         <br>0:表示终端自动识别工作模式
414     *         <br>1:设定工作模式为移动模式
415     *         <br>2:设定工作模式为桌面模式</div>
416     *         <div class="en">Battery mode
417     *         <br>0: indicates that the device automatically recognizes the working mode
418     *         <br>1: Set the working mode to mobile mode
419     *         <br>2: Set the working mode to desktop mode</div>
420     * @throws Exception Exception
421     * @since V3.28.00
422     */
423    byte getBMSMode() throws Exception;
424
425    /**
426     * <div class="zh">切换临时移动模式。</div>
427     * <div class="en">Switch temporary mobile mode.</div>
428     *
429     * @param mode <div class="zh">0:关闭临时移动模式 1:开启临时移动模式 </div>
430     *             <div class="en">0: disable the temporary mobile mode. 1: enable the temporary mobile mode</div>
431
432     * @throws Exception Exception
433     * @since V3.32.00
434     */
435    void setTemporaryBMSMode(int mode) throws Exception;
436
437
438    /**
439     * <div class="zh">获取累计打印纸张长度。<br/>
440     *                 注:调用该接口前需先调用{@link ISys#setInfoCollect(boolean)}打开终端信息收集功能。</div>
441     * <div class="en">Gets the cumulative print paper length.<br/>
442     *                 Note: Before calling this interface, you need to call {@link ISys#setInfoCollect(boolean)} to enable
443     *                 the terminal information collection function.</div>
444     *
445     * @return   <div class="zh">累计打印纸张长度,单位是公里  </div>
446     *           <div class="en">The cumulative length of the printed paper, in kilometers</div>
447     * @throws Exception Exception
448     * @since V3.33.00
449     */
450    float getPaperUsage() throws Exception;
451
452    /**
453     * <div class="zh">获取电池衰减之后的容量占新电池容量的百分比。</div> <div class="en">Get the percentage of the capacity after battery decay to the new battery capacity.</div>
454     *
455     * @return <div class="zh">0-100,1表示1%,100表示100%。</div> <div class="en">0-100, 1 means 1%, 100 means 100%.</div>
456     * @throws Exception Exception
457     * @since V3.33.00
458     */
459    int getBatteryHealthState() throws Exception;
460
461    /**
462     * <div class="zh">获取emmc使用寿命信息。</div> <div class="en">Get emmc life information.</div>
463     *
464     * @return <div class="zh">emmc使用寿命信息。array[0]:Type A(emmc SLC块) ;array[1]:Type B(emmc MLC块)。{@link EmmcInfo}</div>
465     *          <div class="en">emmc life information. array[0]:Type A (emmc SLC block); array[1]:Type B (emmc MLC block).{@link EmmcInfo}</div>
466     * @throws Exception Exception
467     * @since V4.07.00
468     */
469    EmmcInfo[] getEmmcLifeInfo() throws Exception;
470
471    /**
472     * <div class="zh">获取前摄打开次数。</div> <div class="en">Gets the number of proactive opens.</div>
473     *
474     * @return <div class="zh">前摄打开次数 。</div> <div class="en">The number of proactive opens.</div>
475     * @throws Exception Exception
476     * @since V4.08.00
477     */
478    long getFrontCameraOpenCount() throws Exception;
479
480    /**
481     * <div class="zh">获取后摄打开次数。</div> <div class="en">Gets the number of shots opened.</div>
482     *
483     * @return <div class="zh">后摄打开次数。</div> <div class="en">Back shot open times.</div>
484     * @throws Exception Exception
485     * @since V4.08.00
486     */
487    long getRearCameraOpenCount() throws Exception;
488
489    /**
490     * <div class="zh">获取应用的网络使用情况。</div> <div class="en">Obtain the network usage of the application.</div>
491     *
492     * @param packageName <div class="zh">应用包名 </div>
493     *             <div class="en">Application package name</div>
494     *
495     * @return {@link com.pax.dal.entity.AppNetworkStats}
496     * @since V4.10.00
497     */
498    AppNetworkStats getAppNetworkStats(String packageName);
499
500    /**
501     * <div class="zh">清除应用缓存。</div> <div class="en">Clear application cache.</div>
502     *
503     * @param packageName <div class="zh">应用包名 </div>
504     *             <div class="en">Application package name</div>
505     *
506     * @param {@link ResultCallck}
507     * @throws Exception Exception
508     * @since V4.10.00
509     */
510    void cleanAppCache(String packageName, ResultCallback resultCallback) throws Exception;
511
512    /**
513     * <div class="zh">获取各个进程的系统资源使用情况。</div> <div class="en">Gets the system resource usage of each process.</div>
514     *
515     * @param {@link ProcessUsageListener}
516     * @throws Exception Exception
517     * @since V4.11.00
518     */
519    void getProcessUsage(ProcessUsageListener listener) throws Exception;
520
521    /**
522     * <div class="zh">获取EMMC CID值。</div> <div class="en">Obtain the EMMC CID value.</div>
523     *
524     * @return <div class="zh">EMMC CID 。</div> <div class="en">EMMC CID .</div>
525     * @throws Exception Exception
526     * @since V4.11.00
527     */
528    String getEmmcCidInfo() throws Exception;
529}