|
@@ -1,6 +1,5 @@
|
|
|
package com.hh.arome.ui;
|
|
|
|
|
|
-import android.app.ActivityManager;
|
|
|
import android.content.ComponentName;
|
|
|
import android.content.Context;
|
|
|
import android.content.ServiceConnection;
|
|
@@ -31,18 +30,13 @@ import com.alipay.iot.bpaas.api.BPaaSInitCallback;
|
|
|
import com.alipay.iot.bpaas.api.service.BPaaSCallback;
|
|
|
import com.alipay.iot.bpaas.api.service.BPaaSResponse;
|
|
|
import com.blankj.utilcode.util.FileUtils;
|
|
|
-import com.common.face.api.FaceUtil;
|
|
|
import com.common.lib_base.aop.annotation.NoDoubleClick;
|
|
|
import com.common.lib_base.common.async.ThreadPoolManager;
|
|
|
import com.common.lib_base.common.local.AppLocalConfigHandler;
|
|
|
import com.common.lib_base.utils.GlideUtils;
|
|
|
import com.common.lib_base.utils.NetworkUtils;
|
|
|
import com.common.lib_base.utils.StringUtils;
|
|
|
-import com.common.lib_base.utils.TimeUtils;
|
|
|
-import com.common.lib_base.utils.app.AppUtils;
|
|
|
import com.common.lib_base.utils.ui.ToastUtils;
|
|
|
-import com.common.lib_base.utils.ui.UIUtils;
|
|
|
-import com.common.pos.api.util.ShellUtils;
|
|
|
|
|
|
|
|
|
import android.app.Activity;
|
|
@@ -75,6 +69,7 @@ import androidx.annotation.NonNull;
|
|
|
import com.alipay.iot.bpaas.api.InnerApi;
|
|
|
import com.alipay.iot.bpaas.api.ipc.IpcChannel;
|
|
|
import com.alipay.iot.bpaas.api.ipc.IpcListener;
|
|
|
+import com.common.lib_base.utils.ui.UIUtils;
|
|
|
import com.common.print.BasePrinter;
|
|
|
import com.common.print.IPrinter;
|
|
|
import com.common.print.callback.PrintInitResultCallback;
|
|
@@ -84,6 +79,11 @@ import com.google.gson.JsonObject;
|
|
|
import com.hh.arome.BuildConfig;
|
|
|
import com.hh.arome.MyApplication;
|
|
|
import com.hh.arome.R;
|
|
|
+import com.hh.arome.basecard.BaseSocialSecurityCardBean;
|
|
|
+import com.hh.arome.basecard.BaseSocialSecurityCardReader;
|
|
|
+import com.hh.arome.basecard.SocialSecurityCardConfig;
|
|
|
+import com.hh.arome.basecard.listener.SimpleSocialSecurityCardResaultListener;
|
|
|
+import com.hh.arome.basecard.listener.SocialSecurityCardResaultListener;
|
|
|
import com.hh.arome.bean.AlipayUserInfoRequestBean;
|
|
|
import com.hh.arome.bean.AlipayUserInfoResultBean;
|
|
|
import com.hh.arome.bean.BizContentBean;
|
|
@@ -112,9 +112,9 @@ import com.hh.arome.common.scan.idcard.IDCardScan;
|
|
|
import com.hh.arome.common.scan.idcard.bean.IDCardInfoBean;
|
|
|
import com.hh.arome.common.scan.idcard.callback.IDCardInitResultCallback;
|
|
|
import com.hh.arome.common.scan.idcard.callback.IDCardScanResultCallback;
|
|
|
-import com.hh.arome.common.voice.BaiduVoice;
|
|
|
import com.hh.arome.common.voice.MTTSDemo;
|
|
|
import com.hh.arome.helper.Serial.SerialPortFinder;
|
|
|
+import com.hh.arome.lib_sscard.DX_SSCardReader;
|
|
|
import com.hh.arome.mvp.contract.AlipayUserInfoContract;
|
|
|
import com.hh.arome.mvp.contract.DeviceConfigContract;
|
|
|
import com.hh.arome.mvp.contract.HeartbeatContract;
|
|
@@ -133,8 +133,8 @@ import com.hh.arome.services.keeplive.RemoteService;
|
|
|
import com.hh.arome.ui.base.BaseHHActivity;
|
|
|
import com.hh.arome.utlis.DateUtil;
|
|
|
import com.hh.arome.utlis.IdCardUtils;
|
|
|
+import com.hh.arome.utlis.log.AppNetLogUtils;
|
|
|
import com.telpo.tps508.PrintContentBean;
|
|
|
-import com.telpo.tps508.PrintUtile;
|
|
|
import com.hh.arome.utlis.device.DeviceUtils;
|
|
|
import com.hh.arome.utlis.device.FaceScenicUtile;
|
|
|
import com.hh.arome.utlis.log.AppLogUtils;
|
|
@@ -181,6 +181,8 @@ import static com.hh.arome.common.Constants.Ampe.ACTION_MICROPHONE_STATE;
|
|
|
import static com.hh.arome.common.Constants.Ampe.ACTION_PRINT;
|
|
|
import static com.hh.arome.common.Constants.Ampe.ACTION_QR;
|
|
|
import static com.hh.arome.common.Constants.Ampe.ACTION_SCAN_FACE;
|
|
|
+import static com.hh.arome.common.Constants.Ampe.ACTION_SOCIALSECURITYCARDCONFIG;
|
|
|
+import static com.hh.arome.common.Constants.Ampe.ACTION_SOCIALSECURITYCARDINFO;
|
|
|
import static com.hh.arome.common.Constants.Ampe.ACTION_SPEECH;
|
|
|
import static com.hh.arome.common.Constants.Ampe.ACTION_SPEECH_STOP;
|
|
|
import static com.hh.arome.common.Constants.Ampe.ACTION_START_INFRARED_INDUCTION_LISTENER;
|
|
@@ -194,6 +196,7 @@ import static com.hh.arome.common.Constants.Ampe.EVENT_IDCard_LISTENER;
|
|
|
import static com.hh.arome.common.Constants.Ampe.EVENT_INFRARED_INDUCTION_LISTENER;
|
|
|
import static com.hh.arome.common.Constants.Ampe.EVENT_MICROPHONE_LISTENER;
|
|
|
import static com.hh.arome.common.Constants.Ampe.EVENT_QR_LISTENER;
|
|
|
+import static com.hh.arome.common.Constants.Ampe.EVENT_SOCIALSECURITYCARD_LISTENER;
|
|
|
import static com.hh.arome.common.Constants.LogcatValue.LINE;
|
|
|
import static com.hh.arome.common.Constants.LogcatValue.LOG_NODE_AIDL;
|
|
|
import static com.hh.arome.common.Constants.LogcatValue.LOG_NODE_APPLET;
|
|
@@ -204,10 +207,10 @@ import static com.hh.arome.common.Constants.LogcatValue.LOG_NODE_INFRARED_INDUCT
|
|
|
import static com.hh.arome.common.Constants.LogcatValue.LOG_NODE_MICROPHONE;
|
|
|
import static com.hh.arome.common.Constants.LogcatValue.LOG_NODE_NET;
|
|
|
import static com.hh.arome.common.Constants.LogcatValue.LOG_NODE_NET_CONFIG_QUERY;
|
|
|
-import static com.hh.arome.common.Constants.LogcatValue.LOG_NODE_NET_HEARTBEAT;
|
|
|
import static com.hh.arome.common.Constants.LogcatValue.LOG_NODE_QR;
|
|
|
import static com.hh.arome.common.Constants.LogcatValue.LOG_NODE_SPEECH;
|
|
|
import static com.hh.arome.common.Constants.LogcatValue.LOG_PRINT;
|
|
|
+import static com.hh.arome.common.Constants.LogcatValue.LOG_SOCIAL_SECURITY_CARD;
|
|
|
import static com.hh.arome.common.Constants.LogcatValue.LOG_SPEECH;
|
|
|
import static com.hh.arome.common.Constants.LogcatValue.NET_CRASH;
|
|
|
import static com.hh.arome.common.Constants.LogcatValue.NET_ERROR;
|
|
@@ -225,7 +228,6 @@ import static com.hh.arome.common.Constants.Value.INDUCTION_PEOPLE_YES;
|
|
|
import static com.hh.arome.common.Constants.Value.TIME_HEARTBEAT;
|
|
|
import static com.hh.arome.common.Constants.Value.TIME_INDUCTION_INTERVAL;
|
|
|
import static com.hh.arome.common.Constants.Value.TOKEN;
|
|
|
-import static org.apache.log4j.Layout.LINE_SEP;
|
|
|
|
|
|
|
|
|
public class MainActivity extends BaseHHActivity implements DeviceConfigContract.View,
|
|
@@ -272,7 +274,7 @@ public class MainActivity extends BaseHHActivity implements DeviceConfigContract
|
|
|
private TextView tv_idcard_info;
|
|
|
private TextView tv_scan_result;
|
|
|
private Button tv_voice;
|
|
|
-
|
|
|
+ BaseSocialSecurityCardReader reader;
|
|
|
@Override
|
|
|
public int setLayout() {
|
|
|
if (Constants.DeviceModel.D2.equals(deviceModel)) {
|
|
@@ -2593,6 +2595,28 @@ public class MainActivity extends BaseHHActivity implements DeviceConfigContract
|
|
|
}else if(Constants.Ampe.ACTION_SECONDARYSCREENSTATE.equals(ampeAppletRequestBean.getAction())){
|
|
|
//副屏显示状态
|
|
|
getSecondaryScreen(ampeAppletRequestBean,bridgeCallback);
|
|
|
+ }else if(ACTION_SOCIALSECURITYCARDINFO.equals(ampeAppletRequestBean.getAction())){
|
|
|
+ AmpeActionDataBean SocialSecurityCardInfoBean = new AmpeActionDataBean();
|
|
|
+ SocialSecurityCardInfoBean.setTaskId(ampeAppletRequestBean.getTaskId());
|
|
|
+ SocialSecurityCardInfoBean.setBridgeCallback(bridgeCallback);
|
|
|
+ SocialSecurityCardInfoBean.setEvent(ampeAppletRequestBean.getEvent());
|
|
|
+ ampeActionMap.put(ACTION_SOCIALSECURITYCARDINFO, SocialSecurityCardInfoBean);
|
|
|
+ //启动社保卡读卡器
|
|
|
+ startSSCardReader();
|
|
|
+ }else if(ACTION_SOCIALSECURITYCARDCONFIG.equals(ampeAppletRequestBean.getAction())){
|
|
|
+ //启动社保卡读卡器
|
|
|
+ startSSCardReader();
|
|
|
+ AmpeAppletResultBean ssConfigBean = new AmpeAppletResultBean();
|
|
|
+ ssConfigBean.setAction(ACTION_SOCIALSECURITYCARDCONFIG);
|
|
|
+ ssConfigBean.setEvent(ampeAppletRequestBean.getEvent());
|
|
|
+ ssConfigBean.setTaskId(ampeAppletRequestBean.getTaskId());
|
|
|
+ ssConfigBean.setSuccess(true);
|
|
|
+ ssConfigBean.setMessage("成功");
|
|
|
+ JsonObject jsonObject = gson.toJsonTree(ssConfigBean).getAsJsonObject();
|
|
|
+ if (bridgeCallback != null) {
|
|
|
+ bridgeCallback.callback(jsonObject.toString());
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -3036,6 +3060,93 @@ public class MainActivity extends BaseHHActivity implements DeviceConfigContract
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * desc:发送社保卡信息数据
|
|
|
+ * @author xia weihao
|
|
|
+ * @date 2024/6/25
|
|
|
+ *
|
|
|
+ */
|
|
|
+ private void sendSSCardtoApplet(String jsonStr) {
|
|
|
+ // 监听,主动推送给小程序
|
|
|
+ sendMessageToApplet(Constants.Ampe.EVENT_SOCIALSECURITYCARD_LISTENER, jsonStr);
|
|
|
+ // 单次发送给小程序
|
|
|
+ runOnUiThread(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ AmpeActionDataBean ampeActionDataBean = ampeActionMap.get(ACTION_SOCIALSECURITYCARDINFO);
|
|
|
+ ampeActionMap.remove(ACTION_SOCIALSECURITYCARDINFO);
|
|
|
+ if (ampeActionDataBean == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ AromeServiceInvoker.BridgeCallback bridgeCallback = null;
|
|
|
+ try {
|
|
|
+ bridgeCallback = ampeActionDataBean.getBridgeCallback();
|
|
|
+ } catch (NullPointerException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ AmpeAppletResultBean bean = new AmpeAppletResultBean();
|
|
|
+ bean.setAction(ACTION_SOCIALSECURITYCARDINFO);
|
|
|
+ bean.setEvent(ampeActionDataBean.getEvent());
|
|
|
+ bean.setTaskId(ampeActionDataBean.getTaskId());
|
|
|
+ bean.setSuccess(true);
|
|
|
+ bean.setMessage("成功");
|
|
|
+ AmpeAppletResultBean.Data dataBean = gson.fromJson(jsonStr,AmpeAppletResultBean.Data.class);
|
|
|
+ bean.setData(dataBean);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // 回传处理结果给小程序
|
|
|
+ try {
|
|
|
+ JsonObject jsonObject = gson.toJsonTree(bean).getAsJsonObject();
|
|
|
+ if (bridgeCallback != null) {
|
|
|
+ bridgeCallback.callback(jsonObject.toString());
|
|
|
+ }
|
|
|
+ } catch (Throwable t) {
|
|
|
+ AppLogUtils.e("onCalled--t" + t);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * desc:启动社保卡读卡器
|
|
|
+ * @author xia weihao
|
|
|
+ * @date 2024/6/25
|
|
|
+ *
|
|
|
+ */
|
|
|
+ private void startSSCardReader() {
|
|
|
+ if (reader == null) {
|
|
|
+ synchronized (MainActivity.class) {
|
|
|
+ if(reader==null) {
|
|
|
+ reader = new DX_SSCardReader();
|
|
|
+ reader.init(MainActivity.this);
|
|
|
+
|
|
|
+ SocialSecurityCardConfig config = new SocialSecurityCardConfig();
|
|
|
+ config.setnType(1);
|
|
|
+ config.setSlotPSAM(0x11);
|
|
|
+ reader.setConfig(config);
|
|
|
+ reader.setListener(new SimpleSocialSecurityCardResaultListener() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(BaseSocialSecurityCardBean data) {
|
|
|
+ // AppLogUtils.i("_____________123"+data.getAllInfoJson());
|
|
|
+ sendSSCardtoApplet(data.getAllInfoJson());
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onInfoLog(String infoMsg) {
|
|
|
+ AppNetLogUtils.sendLogs(mLogcatAddPresenter, isNetAvailable,
|
|
|
+ LOG_SOCIAL_SECURITY_CARD, infoMsg);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ reader.startRead();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
*
|
|
@@ -3069,7 +3180,7 @@ public class MainActivity extends BaseHHActivity implements DeviceConfigContract
|
|
|
LogcatAddRequestBean logBean = new LogcatAddRequestBean();
|
|
|
logBean.setLogType(NET_LOGCAT);
|
|
|
// 对应web端"日志标签"
|
|
|
- logBean.setLogTag(logLine + WARP + LOG_NODE_APPLET + LOG_NODE_MICROPHONE);
|
|
|
+ logBean.setLogTag(logLine + WARP + LOG_NODE_APPLET + action);
|
|
|
logBean.setLogContent(logContentSb.toString());
|
|
|
requestLogcatAdd(logBean);
|
|
|
// 日志开始----------------end
|
|
@@ -3265,6 +3376,8 @@ public class MainActivity extends BaseHHActivity implements DeviceConfigContract
|
|
|
} else if (eventName.equals(EVENT_INFRARED_INDUCTION_LISTENER)) {
|
|
|
// 开启红外感应持续监听
|
|
|
type = EVENT_INFRARED_INDUCTION_LISTENER;
|
|
|
+ }else if(eventName.equals(EVENT_SOCIALSECURITYCARD_LISTENER)){
|
|
|
+ type=LOG_SOCIAL_SECURITY_CARD;
|
|
|
}
|
|
|
|
|
|
// 日志行数——对应web端"日志标签"
|
|
@@ -6333,9 +6446,10 @@ public class MainActivity extends BaseHHActivity implements DeviceConfigContract
|
|
|
@Override
|
|
|
protected void onDestroy() {
|
|
|
AppLogUtils.e(mTag + "onDestroy");
|
|
|
-
|
|
|
onDestroyUnregister();
|
|
|
-
|
|
|
+ if(reader!=null){
|
|
|
+ reader.release(MainActivity.this);
|
|
|
+ }
|
|
|
super.onDestroy();
|
|
|
|
|
|
|