Merge remote-tracking branch 'origin/dev_robotaxi-d-app-module_251_220125_2.5.1' into dev_robotaxi-d-app-module_251_220125_2.5.1

This commit is contained in:
donghongyu
2022-01-27 18:06:49 +08:00
2 changed files with 62 additions and 4 deletions

View File

@@ -13,6 +13,7 @@ import com.mogo.commons.voice.AIAssist;
import com.mogo.eagle.core.data.BaseData;
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
@@ -558,6 +559,11 @@ public class OchBusOrderModel {
if (currentStationIndex == 0 && !currentStation.isLeaving()){//当前站点是始发站,告诉服务端到达始发站。 如果没有这个节点, 服务器不知道始发站到达状态,订单开始站下在始发站的状态流转有问题
arriveSiteStation(true);
}
// 美化是否开始
if (FunctionBuildConfig.isDemoMode && ((currentStationIndex > 0 && currentStationIndex < stationList.size()-1)
|| (stationList.get(0).isLeaving() || stationList.get(stationList.size() -1).isLeaving()))){//行驶过程中设置美化
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true;
}
if (refreshBusStationsCallback != null){
if (currentStation.isLeaving()){//如果服务端的当前站是leaving状态展示当前站需要+1
currentStationIndex ++;
@@ -680,7 +686,7 @@ public class OchBusOrderModel {
* 行程结束
*/
private void travelOver() {
Logger.d( TAG, "行程结束");
// Logger.d( TAG, "行程结束");
if ( currentStationIndex >= stationList.size() ) {
Logger.e( TAG, "travel over index out of station list" );
@@ -703,7 +709,10 @@ public class OchBusOrderModel {
Logger.e( TAG, "到站异常,取消后续操作结束" );
return;
}
Logger.d( TAG, "到站====" );
if (FunctionBuildConfig.isDemoMode && currentStationIndex == stationList.size() - 1){//到达最后一站结束美化
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false;
}
Logger.d( TAG, "到站====currentStationIndex=" + currentStationIndex);
isGoingToNextStation = false;
// 到达站点后,更新站点状态
// currentStationIndex = getNextStopStation();

View File

@@ -1,6 +1,7 @@
package com.mogo.och.bus.presenter;
import android.location.Location;
import android.os.Looper;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.lifecycle.LifecycleOwner;
@@ -9,6 +10,7 @@ import com.mogo.commons.voice.AIAssist;
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
@@ -23,6 +25,7 @@ import com.mogo.och.bus.fragment.OchBusFragment;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
/**
@@ -34,6 +37,8 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements CarO
private static final String TAG = "OchBusPresenter";
private int currentAutopilotStatus = -1;
private boolean isAnimateRunning = false;
private List<OchBusStation> mStationList = new ArrayList<>();
private int mCurrentStation = 0;
public OchBusPresenter( OchBusFragment view ) {
super( view );
@@ -94,11 +99,31 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements CarO
@Override
public void refreshBusStations(List<OchBusStation> stationList, int currentStation, int nextStation, boolean isArrived) {
mStationList.clear();
mStationList.addAll(stationList);
mCurrentStation = currentStation;
functionDemoModeChange();
Log.d("OchBusOrderModel ="," mCurrentStation ="+mCurrentStation);
if ( mView != null ) {
mView.refreshBusStations( stationList, currentStation, nextStation ,isArrived);
}
}
private void functionDemoModeChange() {
// Log.d("OchBusOrderModel ="," functionDemoModeChange ="+mCurrentStation);
if (FunctionBuildConfig.isDemoMode
&& (
(mCurrentStation > 0 && mCurrentStation < mStationList.size()-1)
|| (
(mCurrentStation == 0 || mCurrentStation == mStationList.size() -1)
&& OchBusOrderModel.getInstance().isGoingToNextStation()
)
)
){
mView.onAutopilotStatusChanged( IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING ,false);
}
}
@Override
public void hideSlidePanel() {
if (mView != null){
@@ -135,11 +160,23 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements CarO
currentAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE;
// 设置UI【自动驾驶】按钮是否展示
mView.onAutopilotEnableChange( true );
// 改变UI自动驾驶状态
mView.onAutopilotStatusChanged( currentAutopilotStatus ,isAnimateRunning);
if ( OchBusOrderModel.getInstance().isGoingToNextStation() ) {
mView.hideSlidePanel();
}
if (FunctionBuildConfig.isDemoMode
&& (
(mCurrentStation > 0 && mCurrentStation < mStationList.size()-1)
|| (
(mCurrentStation == 0 || mCurrentStation == mStationList.size() -1)
&& OchBusOrderModel.getInstance().isGoingToNextStation()
)
)
){
Log.d("OchBusOrderModel=","有美化功能");
return;
}
// 改变UI自动驾驶状态
mView.onAutopilotStatusChanged( currentAutopilotStatus ,isAnimateRunning);
}
break;
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING:
@@ -157,6 +194,18 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements CarO
// AIAssist.getInstance( getContext() ).speakTTSVoice( "自动驾驶已停止,请人工接管" );
}
currentAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE;
if (FunctionBuildConfig.isDemoMode
&& (
(mCurrentStation > 0 && mCurrentStation < mStationList.size()-1)
|| (
(mCurrentStation == 0 || mCurrentStation == mStationList.size() -1)
&& OchBusOrderModel.getInstance().isGoingToNextStation()
)
)
){
Log.d("OchBusOrderModel=","有美化功能");
return;
}
mView.onAutopilotEnableChange( false );
mView.onAutopilotStatusChanged( currentAutopilotStatus ,isAnimateRunning);
}