| | |
| | | |
| | | private fun sendMapInfo(){ |
| | | val mapPath = ExamPlatformData.getInstance().mapPath |
| | | val roadmapPath = ExamPlatformData.getInstance().roadMapPath |
| | | |
| | | if (!TextUtils.isEmpty(roadmapPath)) { |
| | | MyLog.i("调用更新RoadMap路径后的地图$roadmapPath") |
| | | val fileContent = FileUtil.readFile(roadmapPath) |
| | | if (fileContent != null) { |
| | | val str = String(fileContent) |
| | | Log.i(TAG,"文件内容:$str") |
| | | AYSdk.getInstance().sendCmd(safeluck.drive.evaluation.Constant.PUSH_ROAD_MAP_INFO, str) |
| | | } else { |
| | | MyLog.i(String.format("文件:%s不存在", roadmapPath)) |
| | | CThreadPoolExecutor.runOnMainThread { Toast.makeText(app.getAppContext(), "文件:" + roadmapPath + "不存在", Toast.LENGTH_SHORT).show() } |
| | | } |
| | | } else { |
| | | val buffer: StringBuffer? |
| | | buffer = FileUtil.readAssetTxtFile(applicationContext, safeluck.drive.evaluation.Constant.ROAD_MAP) |
| | | if (buffer != null) { |
| | | AYSdk.getInstance().sendCmd(safeluck.drive.evaluation.Constant.PUSH_ROAD_MAP_INFO, buffer.toString()) |
| | | } else { |
| | | MyLog.i(String.format("地图模型未拷入[%s]目录下", Environment.getExternalStorageDirectory().absolutePath + "/" + applicationContext.packageName)) |
| | | CThreadPoolExecutor.runOnMainThread { Toast.makeText(app.getAppContext(), String.format("地图模型未拷入[%s]目录下", Environment.getExternalStorageDirectory().absolutePath + "/" + applicationContext.packageName), Toast.LENGTH_SHORT).show() } |
| | | } |
| | | } |
| | | |
| | | if (!TextUtils.isEmpty(mapPath)) { |
| | | MyLog.i("调用更新Map路径后的地图$mapPath") |
| | | val fileContent = FileUtil.readFile(mapPath) |
| | |
| | | } else { |
| | | MyLog.i("读取Assert目录下初始化的地图") |
| | | var buffer: StringBuffer? |
| | | buffer = FileUtil.readAssetTxtFile(applicationContext, safeluck.drive.evaluation.Constant.ROAD_MAP) |
| | | if (buffer != null) { |
| | | AYSdk.getInstance().sendCmd(safeluck.drive.evaluation.Constant.PUSH_ROAD_MAP_INFO, buffer.toString()) |
| | | } else { |
| | | MyLog.i( String.format("地图模型未拷入[%s]目录下", Environment.getExternalStorageDirectory().absolutePath + "/" + applicationContext.packageName)) |
| | | CThreadPoolExecutor.runOnMainThread { Toast.makeText(app.getAppContext(), String.format("地图模型未拷入[%s]目录下", Environment.getExternalStorageDirectory().absolutePath + "/" + applicationContext.packageName), Toast.LENGTH_SHORT).show() } |
| | | } |
| | | buffer = FileUtil.readAssetTxtFile(applicationContext, safeluck.drive.evaluation.Constant.MAP) |
| | | if (buffer != null) { |
| | | AYSdk.getInstance().sendCmd(safeluck.drive.evaluation.Constant.PUSH_MAP_INFO, buffer.toString()) |
| | |
| | | @Override |
| | | public void run() { |
| | | 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); |
| | | Log.i(TAG, "文件内容:"+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{ |
| | | StringBuffer buffer; |
| | | buffer =FileUtil.readAssetTxtFile(getApplicationContext(),Constant.ROAD_MAP); |
| | | if (buffer != null){ |
| | | |
| | | AYSdk.getInstance().sendCmd(Constant.PUSH_ROAD_MAP_INFO,buffer.toString()); |
| | | }else{ |
| | | MyLog.d(TAG,String.format("地图模型未拷入[%s]目录下", Environment.getExternalStorageDirectory().getAbsolutePath()+"/"+getApplicationContext().getPackageName())); |
| | | CThreadPoolExecutor.runOnMainThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | Toast.makeText(getAppContext(), String.format("地图模型未拷入[%s]目录下", Environment.getExternalStorageDirectory().getAbsolutePath()+"/"+getApplicationContext().getPackageName()), Toast.LENGTH_SHORT).show(); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | } |
| | | if (!TextUtils.isEmpty(mapPath)){ |
| | | MyLog.i("调用更新Map路径后的地图"+mapPath); |
| | | byte[] fileContent = FileUtil.readFile(mapPath); |
| | |
| | | } |
| | | }); |
| | | StringBuffer buffer; |
| | | buffer =FileUtil.readAssetTxtFile(getApplicationContext(),Constant.ROAD_MAP); |
| | | if (buffer != null){ |
| | | |
| | | AYSdk.getInstance().sendCmd(Constant.PUSH_ROAD_MAP_INFO,buffer.toString()); |
| | | }else{ |
| | | MyLog.d(TAG,String.format("地图模型未拷入[%s]目录下", Environment.getExternalStorageDirectory().getAbsolutePath()+"/"+getApplicationContext().getPackageName())); |
| | | CThreadPoolExecutor.runOnMainThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | Toast.makeText(getAppContext(), String.format("地图模型未拷入[%s]目录下", Environment.getExternalStorageDirectory().getAbsolutePath()+"/"+getApplicationContext().getPackageName()), Toast.LENGTH_SHORT).show(); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | buffer =FileUtil.readAssetTxtFile(getApplicationContext(),Constant.MAP); |
| | | if (buffer != null){ |
| | | |
| | |
| | | private String ip="47.93.80.84"; |
| | | private int port=12125; |
| | | private String mapPath;//绝对路径包含文件名的path |
| | | private String roadmapPath;//绝对路径包含文件名的path |
| | | private String carPath;//绝对路径包含文件名的path |
| | | private StringBuffer stringBuffer; |
| | | private int rtkPort = 12125; |
| | |
| | | public void setExamType(int examType) { |
| | | this.examType = examType; |
| | | } |
| | | |
| | | /** |
| | | * 设置路考地图的路径 |
| | | * @param path |
| | | */ |
| | | public void setNewRoadMapPath(String path) { |
| | | this.roadmapPath = path; |
| | | SPUtils.put(app.getAppContext(),SPUtils.ROAD_MAP_PATH,roadmapPath); |
| | | } |
| | | |
| | | /** |
| | | * 获得路考地图的路径 |
| | | * @return |
| | | */ |
| | | public String getRoadMapPath(){ |
| | | roadmapPath = (String) SPUtils.get(app.getAppContext(),SPUtils.ROAD_MAP_PATH,""); |
| | | return roadmapPath; |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | private static final String TAG = SetArgumentsFragment.class.getSimpleName(); |
| | | private static final int REQUEST_CODE_MAP = 100; |
| | | private static final int REQUEST_CODE_ROADMAP = 102; |
| | | private static final int REQUEST_CODE_CAR = 101; |
| | | private int request_code = REQUEST_CODE_MAP; |
| | | private Button btn_config_signal; |
| | | private Button btn_mcu_upgrade,btn_map_select; |
| | | private Button btn_mcu_upgrade,btn_map_select,btn_roadmap_select; |
| | | private EditText et_ip,et_port,et_simulte_ip,et_simulate_port; |
| | | private Gson gson = new Gson(); |
| | | private EditText et_ip_rtk,et_port_rtk,et_city_id,et_city_province,et_phone; |
| | | private RTKConfigViewModel rtkConfigViewModel; |
| | | private RTKConfig mRtkConfig; |
| | | private Toolbar toolbar; |
| | | private boolean needSendRtk = false; |
| | | |
| | | public static SetArgumentsFragment newInstance() { |
| | |
| | | et_port.setText(ExamPlatformData.getInstance().getPlatformPort()+""); |
| | | btn_mcu_upgrade = view.findViewById(R.id.btn_mcu_upgrade); |
| | | btn_map_select = view.findViewById(R.id.btn_map_select); |
| | | btn_roadmap_select = view.findViewById(R.id.btn_roadmap_select); |
| | | view.findViewById(R.id.btn_car_select).setOnClickListener(this); |
| | | btn_mcu_upgrade.setOnClickListener(this); |
| | | btn_map_select.setOnClickListener(this); |
| | | btn_roadmap_select.setOnClickListener(this); |
| | | btn_config_signal = view.findViewById(R.id.btn_signal_conf); |
| | | btn_config_signal.setOnClickListener(this); |
| | | |
| | |
| | | request_code = REQUEST_CODE_MAP; |
| | | openFileMgr(); |
| | | break; |
| | | case R.id.btn_roadmap_select: |
| | | request_code = REQUEST_CODE_ROADMAP; |
| | | openFileMgr(); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | }else if (REQUEST_CODE_ROADMAP == requestCode){ |
| | | if (data != null){ |
| | | final Uri uri= data.getData(); |
| | | Log.i(TAG, "onActivityResult: "+uri.getPath()); |
| | | ExamPlatformData.getInstance().setNewRoadMapPath(uri.getPath()); |
| | | CThreadPoolExecutor.runInBackground(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | byte[] fileContent = FileUtil.readFile(uri.getPath()); |
| | | if (fileContent != null){ |
| | | String str = new String(fileContent); |
| | | Log.i(TAG, "文件内容:"+str); |
| | | AYSdk.getInstance().sendCmd(Constant.PUSH_ROAD_MAP_INFO,str); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | public static final String CAR_PATH = "car_path"; |
| | | public static final String TRAIN_MODE = "training_mode"; |
| | | public static final String FAIL_PROJ_SNS = "failed_projs_sns"; |
| | | public static final String ROAD_MAP_PATH = "road_map_path"; |
| | | |
| | | /** |
| | | * 保存数据的方法,我们需要拿到保存数据的具体类型,然后根据类型调用不同的保存方法 |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <selector xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | <item android:state_pressed="true" android:drawable="@drawable/ic_btn_fail"></item> |
| | | <item android:state_pressed="false" android:drawable="@drawable/ic_btn_daikao"></item> |
| | | </selector> |
| | |
| | | android:background="@drawable/btn_bg_baseset"/> |
| | | <Button android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="考试地图选择" |
| | | android:text="场考地图选择" |
| | | android:padding="5dp" |
| | | android:id="@+id/btn_map_select" |
| | | android:layout_marginLeft="15dp" |
| | |
| | | android:text="车辆模型选择" |
| | | android:padding="5dp" |
| | | android:id="@+id/btn_car_select" |
| | | android:layout_marginLeft="15dp" |
| | | android:background="@drawable/btn_bg_baseset"/> |
| | | <Button android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="路考地图选择" |
| | | android:padding="5dp" |
| | | android:id="@+id/btn_roadmap_select" |
| | | android:layout_marginLeft="15dp" |
| | | android:background="@drawable/btn_bg_baseset"/> |
| | | </TableRow> |
| | |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:id="@+id/btn_save_platform" |
| | | android:background="@drawable/ic_btn_fail" |
| | | android:background="@drawable/btn_state_save" |
| | | android:text="保存"/> |
| | | </LinearLayout> |
| | | <!-- </ScrollView>--> |