[V2X]优化道路施工事件的触发逻辑
This commit is contained in:
@@ -253,6 +253,7 @@ dependencies {
|
|||||||
androidTestImplementation project(':core:mogo-core-function-call')
|
androidTestImplementation project(':core:mogo-core-function-call')
|
||||||
androidTestImplementation project(':core:mogo-core-res')
|
androidTestImplementation project(':core:mogo-core-res')
|
||||||
androidTestImplementation project(':core:function-impl:mogo-core-function-notice')
|
androidTestImplementation project(':core:function-impl:mogo-core-function-notice')
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "./functions/och.gradle"
|
apply from: "./functions/och.gradle"
|
||||||
@@ -263,6 +264,7 @@ dependencies {
|
|||||||
androidTestImplementation rootProject.ext.dependencies.androidx_unit_ext_ktx
|
androidTestImplementation rootProject.ext.dependencies.androidx_unit_ext_ktx
|
||||||
androidTestImplementation rootProject.ext.dependencies.androidx_runner
|
androidTestImplementation rootProject.ext.dependencies.androidx_runner
|
||||||
androidTestImplementation rootProject.ext.dependencies.androidx_espresso_core
|
androidTestImplementation rootProject.ext.dependencies.androidx_espresso_core
|
||||||
|
androidTestImplementation rootProject.ext.dependencies.localbroadcastmanager
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isAndroidTestBuild()) {
|
if (!isAndroidTestBuild()) {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import android.content.IntentFilter
|
|||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import android.provider.Settings.System
|
import android.provider.Settings.System
|
||||||
|
import android.util.*
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||||
import com.mogo.cloud.passport.IMoGoTokenCallback
|
import com.mogo.cloud.passport.IMoGoTokenCallback
|
||||||
import com.mogo.cloud.passport.MoGoAiCloudClient
|
import com.mogo.cloud.passport.MoGoAiCloudClient
|
||||||
@@ -102,6 +103,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
|
|||||||
V2XManager.init(V2XConfig.Builder().also {
|
V2XManager.init(V2XConfig.Builder().also {
|
||||||
it.aiCloudConfig(MoGoAiCloudClientConfig.getInstance())
|
it.aiCloudConfig(MoGoAiCloudClientConfig.getInstance())
|
||||||
it.context(context)
|
it.context(context)
|
||||||
|
it.loggable(true)
|
||||||
it.distanceForTriggerRefresh(200f) //行驶超过200(包含)米,刷新道路周边信息(短链请求)
|
it.distanceForTriggerRefresh(200f) //行驶超过200(包含)米,刷新道路周边信息(短链请求)
|
||||||
it.durationForTriggerRefresh(
|
it.durationForTriggerRefresh(
|
||||||
60,
|
60,
|
||||||
@@ -152,7 +154,6 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
|
|||||||
BridgeApi.registerCenter()?.let {
|
BridgeApi.registerCenter()?.let {
|
||||||
it.unregisterMogoMapListener(MODULE_NAME)
|
it.unregisterMogoMapListener(MODULE_NAME)
|
||||||
it.unregisterMogoMarkerClickListener(ModuleNames.CARD_TYPE_ROAD_CONDITION)
|
it.unregisterMogoMarkerClickListener(ModuleNames.CARD_TYPE_ROAD_CONDITION)
|
||||||
it.unregisterMogoMarkerClickListener(MODULE_NAME)
|
|
||||||
}
|
}
|
||||||
BridgeApi.statusManager()?.let {
|
BridgeApi.statusManager()?.let {
|
||||||
it.unregisterStatusChangedListener(MODULE_NAME, ACC_STATUS, this)
|
it.unregisterStatusChangedListener(MODULE_NAME, ACC_STATUS, this)
|
||||||
@@ -431,7 +432,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
|
|||||||
* V2XEvent事件回调
|
* V2XEvent事件回调
|
||||||
*/
|
*/
|
||||||
override fun onAck(event: V2XEvent) {
|
override fun onAck(event: V2XEvent) {
|
||||||
CallerLogger.d("$M_V2X$TAG", "OK->: $event")
|
Log.d("$M_V2X$TAG", "OK->: $event")
|
||||||
when (event) {
|
when (event) {
|
||||||
is V2XEvent.ForwardsWarning -> {
|
is V2XEvent.ForwardsWarning -> {
|
||||||
handleAdvanceWarningEvent(event)
|
handleAdvanceWarningEvent(event)
|
||||||
@@ -465,6 +466,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
|
|||||||
l3.location = V2XMarkerLocation().also { l4 ->
|
l3.location = V2XMarkerLocation().also { l4 ->
|
||||||
l4.lat = this.roadwork?.center?.point?.lat ?: 0.0
|
l4.lat = this.roadwork?.center?.point?.lat ?: 0.0
|
||||||
l4.lon = this.roadwork?.center?.point?.lon ?: 0.0
|
l4.lon = this.roadwork?.center?.point?.lon ?: 0.0
|
||||||
|
l4.angle = this.roadwork?.center?.road?.bearing?.toDouble() ?: 0.0
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,8 +48,7 @@ public class V2XAlarmServer {
|
|||||||
// 因为集合是按照距离排序后的所以这里检索出来第一个就发出警告
|
// 因为集合是按照距离排序后的所以这里检索出来第一个就发出警告
|
||||||
for (V2XRoadEventEntity v2XRoadEventEntity : v2XRoadEventEntityList) {
|
for (V2XRoadEventEntity v2XRoadEventEntity : v2XRoadEventEntityList) {
|
||||||
// 0、道路事件必须有朝向,角度>=0;
|
// 0、道路事件必须有朝向,角度>=0;
|
||||||
boolean ignoreAngle = EventTypeEnum.AI_ROAD_WORK.getPoiType().equals(v2XRoadEventEntity.getPoiType());
|
if (v2XRoadEventEntity.getLocation().getAngle() >= 0) {
|
||||||
if (v2XRoadEventEntity.getLocation().getAngle() >= 0 || ignoreAngle) {
|
|
||||||
// 计算车辆距离指定气泡的距离
|
// 计算车辆距离指定气泡的距离
|
||||||
MarkerLocation eventLocation = v2XRoadEventEntity.getLocation();
|
MarkerLocation eventLocation = v2XRoadEventEntity.getLocation();
|
||||||
// 1、判断是否到达了触发距离,20 ~ 500,
|
// 1、判断是否到达了触发距离,20 ~ 500,
|
||||||
@@ -64,7 +63,7 @@ public class V2XAlarmServer {
|
|||||||
double carBearing = currentLocation.getBearing();
|
double carBearing = currentLocation.getBearing();
|
||||||
double eventBearing = eventLocation.getAngle();
|
double eventBearing = eventLocation.getAngle();
|
||||||
double diffAngle = DrivingDirectionUtils.getAngleDiff(carBearing, eventBearing);
|
double diffAngle = DrivingDirectionUtils.getAngleDiff(carBearing, eventBearing);
|
||||||
if (ignoreAngle || diffAngle < 20) {
|
if (diffAngle < 20) {
|
||||||
// 3、计算当前车辆行驶方向与事件位置之间夹角《20度,保证道路事件在车辆前方
|
// 3、计算当前车辆行驶方向与事件位置之间夹角《20度,保证道路事件在车辆前方
|
||||||
double eventAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
|
double eventAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
|
||||||
currentLocation.getLongitude(),
|
currentLocation.getLongitude(),
|
||||||
@@ -73,7 +72,7 @@ public class V2XAlarmServer {
|
|||||||
eventLocation.getLat(),
|
eventLocation.getLat(),
|
||||||
(int) currentLocation.getBearing()
|
(int) currentLocation.getBearing()
|
||||||
);
|
);
|
||||||
if (ignoreAngle || 0 <= eventAngle && eventAngle <= 20) {
|
if (0 <= eventAngle && eventAngle <= 20) {
|
||||||
// 判断是否已经提示过道路事件
|
// 判断是否已经提示过道路事件
|
||||||
boolean isAlreadyAlert = false;
|
boolean isAlreadyAlert = false;
|
||||||
String lastTime = mAlertRoadEventList.get(v2XRoadEventEntity);
|
String lastTime = mAlertRoadEventList.get(v2XRoadEventEntity);
|
||||||
|
|||||||
@@ -6,13 +6,13 @@ import com.mogo.eagle.core.data.enums.WarningDirectionEnum;
|
|||||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener;
|
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener;
|
||||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||||
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager;
|
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager;
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
|
||||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
|
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
|
||||||
import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusManager;
|
import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusManager;
|
||||||
import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario;
|
import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario;
|
||||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
|
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
|
||||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||||
@@ -41,7 +41,7 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
|
|||||||
@Override
|
@Override
|
||||||
public void init(V2XMessageEntity<V2XRoadEventEntity> v2XMessageEntity) {
|
public void init(V2XMessageEntity<V2XRoadEventEntity> v2XMessageEntity) {
|
||||||
try {
|
try {
|
||||||
CallerLogger.INSTANCE.d(M_V2X + TAG, "v2XMessageEntity:" + GsonUtil.jsonFromObject(v2XMessageEntity));
|
Logger.d(M_V2X + TAG, "v2XMessageEntity:" + GsonUtil.jsonFromObject(v2XMessageEntity));
|
||||||
V2XRoadEventEntity v2XRoadEventEntity = v2XMessageEntity.getContent();
|
V2XRoadEventEntity v2XRoadEventEntity = v2XMessageEntity.getContent();
|
||||||
if (v2XRoadEventEntity != null) {
|
if (v2XRoadEventEntity != null) {
|
||||||
if (v2XMessageEntity.isShowState()) {
|
if (v2XMessageEntity.isShowState()) {
|
||||||
|
|||||||
@@ -742,6 +742,7 @@ enum class EventTypeEnum(
|
|||||||
TYPE_ERROR.poiType -> TYPE_ERROR.poiTypeSrcVr
|
TYPE_ERROR.poiType -> TYPE_ERROR.poiTypeSrcVr
|
||||||
TYPE_OPTIMAL_ROUTE_RECOMMEND.poiType -> TYPE_OPTIMAL_ROUTE_RECOMMEND.poiTypeSrcVr
|
TYPE_OPTIMAL_ROUTE_RECOMMEND.poiType -> TYPE_OPTIMAL_ROUTE_RECOMMEND.poiTypeSrcVr
|
||||||
GHOST_PROBE.poiType -> GHOST_PROBE.poiTypeSrcVr
|
GHOST_PROBE.poiType -> GHOST_PROBE.poiTypeSrcVr
|
||||||
|
AI_ROAD_WORK.poiType -> AI_ROAD_WORK.poiTypeSrcVr
|
||||||
else -> TYPE_ERROR.poiTypeSrcVr
|
else -> TYPE_ERROR.poiTypeSrcVr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user