diff --git a/OCH/mogo-och-bus-passenger/src/jinlvvan/java/com/mogo/och/bus/passenger/model/BusPassengerModel.java b/OCH/mogo-och-bus-passenger/src/jinlvvan/java/com/mogo/och/bus/passenger/model/BusPassengerModel.java index 1dc6d54e50..512b33d4dc 100644 --- a/OCH/mogo-och-bus-passenger/src/jinlvvan/java/com/mogo/och/bus/passenger/model/BusPassengerModel.java +++ b/OCH/mogo-och-bus-passenger/src/jinlvvan/java/com/mogo/och/bus/passenger/model/BusPassengerModel.java @@ -27,14 +27,19 @@ 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.api.telematic.IReceivedMsgListener; 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.function.call.telematic.CallerTelematicListenerManager; import com.mogo.eagle.core.network.utils.GsonUtil; import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; +import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant; import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; import com.mogo.eagle.core.utilcode.util.CoordinateUtils; +import com.mogo.eagle.core.utilcode.util.GsonUtils; import com.mogo.eagle.core.utilcode.util.NetworkUtils; import com.mogo.eagle.core.utilcode.util.ToastUtils; import com.mogo.och.bus.passenger.R; @@ -50,9 +55,13 @@ import com.mogo.och.bus.passenger.callback.IBusPassengerRouteLineInfoCallback; import com.mogo.och.bus.passenger.constant.BusPassengerConst; import com.mogo.och.bus.passenger.network.BusPassengerModelLoopManager; import com.mogo.och.bus.passenger.network.BusPassengerServiceManager; +import com.mogo.och.common.module.bean.AppConnectMsg; +import com.mogo.och.common.module.biz.common.socketmessage.OCHSocketMessageManager; +import com.mogo.och.common.module.biz.constant.OchCommonConst; import com.mogo.och.common.module.biz.network.OchCommonServiceCallback; import com.mogo.och.common.module.manager.AbnormalFactorsLoopManager; import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil; +import com.mogo.och.common.module.utils.DateTimeUtil; import org.jetbrains.annotations.NotNull; @@ -283,6 +292,9 @@ public class BusPassengerModel { //2021.11.1 自动驾驶路线规划接口 CallerPlanningRottingListenerManager.INSTANCE.addListener(TAG,moGoAutopilotPlanningListener); + //监听司机端消息 + CallerTelematicListenerManager.INSTANCE.addListener(TAG,mReceivedMsgListener); + AbnormalFactorsLoopManager.INSTANCE.startLoopAbnormalFactors(mContext); } @@ -297,10 +309,27 @@ public class BusPassengerModel { CallerAutoPilotStatusListenerManager.INSTANCE.removeListener(mGoAutopilotStatusListener); CallerPlanningRottingListenerManager.INSTANCE.removeListener(moGoAutopilotPlanningListener); + CallerTelematicListenerManager.INSTANCE.removeListener(TAG); AbnormalFactorsLoopManager.INSTANCE.stopLoopAbnormalFactors(); } + private final IReceivedMsgListener mReceivedMsgListener = new IReceivedMsgListener() { + @Override + public void onReceivedMsg(int type, @NonNull byte[] byteArray) { + if (OchCommonConst.BUSINESS_STRING == type){ + + AppConnectMsg msg = GsonUtils.fromJson(new String(byteArray), AppConnectMsg.class); + Logger.d(SceneConstant.M_BUS_P+TAG,"onReceivedMsg = "+GsonUtils.toJson(msg)); + if (msg.isViewShow()){ //消息盒子显示内容 + OCHSocketMessageManager.INSTANCE.pushAppOperationalMsgBox( + DateTimeUtil.getCurrentTimeStamp(),msg.getMsg(), + OCHSocketMessageManager.OPERATION_SYSTEM); + } + } + } + }; + //监听网络变化,避免启动机器时无网导致无法更新订单信息 private final IMogoIntentListener mNetWorkIntentListener = new IMogoIntentListener() { @Override