[shuttle] 乘客屏增加运营消息

This commit is contained in:
wangmingjun
2023-03-27 15:34:57 +08:00
parent 74d2ebba73
commit 47baed0f22

View File

@@ -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.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener; 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.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.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager; 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.autopilot.CallerPlanningRottingListenerManager;
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager;
import com.mogo.eagle.core.network.utils.GsonUtil; import com.mogo.eagle.core.network.utils.GsonUtil;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils; 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.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.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.CoordinateUtils; 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.NetworkUtils;
import com.mogo.eagle.core.utilcode.util.ToastUtils; import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.och.bus.passenger.R; 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.constant.BusPassengerConst;
import com.mogo.och.bus.passenger.network.BusPassengerModelLoopManager; import com.mogo.och.bus.passenger.network.BusPassengerModelLoopManager;
import com.mogo.och.bus.passenger.network.BusPassengerServiceManager; 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.biz.network.OchCommonServiceCallback;
import com.mogo.och.common.module.manager.AbnormalFactorsLoopManager; import com.mogo.och.common.module.manager.AbnormalFactorsLoopManager;
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil; import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
import com.mogo.och.common.module.utils.DateTimeUtil;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -283,6 +292,9 @@ public class BusPassengerModel {
//2021.11.1 自动驾驶路线规划接口 //2021.11.1 自动驾驶路线规划接口
CallerPlanningRottingListenerManager.INSTANCE.addListener(TAG,moGoAutopilotPlanningListener); CallerPlanningRottingListenerManager.INSTANCE.addListener(TAG,moGoAutopilotPlanningListener);
//监听司机端消息
CallerTelematicListenerManager.INSTANCE.addListener(TAG,mReceivedMsgListener);
AbnormalFactorsLoopManager.INSTANCE.startLoopAbnormalFactors(mContext); AbnormalFactorsLoopManager.INSTANCE.startLoopAbnormalFactors(mContext);
} }
@@ -297,10 +309,27 @@ public class BusPassengerModel {
CallerAutoPilotStatusListenerManager.INSTANCE.removeListener(mGoAutopilotStatusListener); CallerAutoPilotStatusListenerManager.INSTANCE.removeListener(mGoAutopilotStatusListener);
CallerPlanningRottingListenerManager.INSTANCE.removeListener(moGoAutopilotPlanningListener); CallerPlanningRottingListenerManager.INSTANCE.removeListener(moGoAutopilotPlanningListener);
CallerTelematicListenerManager.INSTANCE.removeListener(TAG);
AbnormalFactorsLoopManager.INSTANCE.stopLoopAbnormalFactors(); 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() { private final IMogoIntentListener mNetWorkIntentListener = new IMogoIntentListener() {
@Override @Override