[644][data-center] 能否启动自驾接口优化,移除缓存
This commit is contained in:
@@ -102,10 +102,6 @@ public class OCHAdasAbilityManager implements IMoGoAutopilotActionsListener, IMo
|
||||
CallerParallelDrivingActionsListenerManager.INSTANCE.removeListener(TAG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotAbilityHighFrequency(boolean isAutopilotAbility, @Nullable LaunchConditionData launchConditionData, @Nullable ArrayList<UnableLaunchReason> unableAutopilotReasons) {
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onAutopilotAbility(boolean isAutopilotAbility, @Nullable LaunchConditionData launchConditionData, @Nullable ArrayList<UnableLaunchReason> unableAutopilotReasons) {
|
||||
this.isAutopilotAbility = isAutopilotAbility;
|
||||
|
||||
@@ -47,7 +47,7 @@ internal class AcceleratorImpl(ctx: Context): IFlow<AcceleratorStatus>(ctx), IMo
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAutopilotAbilityHighFrequency(isAutopilotAbility: Boolean, launchConditionData: LaunchConditionData?, unableAutopilotReasons: ArrayList<UnableLaunchReason>?) {
|
||||
override fun onAutopilotAbility(isAutopilotAbility: Boolean, launchConditionData: LaunchConditionData?, unableAutopilotReasons: ArrayList<UnableLaunchReason>?) {
|
||||
if (!isAutopilotAbility) {
|
||||
val target = unableAutopilotReasons?.find { it.unableType == CHASSIS_THROTTLE }?.also { itx ->
|
||||
isError = true
|
||||
|
||||
@@ -46,7 +46,7 @@ internal class BrakeImpl(ctx: Context): IFlow<BrakeStatus>(ctx), IMoGoChassisBra
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAutopilotAbilityHighFrequency(isAutopilotAbility: Boolean, launchConditionData: LaunchConditionData?, unableAutopilotReasons: ArrayList<UnableLaunchReason>?) {
|
||||
override fun onAutopilotAbility(isAutopilotAbility: Boolean, launchConditionData: LaunchConditionData?, unableAutopilotReasons: ArrayList<UnableLaunchReason>?) {
|
||||
if (!isAutopilotAbility) {
|
||||
val target = unableAutopilotReasons?.find { it.unableType == CHASSIS_BRAKE }?.also { itx ->
|
||||
isError = true
|
||||
|
||||
@@ -52,7 +52,7 @@ internal class DoubleFlashImpl(ctx: Context): IFlow<DoubleFlashStatus>(ctx), IMo
|
||||
|
||||
}
|
||||
|
||||
override fun onAutopilotAbilityHighFrequency(isAutopilotAbility: Boolean, launchConditionData: LaunchConditionData?, unableAutopilotReasons: ArrayList<UnableLaunchReason>?) {
|
||||
override fun onAutopilotAbility(isAutopilotAbility: Boolean, launchConditionData: LaunchConditionData?, unableAutopilotReasons: ArrayList<UnableLaunchReason>?) {
|
||||
if (!isAutopilotAbility) {
|
||||
val target = unableAutopilotReasons?.find { it.unableType == CHASSIS_HAZARD_LIGHTS }?.also { itx ->
|
||||
isError = true
|
||||
|
||||
@@ -46,7 +46,7 @@ internal class GearImpl(ctx: Context): IFlow<GearStatus>(ctx), IMoGoChassisGearS
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAutopilotAbilityHighFrequency(isAutopilotAbility: Boolean, launchConditionData: LaunchConditionData?, unableAutopilotReasons: ArrayList<UnableLaunchReason>?) {
|
||||
override fun onAutopilotAbility(isAutopilotAbility: Boolean, launchConditionData: LaunchConditionData?, unableAutopilotReasons: ArrayList<UnableLaunchReason>?) {
|
||||
if (!isAutopilotAbility) {
|
||||
val target = unableAutopilotReasons?.find { it.unableType == CHASSIS_GEAR }?.also { itx ->
|
||||
isError = true
|
||||
|
||||
@@ -45,7 +45,7 @@ internal class SteerImpl(ctx: Context): IFlow<SteerStatus>(ctx), IMoGoChassisSte
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAutopilotAbilityHighFrequency(isAutopilotAbility: Boolean, launchConditionData: LaunchConditionData?, unableAutopilotReasons: ArrayList<UnableLaunchReason>?) {
|
||||
override fun onAutopilotAbility(isAutopilotAbility: Boolean, launchConditionData: LaunchConditionData?, unableAutopilotReasons: ArrayList<UnableLaunchReason>?) {
|
||||
Logger.d(TAG, "onAutopilotAbility->($isAutopilotAbility, $launchConditionData, ${unableAutopilotReasons?.joinToString(",")}")
|
||||
if (!isAutopilotAbility) {
|
||||
val target = unableAutopilotReasons?.find { it.unableType == CHASSIS_STEERING }?.also { itx ->
|
||||
|
||||
@@ -12,18 +12,10 @@ interface IMoGoAutopilotActionsListener {
|
||||
/**
|
||||
* 高频
|
||||
*/
|
||||
fun onAutopilotAbilityHighFrequency(
|
||||
isAutopilotAbility: Boolean,
|
||||
launchConditionData: LaunchConditionData?,
|
||||
unableAutopilotReasons: ArrayList<UnableLaunchReason>?
|
||||
){}
|
||||
|
||||
/**
|
||||
* 数据变动才会调用
|
||||
*/
|
||||
fun onAutopilotAbility(
|
||||
isAutopilotAbility: Boolean,
|
||||
launchConditionData: LaunchConditionData?,
|
||||
unableAutopilotReasons: ArrayList<UnableLaunchReason>?
|
||||
){}
|
||||
)
|
||||
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user