| | |
| | | + applicationContext.getPackageName() + "/" + fileName) |
| | | CThreadPoolExecutor.runInBackground(Runnable { |
| | | str = gson.toJson(map.data.map_json) |
| | | MyLog.i(PlatFormConstant.HTTPTAG,"科三道路地图保存成功") |
| | | FileUtil.writeTxtFileToSD(applicationContext, fileName, str, "") |
| | | sendRoadMapInfo() |
| | | // sendRoadMapInfo() |
| | | }) |
| | | } |
| | | |
| | |
| | | ExamPlatformData.getInstance().setNewMapPath(Environment.getExternalStorageDirectory().absolutePath + "/" |
| | | + applicationContext.getPackageName() + "/"+fileName) |
| | | CThreadPoolExecutor.runInBackground(Runnable{ |
| | | MyLog.i(PlatFormConstant.HTTPTAG,"科三场地地图保存成功") |
| | | str = gson.toJson(yard.data.map_json) |
| | | FileUtil.writeTxtFileToSD(applicationContext,fileName,str,"") |
| | | sendMapInfo() |
| | | // sendMapInfo() |
| | | }) |
| | | } |
| | | } |
| | |
| | | Log.i(TAG, "解析之后的车模型=$str") |
| | | CThreadPoolExecutor.runInBackground(Runnable{ |
| | | str = gson.toJson(car.data.map_json) |
| | | MyLog.i(PlatFormConstant.HTTPTAG,"车辆模型保存成功") |
| | | FileUtil.writeTxtFileToSD(applicationContext,fileName,str,"") |
| | | sendVehicleInfo() |
| | | // sendVehicleInfo() |
| | | }) |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | } else { |
| | | Toast.makeText(applicationContext, jsonObject1!!.getString("data"), Toast.LENGTH_SHORT).show() |
| | | // Toast.makeText(applicationContext, jsonObject1!!.getString("data"), Toast.LENGTH_SHORT).show() |
| | | } |
| | | } |
| | | }) |
| | | |
| | | }else{ |
| | | MyLog.i(PlatFormConstant.HTTPTAG,"已存在直接发送车辆和地图") |
| | | when(type){ |
| | | "road" -> sendRoadMapInfo() |
| | | "yard" -> sendMapInfo() |
| | | else -> sendVehicleInfo() |
| | | } |
| | | // MyLog.i(PlatFormConstant.HTTPTAG,"已存在直接发送车辆和地图"+fileName) |
| | | // when(type){ |
| | | // "road" -> sendRoadMapInfo() |
| | | // "yard" -> sendMapInfo() |
| | | // else -> sendVehicleInfo() |
| | | // } |
| | | |
| | | } |
| | | } |
| | |
| | | AYSdk.getInstance().sendCmd(Constant.PUSH_VECHILE_PROFILE,str); |
| | | }else{ |
| | | MyLog.i(String.format("文件:%s不存在",carPath)); |
| | | CThreadPoolExecutor.runOnMainThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | Toast.makeText(getAppContext(), "文件:"+carPath+"不存在", Toast.LENGTH_SHORT).show(); |
| | | } |
| | | }); |
| | | } |
| | | }else{ |
| | | StringBuffer vebuffer =FileUtil.readAssetTxtFile(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())); |
| | | } |
| | | CThreadPoolExecutor.runOnMainThread(()->{ |
| | | MyLog.i("车辆模型发送失败,请手动设置"); |
| | | Toast.makeText(getAppContext(), "车辆模型发送失败,请手动设置", 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(); |
| | | MyLog.i("道路地图发送失败,请手动设置"); |
| | | Toast.makeText(getAppContext(), "道路地图发送失败,请手动设置", Toast.LENGTH_SHORT).show(); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | } |
| | | if (!TextUtils.isEmpty(mapPath)){ |
| | | MyLog.i("调用更新Map路径后的地图"+mapPath); |
| | |
| | | }); |
| | | } |
| | | }else{ |
| | | MyLog.i("读取Assert目录下初始化的地图"); |
| | | CThreadPoolExecutor.runOnMainThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | Toast.makeText(getAppContext(), "读取Assert目录下初始化的地图", Toast.LENGTH_SHORT).show(); |
| | | MyLog.i("场地地图发送失败,请手动设置"); |
| | | Toast.makeText(getAppContext(), "场地地图发送失败,请手动设置", Toast.LENGTH_SHORT).show(); |
| | | } |
| | | }); |
| | | StringBuffer buffer; |
| | | |
| | | buffer =FileUtil.readAssetTxtFile(getApplicationContext(),Constant.MAP); |
| | | if (buffer != null){ |
| | | |
| | | AYSdk.getInstance().sendCmd(Constant.PUSH_MAP_INFO,buffer.toString()); |
| | | }else{ |
| | | MyLog.d(TAG,String.format("地图模型未拷入[%s]目录下", Environment.getExternalStorageDirectory().getAbsolutePath()+"/"+getApplicationContext().getPackageName())); |
| | | CThreadPoolExecutor.runOnMainThread(() -> Toast.makeText(getAppContext(), String.format("地图模型未拷入[%s]目录下", Environment.getExternalStorageDirectory().getAbsolutePath()+"/"+getApplicationContext().getPackageName()), Toast.LENGTH_SHORT).show()); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | Drawable leftGreen ; |
| | | Drawable leftGray ; |
| | | private int index =0 ; |
| | | private Object object = new Object(); |
| | | private ICEventListener icEventListener = new ICEventListener() { |
| | | @Override |
| | | public void onCEvent(String topic, int msgCode, int resultCode, Object obj) { |
| | | synchronized (object){ |
| | | if (msgCode==Constant.MCU_SN){ |
| | | final MCUInfo mcuInfo = gson.fromJson((String)obj, MCUInfo.class); |
| | | if (mcuInfo != null){ |
| | |
| | | bingding.myspeed.updateStr(String.valueOf(mcuInfo.getSpeed()/10.0)); |
| | | |
| | | for (int i = 0; i < gpios.size(); i++) { |
| | | Log.i(TAG, "run: gpio["+i+"]="+gpios.get(i)); |
| | | MyLog.i(TAG, "run: gpio["+i+"]="+gpios.get(i)); |
| | | } |
| | | MyLog.i("gpios.size="+gpios.size()); |
| | | bingding.inpsetSignalSlice.tvSeatBelt.setCompoundDrawablesWithIntrinsicBounds(gpios.get(5)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvTrunLeft.setCompoundDrawablesWithIntrinsicBounds(gpios.get(14)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | | bingding.inpsetSignalSlice.tvTurnRight.setCompoundDrawablesWithIntrinsicBounds(gpios.get(15)==VALIAD_NUM?leftGreen:leftGray,null,null,null); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | }; |
| | | |
| | | public static SupportFragment newInstance(){ |