Ver código fonte

硬件开启数量在接口返回后优先确定

Shangyp 3 meses atrás
pai
commit
0c99e730c1

+ 17 - 2
app/src/main/java/com/hanghui/senic/network/HttpRequest.java

@@ -250,6 +250,8 @@ public class HttpRequest {
         //补光灯设置
         RelaysAndLedUtile.getInstance().setLedLight(ConfigManager.getAuthenticationBeanListBean().getLightMode(), false);
 
+        //设置硬件开启数量
+        setHardwareOpenNum();
         //设置身份证阅读器相关
         setupIDCardReader();
         //二维码启动或关闭
@@ -278,6 +280,21 @@ public class HttpRequest {
         }
     }
 
+    private void setHardwareOpenNum() {
+        if (ConfigManager.getAuthenticationBeanListBean().isUseIdcard()) {
+            DeviceInitManager.getInstance().totalOpenHardwareNum++;
+        }
+        if (ConfigManager.getAuthenticationBeanListBean().isUseQrcode()){
+            DeviceInitManager.getInstance().totalOpenHardwareNum++;
+        }
+        if (ConfigManager.getAuthenticationBeanListBean().isOpenPassport()) {
+            DeviceInitManager.getInstance().totalOpenHardwareNum++;
+        }
+        if (ConfigManager.isOpenICCard()) {
+            DeviceInitManager.getInstance().totalOpenHardwareNum++;
+        }
+    }
+
     public void setStartSmileService() {
         SmileController.getInstance().init();
     }
@@ -513,7 +530,6 @@ public class HttpRequest {
         if (!ConfigManager.getAuthenticationBeanListBean().isUseQrcode()){
            return;
         }
-        DeviceInitManager.getInstance().totalOpenHardwareNum++;
         httpResponseCallback.updateView(Constants.Code_HttpResponseCallback_ShowQRCodeIcon, "二维码读头开启");
         //虚拟串口的二维码阅读器才需要初始化QRCodeController,串口的二维码阅读器走的是SerialController
         if (ConfigManager.getAuthenticationBeanListBean().getQrCodeReaderCommunicationMode() == 1) {
@@ -576,7 +592,6 @@ public class HttpRequest {
         if (!ConfigManager.getAuthenticationBeanListBean().isUseIdcard()) {
             return ;
         }
-        DeviceInitManager.getInstance().totalOpenHardwareNum++;
         httpResponseCallback.updateView(Constants.Code_HttpResponseCallback_ShowIDCardIcon, "身份证阅读器开启");
         IDCardControllerManager.init(ConfigManager.getAuthenticationBeanListBean().getIdCardReaderBrand());
     }

+ 1 - 1
app/src/main/java/com/hanghui/senic/service/usbserialdemo/utile/ConfigManager.java

@@ -97,7 +97,7 @@ public class ConfigManager {
 
     //在线配置的list返回其中一条数据bean
     public static AuthenticationBean.DataDTO getAuthenticationBeanListBean() {
-        return authenticationBean.getData().get(0);
+        return getAuthenticationBean().getData().get(0);
     }
 
     public static AuthenticationBean AuthenticationBeans() {