[CallerAutoPilotStatusListenerManager -> OchAutoPilotStatusListenerManager]
This commit is contained in:
yangyakun
2024-04-19 16:34:41 +08:00
parent 9606e5689d
commit fb2abb828b
27 changed files with 244 additions and 309 deletions

View File

@@ -2,12 +2,12 @@ package com.magic.mogo.och.charter.manager
import com.magic.mogo.och.charter.R
import com.magic.mogo.och.charter.constant.CharterConst
import com.magic.mogo.och.charter.model.DriverM1Model.Companion.get
import com.magic.mogo.och.charter.model.DriverM1Model
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters.AutoPilotLine
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.OperationMsg
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.sendTrajectoryDownloadReq
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
@@ -43,7 +43,7 @@ object CharterTrajectoryManager {
fun syncTrajectoryInfo(lineId: Int, lineName: String) {
mLineId = lineId
mLineName = lineName
val routesResult = get().getBusRoutesResult()
val routesResult = DriverM1Model.get().getBusRoutesResult()
if (LoginStatusManager.isLogin() && routesResult != null) {
d(SceneConstant.M_CHARTER_D + TAG, "syncTrajectoryInfo() start.")
startTrajReqLoop()
@@ -54,6 +54,10 @@ object CharterTrajectoryManager {
}
}
fun onAutopilotGuardian(guardianInfo: MogoReportMessage?, lineId: Long) {
onAutopilotGuardian(guardianInfo)
}
/**
* 接口MEC反馈的常规信息MAP v2.5.0新增轨迹相关信息)
* @param guardianInfo
@@ -63,43 +67,33 @@ object CharterTrajectoryManager {
if ("ISYS_INIT_TRAJECTORY_START" == guardianInfo.code) {
// 1. 轨迹管理_轨迹开始下载本地已有对应轨迹也触发
d(SceneConstant.M_CHARTER_D + TAG, "onAutopilotGuardian() 轨迹开始下载")
// ToastUtils.showShort("轨迹开始下载");
OchChainLogManager.writeChainLog("轨迹监控","onAutopilotGuardian() 轨迹开始下载", eventID = OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY)
stopTrajReqLoop()
} else if ("ISYS_INIT_TRAJECTORY_SUCCESS" == guardianInfo.code) {
// 2. 轨迹管理_轨迹下载成功本地已有对应轨迹也触发
d(SceneConstant.M_CHARTER_D + TAG, "onAutopilotGuardian() 轨迹下载成功")
// ToastUtils.showShort("轨迹下载成功");
OchChainLogManager.writeChainLog("轨迹监控","onAutopilotGuardian() 轨迹下载成功", eventID = OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY)
stopTrajReqLoop()
} else if ("ISYS_INIT_TRAJECTORY_FAILURE" == guardianInfo.code) {
// 3. 轨迹管理_轨迹下载失败本地无对应轨迹
d(
SceneConstant.M_CHARTER_D + TAG, "onAutopilotGuardian() " +
"轨迹下载失败,本地无对应轨迹"
)
d(SceneConstant.M_CHARTER_D + TAG, "onAutopilotGuardian() " + "轨迹下载失败,本地无对应轨迹")
OchChainLogManager.writeChainLog("轨迹监控","onAutopilotGuardian() 轨迹下载失败,本地无对应轨迹", eventID = OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY)
// ToastUtils.showShort("轨迹下载失败,本地无对应轨迹");
} else if ("ISYS_INIT_TRAJECTORY_WARNING" == guardianInfo.code) {
// 4. 轨迹管理_轨迹下载失败本地有对应轨迹认为成功
d(
SceneConstant.M_CHARTER_D + TAG, "onAutopilotGuardian() " +
"轨迹下载失败,本地有对应轨迹,认为成功"
)
d(SceneConstant.M_CHARTER_D + TAG, "onAutopilotGuardian() " + "轨迹下载失败,本地有对应轨迹,认为成功")
OchChainLogManager.writeChainLog("轨迹监控","onAutopilotGuardian() 轨迹下载失败,本地有对应轨迹,认为成功", eventID = OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY)
// ToastUtils.showShort("轨迹下载失败,本地有对应轨迹,认为成功");
} else if ("ISYS_INIT_TRAJECTORY_TIMEOUT" == guardianInfo.code) {
// 5. 轨迹管理_轨迹下载超时
d(SceneConstant.M_CHARTER_D + TAG, "onAutopilotGuardian() 轨迹下载超时")
OchChainLogManager.writeChainLog("轨迹监控","onAutopilotGuardian() 轨迹下载超时", eventID = OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY)
// ToastUtils.showShort("轨迹下载超时");
} else if ("EMAP_ATTITUDE_INIT_FAILED" == guardianInfo.getCode()) {
// 收到ssm的自动驾驶变为ready再次下发轨迹下载.解决域控重启或者102域控启动太早107节点初始化未完成导致的轨迹未进行下载。
d(SceneConstant.M_CHARTER_D + TAG, "onAutopilotGuardian() ssm ready再次发起下载")
OchChainLogManager.writeChainLog("轨迹监控","onAutopilotGuardian() 当前位置距离轨迹距离大于15m", eventID = OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY)
get().getBusOrderResult()?.lineId?.let {
syncTrajectoryInfo(it,
get().getBusOrderResult()?.lineName!!)
DriverM1Model.get().getBusOrderResult()?.lineId?.let {
syncTrajectoryInfo(it, DriverM1Model.get().getBusOrderResult()?.lineName!!)
}
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
@@ -114,7 +108,7 @@ object CharterTrajectoryManager {
}
private fun setupAutoPilotLine() {
val routesResult = get().getBusRoutesResult()
val routesResult = DriverM1Model.get().getBusRoutesResult()
if (routesResult == null) {
e(
SceneConstant.M_CHARTER_D + TAG,
@@ -177,7 +171,7 @@ object CharterTrajectoryManager {
CharterConst.LOOP_DELAY,
CharterConst.LOOP_PERIOD_10S, TimeUnit.MILLISECONDS
)
.map(Function { aLong: Long -> aLong + 1 })
.map { aLong: Long -> aLong + 1 }
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe { aLong: Long ->
@@ -208,24 +202,6 @@ object CharterTrajectoryManager {
return
}
// TODO: 2022/6/24
// test1
// mAutoPilotLine.setLineId(148);
// mAutoPilotLine.setTrajUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/e27c20c2da32481021d934c3ef084536/traj_148.csv");
// mAutoPilotLine.setTrajMd5("e27c20c2da32481021d934c3ef084536");
// mAutoPilotLine.setStopUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/6224c9dd2c0e2bd990c6482c0464de45/stop_148.txt");
// mAutoPilotLine.setStopMd5("6224c9dd2c0e2bd990c6482c0464de45");
// mAutoPilotLine.setTimestamp(1654596000000L); //20220607 18:00
// mAutoPilotLine.setVehicleModel("红旗H9");
// test2
// mAutoPilotLine.setLineId(148);
// mAutoPilotLine.setTrajUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/8654497cf918be461a59c7ad8e22920d/traj_148.csv");
// mAutoPilotLine.setTrajMd5("8654497cf918be461a59c7ad8e22920d");
// mAutoPilotLine.setStopUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/1bb098b244922649bf3e7bada0d3950f/stop_148.txt");
// mAutoPilotLine.setStopMd5("1bb098b244922649bf3e7bada0d3950f");
// mAutoPilotLine.setTimestamp(1654761600000L); //20220609 16:00
// mAutoPilotLine.setVehicleModel("红旗H9");
mAutoPilotLine?.let {
OchChainLogManager.writeChainLog("轨迹监控", "sendTrajectoryReq() 下发轨迹 轨迹id" + it.lineId,
true,
@@ -233,12 +209,8 @@ object CharterTrajectoryManager {
)
}
sendTrajectoryDownloadReq(mAutoPilotLine!!)
d(
SceneConstant.M_CHARTER_D + TAG,
"sendTrajectoryReq(): "
+ GsonUtils.toJson(mAutoPilotLine)
)
CallerAutoPilotControlManager.sendTrajectoryDownloadReq(mAutoPilotLine!!)
d(SceneConstant.M_CHARTER_D + TAG, "sendTrajectoryReq(): ${GsonUtils.toJson(mAutoPilotLine)}")
}
init {

View File

@@ -20,6 +20,9 @@ import com.mogo.och.common.module.biz.login.LoginStatusEnum
import com.mogo.och.common.module.biz.login.LoginStatusManager
import com.mogo.och.common.module.manager.socket.cloud.OCHSocketMessageManager.OPERATION_ROAD_SIDE_TYPE
import com.mogo.och.common.module.manager.autopilot.OCHAdasAbilityManager
import com.mogo.och.common.module.manager.autopilot.autopilot.ArrivedStation
import com.mogo.och.common.module.manager.autopilot.autopilot.IOchAutopilotStatusListener
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotStatusListenerManager
import com.mogo.och.common.module.manager.beautifymode.BeautifyManager
import com.mogo.och.common.module.manager.stopside.OCHPlanningActionsCallback
import com.mogo.och.common.module.manager.stopside.StopSideStatus
@@ -35,7 +38,7 @@ import mogo_msg.MogoReportMsg
class DriverM1Presenter(view: DriverM1Fragment?) :
Presenter<DriverM1Fragment?>(view),
ILoginCallback, DriverM1OrderCallback, ChangeDestCallback,
IMoGoAutopilotStatusListener, OCHPlanningActionsCallback{
IOchAutopilotStatusListener, OCHPlanningActionsCallback{
companion object{
private const val TAG = "DriverM1Presenter"
@@ -50,7 +53,7 @@ class DriverM1Presenter(view: DriverM1Fragment?) :
private fun registerListener() {
//2021.11.1 鹰眼架构整合由IMoGoAutopilotStatusListener逐步替代IMogoAdasOCHCallback接口
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
OchAutoPilotStatusListenerManager.addListener(TAG, this)
StopSideManager.addListener(TAG,this)
DriverM1Model.get().setDriverM1OrderCallback(this)
DriverM1Model.get().setChangeDestCallback(this)
@@ -58,7 +61,7 @@ class DriverM1Presenter(view: DriverM1Fragment?) :
private fun releaseListener() {
StopSideManager.removeListener(TAG)
CallerAutoPilotStatusListenerManager.removeListener(TAG)
OchAutoPilotStatusListenerManager.removeListener(TAG)
DriverM1Model.get().setDriverM1OrderCallback(null)
DriverM1Model.get().setChangeDestCallback(null)
}
@@ -122,12 +125,12 @@ class DriverM1Presenter(view: DriverM1Fragment?) :
DriverM1Model.get().pushOperationalToMsgBox(DateTimeUtil.getCurrentTimeStamp()
,context.getString(R.string.charter_last_15_minutes))
}
override fun onAutopilotGuardian(guardianInfo: MogoReportMsg.MogoReportMessage?) {
CharterTrajectoryManager.onAutopilotGuardian(guardianInfo)
override fun onAutopilotGuardian(guardianInfo: MogoReportMsg.MogoReportMessage?, lineId: Long) {
CharterTrajectoryManager.onAutopilotGuardian(guardianInfo,lineId)
}
override fun onAutopilotArriveAtStation(arrivalNotification: MessagePad.ArrivalNotification?) {
override fun onAutopilotArriveAtStation(arrivalNotification: ArrivedStation?) {
DriverM1Model.get().onAutopilotArriveAtStation()
}

View File

@@ -13,6 +13,8 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.och.common.module.manager.autopilot.autopilot.IOchAutopilotStatusListener
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotStatusListenerManager
import com.mogo.och.common.module.manager.beautifymode.BeautifyManager
import com.mogo.och.common.module.manager.beautifymode.IBeautifyModeCallback
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
@@ -22,7 +24,7 @@ import com.mogo.och.common.module.utils.RxUtils
import java.util.concurrent.atomic.AtomicBoolean
class AutopilotStatusViewModel: ViewModel(), IDriverM1ControllerStatusCallback,
IMoGoAutopilotStatusListener, IBeautifyModeCallback {
IOchAutopilotStatusListener, IBeautifyModeCallback {
private val TAG = AutopilotStatusViewModel::class.java.simpleName
@@ -43,7 +45,7 @@ class AutopilotStatusViewModel: ViewModel(), IDriverM1ControllerStatusCallback,
fun setAutopilotStatusCallback(viewCallback:IAutopilotStatusCallback){
this.viewCallback = viewCallback
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
OchAutoPilotStatusListenerManager.addListener(TAG, this)
BeautifyManager.setStatusChangeListener(TAG,this)
this.setUIMode(CallerAutoPilotStatusListenerManager.getState())
}