From e638ca32b8ee04f31e87743b0e8255911e92b9c6 Mon Sep 17 00:00:00 2001 From: wangmingjun Date: Fri, 17 Feb 2023 11:16:49 +0800 Subject: [PATCH] =?UTF-8?q?[M2]=20M2=E4=B9=98=E5=AE=A2=E5=B1=8F=E8=BD=A8?= =?UTF-8?q?=E8=BF=B9=EF=BC=8C=E5=89=A9=E4=BD=99=E9=87=8C=E7=A8=8B=E5=92=8C?= =?UTF-8?q?=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bus/passenger/model/PM2DrivingModel.kt | 31 ++++++++++++++++++- .../presenter/PM2DrivingPresenter.kt | 4 ++- .../passenger/ui/PM2DrivingInfoFragment.kt | 8 +++++ 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/model/PM2DrivingModel.kt b/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/model/PM2DrivingModel.kt index a25fb17864..9d33c49fa1 100644 --- a/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/model/PM2DrivingModel.kt +++ b/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/model/PM2DrivingModel.kt @@ -9,9 +9,11 @@ import com.mogo.eagle.core.data.map.MogoLocation import com.mogo.eagle.core.data.telematic.TelematicConstant import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener +import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener 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.autopilot.CallerChassisLocationGCJ02ListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d import com.mogo.eagle.core.utilcode.mogo.logger.Logger @@ -93,7 +95,12 @@ class PM2DrivingModel private constructor() { CallerChassisLocationGCJ02ListenerManager.addListener(TAG, mMapLocationListener) CallerChassisLocationGCJ02ListenerManager.setListenerHz(TAG,2)//设置2hz, 1s返回2次 + //司乘屏通信监听 CallerTelematicListenerManager.addListener(TAG,mReceivedMsgListener) + + //自动驾驶轨迹监听 + CallerPlanningRottingListenerManager.addListener(TAG, moGoAutopilotPlanningListener) + } fun releaseListener(){ @@ -104,6 +111,9 @@ class PM2DrivingModel private constructor() { CallerChassisLocationGCJ02ListenerManager.removeListener(TAG) CallerTelematicListenerManager.removeListener(TAG) + + //自动驾驶轨迹监听 + CallerPlanningRottingListenerManager.removeListener(TAG) } fun setDrivingInfoCallback(drivingInfoCallback : DrivingInfoCallback?){ @@ -139,6 +149,25 @@ class PM2DrivingModel private constructor() { } } + private val moGoAutopilotPlanningListener = object : IMoGoPlanningRottingListener{ + override fun onAutopilotRotting(globalPathResp: MessagePad.GlobalPathResp?) { + val routePoints = globalPathResp?.wayPointsList + if (null != routePoints && routePoints.size > 0) { + updateRoutePoints(routePoints) +// startOrStopRouteAndWipe(true) + } + } + + } + + fun updateRoutePoints(routePoints: List?) { + mRoutePoints.clear() + val latLngModels = CoordinateCalculateRouteUtil + .coordinateConverterWgsToGcjLocations(mContext, routePoints) + mRoutePoints.addAll(latLngModels) + calculateTwoStationsRoute() + } + private fun updateSpeed(mogoLocation: MogoLocation) { // km/h val speedKM = (abs(mogoLocation.gnssSpeed) * 3.6f).toInt() @@ -267,7 +296,7 @@ class PM2DrivingModel private constructor() { return } else if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && !station.isLeaving) { if (i == 0) { - startOrStopRouteAndWipe(false) +// startOrStopRouteAndWipe(false) } mPreRouteIndex = 0 isGoingToNextStation = false diff --git a/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/presenter/PM2DrivingPresenter.kt b/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/presenter/PM2DrivingPresenter.kt index afee8afff1..9f05f422cc 100644 --- a/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/presenter/PM2DrivingPresenter.kt +++ b/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/presenter/PM2DrivingPresenter.kt @@ -55,7 +55,9 @@ class PM2DrivingPresenter(view: PM2DrivingInfoFragment?) : } override fun updateRemainMT(meters: Long, timeInSecond: Long) { - TODO("Not yet implemented") + UiThreadHandler.post { + mView?.updateRemainMT(meters, timeInSecond) //米,秒 + } } override fun changeOperationStatus(loginStatus: Boolean) { diff --git a/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/ui/PM2DrivingInfoFragment.kt b/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/ui/PM2DrivingInfoFragment.kt index 71e3fbb026..8e6a69c909 100644 --- a/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/ui/PM2DrivingInfoFragment.kt +++ b/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/ui/PM2DrivingInfoFragment.kt @@ -136,6 +136,14 @@ class PM2DrivingInfoFragment : BitmapFactory.decodeResource(resources,R.drawable.m2_map_staton_icon),0.5f,0.9f) } + /** + * 剩余里程和时间 + */ + fun updateRemainMT(meters: Long, timeInSecond: Long) { //米。秒 + + + } + companion object { private val TAG = PM2DrivingInfoFragment::class.java.simpleName }