[1.0.0]
[m1] [订单、自动驾驶信息]
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package com.mogo.och.bus.passenger.callback;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*
|
||||
* Model->Presenter回调:状态控制器监听(accOn、adas ui show、voice ui show、push ui show、v2x ui show等等)
|
||||
*/
|
||||
public interface IBusPassengerControllerStatusCallback {
|
||||
// 是否vr map模式
|
||||
void onVRModeChanged(boolean isVRMode);
|
||||
// 自车定位
|
||||
void onCarLocationChanged(MogoLocation location);
|
||||
}
|
||||
@@ -14,13 +14,16 @@ import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
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.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.network.utils.GsonUtil
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils.isPassenger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS_P
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
@@ -29,10 +32,7 @@ import com.mogo.och.bus.passenger.bean.response.BusPassengerOperationStatusRespo
|
||||
import com.mogo.och.bus.passenger.bean.response.BusPassengerRoutesResponse
|
||||
import com.mogo.och.bus.passenger.bean.response.BusPassengerRoutesResult
|
||||
import com.mogo.och.bus.passenger.bean.response.BusPassengerStation
|
||||
import com.mogo.och.bus.passenger.callback.IBusPassegerDriverStatusCallback
|
||||
import com.mogo.och.bus.passenger.callback.IBusPassengerADASStatusCallback
|
||||
import com.mogo.och.bus.passenger.callback.IBusPassengerAutopilotPlanningCallback
|
||||
import com.mogo.och.bus.passenger.callback.IBusPassengerRouteLineInfoCallback
|
||||
import com.mogo.och.bus.passenger.callback.*
|
||||
import com.mogo.och.bus.passenger.constant.BusPassengerConst
|
||||
import com.mogo.och.bus.passenger.net.BusPassengerModelLoopManager
|
||||
import com.mogo.och.bus.passenger.net.BusPassengerServiceManager
|
||||
@@ -43,43 +43,60 @@ import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo_msg.MogoReportMsg
|
||||
import system_master.SystemStatusInfo
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*/
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
object BusPassengerModel {
|
||||
object BusPassengerModel {
|
||||
|
||||
init {
|
||||
AbsMogoApplication.getApp().also { this.mContext = it }
|
||||
initListeners()
|
||||
// TODO: 2022/3/31
|
||||
// 启动轮询查询司机登录状态
|
||||
queryDriverOperationStatus()
|
||||
// 轮询获取车辆线路信息
|
||||
startOrStopOrderLoop(true)
|
||||
}
|
||||
|
||||
private val TAG = "BusPassengerModel"
|
||||
private const val TAG = "BusPassengerModel"
|
||||
private const val MSG_QUERY_BUS_P_STATION = 1001
|
||||
|
||||
// 线路所有的轨迹点
|
||||
private val mRoutePoints: MutableList<MogoLocation> = ArrayList()
|
||||
|
||||
private var mContext: Context? = null
|
||||
private var mADASStatusCallback //Model->Presenter:自动驾驶状态相关
|
||||
: IBusPassengerADASStatusCallback? = null
|
||||
private var mAutopilotPlanningCallback //Model->Presenter:自动驾驶线路规划
|
||||
: IBusPassengerAutopilotPlanningCallback? = null
|
||||
private var mDriverStatusCallback //司机登录状态
|
||||
: IBusPassegerDriverStatusCallback? = null
|
||||
private var mRouteLineInfoCallback // bus路线信息更新
|
||||
: IBusPassengerRouteLineInfoCallback? = null
|
||||
private val mLocation: MogoLocation? = null
|
||||
|
||||
//Model->Presenter:自动驾驶状态相关
|
||||
private var mADASStatusCallback: IBusPassengerADASStatusCallback? = null
|
||||
|
||||
//Model->Presenter:自动驾驶线路规划
|
||||
private var mAutopilotPlanningCallback: IBusPassengerAutopilotPlanningCallback? = null
|
||||
|
||||
//司机登录状态
|
||||
private var mDriverStatusCallback: IBusPassegerDriverStatusCallback? = null
|
||||
|
||||
// bus路线信息更新
|
||||
private var mRouteLineInfoCallback: IBusPassengerRouteLineInfoCallback? = null
|
||||
private val mControllerStatusCallbackMap = ConcurrentHashMap<String, IBusPassengerControllerStatusCallback>()
|
||||
|
||||
// 当前位置坐标
|
||||
private var mLocation: MogoLocation? = null
|
||||
// 当前线路信息
|
||||
private var routesResult: BusPassengerRoutesResult? = null
|
||||
// 当前线路所有站点信息
|
||||
var mStations: MutableList<BusPassengerStation> = ArrayList()
|
||||
private var mNextStationIndex = 0 // 要到达站的index
|
||||
// 要到达站的index
|
||||
private var mNextStationIndex = 0
|
||||
// 两个站点之间的轨迹点
|
||||
private val mTwoStationsRouts: MutableList<MogoLocation> = ArrayList()
|
||||
|
||||
private var mPreRouteIndex = 0
|
||||
// 擦除轨迹的点坐标
|
||||
private var mWipePreIndex = 0
|
||||
private val handler = Handler(Handler.Callback { msg ->
|
||||
mutableMapOf<String, IBusPassengerControllerStatusCallback>()
|
||||
if (msg.what == MSG_QUERY_BUS_P_STATION) {
|
||||
queryDriverOperationStatus()
|
||||
return@Callback true
|
||||
@@ -157,7 +174,7 @@ object BusPassengerModel {
|
||||
queryDriverOperationDelay()
|
||||
return
|
||||
}
|
||||
d(SceneConstant.M_BUS_P + TAG, "queryDriverSiteByCoordinate = %s", msg)
|
||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "queryDriverSiteByCoordinate = %s", msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -176,7 +193,8 @@ object BusPassengerModel {
|
||||
mRouteLineInfoCallback!!.updateStationsInfo(stations, i + 1, false)
|
||||
if (mNextStationIndex != i + 1) {
|
||||
mTwoStationsRouts.clear()
|
||||
startRemainRouteInfo()
|
||||
//开启实时计算剩余距离,剩余时间,预计时间
|
||||
startOrStopCalculateRouteInfo(true)
|
||||
}
|
||||
mNextStationIndex = i + 1
|
||||
return
|
||||
@@ -207,13 +225,22 @@ object BusPassengerModel {
|
||||
fun setADASStatusCallback(callback: IBusPassengerADASStatusCallback?) {
|
||||
mADASStatusCallback = callback
|
||||
}
|
||||
fun setControllerStatusCallback(tag: String?, callback: IBusPassengerControllerStatusCallback?) {
|
||||
if (tag == null || "" == tag) return
|
||||
if (callback == null) {
|
||||
mControllerStatusCallbackMap.remove(tag)
|
||||
return
|
||||
}
|
||||
mControllerStatusCallbackMap[tag] = callback
|
||||
}
|
||||
|
||||
private fun initListeners() {
|
||||
|
||||
// 2021.11.1重构自动驾驶 实现接口 IMoGoAutopilotStatusListener 注册监听 替换IMogoAdasOCHCallback接口
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, mGoAutopilotStatusListener)
|
||||
IntentManager.getInstance().registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener)
|
||||
|
||||
// 定位监听
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, mMapLocationListener)
|
||||
//2021.11.1 自动驾驶路线规划接口
|
||||
CallerPlanningRottingListenerManager.addListener(TAG, moGoAutopilotPlanningListener)
|
||||
startLoopAbnormalFactors(mContext!!)
|
||||
@@ -224,21 +251,33 @@ object BusPassengerModel {
|
||||
.unregisterLifecycleListener(10010)
|
||||
CallerAutoPilotStatusListenerManager.removeListener(mGoAutopilotStatusListener)
|
||||
CallerPlanningRottingListenerManager.removeListener(moGoAutopilotPlanningListener)
|
||||
CallerChassisLocationGCJ02ListenerManager.removeListener(TAG)
|
||||
stopLoopAbnormalFactors()
|
||||
}
|
||||
|
||||
//监听网络变化,避免启动机器时无网导致无法更新订单信息
|
||||
private val mNetWorkIntentListener = IMogoIntentListener { intentStr, intent ->
|
||||
d(SceneConstant.M_BUS_P + TAG, "onIntentReceived = %s", intentStr)
|
||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "onIntentReceived = %s", intentStr)
|
||||
if (ConnectivityManager.CONNECTIVITY_ACTION == intentStr) {
|
||||
if (NetworkUtils.isConnected(mContext)) {
|
||||
queryDriverOperationStatus()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 定位监听
|
||||
private val mMapLocationListener: IMoGoChassisLocationGCJ02Listener = object : IMoGoChassisLocationGCJ02Listener {
|
||||
override fun onChassisLocationGCJ02(gnssInfo: MogoLocation?) {
|
||||
if (null == gnssInfo) return
|
||||
mLocation = gnssInfo
|
||||
for (callback in mControllerStatusCallbackMap.values) {
|
||||
callback.onCarLocationChanged(gnssInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
// 前一个自动驾驶状体
|
||||
@Volatile
|
||||
private var mPreAutoStatus = -1
|
||||
// 自动驾驶状态监听
|
||||
private val mGoAutopilotStatusListener: IMoGoAutopilotStatusListener = object : IMoGoAutopilotStatusListener {
|
||||
override fun onAutopilotIpcConnectStatusChanged(status: Int, reason: String?) {}
|
||||
override fun onAutopilotGuardian(guardianInfo: MogoReportMsg.MogoReportMessage?) {}
|
||||
@@ -286,31 +325,39 @@ object BusPassengerModel {
|
||||
|
||||
override fun onAutopilotStatusRespByQuery(status: SystemStatusInfo.StatusInfo) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取自动驾驶轨迹
|
||||
*/
|
||||
private val moGoAutopilotPlanningListener: IMoGoPlanningRottingListener = object : IMoGoPlanningRottingListener {
|
||||
override fun onAutopilotRotting(routeList: MessagePad.GlobalPathResp?) {
|
||||
d(
|
||||
SceneConstant.M_BUS_P + TAG, "onAutopilotRotting = "
|
||||
+ GsonUtil.jsonFromObject(routeList)
|
||||
)
|
||||
val routePoints = routeList!!.wayPointsList
|
||||
if (null != routePoints && routePoints.size > 0) {
|
||||
updateRoutePoints(routePoints)
|
||||
startToRouteAndWipe()
|
||||
override fun onAutopilotRotting(globalPathResp: MessagePad.GlobalPathResp?) {
|
||||
CallerLogger.d(M_BUS_P + TAG, "onAutopilotRotting = ${GsonUtil.jsonFromObject(globalPathResp)}")
|
||||
globalPathResp?.wayPointsList?.let {
|
||||
if (it.size > 0) {
|
||||
updateRoutePoints(it)
|
||||
startOrStopRouteAndWipe(true)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新轨迹点
|
||||
*/
|
||||
fun updateRoutePoints(routePoints: List<MessagePad.Location?>?) {
|
||||
mRoutePoints.clear()
|
||||
val latLngModels = CoordinateCalculateRouteUtil
|
||||
.coordinateConverterWgsToGcjLocations(mContext, routePoints)
|
||||
val latLngModels = CoordinateCalculateRouteUtil.coordinateConverterWgsToGcjLocations(mContext, routePoints)
|
||||
mRoutePoints.addAll(latLngModels)
|
||||
calculateTwoStationsRoute()
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算两个站点之间的轨迹
|
||||
*/
|
||||
private fun calculateTwoStationsRoute() {
|
||||
//找出前往站对应的轨迹点,拿出两站点的集合
|
||||
d(SceneConstant.M_BUS_P + TAG, "mRoutePoints.size() = " + mRoutePoints.size)
|
||||
CallerLogger.d(M_BUS_P + TAG, "mRoutePoints.size() = " + mRoutePoints.size)
|
||||
if (mRoutePoints.size > 0) {
|
||||
if (mStations.size > 1) { //两个站点及以上要计算两个站点间的轨迹路线
|
||||
if (mNextStationIndex <= mStations.size - 1 && mNextStationIndex - 1 >= 0) {
|
||||
@@ -325,8 +372,8 @@ object BusPassengerModel {
|
||||
val nextRouteIndex = CoordinateCalculateRouteUtil.getArrivedPointIndexNew(
|
||||
currentRouteIndex, mRoutePoints, stationNext.gcjLon, stationNext.gcjLat
|
||||
)
|
||||
d(
|
||||
SceneConstant.M_BUS_P + TAG, "轨迹排查==currentRouteIndex = " + currentRouteIndex
|
||||
CallerLogger.d(
|
||||
M_BUS_P + TAG, "轨迹排查==currentRouteIndex = " + currentRouteIndex
|
||||
+ ", nextRouteIndex = " + nextRouteIndex
|
||||
)
|
||||
if (currentRouteIndex < nextRouteIndex) { //如果找到的next在起点的轨迹前面,直接舍弃这个轨迹,不显示
|
||||
@@ -334,10 +381,6 @@ object BusPassengerModel {
|
||||
}
|
||||
}
|
||||
}
|
||||
// else { //只有两个站点的时候整个路线就是两个站点之间的轨迹
|
||||
// mTwoStationsRouts.clear();
|
||||
// mTwoStationsRouts.addAll(mRoutePoints);
|
||||
// }
|
||||
if (mTwoStationsRouts.size > 0) {
|
||||
val sumLength = CoordinateCalculateRouteUtil.calculateRouteSumLength(mTwoStationsRouts)
|
||||
SharedPrefsMgr.getInstance(mContext!!).putInt(BusPassengerConst.BUS_SP_KEY_ORDER_SUM_DIS, sumLength.toInt())
|
||||
@@ -348,6 +391,9 @@ object BusPassengerModel {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算剩余里程和剩余时间
|
||||
*/
|
||||
fun dynamicCalculateRouteInfo() {
|
||||
//计算当前位置和下一站的剩余点集合
|
||||
//计算剩余点总里程和时间
|
||||
@@ -361,27 +407,31 @@ object BusPassengerModel {
|
||||
mPreRouteIndex = index
|
||||
break
|
||||
}
|
||||
// 只有一个值
|
||||
for (lastPoints in lastPointsMap.values) {
|
||||
d(SceneConstant.M_BUS_P + TAG, "轨迹排查==lastPoints.size() = " + lastPoints.size)
|
||||
CallerLogger.d(M_BUS_P + TAG, "轨迹排查==lastPoints.size() = " + lastPoints.size)
|
||||
var lastSumLength = 0f
|
||||
lastSumLength = if (lastPoints.size == 1) { //只是最后一个点,计算当前位置和最后一个点的距离
|
||||
if (mNextStationIndex <= mStations.size - 1 && mNextStationIndex >= 0) {
|
||||
val stationNext = mStations[mNextStationIndex]
|
||||
CoordinateUtils.calculateLineDistance(
|
||||
stationNext.gcjLon, stationNext.gcjLat,
|
||||
mLocation.longitude, mLocation.latitude
|
||||
)
|
||||
mLocation?.let {
|
||||
lastSumLength = if (lastPoints.size == 1) { //只是最后一个点,计算当前位置和最后一个点的距离
|
||||
if (mNextStationIndex <= mStations.size - 1 && mNextStationIndex >= 0) {
|
||||
val stationNext = mStations[mNextStationIndex]
|
||||
CoordinateUtils.calculateLineDistance(
|
||||
stationNext.gcjLon, stationNext.gcjLat,
|
||||
it.longitude, it.latitude
|
||||
)
|
||||
} else {
|
||||
CoordinateUtils.calculateLineDistance(
|
||||
lastPoints[0].longitude, lastPoints[0].latitude,
|
||||
it.longitude, it.latitude
|
||||
)
|
||||
}
|
||||
} else {
|
||||
CoordinateUtils.calculateLineDistance(
|
||||
lastPoints[0].longitude, lastPoints[0].latitude,
|
||||
mLocation.longitude, mLocation.latitude
|
||||
)
|
||||
CoordinateCalculateRouteUtil.calculateRouteSumLength(lastPoints)
|
||||
}
|
||||
} else {
|
||||
CoordinateCalculateRouteUtil.calculateRouteSumLength(lastPoints)
|
||||
}
|
||||
|
||||
val lastTime = lastSumLength / BusPassengerConst.BUS_AVERAGE_SPEED * 3.6 //秒
|
||||
d(SceneConstant.M_BUS_P + TAG, "轨迹排查==lastSumLength = $lastSumLength")
|
||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "轨迹排查==lastSumLength = $lastSumLength")
|
||||
if (mAutopilotPlanningCallback != null) {
|
||||
mAutopilotPlanningCallback!!.routePlanningToNextStationChanged(lastSumLength.toLong(), lastTime.toLong())
|
||||
}
|
||||
@@ -389,20 +439,11 @@ object BusPassengerModel {
|
||||
}
|
||||
}
|
||||
|
||||
fun startRemainRouteInfo() {
|
||||
//开启实时计算剩余距离,剩余时间,预计时间
|
||||
startOrStopCalculateRouteInfo(true)
|
||||
}
|
||||
|
||||
fun startToRouteAndWipe() {
|
||||
startOrStopRouteAndWipe(true)
|
||||
}
|
||||
|
||||
/**
|
||||
* 实时轨迹擦除
|
||||
* @param isStart
|
||||
*/
|
||||
fun startOrStopRouteAndWipe(isStart: Boolean) {
|
||||
fun startOrStopRouteAndWipe(isStart: Boolean=true) {
|
||||
if (isStart) {
|
||||
BusPassengerModelLoopManager.getInstance().startOrStopRouteAndWipe()
|
||||
} else {
|
||||
@@ -411,16 +452,16 @@ object BusPassengerModel {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算需要擦除的轨迹点信息
|
||||
*/
|
||||
fun loopRouteAndWipe() {
|
||||
if (mRoutePoints.size > 0 && mLocation != null) {
|
||||
// 计算需要擦除的轨迹点位置
|
||||
val haveArrivedIndex = CoordinateCalculateRouteUtil
|
||||
.getArrivedPointIndexNew(
|
||||
mWipePreIndex,
|
||||
mRoutePoints,
|
||||
mLocation
|
||||
)
|
||||
.getArrivedPointIndexNew(mWipePreIndex, mRoutePoints, mLocation)
|
||||
mWipePreIndex = haveArrivedIndex
|
||||
d(SceneConstant.M_BUS_P + TAG, "thread = " + Thread.currentThread().name + " haveArrivedIndex== " + haveArrivedIndex)
|
||||
CallerLogger.d(M_BUS_P + TAG, "thread = " + Thread.currentThread().name + " haveArrivedIndex== " + haveArrivedIndex)
|
||||
if (mAutopilotPlanningCallback != null) {
|
||||
val routePoints = CoordinateCalculateRouteUtil
|
||||
.coordinateConverterLocationToLatLng(mContext, mRoutePoints)
|
||||
@@ -434,7 +475,7 @@ object BusPassengerModel {
|
||||
* @param isStart
|
||||
*/
|
||||
fun startOrStopCalculateRouteInfo(isStart: Boolean) {
|
||||
d(SceneConstant.M_BUS_P + TAG, "startOrStopCalculateRouteInfo() $isStart")
|
||||
CallerLogger.d(M_BUS_P + TAG, "startOrStopCalculateRouteInfo() $isStart")
|
||||
if (isStart) {
|
||||
BusPassengerModelLoopManager.getInstance().startCalculateRouteInfoLoop()
|
||||
} else {
|
||||
@@ -444,11 +485,11 @@ object BusPassengerModel {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 轮询获取线路信息
|
||||
* @param start
|
||||
*/
|
||||
private fun startOrStopOrderLoop(start: Boolean) {
|
||||
d(SceneConstant.M_BUS_P + TAG, "startOrStopOrderLoop() $start")
|
||||
CallerLogger.d(M_BUS_P + TAG, "startOrStopOrderLoop() $start")
|
||||
if (start) {
|
||||
BusPassengerModelLoopManager.getInstance().startQueryDriverLineLoop()
|
||||
} else {
|
||||
|
||||
@@ -148,13 +148,10 @@ public class BusPassengerModelLoopManager {
|
||||
}
|
||||
|
||||
private Observable<Integer> startLoopCalculateRouteInfo(){
|
||||
return Observable.create(new ObservableOnSubscribe<Integer>() {
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter<Integer> emitter) throws Exception {
|
||||
if (emitter.isDisposed()) return;
|
||||
BusPassengerModel.INSTANCE.dynamicCalculateRouteInfo();
|
||||
emitter.onComplete();
|
||||
}
|
||||
return Observable.create(emitter -> {
|
||||
if (emitter.isDisposed()) return;
|
||||
BusPassengerModel.INSTANCE.dynamicCalculateRouteInfo();
|
||||
emitter.onComplete();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,23 +68,22 @@ class BusPassengerFunctionDevicePresenter(view: BusPassengerFunctionDeviceFragme
|
||||
}
|
||||
|
||||
fun startStopSide() {
|
||||
AdasManager.getInstance().sendPlanningCmd(2)
|
||||
// when (CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state) {
|
||||
// IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE -> {// 不可自动驾驶
|
||||
// ToastUtils.showShort("设备未就绪请稍等")
|
||||
// }
|
||||
// IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE -> {//
|
||||
// ToastUtils.showShort("启动自动驾驶中")
|
||||
// // TODO: 查找线路和订单来确定 CallerAutoPilotControlManager.startAutoPilot(parameters);
|
||||
// }
|
||||
// IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> {
|
||||
// AdasManager.getInstance().sendPlanningCmd(2)
|
||||
// }
|
||||
// IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> {
|
||||
// ToastUtils.showShort("平行驾驶中请稍后")
|
||||
// }
|
||||
// else -> {}
|
||||
// }
|
||||
when (CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state) {
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE -> {// 不可自动驾驶
|
||||
ToastUtils.showShort("设备未就绪请稍等")
|
||||
}
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE -> {//
|
||||
ToastUtils.showShort("启动自动驾驶中")
|
||||
// TODO: 查找线路和订单来确定 CallerAutoPilotControlManager.startAutoPilot(parameters);
|
||||
}
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> {
|
||||
AdasManager.getInstance().sendPlanningCmd(2)
|
||||
}
|
||||
IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING -> {
|
||||
ToastUtils.showShort("平行驾驶中请稍后")
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,6 +21,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.ClickUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import com.mogo.och.bus.passenger.bean.Temperature
|
||||
import com.mogo.och.bus.passenger.presenter.BusPassengerFunctionSoftPresenter
|
||||
@@ -96,9 +97,6 @@ class BusPassengerFunctionSoftFragment :
|
||||
}
|
||||
// 模式调节
|
||||
rg_setting_pattern.setOnCheckedChangeListener { group, checkedId ->
|
||||
if (!tv_aircondition_switch.isChecked) {
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "调节模式")
|
||||
when (checkedId) {
|
||||
R.id.rb_pattern_heating -> {
|
||||
@@ -106,6 +104,9 @@ class BusPassengerFunctionSoftFragment :
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
|
||||
if (!tv_aircondition_switch.isChecked) {
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
openHeater()
|
||||
}
|
||||
R.id.rb_pattern_automatic->{
|
||||
@@ -113,6 +114,9 @@ class BusPassengerFunctionSoftFragment :
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
|
||||
if (!tv_aircondition_switch.isChecked) {
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
openAircondition()
|
||||
}
|
||||
R.id.rb_pattern_refrigeration->{
|
||||
@@ -120,6 +124,9 @@ class BusPassengerFunctionSoftFragment :
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
|
||||
if (!tv_aircondition_switch.isChecked) {
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
openAircondition()
|
||||
}
|
||||
R.id.rb_pattern_ventilate->{
|
||||
@@ -127,6 +134,9 @@ class BusPassengerFunctionSoftFragment :
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
|
||||
if (!tv_aircondition_switch.isChecked) {
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
openAircondition()
|
||||
}
|
||||
else -> {
|
||||
@@ -137,9 +147,6 @@ class BusPassengerFunctionSoftFragment :
|
||||
|
||||
// 风速调节
|
||||
rg_setting_windspeed.setOnCheckedChangeListener { group, checkedId ->
|
||||
if (!tv_aircondition_switch.isChecked) {
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
when (checkedId) {
|
||||
R.id.rb_wind_speed_low-> {
|
||||
if(!rb_wind_speed_low.isPressed){
|
||||
@@ -159,6 +166,9 @@ class BusPassengerFunctionSoftFragment :
|
||||
else -> {}
|
||||
}
|
||||
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
|
||||
if (!tv_aircondition_switch.isChecked) {
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
if (rg_setting_pattern.checkedRadioButtonId == R.id.rb_pattern_heating) {//暖风机
|
||||
openHeater()
|
||||
} else {
|
||||
@@ -204,6 +214,13 @@ class BusPassengerFunctionSoftFragment :
|
||||
|
||||
}
|
||||
}
|
||||
rv_aircondition_temperature.post {
|
||||
rv_aircondition_temperature.getChildAt(0)?.let {
|
||||
if (it is TextView) {
|
||||
it.setTextColor(Color.WHITE)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getData(): MutableList<Temperature> {
|
||||
@@ -275,7 +292,9 @@ class BusPassengerFunctionSoftFragment :
|
||||
adapter.data.forEach {
|
||||
if (it.value == temperatureCmd) {
|
||||
rv_aircondition_temperature.tag = touchTag
|
||||
rv_aircondition_temperature.smoothScrollToPosition(it.index)
|
||||
UiThreadHandler.postDelayed({
|
||||
rv_aircondition_temperature.smoothScrollToPosition(it.index)
|
||||
},500)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user