From 0234b9cc6009219cc8b1be059c4f956302045451 Mon Sep 17 00:00:00 2001 From: wangmingjun Date: Mon, 17 Oct 2022 08:52:47 +0800 Subject: [PATCH] =?UTF-8?q?[2.11.0]=201=E3=80=81bus=20=E5=8F=B8=E6=9C=BA?= =?UTF-8?q?=E7=AB=AF=E6=B7=BB=E5=8A=A0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mogo/och/bus/model/BusOrderModel.java | 82 +++++++++---------- .../mogo/och/bus/presenter/BusPresenter.java | 2 +- 2 files changed, 41 insertions(+), 43 deletions(-) diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/model/BusOrderModel.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/model/BusOrderModel.java index a9600a2ea7..465be06f92 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/model/BusOrderModel.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/model/BusOrderModel.java @@ -347,10 +347,9 @@ public class BusOrderModel { startLon, startLat, location.getLongitude(), location.getLatitude() ); - CallerLogger.INSTANCE.d(M_BUS + TAG,"judgeArrivedStation() distance = " + distance - +" to " + upcomingStation.getName()); - if ( distance <= BusConst.ARRIVE_AT_END_STATION_DISTANCE ) { + CallerLogger.INSTANCE.d(M_BUS + TAG,"行程日志-judgeArrivedStation() distance = " + distance + +" to " + upcomingStation.getName()); onArriveAt(null); //无自动驾驶到站信息传null return; } @@ -473,12 +472,12 @@ public class BusOrderModel { * 服务端返回的OchBusRoutesResult逻辑, 离开站为当前站, 到达下一站后才会将下一站置为当前站, * 车机端展示是离开当前站,下一站设置为当前站, 所以服务端数据回来要做处理,不能直接渲染 */ - private void leaveStationSuccess() { + private void leaveStationSuccess(int leaveIndex) { //开启自动驾驶 2.10.0: 如果自动驾驶状态下开启, 非自动驾驶状态下不开启,需手动点击自动驾驶按钮开启 isGoingToNextStation = true; if (CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState() == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){ - startAutopilot(false); + startAutopilot(false,leaveIndex); }else { firstStartAutopilot = 0; } @@ -488,12 +487,7 @@ public class BusOrderModel { * 开启自动驾驶 * @param isRestart */ - private void startAutopilot(boolean isRestart) { - - if (backgroundCurrentStationIndex +1 > stationList.size() - 1 || !isGoingToNextStation){ - CallerLogger.INSTANCE.e(M_BUS + TAG, "mismatch condition."); - return; - } + private void startAutopilot(boolean isRestart,int leaveIndex) { if (!FunctionBuildConfig.isDemoMode && !OCHAdasAbilityManager.getInstance().getAutopilotAbilityStatus()){ ToastUtils.showLong(OCHAdasAbilityManager.getInstance().getAutopilotUnAbilityReason() + @@ -505,20 +499,17 @@ public class BusOrderModel { triggerStartServiceEvent(isRestart, false); - BusStationBean currentStation = stationList.get( backgroundCurrentStationIndex); - BusStationBean nextStation = stationList.get( backgroundCurrentStationIndex + 1); - - AutopilotControlParameters parameters = initAutopilotControlParameters(); + AutopilotControlParameters parameters = initAutopilotControlParameters(leaveIndex); if (null == parameters) { - CallerLogger.INSTANCE.e(M_BUS + TAG, "AutopilotControlParameters is empty."); + CallerLogger.INSTANCE.e(M_BUS + TAG, "行程日志-AutopilotControlParameters is empty."); return; } CallerAutoPilotManager.INSTANCE.startAutoPilot(parameters); - CallerLogger.INSTANCE.d( M_BUS + TAG, "开启自动驾驶====" + GsonUtil.jsonFromObject(parameters) - +" startLatLon="+currentStation.getName()+",endLatLon="+nextStation.getName() + - "isRestart = " + isRestart); + CallerLogger.INSTANCE.d( M_BUS + TAG, "行程日志-开启自动驾驶====" + GsonUtil.jsonFromObject(parameters) + +" startLatLon="+parameters.startName+",endLatLon="+parameters.endName + + "isRestart = " + isRestart); if (mControllerStatusCallback != null) { mControllerStatusCallback.startOpenAutopilot(); @@ -596,7 +587,7 @@ public class BusOrderModel { new IBusServiceCallback() { @Override public void onSuccess(BaseData o) { - CallerLogger.INSTANCE.d(M_BUS + TAG,"arriveSiteStation success"); + CallerLogger.INSTANCE.d(M_BUS + TAG,"行程日志-arriveSiteStation success"); queryBusRoutes(); ttsTips(String.format(mContext @@ -636,12 +627,12 @@ public class BusOrderModel { @Override public void onSuccess(BaseData o) { isArrivedStation = false; - CallerLogger.INSTANCE.d( M_BUS + TAG, "自动驾驶开启开往下一站====" ); + CallerLogger.INSTANCE.d( M_BUS + TAG, "行程日志-离站成功开往下一站====" ); //需要更改当前站和下一站的状态 然后渲染 startOrStopQueryPassengerWriteOff(false); - leaveStationSuccess(); - leaveTTSTips(finalNextStationName); queryBusRoutes(); + leaveStationSuccess(backgroundCurrentStationIndex); + leaveTTSTips(finalNextStationName); } @Override public void onFail(String failMsg) { @@ -738,7 +729,8 @@ public class BusOrderModel { BusStationBean currentStation = stationList.get(backgroundCurrentStationIndex); CallerLogger.INSTANCE.d( M_BUS + TAG, - "渲染站点信息服务端currentStationIndex="+backgroundCurrentStationIndex + "行程日志-STATION_STATUS_STOPPED-backgroundCurrentStationIndex=" + +backgroundCurrentStationIndex +" isLeaving()="+currentStation.isLeaving()); // 美化是否开始 @@ -795,9 +787,9 @@ public class BusOrderModel { * 在踩刹车、控制方向盘等操作后,会停止自动驾驶,重启自动驾驶的话相当于重新设置自动驾驶目的地 */ public void restartAutopilot() { - CallerLogger.INSTANCE.d( M_BUS + TAG, "重启自动驾驶===" + isGoingToNextStation ); + CallerLogger.INSTANCE.d( M_BUS + TAG, "行程日志-重启自动驾驶===" + isGoingToNextStation ); //只去启动自动驾驶,不再去上报离站 - startAutopilot(firstStartAutopilot >= 1); + startAutopilot(firstStartAutopilot >= 1,-1); } public boolean isRestartAutopilot(){ @@ -851,20 +843,14 @@ public class BusOrderModel { */ public void onArriveAt( MessagePad.ArrivalNotification data){ if ( backgroundCurrentStationIndex +1 > stationList.size() - 1 ) { - CallerLogger.INSTANCE.e( M_BUS + TAG, "到站异常,取消后续操作结束" ); + CallerLogger.INSTANCE.e( M_BUS + TAG, "行程日志-到站异常,取消后续操作结束" ); return; } if (isArrivedStation) return; isArrivedStation = true; -// if (FunctionBuildConfig.isDemoMode && backgroundCurrentStationIndex <= stationList.size() - 1) {//到达一站结束美化 -// closeBeautificationMode(); -// CallerLogger.INSTANCE.d(M_BUS + TAG, "美化模式-ignore:置为false(到最后一站)"); -// } - - - CallerLogger.INSTANCE.d( M_BUS + TAG, "到站====currentStationIndex=" + backgroundCurrentStationIndex); + CallerLogger.INSTANCE.d( M_BUS + TAG, "行程日志-到站==backgroundCurrentStationIndex=" + backgroundCurrentStationIndex); isGoingToNextStation = false; arriveSiteStation(); @@ -927,7 +913,7 @@ public class BusOrderModel { */ private void updateAutopilotControlParameters() { - AutopilotControlParameters parameters = initAutopilotControlParameters(); + AutopilotControlParameters parameters = initAutopilotControlParameters(-1); if (null == parameters){ CallerLogger.INSTANCE.e(M_BUS + TAG, "AutopilotControlParameters is empty."); return; @@ -941,14 +927,25 @@ public class BusOrderModel { CallerAutoPilotStatusListenerManager.INSTANCE.updateAutopilotControlParameters(null); } - private AutopilotControlParameters initAutopilotControlParameters() { - if (backgroundCurrentStationIndex +1 > stationList.size() - 1 || !isGoingToNextStation){ - CallerLogger.INSTANCE.e(M_BUS + TAG, "mismatch condition."); - return null; - } + private AutopilotControlParameters initAutopilotControlParameters(int leaveIndex) { + BusStationBean currentStation = null; + BusStationBean nextStation = null; - BusStationBean currentStation = stationList.get( backgroundCurrentStationIndex); - BusStationBean nextStation = stationList.get( backgroundCurrentStationIndex + 1); + if (leaveIndex < 0){ + if (backgroundCurrentStationIndex +1 > stationList.size() - 1 || !isGoingToNextStation){ + CallerLogger.INSTANCE.e(M_BUS + TAG, "行程日志-mismatch condition1."); + return null; + } + currentStation = stationList.get( backgroundCurrentStationIndex); + nextStation = stationList.get( backgroundCurrentStationIndex + 1); + }else { + if (leaveIndex +1 > stationList.size() - 1 || !isGoingToNextStation){ + CallerLogger.INSTANCE.e(M_BUS + TAG, "行程日志-mismatch condition2."); + return null; + } + currentStation = stationList.get( leaveIndex); + nextStation = stationList.get( leaveIndex + 1); + } AutopilotControlParameters parameters = new AutopilotControlParameters(); parameters.routeID = busRoutesResult.getLineId(); @@ -970,6 +967,7 @@ public class BusOrderModel { busRoutesResult.txtFileUrlDPQP, busRoutesResult.txtFileMd5DPQP, busRoutesResult.contrailSaveTimeDPQP); } + return parameters; } } diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/BusPresenter.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/BusPresenter.java index fdb55d3a36..88aa1860c1 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/BusPresenter.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/BusPresenter.java @@ -156,7 +156,7 @@ public class BusPresenter extends Presenter @Override public void onAutopilotArriveAtStation(MessagePad.ArrivalNotification arrivalNotification) { - CallerLogger.INSTANCE.e( M_BUS + TAG, "onAutopilotArriveAtStation arrive"); + CallerLogger.INSTANCE.e( M_BUS + TAG, "行程日志-onAutopilotArriveAtStation arrive"); BusOrderModel.getInstance().onArriveAt(arrivalNotification); }