From 9863924ebb8478dfdb59c7675f37a6e1c4fd960e Mon Sep 17 00:00:00 2001 From: zhongchao Date: Mon, 20 Feb 2023 14:54:52 +0800 Subject: [PATCH] [2.14.0] pnc add try catch --- .../function/hmi/ui/pnc/PncActionsView.kt | 51 ++++++++++--------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/pnc/PncActionsView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/pnc/PncActionsView.kt index 29fd379f52..6a15160b33 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/pnc/PncActionsView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/pnc/PncActionsView.kt @@ -72,37 +72,40 @@ class PncActionsView @JvmOverloads constructor( @BizConfig(FOUNDATION, "", BIZ_PNC_ACTIONS) override fun pncActions(planningActionMsg: MessagePad.PlanningActionMsg) { - mAutoPilotStatusInfo?.let { it -> - if (it.state == STATUS_AUTOPILOT_RUNNING) { - UiThreadHandler.post { - var actions: String? = null - planningActionMsg.actionMsg?.let { - actions = PncActionsHelper.getAction(it.drivingState.number, it.drivingAction.number) + try { + mAutoPilotStatusInfo?.let { it -> + if (it.state == STATUS_AUTOPILOT_RUNNING) { + UiThreadHandler.post { + var actions: String? = null + planningActionMsg.actionMsg?.let { + actions = PncActionsHelper.getAction(it.drivingState.number, it.drivingAction.number) - //如果是存在云端红绿灯数据条件下,设置云端数据 - if (PncActionsHelper.isWaitingTrafficlight(it.drivingState.number, it.drivingAction.number) - && mTrafficLightResult != null - && getWaitTrafficlightTime().isNotBlank()) { - actions += ",预计${getWaitTrafficlightTime()}秒后通过" + //如果是存在云端红绿灯数据条件下,设置云端数据 + if (PncActionsHelper.isWaitingTrafficlight(it.drivingState.number, it.drivingAction.number) + && mTrafficLightResult != null + && getWaitTrafficlightTime().isNotBlank()) { + actions += ",预计${getWaitTrafficlightTime()}秒后通过" + } else { + mTrafficLightResult = null + } + } + // update view + if (actions.isNullOrEmpty()) { + this.background = null + tvHmiPncActions.text = "" } else { - mTrafficLightResult = null + this.background = AppCompatResources.getDrawable(context, R.drawable.pnc_actions_bg) + tvHmiPncActions.text = actions } } - // update view - if (actions.isNullOrEmpty()) { - this.background = null - tvHmiPncActions.text = "" - } else { - this.background = AppCompatResources.getDrawable(context, R.drawable.pnc_actions_bg) - tvHmiPncActions.text = actions - } + }else{ + this.background = null + tvHmiPncActions.text = "" } - }else{ - this.background = null - tvHmiPncActions.text = "" } + }catch (e:Exception){ + e.printStackTrace() } - } override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) {