| | |
| | | import android.os.Bundle; |
| | | import android.os.Handler; |
| | | import android.os.Message; |
| | | import android.serialport.SerialPortFinder; |
| | | import android.text.SpannableString; |
| | | import android.text.Spanned; |
| | | import android.text.TextUtils; |
| | | import android.text.style.TextAppearanceSpan; |
| | | import android.util.Log; |
| | | import android.view.Gravity; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | |
| | | import com.doumee.keyCabinet.ui.keyCabinet.ChangeUrlActivity; |
| | | import com.doumee.keyCabinet.ui.keyCabinet.KeyCabinetActivity; |
| | | import com.doumee.keyCabinet.ui.keyCabinet.ManageLoginActivity; |
| | | import com.doumee.keyCabinet.ui.keyCabinet.ZWListActivity; |
| | | import com.doumee.keyCabinet.ui.service.FaceUpdateService; |
| | | import com.doumee.keyCabinet.ui.service.HeartbeatService; |
| | | import com.doumee.keyCabinet.ui.face.AddFaceActivity; |
| | |
| | | import com.example.datalibrary.model.User; |
| | | import com.example.datalibrary.utils.ToastUtils; |
| | | import com.example.datalibrary.view.PreviewTexture; |
| | | import com.mc.enjoysdk.McHome; |
| | | import com.mc.enjoysdk.McSystemUi; |
| | | import com.mc.enjoysdk.transform.McSystemUiFlag; |
| | | import com.proembed.service.MyService; |
| | | import com.yanzhenjie.permission.runtime.Permission; |
| | | |
| | | import org.greenrobot.eventbus.EventBus; |
| | | import org.greenrobot.eventbus.Subscribe; |
| | | import org.greenrobot.eventbus.ThreadMode; |
| | | |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.PrintStream; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | |
| | | private int downCount = 0; |
| | | private Long lastDownTime; |
| | | private Long showTime; |
| | | private McSystemUi mcSystemUi; |
| | | private McHome mcHome; |
| | | private MyService mXService; |
| | | |
| | | private Handler handler = new Handler(){ |
| | | @Override |
| | |
| | | Intent intent2 = new Intent(MainActivity.this, FaceUpdateService.class); |
| | | startService(intent2);*/ |
| | | getPermission(); |
| | | Timber.tag("====>").d(LMobileInfo.getDeviceUniqueId()); |
| | | mcSystemUi = McSystemUi.getInstance(this); |
| | | mcHome = McHome.getInstance(this); |
| | | mXService = new MyService(this); |
| | | //Timber.tag("====>").d(LMobileInfo.getDeviceUniqueId()); |
| | | Thread.setDefaultUncaughtExceptionHandler((thread, throwable) -> { |
| | | String time2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); |
| | | getVM().addInfo("GlobalException线程报错:" + thread.getName()); |
| | | try { |
| | | ByteArrayOutputStream out = new ByteArrayOutputStream(); |
| | | PrintStream print = new PrintStream(out); |
| | | //导出发生异常的时间 |
| | | print.println(time2); |
| | | print.println(); |
| | | throwable.printStackTrace(print); |
| | | SpUtil.saveString(CrashHandler.FILE_NAME+time2,new String(out.toByteArray())); |
| | | print.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | getVM().addInfo("错误日志2"+e.getMessage()); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | private void initM(){ |
| | |
| | | getDB().nsv.setVisibility(View.VISIBLE); |
| | | } |
| | | //显示状态栏 |
| | | mcSystemUi.temporarilySwitchStatusBar(true); |
| | | //显示导航栏 |
| | | mcSystemUi.temporarilySwitchNavigation(true); |
| | | MCUtils.show(mXService); |
| | | } |
| | | }); |
| | | upErrInfo(); |
| | |
| | | if(devConfigBean!=null){ |
| | | if(devConfigBean.getBannerList()!=null) { |
| | | setBanner(devConfigBean.getBannerList()); |
| | | } |
| | | if(!isFaceOk) { |
| | | initLicense(); |
| | | } |
| | | setJiuConfig(); |
| | | initPort(); |
| | |
| | | switch (type){ |
| | | case 2: |
| | | case 3: { |
| | | if(!isFaceOk) { |
| | | initLicense(); |
| | | return; |
| | | } |
| | | //校验是否登录 |
| | | if(MApplication.getConfigBean().getId()==null){ |
| | | Toast.makeText(mContext, "设备未添加,无法操作", Toast.LENGTH_SHORT).show(); |
| | |
| | | super.onResume(); |
| | | isShowing = true; |
| | | getVM().setSubmit(true); |
| | | MCUtils.hind(mcSystemUi); |
| | | mcHome.setHomePackage("com.doumee.keyCabinet"); |
| | | MCUtils.hind(mXService); |
| | | MCUtils.setHomePackage(mXService,"com.doumee.keyCabinet"); |
| | | showTime = System.currentTimeMillis(); |
| | | if(!isFaceOk) { |
| | | initLicense(); |
| | | } |
| | | if(isHavePermission) { |
| | | checkUpdate(); |
| | | } |
| | |
| | | } |
| | | |
| | | private void initModel(List<FaceUserBean> userBeans) { |
| | | if(!isFaceOk){ |
| | | return; |
| | | } |
| | | if (com.example.datalibrary.manager.FaceSDKManager.initStatus == com.example.datalibrary.manager.FaceSDKManager.SDK_MODEL_LOAD_SUCCESS) { |
| | | getVM().addInfo("更新人脸===》开始更新"); |
| | | //getVM().addInfo("更新人脸===》开始更新"); |
| | | waitUpdate(userBeans); |
| | | }else { |
| | | getVM().addInfo("更新人脸===》初始化"); |
| | | //getVM().addInfo("更新人脸===》初始化"); |
| | | initFaceSDKManager(userBeans); |
| | | } |
| | | } |
| | |
| | | //一号版 |
| | | bh = 1; |
| | | } |
| | | String[] sp = data.split("AA"); |
| | | List<String> sp = new ArrayList<>(); |
| | | String data2 = data.substring(8,data.length()); |
| | | while (data2.length()>0){ |
| | | if (data2.length()<22) { |
| | | sp.add(data2+""); |
| | | data2 = ""; |
| | | }else { |
| | | sp.add(data2.substring(0,22)); |
| | | data2 = data2.substring(22); |
| | | } |
| | | } |
| | | for(String s:sp){ |
| | | if(s.length()>=20){ |
| | | String key = SportUtils.intToHex(bh)+s.substring(4,6); |
| | |
| | | }else { |
| | | gridDo.setCurKeyCode(""); |
| | | } |
| | | if("0101".equals(key)) { |
| | | if("0109".equals(key)) { |
| | | getVM().addInfo(key+" , "+isHaveKey+" "+keyCode); |
| | | getVM().addInfo(key + "设置钥匙:" + gridDo.getCurKeyCode()); |
| | | } |
| | |
| | | /*SpUtil.setString("port_grid","/dev/ttyS0"); |
| | | SpUtil.setString("port_key","/dev/ttyS4"); |
| | | SpUtil.setString("port_jiu","/dev/ttyS9");*/ |
| | | |
| | | gridPath = SpUtil.getString("port_grid"); |
| | | getVM().addInfo("门串口链接:"+gridPath); |
| | | keyPath = SpUtil.getString("port_key"); |
| | | getVM().addInfo("钥匙串口链接:"+keyPath); |
| | | jiuPath = SpUtil.getString("port_jiu"); |
| | | getVM().addInfo("酒精串口链接:"+jiuPath); |
| | | if(!TextUtils.isEmpty(SpUtil.getString("port_grid"))&& |
| | | !TextUtils.isEmpty(SpUtil.getString("port_key"))&& |
| | | !TextUtils.isEmpty(SpUtil.getString("port_jiu"))){ |
| | | if(isInitPort){ |
| | | return; |
| | | } |
| | | gridPath = SpUtil.getString("port_grid"); |
| | | getVM().addInfo("门串口链接:"+gridPath); |
| | | keyPath = SpUtil.getString("port_key"); |
| | | getVM().addInfo("钥匙串口链接:"+keyPath); |
| | | jiuPath = SpUtil.getString("port_jiu"); |
| | | getVM().addInfo("酒精串口链接:"+jiuPath); |
| | | xhCount=0; |
| | | closePort(chosePort); |
| | | if(!TextUtils.isEmpty(SpUtil.getString("port_grid"))){ |