From 5719515b70fd7405e34198f15dfbc78c07975323 Mon Sep 17 00:00:00 2001
From: yy1717 <fctom1215@outlook.com>
Date: 星期五, 04 十二月 2020 11:45:49 +0800
Subject: [PATCH] Merge branch 'master' of https://gitee.com/endian11/DriveJudge
---
app/src/main/java/safeluck/drive/evaluation/app.java | 165 +++++++-----------------------------------------------
1 files changed, 22 insertions(+), 143 deletions(-)
diff --git a/app/src/main/java/safeluck/drive/evaluation/app.java b/app/src/main/java/safeluck/drive/evaluation/app.java
index 0bd8129..fe1b37f 100644
--- a/app/src/main/java/safeluck/drive/evaluation/app.java
+++ b/app/src/main/java/safeluck/drive/evaluation/app.java
@@ -3,7 +3,6 @@
import android.app.Application;
import android.content.Context;
import android.os.Environment;
-import android.os.Looper;
import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;
@@ -32,13 +31,10 @@
import org.json.JSONException;
import org.json.JSONObject;
-import java.io.BufferedReader;
import java.io.File;
-import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
-import java.util.concurrent.Executors;
import safeluck.drive.evaluation.DB.WorkRoomDataBase;
import safeluck.drive.evaluation.DB.appstatusdb.AppStatusWorker;
@@ -46,17 +42,15 @@
import safeluck.drive.evaluation.DB.criterias.CriteriaForIII;
import safeluck.drive.evaluation.DB.exam_status.ExamStatus;
import safeluck.drive.evaluation.DB.exam_status.ExamStatusOutWorker;
-import safeluck.drive.evaluation.DB.exam_status.ExamStatusWoker;
import safeluck.drive.evaluation.DB.failitems.FailedProj;
import safeluck.drive.evaluation.DB.failitems.LuKaoFailedProj;
import safeluck.drive.evaluation.DB.gps.GpsInfoWorker;
import safeluck.drive.evaluation.DB.route.RouteCross;
import safeluck.drive.evaluation.DB.route.RouteTriggerLine;
-import safeluck.drive.evaluation.DB.rtktb.RTKConfigUpdateWorker;
+import safeluck.drive.evaluation.bean.AbsInitialData;
import safeluck.drive.evaluation.bean.ExamPlatformData;
import safeluck.drive.evaluation.bean.RemoteRouteCollect;
import safeluck.drive.evaluation.bean.RouteCollect;
-import safeluck.drive.evaluation.cEventCenter.CEvent;
import safeluck.drive.evaluation.cEventCenter.CEventCenter;
import safeluck.drive.evaluation.im.MessageProcessor;
import safeluck.drive.evaluation.platformMessage.AttachInfo;
@@ -64,7 +58,6 @@
import safeluck.drive.evaluation.platformMessage.JKMessage0203;
import safeluck.drive.evaluation.platformMessage.JKMessage0206;
import safeluck.drive.evaluation.platformMessage.PlatFormConstant;
-import safeluck.drive.evaluation.routecollect.RouteCollectController;
import safeluck.drive.evaluation.util.CThreadPoolExecutor;
import safeluck.drive.evaluation.util.DataInitKt;
import safeluck.drive.evaluation.util.FileUtil;
@@ -72,7 +65,7 @@
import safeluck.drive.evaluation.util.SystemUtil;
import safeluck.drive.evaluation.util.Utils;
-import static safeluck.drive.evaluation.bean.ExamPlatformData.getRulesettingFilesName;
+import static safeluck.drive.evaluation.util.DataInitKt.sendJudgeArgs;
/**
* MyApplication2
@@ -115,7 +108,8 @@
//鑰冭瘯鐘舵�� 锛屼竴浜涘垵濮嬬姸鎬侊紝app涓�浜涚姸鎬佸簲璇ュ厛鍒濆鍖栦竴涓�
-
+// ExamPlatformData.getInstance().setMcuSN("0314200100000004");
+// ExamPlatformData.getInstance().setCanWriteSD(true);
}
}
@@ -123,21 +117,9 @@
private void initData() {
CThreadPoolExecutor.runInBackground(()->{
-
int type = WorkRoomDataBase.getWorkRoomDataBase(getApplicationContext()).getExamStatusDao().getStartExamInt();
- MyLog.i("寮�濮嬪垵濮嬪寲鏁版嵁鍙戦�佸湴鍥�/杞﹁締/mcu鍗囩骇鏂囦欢/鑰冭瘯鐘舵��="+type);
- ExamPlatformData.getInstance().setExamType(type);
-// OneTimeWorkRequest examStatausOutWorker = OneTimeWorkRequest.from(ExamStatusOutWorker.class);
-// sendMapInfo();
-// sendVechileInfo();
- sendRouteExam();
-// DataInitKt.MCUUpgrade(getApplicationContext());
- DataInitKt.sendExamLights(getApplicationContext());
- DataInitKt.sendRtkConfig(getApplicationContext());
-// DataInitKt.sendSignalConfigToRemote(getApplicationContext());
-// OneTimeWorkRequest mcuUpgradeWorker = OneTimeWorkRequest.from(MCUUpgradeWorker.class);
-// WorkManager.getInstance(getApplicationContext()).beginWith(examStatausOutWorker).then(mcuUpgradeWorker).enqueue();
-
+ MyLog.i("鑰冭瘯鐘舵��="+type);
+ ExamPlatformData.getInstance().setExamType(type);
//鍙戦�佽摑鐗欓厤缃秷鎭�
String mac= (String) SPUtils.get(getAppContext(),SPUtils.BLUETOOTH_MAC,"");
if (!TextUtils.isEmpty(mac)){
@@ -153,6 +135,17 @@
Log.i(TAG,json);
AYSdk.getInstance().sendCmd(Constant.ID_MS_BLUETOOTH_NAME,json);
}
+
+
+ sendRouteExam();
+ DataInitKt.sendRtkConfig(getApplicationContext());
+// DataInitKt.MCUUpgrade(getApplicationContext());
+
+ //鏀瑰湪钃濈墮宸茬粡杩炴帴锛屽彂閫乮nitialdata
+
+
+
+
@@ -221,35 +214,7 @@
AYSdk.getInstance().sendCmd(0x8017,str);
}
- private void sendJudgeArgs() {
- File dir = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+File.separator+getPackageName());
- List<String> names = ExamPlatformData.getRulesettingFilesName();
- for (int i = 0; i < names.size(); i++) {
- File settFile = new File(dir,names.get(i));
- if (settFile.exists() ){
- Log.i(TAG,settFile.getName()+"瀛樺湪涓嶅鍒�");
- }else{
- Log.i(TAG,settFile.getName()+"涓嶅瓨鍦紝澶嶅埗...");
- FileUtil.copyAssertFileToSD(getApplicationContext(),names.get(i));
- }
- }
-
- if (dir.exists()){
- File[] files = dir.listFiles();
- for (int i = 0; i < files.length; i++) {
- Log.i(TAG,files[i].getName());
- if (names.contains(files[i].getName())){
-
-
- byte[] buffer = FileUtil.readFile(files[i].getAbsolutePath());
- AYSdk.getInstance().sendCmd(Constant.ID_judge_args,new String(buffer).trim());
- }else{
-
- }
- }
- }
- }
public static Context getAppContext(){
return appContext;
@@ -424,11 +389,12 @@
}
}
- sendMapInfo();
+ DataInitKt.sendMapInfo();
+ DataInitKt.sendRoadMapInfo();
break;
case -2:
- sendVechileInfo();
+ DataInitKt.sendVehicleInfo();
break;
case -3:
Data data = new Data.Builder().putInt(Constant.NEED_MAPS_CAR,1).build();
@@ -457,7 +423,7 @@
break;
case Constant.REQ_VECHILE_PROFILE:
- sendVechileInfo();
+ DataInitKt.sendVehicleInfo();
break;
case Constant.GPS_INFO:
Data gpsData = new Data.Builder().putString(Constant.GPS_INFO_DATA,json).build();
@@ -679,6 +645,7 @@
initData();
}else{
ExamPlatformData.getInstance().getTTS().speak("鏈嶅姟寮傚父姝讳骸");
+ AbsInitialData.getInstance().resethasSendInitData();
}
@@ -705,94 +672,6 @@
return false;
}
- private void sendVechileInfo() {
-
- String carPath = ExamPlatformData.getInstance().getCarModelPath();
- if (!TextUtils.isEmpty(carPath)){
- MyLog.i("浣跨敤鏇存柊鍚庣殑Car妯″瀷鍦板浘"+carPath);
- byte[] bytes = FileUtil.readFile(carPath);
- if (bytes != null){
- String str = new String(bytes);
- AYSdk.getInstance().sendCmd(Constant.PUSH_VECHILE_PROFILE,str);
- }else{
- MyLog.i(String.format("鏂囦欢:%s涓嶅瓨鍦�",carPath));
- CThreadPoolExecutor.runOnMainThread(new Runnable() {
- @Override
- public void run() {
- Toast.makeText(getAppContext(), "鏂囦欢锛�"+carPath+"涓嶅瓨鍦�", Toast.LENGTH_SHORT).show();
- }
- });
- }
- }else{
- CThreadPoolExecutor.runOnMainThread(()->{
- MyLog.i("杞﹁締妯″瀷鍙戦�佸け璐ワ紝璇锋墜鍔ㄨ缃�");
- Toast.makeText(getAppContext(), "杞﹁締妯″瀷鍙戦�佸け璐ワ紝璇锋墜鍔ㄨ缃�", Toast.LENGTH_SHORT).show();
- });
- }
-
-
- }
-
- private void sendMapInfo(){
-
- final String mapPath = ExamPlatformData.getInstance().getMapPath();
- final String roadmapPath = ExamPlatformData.getInstance().getRoadMapPath();
-
- if (!TextUtils.isEmpty(roadmapPath)){
- MyLog.i("璋冪敤鏇存柊RoadMap璺緞鍚庣殑鍦板浘"+roadmapPath);
- byte[] fileContent = FileUtil.readFile(roadmapPath);
- if (fileContent != null){
- String str = new String(fileContent);
- MyLog.i("鏂囦欢鍐呭锛�"+str);
- AYSdk.getInstance().sendCmd(Constant.PUSH_ROAD_MAP_INFO,str);
- }else{
- MyLog.i(String.format("鏂囦欢:%s涓嶅瓨鍦�",roadmapPath));
- CThreadPoolExecutor.runOnMainThread(new Runnable() {
- @Override
- public void run() {
- Toast.makeText(getAppContext(), "鏂囦欢锛�"+roadmapPath+"涓嶅瓨鍦�", Toast.LENGTH_SHORT).show();
- }
- });
- }
- }else{
- CThreadPoolExecutor.runOnMainThread(new Runnable() {
- @Override
- public void run() {
- MyLog.i("閬撹矾鍦板浘鍙戦�佸け璐ワ紝璇锋墜鍔ㄨ缃�");
- Toast.makeText(getAppContext(), "閬撹矾鍦板浘鍙戦�佸け璐ワ紝璇锋墜鍔ㄨ缃�", Toast.LENGTH_SHORT).show();
- }
- });
- }
- if (!TextUtils.isEmpty(mapPath)){
- MyLog.i("璋冪敤鏇存柊Map璺緞鍚庣殑鍦板浘"+mapPath);
- byte[] fileContent = FileUtil.readFile(mapPath);
- if (fileContent != null){
- String str = new String(fileContent);
- Log.i(TAG, "鏂囦欢鍐呭锛�"+str);
- AYSdk.getInstance().sendCmd(Constant.PUSH_MAP_INFO,str);
- }else{
- MyLog.i(String.format("鏂囦欢:%s涓嶅瓨鍦�",mapPath));
-
- CThreadPoolExecutor.runOnMainThread(new Runnable() {
- @Override
- public void run() {
- Toast.makeText(getAppContext(), "鏂囦欢锛�"+mapPath+"涓嶅瓨鍦�", Toast.LENGTH_SHORT).show();
- }
- });
- }
- }else{
- CThreadPoolExecutor.runOnMainThread(new Runnable() {
- @Override
- public void run() {
- MyLog.i("鍦哄湴鍦板浘鍙戦�佸け璐ワ紝璇锋墜鍔ㄨ缃�");
- Toast.makeText(getAppContext(), "鍦哄湴鍦板浘鍙戦�佸け璐ワ紝璇锋墜鍔ㄨ缃�", Toast.LENGTH_SHORT).show();
- }
- });
- }
-
-
-
- }
}
--
Gitblit v1.8.0