添加init界面,调整了认证后逻辑,调整了扫描枪扫描处理
This commit is contained in:
Vendored
+2
-1
@@ -18,4 +18,5 @@
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
#-renamesourcefileattribute SourceFile
|
||||
-keep class androidx.core.app.CoreComponentFactory { *; }
|
||||
|
||||
@@ -23,9 +23,9 @@ public class ScanGunKeyEventHelper {
|
||||
// private String mDeviceName = "TMC HIDKeyBoard";
|
||||
private String mDeviceName = "Linux 3.4.35 with ak-hsudc Composite Gadget (ACM + HID)";
|
||||
private String mDeviceName1 = "USBKey Chip USBKey Module";
|
||||
private long lastTime = 0L;
|
||||
|
||||
public ScanGunKeyEventHelper(Context context, OnScanSuccessListener onScanSuccessListener) {
|
||||
|
||||
mContext = context;
|
||||
mOnScanSuccessListener = onScanSuccessListener;
|
||||
mStringBufferResult = new StringBuffer();
|
||||
@@ -38,6 +38,14 @@ public class ScanGunKeyEventHelper {
|
||||
*/
|
||||
private void performScanSuccess() {
|
||||
String barcode = mStringBufferResult.toString();
|
||||
L.d("performScanSuccess barcode = " + barcode);
|
||||
long currentTime = System.currentTimeMillis();
|
||||
if (currentTime - lastTime < 5 * 1000) {
|
||||
L.d("performScanSuccess 操作太频繁");
|
||||
mStringBufferResult.setLength(0);
|
||||
return;
|
||||
}
|
||||
lastTime = currentTime;
|
||||
if (mOnScanSuccessListener != null && !TextUtils.isEmpty(barcode))
|
||||
mOnScanSuccessListener.onScanSuccess(barcode);
|
||||
mStringBufferResult.setLength(0);
|
||||
|
||||
@@ -34,4 +34,10 @@ public class SerialApi {
|
||||
}
|
||||
serialPortManager.sendCommand(generateOpenCommand(boxNumber), callback);
|
||||
}
|
||||
|
||||
public static void close() {
|
||||
if (serialPortManager != null) {
|
||||
serialPortManager.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user