Merge remote-tracking branch 'origin/dev_MogoAP_eagle-1030_211020_8.0.14' into dev_MogoAP_eagle-1030_211020_8.0.14

This commit is contained in:
donghongyu
2021-11-25 20:03:02 +08:00

View File

@@ -5,24 +5,31 @@ import android.location.Location;
import android.util.Log;
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.service.adas.IMogoAdasOCHCallback;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
public class MogoRouteOverlayManager implements IMogoCarLocationChangedListener2, IMoGoAutopilotPlanningListener, IMogoAdasOCHCallback {
public class MogoRouteOverlayManager implements IMogoCarLocationChangedListener2, IMoGoAutopilotPlanningListener, IMoGoAutopilotStatusListener {
private static volatile MogoRouteOverlayManager sInstance;
private Context mContext;
private String TAG = "MogoRouteOverlayManager";
private int STATUS_AUTOPILOT = STATUS_AUTOPILOT_DISABLE;
private int STATUS_AUTOPILOT = 0;//0 非自动驾驶 ; 1 自动驾驶
private MogoRouteOverlayManager(Context context) {
mContext = context;
}
@@ -31,9 +38,9 @@ public class MogoRouteOverlayManager implements IMogoCarLocationChangedListener2
MogoApisHandler.getInstance()
.getApis()
.getRegisterCenterApi()
.registerCarLocationChangedListener("MogoRouteOverlayManager", this);
CallerAutopilotPlanningListenerManager.INSTANCE.addListener("MogoRouteOverlayManager", this);
MogoApisHandler.getInstance().getApis().getAdasControllerApi().addAdasOCHCallback(this);
.registerCarLocationChangedListener(TAG, this);
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, this);
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, this);
}
public static MogoRouteOverlayManager getInstance(Context context) {
@@ -98,21 +105,26 @@ public class MogoRouteOverlayManager implements IMogoCarLocationChangedListener2
latLngList.add(new MogoLatLng(routeModel.getLat(), routeModel.getLon()));
}
Log.e(TAG, "routeResult:" + latLngList.size());
if (STATUS_AUTOPILOT == IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING) {
if (STATUS_AUTOPILOT == 1) {
RouteOverlayDrawer.getInstance(mContext).putRouteList(latLngList);
}
}
@Override
public void onArriveAt(AutopilotStationInfo data) {
// RouteOverlayDrawer.getInstance(mContext).clearMogoRouteOverlay();
}
@Override
public void onStateChanged(int state, String reason) {
this.STATUS_AUTOPILOT = state;
if (state != IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING) {
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autoPilotStatusInfo) {
this.STATUS_AUTOPILOT = autoPilotStatusInfo.getControl_pilotmode();
if (STATUS_AUTOPILOT != 1) {
RouteOverlayDrawer.getInstance(mContext).clearMogoRouteOverlay();
}
}
@Override
public void onAutopilotArriveAtStation(@Nullable AutopilotStationInfo autopilotWayArrive) {
}
@Override
public void onAutopilotGuardian(@Nullable AutopilotGuardianStatusInfo guardianInfo) {
}
}