[m1]
[1.0.2] [车速和开关门]
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
package com.mogo.och.bus.passenger.presenter
|
||||
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.bus.passenger.callback.IBusPassengerControllerStatusCallback
|
||||
import com.mogo.och.bus.passenger.model.BusPassengerModel
|
||||
import com.mogo.och.bus.passenger.ui.BusPassengerFunctionDeviceFragment
|
||||
import com.mogo.och.common.module.manager.OCHM1LightAirconditionDoorStatusManager
|
||||
import com.zhidao.support.adas.high.AdasManager
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.Disposable
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
class BusPassengerFunctionDevicePresenter(view: BusPassengerFunctionDeviceFragment?) :
|
||||
BusBasePassengerFunctionDevicePresenter<BusPassengerFunctionDeviceFragment?>(view),
|
||||
@@ -18,6 +18,7 @@ class BusPassengerFunctionDevicePresenter(view: BusPassengerFunctionDeviceFragme
|
||||
|
||||
private var subscribe: Disposable? = null
|
||||
private var subscribeDoorStatus: Disposable? = null
|
||||
private var gnssSpeed =0f
|
||||
|
||||
companion object {
|
||||
private const val TAG = "BusPassengerFunctionDevicePresenter"
|
||||
@@ -26,6 +27,19 @@ class BusPassengerFunctionDevicePresenter(view: BusPassengerFunctionDeviceFragme
|
||||
override fun onCreate(owner: LifecycleOwner) {
|
||||
super.onCreate(owner)
|
||||
OCHM1LightAirconditionDoorStatusManager.addListener(TAG, this)
|
||||
BusPassengerModel.setControllerStatusCallback(TAG,object :
|
||||
IBusPassengerControllerStatusCallback{
|
||||
override fun onVRModeChanged(isVRMode: Boolean) {
|
||||
|
||||
}
|
||||
|
||||
override fun onCarLocationChanged(location: MogoLocation?) {
|
||||
location?.let {
|
||||
gnssSpeed = it.gnssSpeed
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
override fun onDestroy(owner: LifecycleOwner) {
|
||||
@@ -44,6 +58,11 @@ class BusPassengerFunctionDevicePresenter(view: BusPassengerFunctionDeviceFragme
|
||||
}
|
||||
|
||||
fun openDoor() {
|
||||
val canOpenOrCloseDoor = canOpenOrCloseDoor()
|
||||
if(!canOpenOrCloseDoor.isNullOrEmpty()){
|
||||
ToastUtils.showShort(canOpenOrCloseDoor)
|
||||
return
|
||||
}
|
||||
disposeSubscribe(subscribe)
|
||||
subscribe = createSubscribe(1000) {
|
||||
AdasManager.getInstance().sendRoboBusJinlvM1FrontDoorCmd(0)
|
||||
@@ -58,6 +77,11 @@ class BusPassengerFunctionDevicePresenter(view: BusPassengerFunctionDeviceFragme
|
||||
}
|
||||
|
||||
fun closeDoor() {
|
||||
val canOpenOrCloseDoor = canOpenOrCloseDoor()
|
||||
if(!canOpenOrCloseDoor.isNullOrBlank()){
|
||||
ToastUtils.showShort(canOpenOrCloseDoor)
|
||||
return
|
||||
}
|
||||
disposeSubscribe(subscribe)
|
||||
subscribe = createSubscribe(1000) {
|
||||
AdasManager.getInstance().sendRoboBusJinlvM1FrontDoorCmd(0)
|
||||
@@ -71,6 +95,14 @@ class BusPassengerFunctionDevicePresenter(view: BusPassengerFunctionDeviceFragme
|
||||
}
|
||||
}
|
||||
|
||||
private fun canOpenOrCloseDoor():String?{
|
||||
if(gnssSpeed==0f){
|
||||
return null
|
||||
}else{
|
||||
return "车辆正在运行、请稍后再试"
|
||||
}
|
||||
}
|
||||
|
||||
// 靠边停车
|
||||
fun startStopSide() {
|
||||
when (CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state) {
|
||||
|
||||
Reference in New Issue
Block a user