From ee5ff1ce676fc720de35d6622da1662507d5d74c Mon Sep 17 00:00:00 2001 From: yangyakun Date: Mon, 13 Mar 2023 00:23:42 +0800 Subject: [PATCH] =?UTF-8?q?[m1]=20[=E5=88=87=E6=8D=A2=E7=BA=BF=E8=B7=AF?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E6=9D=A1=E4=BB=B6]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../och/bus/passenger/ui/view/LineSiteView.kt | 51 +++++++++++++++++-- .../OCHPlanningStopSideStatusManager.kt | 12 +++++ 2 files changed, 58 insertions(+), 5 deletions(-) diff --git a/OCH/mogo-och-charter-passenger/src/m1/java/com/mogo/och/bus/passenger/ui/view/LineSiteView.kt b/OCH/mogo-och-charter-passenger/src/m1/java/com/mogo/och/bus/passenger/ui/view/LineSiteView.kt index 2561332e9e..ba93bc0949 100644 --- a/OCH/mogo-och-charter-passenger/src/m1/java/com/mogo/och/bus/passenger/ui/view/LineSiteView.kt +++ b/OCH/mogo-och-charter-passenger/src/m1/java/com/mogo/och/bus/passenger/ui/view/LineSiteView.kt @@ -8,7 +8,9 @@ import android.view.View import android.view.animation.LinearInterpolator import androidx.constraintlayout.widget.ConstraintLayout import androidx.recyclerview.widget.LinearLayoutManager +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener import com.mogo.eagle.core.function.api.telematic.IReceivedMsgListener +import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager import com.mogo.eagle.core.utilcode.kotlin.onClick @@ -32,6 +34,7 @@ import com.mogo.och.common.module.bean.dpmsg.ChangeDestMsg import com.mogo.och.common.module.bean.dpmsg.DPMsgType import com.mogo.och.common.module.biz.constant.OchCommonConst import com.mogo.och.common.module.biz.network.OchCommonServiceCallback +import com.mogo.och.common.module.manager.OCHPlanningStopSideStatusManager import kotlinx.android.synthetic.m1.m1_order_lineside.view.* import me.jessyan.autosize.utils.AutoSizeUtils @@ -325,11 +328,49 @@ class LineSiteView @JvmOverloads constructor( if (gnssSpeed < 0.5) { // TODO: 自驾中 需要 靠边停车中、到站 // TODO: 没有自驾中 需要 靠边停车中、到站 - isChangeIngLineAndSite = false - onlyChangeSite(false) - // 可以切换路径 - setEnableLineStatus(true) - queryLineList() + when (CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state) { + IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE -> {// 不可自动驾驶 + // 可以切换路径 + isChangeIngLineAndSite = false + onlyChangeSite(false) + // 可以切换路径 + setEnableLineStatus(true) + queryLineList() + } + IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE -> {// + isChangeIngLineAndSite = false + onlyChangeSite(false) + // 可以切换路径 + setEnableLineStatus(true) + queryLineList() + } + IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> { + // 自动驾驶中 + when (OCHPlanningStopSideStatusManager.stopSiteStatus) { + OCHPlanningStopSideStatusManager.StopSite.NOTHING -> { + isChangeIngLineAndSite = false + onlyChangeSite(false) + // 可以切换路径 + setEnableLineStatus(true) + queryLineList() + } + OCHPlanningStopSideStatusManager.StopSite.STOPSITED -> { + isChangeIngLineAndSite = false + onlyChangeSite(false) + // 可以切换路径 + setEnableLineStatus(true) + queryLineList() + } + OCHPlanningStopSideStatusManager.StopSite.LANKE_KEEP ->{ + ToastUtils.showShort("自动驾驶中无法切换线路") + } + } + } + IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING -> { + ToastUtils.showShort("因车辆正在平行驾驶中无法切换线路") + } + else -> {} + } } else { 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 0450ab7cc1..a9c427c04b 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,6 +15,8 @@ object OCHPlanningStopSideStatusManager : IMoGoAutopilotPlanningActionsListener CallerPlanningActionsListenerManager.setListenerHz(TAG,5) } + var stopSiteStatus = StopSite.NOTHING + val M_LISTENERS: ConcurrentHashMap = ConcurrentHashMap() fun addListener( @@ -69,6 +71,7 @@ object OCHPlanningStopSideStatusManager : IMoGoAutopilotPlanningActionsListener 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 @@ -127,6 +130,9 @@ object OCHPlanningStopSideStatusManager : IMoGoAutopilotPlanningActionsListener } } } + MessagePad.ParkScenarioDrivingState.PARK_SENARIO_LANKE_KEEP ->{ + stopSiteStatus = StopSite.LANKE_KEEP + } else -> {} } } @@ -138,6 +144,12 @@ object OCHPlanningStopSideStatusManager : IMoGoAutopilotPlanningActionsListener Ending(2) } + enum class StopSite{ + NOTHING,// 初始状态 + STOPSITED,// 靠边停车状态 + LANKE_KEEP;// 形式状态 + } + interface OCHPlanningActionsCallback { fun onStartAutopilotFailure(actionStatus:Status,stopSideStatus : Boolean?, errorInfo : String?) }