"联网考试“去掉由程序主动结束考试;可以一直考试;修改地图,可以一次性加载场考所有地图,然后车移动到某个项目地图,单独显示项目地图;修改map.json;信号配置,只在ExamStatusOutWorker里面收到ndk_start的时候进行发送;
| | |
| | | "id": 863, |
| | | "item": 1, |
| | | "point": [{ |
| | | "x-y": [-5.3706, 30.3648, -4.9011, 29.4905, -4.1911, 29.8586, -3.7009, 28.7631, -2.5941, 29.2631, -3.0647, 30.3601, -2.3782, 30.7019, -2.9159, 31.6925] |
| | | "x-y": [-9.3806, 37.3791, -8.9130, 36.4974, -8.1991, 36.8640, -7.6962, 35.7786, -6.6023, 36.2578, -7.0759, 37.3599, -6.4065, 37.7090, -6.8984, 38.6962] |
| | | } |
| | | ] |
| | | }, |
| | |
| | | "id": 864, |
| | | "item": 3, |
| | | "point": [{ |
| | | "x-y": [-5.3806, 30.3791, -4.9130, 29.4974, -4.1991, 29.8640, -3.6962, 28.7786, -2.6023, 29.2578, -3.0759, 30.3599, -2.4065, 30.7090, -2.8984, 31.6962] |
| | | "x-y": [-5.3806, 37.3791, -4.9130, 36.4974, -4.1991, 36.8640, -3.6962, 35.7786, -2.6023, 36.2578, -3.0759, 37.3599, -2.4065, 37.7090, -2.8984, 38.6962] |
| | | } |
| | | ] |
| | | }, |
| | |
| | | "id": 865, |
| | | "item": 2, |
| | | "point": [{ |
| | | "x-y": [-2.4065,30.709,-3.0759,30.3599,-2.6023,29.2578,-2.9669,29.0981,-3.4503,30.1946,-3.8247,30.0293,-3.3316,28.9383,-3.6962,28.7786,-4.1991,29.864] |
| | | "x-y": [-1.9065, 30.7090, -2.5759, 30.3599, -2.1023, 29.2578, -2.4669, 29.0981, -2.9503, 30.1946, -3.3247, 30.0293, -2.8316, 28.9383, -3.1962, 28.7786, -3.6991, 29.8640] |
| | | } |
| | | ] |
| | | }, |
| | |
| | | "id": 866, |
| | | "item": 5, |
| | | "point": [{ |
| | | "x-y": [-2.8984, 31.6962, -2.4065, 30.7090, -3.0759, 30.3599, -2.6023, 29.2578, -3.6962, 28.7786,-4.6667 ,30.7457] |
| | | "x-y": [1.1016, 31.6962, 1.5935, 30.7090, 0.9241, 30.3599, 1.3977, 29.2578, 0.3038, 28.7786, -0.6667, 30.7457] |
| | | } |
| | | ] |
| | | }, |
| | |
| | | |
| | | @Query("update exam_status set enter =:enter where map_id =:mapid") |
| | | void updateEnter(int enter,int mapid); |
| | | @Query("update exam_status set result =:result where map_id =:mapid") |
| | | void updateItemResult(int result,int mapid); |
| | | @Query("update exam_status set startExam =:startexam") |
| | | void updateStartExam(int startexam); |
| | | |
| | |
| | | |
| | | import android.content.Context |
| | | import android.util.Log |
| | | import android.widget.Toast |
| | | import androidx.work.Data |
| | | import androidx.work.Worker |
| | | import androidx.work.WorkerParameters |
| | | import com.anyun.exam.lib.AYSdk |
| | | import com.anyun.exam.lib.MyLog |
| | | import com.google.gson.Gson |
| | | import org.json.JSONException |
| | | import org.json.JSONObject |
| | | import safeluck.drive.evaluation.DB.Constant |
| | | import safeluck.drive.evaluation.DB.WorkRoomDataBase |
| | | import safeluck.drive.evaluation.DB.signalConfigdb.SingalConfig |
| | | import safeluck.drive.evaluation.bean.SignalConfigRemote |
| | | |
| | | class ExamStatusOutWorker(context: Context, workerParams: WorkerParameters) : Worker(context, workerParams) { |
| | | val TAG:String = "ExamStatusOutWorker" |
| | | private var signalConfiglist: MutableList<SignalConfigRemote> = ArrayList() |
| | | private val gson = Gson() |
| | | private var singalConfigs :List<SingalConfig> = ArrayList() |
| | | override fun doWork(): Result { |
| | | val examType =WorkRoomDataBase.getWorkRoomDataBase(applicationContext).examStatusDao.startExamInt; |
| | | singalConfigs = WorkRoomDataBase.getWorkRoomDataBase(applicationContext).signalConfigDao._getSignalConfigs() |
| | | for (i in singalConfigs.indices) { |
| | | val signalConfigRemote = SignalConfigRemote() |
| | | signalConfigRemote.func_id = i |
| | | signalConfigRemote.gpio_num = singalConfigs.get(i).getIndex() |
| | | signalConfigRemote.level = singalConfigs.get(i).getHighLevel() |
| | | signalConfiglist.add(signalConfigRemote) |
| | | } |
| | | var indexs = WorkRoomDataBase.getWorkRoomDataBase(applicationContext).signalConfigDao.allIndexs |
| | | sendSignalConfigsToRemote(indexs) |
| | | MyLog.i("查到的考试type="+examType) |
| | | val data = Data.Builder().putInt(Constant.EXAM_STATUS_TYPE,examType).build() |
| | | if (examType != safeluck.drive.evaluation.Constant.NONE_BEEN_START_EXAM) { |
| | |
| | | return Result.success(data) |
| | | } |
| | | |
| | | private fun sendSignalConfigsToRemote(indexs: List<Int>) { |
| | | if (signalConfiglist.size > 0) { |
| | | if (listContainsSameValue(indexs)) { |
| | | Log.i(TAG, "sendSignalConfigsToRemote: 有相同的index,不能发送" + gson.toJson(signalConfiglist)) |
| | | } else { |
| | | AYSdk.getInstance().sendCmd(safeluck.drive.evaluation.Constant.SEND_CONFIG_SIGNAL, gson.toJson(signalConfiglist)) |
| | | } |
| | | } |
| | | } |
| | | |
| | | private fun listContainsSameValue(indexs: List<Int>): Boolean { |
| | | for (i in indexs.indices) { //可以默认是0 0不判断是否有相同的index |
| | | if (indexs[i] == 0) { |
| | | continue |
| | | } |
| | | for (j in i + 1 until indexs.size) { |
| | | if (indexs[i] === indexs[j]) { |
| | | return true |
| | | } |
| | | } |
| | | } |
| | | return false |
| | | } |
| | | |
| | | } |
| | |
| | | ", startExam=" + startExam + |
| | | '}'; |
| | | } |
| | | |
| | | /** |
| | | * 更新Exam_status表的result |
| | | * @param i result 1=成功,0-失败 |
| | | * @param map_id |
| | | */ |
| | | public void updateItemExamResult(int i, int map_id) { |
| | | examStatusWorkRepo.updateItemResult(i,map_id); |
| | | } |
| | | } |
| | |
| | | public LiveData<Integer> getStartExam() { |
| | | return startExam; |
| | | } |
| | | |
| | | public void updateItemResult(final int i, final int map_id) { |
| | | WorkRoomDataBase.dataBaseWriteExecutor.execute(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | examStatusDao.updateItemResult(i,map_id); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | |
| | | List<Integer> getAllIndexs(); |
| | | |
| | | @Query("select * from signal_config") |
| | | List<SingalConfig> _getSignalConfigs(); |
| | | @Query("select * from signal_config") |
| | | LiveData<List<SingalConfig>> getSignalConfigs(); |
| | | |
| | | @Insert(onConflict = OnConflictStrategy.REPLACE) |
| | |
| | | workRepo.insertSignalConig(singalConfig); |
| | | } |
| | | |
| | | |
| | | |
| | | public LiveData<List<SingalConfig>> getSignalConfigs(){ |
| | | return signalConfigs; |
| | | } |
| | |
| | | if (msgCode == Constant.NDK_START){ |
| | | MyLog.i(TAG,"NDK_start,发送RTK配置"); |
| | | sendRtkConfigInfo(); |
| | | sendSignalConfigsToRemote(); |
| | | sendMcuUprgrade(); |
| | | } |
| | | } |
| | |
| | | }); |
| | | |
| | | |
| | | signalConfigViewModel = ViewModelProviders.of(this).get(SignalConfigViewModel.class); |
| | | signalConfigViewModel.getSignalConfigs().observe(this, new Observer<List<SingalConfig>>() { |
| | | @Override |
| | | public void onChanged(List<SingalConfig> singalConfigs) { |
| | | signalConfiglist.clear(); |
| | | MyLog.i(TAG, "信号配置发生变化"); |
| | | |
| | | for (int i = 0; i < singalConfigs.size(); i++) { |
| | | SignalConfigRemote signalConfigRemote = new SignalConfigRemote(); |
| | | signalConfigRemote.setFunc_id(i); |
| | | signalConfigRemote.setGpio_num(singalConfigs.get(i).getIndex()); |
| | | signalConfigRemote.setLevel(singalConfigs.get(i).getHighLevel()); |
| | | signalConfiglist.add(signalConfigRemote); |
| | | } |
| | | sendSignalConfigsToRemote(); |
| | | } |
| | | }); |
| | | // signalConfigViewModel = ViewModelProviders.of(this).get(SignalConfigViewModel.class); |
| | | // signalConfigViewModel.getSignalConfigs().observe(this, new Observer<List<SingalConfig>>() { |
| | | // @Override |
| | | // public void onChanged(List<SingalConfig> singalConfigs) { |
| | | // signalConfiglist.clear(); |
| | | // MyLog.i(TAG, "信号配置发生变化"); |
| | | // |
| | | // for (int i = 0; i < singalConfigs.size(); i++) { |
| | | // SignalConfigRemote signalConfigRemote = new SignalConfigRemote(); |
| | | // signalConfigRemote.setFunc_id(i); |
| | | // signalConfigRemote.setGpio_num(singalConfigs.get(i).getIndex()); |
| | | // signalConfigRemote.setLevel(singalConfigs.get(i).getHighLevel()); |
| | | // signalConfiglist.add(signalConfigRemote); |
| | | // } |
| | | // sendSignalConfigsToRemote(); |
| | | // } |
| | | // }); |
| | | |
| | | mPermissionsManager = new PermissionManager(this) { |
| | | @Override |
| | |
| | | import android.graphics.Path; |
| | | import android.os.Bundle; |
| | | import android.os.Handler; |
| | | import android.text.LoginFilter; |
| | | import android.text.TextUtils; |
| | | import android.util.Log; |
| | | import android.view.LayoutInflater; |
| | |
| | | private int map_id; |
| | | private double gpsSpeed = 0; |
| | | |
| | | // double map[][] = {{1, 1}, {10, 1}, {10, 10}, {1, 10}}; |
| | | double allMap[][][]; |
| | | double map[][] = {{-2.4065, 30.7090}, {-3.0759, 30.3599}, { -2.6023, 29.2578}, {-3.3316,28.9383},{-3.8247,30.0293}, |
| | | {-3.4503,30.1946}, {-2.9669,29.0981}, { -3.6962, 28.7786}, {-4.1991, 29.8640}}; |
| | | double map_other[][] = {{-2.4065, 30.7090}, {-3.0759, 30.3599}, { -2.6023, 29.2578}, {-3.3316,28.9383},{-3.8247,30.0293}, |
| | |
| | | }); |
| | | } |
| | | |
| | | public void DrawMap(List<Double> mainAnt, final double[][] map, final double[][] car, List<Integer>body, List<Integer> tire) { |
| | | public void DrawMap(List<Double> mainAnt, final double[][] map, final double[][] car, |
| | | List<Integer>body, List<Integer> tire) { |
| | | if (canvas2 == null || bmp == null) { |
| | | return; |
| | | } |
| | |
| | | // } |
| | | // }); |
| | | } |
| | | public void DrawMapAll(List<Double> mainAnt, final double[][][] map, final double[][] car, |
| | | List<Integer>body, List<Integer> tire) { |
| | | if (canvas2 == null || bmp == null) { |
| | | return; |
| | | } |
| | | long scale_x,scale_y; |
| | | // _mActivity.runOnUiThread(new Runnable() { |
| | | // @Override |
| | | // public void run() { |
| | | double base_x = 300, base_y = 20; |
| | | double max_x = 0, min_x = 0, max_y = 0, min_y = 0; |
| | | |
| | | // Log.d(TAG, "DrawMap map size " + map.length + " car size " + car.length); |
| | | |
| | | |
| | | for (int x = 0; x < map.length; x++) { |
| | | for (int j = 0; j < map[x].length; j++) { |
| | | if (x == 0&&j==0) { |
| | | max_x = map[0][0][0]; |
| | | min_x = map[0][0][0]; |
| | | max_y = map[0][0][1]; |
| | | min_y = map[0][0][1]; |
| | | } else { |
| | | // Log.i(TAG,String.format("map[%d][%d][0]=%f",x,j,map[x][j][0])); |
| | | // Log.i(TAG,String.format("map[%d][%d][1]=%f",x,j,map[x][j][1])); |
| | | // Log.i(TAG,String.format("max_x=%f,max_y=%f,min_x=%f,min_y=%f",max_x,max_y,min_x,min_y)); |
| | | if (max_x < map[x][j][0]) { |
| | | |
| | | max_x = map[x][j][0]; |
| | | } |
| | | if (min_x > map[x][j][0]) { |
| | | min_x = map[x][j][0]; |
| | | } |
| | | if (max_y < map[x][j][1]) { |
| | | max_y = map[x][j][1]; |
| | | } |
| | | if (min_y > map[x][j][1]) { |
| | | min_y = map[x][j][1]; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // Log.d(TAG, "all 地图DrawMap max_x " + max_x + " max_y " + max_y + " min_x " + min_x + " min_y " + min_y); |
| | | if (map_other.length>9){ |
| | | for (int i = 0; i < map_other.length; i++) { |
| | | |
| | | if (max_x < map_other[i][0]) { |
| | | max_x = map_other[i][0]; |
| | | } |
| | | if (min_x > map_other[i][0]) { |
| | | min_x = map_other[i][0]; |
| | | } |
| | | if (max_y < map_other[i][1]) { |
| | | max_y = map_other[i][1]; |
| | | } |
| | | if (min_y > map_other[i][1]) { |
| | | min_y = map_other[i][1]; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | // Log.d(TAG, "DrawMap另外一条曲线 max_x " + max_x + " max_y " + max_y + " min_x " + min_x + " min_y " + min_y); |
| | | |
| | | for (int i = 0; i < car.length; i++) { |
| | | if (max_x < car[i][0]) { |
| | | max_x = car[i][0]; |
| | | } |
| | | if (min_x > car[i][0]) { |
| | | min_x = car[i][0]; |
| | | } |
| | | if (max_y < car[i][1]) { |
| | | max_y = car[i][1]; |
| | | } |
| | | if (min_y > car[i][1]) { |
| | | min_y = car[i][1]; |
| | | } |
| | | } |
| | | |
| | | // Log.d(TAG, "DrawMapAll 和车比max_x " + max_x + " max_y " + max_y + " min_x " + min_x + " min_y " + min_y); |
| | | |
| | | scale_x = Math.round((screen_width - base_x - 10) / (max_x - min_x)); |
| | | scale_y = Math.round((screen_height - base_y - 10) / (max_y - min_y)); |
| | | |
| | | if (scale_x >= scale_y) { |
| | | scale_x = scale_y; |
| | | } else { |
| | | scale_y = scale_x; |
| | | } |
| | | |
| | | // Log.d(TAG, "DrawMapAll scale_x " + scale_x + " scale_y " + scale_y); |
| | | |
| | | |
| | | canvas2.drawColor(Color.WHITE); |
| | | |
| | | if (paint == null || canvas2==null){ |
| | | return; |
| | | } |
| | | paint.setStyle(Paint.Style.FILL_AND_STROKE); |
| | | paint.setColor(Color.BLUE); |
| | | |
| | | canvas2.drawCircle((float) (base_x + (mainAnt.get(0) - min_x) * scale_x), (float) (base_y + (0 - mainAnt.get(1) - min_y) * scale_y), 2, paint); |
| | | |
| | | paint.setColor(Color.RED); |
| | | canvas2.drawCircle((float) (base_x + (car[tire.get(0)][0] - min_x) * scale_x), (float) (base_y + (car[tire.get(0)][1] - min_y) * scale_y), 2.5f, paint); |
| | | canvas2.drawCircle((float) (base_x + (car[tire.get(1)][0] - min_x) * scale_x), (float) (base_y + (car[tire.get(1)][1] - min_y) * scale_y), 2.5f, paint); |
| | | canvas2.drawCircle((float) (base_x + (car[tire.get(2)][0] - min_x) * scale_x), (float) (base_y + (car[tire.get(2)][1] - min_y) * scale_y), 2.5f, paint); |
| | | canvas2.drawCircle((float) (base_x + (car[tire.get(3)][0] - min_x) * scale_x), (float) (base_y + (car[tire.get(3)][1] - min_y) * scale_y), 2.5f, paint); |
| | | |
| | | |
| | | |
| | | paint.setStyle(Paint.Style.STROKE); |
| | | paint.setColor(Color.BLACK); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | Path path = new Path(); |
| | | |
| | | for (int k = 0; k < map.length; k++) { |
| | | |
| | | |
| | | |
| | | |
| | | Log.i(TAG, String.format("all DrawMap: map[%d].length=[%d]",k,map[k].length)); |
| | | if (map[k].length < 9) { |
| | | // Log.d(TAG, String.format("map[%d][0][0]=%f,X=%f",k,map[k][0][0], (float) (base_x + (map[k][0][0] - min_x) * scale_x)) + String.format("map[%d][0][1]=%f,Y=%f",k,map[k][0][1], (float) (base_y + (map[k][0][1] - min_y) * scale_y))); |
| | | path.moveTo((float) (base_x + (map[k][0][0] - min_x) * scale_x), (float) (base_y + (map[k][0][1] - min_y) * scale_y)); |
| | | for (int i = 1; i < map[k].length; i++) { |
| | | // Log.i(TAG,String.format("map[%d][%d][0]=%f,to X=%f",k,i,map[k][i][0],(float) (base_x + (map[k][i][0] - min_x) * scale_x))); |
| | | // Log.i(TAG,String.format("map[%d][%d][1]=%f,to Y=%f",k,i,map[k][i][1],(float) (base_y + (map[k][i][1] - min_y) * scale_y))); |
| | | path.lineTo((float) (base_x + (map[k][i][0] - min_x) * scale_x), (float) (base_y + (map[k][i][1] - min_y) * scale_y)); |
| | | } |
| | | path.close(); |
| | | } else if (map[k].length == 9) { |
| | | path.moveTo((float) (base_x + (map[k][0][0] - min_x) * scale_x), (float) (base_y + (map[k][0][1] - min_y) * scale_y)); |
| | | path.lineTo((float) (base_x + (map[k][8][0] - min_x) * scale_x), (float) (base_y + (map[k][8][1] - min_y) * scale_y)); |
| | | |
| | | path.moveTo((float) (base_x + (map[k][2][0] - min_x) * scale_x), (float) (base_y + (map[k][2][1] - min_y) * scale_y)); |
| | | path.lineTo((float) (base_x + (map[k][1][0] - min_x) * scale_x), (float) (base_y + (map[k][1][1] - min_y) * scale_y)); |
| | | |
| | | path.moveTo((float) (base_x + (map[k][3][0] - min_x) * scale_x), (float) (base_y + (map[k][3][1] - min_y) * scale_y)); |
| | | path.lineTo((float) (base_x + (map[k][4][0] - min_x) * scale_x), (float) (base_y + (map[k][4][1] - min_y) * scale_y)); |
| | | |
| | | path.moveTo((float) (base_x + (map[k][6][0] - min_x) * scale_x), (float) (base_y + (map[k][6][1] - min_y) * scale_y)); |
| | | path.lineTo((float) (base_x + (map[k][5][0] - min_x) * scale_x), (float) (base_y + (map[k][5][1] - min_y) * scale_y)); |
| | | |
| | | path.moveTo((float) (base_x + (map[k][7][0] - min_x) * scale_x), (float) (base_y + (map[k][7][1] - min_y) * scale_y)); |
| | | path.lineTo((float) (base_x + (map[k][8][0] - min_x) * scale_x), (float) (base_y + (map[k][8][1] - min_y) * scale_y)); |
| | | } else { |
| | | path.moveTo((float) (base_x + (map[k][0][0] - min_x) * scale_x), (float) (base_y + (map[k][0][1] - min_y) * scale_y)); |
| | | for (int i = 1; i < map[k].length; i++) { |
| | | path.lineTo((float) (base_x + (map[k][i][0] - min_x) * scale_x), (float) (base_y + (map[k][i][1] - min_y) * scale_y)); |
| | | } |
| | | |
| | | if (map_other.length>9){ |
| | | path.moveTo((float) (base_x + (map_other[0][0] - min_x) * scale_x), (float) (base_y + (map_other[0][1] - min_y) * scale_y)); |
| | | for (int i = 1; i < map[k].length; i++) { |
| | | path.lineTo((float) (base_x + (map_other[i][0] - min_x) * scale_x), (float) (base_y + (map_other[i][1] - min_y) * scale_y)); |
| | | } |
| | | } |
| | | |
| | | for (int i = 0, j = 0; i < map[k].length && j < map_other.length; i++, j++) { |
| | | path.moveTo((float) (base_x + (map[k][i][0] - min_x) * scale_x), (float) (base_y + (map[k][i][1] - min_y) * scale_y)); |
| | | path.lineTo((float) (base_x + (map_other[j][0] - min_x) * scale_x), (float) (base_y + (map_other[j][1] - min_y) * scale_y)); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | canvas2.drawPath(path, paint); |
| | | |
| | | path.moveTo((float) (base_x + (car[body.get(0)][0] - min_x) * scale_x), (float) (base_y + (car[body.get(0)][1] - min_y) * scale_y)); |
| | | for (int i = 1; i < body.size(); i++){ |
| | | // Log.d(TAG, "for 循环 DrawMap to X = " + (float) (base_x + (car[body.get(i)][0] - min_x) * scale_x)+ " Y = " + (float) (base_y + (car[body.get(i)][1] - min_y) * scale_y)); |
| | | Log.i(TAG,String.format("car[%d][0]=%f,to X =%f,car[%d][1]=%f,to Y=%f",i,car[body.get(i)][0], |
| | | (float) (base_x + (car[body.get(i)][0] - min_x) * scale_x),i,car[body.get(i)][1],(float) (base_y + (car[body.get(i)][1] - min_y) * scale_y))); |
| | | path.lineTo((float) (base_x + (car[body.get(i)][0] - min_x) * scale_x), (float) (base_y + (car[body.get(i)][1] - min_y) * scale_y)); |
| | | } |
| | | |
| | | path.close(); |
| | | |
| | | canvas2.drawPath(path, paint); |
| | | |
| | | |
| | | paint.setStyle(Paint.Style.FILL_AND_STROKE); |
| | | |
| | | if (osdHeading != null) { |
| | | Path pathText = new Path(); |
| | | pathText.moveTo(10, 170); |
| | | pathText.lineTo(700, 170); |
| | | canvas2.drawTextOnPath(osdHeading, pathText, 0, 0, paint);//逆时针生成 |
| | | } |
| | | |
| | | if (osdMoveDirect != null) { |
| | | Path pathText = new Path(); |
| | | pathText.moveTo(10, 30); |
| | | pathText.lineTo(700, 30); |
| | | canvas2.drawTextOnPath(osdMoveDirect, pathText, 0, 0, paint);//逆时针生成 |
| | | } |
| | | |
| | | if (osdRtkSpeed != null) { |
| | | Path pathText = new Path(); |
| | | pathText.moveTo(10, 240); |
| | | pathText.lineTo(700, 240); |
| | | canvas2.drawTextOnPath(osdRtkSpeed, pathText, 0, 0, paint);//逆时针生成 |
| | | } |
| | | |
| | | if (osdQf != null) { |
| | | Path pathText = new Path(); |
| | | pathText.moveTo(10, 120); |
| | | pathText.lineTo(700, 120); |
| | | canvas2.drawTextOnPath(osdQf, pathText, 0, 0, paint);//逆时针生成 |
| | | } |
| | | |
| | | { |
| | | BigDecimal bd = new BigDecimal(gpsSpeed); |
| | | bd = bd.setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | |
| | | Path pathText = new Path(); |
| | | pathText.moveTo(10, 70); |
| | | pathText.lineTo(700, 70); |
| | | |
| | | canvas2.drawTextOnPath("GPS速度:" + bd, pathText, 0, 0, paint);//逆时针生成 |
| | | } |
| | | |
| | | |
| | | // 提交画布 |
| | | Canvas canvas = holder.lockCanvas(); |
| | | if (canvas != null){ |
| | | |
| | | canvas.drawBitmap(bmp, 0, 0, paint); |
| | | holder.unlockCanvasAndPost(canvas); |
| | | } |
| | | // } |
| | | // }); |
| | | } |
| | | |
| | | int line = 0; |
| | | int map_line = 0; |
| | | int map_line_other = 0; |
| | | int sanwei = 0; |
| | | private StringBuffer stringBuffer = new StringBuffer(); |
| | | class MessageRemoteService{ |
| | | public int msgCode; |
| | |
| | | line = 0; |
| | | map_line = 0; |
| | | map_line_other = 0; |
| | | sanwei = 0; |
| | | |
| | | car = new double[points.size()/2][2]; |
| | | |
| | |
| | | examMaps = gson.fromJson(newmap.trim(),type); |
| | | } |
| | | |
| | | if (map_id == -1){ |
| | | allMap =new double[examMaps.size()][][]; |
| | | for (int i = 0; i < examMaps.size(); i++) { |
| | | ExamMap examMap = examMaps.get(i); |
| | | |
| | | List<ExamMap.PointBean> pointBeanList = examMap.getPoint(); |
| | | |
| | | for (int i = 0; i < examMaps.size(); i++) { |
| | | ExamMap examMap = examMaps.get(i); |
| | | if (map_id == examMap.getId()){ |
| | | List<ExamMap.PointBean> pointBeanList = examMap.getPoint(); |
| | | |
| | | for(int j=0; j<pointBeanList.size();j++){ |
| | | List<Double> xys = pointBeanList.get(j).getXy(); |
| | | if(j==0){ |
| | | map = new double[xys.size()/2][2]; |
| | | |
| | | for (int k=0; k<xys.size();k++){ |
| | | if ((k % 2) == 0) { |
| | | map[map_line][0] = xys.get(k); |
| | | } else { |
| | | double value = 0 - xys.get(k); |
| | | Log.i(TAG, "onCEvent: map新值=" + value + " 位置:" + k); |
| | | map[map_line][1] = value; |
| | | map_line++; |
| | | } |
| | | } |
| | | }else{ |
| | | MyLog.i(TAG,"暂时支持曲线"); |
| | | map_other = new double[xys.size()/2][2]; |
| | | for (int k=0; k<xys.size();k++){ |
| | | if ((k % 2) == 0) { |
| | | map_other[map_line_other][0] = xys.get(k); |
| | | } else { |
| | | double value = 0 - xys.get(k); |
| | | map_other[map_line_other][1] = value; |
| | | map_line_other++; |
| | | } |
| | | } |
| | | break; |
| | | for(int j=0; j<pointBeanList.size();j++){ |
| | | List<Double> xys = pointBeanList.get(j).getXy(); |
| | | if(j==0){ |
| | | map = new double[xys.size()/2][2]; |
| | | allMap[sanwei] = new double[xys.size()/2][2]; |
| | | map_line = 0; |
| | | for (int k=0; k<xys.size();k++){ |
| | | if ((k % 2) == 0) { |
| | | map[map_line][0] = xys.get(k); |
| | | } else { |
| | | double value = 0 - xys.get(k); |
| | | map[map_line][1] = value; |
| | | map_line++; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | break; |
| | | allMap[sanwei] = map.clone(); |
| | | sanwei++; |
| | | |
| | | }else{ |
| | | // MyLog.i(TAG,"all支持曲线"); |
| | | map_other = new double[xys.size()/2][2]; |
| | | for (int k=0; k<xys.size();k++){ |
| | | if ((k % 2) == 0) { |
| | | map_other[map_line_other][0] = xys.get(k); |
| | | } else { |
| | | double value = 0 - xys.get(k); |
| | | map_other[map_line_other][1] = value; |
| | | map_line_other++; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | DrawMapAll(mainAnt,allMap,car,body,tire); |
| | | }else{ |
| | | for (int i = 0; i < examMaps.size(); i++) { |
| | | ExamMap examMap = examMaps.get(i); |
| | | if (map_id == examMap.getId()){ |
| | | List<ExamMap.PointBean> pointBeanList = examMap.getPoint(); |
| | | |
| | | for(int j=0; j<pointBeanList.size();j++){ |
| | | List<Double> xys = pointBeanList.get(j).getXy(); |
| | | if(j==0){ |
| | | map = new double[xys.size()/2][2]; |
| | | |
| | | |
| | | |
| | | for (int k=0; k<xys.size();k++){ |
| | | if ((k % 2) == 0) { |
| | | map[map_line][0] = xys.get(k); |
| | | } else { |
| | | double value = 0 - xys.get(k); |
| | | Log.i(TAG, "onCEvent: map新值=" + value + " 位置:" + k); |
| | | map[map_line][1] = value; |
| | | map_line++; |
| | | } |
| | | } |
| | | }else{ |
| | | MyLog.i(TAG,"暂时支持曲线"); |
| | | map_other = new double[xys.size()/2][2]; |
| | | for (int k=0; k<xys.size();k++){ |
| | | if ((k % 2) == 0) { |
| | | map_other[map_line_other][0] = xys.get(k); |
| | | } else { |
| | | double value = 0 - xys.get(k); |
| | | map_other[map_line_other][1] = value; |
| | | map_line_other++; |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | |
| | | DrawMap(mainAnt, map, car, body, tire); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | import safeluck.drive.evaluation.util.Utils; |
| | | import safeluck.drive.evaluation.worker.TimeWorker; |
| | | |
| | | import static androidx.work.PeriodicWorkRequest.MIN_PERIODIC_INTERVAL_MILLIS; |
| | | |
| | | /** |
| | | * 联网训练UI |
| | | * MyApplication2 |
| | |
| | | return getResources().getColor(R.color.colorAccent); |
| | | }else{ |
| | | ExamPlatformData.getInstance().getTTS().speak("曲线行驶合格"); |
| | | examStatusViewModel.updateItemExamResult(1,examStatus.getMap_id()); |
| | | return getResources().getColor(R.color.train_btn_return); |
| | | } |
| | | case 5: |
| | |
| | | if (currTotalScore < Constant.PASSING_SCORE){ |
| | | MyLog.i("低于80,不合格"+currTotalScore); |
| | | ExamPlatformData.getInstance().getTTS().speak("考试不合格"); |
| | | stopExam(); |
| | | // stopExam(); |
| | | } |
| | | MyLog.i("监测到有失败项目加入,通知UI更新颜色"); |
| | | mHandler.obtainMessage(ADD_DATA).sendToTarget(); |
| | |
| | | tv_network_time = view.findViewById(R.id.network_time); |
| | | |
| | | |
| | | PeriodicWorkRequest periodicWorkRequest = new PeriodicWorkRequest.Builder(TimeWorker.class,30, TimeUnit.SECONDS).build(); |
| | | PeriodicWorkRequest periodicWorkRequest = new PeriodicWorkRequest.Builder(TimeWorker.class,MIN_PERIODIC_INTERVAL_MILLIS, TimeUnit.MICROSECONDS).build(); |
| | | WorkManager.getInstance(getContext().getApplicationContext()).enqueue(periodicWorkRequest); |
| | | WorkManager.getInstance(getContext().getApplicationContext()).getWorkInfoByIdLiveData(periodicWorkRequest.getId()) |
| | | .observe(this, new Observer<WorkInfo>() { |
| | |
| | | package safeluck.drive.evaluation.fragment; |
| | | |
| | | import android.app.AlarmManager; |
| | | import android.app.PendingIntent; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.os.Bundle; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.annotation.Nullable; |
| | | import androidx.core.app.AlarmManagerCompat; |
| | | import androidx.lifecycle.Observer; |
| | | import androidx.lifecycle.ViewModelProviders; |
| | | import androidx.work.OneTimeWorkRequest; |
| | |
| | | |
| | | import android.os.Handler; |
| | | import android.os.Message; |
| | | import android.os.SystemClock; |
| | | import android.text.TextUtils; |
| | | import android.util.Log; |
| | | import android.view.LayoutInflater; |
| | |
| | | public class TrainFragment extends SupportFragment implements View.OnClickListener { |
| | | |
| | | private static final String TAG = TrainFragment.class.getSimpleName(); |
| | | private static final int REQUEST_CODE = 1000; |
| | | private static final String ALARM_ACTION_CODE = "com.anyun.alermbroadcast"; |
| | | |
| | | public static SupportFragment newInstance() { |
| | | return new TrainFragment(); |
| | |
| | | |
| | | private void initView(View view) { |
| | | |
| | | Intent intent = new Intent(ALARM_ACTION_CODE); |
| | | PendingIntent pendingIntent = PendingIntent.getBroadcast(_mActivity.getApplicationContext(), |
| | | REQUEST_CODE, intent, |
| | | PendingIntent.FLAG_CANCEL_CURRENT); |
| | | AlarmManager alarmManager = (AlarmManager) _mActivity.getApplicationContext().getSystemService(Context.ALARM_SERVICE); |
| | | alarmManager.setExact(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime(),pendingIntent); |
| | | |
| | | |
| | | view.findViewById(R.id.iv_head).setOnClickListener(this); |
| | | av_curve = view.findViewById(R.id.av3); |
| | | av_park = view.findViewById(R.id.av2); |
| | |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="呼叫请求" |
| | | android:text="结束考试" |
| | | android:id="@+id/tv_stop" |
| | | android:textColor="@android:color/white" |
| | | android:padding="10dp" |