From 0832081b696b58a01f50e0c65aa20cc538e19e4b Mon Sep 17 00:00:00 2001 From: endian11 <Dana_Lee1016@126.com> Date: 星期四, 17 九月 2020 17:43:23 +0800 Subject: [PATCH] 加入路口信息 --- app/src/main/java/safeluck/drive/evaluation/Constant.java | 3 + app/src/main/java/safeluck/drive/evaluation/app.java | 6 ++ app/src/main/java/safeluck/drive/evaluation/routecollect/impl/RouteModel.java | 37 ++++++++---- app/src/main/java/safeluck/drive/evaluation/routecollect/RouteCollectController.java | 13 ++++ app/src/main/java/safeluck/drive/evaluation/routecollect/bean/RoadInfo.java | 34 +++++++++++ app/src/main/java/safeluck/drive/evaluation/fragment/TrainFragment.java | 12 ++++ app/src/main/java/safeluck/drive/evaluation/routecollect/bean/RoadCrossInfo.java | 44 ++++++++++++++ app/src/main/java/safeluck/drive/evaluation/routecollect/ICollectView.java | 6 ++ app/src/main/java/safeluck/drive/evaluation/routecollect/ILoadListener.java | 6 ++ 9 files changed, 148 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/safeluck/drive/evaluation/Constant.java b/app/src/main/java/safeluck/drive/evaluation/Constant.java index a0dd066..17f62ca 100644 --- a/app/src/main/java/safeluck/drive/evaluation/Constant.java +++ b/app/src/main/java/safeluck/drive/evaluation/Constant.java @@ -94,6 +94,9 @@ //鐢ㄤ簬鍦板浘杞﹁締绉诲姩 鍧愭爣 public static final String BIND_RTK_INFO_MAP = "bind_rtk_info_map"; public static final int ID_SM_CARSENSOR = 0x0013; + public static final String BIND_ROUTE_COLLECT_TOPIC = "BIND_ROUTE_COLLECT_TOPIC"; + public static final int ENTER_OR_EXIT_ROAD_ID = 0x0015; + public static final int ENTER_OR_EXIT_ROADCROSS_ID = 0x0016; public static String exam_enter_exitdata="exam_enter_exitdata"; public static int Chang_di = 2; public static int DaoLu_night = 3; diff --git a/app/src/main/java/safeluck/drive/evaluation/app.java b/app/src/main/java/safeluck/drive/evaluation/app.java index db45ca9..2541220 100644 --- a/app/src/main/java/safeluck/drive/evaluation/app.java +++ b/app/src/main/java/safeluck/drive/evaluation/app.java @@ -517,6 +517,12 @@ Log.i("InspectSignal",json); CEventCenter.dispatchEvent(Constant.BIND_MCUINFO_TOPIC,cmd,0,json); break; + case Constant.ENTER_OR_EXIT_ROAD_ID: +// CEventCenter.dispatchEvent(Constant.BIND_RTK_INFO_MAP,cmd,0,json); +// break; + case Constant.ENTER_OR_EXIT_ROADCROSS_ID: + CEventCenter.dispatchEvent(Constant.BIND_RTK_INFO_MAP,cmd,0,json); + break; } } diff --git a/app/src/main/java/safeluck/drive/evaluation/fragment/TrainFragment.java b/app/src/main/java/safeluck/drive/evaluation/fragment/TrainFragment.java index e480e6b..1d378da 100644 --- a/app/src/main/java/safeluck/drive/evaluation/fragment/TrainFragment.java +++ b/app/src/main/java/safeluck/drive/evaluation/fragment/TrainFragment.java @@ -91,6 +91,8 @@ import safeluck.drive.evaluation.routecollect.CollectPointResult; import safeluck.drive.evaluation.routecollect.ICollectView; import safeluck.drive.evaluation.routecollect.RouteCollectController; +import safeluck.drive.evaluation.routecollect.bean.RoadCrossInfo; +import safeluck.drive.evaluation.routecollect.bean.RoadInfo; import safeluck.drive.evaluation.util.CThreadPoolExecutor; import safeluck.drive.evaluation.util.Utils; import safeluck.drive.evaluation.widget.StatusDialog; @@ -1060,4 +1062,14 @@ public void routeItem(CollectPointResult collectPointResult) { Log.i(TAG,String.format("x=%f,y=%f",collectPointResult.getX(),collectPointResult.getY())); } + + @Override + public void roadinfo(RoadInfo roadInfo) { + + } + + @Override + public void roadcrossInfo(RoadCrossInfo roadCrossInfo) { + + } } diff --git a/app/src/main/java/safeluck/drive/evaluation/routecollect/ICollectView.java b/app/src/main/java/safeluck/drive/evaluation/routecollect/ICollectView.java index 53c9ff4..0af19a1 100644 --- a/app/src/main/java/safeluck/drive/evaluation/routecollect/ICollectView.java +++ b/app/src/main/java/safeluck/drive/evaluation/routecollect/ICollectView.java @@ -1,5 +1,8 @@ package safeluck.drive.evaluation.routecollect; +import safeluck.drive.evaluation.routecollect.bean.RoadCrossInfo; +import safeluck.drive.evaluation.routecollect.bean.RoadInfo; + /** * DriveJudge * Created by lzw on 2020/9/16. 10:12:23 @@ -15,4 +18,7 @@ * @param collectPointResult */ void routeItem(CollectPointResult collectPointResult ); + + void roadinfo(RoadInfo roadInfo); + void roadcrossInfo(RoadCrossInfo roadCrossInfo); } diff --git a/app/src/main/java/safeluck/drive/evaluation/routecollect/ILoadListener.java b/app/src/main/java/safeluck/drive/evaluation/routecollect/ILoadListener.java index 3c79882..03ef1a6 100644 --- a/app/src/main/java/safeluck/drive/evaluation/routecollect/ILoadListener.java +++ b/app/src/main/java/safeluck/drive/evaluation/routecollect/ILoadListener.java @@ -1,5 +1,8 @@ package safeluck.drive.evaluation.routecollect; +import safeluck.drive.evaluation.routecollect.bean.RoadCrossInfo; +import safeluck.drive.evaluation.routecollect.bean.RoadInfo; + /** * DriveJudge * Created by lzw on 2020/9/16. 10:54:19 @@ -9,4 +12,7 @@ public interface ILoadListener { void finishCollectItem(CollectPointResult collectPointResult); + + void roadInfo(RoadInfo roadInfo); + void roadCrossInfo(RoadCrossInfo roadCrossInfo); } diff --git a/app/src/main/java/safeluck/drive/evaluation/routecollect/RouteCollectController.java b/app/src/main/java/safeluck/drive/evaluation/routecollect/RouteCollectController.java index bb439c3..9759ef3 100644 --- a/app/src/main/java/safeluck/drive/evaluation/routecollect/RouteCollectController.java +++ b/app/src/main/java/safeluck/drive/evaluation/routecollect/RouteCollectController.java @@ -1,6 +1,8 @@ package safeluck.drive.evaluation.routecollect; import safeluck.drive.evaluation.fragment.TrainFragment; +import safeluck.drive.evaluation.routecollect.bean.RoadCrossInfo; +import safeluck.drive.evaluation.routecollect.bean.RoadInfo; import safeluck.drive.evaluation.routecollect.impl.RouteModel; /** @@ -45,4 +47,15 @@ iCollectView.routeItem(collectPointResult); } } + + @Override + public void roadInfo(RoadInfo roadInfo) { + + } + + @Override + public void roadCrossInfo(RoadCrossInfo roadCrossInfo) { + + } + } diff --git a/app/src/main/java/safeluck/drive/evaluation/routecollect/bean/RoadCrossInfo.java b/app/src/main/java/safeluck/drive/evaluation/routecollect/bean/RoadCrossInfo.java new file mode 100644 index 0000000..d04a0f4 --- /dev/null +++ b/app/src/main/java/safeluck/drive/evaluation/routecollect/bean/RoadCrossInfo.java @@ -0,0 +1,44 @@ +package safeluck.drive.evaluation.routecollect.bean; + +/** + * DriveJudge + * Created by lzw on 2020/9/17. 17:39:51 + * 閭锛�632393724@qq.com + * All Rights Saved! Chongqing AnYun Tech co. LTD + */ +public class RoadCrossInfo { + + /** + * road_id : 0 + * crossing_index : 0 + * status : 0 + */ + + private int road_id; + private int crossing_index; + private int status; + + public int getRoad_id() { + return road_id; + } + + public void setRoad_id(int road_id) { + this.road_id = road_id; + } + + public int getCrossing_index() { + return crossing_index; + } + + public void setCrossing_index(int crossing_index) { + this.crossing_index = crossing_index; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } +} diff --git a/app/src/main/java/safeluck/drive/evaluation/routecollect/bean/RoadInfo.java b/app/src/main/java/safeluck/drive/evaluation/routecollect/bean/RoadInfo.java new file mode 100644 index 0000000..cd63083 --- /dev/null +++ b/app/src/main/java/safeluck/drive/evaluation/routecollect/bean/RoadInfo.java @@ -0,0 +1,34 @@ +package safeluck.drive.evaluation.routecollect.bean; + +/** + * DriveJudge + * Created by lzw on 2020/9/17. 17:39:38 + * 閭锛�632393724@qq.com + * All Rights Saved! Chongqing AnYun Tech co. LTD + */ +public class RoadInfo { + + /** + * road_id : 0 + * status : 0 + */ + + private int road_id; + private int status; + + public int getRoad_id() { + return road_id; + } + + public void setRoad_id(int road_id) { + this.road_id = road_id; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } +} diff --git a/app/src/main/java/safeluck/drive/evaluation/routecollect/impl/RouteModel.java b/app/src/main/java/safeluck/drive/evaluation/routecollect/impl/RouteModel.java index 399ca2b..cdc1386 100644 --- a/app/src/main/java/safeluck/drive/evaluation/routecollect/impl/RouteModel.java +++ b/app/src/main/java/safeluck/drive/evaluation/routecollect/impl/RouteModel.java @@ -29,22 +29,33 @@ @Override public void onCEvent(String topic, int msgCode, int resultCode, Object obj) { //,"coord_x":0.974,"coord_x_dir":"N","coord_y":-0.191,"c - if (iLoadListener != null){ - CollectPointResult collectPointResult = new CollectPointResult(); - try { - JSONObject jsonObject = new JSONObject((String)obj); - double x = jsonObject.getDouble("coord_x"); - double y = jsonObject.getDouble("coord_y"); + if (msgCode==Constant.RTK_INFO){ + if (iLoadListener != null){ + CollectPointResult collectPointResult = new CollectPointResult(); + try { + JSONObject jsonObject = new JSONObject((String)obj); + double x = jsonObject.getDouble("coord_x"); + double y = jsonObject.getDouble("coord_y"); - Log.i(TAG,String.format("閲囬泦鍒扮殑鐐广�恱=%f,y=%f]",x,y)); - collectPointResult.setX(Utils.getdouble(x,4)); - collectPointResult.setY(Utils.getdouble(y,4)); - iLoadListener.finishCollectItem(collectPointResult); - } catch (JSONException e) { - e.printStackTrace(); + Log.i(TAG,String.format("閲囬泦鍒扮殑鐐广�恱=%f,y=%f]",x,y)); + collectPointResult.setX(Utils.getdouble(x,4)); + collectPointResult.setY(Utils.getdouble(y,4)); + iLoadListener.finishCollectItem(collectPointResult); + } catch (JSONException e) { + e.printStackTrace(); + } + } - } + + if (msgCode == Constant.ENTER_OR_EXIT_ROAD_ID){ + Log.i(TAG,"閬撹矾娑堟伅"+(String)obj); + } + + if (msgCode == Constant.ENTER_OR_EXIT_ROADCROSS_ID){ + Log.i(TAG,"璺彛娑堟伅"+(String)obj); + } + } }; -- Gitblit v1.8.0