[fix]
[null 检测]
This commit is contained in:
yangyakun
2024-11-28 10:38:50 +08:00
parent 0039876866
commit c50b69f14d

View File

@@ -41,18 +41,22 @@ public class BusTrajectoryManager {
return SingletonHolder.INSTANCE;
}
private AutopilotControlParameters mAutoPilotLine = null;
private AutopilotControlParameters mAutopilotControlParameters = null;
private Disposable mSendReqDisposable = null;
public BusTrajectoryManager() {
mAutoPilotLine = new AutopilotControlParameters();
mAutopilotControlParameters = new AutopilotControlParameters();
}
/**
* 同步Bus路线信息
*/
public void syncTrajectoryInfo() {
OchChainLogManager.writeChainLog("轨迹监控","开始或者结束下发轨迹 轨迹id"+mAutoPilotLine.autoPilotLine.getLineId(), true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
if(mAutopilotControlParameters==null||mAutopilotControlParameters.autoPilotLine==null){
OchChainLogManager.writeChainLog("轨迹监控", "开始或者结束下发轨迹 轨迹id" + -1, true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
}else {
OchChainLogManager.writeChainLog("轨迹监控", "开始或者结束下发轨迹 轨迹id" + mAutopilotControlParameters.autoPilotLine.getLineId(), true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
}
if (LoginStatusManager.isLogin() && LineModel.INSTANCE.getCurrentTask() != null
&& LineModel.getStartStationIndex() == 0
&& !OrderModel.isGoingToNextStation()) {
@@ -92,17 +96,21 @@ public class BusTrajectoryManager {
"setupAutoPilotLine(): routesResult is null.");
return;
} else {
mAutoPilotLine = LineManager.INSTANCE.initAutopilotControlParameters();
mAutopilotControlParameters = LineManager.INSTANCE.initAutopilotControlParameters();
}
}
private void clearAutoPilotLine() {
if (mAutoPilotLine == null) return;
mAutoPilotLine = null;
if (mAutopilotControlParameters == null) return;
mAutopilotControlParameters = null;
}
private void startTrajReqLoop() {
OchChainLogManager.writeChainLog("轨迹监控","开始下发轨迹 轨迹id"+mAutoPilotLine.autoPilotLine.getLineId(), true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
if(mAutopilotControlParameters==null||mAutopilotControlParameters.autoPilotLine==null){
OchChainLogManager.writeChainLog("轨迹监控", "开始下发轨迹 轨迹id" + -1, true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
}else {
OchChainLogManager.writeChainLog("轨迹监控", "开始下发轨迹 轨迹id" + mAutopilotControlParameters.autoPilotLine.getLineId(), true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
}
if (mSendReqDisposable != null && !mSendReqDisposable.isDisposed()) {
return;
}
@@ -124,7 +132,11 @@ public class BusTrajectoryManager {
}
public void stopTrajReqLoop() {
OchChainLogManager.writeChainLog("轨迹监控","结束下发轨迹 轨迹id"+mAutoPilotLine.autoPilotLine.getLineId(), true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
if(mAutopilotControlParameters==null||mAutopilotControlParameters.autoPilotLine==null){
OchChainLogManager.writeChainLog("轨迹监控", "结束下发轨迹 轨迹id" + -1, true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
}else {
OchChainLogManager.writeChainLog("轨迹监控", "结束下发轨迹 轨迹id" + mAutopilotControlParameters.autoPilotLine.getLineId(), true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
}
if (mSendReqDisposable != null) {
CallerLogger.d(M_BUS + TAG, "stopTrajReqLoop()");
mSendReqDisposable.dispose();
@@ -134,13 +146,13 @@ public class BusTrajectoryManager {
}
private void sendTrajectoryReq() {
if (mAutoPilotLine == null||mAutoPilotLine.autoPilotLine.getLineId()==-1) {
if(mAutopilotControlParameters==null||mAutopilotControlParameters.autoPilotLine==null||mAutopilotControlParameters.autoPilotLine.getLineId()==-1){
CallerLogger.e(M_BUS + TAG, "sendTrajectoryReq(): mAutoPilotLine is null!!!");
return;
return;
}
OchChainLogManager.writeChainLog("轨迹监控","sendTrajectoryReq() 下发轨迹 轨迹id"+mAutoPilotLine.autoPilotLine.getLineId(), true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
CallerAutoPilotControlManager.INSTANCE.sendTrajectoryDownloadReq(mAutoPilotLine,0);
OchChainLogManager.writeChainLog("轨迹监控","sendTrajectoryReq() 下发轨迹 轨迹id"+ mAutopilotControlParameters.autoPilotLine.getLineId(), true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
CallerAutoPilotControlManager.INSTANCE.sendTrajectoryDownloadReq(mAutopilotControlParameters,0);
CallerLogger.d(M_BUS + TAG, "sendTrajectoryReq(): "
+ GsonUtils.toJson(mAutoPilotLine));
+ GsonUtils.toJson(mAutopilotControlParameters));
}
}