[自动驾驶状态变更toast提示]
This commit is contained in:
yangyakun
2024-06-04 11:18:19 +08:00
parent 9c6bd1f437
commit 9023bacf24
2 changed files with 26 additions and 4 deletions

View File

@@ -4,6 +4,8 @@ import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.och.common.module.R
import com.mogo.och.common.module.manager.autopilot.trajectory.TrajectoryManager
import com.mogo.och.common.module.utils.CallerBase
import com.zhjt.mogo.adas.data.AdasConstants
@@ -13,11 +15,31 @@ import mogo_msg.MogoReportMsg
import system_master.SsmInfo
import system_master.SystemStatusInfo
import java.lang.Exception
import kotlin.properties.Delegates
object OchAutoPilotStatusListenerManager : CallerBase<IOchAutopilotStatusListener>(),IMoGoAutopilotStatusListener,
(Boolean) -> Unit {
const val TAG = "OCHAutoPilotStatusListenerManager"
private var autopilotState: Int by Delegates.observable(0) { _, oldValue, newValue ->
if (oldValue != newValue) {
if(oldValue==IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){
if(newValue==IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE){
ToastUtils.showLong(R.string.common_change2_autopilot2_manual)
}
}else if(oldValue==IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING){
if(newValue==IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE){
ToastUtils.showLong(R.string.common_change2_pxjs_manual)
}
}
M_LISTENERS.forEach {
val listener = it.value
listener.onAutopilotStatusResponse(newValue)
}
}
}
init {
//2021.11.1 鹰眼架构整合由IMoGoAutopilotStatusListener逐步替代IMogoAdasOCHCallback接口
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
@@ -37,10 +59,7 @@ object OchAutoPilotStatusListenerManager : CallerBase<IOchAutopilotStatusListene
override fun onAutopilotStatusResponse(state: Int) {
super.onAutopilotStatusResponse(state)
M_LISTENERS.forEach {
val listener = it.value
listener.onAutopilotStatusResponse(state)
}
autopilotState = state
}
override fun onAutopilotDockerInfo(dockerVersion: String) {

View File

@@ -17,4 +17,7 @@
<string name="qr_cancel">取消</string>
<string name="bind_driver_qr_title">扫描二维码完成车辆绑定</string>
<string name="common_change2_autopilot2_manual">自动驾驶已退出,请立即接管,注意周边环境 小心驾驶</string>
<string name="common_change2_pxjs_manual">平行驾驶已退出,请立即接管,注意周边环境 小心驾驶</string>
</resources>