app/src/main/java/safeluck/drive/evaluation/app.java
@@ -19,6 +19,7 @@
import com.anyun.exam.lib.MyLog;
import com.anyun.exam.lib.crash.CrashHandler;
import com.anyun.im_lib.ExecutorServiceFactory;
import com.facebook.stetho.Stetho;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
@@ -86,6 +87,16 @@
            FileUtil.createdirs(getApplicationContext());
            failedProjRepository = new FailedProjRepository(this);
            rtkWorkRepository = new RTKWorkRepository(this);
            MyLog.i(TAG,"拷贝assert目录下的map" +
                    "和vechile json到包目录下");
            new Thread(new Runnable() {
                @Override
                public void run() {
                    FileUtil.copyAssertFileToSD(getApplicationContext(),Constant.MAP);
                    FileUtil.copyAssertFileToSD(getApplicationContext(),Constant.VEHICLE);
                }
            }).start();
        }
    }
@@ -144,7 +155,24 @@
                break;
            case Constant.EXAM_STATUS_REPLY:
                MyLog.d(TAG, "考试开始,需要删除上一个考试学员的数据库失败项目表");
                failedProjRepository.deleteAll();
                try {
                    failedProjRepository.deleteAll();
                    JSONObject jsonObject =new JSONObject((String)json);
                    int errCode = jsonObject.getInt("error");
                    switch (errCode){
                        case -1:
                            sendMapInfo();
                            break;
                        case -2:
                            sendVechileInfo();
                            break;
                        case -3:
                            break;
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }
                break;
            case Constant.RTK_PLATFORM_CONNECT_STATUS:
                String[] conn_strs = new String[2];
@@ -156,8 +184,42 @@
                WorkManager.getInstance(getApplicationContext()).enqueue(oneTimeWorkRequest);
                break;
            case Constant.FETCH_MAP_INFO:
                sendMapInfo();
                StringBuffer buffer =FileUtil.readTxtFileFromSD(this,Constant.MAP);
                break;
            case Constant.REQ_VECHILE_PROFILE:
                sendVechileInfo();
                break;
            case Constant.GPS_INFO:
                Data gpsData = new Data.Builder().putString(Constant.GPS_INFO_DATA,json).build();
                OneTimeWorkRequest gpsinfoWorkRequest = new OneTimeWorkRequest.Builder(GpsInfoWorker.class).setInputData(gpsData).build();
                WorkManager.getInstance(getApplicationContext()).enqueue(gpsinfoWorkRequest);
                break;
        }
    }
    private void sendVechileInfo() {
        new Thread(new Runnable() {
            @Override
            public void run() {
                StringBuffer vebuffer =FileUtil.readTxtFileFromSD(getApplicationContext(),Constant.VEHICLE);
                if (vebuffer != null){
                    AYSdk.getInstance().sendCmd(Constant.PUSH_VECHILE_PROFILE,vebuffer.toString());
                }else{
                    MyLog.d(TAG,String.format("车辆模型模型未拷入[%s]目录下", Environment.getExternalStorageDirectory().getAbsolutePath()+"/"+getApplicationContext().getPackageName()));
                }
            }
        }).start();
    }
    private void sendMapInfo(){
        new Thread(new Runnable() {
            @Override
            public void run() {
                StringBuffer buffer =FileUtil.readTxtFileFromSD(getApplicationContext(),Constant.MAP);
                if (buffer != null){
                    AYSdk.getInstance().sendCmd(Constant.PUSH_MAP_INFO,buffer.toString());
@@ -165,24 +227,8 @@
                    MyLog.d(TAG,String.format("地图模型未拷入[%s]目录下", Environment.getExternalStorageDirectory().getAbsolutePath()+"/"+getApplicationContext().getPackageName()));
                }
                break;
            case Constant.REQ_VECHILE_PROFILE:
                StringBuffer vebuffer =FileUtil.readTxtFileFromSD(this,Constant.VEHICLE);
                if (vebuffer != null){
                    AYSdk.getInstance().sendCmd(Constant.PUSH_VECHILE_PROFILE,vebuffer.toString());
                }else{
                    MyLog.d(TAG,String.format("车辆模型模型未拷入[%s]目录下", Environment.getExternalStorageDirectory().getAbsolutePath()+"/"+getApplicationContext().getPackageName()));
                }
                break;
            case Constant.GPS_INFO:
                Data gpsData = new Data.Builder().putString(Constant.GPS_INFO_DATA,json).build();
                OneTimeWorkRequest gpsinfoWorkRequest = new OneTimeWorkRequest.Builder(GpsInfoWorker.class).setInputData(gpsData).build();
                WorkManager.getInstance(getApplicationContext()).enqueue(gpsinfoWorkRequest);
                break;
        }
            }
        }).start();
    }
}