[644][data-center] 能否启动自驾接口优化,移除缓存

This commit is contained in:
xinfengkun
2024-06-11 17:55:46 +08:00
parent 7eb7c0e93e
commit ee85b6f51d
8 changed files with 27 additions and 50 deletions

View File

@@ -220,47 +220,36 @@ object CallerAutopilotActionsListenerManager : CallerBase<IMoGoAutopilotActionsL
@Synchronized
fun invokeAutopilotAbility(
isAutopilotAbility: Boolean,
launchCondition: LaunchConditionData,
launchConditionData: LaunchConditionData,
unableAutopilotReasons: ArrayList<UnableLaunchReason>?
) {
this.launchConditionData = launchCondition
this.isAutopilotAbility = isAutopilotAbility
this.launchConditionData = launchConditionData
this.unableAutopilotReasons = unableAutopilotReasons
Logger.d(
"CallerAutopilotActionsListenerManager",
"高频 是否可以启动自动驾驶=" + isAutopilotAbility + " 原因=" + (unableAutopilotReasons?.toString()) + " 原始数据=" + launchConditionData?.json
)
M_LISTENERS.forEach {
val listener = it.value
listener.onAutopilotAbilityHighFrequency(
CallerAutopilotActionsListenerManager.isAutopilotAbility,
launchConditionData,
CallerAutopilotActionsListenerManager.unableAutopilotReasons
)
}
notification();
if (isConnected) {
var isEquals = true
if (unableAutopilotReasons != null && this.unableAutopilotReasons != null) {
unableAutopilotReasons.let { onw ->
onw.sortWith(compareBy(UnableLaunchReason::hashCode));
this.unableAutopilotReasons?.let { old ->
old.sortWith(compareBy(UnableLaunchReason::hashCode));
isEquals = onw.toTypedArray() contentEquals old.toTypedArray()
}
}
} else isEquals =
!(unableAutopilotReasons != null || this.unableAutopilotReasons != null)
if (this.isAutopilotAbility != isAutopilotAbility || !isEquals) {
notification()
}
}
// if (isConnected) {
// var isEquals = true
// if (unableAutopilotReasons != null && this.unableAutopilotReasons != null) {
// unableAutopilotReasons.let { onw ->
// onw.sortWith(compareBy(UnableLaunchReason::hashCode));
// this.unableAutopilotReasons?.let { old ->
// old.sortWith(compareBy(UnableLaunchReason::hashCode));
// isEquals = onw.toTypedArray() contentEquals old.toTypedArray()
// }
// }
// } else isEquals =
// !(unableAutopilotReasons != null || this.unableAutopilotReasons != null)
// if (this.isAutopilotAbility != isAutopilotAbility || !isEquals) {
// notification()
// }
// }
}
private fun notification() {
Logger.d(
"CallerAutopilotActionsListenerManager",
"低频 是否可以启动自动驾驶=" + isAutopilotAbility + " 原因=" + (unableAutopilotReasons?.toString()) + " 原始数据=" + launchConditionData?.json
"是否可以启动自动驾驶=" + isAutopilotAbility + " 原因=" + (unableAutopilotReasons?.toString()) + " 原始数据=" + launchConditionData?.json
)
M_LISTENERS.forEach {
val listener = it.value