[dev_arch_opt_3.0] 封装obu显示数据

This commit is contained in:
lixiaopeng
2023-02-20 18:20:20 +08:00
parent ca1832210a
commit 6d2deb6582
7 changed files with 101 additions and 53 deletions

View File

@@ -13,6 +13,7 @@ import com.mogo.eagle.function.biz.dispatch.DispatchAutoPilotManager.Companion.d
import com.mogo.eagle.function.biz.monitoring.CronTaskManager.Companion.cronTaskManager
import com.mogo.eagle.function.biz.notice.NoticeSocketManager.Companion.noticeSocketManager
import com.mogo.eagle.function.biz.notice.network.NoticeNetWorkManager
import com.mogo.eagle.function.biz.v2x.obu.V2xObuEventManager
import com.mogo.eagle.function.biz.v2x.overview.OverViewDataManager
import com.mogo.eagle.function.biz.v2x.overview.db.OverviewDb
import com.mogo.eagle.function.biz.v2x.road.LineUploadManager
@@ -44,6 +45,7 @@ class FuncBizProvider : IMoGoFuncBizProvider {
if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){
LineUploadManager.getInstance(context)?.init()
}
V2xObuEventManager.init(context)
// RedLightWarningManager.INSTANCE.listenTrafficLight()
}
@@ -110,6 +112,7 @@ class FuncBizProvider : IMoGoFuncBizProvider {
LineUploadManager.getInstance(it)?.onDestroy()
}
}
V2xObuEventManager.release()
// RedLightWarningManager.INSTANCE.onDestroy()
}
}

View File

@@ -0,0 +1,56 @@
package com.mogo.eagle.function.biz.v2x.obu
import android.content.Context
import com.mogo.eagle.core.data.enums.DataSourceType
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.function.api.obu.IMoGoObuSaveMessageListener
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.obu.CallerObuSaveMessageListenerManager
/**
* 处理obu分发出来在消息盒子展示的消息
*/
object V2xObuEventManager : IMoGoObuSaveMessageListener {
private const val TAG = "V2xObuEventManager"
fun init(context: Context) {
registerListener()
}
private fun registerListener() {
CallerObuSaveMessageListenerManager.addListener(TAG,this)
}
private fun unRegisterListener() {
CallerObuSaveMessageListenerManager.removeListener(TAG)
}
/**
* @param type 事件id类似与uuid
* @param content 事件内容
* @param tts 事件语音播报
*/
override fun onMoGoObuSaveMessage(type: String, content: String, tts: String) {
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
type,
content,
tts
)
).apply {
sourceType = DataSourceType.OBU
}
)
}
fun release() {
unRegisterListener()
}
}

View File

@@ -18,6 +18,7 @@ import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.obu.CallerObuConnectListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuSaveMessageListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuWarningListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
@@ -968,18 +969,7 @@ class MogoPrivateObuNewManager private constructor() {
* 保存obu直连数据到消息盒子
*/
private fun saveObuData(type: String, content: String, tts: String) {
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
type,
content,
tts
)
).apply {
sourceType = DataSourceType.OBU
}
)
CallerObuSaveMessageListenerManager.invokeObuSaveMessage(type, content, tts)
}
/**