替换主动获取自动驾驶状态的调用方式

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2022-02-07 17:12:29 +08:00
parent e787cba3be
commit 8233e69f99
11 changed files with 21 additions and 115 deletions

View File

@@ -28,7 +28,6 @@ import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
import com.mogo.module.adas.model.AdasServiceModel;
import com.mogo.module.common.drawer.IdentifyDataDrawer;
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotStateModel;
import com.zhidao.support.adas.high.AdasManager;
import com.zhidao.support.adas.high.OnAdasMsgConnectStatusListener;
import com.zhidao.support.adas.high.bean.BasicInfo;
@@ -62,8 +61,6 @@ public class AdasEventManager implements
private int mCurrentAutopilotStatus = -1;
//自动驾驶车速度
private float mCurrentAutopilotSpeed = 0;
//自动驾驶状态
private AutopilotStatusInfo mAutopilotValuesStatus = null;
private AdasEventManager() {
@@ -154,23 +151,12 @@ public class AdasEventManager implements
AdasServiceModel.getInstance().reportSite(lon, lat);
}
public AdasAIDLAutopilotStateModel autopilotStateCall() {
AdasAIDLAutopilotStateModel adasAIDLAutopilotStateModel = new AdasAIDLAutopilotStateModel();
if (mAutopilotValuesStatus != null) {
adasAIDLAutopilotStateModel.setSpeed(mAutopilotValuesStatus.getSpeed());
adasAIDLAutopilotStateModel.setState(mAutopilotValuesStatus.getState());
adasAIDLAutopilotStateModel.setReason(mAutopilotValuesStatus.getReason());
}
return adasAIDLAutopilotStateModel;
}
@Override
public void onAutopilotStatusResponse(@NonNull AutopilotStatusInfo autoPilotStatusInfo) {
int state = autoPilotStatusInfo.getState();
float speed = autoPilotStatusInfo.getSpeed();
mCurrentAutopilotStatus = state;
mCurrentAutopilotSpeed = speed;
this.mAutopilotValuesStatus = autoPilotStatusInfo;
for (IAdasDataListener listener : iAdasEventListeners) {
if (listener != null) {
listener.notifyAutopilotState(autoPilotStatusInfo);
@@ -184,11 +170,6 @@ public class AdasEventManager implements
double lon = autopilotWayArrive.getLon();
double lat = autopilotWayArrive.getLat();
reportSite(lon, lat);
for (IAdasDataListener listener : iAdasEventListeners) {
if (listener != null) {
listener.autopilotArrive(autopilotWayArrive);
}
}
}
}

View File

@@ -7,7 +7,6 @@ import com.alibaba.android.arouter.facade.template.IProvider;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotStateModel;
import com.zhidao.support.adas.high.AdasManager;
import com.zhidao.support.adas.high.common.CupidLogUtils;
@@ -65,7 +64,4 @@ public class AdasProvider implements IProvider {
AdasManager.getInstance().aiCloudToAdasData(msg);
}
public AdasAIDLAutopilotStateModel autopilotStateCall() {
return adasEventManager.autopilotStateCall();
}
}

View File

@@ -1,18 +1,9 @@
package com.mogo.module.adas;
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage;
public interface IAdasDataListener {
/**
* 自动驾驶到达站点回调接口
*
* @param autopilotWayArrive
*/
default void autopilotArrive(AutopilotStationInfo autopilotWayArrive) {
}
/**
* 自车定位信息

View File

@@ -6,9 +6,9 @@ import android.os.Handler;
import android.os.Message;
import android.util.Log;
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.check.CallerCheckManager;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.service.adas.IMogoAdasOCHCallback;
/**
* @author liujing
@@ -25,14 +25,14 @@ public class VehicleMonitoring implements Handler.Callback {
//非自动驾驶测试数据 后期根据需求做修改
private static final long MANUAL_CHECK_STATUS_DELAY = 30 * 1000;
//自动驾驶状态
private static int AutopilotStatus = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus();
private static int AutopilotStatus = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState();
public VehicleMonitoring(Context context) {
mContext = context;
}
public void vehicleCheck() {
if (AutopilotStatus == IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING) {
if (AutopilotStatus == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
Log.d(TAG, "自动驾驶中...");
mHandler.sendEmptyMessageDelayed(AutopilotStatus, AUTO_CHECK_STATUS_DELAY);
} else {
@@ -44,14 +44,14 @@ public class VehicleMonitoring implements Handler.Callback {
@Override
public boolean handleMessage(Message msg) {
AutopilotStatus = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus();
AutopilotStatus = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState();
switch (msg.what) {
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING:
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING:
vehicleMonitor();
mHandler.sendEmptyMessageDelayed(AutopilotStatus, AUTO_CHECK_STATUS_DELAY);
return true;
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_DISABLE:
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_ENABLE:
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE:
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE:
vehicleMonitor();
mHandler.sendEmptyMessageDelayed(AutopilotStatus, MANUAL_CHECK_STATUS_DELAY);
return true;