驾考完成app重启自动拷贝assert里的设置文件到sd卡,并发送规则设置;服务绑定成功就会发送
| | |
| | | {"hold_start_key_limit_time":2000,"curve_pause_criteria":200,"park_bottom_pause_criteria":2000,"park_bottom_limit_time":210,"park_edge_pause_criteria":2000,"park_edge_limit_time":90,"turn_a90_pause_criteria":2000,"ramp_start_car_limit_time":30,"ramp_stoppoint_red_distance":0.5,"ramp_edge_yellow_distance":0.3,"ramp_edge_red_distance":0.5,"ramp_slide_yellow_distance":0.1,"ramp_slide_red_distance":0.3} |
| | | {"hold_start_key_limit_time":2000,"curve_pause_criteria":2000,"park_bottom_pause_criteria":2000,"park_bottom_limit_time":210,"park_edge_pause_criteria":2000,"park_edge_limit_time":90,"turn_a90_pause_criteria":2000,"ramp_start_car_limit_time":30,"ramp_stoppoint_red_distance":0.5,"ramp_edge_yellow_distance":0.3,"ramp_edge_red_distance":0.5,"ramp_slide_yellow_distance":0.1,"ramp_slide_red_distance":0.3} |
| | |
| | | {"road_total_distance":3000,"road_max_speed":3,"stop_car_open_door_allow_time":15,"stop_car_limit_distance":150,"stop_car_edge_red_distance":0.5,"stop_car_edge_yellow_distance":0.3} |
| | | {"road_total_distance":3000,"road_max_speed":60,"stop_car_open_door_allow_time":15,"stop_car_limit_distance":150,"stop_car_edge_red_distance":0.5,"stop_car_edge_yellow_distance":0.3} |
| | |
| | | import java.io.File; |
| | | import java.io.InputStreamReader; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.concurrent.Executors; |
| | | |
| | | import safeluck.drive.evaluation.DB.WorkRoomDataBase; |
| | |
| | | import safeluck.drive.evaluation.util.FileUtil; |
| | | import safeluck.drive.evaluation.util.SystemUtil; |
| | | import safeluck.drive.evaluation.util.Utils; |
| | | |
| | | import static safeluck.drive.evaluation.bean.ExamPlatformData.getRulesettingFilesName; |
| | | |
| | | /** |
| | | * MyApplication2 |
| | |
| | | |
| | | private void sendJudgeArgs() { |
| | | File dir = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+File.separator+getPackageName()); |
| | | |
| | | List<String> names = ExamPlatformData.getRulesettingFilesName(); |
| | | for (int i = 0; i < names.size(); i++) { |
| | | File settFile = new File(dir,names.get(i)); |
| | | if (settFile.exists() ){ |
| | | Log.i(TAG,settFile.getName()+"存在不复制"); |
| | | }else{ |
| | | Log.i(TAG,settFile.getName()+"不存在,复制..."); |
| | | FileUtil.copyAssertFileToSD(getApplicationContext(),names.get(i)); |
| | | } |
| | | } |
| | | |
| | | if (dir.exists()){ |
| | | File[] files = dir.listFiles(); |
| | | for (int i = 0; i < files.length; i++) { |
| | | if (files[i].getName().contains("_setting")||files[i].getName().contains("_Setting")){ |
| | | Log.i(TAG,files[i].getName()); |
| | | if (names.contains(files[i].getName())){ |
| | | |
| | | |
| | | byte[] buffer = FileUtil.readFile(files[i].getAbsolutePath()); |
| | | AYSdk.getInstance().sendCmd(Constant.ID_judge_args,new String(buffer).trim()); |
| | | }else{ |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | private List<Integer> sns =new ArrayList<>();//保存所有失败项目的sn |
| | | private static HashMap<Integer,String> enter_exit_item_tts = new HashMap<>(); |
| | | private static List<SimulateNightBean.QuestionBean> simulate_light_tips = new ArrayList<>(); |
| | | |
| | | private static List<String> RulesettingFilesName = new ArrayList<>(); |
| | | |
| | | public static List<String> getRulesettingFilesName() { |
| | | return RulesettingFilesName; |
| | | } |
| | | |
| | | static { |
| | | |
| | | RulesettingFilesName.add("startcar_setting.json"); |
| | | RulesettingFilesName.add("station_setting.json"); |
| | | RulesettingFilesName.add("straightline_setting.json"); |
| | | RulesettingFilesName.add("subdecGear_setting.json"); |
| | | RulesettingFilesName.add("sidestop_setting.json"); |
| | | RulesettingFilesName.add("overtake_setting.json"); |
| | | RulesettingFilesName.add("Gear_Setting.json"); |
| | | RulesettingFilesName.add("cornerlamp_setting.json"); |
| | | RulesettingFilesName.add("common_setting.json"); |
| | | RulesettingFilesName.add("area_setting.json"); |
| | | |
| | | |
| | | examPlatformStrs.put(TCP_DISCONNECT,"未连接"); |
| | | examPlatformStrs.put(TCP_CONNECTED,"未登录"); |
| | | examPlatformStrs.put(DEV_NOT_REGISTERED,"未注册"); |
| | |
| | | @Override |
| | | public void onChanged(GearRelateSet gearRelateSet) { |
| | | if (gearRelateSet != null){ |
| | | Toast.makeText(_mActivity, gearRelateSet.toString(), Toast.LENGTH_SHORT).show(); |
| | | mgearRelateSet = gearRelateSet; |
| | | setDatas(); |
| | | } |
| | |
| | | @Override |
| | | public boolean onBackPressedSupport() { |
| | | // ContentFragment是ShopFragment的栈顶子Fragment,会先调用ContentFragment的onBackPressedSupport方法 |
| | | Toast.makeText(_mActivity, "onBackPressedSupport-->return false, 上层处理" , Toast.LENGTH_SHORT).show(); |
| | | // Toast.makeText(_mActivity, "onBackPressedSupport-->return false, 上层处理" , Toast.LENGTH_SHORT).show(); |
| | | return false; |
| | | } |
| | | |
| | |
| | | |
| | | OutputStream outputStream = new FileOutputStream( new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/"+context.getPackageName(), assertfileName)); |
| | | byte[] bytes = new byte[1024]; |
| | | int len = 0; |
| | | while ((len =inputStream.read(bytes))>0){ |
| | | outputStream.write(bytes,0,len); |
| | | } |
| | | outputStream.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | /** |
| | | * 拷贝assert目录下的文件到 安装包目录下 |
| | | * @param context |
| | | * @param assertfileName |
| | | */ |
| | | public static void copyAssertFileToCache(Context context,String assertfileName){ |
| | | |
| | | try { |
| | | InputStream inputStream = null; |
| | | try { |
| | | inputStream = context.getAssets() |
| | | .open(assertfileName); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | // deleteFile(context.getPackageName()+"/",assertfileName); |
| | | |
| | | OutputStream outputStream = new FileOutputStream( new File(context.getFilesDir(), assertfileName)); |
| | | // OutputStream outputStream = context.openFileOutput(assertfileName,Context.MODE_PRIVATE+Context.MODE_WORLD_WRITEABLE); |
| | | byte[] bytes = new byte[1024]; |
| | | while ((inputStream.read(bytes))>0){ |
| | | outputStream.write(bytes); |
| | | } |