From 00ba93371ecb584d66665d484a49d7a8299bf1a8 Mon Sep 17 00:00:00 2001 From: zhongchao Date: Mon, 19 Dec 2022 15:32:59 +0800 Subject: [PATCH] [2.13.2-v2x] new func --- .../identify/MapIdentifySubscriber.kt | 3 - .../function/v2x/events/V2XEventManager.kt | 94 +++++++++++++++---- 2 files changed, 76 insertions(+), 21 deletions(-) diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/MapIdentifySubscriber.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/MapIdentifySubscriber.kt index d9a344ec2e..33fa6a5a1c 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/MapIdentifySubscriber.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/MapIdentifySubscriber.kt @@ -67,7 +67,4 @@ class MapIdentifySubscriber private constructor() : IMoGoSubscriber, } } - override fun onAutopilotWarnMessage(warn: MessagePad.Warn?) { - - } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt index 86c0e3b634..acc4631953 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt @@ -1,5 +1,6 @@ package com.mogo.eagle.core.function.v2x.events +import android.annotation.SuppressLint import android.content.* import android.os.* import android.provider.Settings.System @@ -28,8 +29,12 @@ import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.data.msgbox.MsgBoxType import com.mogo.eagle.core.data.msgbox.V2XMsg import com.mogo.eagle.core.data.traffic.* +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningActionsListener import com.mogo.eagle.core.function.api.hmi.warning.* import com.mogo.eagle.core.function.api.map.listener.* +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningActionsListenerManager import com.mogo.eagle.core.function.call.hmi.* import com.mogo.eagle.core.function.call.map.* import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.Default @@ -73,6 +78,7 @@ import com.shuyu.gsyvideoplayer.utils.* import com.zhjt.service.chain.* import kotlinx.coroutines.* import kotlinx.coroutines.android.* +import mogo.telematics.pad.MessagePad import roadwork.Road.RW_PB import tv.danmaku.ijk.media.player.* import java.util.concurrent.* @@ -80,7 +86,7 @@ import java.util.concurrent.atomic.* object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallback, - IMogoMapListener, IMogoStatusChangedListener { + IMogoMapListener, IMogoStatusChangedListener, IMoGoAutopilotIdentifyListener { private const val TAG = "V2XEventManager" @@ -140,9 +146,11 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb } }) } - MogoStatusManager.getInstance().registerStatusChangedListener(MODULE_NAME, StatusDescriptor.ACC_STATUS, this) - MogoStatusManager.getInstance().registerStatusChangedListener(MODULE_NAME, StatusDescriptor.SEEK_HELPING, this) - + MogoStatusManager.getInstance() + .registerStatusChangedListener(MODULE_NAME, StatusDescriptor.ACC_STATUS, this) + MogoStatusManager.getInstance() + .registerStatusChangedListener(MODULE_NAME, StatusDescriptor.SEEK_HELPING, this) + CallerAutopilotIdentifyListenerManager.addListener(MODULE_NAME, this) } private fun unRegisterListener() { @@ -152,9 +160,11 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb it.unregisterMogoMapListener(MODULE_NAME) it.unregisterMogoMarkerClickListener(CARD_TYPE_ROAD_CONDITION) } - MogoStatusManager.getInstance().unregisterStatusChangedListener(MODULE_NAME, StatusDescriptor.ACC_STATUS, this) - MogoStatusManager.getInstance().unregisterStatusChangedListener(MODULE_NAME, StatusDescriptor.SEEK_HELPING, this) - + MogoStatusManager.getInstance() + .unregisterStatusChangedListener(MODULE_NAME, StatusDescriptor.ACC_STATUS, this) + MogoStatusManager.getInstance() + .unregisterStatusChangedListener(MODULE_NAME, StatusDescriptor.SEEK_HELPING, this) + CallerAutopilotIdentifyListenerManager.removeListener(MODULE_NAME) } private fun initData() { @@ -353,12 +363,18 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb BridgeApi.v2xMarker()?.v2XRoadEventEntityList, V2XStatusManager.getInstance().location ) - if (v2XRoadEventEntity != null) { // CallerLogger.w("$M_V2X$TAG", + if (v2XRoadEventEntity != null) { val distance = v2XRoadEventEntity.distance val min = if (EventTypeEnum.AI_ROAD_WORK.poiType == v2XRoadEventEntity.poiType) 0 else 5 - Logger.d(TAG, "--- trigger show before ---:data=>[${location.longitude}, ${location.latitude}, ${location.speed}], distance: $distance, minDistance: $min, poiType: ${v2XRoadEventEntity.poiType}") + CallerLogger.d( + "$M_V2X$TAG", + "--- trigger show before ---:data=>[${location.longitude}, ${location.latitude}, ${location.speed}], distance: $distance, minDistance: $min, poiType: ${v2XRoadEventEntity.poiType}" + ) if (distance >= min) { - Logger.d(TAG, "--- trigger show ---:poiType:" + v2XRoadEventEntity.poiType) + CallerLogger.d( + "$M_V2X$TAG", + "--- trigger show ---:poiType:" + v2XRoadEventEntity.poiType + ) TrackUtils.trackV2xRoadProduceEvent(1) val v2XMessageEntity = V2XMessageEntity() v2XMessageEntity.type = V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING @@ -441,7 +457,12 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb Pair(d.lon, d.lat) } - extra["gps_location"] = listOf(Pair(this.roadwork?.center?.point?.lon ?: 0.0, this.roadwork?.center?.point?.lat ?: 0.0)) + extra["gps_location"] = listOf( + Pair( + this.roadwork?.center?.point?.lon ?: 0.0, + this.roadwork?.center?.point?.lat ?: 0.0 + ) + ) } } l1.exploreWay = ArrayList().also { l2 -> @@ -449,7 +470,10 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb l3.poiType = this.roadwork?.poiType?.toString() l3.generateTime = this.roadwork?.detectTime ?: 0L l3.location = V2XMarkerLocation().also { l4 -> - val p = CoordinateUtils.transformWgsToGcj(this.roadwork?.center?.point?.lat ?: 0.0, this.roadwork?.center?.point?.lon ?: 0.0) + val p = CoordinateUtils.transformWgsToGcj( + this.roadwork?.center?.point?.lat ?: 0.0, + this.roadwork?.center?.point?.lon ?: 0.0 + ) l4.lon = p[0] l4.lat = p[1] l4.angle = this.roadwork?.center?.road?.bearing?.toDouble() ?: 0.0 @@ -457,9 +481,40 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb }) } - AiRoadMarker.receive(Marker(this.roadwork?.center?.point?.lat ?: 0.0, this.roadwork?.center?.point?.lon ?: 0.0, this.roadwork?.center?.road?.bearing?.toDouble() ?: 0.0, null, null, null)) + AiRoadMarker.receive( + Marker( + this.roadwork?.center?.point?.lat ?: 0.0, + this.roadwork?.center?.point?.lon ?: 0.0, + this.roadwork?.center?.road?.bearing?.toDouble() ?: 0.0, + null, + null, + null + ) + ) } + @SuppressLint("NewApi") + override fun onAutopilotIdentifyPlanningObj(planningObjects: List?) { + super.onAutopilotIdentifyPlanningObj(planningObjects) + planningObjects?.let { + if (it.isNotEmpty()) { + val first = it.stream() + .filter { planningObj: MessagePad.PlanningObject -> planningObj.type >= 1000 } + .findFirst() + if(first.isPresent){ + when(first.get().type){ +// 1004 -> { //V2N_RSM,静止事件,包括异常停车、异常静止障碍物 +// +// } + 1005 -> { //V2N_RSI,施工事件,包括锥桶或者挡板围城的施工场景,是个多边形包围区域 + + } + } + } + } + } + } + // private fun buildRoadEntity(e: V2XMarkerExploreWay, extra: Map? = null): V2XRoadEventEntity { // 记录道路事件 // val v2XRoadEventEntity = V2XRoadEventEntity() // v2XRoadEventEntity.location = e.location.toMarkerLocation() // 探路目前只有上报拥堵 @@ -513,7 +568,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb when (message.typeId) { 1001 -> { // 弱势交通碰撞预警 - EventTypeHelper.getVRU{ appId, tts, content -> + EventTypeHelper.getVRU { appId, tts, content -> tempAppId = appId tempTts = tts tempContent = content @@ -558,7 +613,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb } 2001 -> { // 最优车道100061 - EventTypeHelper.getOptLine{ appId, tts, content -> + EventTypeHelper.getOptLine { appId, tts, content -> tempAppId = appId tempTts = tts tempContent = content @@ -566,7 +621,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb } 3001 -> { // 前方道路拥堵预警 - EventTypeHelper.getTJW{ appId, tts, content -> + EventTypeHelper.getTJW { appId, tts, content -> tempAppId = appId tempTts = tts tempContent = content @@ -580,9 +635,11 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb CallerMsgBoxManager.saveMsgBox( MsgBoxBean( MsgBoxType.V2X, - V2XMsg(tempAppId.toString(), + V2XMsg( + tempAppId.toString(), tempContent, - tempTts) + tempTts + ) ) ) CallerHmiManager.warningV2X( @@ -662,4 +719,5 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb } } } + } \ No newline at end of file