From 6173626ad6a31e82a7c90c36c1fe9a2736db2efe Mon Sep 17 00:00:00 2001 From: yangyakun Date: Thu, 23 Mar 2023 15:46:18 +0800 Subject: [PATCH] =?UTF-8?q?[m1]=20[=E9=9D=A0=E8=BE=B9=E5=81=9C=E8=BD=A6?= =?UTF-8?q?=E9=80=BB=E8=BE=91]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusPassengerFunctionPresenter.kt | 16 ++-- .../OCHPlanningStopSideStatusManager.kt | 91 ++++++++++++++----- 2 files changed, 75 insertions(+), 32 deletions(-) diff --git a/OCH/mogo-och-charter-passenger/src/m1/java/com/mogo/och/bus/passenger/presenter/BusPassengerFunctionPresenter.kt b/OCH/mogo-och-charter-passenger/src/m1/java/com/mogo/och/bus/passenger/presenter/BusPassengerFunctionPresenter.kt index 269b8a5f7f..feb5069928 100644 --- a/OCH/mogo-och-charter-passenger/src/m1/java/com/mogo/och/bus/passenger/presenter/BusPassengerFunctionPresenter.kt +++ b/OCH/mogo-och-charter-passenger/src/m1/java/com/mogo/och/bus/passenger/presenter/BusPassengerFunctionPresenter.kt @@ -39,17 +39,13 @@ class BusPassengerFunctionPresenter(view: M1ContainFragment?) : VoiceNotice.showNotice(context.getString(R.string.m1_stop_site_zh), AIAssist.LEVEL1) } OCHPlanningStopSideStatusManager.Status.DOING -> { - + // 正在靠边停车 } - OCHPlanningStopSideStatusManager.Status.Ending -> { - stopSideStatus?.let { - if(it){ - ToastUtils.showShort("靠边停车成功") - }else{ - ToastUtils.showShort("靠边停车失败") - } - } - + OCHPlanningStopSideStatusManager.Status.EndingSuccess -> { + ToastUtils.showShort("靠边停车成功") + } + OCHPlanningStopSideStatusManager.Status.EndingFaile -> { + ToastUtils.showShort("靠边停车失败") } } } diff --git a/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/manager/OCHPlanningStopSideStatusManager.kt b/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/manager/OCHPlanningStopSideStatusManager.kt index a9c427c04b..fbfd3b3079 100644 --- a/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/manager/OCHPlanningStopSideStatusManager.kt +++ b/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/manager/OCHPlanningStopSideStatusManager.kt @@ -15,7 +15,7 @@ object OCHPlanningStopSideStatusManager : IMoGoAutopilotPlanningActionsListener CallerPlanningActionsListenerManager.setListenerHz(TAG,5) } - var stopSiteStatus = StopSite.NOTHING + var stopSiteStatus = Status.NOTHING val M_LISTENERS: ConcurrentHashMap = ConcurrentHashMap() @@ -60,31 +60,49 @@ object OCHPlanningStopSideStatusManager : IMoGoAutopilotPlanningActionsListener when (drivingAction) { MessagePad.DrivingAction.DRIVING_ACTION_STATE_ONE -> { // 表示开始靠边停车 - CallerLogger.d(SceneConstant.M_BUS+ TAG,"开始靠边停车") M_LISTENERS.forEach { val tag = it.key val listener = it.value - listener.onStartAutopilotFailure(Status.START,null,null) - listener.onStartAutopilotFailure(Status.DOING,null,null) + if(stopSiteStatus == Status.START){ + // 靠边停车中 + CallerLogger.d(SceneConstant.M_BUS+ TAG,"靠边停车中") + listener.onStartAutopilotFailure(Status.DOING,null,null) + }else{ + // 开始靠边停车 + stopSiteStatus = Status.START + CallerLogger.d(SceneConstant.M_BUS+ TAG,"开始靠边停车") + listener.onStartAutopilotFailure(Status.START,null,null) + } } } MessagePad.DrivingAction.DRIVING_ACTION_STATE_TWO -> { //表示靠边停车成功 - CallerLogger.d(SceneConstant.M_BUS+ TAG,"靠边停车成功") - stopSiteStatus = StopSite.STOPSITED M_LISTENERS.forEach { val tag = it.key val listener = it.value - listener.onStartAutopilotFailure(Status.Ending,true,null) + if(stopSiteStatus == Status.EndingSuccess){ + // 只响应第一次 + }else{ + stopSiteStatus = Status.EndingSuccess + CallerLogger.d(SceneConstant.M_BUS+ TAG,"靠边停车成功") + listener.onStartAutopilotFailure(Status.EndingSuccess,true,null) + } + } } MessagePad.DrivingAction.DRIVING_ACTION_STATE_THREE -> { //靠边停车失败 - CallerLogger.d(SceneConstant.M_BUS+ TAG,"靠边停车失败") M_LISTENERS.forEach { val tag = it.key val listener = it.value - listener.onStartAutopilotFailure(Status.Ending,false,null) + if(stopSiteStatus==Status.EndingFaile){ + // 只响应第一次 + }else{ + stopSiteStatus = Status.EndingFaile + CallerLogger.d(SceneConstant.M_BUS+ TAG,"靠边停车失败") + listener.onStartAutopilotFailure(Status.EndingFaile,false,null) + } + } } else -> {} @@ -94,11 +112,16 @@ object OCHPlanningStopSideStatusManager : IMoGoAutopilotPlanningActionsListener when (drivingAction) { MessagePad.DrivingAction.DRIVING_ACTION_STATE_ONE -> { // 表示距离前方站点100m - CallerLogger.d(SceneConstant.M_BUS+ TAG,"靠边停车失败_原因:距离前方站点100m") M_LISTENERS.forEach { val tag = it.key val listener = it.value - listener.onStartAutopilotFailure(Status.NOSTART,false,"距离前方站点100m,请稍后再试") + if(stopSiteStatus==Status.NOSTART){ + // 只响应第一次 + }else{ + stopSiteStatus = Status.NOSTART + CallerLogger.d(SceneConstant.M_BUS+ TAG,"靠边停车失败_原因:距离前方站点100m") + listener.onStartAutopilotFailure(Status.NOSTART,false,"距离前方站点100m,请稍后再试") + } } } MessagePad.DrivingAction.DRIVING_ACTION_STATE_TWO -> { @@ -107,41 +130,65 @@ object OCHPlanningStopSideStatusManager : IMoGoAutopilotPlanningActionsListener M_LISTENERS.forEach { val tag = it.key val listener = it.value - listener.onStartAutopilotFailure(Status.NOSTART,false,"距离路口100m,请稍后再试") + if(stopSiteStatus==Status.NOSTART){ + // 只响应第一次 + }else{ + stopSiteStatus = Status.NOSTART + CallerLogger.d(SceneConstant.M_BUS+ TAG,"靠边停车失败_原因:距离路口100m,请稍后再试") + listener.onStartAutopilotFailure(Status.NOSTART,false,"距离路口100m,请稍后再试") + } } } MessagePad.DrivingAction.DRIVING_ACTION_STATE_THREE -> { //正在变道 - CallerLogger.d(SceneConstant.M_BUS+ TAG,"靠边停车失败_原因:正在变道") M_LISTENERS.forEach { val tag = it.key val listener = it.value - listener.onStartAutopilotFailure(Status.NOSTART,false,"因车辆正在变道无法靠边停车,请稍后再试") + if(stopSiteStatus==Status.NOSTART){ + // 只响应第一次 + }else{ + stopSiteStatus = Status.NOSTART + CallerLogger.d(SceneConstant.M_BUS+ TAG,"靠边停车失败_原因:正在变道") + listener.onStartAutopilotFailure(Status.NOSTART,false,"因车辆正在变道无法靠边停车,请稍后再试") + } } } else -> { //未知问题 - CallerLogger.d(SceneConstant.M_BUS+ TAG,"靠边停车失败_原因:未知问题") + M_LISTENERS.forEach { val tag = it.key val listener = it.value - listener.onStartAutopilotFailure(Status.NOSTART,false,"靠边停车失败,请稍后再试") + if(stopSiteStatus==Status.NOSTART){ + // 只响应第一次 + }else{ + stopSiteStatus = Status.NOSTART + CallerLogger.d(SceneConstant.M_BUS+ TAG,"靠边停车失败_原因:未知问题") + listener.onStartAutopilotFailure(Status.NOSTART,false,"靠边停车失败,请稍后再试") + } } } } } MessagePad.ParkScenarioDrivingState.PARK_SENARIO_LANKE_KEEP ->{ - stopSiteStatus = StopSite.LANKE_KEEP + if(stopSiteStatus==Status.NOTHING){ + // 只响应第一次 + }else{ + stopSiteStatus = Status.NOTHING + CallerLogger.d(SceneConstant.M_BUS+ TAG,"进入正常驾驶") + } } else -> {} } } - enum class Status(val code: Int){ - NOSTART(-1), - START(0), - DOING(1), - Ending(2) + enum class Status(){ + START(),// 开始靠边停车 + DOING(),// 正在靠边停车 + EndingSuccess(),// 靠边停车成功 + EndingFaile(),// 靠边停车失败 + NOSTART(),// 没有响应靠边停车 + NOTHING()// 默认状态 } enum class StopSite{