yy1717
2020-12-04 5719515b70fd7405e34198f15dfbc78c07975323
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 {
            }
        }
    }
}