Merge remote-tracking branch 'origin/dev2_aiSdk' into dev2_aiSdk
This commit is contained in:
@@ -37,6 +37,12 @@ public class MoGoV2XServicePaths {
|
||||
@Keep
|
||||
public static final String PATH_V2X_WARN_POLYLINE_MANAGER = "/v2xWarnPolylineManager/api";
|
||||
|
||||
/**
|
||||
* V2X 云端数据处理
|
||||
*/
|
||||
@Keep
|
||||
public static final String PATH_V2X_WARN_CLOUND_DATA_MANAGER = "/v2xWarnCloundDataManager/api";
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -140,4 +140,9 @@ public class V2XConst {
|
||||
*/
|
||||
public static final String V2X_OPTIMAL_SPEED_MARKER = "V2X_OPTIMAL_SPEED_MARKER";
|
||||
|
||||
/*
|
||||
*V2X 车路云前方预警
|
||||
* */
|
||||
public static final String V2X_FRONT_WARNING_MARKER = "V2X_FRONT_WARNING_MARKER";
|
||||
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import com.mogo.module.common.utils.Const;
|
||||
import com.mogo.module.v2x.entity.net.V2XSeekHelpRes;
|
||||
import com.mogo.module.v2x.entity.net.V2XStrategyPushRes;
|
||||
import com.mogo.module.v2x.network.V2XRefreshCallback;
|
||||
import com.mogo.module.v2x.receiver.AdasDataBroadcastReceiver;
|
||||
import com.mogo.module.v2x.receiver.SceneBroadcastReceiver;
|
||||
import com.mogo.module.v2x.scenario.impl.V2XScenarioManager;
|
||||
import com.mogo.module.v2x.scenario.scene.livecar.V2XVoiceCallLiveBiz;
|
||||
@@ -302,6 +303,9 @@ public class V2XModuleProvider implements
|
||||
V2XServiceManager.getV2XMarkerService().startAutoRefresh();
|
||||
// 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随
|
||||
V2XServiceManager.getMapUIController().recoverLockMode();
|
||||
Log.d("liyz", "V2XModuleProvider ------> ");
|
||||
//注册adas数据通道
|
||||
V2XWaringManager.getInstance().registerAdasSocketMessage(mContext);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.module.v2x;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
@@ -15,10 +16,12 @@ 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.IMoGoV2XCloundDataManager;
|
||||
import com.mogo.module.v2x.manager.IMoGoV2XMarkerManager;
|
||||
import com.mogo.module.v2x.manager.IMoGoV2XPolylineManager;
|
||||
import com.mogo.module.v2x.manager.IMoGoV2XStatusManager;
|
||||
import com.mogo.module.v2x.manager.IMoGoWarnPolylineManager;
|
||||
import com.mogo.module.v2x.manager.impl.MoGoV2XCloundDataManager;
|
||||
import com.mogo.module.v2x.network.V2XRefreshModel;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
@@ -109,9 +112,7 @@ public class V2XServiceManager {
|
||||
private static IMoGoV2XPolylineManager moGoV2XPolylineManager;
|
||||
private static IMoGoV2XStatusManager moGoV2XStatusManager;
|
||||
private static IMoGoWarnPolylineManager moGoWarnPolylineManager;
|
||||
|
||||
List<ADASRecognizedResult> resultList = new ArrayList<>();
|
||||
|
||||
private static IMoGoV2XCloundDataManager moGoV2XCloundDataManager;
|
||||
|
||||
private V2XServiceManager() {
|
||||
|
||||
@@ -165,36 +166,9 @@ public class V2XServiceManager {
|
||||
moGoV2XMarkerManager = (IMoGoV2XMarkerManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_MARKER_MANAGER).navigation(context);
|
||||
moGoV2XPolylineManager = (IMoGoV2XPolylineManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_POLYLINE_MANAGER).navigation(context);
|
||||
moGoWarnPolylineManager = (IMoGoWarnPolylineManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_WARN_POLYLINE_MANAGER).navigation(context);
|
||||
moGoV2XCloundDataManager = (IMoGoV2XCloundDataManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_WARN_CLOUND_DATA_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
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,4 +323,20 @@ public class V2XServiceManager {
|
||||
public static IEventPanelProvider getEventPanelProvider() {
|
||||
return mIEventPanelProvider;
|
||||
}
|
||||
|
||||
public static IMogoADASController getmIMogoADASController() {
|
||||
return mIMogoADASController;
|
||||
}
|
||||
|
||||
public static void setmIMogoADASController(IMogoADASController mIMogoADASController) {
|
||||
V2XServiceManager.mIMogoADASController = mIMogoADASController;
|
||||
}
|
||||
|
||||
public static IMoGoV2XCloundDataManager getMoGoV2XCloundDataManager() {
|
||||
return moGoV2XCloundDataManager;
|
||||
}
|
||||
|
||||
public static void setMoGoV2XCloundDataManager(IMoGoV2XCloundDataManager moGoV2XCloundDataManager) {
|
||||
V2XServiceManager.moGoV2XCloundDataManager = moGoV2XCloundDataManager;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
package com.mogo.module.v2x;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.drawer.AdasRecognizedResultDrawer;
|
||||
import com.mogo.module.v2x.entity.model.DrawLineInfo;
|
||||
import com.mogo.module.v2x.listener.V2XMessageListener_401011;
|
||||
import com.mogo.module.v2x.listener.V2XWarnMessageListener;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.mogo.module.v2x.V2XServiceManager.getContext;
|
||||
|
||||
/**
|
||||
* desc : V2X报警事件管理,这里进行报警事件的分发处理,包括了adas数据
|
||||
*/
|
||||
public class V2XWaringManager {
|
||||
|
||||
List<MogoLatLng> lonLats = new ArrayList<>();
|
||||
List<ADASRecognizedResult> resultList = new ArrayList<>();
|
||||
private Context mContext;
|
||||
|
||||
private static V2XWaringManager mV2XWaringManager;
|
||||
//TODO 需要修改
|
||||
private V2XWarnMessageListener v2XWarnMessageListener;
|
||||
|
||||
|
||||
private V2XWaringManager() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取操作实体
|
||||
*/
|
||||
public static synchronized V2XWaringManager getInstance() {
|
||||
synchronized (V2XWaringManager.class) {
|
||||
if (mV2XWaringManager == null) {
|
||||
mV2XWaringManager = new V2XWaringManager();
|
||||
}
|
||||
}
|
||||
return mV2XWaringManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册长链接消息处理
|
||||
*/
|
||||
public void registerAdasSocketMessage(Context context) {
|
||||
Logger.d("liyz", "开始注册Socket通道....");
|
||||
mContext = context;
|
||||
|
||||
//根据云端,绘制自车和交点,以及行人或二轮车与交点的绘制
|
||||
registerWarnListener();
|
||||
|
||||
handleAdasData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 反注册消息通道,不再进行接受
|
||||
*/
|
||||
public void unregisterAdasSocketMessage() {
|
||||
Logger.w("liyz", "反注册Socket通道....");
|
||||
if (v2XWarnMessageListener != null) {
|
||||
V2XServiceManager
|
||||
.getMoGoSocketManager()
|
||||
.unregisterOnMessageListener(401011, v2XWarnMessageListener);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 道路事件,行人 TODO type
|
||||
*/
|
||||
private void registerWarnListener() {
|
||||
v2XWarnMessageListener = new V2XWarnMessageListener();
|
||||
// 道路事件,在线车辆绘制
|
||||
V2XServiceManager
|
||||
.getMoGoSocketManager()
|
||||
.registerOnMessageListener(
|
||||
401011,
|
||||
v2XWarnMessageListener );
|
||||
}
|
||||
|
||||
public V2XWarnMessageListener getV2XMessageListener() {
|
||||
return v2XWarnMessageListener;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理adas返回的数据
|
||||
*/
|
||||
private void handleAdasData() {
|
||||
Log.d("liyz", "V2XWaringManager ---- handleAdasData ---0-- ");
|
||||
//清理
|
||||
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
|
||||
|
||||
// 绘制连接线 TODO 来的是列表数据
|
||||
DrawLineInfo info1 = new DrawLineInfo();
|
||||
MogoLatLng startLatlng1 = new MogoLatLng(39.968919,116.407642);
|
||||
MogoLatLng endLatlng1 = new MogoLatLng(40.010906,116.423821);
|
||||
info1.setStartLocation(startLatlng1);
|
||||
info1.setEndLocation(endLatlng1);
|
||||
V2XServiceManager.getMoGoWarnPolylineManager().drawableWarnPolyline(getContext(), info1);
|
||||
|
||||
// adas 每隔一秒传递的他车或行人数据
|
||||
V2XServiceManager.getmIMogoADASController().addAdasRecognizedDataCallback(resultList -> {
|
||||
// 绘制近景识别到的车辆,行人和二轮车 TODO
|
||||
AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult( resultList );
|
||||
Log.d("liyz", "V2XWaringManager ---- handleAdasData ----- ");
|
||||
|
||||
//清理
|
||||
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
|
||||
|
||||
// 绘制连接线 TODO 来的是列表数据
|
||||
DrawLineInfo info = new DrawLineInfo();
|
||||
MogoLatLng startLatlng = new MogoLatLng(39.969247,116.407299);
|
||||
MogoLatLng endLatlng = new MogoLatLng(39.971089,116.407384);
|
||||
info.setStartLocation(startLatlng);
|
||||
info.setEndLocation(endLatlng);
|
||||
V2XServiceManager.getMoGoWarnPolylineManager().drawableWarnPolyline(mContext, info);
|
||||
|
||||
//更新数据
|
||||
for (ADASRecognizedResult result : resultList) {
|
||||
MogoLatLng latLng = new MogoLatLng(result.lat, result.lon);
|
||||
lonLats.add(latLng);
|
||||
}
|
||||
IMogoPolyline mMogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline();
|
||||
mMogoPolyline.setPoints(lonLats);
|
||||
|
||||
} );
|
||||
|
||||
double lon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon();
|
||||
double lat = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat();
|
||||
Log.d("liyz", "lon = " + lon + "----lat = " + lat);
|
||||
|
||||
//绘制自车数据 liyz
|
||||
// DrawLineInfo info = new DrawLineInfo();
|
||||
// MogoLatLng startLatlng = new MogoLatLng(lat,lon); //我的位置
|
||||
// MogoLatLng endLatlng = new MogoLatLng(39.971089,); //交点位置
|
||||
// info.setStartLocation(startLatlng);
|
||||
// info.setEndLocation(endLatlng);
|
||||
// V2XServiceManager.getMoGoWarnPolylineManager().drawableWarnPolyline(mContext, info);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.mogo.module.v2x.entity.model;
|
||||
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 云端警告下发数据(二轮车和弱势群体)
|
||||
* @since 2021/3/30
|
||||
*/
|
||||
public class CloundWarningInfo {
|
||||
|
||||
/**
|
||||
* 识别物体类型
|
||||
*/
|
||||
public int type;
|
||||
|
||||
/**
|
||||
* 提示信息
|
||||
*/
|
||||
public String warningContent;
|
||||
|
||||
/**
|
||||
* 道路唯一标识
|
||||
*/
|
||||
public String roadId;
|
||||
|
||||
/**
|
||||
* 车道唯一标识
|
||||
*/
|
||||
public String laneId;
|
||||
|
||||
/**
|
||||
* 识别物体唯一标识
|
||||
*/
|
||||
public String uuid;
|
||||
|
||||
/**
|
||||
* 红绿灯颜色
|
||||
*/
|
||||
public String color;
|
||||
|
||||
/**
|
||||
* 车ID 暂不使用
|
||||
*/
|
||||
public String carId;
|
||||
|
||||
/**
|
||||
* 识别物体的纬度
|
||||
*/
|
||||
public double lat;
|
||||
|
||||
/**
|
||||
* 识别物体的经度
|
||||
*/
|
||||
public double lon;
|
||||
|
||||
/**
|
||||
* 识别物经纬度
|
||||
* */
|
||||
private MogoLatLng startLocation;
|
||||
|
||||
/**
|
||||
* 行人经纬度交点
|
||||
*/
|
||||
private MogoLatLng endLocation;
|
||||
|
||||
/**
|
||||
* 停止线的纬度
|
||||
*/
|
||||
public double stopLinelat;
|
||||
|
||||
/**
|
||||
* 停止线的经度
|
||||
*/
|
||||
public double stopLinelon;
|
||||
|
||||
/**
|
||||
* 车头朝向
|
||||
*/
|
||||
public double heading;
|
||||
|
||||
/**
|
||||
* 系统时间 暂时没用
|
||||
*/
|
||||
public long systemTime;
|
||||
|
||||
/**
|
||||
* 定位卫星时间 暂时没用
|
||||
*/
|
||||
public long satelliteTime;
|
||||
|
||||
/**
|
||||
* 速度 暂时没用
|
||||
*/
|
||||
public double speed;
|
||||
|
||||
/**
|
||||
* 莫顿码 暂时没用
|
||||
*/
|
||||
public long mortonCode;
|
||||
|
||||
/**
|
||||
* 停车线距离
|
||||
*/
|
||||
public double distance;
|
||||
|
||||
}
|
||||
@@ -18,6 +18,8 @@ public class DrawLineInfo {
|
||||
//结束点位置
|
||||
private MogoLatLng endLocation;
|
||||
|
||||
private double heading;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
@@ -41,4 +43,12 @@ public class DrawLineInfo {
|
||||
public void setEndLocation(MogoLatLng endLocation) {
|
||||
this.endLocation = endLocation;
|
||||
}
|
||||
|
||||
public double getHeading() {
|
||||
return heading;
|
||||
}
|
||||
|
||||
public void setHeading(double heading) {
|
||||
this.heading = heading;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.mogo.module.v2x.listener;
|
||||
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.entity.model.CloundWarningInfo;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
|
||||
/**
|
||||
* desc: 下发的云端预警数据
|
||||
*/
|
||||
public class V2XWarnMessageListener implements IMogoOnMessageListener<CloundWarningInfo> {
|
||||
|
||||
@Override
|
||||
public Class<CloundWarningInfo> target() {
|
||||
return CloundWarningInfo.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(CloundWarningInfo info) {
|
||||
//Logger.d(MODULE_NAME, "V2XMessageListener_401011==V2X地图气泡数据刷新:\n" + GsonUtil.jsonFromObject(response));
|
||||
V2XUtils.runOnBackgroundThread(() -> {
|
||||
// 解析不同的Marker类型,然后对应的进行绘制
|
||||
if (info != null) {
|
||||
// 解析存储道路事件 liyz
|
||||
V2XServiceManager.getMoGoV2XCloundDataManager().analysisV2XCloundDataEvent(info);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.mogo.module.v2x.manager;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.module.v2x.entity.model.CloundWarningInfo;
|
||||
|
||||
/**
|
||||
* desc: V2X 处理云端预警消息
|
||||
*/
|
||||
public interface IMoGoV2XCloundDataManager extends IProvider {
|
||||
|
||||
/**
|
||||
* 处理下发数据
|
||||
*/
|
||||
void analysisV2XCloundDataEvent(CloundWarningInfo cloundWarningInfo);
|
||||
|
||||
/**
|
||||
* 清除 所有的 POI
|
||||
*/
|
||||
void clearALLPOI();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.mogo.module.v2x.manager.impl;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.module.v2x.MoGoV2XServicePaths;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.entity.model.CloundWarningInfo;
|
||||
import com.mogo.module.v2x.entity.model.DrawLineInfo;
|
||||
import com.mogo.module.v2x.manager.IMoGoV2XCloundDataManager;
|
||||
|
||||
import static com.mogo.module.v2x.V2XServiceManager.getContext;
|
||||
|
||||
/**
|
||||
* desc : V2X 服务端下发数据处理 点的绘制
|
||||
*/
|
||||
@Route(path = MoGoV2XServicePaths.PATH_V2X_WARN_CLOUND_DATA_MANAGER)
|
||||
public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager {
|
||||
private static final String TAG = "MoGoV2XCloundDataManager";
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void analysisV2XCloundDataEvent(CloundWarningInfo cloundWarningInfo) {
|
||||
//TODO
|
||||
//清理
|
||||
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
|
||||
|
||||
//绘制连接线自车与交汇点连线
|
||||
DrawLineInfo info1 = new DrawLineInfo();
|
||||
MogoLatLng startLatlng1 = new MogoLatLng(39.968919,116.407642);
|
||||
MogoLatLng endLatlng1 = new MogoLatLng(40.010906,116.423821);
|
||||
info1.setStartLocation(startLatlng1);
|
||||
info1.setEndLocation(endLatlng1);
|
||||
V2XServiceManager.getMoGoWarnPolylineManager().drawableWarnPolyline(getContext(), info1);
|
||||
|
||||
//绘制识别物与交汇点连线 TODO
|
||||
|
||||
|
||||
//更新数据连线数据 他车和自车
|
||||
|
||||
|
||||
//自车的移动
|
||||
|
||||
|
||||
//他车的移动
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearALLPOI() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.module.v2x.manager.impl;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
@@ -22,7 +23,6 @@ import java.util.List;
|
||||
*/
|
||||
@Route(path = MoGoV2XServicePaths.PATH_V2X_WARN_POLYLINE_MANAGER)
|
||||
public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
|
||||
private static final String TAG = "MoGoWarnPolylineManager";
|
||||
private static IMogoPolyline mMogoPolyline;
|
||||
|
||||
|
||||
@@ -48,16 +48,15 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
|
||||
}
|
||||
|
||||
// 线条粗细,渐变,渐变色值
|
||||
options.width(30).useGradient(true).colorValues(colors);
|
||||
|
||||
options.width(60).useGradient(true).colorValues(colors);
|
||||
// 当前车辆位置
|
||||
options.add(info.getStartLocation());
|
||||
|
||||
// 目标车辆位置
|
||||
options.add(info.getStartLocation());
|
||||
options.add(info.getEndLocation());
|
||||
|
||||
// 绘制线的对象
|
||||
mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options);
|
||||
Log.d("liyz", "MoGoWarnPolylineManager drawableWarnPolyline -----> ");
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -3,8 +3,10 @@ package com.mogo.module.v2x.receiver;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XWaringManager;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
@@ -17,10 +19,11 @@ 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);
|
||||
// ADASRecognizedResult adasResult = (ADASRecognizedResult) intent.getSerializableExtra(V2XConst.BROADCAST_ADAS_EXTRA_KEY);
|
||||
// Logger.d("liyz", "AdasDataBroadcastReceiver -->" + GsonUtil.jsonFromObject(adasResult));
|
||||
String adasResult = (String) intent.getSerializableExtra(V2XConst.BROADCAST_ADAS_EXTRA_KEY);
|
||||
Log.d("liyz", "AdasDataBroadcastReceiver -----> ");
|
||||
V2XWaringManager.getInstance().registerAdasSocketMessage(context);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.module.v2x.receiver;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
@@ -24,6 +25,7 @@ public class SceneBroadcastReceiver extends BroadcastReceiver {
|
||||
try {
|
||||
V2XMessageEntity v2XMessageEntity = (V2XMessageEntity) intent.getSerializableExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY);
|
||||
//Logger.d(TAG, "v2XMessageEntity:" + GsonUtil.jsonFromObject(v2XMessageEntity));
|
||||
Log.d("liyz", "SceneBroadcastReceiver ------->");
|
||||
V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -66,6 +66,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
private Button mBtnTriggerTrafficSearch;
|
||||
private Button mBtnTriggerRecommendRouteEvent;
|
||||
private ToggleButton nBtnTriggerVR;
|
||||
private Button mBtnAdasDataWarn;
|
||||
|
||||
private Button btnTriggerRearVIPCarTip,
|
||||
btnTriggerVehicleBrakes,
|
||||
@@ -129,6 +130,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
mBtnTriggerTrafficSearch = findViewById(R.id.btnTriggerTrafficSearch);
|
||||
mBtnTriggerRecommendRouteEvent = findViewById(R.id.btnTriggerRecommendRouteEvent);
|
||||
nBtnTriggerVR = findViewById(R.id.btnTriggerVR);
|
||||
mBtnAdasDataWarn = findViewById(R.id.btnAdasDataWarn);
|
||||
|
||||
switch (showType) {
|
||||
case 0:
|
||||
@@ -301,6 +303,12 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
||||
});
|
||||
|
||||
mBtnAdasDataWarn.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(V2XConst.BROADCAST_ADAS_SCENE_HANDLER_ACTION);
|
||||
intent.putExtra(V2XConst.BROADCAST_ADAS_EXTRA_KEY, "23");
|
||||
getContext().sendBroadcast(intent);
|
||||
});
|
||||
|
||||
mBtnTriggerTrafficSearch.setOnClickListener(v -> V2XServiceManager.getIMogoTrafficUploadProvider().verifyCurrentTrafficStatus());
|
||||
|
||||
mBtnTriggerRecommendRouteEvent.setOnClickListener(view -> {
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.view.ViewGroup;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XPoiTypeEnum;
|
||||
@@ -44,6 +45,7 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV
|
||||
|
||||
public V2XFrontWarningScenario() {
|
||||
setV2XWindow(new V2XWarningWindow());
|
||||
setV2XMarker(new V2XWarningMarker());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -54,6 +56,7 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV
|
||||
direction = mMarkerEntity.getDirection();
|
||||
MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(direction, MogoReceiver.ACTION_V2X_FRONT_WARNING);
|
||||
show();
|
||||
drawPOI();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -78,6 +81,7 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV
|
||||
.getMogoTopViewManager()
|
||||
.addView(getV2XWindow().getView(), layoutParams, this);
|
||||
getV2XWindow().show(mMarkerEntity);
|
||||
getV2XMarker().drawPOI(mMarkerEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +102,8 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV
|
||||
|
||||
@Override
|
||||
public void drawPOI() {
|
||||
|
||||
getV2XMarker().drawPOI(mMarkerEntity);
|
||||
Log.d(TAG, "drawPOI");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.mogo.module.v2x.scenario.scene.warning;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.drawer.marker.IMarkerView;
|
||||
import com.mogo.module.common.drawer.marker.MapMarkerAdapter;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
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;
|
||||
import com.mogo.module.v2x.scenario.view.IV2XMarker;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 描述
|
||||
* @since: 2021/3/30
|
||||
*/
|
||||
public class V2XWarningMarker implements IV2XMarker {
|
||||
private V2XWarningEntity mMarkerEntity;
|
||||
private Context mContext = V2XServiceManager.getContext();
|
||||
|
||||
@Override
|
||||
public void drawPOI(Object entity) {
|
||||
try {
|
||||
mMarkerEntity = (V2XWarningEntity) entity;
|
||||
MarkerLocation location = new MarkerLocation();
|
||||
location.setLat(mMarkerEntity.getLat());
|
||||
location.setLon(mMarkerEntity.getLon());
|
||||
|
||||
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
|
||||
markerShowEntity.setMarkerLocation(location);
|
||||
markerShowEntity.setMarkerType(V2XConst.V2X_FRONT_WARNING_MARKER);
|
||||
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
V2XServiceManager.getMarkerManager().removeMarkers(V2XConst.V2X_FRONT_WARNING_MARKER);
|
||||
WorkThreadHandler.getInstance().postDelayed(() -> {
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.object(markerShowEntity)
|
||||
.latitude(markerShowEntity.getMarkerLocation().getLat())
|
||||
.longitude(markerShowEntity.getMarkerLocation().getLon());
|
||||
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
|
||||
Bitmap bitmap = BitmapFactory.decodeResource(AbsMogoApplication.getApp().getResources(), R.drawable.v2x_road_front_p_warning);
|
||||
options.icon(bitmap);
|
||||
IMogoMarker marker = V2XServiceManager.getMarkerManager().addMarker(markerShowEntity.getMarkerType(), options);
|
||||
iMarkerView.setMarker(marker);
|
||||
marker.setToTop();
|
||||
}, 1000);
|
||||
} else {
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPOI() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,15 @@
|
||||
package com.mogo.module.v2x.utils;
|
||||
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
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.entity.net.V2XSpecialCarRes;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
@@ -172,7 +175,6 @@ public class TestOnLineCarUtils {
|
||||
|
||||
// 加载数据源
|
||||
V2XWarningEntity warningEntity = GsonUtil.objectFromJson(baos.toString(), V2XWarningEntity.class);
|
||||
|
||||
V2XMessageEntity<V2XWarningEntity> v2xMessageEntity = new V2XMessageEntity<>();
|
||||
// 控制类型
|
||||
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_TOP);
|
||||
|
||||
Reference in New Issue
Block a user