[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)
}
}