opt
This commit is contained in:
@@ -163,7 +163,10 @@ public class OchBusFragment extends BaseOchFragment<OchBusFragment, OchBusPresen
|
||||
|
||||
@Override
|
||||
public void restartAutopilot() {
|
||||
mPresenter.restartAutopilot();
|
||||
// 如果能自动驾驶,就自动驾驶,不能就提示
|
||||
if (MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() == IMogoAdasOCHCallback.STATUS_AUTOPILOT_ENABLE) {
|
||||
mPresenter.restartAutopilot();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,6 +43,11 @@ class MogoOCHTaxiModel {
|
||||
|
||||
private static final String TAG = "MogoOCHTaxiModel";
|
||||
|
||||
/**
|
||||
* 到达起始点围栏
|
||||
*/
|
||||
public static final int ARRIVE_AT_START_STATION_DISTANCE = 10;
|
||||
|
||||
private static volatile MogoOCHTaxiModel sInstance;
|
||||
|
||||
private MogoOCHTaxiModel() {
|
||||
@@ -332,12 +337,12 @@ class MogoOCHTaxiModel {
|
||||
private void judgeStationStation( Location location ) {
|
||||
OCHTaxiOrderResponse.OCHTaxiStation station = mCurrentOCHOrder.drivingRoutes.get( 0 );//起点
|
||||
double distance = CoordinateUtils.calculateLineDistance( station.lon, station.lat, location.getLongitude(), location.getLatitude() );
|
||||
if ( distance > 5 ) {
|
||||
if ( distance > ARRIVE_AT_START_STATION_DISTANCE ) {
|
||||
distance = CoordinateUtils.calculateLineDistance( station.lon, station.lat,
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon(),
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat() );
|
||||
}
|
||||
if ( distance <= 5 ) {
|
||||
if ( distance <= ARRIVE_AT_START_STATION_DISTANCE ) {
|
||||
mIsArriveAtStartStation = true;
|
||||
unregisterCarLocationListener();
|
||||
OCHTaxiUiController.getInstance().onArriveAtStartStation();
|
||||
@@ -360,6 +365,7 @@ class MogoOCHTaxiModel {
|
||||
} );
|
||||
return;
|
||||
}
|
||||
Logger.d( TAG, "distance = %s", distance );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -417,6 +423,7 @@ class MogoOCHTaxiModel {
|
||||
|
||||
@Override
|
||||
public void onMsgReceived( OCHTaxiOrderResponse obj ) {
|
||||
Logger.d( TAG, "收到新订单" );
|
||||
mCurrentOCHOrder = obj;
|
||||
cacheOrderInfo2Native( mCurrentOCHOrder );
|
||||
Location location = MogoApisHandler.getInstance()
|
||||
@@ -522,6 +529,7 @@ class MogoOCHTaxiModel {
|
||||
|
||||
@Override
|
||||
public void onStateChanged( int state, String reason ) {
|
||||
Logger.d( TAG, "state = %s", state );
|
||||
OCHTaxiUiController.getInstance().onAutoPilotStatusChanged( state, reason );
|
||||
}
|
||||
}
|
||||
@@ -661,4 +669,20 @@ class MogoOCHTaxiModel {
|
||||
public OCHTaxiOrderResponse getCurrentOCHOrder() {
|
||||
return mCurrentOCHOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束自动驾驶
|
||||
*/
|
||||
public void cancelAutopilot(){
|
||||
try {
|
||||
Logger.d( TAG, "结束自动驾驶" );
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getAdasControllerApi()
|
||||
.cancelAutopilot();
|
||||
Logger.d( TAG, "结束自动驾驶" );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,6 +266,7 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
||||
public void onSuccess( Object data ) {
|
||||
Logger.d( TAG, "更新状态成功" );
|
||||
MogoOCHTaxiModel.getInstance().clearCurrentOCHOrder();
|
||||
MogoOCHTaxiModel.getInstance().cancelAutopilot();
|
||||
OCHTaxiUiController.getInstance().removeFragment();
|
||||
}
|
||||
|
||||
|
||||
@@ -61,9 +61,9 @@ public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> e
|
||||
@Override
|
||||
public void onClickImpl(View v) {
|
||||
// 如果能自动驾驶,就自动驾驶,不能就提示
|
||||
if (MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() == IMogoAdasOCHCallback.STATUS_AUTOPILOT_ENABLE) {
|
||||
restartAutopilot();
|
||||
}
|
||||
// if (MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() == IMogoAdasOCHCallback.STATUS_AUTOPILOT_ENABLE) {
|
||||
// }
|
||||
restartAutopilot();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user