rc
This commit is contained in:
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@@ -89,6 +89,7 @@
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
<option name="useQualifiedModuleNames" value="true" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
@@ -108,17 +108,19 @@ public class OchBusFragment extends BaseOchFragment<OchBusFragment, OchBusPresen
|
||||
tvStationName.setText(station.getSiteName());
|
||||
tvStationNotice.setText("下一站");
|
||||
currPos = i;
|
||||
onAutopilotStatusChanged(true);
|
||||
// onAutopilotStatusChanged(true);
|
||||
break;
|
||||
} else if (station.getIsCurrentSite() == OchBusConst.STATION_STATUS_STOPED) {
|
||||
currPos = i;
|
||||
tvStationNotice.setText("当前车站");
|
||||
tvStationName.setText(station.getSiteName());
|
||||
onAutopilotStatusChanged(false);
|
||||
// onAutopilotStatusChanged(false);
|
||||
if (i == stationList.size() - 1) {
|
||||
showNotice("行程结束,请携带好随身物品\n注意侧后方来车\n感谢体验蘑菇智行自动驾驶车!");
|
||||
tvStationNotice.setText("终点");
|
||||
showSlidePanle("单程结束");
|
||||
} else if (i == 0) {
|
||||
hideNotice();
|
||||
showSlidePanle("准备出发");
|
||||
} else {
|
||||
showNotice("行程结束,请携带好随身物品\n注意侧后方来车\n感谢体验蘑菇智行自动驾驶车!");
|
||||
|
||||
@@ -10,10 +10,12 @@ import com.mogo.commons.network.Utils;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
import com.mogo.och.OCHConstants;
|
||||
import com.mogo.och.bus.bean.OchBusLeaveStationRequest;
|
||||
import com.mogo.och.bus.bean.OchBusRoutesRequest;
|
||||
import com.mogo.och.bus.bean.OchBusRoutesResponse;
|
||||
import com.mogo.och.bus.bean.OchBusStation;
|
||||
import com.mogo.och.bus.constant.OchBusConst;
|
||||
import com.mogo.och.bus.fragment.OchBusFragment;
|
||||
import com.mogo.och.bus.net.IOchBusApiService;
|
||||
import com.mogo.service.adas.IMogoAdasOCHCallback;
|
||||
@@ -86,6 +88,16 @@ public class OchBusPresenter extends Presenter<OchBusFragment> implements IMogoA
|
||||
if (mView != null && o.getResult() != null && o.getResult().getSite() != null) {
|
||||
stationList.clear();
|
||||
stationList.addAll(o.getResult().getSite());
|
||||
for (int i = 0;i<stationList.size();i++) {
|
||||
OchBusStation s = stationList.get(i);
|
||||
if (s.getIsCurrentSite() == STATION_STATUS_ARRIVING || s.getIsCurrentSite() == STATION_STATUS_LEAVING) {
|
||||
isGoingToNextStation = true;
|
||||
mView.hideSlidePanel();
|
||||
}
|
||||
if (s.getIsCurrentSite() == STATION_STATUS_LEAVING) {
|
||||
currentStationIndex = i;
|
||||
}
|
||||
}
|
||||
refreshCurrentStation();
|
||||
mView.refreshBusStations(stationList);
|
||||
}
|
||||
@@ -150,6 +162,41 @@ public class OchBusPresenter extends Presenter<OchBusFragment> implements IMogoA
|
||||
currentAutopilot.vehicleType = VEHICAL_TYPE;
|
||||
Logger.d(TAG, "开启自动驾驶====" + currentAutopilot);
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().aiCloudToAdasData(currentAutopilot);
|
||||
|
||||
if (mView != null) {
|
||||
mView.refreshBusStations(stationList);
|
||||
}
|
||||
mView.hideSlidePanel();
|
||||
mView.hideNotice();
|
||||
|
||||
if (isGoingToNextStation) {
|
||||
// 为了避免恢复自动驾驶时重复的接口请求
|
||||
return;
|
||||
}
|
||||
isGoingToNextStation = true;
|
||||
RequestBody request = RequestBody.create(MediaType.get("application/json"), GsonUtil.jsonFromObject(new OchBusLeaveStationRequest(Utils.getSn(), stationList.get(currentStationIndex).getSiteId())));
|
||||
MogoApisHandler.getInstance().getApis().getNetworkApi()
|
||||
.create(IOchBusApiService.class, HostConst.OCH_DOMAIN)
|
||||
.leaveStation(request).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(getContext())) {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
Logger.d(TAG, "leave station error: " + message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.e(TAG, e, "leave station exception");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void refreshCurrentStation() {
|
||||
@@ -182,6 +229,7 @@ public class OchBusPresenter extends Presenter<OchBusFragment> implements IMogoA
|
||||
return;
|
||||
}
|
||||
Logger.d(TAG, "单程结束====");
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().cancelAutopilot();
|
||||
RequestBody request = RequestBody.create(MediaType.get("application/json"), GsonUtil.jsonFromObject(new OchBusLeaveStationRequest(Utils.getSn(), stationList.get(currentStationIndex).getSiteId())));
|
||||
MogoApisHandler.getInstance().getApis().getNetworkApi()
|
||||
.create(IOchBusApiService.class, HostConst.OCH_DOMAIN)
|
||||
@@ -227,43 +275,8 @@ public class OchBusPresenter extends Presenter<OchBusFragment> implements IMogoA
|
||||
}
|
||||
break;
|
||||
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING:
|
||||
mView.onAutopilotEnableChange(true);
|
||||
// mView.onAutopilotEnableChange(true);
|
||||
mView.onAutopilotStatusChanged(true);
|
||||
mView.hideSlidePanel();
|
||||
mView.hideNotice();
|
||||
if (mView != null) {
|
||||
mView.refreshBusStations(stationList);
|
||||
}
|
||||
if (isGoingToNextStation) {
|
||||
// 为了避免恢复自动驾驶时重复的接口请求
|
||||
return;
|
||||
}
|
||||
isGoingToNextStation = true;
|
||||
RequestBody request = RequestBody.create(MediaType.get("application/json"), GsonUtil.jsonFromObject(new OchBusLeaveStationRequest(Utils.getSn(), stationList.get(currentStationIndex).getSiteId())));
|
||||
MogoApisHandler.getInstance().getApis().getNetworkApi()
|
||||
.create(IOchBusApiService.class, HostConst.OCH_DOMAIN)
|
||||
.leaveStation(request).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(getContext())) {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
Logger.d(TAG, "leave station error: " + message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.e(TAG, e, "leave station exception");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
break;
|
||||
default:
|
||||
mView.onAutopilotEnableChange(false);
|
||||
|
||||
@@ -146,8 +146,9 @@ public interface IMogoADASController extends IProvider {
|
||||
|
||||
void mockOchStatus( int state, String reason );
|
||||
|
||||
|
||||
double getLastLat();
|
||||
|
||||
double getLastLon();
|
||||
|
||||
void cancelAutopilot();
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.service.impl.adas;
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.RemoteException;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
@@ -708,4 +709,13 @@ public class MogoADASController implements IMogoADASController {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelAutopilot() {
|
||||
try {
|
||||
AutopilotServiceManage.getInstance().cancelAutopilot();
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user