[Delete]
修改调度使用的自动驾驶监听接口为新方式 Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
@@ -1,9 +1,5 @@
|
||||
package com.mogo.module.service.dispatch;
|
||||
|
||||
import static com.mogo.module.service.dispatch.model.DispatchServiceModel.DISPATCH_RESULT_AFFIRM;
|
||||
import static com.mogo.module.service.dispatch.model.DispatchServiceModel.DISPATCH_RESULT_MANUAL_CANCEL;
|
||||
import static com.mogo.module.service.dispatch.model.DispatchServiceModel.DISPATCH_RESULT_TIMER_CANCEL;
|
||||
|
||||
import android.content.Context;
|
||||
import android.location.Location;
|
||||
import android.os.Handler;
|
||||
@@ -12,12 +8,16 @@ import android.os.Message;
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
|
||||
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.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.api.hmi.autopilot.IMoGoCheckAutoPilotBtnListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
@@ -27,16 +27,22 @@ import com.mogo.module.service.dispatch.bean.DispatchAdasAutoPilotLocReceiverBea
|
||||
import com.mogo.module.service.dispatch.model.DispatchServiceModel;
|
||||
import com.mogo.module.service.dispatch.model.IDispatch;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.adas.IMogoAdasOCHCallback;
|
||||
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.mogo.module.service.dispatch.model.DispatchServiceModel.DISPATCH_RESULT_AFFIRM;
|
||||
import static com.mogo.module.service.dispatch.model.DispatchServiceModel.DISPATCH_RESULT_MANUAL_CANCEL;
|
||||
import static com.mogo.module.service.dispatch.model.DispatchServiceModel.DISPATCH_RESULT_TIMER_CANCEL;
|
||||
|
||||
//负责监听自动驾驶状态并进行状态上报,自动驾驶路线上报,接收调度指令展示指令弹窗
|
||||
public class DispatchAutoPilotManager implements IMogoOnMessageListener<DispatchAdasAutoPilotLocReceiverBean>
|
||||
, IDispatchRemindClickListener, IMogoCarLocationChangedListener2, IMogoAdasOCHCallback,
|
||||
IMoGoCheckAutoPilotBtnListener, IMoGoAutopilotPlanningListener {
|
||||
, IDispatchRemindClickListener, IMogoCarLocationChangedListener2,
|
||||
IMoGoCheckAutoPilotBtnListener, IMoGoAutopilotPlanningListener, IMoGoAutopilotStatusListener {
|
||||
|
||||
private static final String TAG = "DispatchAutoPilotManager";
|
||||
private static volatile DispatchAutoPilotManager instance;
|
||||
@@ -98,15 +104,26 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
|
||||
mApis.getSocketManagerApi(context).registerOnMessageListener(MSG_SOCKET_TYPE, this);
|
||||
mApis.getRegisterCenterApi()
|
||||
.registerCarLocationChangedListener(TAG, this);
|
||||
mApis.getAdasControllerApi()
|
||||
.addAdasOCHCallback(this);
|
||||
// 添加自动驾驶按钮选中监听
|
||||
CallerHmiListenerManager.INSTANCE.addCheckAutoPilotBtnListener(TAG, this);
|
||||
// 添加 规划路径相关回调 监听
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, this);
|
||||
// 添加 ADAS状态 监听
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, this);
|
||||
dispatchDialogManager = DispatchDialogManager.getInstance(context);
|
||||
dispatchDialogManager.addIDispatchRemindListener(this);
|
||||
handler.sendEmptyMessageDelayed(MSG_TYPE_UPLOAD_AUTOPILOT_STATUS, 1000L);
|
||||
}
|
||||
|
||||
public void release() {
|
||||
// 添加自动驾驶按钮选中监听
|
||||
CallerHmiListenerManager.INSTANCE.removeCheckAutoPilotBtnListener(TAG);
|
||||
// 添加 规划路径相关回调 监听
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.removeListener(TAG);
|
||||
// 添加 ADAS状态 监听
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.removeListener(TAG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<DispatchAdasAutoPilotLocReceiverBean> target() {
|
||||
return DispatchAdasAutoPilotLocReceiverBean.class;
|
||||
@@ -195,34 +212,6 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArriveAt(AutopilotStationInfo data) {
|
||||
if(!isDispatch){
|
||||
return;
|
||||
}
|
||||
if(data == null){
|
||||
return;
|
||||
}
|
||||
Logger.d(TAG, "onArriveAt data : " + data.toString());
|
||||
double endLat = data.getLat();
|
||||
double endLon = data.getLon();
|
||||
// 计算是不是到了终点
|
||||
float distanceFromSelf = CoordinateUtils.calculateLineDistance(receiverBean.getEndLon(), receiverBean.getEndLat()
|
||||
, endLon, endLat);
|
||||
Logger.d(TAG, "onArriveAt cal distance : " + distanceFromSelf);
|
||||
if (distanceFromSelf < 10) {
|
||||
Logger.d(TAG, "onArriveAt end location");
|
||||
isDispatch = false;
|
||||
isArriveEnd = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateChanged(int state, String reason) {
|
||||
autoPilotStatus = state;
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCheck(boolean isChecked) {
|
||||
if (isChecked) {
|
||||
@@ -302,4 +291,42 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
|
||||
}
|
||||
DispatchServiceModel.getInstance().uploadAutopilotRoute(autopilotRoute.getModels());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autoPilotStatusInfo) {
|
||||
autoPilotStatus = autoPilotStatusInfo.getState();
|
||||
this.reason = autoPilotStatusInfo.getReason();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotArriveAtStation(@Nullable AutopilotStationInfo autopilotWayArrive) {
|
||||
if (!isDispatch) {
|
||||
return;
|
||||
}
|
||||
if (autopilotWayArrive == null) {
|
||||
return;
|
||||
}
|
||||
Logger.d(TAG, "onArriveAt data : " + autopilotWayArrive.toString());
|
||||
double endLat = autopilotWayArrive.getLat();
|
||||
double endLon = autopilotWayArrive.getLon();
|
||||
// 计算是不是到了终点
|
||||
float distanceFromSelf = CoordinateUtils.calculateLineDistance(receiverBean.getEndLon(), receiverBean.getEndLat()
|
||||
, endLon, endLat);
|
||||
Logger.d(TAG, "onArriveAt cal distance : " + distanceFromSelf);
|
||||
if (distanceFromSelf < 10) {
|
||||
Logger.d(TAG, "onArriveAt end location");
|
||||
isDispatch = false;
|
||||
isArriveEnd = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotSNRequest() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotGuardian(@Nullable AutopilotGuardianStatusInfo guardianInfo) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user