Merge remote-tracking branch 'origin/dev2_aiSdk' into dev2_aiSdk
This commit is contained in:
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@@ -91,6 +91,7 @@
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
<option name="useQualifiedModuleNames" value="true" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -8,7 +8,7 @@
|
||||
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
|
||||
<groovy codeStyle="LEGACY" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="12" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -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:
|
||||
|
||||
@@ -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<MogoLatLng> 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();
|
||||
|
||||
@@ -48,8 +48,6 @@ public class V2XPushMessageEntity implements Serializable {
|
||||
|
||||
private List<double[]> polyline;
|
||||
|
||||
private List<double[]> moveTrack;
|
||||
|
||||
private List<double[]> recommendPolyline;
|
||||
|
||||
public int getViewType() {
|
||||
@@ -283,14 +281,6 @@ public class V2XPushMessageEntity implements Serializable {
|
||||
this.polyline = polyline;
|
||||
}
|
||||
|
||||
public List<double[]> getMoveTrack() {
|
||||
return moveTrack;
|
||||
}
|
||||
|
||||
public void setMoveTrack(List<double[]> moveTrack) {
|
||||
this.moveTrack = moveTrack;
|
||||
}
|
||||
|
||||
public List<double[]> getRecommendPolyline() {
|
||||
return recommendPolyline;
|
||||
}
|
||||
|
||||
@@ -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 + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"}
|
||||
@@ -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"}
|
||||
@@ -24,6 +24,14 @@
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<!--adas数据-->
|
||||
<receiver android:name=".receiver.AdasDataBroadcastReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="com.v2x.adas_data_broadcast" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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<ADASRecognizedResult> 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<MogoLatLng> 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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
/**
|
||||
* 移除连接线
|
||||
|
||||
@@ -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<Integer> 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<Integer> 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<V2XPushMessageEntity> {
|
||||
|
||||
@@ -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<V2XPushMessageEntity> {
|
||||
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<V2XPushMessageEntity> {
|
||||
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<Integer> 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<V2XPushMessageEntity> {
|
||||
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<V2XPushMessageEntity> {
|
||||
MarkerUtils.resetMapZoom(16);
|
||||
// 移除线
|
||||
clearLine();
|
||||
// 移除事件POI
|
||||
clearAlarmPOI();
|
||||
// 绘制上次的数据
|
||||
V2XServiceManager.getMoGoV2XMarkerManager().drawableLastAllPOI();
|
||||
}
|
||||
|
||||
void clearAlarmPOI() {
|
||||
if (mAlarmInfoMarker != null) {
|
||||
mAlarmInfoMarker.remove();
|
||||
}
|
||||
}
|
||||
|
||||
public void clearLine() {
|
||||
if (mMogoPolyline != null) {
|
||||
mMogoPolyline.remove();
|
||||
|
||||
@@ -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<V2XPushMessageEntity> 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<V2XPushMessageEntity> {
|
||||
public class V2XPushVREventWindow extends V2XBasWindow implements IV2XWindow<V2XPushMessageEntity> {
|
||||
private String TAG = "V2XPushVREventWindow";
|
||||
|
||||
// 处理道路事件,30秒倒计时
|
||||
@@ -29,6 +32,26 @@ public class V2XPushVREventWindow implements IV2XWindow<V2XPushMessageEntity> {
|
||||
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<V2XPushMessageEntity> {
|
||||
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<V2XPushMessageEntity> {
|
||||
@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
|
||||
|
||||
@@ -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<V2XPushMessageEntity> v2XMessageEntity =
|
||||
V2XMessageEntity<V2XWarningEntity> v2XMessageEntity =
|
||||
TestOnLineCarUtils.getV2XScenarioPushFrontWarningEventData();
|
||||
|
||||
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
|
||||
|
||||
@@ -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<V2XSpecialCarRes.V2XMarkerEntity> 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
|
||||
|
||||
@@ -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 = () -> {
|
||||
|
||||
@@ -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<V2XPushMessageEntity> getV2XScenarioPushFrontWarningEventData() {
|
||||
public static V2XMessageEntity<V2XWarningEntity> 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<V2XPushMessageEntity> v2xMessageEntity = new V2XMessageEntity<>();
|
||||
V2XMessageEntity<V2XWarningEntity> 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];
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
@@ -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" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -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 @@
|
||||
<Button
|
||||
android:id="@+id/btnTriggerOpen"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="@dimen/dp_50"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:background="#FFF"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="隐藏测试按钮面板"
|
||||
@@ -44,9 +44,8 @@
|
||||
<Button
|
||||
android:id="@+id/btnClearRoadEvent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="@dimen/dp_50"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:background="#6BCF23"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="清除缓存播报"
|
||||
@@ -55,16 +54,16 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<Button
|
||||
<ToggleButton
|
||||
android:id="@+id/btnTriggerVR"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="@dimen/dp_50"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:background="#6BCF23"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="开启VR模式"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textOff="开启VR模式"
|
||||
android:textOn="关闭VR模式"
|
||||
android:textSize="@dimen/dp_22"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
@@ -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
|
||||
]
|
||||
]
|
||||
}
|
||||
@@ -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
|
||||
]
|
||||
]
|
||||
}
|
||||
@@ -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
|
||||
|
||||
}
|
||||
@@ -6,5 +6,5 @@ package com.mogo.service.v2x;
|
||||
* @since: 2021/3/24
|
||||
*/
|
||||
public interface IV2XListener {
|
||||
void warningChangedWithType(int type);
|
||||
void warningChangedWithDirection(int direction);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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<IV2XListener> listeners = mListeners.get(command);
|
||||
if (listeners != null && !listeners.isEmpty()) {
|
||||
Iterator<IV2XListener> iterator = listeners.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
IV2XListener listener = iterator.next();
|
||||
if (listener != null) {
|
||||
listener.warningChangedWithType(type);
|
||||
listener.warningChangedWithDirection(direction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user