app/src/main/java/safeluck/drive/evaluation/DB/rtktb/RTKConfigUpdateWorker.kt | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/safeluck/drive/evaluation/MainActivity.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/safeluck/drive/evaluation/app.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/safeluck/drive/evaluation/bean/AbsInitialData.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/safeluck/drive/evaluation/bean/UserOpStatus.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/safeluck/drive/evaluation/fragment/SetArgumentsFragment.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/safeluck/drive/evaluation/util/DataInit.kt | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
app/src/main/java/safeluck/drive/evaluation/DB/rtktb/RTKConfigUpdateWorker.kt
@@ -64,9 +64,9 @@ phone = sn Log.i(TAG,"phone="+phone) getMap(sn, "road") getMap(sn, "yard") getMap(sn, "car") // getMap(sn, "road") // getMap(sn, "yard") // getMap(sn, "car") MyLog.i(PlatFormConstant.TAG,"重置TCP连接") IMSClientBootstrap.getInstance().resetConnect(); app/src/main/java/safeluck/drive/evaluation/MainActivity.java
@@ -37,6 +37,7 @@ import safeluck.drive.evaluation.DB.rtktb.RTKConfigUpdateWorker; import safeluck.drive.evaluation.DB.rtktb.RTKConfigViewModel; import safeluck.drive.evaluation.DB.signalConfigdb.SignalConfigViewModel; import safeluck.drive.evaluation.bean.AbsInitialData; import safeluck.drive.evaluation.bean.ExamPlatformData; import safeluck.drive.evaluation.bean.SignalConfigRemote; import safeluck.drive.evaluation.cEventCenter.CEventCenter; @@ -64,6 +65,7 @@ import safeluck.drive.evaluation.platformMessage.JKMessage0101; import safeluck.drive.evaluation.platformMessage.PlatFormConstant; import safeluck.drive.evaluation.util.CThreadPoolExecutor; import safeluck.drive.evaluation.util.DataInitKt; import safeluck.drive.evaluation.util.FileUtil; import safeluck.drive.evaluation.util.PermissionManager; import safeluck.drive.evaluation.util.SPUtils; @@ -130,12 +132,14 @@ break; case 1: des ="蓝牙打开"; break; case 2: des ="蓝牙未连接"; break; case 3: authMapViewmodel.setAuthValue(3); //需要延迟再发送,因为发送蓝牙已连接在前,收到sn在后,所以延迟发送3 ,可以取得sn scheduledExecutorService.schedule(()->{ authMapViewmodel.setAuthValue(3);},1,TimeUnit.SECONDS); des ="蓝牙连接"; String mac = jsonObject.getString("bluetooth_addr"); SPUtils.put(getApplicationContext(),SPUtils.BLUETOOTH_MAC,mac); @@ -222,10 +226,14 @@ if (integer.intValue() == Constant.BLUETOOTH_CONNECT){ MyLog.i(TAG,"Bluetooth connected,auth permission and sn != null"); String sn = ExamPlatformData.getInstance().getMcuSN(); MyLog.i(TAG,"权限允许,获得到的sn="+sn); Data data = new Data.Builder().putString(safeluck.drive.evaluation.DB.Constant.RTK_CONFIG_UPDATE_JSON,sn).build(); OneTimeWorkRequest rtkConfigUpdateWorker= new OneTimeWorkRequest.Builder(RTKConfigUpdateWorker.class).setInputData(data).build(); WorkManager.getInstance(getApplicationContext()).enqueue(rtkConfigUpdateWorker); if (!TextUtils.isEmpty(sn)){ MyLog.i(TAG,"权限允许,蓝牙已连接,获得到的sn="+sn); AbsInitialData.getInstance().sendInitialData(); }else{ MyLog.i(TAG,"权限允许,蓝牙已连接,获得到的sn=null,不能发送初始数据"); } } } }); @@ -336,42 +344,9 @@ private void setSDAuthAndSendJudgeArg() { ExamPlatformData.getInstance().setCanWriteSD(true); //只要app不销毁(重启)只会请求一次,但是确保PERMISSIONS最后一个元素是writeSD CThreadPoolExecutor.runInBackground(()->{ MyLog.i(TAG,"权限允许,开始发送配置参数"); sendJudgeArgs(); }); } private void sendJudgeArgs() { FileUtil.createdirs(getApplicationContext()); 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{ } } } } @Override protected void onDestroy() { super.onDestroy(); 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()); //改在蓝牙已经连接,发送initialdata @@ -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(); } }); } } } app/src/main/java/safeluck/drive/evaluation/bean/AbsInitialData.java
New file @@ -0,0 +1,142 @@ package safeluck.drive.evaluation.bean; import android.os.Environment; import android.renderscript.Element; import android.text.TextUtils; import android.util.Log; import android.widget.Toast; import com.anyun.basecommonlib.MyLog; import com.anyun.exam.lib.AYSdk; import com.google.gson.Gson; import org.json.JSONObject; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import okhttp3.ResponseBody; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; import safeluck.drive.evaluation.Constant; import safeluck.drive.evaluation.app; import safeluck.drive.evaluation.httpmodule.HttpCarRespBean; import safeluck.drive.evaluation.httpmodule.HttpRequetBean; import safeluck.drive.evaluation.httpmodule.HttpRoadMapRsp; import safeluck.drive.evaluation.httpmodule.HttpYardRsp; import safeluck.drive.evaluation.httpmodule.RetrofitCreator; import safeluck.drive.evaluation.platformMessage.PlatFormConstant; import safeluck.drive.evaluation.util.CThreadPoolExecutor; import safeluck.drive.evaluation.util.DataInitKt; import safeluck.drive.evaluation.util.FileUtil; import static safeluck.drive.evaluation.util.DataInitKt.sendJudgeArgs; /** * DriveJudge * Created by lzw on 2020/12/3. 15:45:26 * 邮箱:632393724@qq.com * All Rights Saved! Chongqing AnYun Tech co. LTD */ public class AbsInitialData { private UserOpStatus userOpStatus = UserOpStatus.getInstance(); private static boolean hasSend = false; public static AbsInitialData getInstance(){ return new AbsInitialData(); } private boolean checkPermission(){ return ExamPlatformData.getInstance().isCanWriteSD(); } /*** * 如果服务异常死亡,可以置hasSend为false,然后sendINintdata */ public void resethasSendInitData(){ hasSend = false; } /**********f发送灯光考试项和考试状态**********/ private void sendLightsAndExamStatus(){ DataInitKt.sendExamLightsAndExamStatus(app.getAppContext()); } private void sendCarModelFile(){ if (userOpStatus.getCarFileSelectState()== UserOpStatus.State.SELECT_CAR_FILE_STATE){ MyLog.i("用户在设置里面选择车模型文件"); DataInitKt.sendVehicleInfo(); }else{ MyLog.i("用户没有在设置里面选择车模型文件,则进行htp请求(先检查sn是否为空)"); if (ExamPlatformData.getInstance().getMcuSN() != null){ DataInitKt.getMap(ExamPlatformData.getInstance().getMcuSN(),"car"); }else{ MyLog.i("sn为空,不能请求http下载车模型"); } } } private void sendRoadMapFile(){ if (userOpStatus.getRoadFileSelectState()== UserOpStatus.State.SELECT_ROAD_MAP_STATE){ MyLog.i("用户在设置里面选择车模型文件"); DataInitKt.sendRoadMapInfo(); }else{ MyLog.i("用户没有在设置里面选择车模型文件,则进行htp请求(先检查sn是否为空)"); if (ExamPlatformData.getInstance().getMcuSN() != null){ DataInitKt.getMap(ExamPlatformData.getInstance().getMcuSN(),"road"); }else{ MyLog.i("sn为空,不能请求http下载道路"); } } } private void sendItemsMapFile(){ if (userOpStatus.getItemsFileSelectState()== UserOpStatus.State.SELECT_ITEMS_MAP_STATE){ MyLog.i("用户在设置里面选择场地文件"); DataInitKt.sendMapInfo(); }else{ MyLog.i("用户没有在设置里面选择场地文件,则进行htp请求(先检查sn是否为空)"); if (ExamPlatformData.getInstance().getMcuSN() != null){ DataInitKt.getMap(ExamPlatformData.getInstance().getPhone(),"yard"); }else{ MyLog.i("sn为空,不能请求http下载场地"); } } } ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(); public synchronized void sendInitialData(){ if (checkPermission() && !hasSend){ /**********只有权限满足(读写SD卡权限)和没有发送过的情况下才进行以下操作*********/ hasSend = true; sendCarModelFile(); sendRoadMapFile(); sendItemsMapFile(); sendJudgeArgs(); //需要延迟发送,因为前面有http请求 executorService.schedule(()->{ Log.i("AYJiaKao","延迟发送"); sendLightsAndExamStatus();},1, TimeUnit.SECONDS); }else{ MyLog.i(hasSend?"已经发送过了初始数据":"权限不允许,不能发送初始数据"); } } } app/src/main/java/safeluck/drive/evaluation/bean/UserOpStatus.java
New file @@ -0,0 +1,57 @@ package safeluck.drive.evaluation.bean; /** * DriveJudge * * 用户手动在设置里面选择 车辆模型文件,科二 、科三地图文件 * Created by lzw on 2020/12/3. 15:37:53 * 邮箱:632393724@qq.com * All Rights Saved! Chongqing AnYun Tech co. LTD */ public class UserOpStatus { public static UserOpStatus getInstance() { return new UserOpStatus(); } private UserOpStatus(){} public enum State{ SELECT_NOEN_STATE,SELECT_CAR_FILE_STATE,SELECT_ROAD_MAP_STATE,SELECT_ITEMS_MAP_STATE } /*******默认是没有手动选择文件,是通过http进行下载然后保存发送地图文件、车辆文件********/ private State carFileSelectState = State.SELECT_NOEN_STATE; private State roadFileSelectState = State.SELECT_NOEN_STATE; private State itemsFileSelectState = State.SELECT_NOEN_STATE; public State getCarFileSelectState() { return carFileSelectState; } public void setCarFileSelectState(State carFileSelectState) { this.carFileSelectState = carFileSelectState; } public State getRoadFileSelectState() { return roadFileSelectState; } public void setRoadFileSelectState(State roadFileSelectState) { this.roadFileSelectState = roadFileSelectState; } public State getItemsFileSelectState() { return itemsFileSelectState; } public void setItemsFileSelectState(State itemsFileSelectState) { this.itemsFileSelectState = itemsFileSelectState; } public void resetItemsFileSelectState(){ itemsFileSelectState = State.SELECT_NOEN_STATE; } public void resetRoadFileSelectState(){ roadFileSelectState = State.SELECT_NOEN_STATE; } public void resetCarFileSelectState(){ carFileSelectState = State.SELECT_NOEN_STATE; } } app/src/main/java/safeluck/drive/evaluation/fragment/SetArgumentsFragment.java
@@ -54,6 +54,7 @@ import safeluck.drive.evaluation.adapter.WrapContentLinearLayoutManager; import safeluck.drive.evaluation.bean.ExamPlatformData; import safeluck.drive.evaluation.bean.MCUInfo; import safeluck.drive.evaluation.bean.UserOpStatus; import safeluck.drive.evaluation.cEventCenter.CEventCenter; import safeluck.drive.evaluation.cEventCenter.ICEventListener; import safeluck.drive.evaluation.customview.MyArgEditText; @@ -269,14 +270,17 @@ case R.id.btn_car_upgrade: Toast.makeText(_mActivity, "更新车模型", Toast.LENGTH_SHORT).show(); DataInitKt.getMap(ExamPlatformData.getInstance().getPhone(),"car"); UserOpStatus.getInstance().resetCarFileSelectState(); break; case R.id.btn_yard_update: Toast.makeText(_mActivity, "更新场地地图", Toast.LENGTH_SHORT).show(); DataInitKt.getMap(ExamPlatformData.getInstance().getPhone(),"yard"); UserOpStatus.getInstance().resetItemsFileSelectState(); break; case R.id.btn_road_update: Toast.makeText(_mActivity, "更新道路地图", Toast.LENGTH_SHORT).show(); DataInitKt.getMap(ExamPlatformData.getInstance().getPhone(),"road"); UserOpStatus.getInstance().resetRoadFileSelectState(); break; default: break; @@ -302,6 +306,7 @@ if (data != null){ final Uri uri= data.getData(); Log.i(TAG, "onActivityResult: "+uri.getPath()); UserOpStatus.getInstance().setItemsFileSelectState(UserOpStatus.State.SELECT_ITEMS_MAP_STATE); ExamPlatformData.getInstance().setNewMapPath(uri.getPath()); CThreadPoolExecutor.runInBackground(()-> { @@ -321,6 +326,7 @@ final Uri uri= data.getData(); Log.i(TAG, "onActivityResult: "+uri.getPath()); ExamPlatformData.getInstance().setCarModelPath(uri.getPath()); UserOpStatus.getInstance().setCarFileSelectState(UserOpStatus.State.SELECT_CAR_FILE_STATE); CThreadPoolExecutor.runInBackground(()-> { byte[] fileContent = FileUtil.readFile(uri.getPath()); @@ -339,6 +345,7 @@ final Uri uri= data.getData(); Log.i(TAG, "onActivityResult: "+uri.getPath()); ExamPlatformData.getInstance().setNewRoadMapPath(uri.getPath()); UserOpStatus.getInstance().setRoadFileSelectState(UserOpStatus.State.SELECT_ROAD_MAP_STATE); CThreadPoolExecutor.runInBackground(() -> { byte[] fileContent = FileUtil.readFile(uri.getPath()); if (fileContent != null){ app/src/main/java/safeluck/drive/evaluation/util/DataInit.kt
@@ -6,9 +6,8 @@ import android.util.Log import android.widget.Toast import androidx.work.Data import androidx.work.ListenableWorker import com.anyun.exam.lib.AYSdk import com.anyun.basecommonlib.MyLog import com.anyun.exam.lib.AYSdk import com.google.gson.Gson import com.google.gson.reflect.TypeToken import com.google.gson.stream.JsonReader @@ -18,7 +17,6 @@ import retrofit2.Call import retrofit2.Callback import retrofit2.Response import retrofit2.http.Url import safeluck.drive.evaluation.Constant import safeluck.drive.evaluation.DB.WorkRoomDataBase import safeluck.drive.evaluation.DB.rtktb.RTKConfig @@ -31,10 +29,9 @@ import safeluck.drive.evaluation.httpmodule.HttpYardRsp import safeluck.drive.evaluation.httpmodule.RetrofitCreator.Companion.getRestService import safeluck.drive.evaluation.platformMessage.PlatFormConstant import safeluck.drive.evaluation.worker.MCUUpgradeWorker import java.io.File import java.io.IOException import java.io.InputStreamReader import java.net.URL import java.net.URLDecoder import java.nio.charset.Charset @@ -75,7 +72,7 @@ private val gson = Gson() private val tempQs: MutableList<SimulateNightBean.QuestionBean> = java.util.ArrayList() var simulateNightBean:SimulateNightBean=SimulateNightBean() fun sendExamLights(applicationContext: Context){ fun sendExamLightsAndExamStatus(applicationContext: Context){ MyLog.i("发送灯光") val examType = ExamPlatformData.getInstance().examType @@ -327,7 +324,7 @@ } private fun sendMapInfo(){ fun sendMapInfo(){ val mapPath = ExamPlatformData.getInstance().mapPath @@ -344,7 +341,7 @@ } } private fun sendVehicleInfo(){ fun sendVehicleInfo(){ val carPath = ExamPlatformData.getInstance().carModelPath if (!TextUtils.isEmpty(carPath)) { MyLog.i("更新后的Car模型$carPath") @@ -357,7 +354,7 @@ } } } private fun sendRoadMapInfo(){ fun sendRoadMapInfo(){ val roadmapPath = ExamPlatformData.getInstance().roadMapPath if (!TextUtils.isEmpty(roadmapPath)) { @@ -374,3 +371,30 @@ } } fun sendJudgeArgs() { val dir = File(Environment.getExternalStorageDirectory().absolutePath + File.separator + app.getAppContext().getPackageName()) val names = ExamPlatformData.getRulesettingFilesName() for (i in names.indices) { val settFile = File(dir, names[i]) if (settFile.exists()) { Log.i("app.TAG", settFile.name + "存在不复制") } else { Log.i("app.TAG", settFile.name + "不存在,复制...") FileUtil.copyAssertFileToSD(app.getAppContext().applicationContext, names[i]) } } if (dir.exists()) { val files = dir.listFiles() for (i in files.indices) { Log.i("app.TAG", files[i].name+" names.size="+names.size) if (names.contains(files[i].name)) { val buffer = FileUtil.readFile(files[i].absolutePath) var str =String(buffer) AYSdk.getInstance().sendCmd(Constant.ID_judge_args, str) } else { } } } }