From 1fb1d517cedd9ceef5002efc4b901d58222d7938 Mon Sep 17 00:00:00 2001 From: yangyakun Date: Wed, 23 Oct 2024 17:45:04 +0800 Subject: [PATCH] =?UTF-8?q?[6.7.2]=20[fix]=20[m2=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E8=87=AA=E9=A9=BE=E4=BF=A1=E6=81=AF]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../passenger/model/PM2DrivingModel.kt | 63 +++++++++++++++++++ .../passenger/model/PM2DrivingModel.kt | 62 ++++++++++++++++++ 2 files changed, 125 insertions(+) diff --git a/OCH/shuttle/passenger/src/main/java/m2/com/mogo/och/shuttle/passenger/model/PM2DrivingModel.kt b/OCH/shuttle/passenger/src/main/java/m2/com/mogo/och/shuttle/passenger/model/PM2DrivingModel.kt index 9f427ac5d5..590d7b8924 100644 --- a/OCH/shuttle/passenger/src/main/java/m2/com/mogo/och/shuttle/passenger/model/PM2DrivingModel.kt +++ b/OCH/shuttle/passenger/src/main/java/m2/com/mogo/och/shuttle/passenger/model/PM2DrivingModel.kt @@ -12,6 +12,7 @@ import com.mogo.commons.module.intent.IMogoIntentListener import com.mogo.commons.module.intent.IntentManager import com.mogo.commons.voice.AIAssist import com.mogo.commons.voice.IMogoVoiceCmdCallBack +import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.map.MogoLocation import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener @@ -45,6 +46,7 @@ import com.mogo.och.common.module.manager.socket.lan.bean.BusinessType import com.mogo.och.common.module.manager.socket.lan.bean.DPMsgType import com.mogo.och.common.module.manager.socket.lan.bean.TaskDetailsMsg import com.mogo.och.common.module.utils.DateTimeUtil +import com.mogo.och.common.module.utils.PinYinUtil import com.mogo.och.common.module.voice.VoiceNotice import com.mogo.och.common.module.voice.VoiceNotice.showNotice import com.mogo.och.data.bean.BusRoutesResult @@ -441,6 +443,7 @@ class PM2DrivingModel private constructor() { val startStation = mStations[i] val endStation = mStations[i + 1] setTrajectoryStation(startStation, endStation, result.lineId) + updateAutopilotControlParameters(result,i) return } else if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && !station.isLeaving) { d(SceneConstant.M_BUS_P+TAG,"och-rotting--mNextStationIndex = $mNextStationIndex , i = $i") @@ -450,6 +453,7 @@ class PM2DrivingModel private constructor() { } isGoingToNextStation = false mDrivingInfoCallback?.updateStationsInfo(stations as MutableList, i, true) + clearAutopilotControlParameters() return }else{ // d(SceneConstant.M_BUS_P+TAG,"och-rotting--BusStationBean = " + GsonUtils.toJson(station)) @@ -477,4 +481,63 @@ class PM2DrivingModel private constructor() { d(SceneConstant.M_BUS_P + TAG, "清理站点:$type") TrajectoryAndDistanceManager.setStationPoint(null, null, -1L) } + + + + private fun updateAutopilotControlParameters( + busRoutesResult: BusRoutesResult, + leaveIndex: Int + ) { + val parameters = initAutopilotControlParameters(busRoutesResult, leaveIndex) + if (null == parameters) { + CallerLogger.e(SceneConstant.M_BUS_P + TAG, "AutopilotControlParameters is empty.") + return + } + CallerLogger.d(SceneConstant.M_BUS_P + TAG, "AutopilotControlParameters is update.") + CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(parameters) + } + + private fun initAutopilotControlParameters( + busRoutesResult: BusRoutesResult, + leaveIndex: Int + ): AutopilotControlParameters? { + if (busRoutesResult.sites == null) { + return null + } + val stations = busRoutesResult.sites + if (leaveIndex + 1 > stations.size - 1) { + CallerLogger.e(SceneConstant.M_BUS_P + TAG, "行程日志-mismatch condition1.") + return null + } + val currentStation = stations[leaveIndex] + val nextStation = stations[leaveIndex + 1] + val parameters = AutopilotControlParameters() + parameters.routeID = busRoutesResult.lineId + parameters.routeName = busRoutesResult.name + parameters.startName = PinYinUtil.getPinYinHeadChar(currentStation.name) + parameters.endName = PinYinUtil.getPinYinHeadChar(nextStation.name) + parameters.startLatLon = + AutopilotControlParameters.AutoPilotLonLat(currentStation.lat, currentStation.lon) + parameters.endLatLon = + AutopilotControlParameters.AutoPilotLonLat(nextStation.lat, nextStation.lon) + parameters.vehicleType = 10 + if (parameters.autoPilotLine == null) { + parameters.autoPilotLine = AutopilotControlParameters.AutoPilotLine( + busRoutesResult.lineId.toLong(), busRoutesResult.name, + busRoutesResult.csvFileUrl, busRoutesResult.csvFileMd5, + busRoutesResult.txtFileUrl, busRoutesResult.txtFileMd5, + busRoutesResult.contrailSaveTime, busRoutesResult.carModel, + busRoutesResult.csvFileUrlDPQP, busRoutesResult.csvFileMd5DPQP, + busRoutesResult.txtFileUrlDPQP, busRoutesResult.txtFileMd5DPQP, + busRoutesResult.contrailSaveTimeDPQP + ) + } + return parameters + } + + + private fun clearAutopilotControlParameters() { + CallerLogger.d(SceneConstant.M_BUS_P + TAG, "AutopilotControlParameters is clear.") + CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(null) + } } \ No newline at end of file diff --git a/OCH/shuttle/passenger_weaknet/src/main/java/m2/com/mogo/och/shuttle/weaknet/passenger/model/PM2DrivingModel.kt b/OCH/shuttle/passenger_weaknet/src/main/java/m2/com/mogo/och/shuttle/weaknet/passenger/model/PM2DrivingModel.kt index 6621ded080..4183d6765f 100644 --- a/OCH/shuttle/passenger_weaknet/src/main/java/m2/com/mogo/och/shuttle/weaknet/passenger/model/PM2DrivingModel.kt +++ b/OCH/shuttle/passenger_weaknet/src/main/java/m2/com/mogo/och/shuttle/weaknet/passenger/model/PM2DrivingModel.kt @@ -2,11 +2,13 @@ package com.mogo.och.shuttle.weaknet.passenger.model import android.annotation.SuppressLint import android.content.Context +import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.map.MogoLocation import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener 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.CallerLogger.d import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant import com.mogo.eagle.core.utilcode.util.GsonUtils @@ -21,6 +23,7 @@ import com.mogo.och.common.module.manager.socket.lan.LanSocketManager import com.mogo.och.common.module.manager.socket.lan.bean.BusinessType import com.mogo.och.common.module.manager.socket.lan.bean.DPMsgType import com.mogo.och.common.module.manager.socket.lan.bean.TaskDetailsMsg +import com.mogo.och.common.module.utils.PinYinUtil import com.mogo.och.common.module.voice.VoiceNotice.showNotice import com.mogo.och.data.bean.BusRoutesResult import com.mogo.och.data.bean.BusStationBean @@ -227,6 +230,7 @@ object PM2DrivingModel{ val startStation = mStations[i] val endStation = mStations[i + 1] setTrajectoryStation(startStation, endStation, result.lineId) + updateAutopilotControlParameters(result,i) return } else if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && !station.isLeaving) { d(SceneConstant.M_BUS_P+ TAG,"och-rotting--mNextStationIndex = $mNextStationIndex , i = $i") @@ -236,6 +240,7 @@ object PM2DrivingModel{ } isGoingToNextStation = false mDrivingInfoCallback?.updateStationsInfo(stations as MutableList, i, true) + clearAutopilotControlParameters() return }else{ // d(SceneConstant.M_BUS_P+TAG,"och-rotting--BusStationBean = " + GsonUtils.toJson(station)) @@ -263,4 +268,61 @@ object PM2DrivingModel{ d(SceneConstant.M_BUS_P + TAG, "清理站点:$type") TrajectoryAndDistanceManager.setStationPoint(null, null, -1L) } + + private fun updateAutopilotControlParameters( + busRoutesResult: BusRoutesResult, + leaveIndex: Int + ) { + val parameters = initAutopilotControlParameters(busRoutesResult, leaveIndex) + if (null == parameters) { + CallerLogger.e(SceneConstant.M_BUS_P + TAG, "AutopilotControlParameters is empty.") + return + } + CallerLogger.d(SceneConstant.M_BUS_P + TAG, "AutopilotControlParameters is update.") + CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(parameters) + } + + private fun initAutopilotControlParameters( + busRoutesResult: BusRoutesResult, + leaveIndex: Int + ): AutopilotControlParameters? { + if (busRoutesResult.sites == null) { + return null + } + val stations = busRoutesResult.sites + if (leaveIndex + 1 > stations.size - 1) { + CallerLogger.e(SceneConstant.M_BUS_P + TAG, "行程日志-mismatch condition1.") + return null + } + val currentStation = stations[leaveIndex] + val nextStation = stations[leaveIndex + 1] + val parameters = AutopilotControlParameters() + parameters.routeID = busRoutesResult.lineId + parameters.routeName = busRoutesResult.name + parameters.startName = PinYinUtil.getPinYinHeadChar(currentStation.name) + parameters.endName = PinYinUtil.getPinYinHeadChar(nextStation.name) + parameters.startLatLon = + AutopilotControlParameters.AutoPilotLonLat(currentStation.lat, currentStation.lon) + parameters.endLatLon = + AutopilotControlParameters.AutoPilotLonLat(nextStation.lat, nextStation.lon) + parameters.vehicleType = 10 + if (parameters.autoPilotLine == null) { + parameters.autoPilotLine = AutopilotControlParameters.AutoPilotLine( + busRoutesResult.lineId.toLong(), busRoutesResult.name, + busRoutesResult.csvFileUrl, busRoutesResult.csvFileMd5, + busRoutesResult.txtFileUrl, busRoutesResult.txtFileMd5, + busRoutesResult.contrailSaveTime, busRoutesResult.carModel, + busRoutesResult.csvFileUrlDPQP, busRoutesResult.csvFileMd5DPQP, + busRoutesResult.txtFileUrlDPQP, busRoutesResult.txtFileMd5DPQP, + busRoutesResult.contrailSaveTimeDPQP + ) + } + return parameters + } + + + private fun clearAutopilotControlParameters() { + CallerLogger.d(SceneConstant.M_BUS_P + TAG, "AutopilotControlParameters is clear.") + CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(null) + } } \ No newline at end of file