[m1]
[1.0.0] [开门关门超时处理、靠边停车吐司处理、电量处理]
This commit is contained in:
@@ -51,16 +51,6 @@ import java.util.concurrent.ConcurrentHashMap
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
object BusPassengerModel {
|
||||
|
||||
init {
|
||||
AbsMogoApplication.getApp().also { this.mContext = it }
|
||||
initListeners()
|
||||
// TODO: 2022/3/31
|
||||
// 启动轮询查询司机登录状态
|
||||
queryDriverOperationStatus()
|
||||
// 轮询获取车辆线路信息
|
||||
startOrStopOrderLoop(true)
|
||||
}
|
||||
|
||||
private const val TAG = "BusPassengerModel"
|
||||
private const val MSG_QUERY_BUS_P_STATION = 1001
|
||||
// 线路所有的轨迹点
|
||||
@@ -104,6 +94,16 @@ object BusPassengerModel {
|
||||
false
|
||||
})
|
||||
|
||||
fun init(){
|
||||
AbsMogoApplication.getApp().also { this.mContext = it }
|
||||
initListeners()
|
||||
// TODO: 2022/3/31
|
||||
// 启动轮询查询司机登录状态
|
||||
queryDriverOperationStatus()
|
||||
// 轮询获取车辆线路信息
|
||||
startOrStopOrderLoop(true)
|
||||
}
|
||||
|
||||
fun setDriverStatusCallback(callback: IBusPassegerDriverStatusCallback?) {
|
||||
mDriverStatusCallback = callback
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.mogo.och.bus.passenger.presenter
|
||||
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.bus.passenger.ui.BusPassengerFunctionDeviceFragment
|
||||
@@ -18,6 +17,7 @@ class BusPassengerFunctionDevicePresenter(view: BusPassengerFunctionDeviceFragme
|
||||
OCHM1LightAirconditionDoorStatusManager.OCHM1LightAirconditionDoorCallback {
|
||||
|
||||
private var subscribe: Disposable?=null
|
||||
private var subscribeDoorStatus: Disposable?=null
|
||||
companion object{
|
||||
private const val TAG = "BusPassengerFunctionDevicePresenter"
|
||||
}
|
||||
@@ -33,9 +33,9 @@ class BusPassengerFunctionDevicePresenter(view: BusPassengerFunctionDeviceFragme
|
||||
|
||||
override fun onDoorStatusCallback(isOpen: Boolean) {
|
||||
if(isOpen){
|
||||
ToastUtils.showShort("开门状态")
|
||||
ToastUtils.showShort("已开启车门")
|
||||
}else{
|
||||
ToastUtils.showShort("关门状态")
|
||||
ToastUtils.showShort("已关门车门")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,19 @@ class BusPassengerFunctionDevicePresenter(view: BusPassengerFunctionDeviceFragme
|
||||
.subscribe {
|
||||
AdasManager.getInstance().sendRoboBusJinlvM1FrontDoorCmd(0)
|
||||
}
|
||||
AdasManager.getInstance().sendRoboBusJinlvM1FrontDoorCmd(1);
|
||||
AdasManager.getInstance().sendRoboBusJinlvM1FrontDoorCmd(1)
|
||||
subscribeDoorStatus?.let {
|
||||
if (!it.isDisposed) {
|
||||
it.dispose()
|
||||
}
|
||||
}
|
||||
subscribeDoorStatus = Observable.timer(2000, TimeUnit.MILLISECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe {
|
||||
if (!OCHM1LightAirconditionDoorStatusManager.doorStatus.isOpen) {
|
||||
ToastUtils.showShort("车门无法开启,请使用车内物理按钮")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun closeDoor(){
|
||||
@@ -65,9 +77,40 @@ class BusPassengerFunctionDevicePresenter(view: BusPassengerFunctionDeviceFragme
|
||||
AdasManager.getInstance().sendRoboBusJinlvM1FrontDoorCmd(0)
|
||||
}
|
||||
AdasManager.getInstance().sendRoboBusJinlvM1FrontDoorCmd(2)
|
||||
subscribeDoorStatus?.let {
|
||||
if (!it.isDisposed) {
|
||||
it.dispose()
|
||||
}
|
||||
}
|
||||
subscribeDoorStatus = Observable.timer(2000, TimeUnit.MILLISECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe {
|
||||
if (OCHM1LightAirconditionDoorStatusManager.doorStatus.isOpen) {
|
||||
ToastUtils.showShort("车门无法关闭,请使用车内物理按钮")
|
||||
}
|
||||
}
|
||||
}
|
||||
// 靠边停车
|
||||
fun startStopSide() {
|
||||
when (CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state) {
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE -> {// 不可自动驾驶
|
||||
ToastUtils.showShort("设备未就绪请稍等,请稍后再试")
|
||||
}
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE -> {//
|
||||
ToastUtils.showShort("因车辆正在人工驾驶中无法靠边停车,请稍后再试")
|
||||
}
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> {
|
||||
// 靠边停车
|
||||
AdasManager.getInstance().sendPlanningCmd(1)
|
||||
}
|
||||
IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING -> {
|
||||
ToastUtils.showShort("因车辆正在平行驾驶中无法靠边停车,请稍后再试")
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
fun startStopSide() {
|
||||
fun startGo() {
|
||||
when (CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state) {
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE -> {// 不可自动驾驶
|
||||
ToastUtils.showShort("设备未就绪请稍等")
|
||||
@@ -77,10 +120,11 @@ class BusPassengerFunctionDevicePresenter(view: BusPassengerFunctionDeviceFragme
|
||||
// TODO: 查找线路和订单来确定 CallerAutoPilotControlManager.startAutoPilot(parameters);
|
||||
}
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> {
|
||||
// 重新起步
|
||||
AdasManager.getInstance().sendPlanningCmd(2)
|
||||
}
|
||||
IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING -> {
|
||||
ToastUtils.showShort("平行驾驶中请稍后")
|
||||
ToastUtils.showShort("因车辆正在平行驾驶中无法靠边停车,请稍后再试")
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.mogo.och.bus.passenger.presenter
|
||||
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.bus.passenger.ui.BusPassengerFunctionFragment
|
||||
import com.mogo.och.common.module.manager.OCHPlanningStopSideStatusManager
|
||||
import com.mogo.och.common.module.voice.VoiceNotice
|
||||
|
||||
class BusPassengerFunctionPresenter(view: BusPassengerFunctionFragment?) :
|
||||
BusBasePassengerFunctionDevicePresenter<BusPassengerFunctionFragment?>(view),
|
||||
@@ -32,7 +32,7 @@ class BusPassengerFunctionPresenter(view: BusPassengerFunctionFragment?) :
|
||||
ToastUtils.showShort(errorInfo)
|
||||
}
|
||||
OCHPlanningStopSideStatusManager.Status.START -> {
|
||||
ToastUtils.showShort("开始靠边停车")
|
||||
VoiceNotice.showNotice("正在为您靠边停车,请坐稳扶好哟")
|
||||
}
|
||||
OCHPlanningStopSideStatusManager.Status.DOING -> {
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ class BusPassengerPresenter(view: BusPassengerRouteFragment?) :
|
||||
IBusPassengerControllerStatusCallback, IBusPassengerAutopilotPlanningCallback {
|
||||
override fun onCreate(owner: LifecycleOwner) {
|
||||
super.onCreate(owner)
|
||||
BusPassengerModel.init()
|
||||
// 定位监听
|
||||
BusPassengerModel.setControllerStatusCallback(TAG,this)
|
||||
BusPassengerModel.setMoGoAutopilotPlanningListener(this)
|
||||
@@ -53,13 +54,13 @@ class BusPassengerPresenter(view: BusPassengerRouteFragment?) :
|
||||
|
||||
override fun routePlanningToNextStationChanged(meters: Long, timeInSecond: Long) {
|
||||
var dis: String? = "0"
|
||||
var disUnit = "公里"
|
||||
var disUnit = "KM"
|
||||
if (meters > 0) {
|
||||
if (meters / 1000 < 1) {
|
||||
disUnit = "米"
|
||||
disUnit = "M"
|
||||
dis = Math.round(meters.toFloat()).toString()
|
||||
} else {
|
||||
disUnit = "公里"
|
||||
disUnit = "KM"
|
||||
dis = NumberFormatUtil.formatLong(meters.toDouble() / 1000)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,12 +33,13 @@ class BusPassengerFunctionDeviceFragment :
|
||||
//判断自动驾驶状态
|
||||
// 自动驾驶状态中: AdasManager.getInstance().sendPlanningCmd(2);
|
||||
// 没有在自动驾驶中:启动自动驾驶 CallerAutoPilotControlManager.INSTANCE.startAutoPilot(parameters);
|
||||
mPresenter?.startStopSide()
|
||||
mPresenter?.startGo()
|
||||
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
|
||||
}
|
||||
tv_car_setting_stopside.setOnClickListener {
|
||||
// 执行靠边停车 AdasManager.getInstance().sendPlanningCmd(1);
|
||||
AdasManager.getInstance().sendPlanningCmd(1);
|
||||
mPresenter?.startStopSide()
|
||||
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
|
||||
}
|
||||
tv_car_setting_opendoor.onClick {
|
||||
|
||||
@@ -51,6 +51,9 @@ class StatusBarView @JvmOverloads constructor(
|
||||
CallerBatteryManagementSystemListenerManager.addListener(TAG,this)
|
||||
|
||||
updateStatusBarRightView(FunctionBuildConfig.isDemoMode, "demoMode", DemoModeView(this.context))
|
||||
|
||||
progress.progress = 50
|
||||
tv_power_cos.text = "50%"
|
||||
}
|
||||
|
||||
override fun onSkinModeChange(skinMode: Int) {
|
||||
@@ -77,8 +80,16 @@ class StatusBarView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
override fun onBatteryManagementSystemStates(states: ChassisStatesOuterClass.BMSSystemStates) {
|
||||
progress.progress = states.bmsSoc.toInt()
|
||||
tv_power_cos.text = "${states.bmsSoc.toInt()}%"
|
||||
val bmsSoc = states.bmsSoc
|
||||
if(bmsSoc >1){
|
||||
progress.progress = bmsSoc.toInt()
|
||||
tv_power_cos.text = "${bmsSoc.toInt()}%"
|
||||
}else{
|
||||
val currenPower = (bmsSoc * 100).toInt()
|
||||
progress.progress = currenPower
|
||||
tv_power_cos.text = "$currenPower%"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient android:startColor="@android:color/transparent" android:centerColor="@android:color/holo_blue_light" android:endColor="@android:color/transparent"/>
|
||||
<gradient android:startColor="@android:color/transparent" android:centerColor="@android:color/white" android:endColor="@android:color/transparent"/>
|
||||
</shape>
|
||||
@@ -89,7 +89,7 @@ object OCHPlanningStopSideStatusManager : IMoGoAutopilotPlanningActionsListener
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onStartAutopilotFailure(Status.NOSTART,false,"距离前方站点100m")
|
||||
listener.onStartAutopilotFailure(Status.NOSTART,false,"距离前方站点100m,请稍后再试")
|
||||
}
|
||||
}
|
||||
MessagePad.DrivingAction.DRIVING_ACTION_STATE_TWO -> {
|
||||
@@ -97,7 +97,7 @@ object OCHPlanningStopSideStatusManager : IMoGoAutopilotPlanningActionsListener
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onStartAutopilotFailure(Status.NOSTART,false,"距离路口100m")
|
||||
listener.onStartAutopilotFailure(Status.NOSTART,false,"距离路口100m,请稍后再试")
|
||||
}
|
||||
}
|
||||
MessagePad.DrivingAction.DRIVING_ACTION_STATE_THREE -> {
|
||||
@@ -105,7 +105,7 @@ object OCHPlanningStopSideStatusManager : IMoGoAutopilotPlanningActionsListener
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onStartAutopilotFailure(Status.NOSTART,false,"正在变道")
|
||||
listener.onStartAutopilotFailure(Status.NOSTART,false,"因车辆正在变道无法靠边停车,请稍后再试")
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
@@ -113,7 +113,7 @@ object OCHPlanningStopSideStatusManager : IMoGoAutopilotPlanningActionsListener
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onStartAutopilotFailure(Status.NOSTART,false,"正在变道")
|
||||
listener.onStartAutopilotFailure(Status.NOSTART,false,"靠边停车失败,请稍后再试")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user