diff --git a/modules/mogo-module-service/src/main/assets/adas_bike.txt b/modules/mogo-module-service/src/main/assets/adas_bike.txt
new file mode 100644
index 0000000000..bfbda26943
--- /dev/null
+++ b/modules/mogo-module-service/src/main/assets/adas_bike.txt
@@ -0,0 +1 @@
+{"systemTime":1615529718585,"satelliteTime":1615529718585,"lon":116.411411222501,"lat":39.9753341630918,"alt":34.4018669128417,"heading":0.342695406938048,"speed":0.003303937,"type":3,"uuid":"2_1"}
{"systemTime":1615529718636,"satelliteTime":1615529718636,"lon":116.411411220925,"lat":39.9753341651731,"alt":34.4015388488769,"heading":0.343515029638467,"speed":0.0047798273,"type":3,"uuid":"2_1"}
\ No newline at end of file
diff --git a/modules/mogo-module-service/src/main/assets/adas_person.txt b/modules/mogo-module-service/src/main/assets/adas_person.txt
new file mode 100644
index 0000000000..a29b95434a
--- /dev/null
+++ b/modules/mogo-module-service/src/main/assets/adas_person.txt
@@ -0,0 +1 @@
+{"systemTime":1615529718585,"satelliteTime":1615529718585,"lon":116.411411222501,"lat":39.9753341630918,"alt":34.4018669128417,"heading":0.342695406938048,"speed":0.003303937,"type":3,"uuid":"2_1"}
{"systemTime":1615529718636,"satelliteTime":1615529718636,"lon":116.411411220925,"lat":39.9753341651731,"alt":34.4015388488769,"heading":0.343515029638467,"speed":0.0047798273,"type":3,"uuid":"2_1"}
{"systemTime":1615529718688,"satelliteTime":1615529718688,"lon":116.411411219886,"lat":39.9753341666208,"alt":34.4012908935546,"heading":0.344129746663782,"speed":0.0041261637,"type":3,"uuid":"2_1"}
{"systemTime":1615529718748,"satelliteTime":1615529718748,"lon":116.411411218862,"lat":39.9753341684681,"alt":34.400951385498,"heading":0.343241822071661,"speed":0.004486713,"type":3,"uuid":"2_1"}
{"systemTime":1615529718787,"satelliteTime":1615529718787,"lon":116.411411217972,"lat":39.9753341703566,"alt":34.4005889892578,"heading":0.346814011007552,"speed":0.0047472687,"type":3,"uuid":"2_1"}
\ No newline at end of file
diff --git a/modules/mogo-module-v2x/src/main/AndroidManifest.xml b/modules/mogo-module-v2x/src/main/AndroidManifest.xml
index 10181ad5df..55a8c743c5 100644
--- a/modules/mogo-module-v2x/src/main/AndroidManifest.xml
+++ b/modules/mogo-module-v2x/src/main/AndroidManifest.xml
@@ -24,6 +24,14 @@
+
+
+
+
+
+
+
+
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java
index 216a7b9b08..49c2f35391 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java
@@ -36,6 +36,12 @@ public class V2XConst {
public static final String BROADCAST_SCENE_HANDLER_ACTION = "com.v2x.scene_handler_broadcast";
public static final String BROADCAST_SCENE_EXTRA_KEY = "V2XMessageEntity";
+ /**
+ * V2X ADASData Action
+ */
+ public static final String BROADCAST_ADAS_SCENE_HANDLER_ACTION = "com.v2x.adas_data_broadcast";
+ public static final String BROADCAST_ADAS_EXTRA_KEY = "ADASData";
+
/**
* V2X 测试控制面板广播Action
*/
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XServiceManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XServiceManager.java
index da66d70c52..c3752530fe 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XServiceManager.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XServiceManager.java
@@ -3,12 +3,17 @@ package com.mogo.module.v2x;
import android.content.Context;
import com.alibaba.android.arouter.launcher.ARouter;
+import com.mogo.map.MogoLatLng;
import com.mogo.map.location.IMogoLocationClient;
import com.mogo.map.marker.IMogoMarkerManager;
import com.mogo.map.navi.IMogoNavi;
import com.mogo.map.overlay.IMogoOverlayManager;
+import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.map.search.geo.IMogoGeoSearch;
import com.mogo.map.uicontroller.IMogoMapUIController;
+import com.mogo.module.common.MogoApisHandler;
+import com.mogo.module.common.drawer.AdasRecognizedResultDrawer;
+import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.v2x.alarm.V2XCalculateServer;
import com.mogo.module.v2x.manager.IMoGoV2XMarkerManager;
import com.mogo.module.v2x.manager.IMoGoV2XPolylineManager;
@@ -16,6 +21,7 @@ import com.mogo.module.v2x.manager.IMoGoV2XStatusManager;
import com.mogo.module.v2x.manager.IMoGoWarnPolylineManager;
import com.mogo.module.v2x.network.V2XRefreshModel;
import com.mogo.module.v2x.utils.V2XUtils;
+import com.mogo.realtime.entity.ADASRecognizedResult;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.adas.IMogoADASController;
@@ -41,6 +47,9 @@ import com.mogo.service.windowview.IMogoWindowManager;
import com.zhidao.carchattingprovider.CallChattingProviderConstant;
import com.zhidao.carchattingprovider.ICarsChattingProvider;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
@@ -99,6 +108,9 @@ public class V2XServiceManager {
private static IMoGoV2XStatusManager moGoV2XStatusManager;
private static IMoGoWarnPolylineManager moGoWarnPolylineManager;
+ List resultList = new ArrayList<>();
+
+
private V2XServiceManager() {
}
@@ -152,9 +164,38 @@ public class V2XServiceManager {
moGoWarnPolylineManager = (IMoGoWarnPolylineManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_WARN_POLYLINE_MANAGER).navigation(context);
moGoV2XStatusManager = (IMoGoV2XStatusManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_STATUS_MANAGER).navigation(context);
+
+ List lonLats = new ArrayList<>();
+
+ // adas 每隔一秒传递的他车或行人数据
+ MarkerServiceHandler.getApis().getAdasControllerApi().addAdasRecognizedDataCallback(resultList -> {
+ // 绘制近景识别到的车辆,行人和二轮车 TODO
+ AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult( resultList );
+
+ //清理
+ V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
+
+ // 绘制连接线 TODO 来的是列表数据
+// V2XServiceManager.getMoGoWarnPolylineManager().drawableWarnPolyline(context, roadEventEntity);
+
+ //更新数据
+ for (ADASRecognizedResult result : resultList) {
+ MogoLatLng latLng = new MogoLatLng(result.lat, result.lon);
+ lonLats.add(latLng);
+ }
+
+ IMogoPolyline mMogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline();
+ mMogoPolyline.setPoints(lonLats);
+
+ } );
+
+ //绘制自车数据 liyz
+ MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient(mContext).getLastKnowLocation();
+
}
}
+
public static Context getContext() {
return mContext;
}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/model/DrawLineInfo.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/model/DrawLineInfo.java
new file mode 100644
index 0000000000..8acd7004e6
--- /dev/null
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/model/DrawLineInfo.java
@@ -0,0 +1,44 @@
+package com.mogo.module.v2x.entity.model;
+
+
+import com.mogo.map.MogoLatLng;
+
+
+/**
+ * @author lixiaopeng
+ * @description
+ * @since 2020/7/29
+ */
+public class DrawLineInfo {
+ //报警类型
+ private String type;
+
+ // 起点位置
+ private MogoLatLng startLocation;
+ //结束点位置
+ private MogoLatLng endLocation;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public MogoLatLng getStartLocation() {
+ return startLocation;
+ }
+
+ public void setStartLocation(MogoLatLng startLocation) {
+ this.startLocation = startLocation;
+ }
+
+ public MogoLatLng getEndLocation() {
+ return endLocation;
+ }
+
+ public void setEndLocation(MogoLatLng endLocation) {
+ this.endLocation = endLocation;
+ }
+}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoWarnPolylineManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoWarnPolylineManager.java
index c2a2913d3f..fbdd452138 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoWarnPolylineManager.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoWarnPolylineManager.java
@@ -5,6 +5,8 @@ import android.content.Context;
import com.alibaba.android.arouter.facade.template.IProvider;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.module.common.entity.V2XRoadEventEntity;
+import com.mogo.module.v2x.entity.model.DrawLineInfo;
+import com.mogo.realtime.entity.ADASRecognizedResult;
/**
* 绘制可变宽度和渐变的线
@@ -14,9 +16,9 @@ public interface IMoGoWarnPolylineManager extends IProvider {
* 绘制连接线,目标车,与当前车辆间连线
*
* @param context
- * @param roadEventEntity
+ * @param info
*/
- void drawableWarnPolyline(Context context, V2XRoadEventEntity roadEventEntity);
+ void drawableWarnPolyline(Context context, DrawLineInfo info);
/**
* 移除连接线
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoWarnPolylineManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoWarnPolylineManager.java
index 40d19c0b03..fed112a454 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoWarnPolylineManager.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoWarnPolylineManager.java
@@ -10,7 +10,9 @@ import com.mogo.module.common.entity.V2XPoiTypeEnum;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.v2x.MoGoV2XServicePaths;
import com.mogo.module.v2x.V2XServiceManager;
+import com.mogo.module.v2x.entity.model.DrawLineInfo;
import com.mogo.module.v2x.manager.IMoGoWarnPolylineManager;
+import com.mogo.realtime.entity.ADASRecognizedResult;
import java.util.ArrayList;
import java.util.List;
@@ -23,52 +25,40 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
private static final String TAG = "MoGoWarnPolylineManager";
private static IMogoPolyline mMogoPolyline;
- //TODO liyz
+
@Override
- public void drawableWarnPolyline(Context context, V2XRoadEventEntity roadEventEntity) {
+ public void drawableWarnPolyline(Context context, DrawLineInfo info) {
try {
if (mMogoPolyline != null) {
mMogoPolyline.remove();
}
- if ((V2XServiceManager.getMoGoV2XStatusManager().isRoadEventPOIShow()
- || V2XServiceManager.getMoGoV2XStatusManager().isOtherSeekHelpPOIShow())
- && V2XServiceManager.getV2XStatusManager().getTargetMoGoLatLng() != null) {
- // 连接线参数
- MogoPolylineOptions options = new MogoPolylineOptions();
- // 渐变色
- List colors = new ArrayList<>();
+ // 连接线参数
+ MogoPolylineOptions options = new MogoPolylineOptions();
- switch (roadEventEntity.getPoiType()) {
- case V2XPoiTypeEnum.ALERT_TRAFFIC_LIGHT_SUGGEST:
- case V2XPoiTypeEnum.ALERT_TRAFFIC_LIGHT_WARNING:
- case V2XPoiTypeEnum.FOURS_BLOCK_UP:
- case V2XPoiTypeEnum.ALERT_CAR_TROUBLE_WARNING + "":
- colors.add(0xFFFFA31A);
- colors.add(0xFFFFA31A);
- break;
- default:
- colors.add(0xFFE32F46);
- colors.add(0xFFE32F46);
- break;
- }
+ // 渐变色
+ List colors = new ArrayList<>();
- // 线条粗细,渐变,渐变色值
- options.width(10).useGradient(true).colorValues(colors);
-
- // 当前车辆位置
- MogoLatLng carLocation = V2XServiceManager.getNavi().getCarLocation();
- if (carLocation != null) {
- options.add(carLocation);
- } else {
- options.add(V2XServiceManager.getV2XStatusManager().getLocation());
- }
- // 目标车辆位置
- options.add(V2XServiceManager.getV2XStatusManager().getTargetMoGoLatLng());
-
- // 绘制线的对象
- mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options);
+ if (info.getType().equals("1")) { //预警 TODO
+ colors.add(0xFFFFA31A);
+ colors.add(0xFFFFA31A);
+ } else {
+ colors.add(0xFFE32F46);
+ colors.add(0xFFE32F46);
}
+
+ // 线条粗细,渐变,渐变色值
+ options.width(30).useGradient(true).colorValues(colors);
+
+ // 当前车辆位置
+ options.add(info.getStartLocation());
+
+ // 目标车辆位置
+ options.add(info.getStartLocation());
+
+ // 绘制线的对象
+ mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options);
+
} catch (Exception e) {
e.printStackTrace();
}
@@ -79,7 +69,6 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
if (mMogoPolyline != null) {
mMogoPolyline.remove();
mMogoPolyline = null;
- V2XServiceManager.getV2XStatusManager().setAlarmInfo(null);
}
}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/receiver/AdasDataBroadcastReceiver.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/receiver/AdasDataBroadcastReceiver.java
new file mode 100644
index 0000000000..80325f76df
--- /dev/null
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/receiver/AdasDataBroadcastReceiver.java
@@ -0,0 +1,29 @@
+package com.mogo.module.v2x.receiver;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+import com.mogo.module.v2x.V2XConst;
+import com.mogo.realtime.entity.ADASRecognizedResult;
+import com.mogo.utils.logger.Logger;
+import com.mogo.utils.network.utils.GsonUtil;
+
+/**
+ * 单车预警,车辆盲区预警,弱势交通参与者预警
+ */
+public class AdasDataBroadcastReceiver extends BroadcastReceiver {
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ try {
+ ADASRecognizedResult adasResult = (ADASRecognizedResult) intent.getSerializableExtra(V2XConst.BROADCAST_ADAS_EXTRA_KEY);
+ Logger.d("AdasDataBroadcastReceiver", "adasResult:" + GsonUtil.jsonFromObject(adasResult));
+
+// V2XScenarioManager.getInstance().handlerMessage(adasResult);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}