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 019 020import android.os.Bundle; 021 022import com.pax.dal.entity.LPRResult; 023import com.pax.dal.exceptions.LPRException; 024 025/** 026 * <div class="zh">LPR模块。</div> <div class="en">LPR module.</div> 027 */ 028public interface ILPR { 029 030 /** 031 * <div class="zh">印度车牌。</div> <div class="en">Indian license plate.</div> 032 * @since V4.04.00 033 */ 034 public static final int TYPE_IND = 1; 035 /** 036 * <div class="zh">中国车牌。</div> <div class="en">Chinese license plate.</div> 037 * @since V4.04.00 038 */ 039 public static final int TYPE_CHN = 2; 040 041 042 /** 043 * <div class="zh">设置授权认证ID。</div> <div class="en">Set the authorization ID.</div> 044 * 045 * @param authId <div class="zh">授权认证ID。</div> <div class="en">Authorization ID.</div> 046 * @throws LPRException 047 * @since V4.04.00 048 */ 049 void setAuthId(String authId) throws LPRException; 050 051 /** 052 * <div class="zh">打开LPR。</div> <div class="en">Open the LPR.</div> 053 * 054 * @throws LPRException 055 * @since V4.04.00 056 */ 057 void open() throws LPRException; 058 059 /** 060 * <div class="zh">获取当前LPR服务打开状态。</div> <div class="en">Get the current LPR service opening status.</div> 061 * 062 * @return <div class="zh">true:开启状态 false:关闭状态 </div> <div class="en">true: open state false: closed state</div> 063 * @since V4.04.00 064 */ 065 boolean isOpened(); 066 067 /** 068 * <div class="zh">获取当前LPR服务开始状态。</div> <div class="en">Get the current LPR service start status.</div> 069 * 070 * @return <div class="zh">true:开始状态 false:停止状态 </div> <div class="en">true: start state false: stop state</div> 071 * @since V4.04.00 072 */ 073 boolean isStarted(); 074 075 /** 076 * <div class="zh">设置预览配置。在{@link #open()}之后和{@link #startPreview(int, int, ILPR.ILPRListener)}之前调用。</div> 077 * <div class="en">Set the preview configuration.Called after {@link #open()} and before {@link #startPreview(int, int, ILPR.ILPRListener)}.</div> 078 * 079 * @param param <div class="zh"> 080 * <table border="1"> 081 * <tr> 082 * <th>KEY名称</th> 083 * <th>类型</th> 084 * <th>说明</th> 085 * </tr> 086 * <tr> 087 * <td>cameraId</td> 088 * <td>int</td> 089 * <td>摄像头ID(默认后置) 0:后置摄像头 1:前置摄像头</td> 090 * </tr> 091 * <tr> 092 * <td>isFlashOn</td> 093 * <td>boolean</td> 094 * <td>是否开启闪光灯(默认不开启) true:开启 false:不开启</td> 095 * </tr> 096 * <tr> 097 * <td>isAutoFocus</td> 098 * <td>boolean</td> 099 * <td>是否开启自动对焦(默认不开启) true:开启 false:不开启</td> 100 * </tr> 101 * </table> 102 * </div> 103 * <div class="en"> 104 * <table border="1"> 105 * <tr> 106 * <th>The KEY name</th> 107 * <th>Type</th> 108 * <th>Instructions</th> 109 * </tr> 110 * <tr> 111 * <td>cameraId</td> 112 * <td>int</td> 113 * <td>Camera ID(default rear). 0: rear camera 1: front camera</td> 114 * </tr> 115 * <tr> 116 * <td>isFlashOn</td> 117 * <td>boolean</td> 118 * <td>Whether to turn on the flash (not on by default).true:open, false:not open</td> 119 * </tr> 120 * <tr> 121 * <td>isAutoFocus</td> 122 * <td>boolean</td> 123 * <td>Whether to turn on autofocus (not on by default).true:open, false:not open</td> 124 * </tr> 125 * </table> 126 * </div> 127 * @throws LPRException 128 * @since V4.04.00 129 */ 130 void setPreviewParam(Bundle param) throws LPRException; 131 132 /** 133 * <div class="zh">打开预览界面进行识别。</div> <div class="en">Open the preview screen for recognition.</div> 134 * 135 * @param type <div class="zh">识别车牌类型。 136 * <ul> 137 * <li>{@link #TYPE_IND}</li> 138 * <li>{@link #TYPE_CHN}</li> 139 * </ul> 140 * </div> 141 * <div class="en">Type of license plate. 142 * <ul> 143 * <li>{@link #TYPE_IND}</li> 144 * <li>{@link #TYPE_CHN}</li> 145 * </ul> 146 * </div> 147 * @param timeout <div class="zh">超时时间。单位:毫秒。超时传入的小于3000ms,则是3000ms,超过3000ms则为传入的实际时间,0为不超时</div> 148 * <div class="en">Timeout time. Unit: ms. If the timeout provided is less than 3000ms, it will be set to 3000ms. If it exceeds 3000ms, 149 * the timeout will be set to the actual time provided. 0 means no timeout.</div> 150 * @param listener <div class="zh">识别结果回调。{@link ILPR.ILPRListener}</div> <div class="en">Callback of recognize results.{@link ILPR.ILPRListener}</div> 151 * @throws LPRException 152 * @since V4.04.00 153 */ 154 void startPreview(int type, int timeout, ILPR.ILPRListener listener) throws LPRException; 155 156 /** 157 * <div class="zh">关闭扫描预览界面。</div> <div class="en">Close the scan preview screen.</div> 158 * 159 * @throws LPRException 160 * @since V4.04.00 161 */ 162 void stopPreview() throws LPRException; 163 164 /** 165 * <div class="zh">关闭LPR。</div> <div class="en">Close the LPR.</div> 166 * 167 * @throws LPRException 168 * @since V4.04.00 169 */ 170 void close() throws LPRException; 171 172 /** 173 * <div class="zh">识别结果回调。</div> <div class="en">Callback of recognition result.</div> 174 * @since V4.04.00 175 */ 176 interface ILPRListener { 177 /** 178 * <div class="zh">成功回调。</div> <div class="en">Success callback.</div> 179 * @param result <div class="zh">根据{@link #startPreview(int, int, ILPR.ILPRListener)}的type,强制转换成对应的OCRResult。 180 * <br/>{@link #TYPE_IND}: {@link com.pax.dal.entity.LPRIndiaResult} 181 * <br/>{@link #TYPE_CHN}: {@link com.pax.dal.entity.LPRChinaResult}</div> 182 * <div class="en">Cast to the corresponding OCRResult according to the type of {@link #startPreview(int, int, ILPR.ILPRListener)}. 183 * <br/>{@link #TYPE_IND}: {@link com.pax.dal.entity.LPRIndiaResult} 184 * <br/>{@link #TYPE_CHN}: {@link com.pax.dal.entity.LPRChinaResult}</div> 185 * @since V4.04.00 186 */ 187 void onSuccess(LPRResult result); 188 189 /** 190 * <div class="zh">错误回调。</div> <div class="en">Error callback.</div> 191 * @param code <div class="zh"> 192 * <ul> 193 * <li>1:获取失败</li> 194 * <li>2:识别超时</li> 195 * <li>3:取消识别</li> 196 * <li>4:LPR服务初始化失败 </li> 197 * </ul> 198 * </div> 199 * <div class="en"> 200 * <ul> 201 * <li>1:Recognize failure</li> 202 * <li>2:Recognize timeout</li> 203 * <li>3:Cancel recognize</li> 204 * <li>4:LPR service initialization failure</li> 205 * </ul> 206 * </div> 207 * @since V4.04.00 208 */ 209 void onError(int code); 210 } 211}