@@ -14,8 +14,11 @@ object CallerHmiListenerManager : CallerBase() {
|
||||
|
||||
private val TAG = "CallerHmiListenerManager"
|
||||
|
||||
private val checkAutoPilotBtnListeners: HashMap<String, IMoGoCheckAutoPilotBtnListener> =
|
||||
HashMap()
|
||||
// 存储最后一次回调的数据,当有新当位置注册了监听将此数据回调过去,防止有些模块注册顺序问题导致无法获取最新状态
|
||||
private var mIsChecked: Boolean = false
|
||||
|
||||
// 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步
|
||||
private val mAutoPilotBtnListeners: HashMap<String, IMoGoCheckAutoPilotBtnListener> = HashMap()
|
||||
|
||||
|
||||
/**
|
||||
@@ -27,7 +30,8 @@ object CallerHmiListenerManager : CallerBase() {
|
||||
@Nullable tag: String,
|
||||
@Nullable listener: IMoGoCheckAutoPilotBtnListener
|
||||
) {
|
||||
checkAutoPilotBtnListeners[tag] = listener
|
||||
mAutoPilotBtnListeners[tag] = listener
|
||||
listener.onCheck(mIsChecked)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -35,7 +39,7 @@ object CallerHmiListenerManager : CallerBase() {
|
||||
* @param tag 标记,用来注销监听使用
|
||||
*/
|
||||
fun removeCheckAutoPilotBtnListener(@Nullable tag: String) {
|
||||
checkAutoPilotBtnListeners.remove(tag)
|
||||
mAutoPilotBtnListeners.remove(tag)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,11 +48,12 @@ object CallerHmiListenerManager : CallerBase() {
|
||||
*/
|
||||
fun invokeCheckAutoPilotBtnListener(isChecked: Boolean) {
|
||||
LogUtils.dTag(TAG, "isChecked:$isChecked")
|
||||
checkAutoPilotBtnListeners.forEach {
|
||||
mIsChecked = isChecked
|
||||
mAutoPilotBtnListeners.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
LogUtils.dTag(TAG, "tag:$tag listener:$listener")
|
||||
listener.onCheck(isChecked)
|
||||
listener.onCheck(mIsChecked)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,8 @@ package com.mogo.eagle.core.function.call.hmi
|
||||
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
|
||||
import com.mogo.eagle.core.function.api.hmi.autopilot.IMoGoCheckAutoPilotBtnListener
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.WarningStatusListener
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
|
||||
/**
|
||||
@@ -31,9 +30,9 @@ object CallerHmiManager : CallerBase() {
|
||||
alertContent: String?,
|
||||
ttsContent: String?,
|
||||
tag: String?,
|
||||
listener: WarningStatusListener?
|
||||
listenerIMoGo: IMoGoWarningStatusListener?
|
||||
) {
|
||||
waringProviderApi.showWarningV2X(v2xType, alertContent, ttsContent, tag, listener)
|
||||
waringProviderApi.showWarningV2X(v2xType, alertContent, ttsContent, tag, listenerIMoGo)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.mogo.eagle.core.function.call.obu
|
||||
|
||||
import androidx.annotation.Nullable
|
||||
import com.mogo.eagle.core.data.obu.ObuStatusInfo
|
||||
import com.mogo.eagle.core.function.api.obu.IMoGoObuStatusListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import com.mogo.eagle.core.utilcode.util.LogUtils
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/9/30 5:48 下午
|
||||
* OBU 监听管理
|
||||
*/
|
||||
object CallerObuListenerManager : CallerBase() {
|
||||
private val TAG = "CallerObuListenerManager"
|
||||
|
||||
// 存储最后一次回调的数据,当有新当位置注册了监听将此数据回调过去,防止有些模块注册顺序问题导致无法获取最新状态
|
||||
private var mObuStatusInfo: ObuStatusInfo = ObuStatusInfo()
|
||||
// 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步
|
||||
private val mObuStatusListeners: HashMap<String, IMoGoObuStatusListener> = HashMap()
|
||||
|
||||
/**
|
||||
* 添加自动驾驶按钮选中监听
|
||||
* @param tag 标记,用来注销监听使用
|
||||
* @param listener 监听回调
|
||||
*/
|
||||
fun addCheckAutoPilotBtnListener(
|
||||
@Nullable tag: String,
|
||||
@Nullable listener: IMoGoObuStatusListener
|
||||
) {
|
||||
mObuStatusListeners[tag] = listener
|
||||
listener.onObuStatusResponse(mObuStatusInfo)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除自动驾驶按钮选中监听
|
||||
* @param tag 标记,用来注销监听使用
|
||||
*/
|
||||
fun removeCheckAutoPilotBtnListener(@Nullable tag: String) {
|
||||
mObuStatusListeners.remove(tag)
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发自动驾驶按钮选中监听
|
||||
* @param isChecked 选中状态
|
||||
*/
|
||||
fun invokeCheckAutoPilotBtnListener(obuStatusInfo: ObuStatusInfo) {
|
||||
LogUtils.dTag(TAG, "isChecked:$obuStatusInfo")
|
||||
mObuStatusInfo = obuStatusInfo
|
||||
mObuStatusListeners.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
LogUtils.dTag(TAG, "tag:$tag listener:$listener")
|
||||
listener.onObuStatusResponse(mObuStatusInfo)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user