[660][data-center] 添加查询节点状态以及主动推送节点状态接口
This commit is contained in:
@@ -22,6 +22,7 @@ import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.util.AppStateManager
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.zhjt.mogo.adas.data.Adas
|
||||
import com.zhjt.mogo.adas.data.sweeper.bootable.SweeperBootable.IsBootable
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask.GetTaskReq
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask.StartTaskResp
|
||||
@@ -919,4 +920,14 @@ object CallerAutoPilotControlManager {
|
||||
fun sendSeatPressure(driver: Boolean,copilot: Boolean,backRow: Boolean): Boolean?{
|
||||
return providerApi?.sendSeatPressure(driver, copilot, backRow)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询节点状态
|
||||
*
|
||||
* @param name 节点名称 目前只有SSM和FSM2024
|
||||
* @return 状态 SSM只能查询到超时状态;FSM2024可以查询到节点是否存在状态以及超时状态;
|
||||
*/
|
||||
fun getNodeStateInfo(name: AdasConstants.NodeName): Adas.NodeStateInfo? {
|
||||
return providerApi?.getNodeStateInfo(name)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoNodeStateListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import com.zhjt.mogo.adas.data.Adas
|
||||
import com.zhjt.mogo.adas.data.AdasConstants
|
||||
|
||||
/**
|
||||
*节点状态
|
||||
*/
|
||||
object CallerNodeStateListenerManager : CallerBase<IMoGoNodeStateListener>() {
|
||||
private val mutableMap = mutableMapOf<String, Set<AdasConstants.NodeName>>()
|
||||
|
||||
fun addNodeStateListener(
|
||||
tag: String,
|
||||
nodeName: Set<AdasConstants.NodeName>?,
|
||||
listener: IMoGoNodeStateListener
|
||||
) {
|
||||
if (!nodeName.isNullOrEmpty()) {
|
||||
mutableMap[tag] = nodeName
|
||||
}
|
||||
super.addListener(tag, listener)
|
||||
}
|
||||
|
||||
fun removeNodeStateListener(tag: String) {
|
||||
if (mutableMap.containsKey(tag)) {
|
||||
mutableMap.remove(tag)
|
||||
}
|
||||
super.removeListener(tag)
|
||||
}
|
||||
|
||||
fun invokeNodeState(name: AdasConstants.NodeName, stateInfo: Adas.NodeStateInfo) {
|
||||
M_LISTENERS.forEach {
|
||||
val names = mutableMap[it.key]
|
||||
val listener = it.value
|
||||
if (names.isNullOrEmpty()) {
|
||||
listener.onNodeStateInfo(name, stateInfo)
|
||||
} else {
|
||||
if (names.contains(name)) {
|
||||
listener.onNodeStateInfo(name, stateInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun doSomeAfterAddListener(tag: String, listener: IMoGoNodeStateListener) {
|
||||
super.doSomeAfterAddListener(tag, listener)
|
||||
mutableMap.forEach { it ->
|
||||
if (it.key == tag) {
|
||||
val value = it.value
|
||||
value.forEach { name ->
|
||||
val state = CallerAutoPilotControlManager.getNodeStateInfo(name)
|
||||
state?.let {
|
||||
listener.onNodeStateInfo(name, state)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user