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

View File

@@ -0,0 +1,18 @@
package com.mogo.eagle.core.function.api.obu
/**
* OBU 数据保存
* @author lixiaopeng
* @date 2023-02-01
*/
interface IMoGoObuSaveMessageListener {
/**
* @param type 事件id类似与uuid
* @param content 事件内容
* @param tts 事件语音播报
*
*/
fun onMoGoObuSaveMessage(type: String, content: String, tts: String)
}

View File

@@ -13,5 +13,4 @@ interface IMoGoObuDcCombineListener {
*/
fun onMoGoObuDcCombineData(obuWarningData: ObuWarningEvent.ObuWarningData?)
}

View File

@@ -0,0 +1,22 @@
package com.mogo.eagle.core.function.call.obu
import com.mogo.eagle.core.function.api.obu.IMoGoObuSaveMessageListener
import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningRsiListener
import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.support.obu.ObuScene
/**
* OBU 保存到数据中心,展示在消息盒子的数据
*
*/
object CallerObuSaveMessageListenerManager : CallerBase<IMoGoObuSaveMessageListener>() {
fun invokeObuSaveMessage(type: String, content: String, tts: String) {
M_LISTENERS.forEach {
val tag = it.key
val listener = it.value
listener.onMoGoObuSaveMessage(type, content, tts)
}
}
}

View File

@@ -1,7 +1,5 @@
package com.mogo.eagle.core.function.call.obucombine
import androidx.annotation.Nullable
import com.mogo.eagle.core.function.api.obu.IMoGoObuStatusListener
import com.mogo.eagle.core.function.api.obucombine.IMoGoObuDcCombineListener
import com.mogo.eagle.core.function.call.base.CallerBase
import mogo.v2x.ObuWarningEvent
@@ -15,44 +13,6 @@ object CallerObuDcCombineListenerManager : CallerBase<IMoGoObuDcCombineListener>
private val M_DC_COMBINE_LISTENERS: ConcurrentHashMap<String, IMoGoObuDcCombineListener> =
ConcurrentHashMap()
/**
* 添加 obu和dc数据通道 监听
* @param tag 标记,用来注销监听使用
* @param listener 监听回调
*/
// fun addListener(
// @Nullable tag: String,
// @Nullable listener: IMoGoObuDcCombineListener
// ) {
// if (M_DC_COMBINE_LISTENERS.containsKey(tag)) {
// return
// }
// M_DC_COMBINE_LISTENERS[tag] = listener
// }
/**
* 删除监听
* @param tag 标记,用来注销监听使用
*/
// fun removeListener(@Nullable tag: String) {
// if (!M_DC_COMBINE_LISTENERS.containsKey(tag)) {
// return
// }
// M_DC_COMBINE_LISTENERS.remove(tag)
// }
/**
* 删除自动驾驶按钮选中监听
* @param listener 要删除的监听对象
*/
// fun removeListener(@Nullable listener: IMoGoObuDcCombineListener) {
// M_DC_COMBINE_LISTENERS.forEach {
// if (it.value == listener) {
// M_DC_COMBINE_LISTENERS.remove(it.key)
// }
// }
// }
/**
* v2i数据
*/