完成了自动驾驶状态信息回传

Signed-off-by: 董宏宇 <martindhy@gmail.com>
This commit is contained in:
董宏宇
2021-10-12 21:24:58 +08:00
parent 870af04059
commit 9802124169
15 changed files with 309 additions and 37 deletions

View File

@@ -1,10 +1,9 @@
package com.mogo.module.adas;
import com.google.gson.Gson;
import com.mogo.module.adas.entity.WarnMessageModel;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.module.adas.model.AdasServiceModel;
import com.mogo.module.adas.network.IAdasApiService;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotArriveModel;
@@ -20,7 +19,6 @@ import com.zhidao.support.adas.high.bean.LightStatueInfo;
import com.zhidao.support.adas.high.bean.ObstaclesInfo;
import com.zhidao.support.adas.high.bean.RectInfo;
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
import com.zhidao.support.adas.high.common.MsgActionType;
import com.zhidao.support.obu.ami.AmiClientManager;
import java.util.ArrayList;
@@ -31,8 +29,6 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import static com.mogo.module.adas.AdasConstant.getBaseUrl;
/**
* Created by XuYong on 2021/4/25 14:43
*/
@@ -187,6 +183,18 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
Logger.d(TAG, "autopilotStatus " + autopilotStatus);
AutopilotStatus.ValuesBean autopilotStatusValues = autopilotStatus.getValues();
if (autopilotStatusValues != null) {
// 初始化自动驾驶状态信息
AutopilotStatusInfo autopilotStatusInfo = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo();
autopilotStatusInfo.setAutopilotStatus(autopilotStatusValues.getState());
autopilotStatusInfo.setAutoDriveStatus(autopilotStatusValues.getPilotmode());
autopilotStatusInfo.setErrorReason(autopilotStatusValues.getReason());
autopilotStatusInfo.setCamera(autopilotStatusValues.getCamera());
autopilotStatusInfo.setRtk(autopilotStatusValues.getRtk());
autopilotStatusInfo.setRadar(autopilotStatusValues.getRadar());
autopilotStatusInfo.setSpeed(autopilotStatusValues.getSpeed());
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutoPilotStatusListener();
int state = autopilotStatusValues.getState();
float speed = autopilotStatusValues.getSpeed();
mCurrentAutopilotStatus = state;
@@ -252,6 +260,8 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
@Override
public void onWebSocketConnectSuccess() {
Logger.d(TAG, "webSocket 连接成功");
CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().setConnectStatus(true);
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutoPilotStatusListener();
for (IAdasStatusListener listener : iAdasStatusListeners) {
listener.onServiceConnected();
}
@@ -261,6 +271,8 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
@Override
public void onWebSocketConnectFailed() {
Logger.d(TAG, "webSocket 连接失败");
CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().setConnectStatus(false);
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutoPilotStatusListener();
for (IAdasStatusListener listener : iAdasStatusListeners) {
listener.onServiceDisconnected();
}

View File

@@ -1,16 +1,11 @@
package com.mogo.module.adas;
import com.mogo.module.adas.entity.WarnMessageModel;
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotArriveModel;
import com.zhidao.autopilotservice.model.AdasAIDLOwnerCarRectModel;
import com.zhidao.autopilotservice.model.AdasAIDLOwnerCarStateModel;
import com.zhidao.support.adas.high.bean.AutopilotRoute;
import com.zhidao.support.adas.high.bean.AutopilotStatus;
import com.zhidao.support.adas.high.bean.RectInfo;
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
import java.util.List;
public interface IAdasDataListener {