[Fix]解决司机屏连接工控机失败的问题

This commit is contained in:
chenfufeng
2022-10-12 20:05:09 +08:00
parent a7ca4752b1
commit 0169a68d1e
4 changed files with 107 additions and 166 deletions

View File

@@ -1,7 +1,5 @@
package com.mogo.eagle.core.function.autopilot.adapter
import android.location.Location
import android.util.Log
import chassis.VehicleStateOuterClass
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig
@@ -37,6 +35,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotGuardian
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotSNRequest
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotStatusRespByQuery
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager.invokeAutopilotAbility
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager.invokeAutopilotCarConfigData
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager.invokeAutopilotCarStateData
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
@@ -51,7 +50,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.map.navi.MogoCarLocationChangedListenerRegister
import com.zhidao.support.adas.high.AdasManager
import com.zhidao.support.adas.high.OnAdasListener
import com.zhidao.support.adas.high.bean.AutopilotAbility
@@ -444,5 +442,6 @@ class MoGoAdasListenerImpl : OnAdasListener {
* 使用方法查看app_ipc_monitoring/uiMainActivity/onAutopilotAbility
*/
override fun onAutopilotAbility(ability: AutopilotAbility?) {
invokeAutopilotAbility(ability)
}
}

View File

@@ -0,0 +1,12 @@
package com.mogo.eagle.core.function.api.autopilot
import com.zhidao.support.adas.high.bean.AutopilotAbility
interface IMoGoAutopilotActionsListener {
/**
* pnc actions 决策 驾驶的意图
*/
fun onAutopilotAbility(ability: AutopilotAbility?)
}

View File

@@ -0,0 +1,60 @@
package com.mogo.eagle.core.function.call.autopilot
import androidx.annotation.Nullable
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener
import com.mogo.eagle.core.function.call.base.CallerBase
import com.zhidao.support.adas.high.bean.AutopilotAbility
import java.util.concurrent.ConcurrentHashMap
object CallerAutopilotActionsListenerManager : CallerBase() {
private val M_AUTOPILOT_ACTIONS_LISTENER: ConcurrentHashMap<String, IMoGoAutopilotActionsListener> =
ConcurrentHashMap()
/**
* 添加监听
* @param tag 标记,用来注销监听使用
* @param listener 监听回调
*/
fun addListener(
@Nullable tag: String,
@Nullable listener: IMoGoAutopilotActionsListener
) {
if (M_AUTOPILOT_ACTIONS_LISTENER.containsKey(tag)) {
return
}
M_AUTOPILOT_ACTIONS_LISTENER[tag] = listener
}
/**
* 删除监听
* @param tag 标记,用来注销监听使用
*/
fun removeListener(@Nullable tag: String) {
if (!M_AUTOPILOT_ACTIONS_LISTENER.containsKey(tag)) {
return
}
M_AUTOPILOT_ACTIONS_LISTENER.remove(tag)
}
/**
* 删除自动驾驶按钮选中监听
* @param listener 要删除的监听对象
*/
fun removeListener(@Nullable listener: IMoGoAutopilotActionsListener) {
M_AUTOPILOT_ACTIONS_LISTENER.forEach {
if (it.value == listener) {
M_AUTOPILOT_ACTIONS_LISTENER.remove(it.key)
}
}
}
@Synchronized
fun invokeAutopilotAbility(ability: AutopilotAbility?) {
M_AUTOPILOT_ACTIONS_LISTENER.forEach {
val listener = it.value
listener.onAutopilotAbility(ability)
}
}
}