[2.15.0][feat]替换全览模式的V2X数据来源

This commit is contained in:
chenfufeng
2023-03-30 18:15:09 +08:00
parent 86df90cd10
commit c9de9aa286
6 changed files with 137 additions and 7 deletions

View File

@@ -19,7 +19,6 @@ import com.mogo.eagle.function.biz.v2x.overview.db.OverviewDb
import com.mogo.eagle.function.biz.v2x.road.LineUploadManager
import com.mogo.eagle.function.biz.v2x.trafficlight.core.MogoTrafficLightManager
import com.mogo.eagle.function.biz.v2x.v2n.V2XEventManager
import com.mogo.eagle.function.biz.v2x.v2n.V2XPoiLoader.Companion.v2xPoiLoader
import com.mogo.eagle.function.biz.v2x.v2n.pnc.*
import com.mogo.eagle.function.biz.v2x.vip.VipCarManager
@@ -92,11 +91,11 @@ class FuncBizProvider : IMoGoFuncBizProvider {
}
override fun getAllV2XEvents() {
OverViewDataManager.getAllV2XEventsByLineId(MoGoAiCloudClientConfig.getInstance().sn)
// OverViewDataManager.getAllV2XEventsByLineId(MoGoAiCloudClientConfig.getInstance().sn)
}
override fun queryV2XEvents() {
v2xPoiLoader.queryWholeRoadEvents()
// v2xPoiLoader.queryWholeRoadEvents()
}
override fun onDestroy() {

View File

@@ -6,9 +6,11 @@ import android.os.Handler
import android.os.Looper
import android.util.Log
import androidx.localbroadcastmanager.content.LocalBroadcastManager
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_CLOUD_V2N
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_CLOUD
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_CLOUD_V2N
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.enums.EventTypeHelper
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
@@ -41,7 +43,11 @@ import com.mogo.eagle.function.biz.v2x.v2n.utils.toRoadMarker
import com.mogo.eagle.core.data.v2x.V2XEvent
import com.mogo.eagle.core.data.v2x.V2XMarkerCardResult
import com.mogo.eagle.core.data.v2x.V2XWarningTarget
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoV2XListener
import com.mogo.eagle.core.function.api.cloud.IMoGoCloudListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerV2XListenerManager
import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager
import com.mogo.eagle.function.biz.v2x.v2n.V2XPoiLoader.Companion.v2xPoiLoader
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
@@ -58,9 +64,11 @@ import kotlinx.coroutines.cancel
import kotlinx.coroutines.launch
import java.util.concurrent.atomic.AtomicBoolean
import mogo.telematics.pad.MessagePad.PlanningObject
import mogo.v2x.MogoV2X
object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IV2XCallback,
IMoGoAutopilotIdentifyListener, IMoGoCloudListener {
IMoGoAutopilotIdentifyListener, IMoGoCloudListener,
IMoGoV2XListener, IMoGoAutopilotStatusListener {
private const val TAG = "V2XEventManager"
@@ -70,6 +78,9 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IV2XCallback,
private val hasInit by lazy { AtomicBoolean(false) }
@Volatile
private var eventCount = -1
fun init(context: Context) {
BridgeApi.init(context)
if (hasInit.compareAndSet(false, true)) {
@@ -85,6 +96,8 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IV2XCallback,
v2xPoiLoader.addCallback(this)
CallerCloudListenerManager.addListener(TAG,this)
CallerAutopilotIdentifyListenerManager.addListener(TAG, this)
CallerV2XListenerManager.addListener(TAG, this)
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
}
private fun unRegisterListener() {
@@ -92,6 +105,8 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IV2XCallback,
v2xPoiLoader.removeCallback(this)
CallerCloudListenerManager.removeListener(TAG)
CallerAutopilotIdentifyListenerManager.removeListener(TAG)
CallerV2XListenerManager.removeListener(TAG)
CallerAutoPilotStatusListenerManager.removeListener(TAG)
}
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
@@ -381,4 +396,31 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IV2XCallback,
}
}
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
if (autoPilotStatusInfo.autopilotControlParameters != null) {
eventCount = -1
}
}
override fun onV2nGlobalPathEvents(
eventCount: Int,
construct: MogoV2X.RSI_PB?,
triangle: MogoV2X.RSI_PB?,
congestion: MogoV2X.RSI_PB?,
parkingViolation: MogoV2X.RSM_PB?
) {
if (this.eventCount == -1) {
this.eventCount = eventCount
if (eventCount >= 0) {
sendToMsgBox(eventCount)
}
}
}
private fun sendToMsgBox(count: Int) {
val msgBoxBean =
MsgBoxBean(MsgBoxType.V2X, V2XMsg("", "查询到当前全程共${count}个事件", ""))
msgBoxBean.sourceType = DataSourceType.SUMMARY
CallerMsgBoxManager.saveMsgBox(msgBoxBean)
}
}

View File

@@ -655,7 +655,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
* @param parkingViolation 违停 ---包含 静态障碍车
*/
override fun onV2nGlobalPathEvents(header: MessagePad.Header, roadOverview: RoadOverviewEvents.RoadOverviewData, construct: MogoV2X.RSI_PB?, triangle: MogoV2X.RSI_PB?, congestion: MogoV2X.RSI_PB?, parkingViolation: MogoV2X.RSM_PB?) {
CallerV2XListenerManager.dispatchV2nGlobalPathEvents(roadOverview.eventCount, construct, triangle, congestion, parkingViolation)
}
/**

View File

@@ -22,13 +22,16 @@ import com.amap.api.maps.TextureMapView
import com.amap.api.maps.model.*
import com.mogo.eagle.core.data.map.Infrastructure
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.data.v2x.Center
import com.mogo.eagle.core.data.v2x.V2XEventData
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoV2XListener
import com.mogo.eagle.core.function.api.biz.IFuncBizProvider
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.getGlobalPath
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerV2XListenerManager
import com.mogo.eagle.core.function.call.biz.CallerFuncBizListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showVideoDialog
import com.mogo.eagle.core.function.map.R
@@ -43,9 +46,12 @@ import com.mogo.eagle.core.function.smp.MarkerDrawerManager.startLoopCalCarLocat
import com.mogo.eagle.core.function.smp.MarkerDrawerManager.updateRoutePoints
import com.mogo.eagle.core.function.smp.V2XMarkerView
import com.mogo.eagle.core.utilcode.mogo.MapAssetStyleUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import me.jessyan.autosize.utils.AutoSizeUtils
import mogo.telematics.pad.MessagePad
import mogo.v2x.MogoV2X
import kotlin.math.pow
/**
* 全览地图View
@@ -57,7 +63,7 @@ class OverMapView @JvmOverloads constructor(
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : RelativeLayout(context, attrs, defStyleAttr), IMoGoChassisLocationGCJ02Listener,
IMoGoPlanningRottingListener {
IMoGoPlanningRottingListener, IMoGoV2XListener {
// =============自定义属性相关=============
private var mapStylePath: String? = null
@@ -313,9 +319,10 @@ class OverMapView @JvmOverloads constructor(
}
override fun onV2XEvents(v2XEventData: List<V2XEventData>?) {
showV2XEventMarkers(v2XEventData)
// showV2XEventMarkers(v2XEventData)
}
})
CallerV2XListenerManager.addListener(TAG, this)
// 主动查一次全局路径规划的数据
getGlobalPath()
}
@@ -471,6 +478,7 @@ class OverMapView @JvmOverloads constructor(
// 注册定位监听
CallerChassisLocationGCJ02ListenerManager.removeListener(TAG)
CallerPlanningRottingListenerManager.removeListener(TAG)
CallerV2XListenerManager.removeListener(TAG)
}
override fun onInterceptTouchEvent(ev: MotionEvent): Boolean {
@@ -696,4 +704,53 @@ class OverMapView @JvmOverloads constructor(
handlePlanningData(it.wayPointsList)
}
}
override fun onV2nGlobalPathEvents(
eventCount: Int,
construct: MogoV2X.RSI_PB?,
triangle: MogoV2X.RSI_PB?,
congestion: MogoV2X.RSI_PB?,
parkingViolation: MogoV2X.RSM_PB?
) {
val constructList = construct?.rsiFrame?.rtes?.rteDataList
val triangleList = triangle?.rsiFrame?.rtes?.rteDataList
val congestionList = congestion?.rsiFrame?.rtes?.rteDataList
val parkingList = parkingViolation?.rsmFrame?.participants?.participantDataList
val list = ArrayList<V2XEventData>()
constructList?.forEach {
it.eventPos?.offsetLL?.positionLatLon?.let { latLon ->
list.add(V2XEventData(
0, 0, "", Center(latLon.lat * 10.0.pow(-7.0),
latLon.lon * 10.0.pow(-7.0)), null, 0.0, "10006", 1
))
}
}
triangleList?.forEach {
it.eventPos?.offsetLL?.positionLatLon?.let { latLon ->
list.add(V2XEventData(
0, 0, "", Center(latLon.lat * 10.0.pow(-7.0),
latLon.lon * 10.0.pow(-7.0)), null, 0.0, "10032", 1
))
}
}
congestionList?.forEach {
it.eventPos?.offsetLL?.positionLatLon?.let { latLon ->
list.add(V2XEventData(
0, 0, "", Center(latLon.lat * 10.0.pow(-7.0),
latLon.lon * 10.0.pow(-7.0)), null, 0.0, "10007", 1
))
}
}
parkingList?.forEach {
it.pos?.offsetLL?.positionLatLon?.let { latLon ->
list.add(V2XEventData(
0, 0, "", Center(latLon.lat * 10.0.pow(-7.0),
latLon.lon * 10.0.pow(-7.0)), null, 0.0, "10025", 1
))
}
}
UiThreadHandler.post {
showV2XEventMarkers(list)
}
}
}