[6295553 消息接受]
This commit is contained in:
yangyakun
2024-08-12 19:02:08 +08:00
parent c593e5c494
commit 0fbbe47a8f
13 changed files with 120 additions and 240 deletions

View File

@@ -112,9 +112,7 @@ object BusLineModel {
}
override fun onNext(data: List<BusQueryLinesResponse.Result>) {
if (mBusLinesCallback != null) {
mBusLinesCallback!!.onBusLinesChange(data)
}
mBusLinesCallback?.onBusLinesChange(data)
}
})

View File

@@ -23,8 +23,8 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
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.CallerLogger.e
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.i
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
import com.mogo.eagle.core.utilcode.util.CoordinateUtils
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.NetworkUtils
@@ -40,19 +40,14 @@ import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotManage
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotManager.canStartAutoPilotSSM
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotManager.startAutoPilot
import com.mogo.och.common.module.manager.autopilot.line.LineManager.setLineId
import com.mogo.och.common.module.manager.autopilot.location.OchLocationManager.addGCJ02Listener
import com.mogo.och.common.module.manager.autopilot.location.OchLocationManager.removeGCJ02Listener
import com.mogo.och.common.module.manager.autopilot.location.OchLocationManager
import com.mogo.och.common.module.manager.distance.TrajectoryAndDistanceManager
import com.mogo.och.common.module.manager.distance.TrajectoryAndDistanceManager.setStationPoint
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager.writeChainLog
import com.mogo.och.common.module.manager.socket.cloud.AbnormalFactorsLoopManager
import com.mogo.och.common.module.manager.socket.cloud.AbnormalFactorsLoopManager.stopLoopAbnormalFactors
import com.mogo.och.common.module.manager.socket.cloud.IOchOnMessageListener
import com.mogo.och.common.module.manager.socket.cloud.OCHSocketMessageManager
import com.mogo.och.common.module.manager.socket.cloud.OCHSocketMessageManager.pushAppOperationalMsgBox
import com.mogo.och.common.module.manager.socket.cloud.OCHSocketMessageManager.registerSocketMessageListener
import com.mogo.och.common.module.manager.socket.cloud.OCHSocketMessageManager.releaseSocketMessageListener
import com.mogo.och.common.module.manager.socket.cloud.data.SystemMsg
import com.mogo.och.common.module.manager.socket.cloud.action.OperateAction
import com.mogo.och.common.module.manager.socket.lan.LanSocketManager.sendMsgToClient
import com.mogo.och.common.module.manager.socket.lan.bean.AppConnectMsg
import com.mogo.och.common.module.manager.socket.lan.bean.BaseDPMsg
@@ -140,14 +135,14 @@ object OrderModel {
fun init() {
mContext = AbsMogoApplication.getApp()
// 定位监听
addGCJ02Listener(TAG, 5, mMapLocationListener)
OchLocationManager.addGCJ02Listener(TAG, 5, mMapLocationListener)
//开启自驾后 异常信息返回
OCHAdasAbilityManager.getInstance().setAdasStartFailureCallback(mAdasStartFailureListener)
registerSocketMessageListener( //监听运营消息
OCHSocketMessageManager.registerSocketMessageListener( //监听运营消息
OCHSocketMessageManager.msgMonitorType,
mMogoOnMessageListener
OperateAction(true)
)
load()
@@ -184,36 +179,6 @@ object OrderModel {
}
}
private val mMogoOnMessageListener = object : IOchOnMessageListener<SystemMsg> {
override fun target(): Class<SystemMsg> {
return SystemMsg::class.java
}
override fun onMsgReceived(obj: SystemMsg?) {
if (obj == null) {
d(SceneConstant.M_BUS + TAG, "onMsgReceived = null")
return
}
i(SceneConstant.M_BUS + TAG, "onMsgReceived = " + obj.context)
val list: List<Int> = obj.screenList
i(SceneConstant.M_BUS + TAG, "onMsgReceived = " + GsonUtils.toJson(list))
if (list != null && list.contains(1)) { // 1司机端
pushAppOperationalMsgBox(
DateTimeUtil.getCurrentTimeStamp(),
obj.context, OCHSocketMessageManager.OPERATION_SYSTEM
)
}
if (list != null && list.contains(2)) { //乘客屏
val msg = AppConnectMsg(true, false, obj.context, -1)
sendMsgToClient(msg)
}
}
}
@JvmStatic
fun setAdasStatusCallback(callback: IBusADASStatusCallback?) {
this.mADASStatusCallback = callback
@@ -238,16 +203,12 @@ object OrderModel {
fun release() {
// 注销定位监听
removeGCJ02Listener(TAG)
OchLocationManager.removeGCJ02Listener(TAG)
OCHAdasAbilityManager.getInstance().setAdasStartFailureCallback(null)
releaseSocketMessageListener(
OCHSocketMessageManager.msgMonitorType
)
releaseSocketMessageListener(
OCHSocketMessageManager.msgWriteOffPassengerType
)
OCHSocketMessageManager.releaseSocketMessageListener(OCHSocketMessageManager.msgMonitorType)
OCHSocketMessageManager.releaseSocketMessageListener(OCHSocketMessageManager.msgWriteOffPassengerType)
stopLoopAbnormalFactors()
//监听乘客屏发来的消息
@@ -276,15 +237,13 @@ object OrderModel {
}
// 自车定位
private val mMapLocationListener: IMoGoChassisLocationGCJ02Listener =
object : IMoGoChassisLocationGCJ02Listener {
private val mMapLocationListener = object : IMoGoChassisLocationGCJ02Listener {
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
if (null == mogoLocation) return
//是否到站的围栏判断 离站状态并且自动驾驶还未触发到站
if (isGoingToNextStation && !isArrivedStation) {
OCHThreadPoolManager.getsInstance()
.locationExecute { judgeArrivedStation(mogoLocation) }
OCHThreadPoolManager.getsInstance().locationExecute { judgeArrivedStation(mogoLocation) }
}
}
}
@@ -1035,7 +994,7 @@ object OrderModel {
private fun tipStartTask(s: String) {
val tips = ResourcesUtils.getString(R.string.bus_before_tips_s,s)
//展示在运营消息
pushAppOperationalMsgBox(
OCHSocketMessageManager.pushAppOperationalMsgBox(
DateTimeUtil.getCurrentTimeStamp(),
tips, OCHSocketMessageManager.OPERATION_SYSTEM
)
@@ -1170,10 +1129,7 @@ object OrderModel {
if (isArrivedStation) return
d(
SceneConstant.M_BUS + TAG, "行程日志-当前==backgroundCurrentStationIndex="
+ currentStationIndex
)
d(M_BUS + TAG, "行程日志-当前==backgroundCurrentStationIndex=${currentStationIndex}")
arriveSiteStation(type)
}

View File

@@ -39,9 +39,7 @@ class BusLinePresenter(view: BusSwitchLineView?) : Presenter<BusSwitchLineView?>
}
override fun onBusLinesChange(data: List<BusQueryLinesResponse.Result>) {
if (mView != null) {
mView!!.onBusLinesChange(data)
}
mView?.onBusLinesChange(data)
}
override fun onChangeLineIdSuccess() {