[M2] M2乘客屏轨迹,剩余里程和时间

This commit is contained in:
wangmingjun
2023-02-17 11:16:49 +08:00
parent 3b079703e4
commit e638ca32b8
3 changed files with 41 additions and 2 deletions

View File

@@ -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<MessagePad.Location?>?) {
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

View File

@@ -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) {

View File

@@ -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
}