diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 83405b8de1..4ff10f68a5 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -91,6 +91,7 @@
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 97b9126cee..74aa6f6b47 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -8,7 +8,7 @@
-
+
\ No newline at end of file
diff --git a/main-extensions/mogo-module-main-launcher/src/main/java/com/zhidao/mogo/module/main/launcher/MainLauncherActivity.java b/main-extensions/mogo-module-main-launcher/src/main/java/com/zhidao/mogo/module/main/launcher/MainLauncherActivity.java
index bbe709f901..511770f1ee 100644
--- a/main-extensions/mogo-module-main-launcher/src/main/java/com/zhidao/mogo/module/main/launcher/MainLauncherActivity.java
+++ b/main-extensions/mogo-module-main-launcher/src/main/java/com/zhidao/mogo/module/main/launcher/MainLauncherActivity.java
@@ -178,7 +178,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
}
@Override
- public void warningChangedWithType(int type) {
+ public void warningChangedWithDirection(int type) {
Log.d(TAG, "显示红色预警蒙层");
switch (type) {
case ALERT_THE_FRONT_CRASH_WARNING_TOP:
diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/PushRoadConditionDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/PushRoadConditionDrawer.java
index a281288538..644c8bf7bb 100644
--- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/PushRoadConditionDrawer.java
+++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/PushRoadConditionDrawer.java
@@ -1,17 +1,6 @@
package com.mogo.module.common.drawer;
-import com.mogo.commons.AbsMogoApplication;
-import com.mogo.map.MogoLatLng;
-import com.mogo.map.marker.IMogoMarker;
-import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.map.overlay.IMogoPolyline;
-import com.mogo.module.common.MogoApisHandler;
-import com.mogo.module.common.constants.DataTypes;
-import com.mogo.module.common.drawer.marker.MapVrMarkerView;
-import com.mogo.module.common.entity.V2XPushMessageEntity;
-
-import java.util.ArrayList;
-import java.util.List;
/**
* @author donghongyu
@@ -20,11 +9,10 @@ import java.util.List;
*/
public class PushRoadConditionDrawer {
- private static final String TAG = "OnlineCarDrawer";
+ private static final String TAG = "PushRoadConditionDrawer";
private static volatile PushRoadConditionDrawer sInstance;
private static IMogoPolyline mMogoPolyline;
- private static IMogoMarker mMogoMarker;
private PushRoadConditionDrawer() {
}
@@ -41,57 +29,11 @@ public class PushRoadConditionDrawer {
}
public synchronized void release() {
- clearMarker();
clearPolyline();
mMogoPolyline = null;
- mMogoMarker = null;
sInstance = null;
}
-
- private Object readResolve() {
- // 阻止反序列化,必须实现 Serializable 接口
- return sInstance;
- }
-
-
- /**
- * 绘制路况事件Marker移动轨迹
- */
- public void drawRoadConditionMarker(V2XPushMessageEntity entity) {
- // 道路事件
- MogoMarkerOptions options = new MogoMarkerOptions()
- .object(entity)
- .latitude(entity.getLat())
- .longitude(entity.getLon());
- options.anchor(0.5f, 0.5f);
-
- options.icon(MapVrMarkerView.getInstance().getBitmap(entity.getSceneId()));
-
- mMogoMarker =
- MogoApisHandler
- .getInstance()
- .getApis()
- .getMapServiceApi()
- .getMarkerManager(AbsMogoApplication.getApp())
- .addMarker(DataTypes.TYPE_MARKER_PUSH_DATA, options);
-
- List points = new ArrayList<>();
-
- for (double[] doubles : entity.getMoveTrack()) {
- points.add(new MogoLatLng(doubles[1], doubles[0]));
- }
-
- mMogoMarker.startSmooth(points, 10);
- }
-
-
- public void clearMarker() {
- if (mMogoMarker != null) {
- mMogoMarker.remove();
- }
- }
-
public void clearPolyline() {
if (mMogoPolyline != null) {
mMogoPolyline.remove();
diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XPushMessageEntity.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XPushMessageEntity.java
index 223e86a268..b6a9fe2ca8 100644
--- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XPushMessageEntity.java
+++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XPushMessageEntity.java
@@ -48,8 +48,6 @@ public class V2XPushMessageEntity implements Serializable {
private List polyline;
- private List moveTrack;
-
private List recommendPolyline;
public int getViewType() {
@@ -283,14 +281,6 @@ public class V2XPushMessageEntity implements Serializable {
this.polyline = polyline;
}
- public List getMoveTrack() {
- return moveTrack;
- }
-
- public void setMoveTrack(List moveTrack) {
- this.moveTrack = moveTrack;
- }
-
public List getRecommendPolyline() {
return recommendPolyline;
}
diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XWarningEntity.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XWarningEntity.java
new file mode 100644
index 0000000000..3dc98fe662
--- /dev/null
+++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XWarningEntity.java
@@ -0,0 +1,188 @@
+package com.mogo.module.common.entity;
+
+import java.io.Serializable;
+
+/**
+ * @author liujing
+ * @description 预警目标物数据模型
+ * @since: 2021/3/26
+ */
+public class V2XWarningEntity implements Serializable {
+
+ //事件类型 行人0/自行车1/摩托车2/小汽车3/公交车4
+ private int type;
+ //目标物位置
+ private double lat;
+ private double lon;
+ //距离
+ private double distance;
+ //预测碰撞点位置
+ private double collisionLat;
+ private double collisionLon;
+ //来源 ADAS/云端
+ private int from;
+ //朝向 角度
+ private double angle;
+ //方位 前 后 左 右
+ private int direction;
+ //速度
+ private float speed;
+
+ //以下为自组字段
+ //预警文案
+ private String tipContent;
+ //tts播报
+ private String tts;
+
+ public void setTipContent(int type) {
+ switch (type) {
+ case 0:
+ this.tipContent = "行人碰撞预警";
+ break;
+ case 1:
+ case 3:
+ case 4:
+ this.tipContent = "前车碰撞预警";
+ break;
+ case 2:
+ this.tipContent = "摩托车碰撞预警";
+ break;
+ default:
+ break;
+ }
+ }
+
+ public void setTts(int type) {
+ switch (type) {
+ case 0:
+ this.tts = "注意行人";
+ break;
+ case 1:
+ this.tts = "注意自行车";
+ break;
+ case 2:
+ this.tts = "注意摩托车";
+ break;
+ case 3:
+ case 4:
+ this.tts = "注意前方车辆";
+ break;
+ default:
+ break;
+ }
+ }
+
+ public void setType(int type) {
+ this.type = type;
+ }
+
+ public void setDistance(double distance) {
+ this.distance = distance;
+ }
+
+ public void setLat(double lat) {
+ this.lat = lat;
+ }
+
+ public void setLon(double lon) {
+ this.lon = lon;
+ }
+
+ public void setCollisionLat(double collisionLat) {
+ this.collisionLat = collisionLat;
+ }
+
+ public void setCollisionLon(double collisionLon) {
+ this.collisionLon = collisionLon;
+ }
+
+ public void setFrom(int from) {
+ this.from = from;
+ }
+
+ public void setAngle(double angle) {
+ this.angle = angle;
+ }
+
+ public void setDirection(int direction) {
+ this.direction = direction;
+ }
+
+ public void setSpeed(float speed) {
+ this.speed = speed;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+
+ public double getLat() {
+ return lat;
+ }
+
+ public double getLon() {
+ return lon;
+ }
+
+ public double getCollisionLat() {
+ return collisionLat;
+ }
+
+ public double getCollisionLon() {
+ return collisionLon;
+ }
+
+ public double getDistance() {
+ return distance;
+ }
+
+ public int getFrom() {
+ return from;
+ }
+
+ public double getAngle() {
+ return angle;
+ }
+
+ public int getDirection() {
+ return direction;
+ }
+
+ public float getSpeed() {
+ return speed;
+ }
+
+ public String getTipContent() {
+ if (this.tipContent == null) {
+ setTipContent(type);
+ }
+ return tipContent;
+ }
+
+ public String getTts() {
+ if (tts == null) {
+ setTts(type);
+ }
+ return tts;
+ }
+
+ @Override
+ public String toString() {
+ return "V2XWarningEntity{" +
+ "type=" + type +
+ ", lat=" + lat +
+ ", lon=" + lon +
+ ", distance=" + distance +
+ ", collisionLat=" + collisionLat +
+ ", collisionLon=" + collisionLon +
+ ", from=" + from +
+ ", angle=" + angle +
+ ", direction=" + direction +
+ ", speed=" + speed +
+ ", tipContent='" + tipContent + '\'' +
+ ", tts='" + tts + '\'' +
+ '}';
+ }
+}
+
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..5151de383b 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 每隔一秒传递的他车或行人数据
+ mIMogoADASController.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
+
+
}
}
+
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();
+ }
+ }
+}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/push/V2XPushEventWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/push/V2XPushEventWindow.java
index 88917a149d..e9a5059911 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/push/V2XPushEventWindow.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/push/V2XPushEventWindow.java
@@ -36,7 +36,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* e-mail : 1358506549@qq.com
* date : 2020/4/14 2:37 PM
* desc :
- * TODO 目前睡前瞻推送使用的消息都在这里展示
+ * TODO 目前前瞻推送使用的消息都在这里展示
* version: 1.0
*/
public class V2XPushEventWindow extends V2XBasWindow implements IV2XWindow {
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/pushVR/V2XPushVREventMarker.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/pushVR/V2XPushVREventMarker.java
index aa18f70f8b..120088508a 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/pushVR/V2XPushVREventMarker.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/pushVR/V2XPushVREventMarker.java
@@ -1,9 +1,7 @@
package com.mogo.module.v2x.scenario.scene.pushVR;
-import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.map.overlay.MogoPolylineOptions;
-import com.mogo.module.common.drawer.PushRoadConditionDrawer;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
@@ -25,7 +23,6 @@ public class V2XPushVREventMarker implements IV2XMarker {
private final String TAG = "V2XPushVREventMarker";
private static IMogoPolyline mMogoPolyline;
- private static IMogoMarker mAlarmInfoMarker;
@Override
public void drawPOI(V2XPushMessageEntity entity) {
@@ -39,44 +36,13 @@ public class V2XPushVREventMarker implements IV2XMarker {
if (mMogoPolyline != null) {
mMogoPolyline.remove();
}
-
- // 绘制事件点Marker
- PushRoadConditionDrawer.getInstance().drawRoadConditionMarker(entity);
-
// 绘制引导线
- drawablePloyLine(entity);
drawableRecommendPolyline(entity);
} catch (Exception e) {
e.printStackTrace();
}
}
- /**
- * 绘制引导线
- *
- * @param entity
- */
- void drawablePloyLine(V2XPushMessageEntity entity) {
- // 连接线参数
- MogoPolylineOptions options = new MogoPolylineOptions();
-
- // 渐变色
- List colors = new ArrayList<>();
- colors.add(0xFFFA8C34);
- colors.add(0xFFBD6D36);
- colors.add(0xFFFA8C34);
-
- // 线条粗细,渐变,渐变色值
- options.width(15).useGradient(true).color(0xFF1F7EFF);
-
- for (double[] doubles : entity.getPolyline()) {
- options.add(doubles[0], doubles[1]);
- }
-
- // 绘制线的对象
- mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options);
- }
-
/**
* 绘制推荐引导线
*
@@ -93,7 +59,7 @@ public class V2XPushVREventMarker implements IV2XMarker {
colors.add(0xFFCB253A);
// 线条粗细,渐变,渐变色值
- options.width(15).useGradient(true).color(0xFFEF3A3A);
+ options.width(15).useGradient(true).color(0xFFF95959);
for (double[] doubles : entity.getRecommendPolyline()) {
options.add(doubles[0], doubles[1]);
@@ -109,18 +75,10 @@ public class V2XPushVREventMarker implements IV2XMarker {
MarkerUtils.resetMapZoom(16);
// 移除线
clearLine();
- // 移除事件POI
- clearAlarmPOI();
// 绘制上次的数据
V2XServiceManager.getMoGoV2XMarkerManager().drawableLastAllPOI();
}
- void clearAlarmPOI() {
- if (mAlarmInfoMarker != null) {
- mAlarmInfoMarker.remove();
- }
- }
-
public void clearLine() {
if (mMogoPolyline != null) {
mMogoPolyline.remove();
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/pushVR/V2XPushVREventScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/pushVR/V2XPushVREventScenario.java
index 31770af166..59c29c99ff 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/pushVR/V2XPushVREventScenario.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/pushVR/V2XPushVREventScenario.java
@@ -1,14 +1,17 @@
package com.mogo.module.v2x.scenario.scene.pushVR;
import android.view.View;
+import android.view.ViewGroup;
import androidx.annotation.Nullable;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
+import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario;
+import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.service.windowview.IMogoTopViewStatusListener;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
@@ -32,7 +35,7 @@ public class V2XPushVREventScenario
@Override
public void init(@Nullable V2XMessageEntity v2XMessageEntity) {
- Logger.w(V2XConst.MODULE_NAME + "_" + TAG, "处理推送VR场景:" + GsonUtil.jsonFromObject(v2XMessageEntity));
+ Logger.w(V2XConst.MODULE_NAME + "_" + TAG, "处理推送VR:" + GsonUtil.jsonFromObject(v2XMessageEntity));
if (!isSameScenario(v2XMessageEntity)
&& V2XServiceManager.getMoGoStatusManager().isMainPageLaunched()) {
@@ -58,7 +61,15 @@ public class V2XPushVREventScenario
@Override
public void showWindow() {
if (getV2XWindow() != null) {
+ ViewGroup.LayoutParams layoutParams =
+ new ViewGroup.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ (int) V2XUtils.getApp().getResources().getDimension(R.dimen.module_v2x_event_window_height_ground));
+ V2XServiceManager
+ .getMogoTopViewManager()
+ .addView(getV2XWindow().getView(), layoutParams, this);
getV2XWindow().show(getV2XMessageEntity().getContent());
+ V2XServiceManager.getMoGoV2XStatusManager().setPushWindowShow(TAG, true);
}
}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/pushVR/V2XPushVREventWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/pushVR/V2XPushVREventWindow.java
index 3efb61a229..d41e60a714 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/pushVR/V2XPushVREventWindow.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/pushVR/V2XPushVREventWindow.java
@@ -1,14 +1,17 @@
package com.mogo.module.v2x.scenario.scene.pushVR;
+import android.content.Context;
import android.os.Handler;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
import android.view.View;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
+import com.mogo.module.v2x.scenario.scene.V2XBasWindow;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
-import com.mogo.service.entrance.IMogoEntranceButtonController;
import com.mogo.utils.logger.Logger;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
@@ -21,7 +24,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* TODO 只有VR演示场景使用
* version: 1.0
*/
-public class V2XPushVREventWindow implements IV2XWindow {
+public class V2XPushVREventWindow extends V2XBasWindow implements IV2XWindow {
private String TAG = "V2XPushVREventWindow";
// 处理道路事件,30秒倒计时
@@ -29,6 +32,26 @@ public class V2XPushVREventWindow implements IV2XWindow {
private Runnable runnableV2XEvent;
private int mExpireTime = 30000;
+ public V2XPushVREventWindow() {
+ this(V2XServiceManager.getContext());
+ }
+
+ public V2XPushVREventWindow(Context context) {
+ this(context, null);
+ }
+
+ public V2XPushVREventWindow(Context context, AttributeSet attrs) {
+ this(V2XServiceManager.getContext(), null, 0);
+ }
+
+ public V2XPushVREventWindow(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ // 填充布局
+ LayoutInflater.from(context).inflate(V2XServiceManager.getMoGoStatusManager().isVrMode() ?
+ R.layout.window_road_event_detail_vr : R.layout.window_road_event_detail, this);
+
+ }
+
/**
* 展示道路事件详情Windows
*/
@@ -36,13 +59,7 @@ public class V2XPushVREventWindow implements IV2XWindow {
public void show(V2XPushMessageEntity entity) {
Logger.d(MODULE_NAME + "_" + TAG, "V2X==VR=推送消息:展示 Window=\n" + entity);
- V2XServiceManager
- .getMogoEntranceButtonController()
- .showLeftNoticeByType(
- IMogoEntranceButtonController.NOTICE_TYPE_CONGESTION_RECOMMENDED,
- R.drawable.module_v2x_left_notice_seek_help,
- entity.getAlarmContent());
- //countDownV2XEvent();
+ countDownV2XEvent();
}
/**
@@ -51,21 +68,22 @@ public class V2XPushVREventWindow implements IV2XWindow {
@Override
public void close() {
Logger.d(MODULE_NAME + "_" + TAG, "V2X==VR=关闭Window");
- V2XServiceManager
- .getMogoEntranceButtonController()
- .hideLeftNoticeByType(IMogoEntranceButtonController.NOTICE_TYPE_CONGESTION_RECOMMENDED);
-
// 停止倒计时
if (handlerV2XEvent != null && runnableV2XEvent != null) {
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
runnableV2XEvent = null;
}
+ //移除窗体
+ V2XServiceManager
+ .getMogoTopViewManager()
+ .removeView(this);
+
}
@Override
public View getView() {
- return null;
+ return this;
}
@Override
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/test/V2XTestConsoleWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/test/V2XTestConsoleWindow.java
index 919831af2b..bae631d719 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/test/V2XTestConsoleWindow.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/test/V2XTestConsoleWindow.java
@@ -7,7 +7,9 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
+import android.widget.CompoundButton;
import android.widget.LinearLayout;
+import android.widget.ToggleButton;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
@@ -17,6 +19,7 @@ import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.common.entity.V2XRoadEventEntity;
+import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
@@ -62,7 +65,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
private Button mBtnTriggerEventUgc;
private Button mBtnTriggerTrafficSearch;
private Button mBtnTriggerRecommendRouteEvent;
- private Button nBtnTriggerVR;
+ private ToggleButton nBtnTriggerVR;
private Button btnTriggerRearVIPCarTip,
btnTriggerVehicleBrakes,
@@ -140,10 +143,11 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
break;
}
- nBtnTriggerVR.setOnClickListener(new OnClickListener() {
+ nBtnTriggerVR.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+
@Override
- public void onClick(View v) {
- V2XServiceManager.getMoGoStatusManager().setVrMode("nBtnTriggerVR", true);
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ V2XServiceManager.getMoGoStatusManager().setVrMode("nBtnTriggerVR", isChecked);
}
});
@@ -217,7 +221,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
//车路云—场景预警-V1.0 碰撞预警
mBtnTriggerWarningEvent.setOnClickListener(v->{
- V2XMessageEntity v2XMessageEntity =
+ V2XMessageEntity v2XMessageEntity =
TestOnLineCarUtils.getV2XScenarioPushFrontWarningEventData();
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XFrontWarningScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XFrontWarningScenario.java
index a24044b98c..cbbbee5473 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XFrontWarningScenario.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XFrontWarningScenario.java
@@ -14,6 +14,7 @@ import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPoiTypeEnum;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.common.entity.V2XRoadEventEntity;
+import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.MogoServices;
import com.mogo.module.service.receiver.MogoReceiver;
@@ -38,10 +39,8 @@ import java.util.List;
* @since: 2021/3/24
*/
public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopViewStatusListener {
- private int type;
- private IV2XListener mIV2XListener;
- private List mMarkerEntity;
- private V2XPushMessageEntity mV2XPushMessageEntity;
+ private int direction;
+ private V2XWarningEntity mMarkerEntity;
public V2XFrontWarningScenario() {
setV2XWindow(new V2XWarningWindow());
@@ -49,19 +48,16 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV
@Override
public void init(@Nullable V2XMessageEntity v2XMessageEntity) {
- type = v2XMessageEntity.getType();
- MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithType(type, MogoReceiver.ACTION_V2X_FRONT_WARNING);
try {
- if (V2XServiceManager.getMoGoStatusManager().isMainPageOnResume()) {
- if (getV2XMessageEntity() != null &&
- !V2XServiceManager.getMoGoV2XStatusManager().isOtherSeekHelpWindowShow()) {
- show();
- }
+ if (v2XMessageEntity != null && V2XServiceManager.getMoGoStatusManager().isMainPageOnResume()) {
+ mMarkerEntity = (V2XWarningEntity) v2XMessageEntity.getContent();
+ direction = mMarkerEntity.getDirection();
+ MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(direction, MogoReceiver.ACTION_V2X_FRONT_WARNING);
+ show();
}
} catch (Exception e) {
e.printStackTrace();
}
- show();
}
@Override
@@ -71,7 +67,7 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV
@Override
public void showWindow() {
-// if (getV2XWindow() != null && mMarkerEntity != null) {
+ if (getV2XWindow() != null && mMarkerEntity != null) {
View view = getV2XWindow().getView();
//Logger.d(MODULE_NAME, "添加window= " + view);
ViewGroup.LayoutParams layoutParams =
@@ -81,8 +77,8 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV
V2XServiceManager
.getMogoTopViewManager()
.addView(getV2XWindow().getView(), layoutParams, this);
- getV2XWindow().show(mV2XPushMessageEntity);
-// }
+ getV2XWindow().show(mMarkerEntity);
+ }
}
@Override
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java
index 726d245649..4b609c7777 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java
@@ -8,11 +8,15 @@ import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
+import com.mogo.commons.voice.AIAssist;
+import com.mogo.commons.voice.VoicePreemptType;
+import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.scenario.scene.V2XBasWindow;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
+import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.utils.logger.Logger;
/**
@@ -25,6 +29,7 @@ public class V2XWarningWindow extends V2XBasWindow implements IV2XWindow {
private ImageView typeImage;
private TextView warningTextView;
private TextView distance;
+ private V2XWarningEntity mV2XWarningEntity;
//倒计时3s弹框取消
private static Handler handlerV2XEvent = new Handler();
@@ -56,7 +61,22 @@ public class V2XWarningWindow extends V2XBasWindow implements IV2XWindow {
@Override
public void show(Object entity) {
if (entity != null) {
-
+ mV2XWarningEntity = (V2XWarningEntity) entity;
+ //行人0/自行车1/摩托车2/小汽车3/公交车4
+ switch (mV2XWarningEntity.getType()) {
+ case 0:
+ typeImage.setImageResource(R.drawable.v2x_road_front_p_warning);
+ break;
+ case 1:
+ case 2:
+ typeImage.setImageResource(R.drawable.v2x_road_front_p_warning);
+ break;
+ default:
+ break;
+ }
+ distance.setText(String.valueOf(mV2XWarningEntity.getDistance()) + "米");
+ warningTextView.setText(mV2XWarningEntity.getTipContent());
+ AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice(mV2XWarningEntity.getTts());
}
if (runnableV2XEvent == null) {
runnableV2XEvent = () -> {
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/TestOnLineCarUtils.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/TestOnLineCarUtils.java
index bd0e95de1e..a7b29cdd1f 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/TestOnLineCarUtils.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/TestOnLineCarUtils.java
@@ -5,6 +5,7 @@ import com.mogo.module.common.entity.MarkerResponse;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.common.entity.V2XRoadEventEntity;
+import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.entity.net.V2XSpecialCarRes;
import com.mogo.utils.network.utils.GsonUtil;
@@ -156,7 +157,7 @@ public class TestOnLineCarUtils {
return null;
}
- public static V2XMessageEntity getV2XScenarioPushFrontWarningEventData() {
+ public static V2XMessageEntity getV2XScenarioPushFrontWarningEventData() {
try {
InputStream inputStream = V2XUtils.getApp()
.getResources()
@@ -170,13 +171,13 @@ public class TestOnLineCarUtils {
inputStream.close();
// 加载数据源
- V2XPushMessageEntity v2xRoadEventEntity = GsonUtil.objectFromJson(baos.toString(), V2XPushMessageEntity.class);
+ V2XWarningEntity warningEntity = GsonUtil.objectFromJson(baos.toString(), V2XWarningEntity.class);
- V2XMessageEntity v2xMessageEntity = new V2XMessageEntity<>();
+ V2XMessageEntity v2xMessageEntity = new V2XMessageEntity<>();
// 控制类型
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_TOP);
// 设置数据
- v2xMessageEntity.setContent(v2xRoadEventEntity);
+ v2xMessageEntity.setContent(warningEntity);
// 控制展示状态
v2xMessageEntity.setShowState(true);
return v2xMessageEntity;
@@ -427,7 +428,7 @@ public class TestOnLineCarUtils {
try {
InputStream inputStream = V2XUtils.getApp()
.getResources()
- .openRawResource(R.raw.scenario_push_vr_event_data_yongdu);
+ .openRawResource(R.raw.scenario_push_vr_event_data_yongdu_gongsi);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int len = -1;
byte[] buffer = new byte[1024];
diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_road_front_m_warning.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_road_front_m_warning.png
new file mode 100644
index 0000000000..26ca1bb28f
Binary files /dev/null and b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_road_front_m_warning.png differ
diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_road_front_p_warning.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_road_front_p_warning.png
new file mode 100644
index 0000000000..20faebbdb1
Binary files /dev/null and b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_road_front_p_warning.png differ
diff --git a/modules/mogo-module-v2x/src/main/res/layout/v2x_road_front_warning_vr.xml b/modules/mogo-module-v2x/src/main/res/layout/v2x_road_front_warning_vr.xml
index 47b06a1102..1bce72aaed 100644
--- a/modules/mogo-module-v2x/src/main/res/layout/v2x_road_front_warning_vr.xml
+++ b/modules/mogo-module-v2x/src/main/res/layout/v2x_road_front_warning_vr.xml
@@ -36,7 +36,7 @@
android:layout_marginRight="@dimen/dp_20"
android:layout_toRightOf="@+id/warning_type_image"
android:text="前车碰撞预警"
- android:textColor="@color/v2x_FFF_333"
+ android:textColor="#FFFFFF"
android:textSize="@dimen/dp_32" />
\ No newline at end of file
diff --git a/modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml b/modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml
index 2e1d5e64cb..e19d12dce3 100644
--- a/modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml
+++ b/modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml
@@ -20,6 +20,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
+ android:layout_marginBottom="@dimen/dp_10"
android:orientation="horizontal"
app:alignContent="flex_start"
app:alignItems="center"
@@ -30,9 +31,8 @@
-
diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_yongdu.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_yongdu.json
index 58209f8d88..457560116b 100644
--- a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_yongdu.json
+++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_yongdu.json
@@ -575,171 +575,5 @@
116.72509,
40.195228
]
- ],
- "moveTrack": [
- [
- 116.731239,
- 40.196264
- ],
- [
- 116.731082,
- 40.19622
- ],
- [
- 116.730919,
- 40.196173
- ],
- [
- 116.730762,
- 40.196125
- ],
- [
- 116.730596,
- 40.196069
- ],
- [
- 116.730437,
- 40.196013
- ],
- [
- 116.730296,
- 40.195959
- ],
- [
- 116.730122,
- 40.19589
- ],
- [
- 116.729956,
- 40.195823
- ],
- [
- 116.729841,
- 40.195777
- ],
- [
- 116.729797,
- 40.195759
- ],
- [
- 116.729696,
- 40.195721
- ],
- [
- 116.729624,
- 40.195695
- ],
- [
- 116.729498,
- 40.195649
- ],
- [
- 116.729464,
- 40.195637
- ],
- [
- 116.729366,
- 40.195604
- ],
- [
- 116.729294,
- 40.195583
- ],
- [
- 116.729122,
- 40.195533
- ],
- [
- 116.728954,
- 40.195489
- ],
- [
- 116.728781,
- 40.195448
- ],
- [
- 116.728616,
- 40.195412
- ],
- [
- 116.728442,
- 40.195376
- ],
- [
- 116.728269,
- 40.195341
- ],
- [
- 116.728087,
- 40.195311
- ],
- [
- 116.727909,
- 40.195283
- ],
- [
- 116.727746,
- 40.195263
- ],
- [
- 116.727561,
- 40.195242
- ],
- [
- 116.727386,
- 40.195226
- ],
- [
- 116.727213,
- 40.195217
- ],
- [
- 116.727036,
- 40.19521
- ],
- [
- 116.726865,
- 40.195206
- ],
- [
- 116.72669,
- 40.195206
- ],
- [
- 116.726512,
- 40.195207
- ],
- [
- 116.726333,
- 40.195209
- ],
- [
- 116.726144,
- 40.195211
- ],
- [
- 116.725959,
- 40.195214
- ],
- [
- 116.725771,
- 40.195217
- ],
- [
- 116.725588,
- 40.195221
- ],
- [
- 116.725411,
- 40.195225
- ],
- [
- 116.725201,
- 40.195228
- ],
- [
- 116.72509,
- 40.195228
- ]
]
}
\ No newline at end of file
diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_yongdu_gongsi.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_yongdu_gongsi.json
new file mode 100644
index 0000000000..b466e96184
--- /dev/null
+++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_yongdu_gongsi.json
@@ -0,0 +1,95 @@
+{
+ "sceneId": "200008",
+ "alarmContent": "拥堵路线推荐",
+ "expireTime": 20000,
+ "sceneCategory": 0,
+ "sceneDescription": "拥堵路线推荐",
+ "sceneName": "拥堵路线推荐",
+ "sceneLevel": 0,
+ "videoUrl": "",
+ "videoChannel": "",
+ "videoSn": "",
+ "tts": "发现前方拥堵,最优路线快6分钟",
+ "zoom": false,
+ "zoomScale": 15,
+ "userHead": "",
+ "msgImgUrl": "",
+ "lat":39.969088,
+ "lon":116.41808,
+ "polyline": [
+ [
+ 116.408012,39.968598
+ ],
+ [
+ 116.408784,39.968688
+ ],
+ [
+ 116.409632,39.968688
+ ],
+ [
+ 116.410168,39.968688
+ ],
+ [
+ 116.410898,39.968795
+ ],
+ [
+ 116.412143,39.968812
+ ],
+ [
+ 116.414481,39.968919
+ ],
+ [
+ 116.41681,39.969025
+ ],
+ [
+ 116.417947,39.96905
+ ],
+ [
+ 116.418011,39.968179
+ ],
+ [
+ 116.418033,39.967644
+ ],
+ [
+ 116.417947,39.967225
+ ]
+ ],
+ "recommendPolyline": [
+ [
+ 116.408012,39.968598
+ ],
+ [
+ 116.408784,39.968688
+ ],
+ [
+ 116.409632,39.968688
+ ],
+ [
+ 116.410168,39.968688
+ ],
+ [
+ 116.410898,39.968795
+ ],
+ [
+ 116.412143,39.968812
+ ],
+ [
+ 116.414481,39.968919
+ ],
+ [
+ 116.41681,39.969025
+ ],
+ [
+ 116.417947,39.96905
+ ],
+ [
+ 116.418011,39.968179
+ ],
+ [
+ 116.418033,39.967644
+ ],
+ [
+ 116.417947,39.967225
+ ]
+ ]
+}
\ No newline at end of file
diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json
index 3296219142..aa48b7241f 100644
--- a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json
+++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json
@@ -1,12 +1,14 @@
{
- "systemTime":1615529739389,
- "satelliteTime":1615529739389,
- "lon":116.411360351446,
+ "type":0,
+ "targetType": "1",
"lat":39.9760799115428,
- "alt":34.4648361206054,
- "heading":359.939618623258,
- "speed":11.108121,
- "type":3,
- "uuid":"2_1",
- "direction": "0"
+ "lon":116.411360351446,
+ "distance": 2.22,
+ "collisionLat": 39.9760799115429,
+ "collisionLon": 116.411360351446,
+ "from": 1,
+ "angle": 120,
+ "direction": 10014,
+ "speed":11.108121
+
}
\ No newline at end of file
diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/v2x/IV2XListener.java b/services/mogo-service-api/src/main/java/com/mogo/service/v2x/IV2XListener.java
index 4931132089..440dbca18d 100644
--- a/services/mogo-service-api/src/main/java/com/mogo/service/v2x/IV2XListener.java
+++ b/services/mogo-service-api/src/main/java/com/mogo/service/v2x/IV2XListener.java
@@ -6,5 +6,5 @@ package com.mogo.service.v2x;
* @since: 2021/3/24
*/
public interface IV2XListener {
- void warningChangedWithType(int type);
+ void warningChangedWithDirection(int direction);
}
diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/v2x/IV2XProvider.java b/services/mogo-service-api/src/main/java/com/mogo/service/v2x/IV2XProvider.java
index cded9418b3..96a94ac5e8 100644
--- a/services/mogo-service-api/src/main/java/com/mogo/service/v2x/IV2XProvider.java
+++ b/services/mogo-service-api/src/main/java/com/mogo/service/v2x/IV2XProvider.java
@@ -14,5 +14,5 @@ public interface IV2XProvider extends IProvider {
public void unregisterIntentListener(String intent, IV2XListener listener);
- public void warningChangedForListenerWithType(int type, String command);
+ public void warningChangedForListenerWithDirection(int direction, String command);
}
diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/v2x/V2XManager.java b/services/mogo-service/src/main/java/com/mogo/service/impl/v2x/V2XManager.java
index e1cb2627d5..d27ca128e8 100644
--- a/services/mogo-service/src/main/java/com/mogo/service/impl/v2x/V2XManager.java
+++ b/services/mogo-service/src/main/java/com/mogo/service/impl/v2x/V2XManager.java
@@ -47,14 +47,14 @@ public class V2XManager implements IV2XProvider {
}
@Override
- public void warningChangedForListenerWithType(int type, String command) {
+ public void warningChangedForListenerWithDirection(int direction, String command) {
List listeners = mListeners.get(command);
if (listeners != null && !listeners.isEmpty()) {
Iterator iterator = listeners.iterator();
while (iterator.hasNext()) {
IV2XListener listener = iterator.next();
if (listener != null) {
- listener.warningChangedWithType(type);
+ listener.warningChangedWithDirection(direction);
}
}
}