app/src/main/java/safeluck/drive/evaluation/MainActivity.java
@@ -25,6 +25,7 @@ import androidx.work.WorkManager; import me.yokeyword.fragmentation.SupportActivity; import safeluck.drive.evaluation.DB.exam_status.ExamStatusViewModel; import safeluck.drive.evaluation.DB.rtktb.RTKConfig; import safeluck.drive.evaluation.DB.rtktb.RTKConfigViewModel; import safeluck.drive.evaluation.DB.signalConfigdb.SignalConfigViewModel; @@ -46,6 +47,9 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import safeluck.drive.evaluation.im.IMSClientBootstrap; import safeluck.drive.evaluation.im.MessageProcessor; @@ -58,6 +62,7 @@ import safeluck.drive.evaluation.util.SPUtils; import safeluck.drive.evaluation.util.Utils; import safeluck.drive.evaluation.viewmodels.ExamPlatformModel; import safeluck.drive.evaluation.viewmodels.TimeViewModel; public class MainActivity extends SupportActivity implements IMSConnectStatusCallback { @@ -69,7 +74,9 @@ private Gson gson = new Gson(); String[] PERMISSIONS = new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA}; RTKConfigViewModel rtkConfigViewModel; public ExamPlatformModel examPlatformModel; private ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); private ICEventListener icEventListener = new ICEventListener() { @Override @@ -98,7 +105,6 @@ private List<SignalConfigRemote> signalConfiglist = new ArrayList<>(); public ExamPlatformModel examPlatformModel; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -133,7 +139,12 @@ } }); scheduledExecutorService.scheduleAtFixedRate(new Runnable() { @Override public void run() { ExamPlatformData.getInstance().setTimeArrive_10s(true); } },10,10, TimeUnit.SECONDS); rtkConfigViewModel = ViewModelProviders.of(this).get(RTKConfigViewModel.class); app/src/main/java/safeluck/drive/evaluation/app.java
@@ -79,6 +79,7 @@ import safeluck.drive.evaluation.util.SPUtils; import safeluck.drive.evaluation.util.SystemUtil; import safeluck.drive.evaluation.util.Utils; import safeluck.drive.evaluation.viewmodels.TimeViewModel; import safeluck.drive.evaluation.worker.MCUUpgradeWorker; import safeluck.drive.evaluation.worker.TTSWorker; @@ -438,7 +439,27 @@ } jkMessage0206.attachInfo = attachInfo; if (ExamPlatformData.getInstance().getTrainingMode()==ExamPlatformData.MODE_NONE){ Log.i(TAG,"非训练和考试"); //判断10s时间是否到 if (ExamPlatformData.getInstance().isTimeArrive_10s()){ Log.i(TAG,"非训练和考试10s到"); //到了 就走下面发送0206消息 MessageProcessor.getInstance().sendMessage(jkMessage0206); //重置标记 ExamPlatformData.getInstance().setTimeArrive_10s(false); }else{ //没到,就不走下面 不发送0206,直接return return; } }else{ MessageProcessor.getInstance().sendMessage(jkMessage0206); } } catch (JSONException e) { e.printStackTrace(); app/src/main/java/safeluck/drive/evaluation/bean/ExamPlatformData.java
@@ -50,9 +50,13 @@ public static final int DEV_NOT_LOGIN = 5; public static final int DEV_LOGIN = 6; private int trainingMode = 0;//即不是训练模式也是考试模式 private int trainingMode = 0;//即不是训练模式也不是考试模式 public static final int EXAMING_MODE =1; public static final int TRAINING_MODE =2; //主要是为了控制既不是考试模式也不是训练模式下 0206消息的发送,10s一次发送 private boolean timeArrive_10s = false; private static HashMap<Integer,String> examPlatformStrs = new HashMap<>(); private List<Integer> sns =new ArrayList<>();//保存所有失败项目的sn @@ -314,31 +318,12 @@ return simulate_light_tips; } public List<Integer> getSns() { // if (sns.size()<=0){ // String snsstr = (String) SPUtils.get(app.getAppContext(),SPUtils.FAIL_PROJ_SNS,""); // if (!TextUtils.isEmpty(snsstr)){ // String[] strings=snsstr.split("#"); // for (int i = 0; i < strings.length; i++) { // Log.i(TAG, String.format("strings[%d]=%s",i,strings[i])); // if (!TextUtils.isEmpty(strings[i])) // sns.add(Integer.parseInt(strings[i])); // } // } // } return sns; public boolean isTimeArrive_10s() { return timeArrive_10s; } public void addSn(int sn) { // stringBuffer.append("#"+String.valueOf(sn)); // SPUtils.put(app.getAppContext(),SPUtils.FAIL_PROJ_SNS,stringBuffer.toString()); this.sns.add(sn); } public void clearSns() { // SPUtils.clear(app.getAppContext()); sns.clear(); public void setTimeArrive_10s(boolean timeArrive_10s) { this.timeArrive_10s = timeArrive_10s; } public void setRTKPort(int port) { app/src/main/java/safeluck/drive/evaluation/im/MessageProcessor.java
@@ -180,7 +180,7 @@ } }else{ //考试模式下全部都可以发送 //考试模式下 和什么模式都不是状态 全部都可以发送 return true; } app/src/main/java/safeluck/drive/evaluation/platformMessage/JKMessage8201.java
@@ -15,7 +15,7 @@ @Ascii public String name; //TODO Length(0) 表示什么意思 @Order(4) @Length(0) @Ascii