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 }