From 0aca34c032de148a6f636f1f6e8b168c18b571a5 Mon Sep 17 00:00:00 2001 From: yangyakun Date: Mon, 13 Nov 2023 19:19:56 +0800 Subject: [PATCH] =?UTF-8?q?[6.2.0]=20[charter]=20[m1]=20[=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E8=87=AA=E9=A9=BE=E7=9A=84=E6=8C=89=E9=92=AE]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IDriverM1ControllerStatusCallback.kt | 4 - .../mogo/och/charter/model/DriverM1Model.kt | 2 - .../view/autopilot/AutopilotStatusView.kt | 191 +++++++----------- .../autopilot/AutopilotStatusViewModel.kt | 168 +++++++++++++-- .../charter_autopilot_0_1_status_bg.xml | 6 +- .../passenger/ui/statusbar/StatusBarView.kt | 3 - .../common/module/debug/DebugDataDispatch.kt | 24 +++ 7 files changed, 256 insertions(+), 142 deletions(-) diff --git a/OCH/charter/driver/src/main/java/com/magic/mogo/och/charter/callback/IDriverM1ControllerStatusCallback.kt b/OCH/charter/driver/src/main/java/com/magic/mogo/och/charter/callback/IDriverM1ControllerStatusCallback.kt index d0826bb748..f9c63e9ea5 100644 --- a/OCH/charter/driver/src/main/java/com/magic/mogo/och/charter/callback/IDriverM1ControllerStatusCallback.kt +++ b/OCH/charter/driver/src/main/java/com/magic/mogo/och/charter/callback/IDriverM1ControllerStatusCallback.kt @@ -1,7 +1,5 @@ package com.magic.mogo.och.charter.callback -import com.mogo.eagle.core.data.map.MogoLocation - /** * Created on 2021/9/10 * @@ -14,6 +12,4 @@ interface IDriverM1ControllerStatusCallback { //启动自驾失败 fun onStartAdasFailure() - //速度更新 - fun updateSpeed(gnssInfo: MogoLocation) } \ No newline at end of file diff --git a/OCH/charter/driver/src/main/java/com/magic/mogo/och/charter/model/DriverM1Model.kt b/OCH/charter/driver/src/main/java/com/magic/mogo/och/charter/model/DriverM1Model.kt index b12b7c0528..a5dee16a6a 100644 --- a/OCH/charter/driver/src/main/java/com/magic/mogo/och/charter/model/DriverM1Model.kt +++ b/OCH/charter/driver/src/main/java/com/magic/mogo/och/charter/model/DriverM1Model.kt @@ -363,8 +363,6 @@ class DriverM1Model { mLongitude = gnssInfo.longitude mLatitude = gnssInfo.latitude - mControllerStatusCallback?.updateSpeed(gnssInfo) - //是否到站的围栏判断 自动驾驶还未触发到站 if (!isArrivedStation) { judgeArrivedStation(gnssInfo) diff --git a/OCH/charter/driver/src/main/java/com/magic/mogo/och/charter/view/autopilot/AutopilotStatusView.kt b/OCH/charter/driver/src/main/java/com/magic/mogo/och/charter/view/autopilot/AutopilotStatusView.kt index 3575f1593e..aa06ab956b 100644 --- a/OCH/charter/driver/src/main/java/com/magic/mogo/och/charter/view/autopilot/AutopilotStatusView.kt +++ b/OCH/charter/driver/src/main/java/com/magic/mogo/och/charter/view/autopilot/AutopilotStatusView.kt @@ -6,15 +6,12 @@ import android.util.AttributeSet import android.view.LayoutInflater import android.view.animation.LinearInterpolator import android.widget.RelativeLayout +import androidx.core.content.ContextCompat import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.findViewTreeViewModelStoreOwner import com.magic.mogo.och.charter.R -import com.magic.mogo.och.charter.constant.CharterConst -import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener -import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager import com.mogo.eagle.core.utilcode.kotlin.onClick import com.mogo.eagle.core.utilcode.util.ResourceUtils -import com.mogo.eagle.core.utilcode.util.UiThreadHandler import kotlinx.android.synthetic.main.charter_autopilot_status.view.bus_autopilot_btn_iv import kotlinx.android.synthetic.main.charter_autopilot_status.view.bus_autopolot_btn_tv @@ -37,130 +34,98 @@ class AutopilotStatusView : RelativeLayout,AutopilotStatusViewModel.IAutopilotSt var viewModel:AutopilotStatusViewModel?=null - var isAnimateRunning = false - - private var autopilotLoadingAnimator: ObjectAnimator? = null + private lateinit var autopilotLoadingAnimator: ObjectAnimator private fun initView() { LayoutInflater.from(context).inflate(R.layout.charter_autopilot_status, this, true) + autopilotLoadingAnimator = ObjectAnimator.ofFloat(bus_autopilot_btn_iv, "rotation", 0f, 360f) + autopilotLoadingAnimator.interpolator = LinearInterpolator() + autopilotLoadingAnimator.repeatCount = -1 //无限循环 + autopilotLoadingAnimator.duration = 1000 //设置持续时间 onClick { - if (!isAnimateRunning) { - viewModel?.restartAutopilot() - } + viewModel?.restartAutopilot() } } - override fun startAutopilotAnimation() { - isAnimateRunning = true - bus_autopolot_btn_tv!!.text = resources.getString(R.string.charter_loading_autopilot_tv) - bus_autopolot_btn_tv!!.setTextColor(resources.getColor(R.color.charter_autopilot_text_color_normal)) -// ctvAutopilotStatus!!.isSelected = false - isClickable = true - bus_autopilot_btn_iv!!.setImageResource(R.drawable.charter_loading_autopilot_icon) - if (autopilotLoadingAnimator == null) { - autopilotLoadingAnimator = - ObjectAnimator.ofFloat(bus_autopilot_btn_iv, "rotation", 0f, 360f) - autopilotLoadingAnimator?.interpolator = LinearInterpolator() - autopilotLoadingAnimator?.repeatCount = -1 //无限循环 - autopilotLoadingAnimator?.duration = 1000 //设置持续时间 - } - autopilotLoadingAnimator!!.start() //动画开始 - startingAutoApilotCountDown() + override fun startAutopilotSuccess(){ + bus_autopilot_btn_iv.setImageResource(R.drawable.charter_right_autopilot_icon) + bus_autopolot_btn_tv.setTextColor(ContextCompat.getColor(context,R.color.charter_autopilot_text_color_normal)) + bus_autopolot_btn_tv.text = resources.getString(R.string.charter_loading_autopilot_success_tv) + isClickable = false } - override fun stopAnimAndUpdateBtnStatus() { - stopAutopilotAnimation() - updateAutopilotStatus(CallerAutoPilotStatusListenerManager.getState()) - } - - override fun onAutopilotStatusChanged(autopilotStatus: Int) { - if (isAnimateRunning && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING - != autopilotStatus - ) { - // 主动开启自动驾驶中,不为2(为0、1)则继续loading - return - } - if (isAnimateRunning) { - stopAnimAndUpdateBtnStatus() - } else { - setAutopilotBtnStatus(autopilotStatus) - } - } - - private fun startingAutoApilotCountDown() { - //10s 若自动驾驶没有开启,则结束动画 - UiThreadHandler.postDelayed({ - //未启动成功做处理 - if (isAnimateRunning) { // 只判断动画是否在进行,根据自动驾驶当前状态去设置自动驾驶状态 - stopAutopilotAnimation() - updateAutopilotStatus(CallerAutoPilotStatusListenerManager.getState()) - } - }, CharterConst.TIMER_START_AUTOPILOT_INTERVAL) - } - - fun updateAutopilotStatus(autopilotStatus: Int) { - if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING - == autopilotStatus - ) { //2 running - bus_autopilot_btn_iv!!.setImageResource(R.drawable.charter_right_autopilot_icon) - bus_autopolot_btn_tv!!.setTextColor(resources.getColor(R.color.charter_autopilot_text_color_normal)) - bus_autopolot_btn_tv!!.text = - resources.getString(R.string.charter_loading_autopilot_success_tv) -// ctvAutopilotStatus!!.isSelected = false - isClickable = false - } else { - bus_autopilot_btn_iv!!.setImageResource(R.drawable.charter_wrong_autopilot_icon) - bus_autopolot_btn_tv!!.setTextColor(resources.getColor(R.color.charter_autopilot_text_color_normal)) - bus_autopolot_btn_tv!!.text = - resources.getString(R.string.charter_loading_autopilot_failure_tv) - isClickable = false -// ctvAutopilotStatus!!.isSelected = false - } - UiThreadHandler.postDelayed({ setAutopilotBtnStatus(autopilotStatus) }, 1000) + override fun startAutopilotFail(){ + bus_autopilot_btn_iv.setImageResource(R.drawable.charter_wrong_autopilot_icon) + bus_autopolot_btn_tv.setTextColor(ContextCompat.getColor(context,R.color.charter_autopilot_text_color_normal)) + bus_autopolot_btn_tv.text = resources.getString(R.string.charter_loading_autopilot_failure_tv) + isClickable = false } fun setAutopilotBtnStatus(autopilotStatus: Int) { - if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE - == autopilotStatus - ) { //0不可用 - bus_autopolot_btn_tv!!.setTextColor(resources.getColor(R.color.charter_autopilot_text_color_disable)) - bus_autopolot_btn_tv!!.text = - resources.getString(R.string.charter_loading_autopilot_runnig_tv) - bus_autopilot_btn_iv!!.setImageResource(R.drawable.charter_disable_autopilot_icon) -// ctvAutopilotStatus!!.isSelected = false - isClickable = true - background = ResourceUtils.getDrawable(R.drawable.charter_autopilot_0_1_status_bg) - }else{ - bus_autopolot_btn_tv!!.setTextColor(resources.getColor(R.color.charter_autopilot_text_color_normal)) - bus_autopilot_btn_iv!!.setImageResource(R.drawable.charter_ic_autopilot) - bus_autopolot_btn_tv!!.text = - resources.getString(R.string.charter_loading_autopilot_runnig_tv) - isClickable = true - if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE == autopilotStatus) { //1可用 - background = - ResourceUtils.getDrawable(R.drawable.charter_autopilot_0_1_status_bg) - } else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == autopilotStatus) { - background = - ResourceUtils.getDrawable(R.drawable.charter_autopilot_2_status_bg) - } else if (IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING == autopilotStatus){ - bus_autopolot_btn_tv!!.text = - resources.getString(R.string.charter_loading_autopilot_pingxing_tv) - isClickable = false - background = ResourceUtils.getDrawable(R.drawable.charter_pingxingjiashi) - } - } + viewModel?.setUIMode(autopilotStatus) } /** - * 停止自动驾驶中间动画 + * 开始动画展示 */ - protected open fun stopAutopilotAnimation() { - if (autopilotLoadingAnimator != null) { - autopilotLoadingAnimator!!.end() - bus_autopilot_btn_iv!!.clearAnimation() - autopilotLoadingAnimator = null - isAnimateRunning = false - } + override fun startAutopilotAnimation() { + bus_autopolot_btn_tv.text = resources.getString(R.string.charter_loading_autopilot_tv) + bus_autopolot_btn_tv.setTextColor(ContextCompat.getColor(context,R.color.charter_autopilot_text_color_normal)) + isClickable = true + bus_autopilot_btn_iv.setImageResource(R.drawable.charter_loading_autopilot_icon) + autopilotLoadingAnimator.start() //动画开始 + } + + /** + * 结束动画展示 + */ + override fun stopAutopilotAnimation() { + autopilotLoadingAnimator.end() + bus_autopilot_btn_iv.clearAnimation() + } + + /** + * 自动驾驶不可用 + */ + override fun autopilotDisable(){ + bus_autopolot_btn_tv.setTextColor(ContextCompat.getColor(context,R.color.charter_autopilot_text_color_disable)) + bus_autopolot_btn_tv.text = resources.getString(R.string.charter_loading_autopilot_runnig_tv) + bus_autopilot_btn_iv.setImageResource(R.drawable.charter_disable_autopilot_icon) + isClickable = true + background = ResourceUtils.getDrawable(R.drawable.charter_autopilot_0_1_status_bg) + } + + /** + * 底盘准备好了可以启动自动驾驶 + */ + override fun canStartAutopilot(){ + bus_autopolot_btn_tv.setTextColor(ContextCompat.getColor(context,R.color.charter_autopilot_text_color_normal)) + bus_autopolot_btn_tv.text = resources.getString(R.string.charter_loading_autopilot_runnig_tv) + bus_autopilot_btn_iv.setImageResource(R.drawable.charter_ic_autopilot) + isClickable = true + background = ResourceUtils.getDrawable(R.drawable.charter_autopilot_0_1_status_bg) + } + + /** + * 自动驾驶中 + */ + override fun inAutopilot(){ + bus_autopolot_btn_tv.setTextColor(ContextCompat.getColor(context,R.color.charter_autopilot_text_color_normal)) + bus_autopolot_btn_tv.text = resources.getString(R.string.charter_loading_autopilot_runnig_tv) + bus_autopilot_btn_iv.setImageResource(R.drawable.charter_ic_autopilot) + isClickable = true + background = ResourceUtils.getDrawable(R.drawable.charter_autopilot_2_status_bg) + } + + /** + * 平行驾驶中 + */ + override fun inRemoteDriver(){ + bus_autopolot_btn_tv.setTextColor(ContextCompat.getColor(context,R.color.charter_autopilot_text_color_normal)) + bus_autopolot_btn_tv.text = resources.getString(R.string.charter_loading_autopilot_pingxing_tv) + bus_autopilot_btn_iv.setImageResource(R.drawable.charter_ic_autopilot) + isClickable = false + background = ResourceUtils.getDrawable(R.drawable.charter_pingxingjiashi) } override fun onAttachedToWindow() { @@ -169,14 +134,12 @@ class AutopilotStatusView : RelativeLayout,AutopilotStatusViewModel.IAutopilotSt ViewModelProvider(it).get(AutopilotStatusViewModel::class.java) } viewModel?.setAutopilotStatusCallback(this) - setAutopilotBtnStatus(CallerAutoPilotStatusListenerManager.getState()) } override fun onDetachedFromWindow() { super.onDetachedFromWindow() } - init { try { initView() diff --git a/OCH/charter/driver/src/main/java/com/magic/mogo/och/charter/view/autopilot/AutopilotStatusViewModel.kt b/OCH/charter/driver/src/main/java/com/magic/mogo/och/charter/view/autopilot/AutopilotStatusViewModel.kt index 8e398b6b57..02637d026d 100644 --- a/OCH/charter/driver/src/main/java/com/magic/mogo/och/charter/view/autopilot/AutopilotStatusViewModel.kt +++ b/OCH/charter/driver/src/main/java/com/magic/mogo/och/charter/view/autopilot/AutopilotStatusViewModel.kt @@ -1,20 +1,33 @@ package com.magic.mogo.och.charter.view.autopilot import androidx.lifecycle.ViewModel +import com.magic.mogo.och.charter.callback.IBeautifyModeCallback import com.magic.mogo.och.charter.callback.IDriverM1ControllerStatusCallback +import com.magic.mogo.och.charter.constant.CharterConst +import com.magic.mogo.och.charter.manager.BeautifyManager import com.magic.mogo.och.charter.model.DriverM1Model -import com.mogo.eagle.core.data.map.MogoLocation +import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS_P import com.mogo.eagle.core.utilcode.util.ThreadUtils +import com.mogo.eagle.core.utilcode.util.ToastUtils +import com.mogo.eagle.core.utilcode.util.UiThreadHandler +import com.mogo.och.common.module.bean.dpmsg.BaseDPMsg +import com.mogo.och.common.module.utils.RxUtils +import java.util.concurrent.atomic.AtomicBoolean class AutopilotStatusViewModel: ViewModel(), IDriverM1ControllerStatusCallback, - IMoGoAutopilotStatusListener { + IMoGoAutopilotStatusListener, IBeautifyModeCallback { private val TAG = AutopilotStatusViewModel::class.java.simpleName private var viewCallback:IAutopilotStatusCallback?=null + private var isAnimateRunning = AtomicBoolean(false) + init { DriverM1Model.get().setControllerStatusCallback(this) @@ -29,40 +42,165 @@ class AutopilotStatusViewModel: ViewModel(), IDriverM1ControllerStatusCallback, fun setAutopilotStatusCallback(viewCallback:IAutopilotStatusCallback){ this.viewCallback = viewCallback CallerAutoPilotStatusListenerManager.addListener(TAG, this) + BeautifyManager.setStatusChangeListener(TAG,this) + this.setUIMode(CallerAutoPilotStatusListenerManager.getState()) } fun restartAutopilot() { // todo 启动自驾必须有订单路线 - if (DriverM1Model.get().isHaveOrder()) { - DriverM1Model.get().restartAutopilot() + if(isAnimateRunning.get()){ + ToastUtils.showShort("启动自驾中") + }else { + if (DriverM1Model.get().isHaveOrder()) { + DriverM1Model.get().restartAutopilot() + CallerLogger.d(M_BUS_P + TAG, "启动自驾") + } +// startOpenAutopilot() // TODO: 需要注释 } } - interface IAutopilotStatusCallback{ - fun startAutopilotAnimation() - fun stopAnimAndUpdateBtnStatus() - fun onAutopilotStatusChanged(state: Int) - } - + /** + * 启动自驾 + */ override fun startOpenAutopilot() { ThreadUtils.runOnUiThread( { + isAnimateRunning.set(true) this.viewCallback?.startAutopilotAnimation() },ThreadUtils.MODE.QUEUE) + //20s 若自动驾驶没有开启,则结束动画 + UiThreadHandler.postDelayed({ + //20s 超时来判断自驾状态 + assertStartAutopiloState(CallerAutoPilotStatusListenerManager.getState()); + }, CharterConst.TIMER_START_AUTOPILOT_INTERVAL) } + /** + * 自驾不符合条件启动(底盘返回的) + */ override fun onStartAdasFailure() { ThreadUtils.runOnUiThread( { - this.viewCallback?.stopAnimAndUpdateBtnStatus() + // 底盘自驾判断无法启动自驾 + assertStartAutopiloState(CallerAutoPilotStatusListenerManager.getState()) },ThreadUtils.MODE.QUEUE) } - override fun updateSpeed(gnssInfo: MogoLocation) { - } - + /** + * 自驾状态回调 + */ override fun onAutopilotStatusResponse(state: Int) { + if (isAnimateRunning.get() && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING != state) { + // 主动开启自动驾驶中,不为2(为0、1)则继续loading + return + } ThreadUtils.runOnUiThread( { - this.viewCallback?.onAutopilotStatusChanged(state) + // 自驾状态变更回调(可能成功可能失败) + assertStartAutopiloState(state) },ThreadUtils.MODE.QUEUE) } + private fun assertStartAutopiloState(state: Int){ + if(isAnimateRunning.get()){ + isAnimateRunning.set(false) + if(state==IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){ + viewCallback?.startAutopilotSuccess() + }else{ + viewCallback?.startAutopilotFail() + } + this.viewCallback?.stopAutopilotAnimation() + RxUtils.createSubscribe(1_000) { + setUIMode(state) + } + }else{ + setUIMode(state) + } + } + + fun setUIMode(state:Int){ + if (FunctionBuildConfig.isDemoMode) {// 美化模式 + viewCallback?.inAutopilot() +// when (CharterPassengerModel.getCurrentOrderStatus()) { +// OrderStatusEnum.Nothing -> {// 初始状态 +// //是否强制绘制引导线 +// FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false +// } +// OrderStatusEnum.NoOrderUnuse -> {//无订单车闲置 +// //是否强制绘制引导线 +// FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false +// } +// OrderStatusEnum.OrderNoLine -> {//有订单无线路 +// //是否强制绘制引导线 +// FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false +// } +// OrderStatusEnum.OrdersWithLine -> {//有订单有线路 是否到站 +// //是否强制绘制引导线 +// CharterPassengerModel.getCurrentOrderInfo()?.let { +// if(it.arriveStatus == OrderInfoResponse.ARRIVED){ +// // 到站不绘制引导线 +// FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false +// return +// } +// if (StopSideManager.stopSiteStatus== StopSideStatus.EndingSuccess) { +// // 靠边停车成功不绘制引导线 +// FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false +// return +// } +// FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true +// } +// } +// OrderStatusEnum.NoOrderUse -> {// 无订单车不闲置 +// //是否强制绘制引导线 +// FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false +// } +// } + }else{ + when (state) { + IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE -> { + // 自动驾驶未就绪 + viewCallback?.autopilotDisable() + } + IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE -> { + // 自动驾驶状态就绪可启动自驾 + viewCallback?.canStartAutopilot() + } + IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> { + // 自动驾驶中 + viewCallback?.inAutopilot() + } + IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING -> { + // 平行驾驶中 + viewCallback?.inRemoteDriver() + } + else -> {} + } + } + } + + override fun dispatchStatus(typeEnum: BeautifyManager.ChangeTypeEnum) { + setUIMode(CallerAutoPilotStatusListenerManager.getState()) + } + + interface IAutopilotStatusCallback{ + /** + * 开始动画 + */ + fun startAutopilotAnimation() + + /** + * 结束动画 + */ + fun stopAutopilotAnimation() + // 进入自动驾驶 + fun inAutopilot() + // 自动驾驶不可用 + fun autopilotDisable() + // 自动驾驶不可用 + fun canStartAutopilot() + // 进入平行驾驶 + fun inRemoteDriver() + // 启动自驾成功 + fun startAutopilotSuccess() + // 启动自驾失败 + fun startAutopilotFail() + } + } \ No newline at end of file diff --git a/OCH/charter/driver/src/main/res/drawable/charter_autopilot_0_1_status_bg.xml b/OCH/charter/driver/src/main/res/drawable/charter_autopilot_0_1_status_bg.xml index 62d3a1173a..8c1d9e64ed 100644 --- a/OCH/charter/driver/src/main/res/drawable/charter_autopilot_0_1_status_bg.xml +++ b/OCH/charter/driver/src/main/res/drawable/charter_autopilot_0_1_status_bg.xml @@ -1,8 +1,6 @@ - - - - + + diff --git a/OCH/charter/passenger/src/main/java/com/mogo/och/charter/passenger/ui/statusbar/StatusBarView.kt b/OCH/charter/passenger/src/main/java/com/mogo/och/charter/passenger/ui/statusbar/StatusBarView.kt index 2a1d837714..75888d6638 100644 --- a/OCH/charter/passenger/src/main/java/com/mogo/och/charter/passenger/ui/statusbar/StatusBarView.kt +++ b/OCH/charter/passenger/src/main/java/com/mogo/och/charter/passenger/ui/statusbar/StatusBarView.kt @@ -15,7 +15,6 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener import com.mogo.eagle.core.function.api.autopilot.IMoGoBatteryManagementSystemListener import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerBatteryManagementSystemListenerManager -import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger @@ -120,7 +119,6 @@ class StatusBarView @JvmOverloads constructor( private fun setAutoPilotStatusInfo(state: Int) { if (FunctionBuildConfig.isDemoMode) {// 美化模式 - val gnssSpeed = CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02().gnssSpeed actv_auto_status.text = "自动驾驶中" when (CharterPassengerModel.getCurrentOrderStatus()) { OrderStatusEnum.Nothing -> {// 初始状态 @@ -137,7 +135,6 @@ class StatusBarView @JvmOverloads constructor( } OrderStatusEnum.OrdersWithLine -> {//有订单有线路 是否到站 //是否强制绘制引导线 - FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = gnssSpeed>0.3 CharterPassengerModel.getCurrentOrderInfo()?.let { if(it.arriveStatus == OrderInfoResponse.ARRIVED){ // 到站不绘制引导线 diff --git a/OCH/mogo-och-common-module/src/debug/java/com/mogo/och/common/module/debug/DebugDataDispatch.kt b/OCH/mogo-och-common-module/src/debug/java/com/mogo/och/common/module/debug/DebugDataDispatch.kt index 06b0a3311b..5b64188751 100644 --- a/OCH/mogo-och-common-module/src/debug/java/com/mogo/och/common/module/debug/DebugDataDispatch.kt +++ b/OCH/mogo-och-common-module/src/debug/java/com/mogo/och/common/module/debug/DebugDataDispatch.kt @@ -2,6 +2,7 @@ package com.mogo.och.common.module.debug import android.content.Intent import android.os.Environment +import android.os.SystemClock import chassis.Chassis import chassis.Chassis.DoorNumber import chassis.VehicleStateOuterClass @@ -10,6 +11,7 @@ import com.google.gson.reflect.TypeToken import com.mogo.eagle.core.data.enums.DataSourceType import com.mogo.eagle.core.data.map.MogoLocation import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotStatisticsListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerChassisDoorStateListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerChassisGnssListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager @@ -24,6 +26,7 @@ import com.mogo.och.common.module.debug.location.MogoLocationExit import com.mogo.och.common.module.manager.distancemamager.TrajectoryAndDistanceManager import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil import com.mogo.och.common.module.view.DebugFloatWindow +import com.zhjt.mogo.adas.data.bean.AutopilotStatistics import mogo.telematics.pad.MessagePad import mogo_msg.MogoReportMsg import java.io.BufferedReader @@ -43,12 +46,16 @@ object DebugDataDispatch { const val carLightSwitch = "lightSwitch" const val trajectoryStation = "trajectoryStation" const val showDebugView = "showDebugView" + const val stateAutopilot = "stateAutopilot" + const val stateAutopilotFail = "stateAutopilotFail" // adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "location" --es path "1111/11111" // adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "globalPath" --es path "sy73.json" // adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "carDoor" --ei doorPostion 1 --ei doorStatus 1 // adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "trunAroud" --es code "IMAP_TRA_LOADED" // adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "lightSwitch" --ei lightPostion 0 +// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "stateAutopilot" --ei autopilotMode 0 --ei autopilotState 0 +// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "stateAutopilotFail" // adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "trajectoryStation" --ef startLon 116.74053643938474 --ef startLat 40.200487993233246 --ef endLon 116.73876977409685 --ef endLat 40.20179054129441 --el lineID 8 @@ -122,6 +129,23 @@ object DebugDataDispatch { val debugFloatWindow = DebugFloatWindow(ActivityUtils.getTopActivity()) debugFloatWindow.showFloatWindow() } + stateAutopilot -> { + val autopilotState = intent.getIntExtra("autopilotState", 0) + val autopilotMode = intent.getIntExtra("autopilotMode", 0) + CallerAutoPilotStatusListenerManager.updateAutoPilotStatus(autopilotState,autopilotMode) + } + stateAutopilotFail -> { + val newBuilder = MogoReportMsg.MogoReportMessage.newBuilder() + newBuilder.code = "100" + newBuilder.msg = "adb 模拟指令" + newBuilder.timestampBuilder.sec = 0 + newBuilder.timestampBuilder.nsec = 0 + newBuilder.src = "2" + newBuilder.level = "" + var autopilotStatistics = + AutopilotStatistics(1, SystemClock.elapsedRealtime(), null, newBuilder.build()) + CallerAutopilotStatisticsListenerManager.invokeAutopilotStatistics(autopilotStatistics) + } else -> {} } }