| | |
| | | import android.graphics.drawable.BitmapDrawable; |
| | | import android.hardware.Camera; |
| | | import android.opengl.Visibility; |
| | | import android.os.Build; |
| | | import android.os.Bundle; |
| | | import android.os.Handler; |
| | | import android.os.Message; |
| | |
| | | getDB().setModel(getVM()); |
| | | initRGBCheck(); |
| | | handler.sendEmptyMessageDelayed(0, 1000); |
| | | //启动心跳 |
| | | /*//启动心跳 |
| | | Intent intent = new Intent(MainActivity.this, HeartbeatService.class); |
| | | startService(intent); |
| | | //启动更新人脸 |
| | | Intent intent2 = new Intent(MainActivity.this, FaceUpdateService.class); |
| | | startService(intent2); |
| | | startService(intent2);*/ |
| | | getPermission(); |
| | | Timber.tag("====>").d(LMobileInfo.getDeviceUniqueId()); |
| | | } |
| | |
| | | long availableMemory = memoryInfo.availMem/(1024*1024); |
| | | long usedMemory = totalMemory - availableMemory; |
| | | //getDB().tvM.setText("总内存:"+totalMemory+",使用内存:"+usedMemory+",可用内存:"+availableMemory); |
| | | if((availableMemory<400&&showTime!=null&&(System.currentTimeMillis()-showTime>5000))|| |
| | | if((availableMemory<100&&showTime!=null&&(System.currentTimeMillis()-showTime>5000))|| |
| | | ("02:00:00".equals(StringUtil.getHM()))){ |
| | | //可用内存小于400M,或者每天凌晨2点,重启app |
| | | //restartApp(); |
| | | restartApp(); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | getDB().imgLeft.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | public void onClick(View v1) { |
| | | //todo 临时代码 |
| | | if (getDB().nsv.getVisibility()== View.VISIBLE) { |
| | | getDB().nsv.setVisibility(View.GONE); |
| | | }else { |
| | | getDB().nsv.setVisibility(View.VISIBLE); |
| | | } |
| | | |
| | | YNHAPI mAPI = YNHAPI.getInstance(); |
| | | mAPI.setNavigationBarVisibility(YNHAPI.NavigationBarVisibility.VISIBLE); |
| | | } |
| | | }); |
| | | upErrInfo(); |
| | |
| | | isShowing = true; |
| | | YNHAPI mAPI = YNHAPI.getInstance(); |
| | | mAPI.setNavigationBarVisibility(YNHAPI.NavigationBarVisibility.ALWAYS_INVISIBLE); |
| | | mAPI.setBootLaunchApk("com.doumee.keyCabinet", true); |
| | | showTime = System.currentTimeMillis(); |
| | | if(!isFaceOk) { |
| | | initLicense(); |
| | |
| | | //定时拉取基本信息 |
| | | getVM().devLogin(); |
| | | getPermission(); |
| | | getVM().devHeart(); |
| | | EventBus.getDefault().post(new GetFacesEvent()); |
| | | }else { |
| | | loopDownCount--; |
| | | } |
| | |
| | | EventBus.getDefault().post(new CloseGridOneResultEvent(key,"00".equals(open)?1:0)); |
| | | if(isShowing&&isShowTip){ |
| | | //修改显示提醒 |
| | | doRegister(5,null); |
| | | getVM().doAction(5); |
| | | } |
| | | }else if(data.startsWith("80")){ |
| | | //查询所有门状态 |
| | |
| | | keyPreviousData = data; |
| | | }else if(data.startsWith("CC02")){ |
| | | runOnUiThread(() -> { |
| | | //getVM().addInfo("获取到钥匙数据:" + data); |
| | | getVM().addInfo("获取到钥匙数据:" + data); |
| | | jxKey(data); |
| | | }); |
| | | keyPreviousData = null; |
| | |
| | | if(!TextUtils.isEmpty(keyPreviousData)){ |
| | | String data2 = keyPreviousData+data; |
| | | runOnUiThread(() -> { |
| | | //getVM().addInfo("获取到钥匙数据:" + data2); |
| | | getVM().addInfo("获取到钥匙数据:" + data2); |
| | | if(data2.contains("CC01")&&data2.contains("CC02")){ |
| | | String[] sp = data2.split("CC02"); |
| | | if(sp.length==2){ |
| | |
| | | updateList.add(gridDo); |
| | | } |
| | | } |
| | | } |
| | | //todo 去掉 |
| | | CabinetGridDo gridDo = oldMap.get("0101"); |
| | | if(gridDo!=null) { |
| | | EventBus.getDefault().post(new HttpEvent(StringUtil.DateToStrSS(new Date())+ |
| | | "=================>更新数据当前钥匙7:" + gridDo.getCurKeyCode())); |
| | | } |
| | | |
| | | getVM().updateGrids(updateList); |
| | |
| | | private boolean isInitPort; |
| | | //初始化串口 |
| | | private void initPort(){ |
| | | SpUtil.setString("port_grid","/dev/ttyS7"); |
| | | SpUtil.setString("port_key","/dev/ttyS1"); |
| | | SpUtil.setString("port_jiu","/dev/ttyS2"); |
| | | //SpUtil.setString("port_grid","/dev/ttyS7"); |
| | | //SpUtil.setString("port_key","/dev/ttyS1"); |
| | | //SpUtil.setString("port_jiu","/dev/ttyS2"); |
| | | gridPath = SpUtil.getString("port_grid"); |
| | | //getVM().addInfo("门串口链接:"+gridPath); |
| | | getVM().addInfo("门串口链接:"+gridPath); |
| | | keyPath = SpUtil.getString("port_key"); |
| | | //getVM().addInfo("钥匙串口链接:"+keyPath); |
| | | getVM().addInfo("钥匙串口链接:"+keyPath); |
| | | jiuPath = SpUtil.getString("port_jiu"); |
| | | //getVM().addInfo("酒精串口链接:"+jiuPath); |
| | | getVM().addInfo("酒精串口链接:"+jiuPath); |
| | | if(!TextUtils.isEmpty(SpUtil.getString("port_grid"))&& |
| | | !TextUtils.isEmpty(SpUtil.getString("port_key"))&& |
| | | !TextUtils.isEmpty(SpUtil.getString("port_jiu"))){ |