[Delete]
移除废弃的云端调度逻辑 Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
@@ -69,10 +69,15 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
// 添加 OBU状态 监听
|
||||
CallerObuListenerManager.addListener(TAG, this)
|
||||
// 添加 ADAS状态 监听
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
// 添加 ADAS车辆状态&定位 监听
|
||||
CallerAutopilotCarStatusListenerManager.addListener(TAG, this)
|
||||
// 添加 地图样式改变 监听
|
||||
CallerMapLocationListenerManager.addListener(TAG, this)
|
||||
// 添加 域控制器感知数据 监听
|
||||
CallerAutopilotIdentifyListenerManager.addListener(TAG, this)
|
||||
if (logInfoView != null) {
|
||||
logInfoView!!.onEnterForeground()
|
||||
@@ -81,10 +86,15 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
// 移除 OBU状态 监听
|
||||
CallerObuListenerManager.removeListener(TAG)
|
||||
// 移除 ADAS状态 监听
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
// 移除 ADAS车辆状态&定位 监听
|
||||
CallerAutopilotCarStatusListenerManager.removeListener(TAG)
|
||||
// 移除 地图样式改变 监听
|
||||
CallerMapLocationListenerManager.removeListener(TAG)
|
||||
// 移除 域控制器感知数据 监听
|
||||
CallerAutopilotIdentifyListenerManager.removeListener(TAG)
|
||||
if (logInfoView != null) {
|
||||
logInfoView!!.onEnterBackground()
|
||||
|
||||
@@ -41,7 +41,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加监听
|
||||
* 添加 ADAS状态 监听
|
||||
* @param tag 标记,用来注销监听使用
|
||||
* @param listener 监听回调
|
||||
*/
|
||||
|
||||
@@ -21,7 +21,7 @@ object CallerAutopilotCarStatusListenerManager : CallerBase() {
|
||||
|
||||
|
||||
/**
|
||||
* 添加监听
|
||||
* 添加 ADAS车辆状态&定位 监听
|
||||
* @param tag 标记,用来注销监听使用
|
||||
* @param listener 监听回调
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,7 @@ object CallerAutopilotIdentifyListenerManager : CallerBase() {
|
||||
ConcurrentHashMap()
|
||||
|
||||
/**
|
||||
* 添加监听
|
||||
* 添加 域控制器感知数据 监听
|
||||
* @param tag 标记,用来注销监听使用
|
||||
* @param listener 监听回调
|
||||
*/
|
||||
|
||||
@@ -1,269 +0,0 @@
|
||||
package com.mogo.module.adas;
|
||||
|
||||
import static com.mogo.module.adas.AdasConstant.MODULE_TAG;
|
||||
import static com.mogo.module.adas.entity.DispatchAdasAutoPilotLocReceiverBean.DISPATCH_SOURCE_HENGYANG;
|
||||
import static com.mogo.module.adas.entity.DispatchAdasAutoPilotLocReceiverBean.DISPATCH_TYPE_START;
|
||||
import static com.mogo.module.adas.model.AdasServiceModel.DISPATCH_RESULT_AFFIRM;
|
||||
import static com.mogo.module.adas.model.AdasServiceModel.DISPATCH_RESULT_MANUAL_CANCEL;
|
||||
import static com.mogo.module.adas.model.AdasServiceModel.DISPATCH_RESULT_TIMER_CANCEL;
|
||||
|
||||
import android.content.Context;
|
||||
import android.location.Location;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
|
||||
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.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.module.adas.entity.DispatchAdasAutoPilotLocReceiverBean;
|
||||
import com.mogo.module.adas.entity.DispatchData;
|
||||
import com.mogo.module.adas.entity.DispatchResult;
|
||||
import com.mogo.module.adas.entity.EndLatLon;
|
||||
import com.mogo.module.adas.entity.StartLatLon;
|
||||
import com.mogo.module.adas.model.AdasServiceModel;
|
||||
import com.mogo.module.adas.model.IDispatch;
|
||||
import com.mogo.module.adas.overlay.LineOverlayManager;
|
||||
import com.mogo.module.adas.view.DispatchRemindDialog;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotRoute;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
//todo 后续拆解是否放到网约车模块,画线部分已与产品沟通,放入后续迭代需求
|
||||
//负责监听自动驾驶状态并进行状态上报,自动驾驶路线上报,接收调度指令展示指令弹窗
|
||||
public class AdasAutoPilotManager implements IMogoOnMessageListener<DispatchAdasAutoPilotLocReceiverBean>
|
||||
, IAdasDataListener
|
||||
, DispatchRemindDialog.IDispatchRemindClickListener
|
||||
, IMogoCarLocationChangedListener2 {
|
||||
|
||||
private static final String TAG = "AdasAutoPilotManager";
|
||||
private static volatile AdasAutoPilotManager instance;
|
||||
private static final byte[] obj = new byte[0];
|
||||
private Context mContext;
|
||||
private static final int MSG_SOCKET_TYPE = 501000;
|
||||
private static final int MSG_TYPE_SHOW_DIALOG = 0;
|
||||
|
||||
private DispatchRemindDialog dispatchRemindDialog;
|
||||
private LineOverlayManager lineOverlayManager;
|
||||
private IDispatchResultListener dispatchResultListener;
|
||||
private DispatchAdasAutoPilotLocReceiverBean receiverBean;
|
||||
private List<MogoLatLng> latLngList;
|
||||
private boolean drawLine;
|
||||
|
||||
private AdasAutoPilotManager() {
|
||||
|
||||
}
|
||||
|
||||
public static AdasAutoPilotManager getInstance() {
|
||||
if (instance == null) {
|
||||
synchronized (obj) {
|
||||
if (instance == null) {
|
||||
instance = new AdasAutoPilotManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private final Handler handler = new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
if (msg.what == MSG_TYPE_SHOW_DIALOG) {
|
||||
DispatchAdasAutoPilotLocReceiverBean msgData = (DispatchAdasAutoPilotLocReceiverBean) msg.obj;
|
||||
dispatchRemindDialog.showDialog(msgData.getEndLocAddress());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public void initSocket(Context context) {
|
||||
mContext = context;
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getSocketManagerApi(context).registerOnMessageListener(MSG_SOCKET_TYPE, this);
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi()
|
||||
.registerCarLocationChangedListener(MODULE_TAG, this);
|
||||
AdasEventManager.getInstance().addEventListener(this);
|
||||
dispatchRemindDialog = new DispatchRemindDialog(context);
|
||||
dispatchRemindDialog.addIDispatchRemindListener(this);
|
||||
if (lineOverlayManager == null) {
|
||||
lineOverlayManager = new LineOverlayManager(mContext);
|
||||
lineOverlayManager.setIAdasLineOverlayListener(() -> drawLine = false);
|
||||
}
|
||||
}
|
||||
|
||||
public void addIDispatchResult(IDispatchResultListener listener) {
|
||||
this.dispatchResultListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<DispatchAdasAutoPilotLocReceiverBean> target() {
|
||||
return DispatchAdasAutoPilotLocReceiverBean.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(DispatchAdasAutoPilotLocReceiverBean adasAutoPilotLocReceiverBean) {
|
||||
if (adasAutoPilotLocReceiverBean != null
|
||||
&& adasAutoPilotLocReceiverBean.getEndLat() != 0.0
|
||||
&& adasAutoPilotLocReceiverBean.getEndLon() != 0.0
|
||||
&& adasAutoPilotLocReceiverBean.getEndLocAddress() != null) {
|
||||
// if (AdasEventManager.getInstance().getAutopilotValuesStatus() != null &&
|
||||
// AdasEventManager.getInstance().getAutopilotValuesStatus().getPilotmode() == 1) {
|
||||
// Logger.d(TAG, "onMsgReceived 接收到服务端调度信息,但现在已经在自动驾驶状态,下发重复 略过");
|
||||
// return;
|
||||
// }
|
||||
if (adasAutoPilotLocReceiverBean.getSource() == DISPATCH_SOURCE_HENGYANG
|
||||
&& adasAutoPilotLocReceiverBean.getType() == DISPATCH_TYPE_START) {
|
||||
this.receiverBean = adasAutoPilotLocReceiverBean;
|
||||
Message message = new Message();
|
||||
message.what = MSG_TYPE_SHOW_DIALOG;
|
||||
message.obj = adasAutoPilotLocReceiverBean;
|
||||
handler.sendMessage(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyAutopilotState(AutopilotStatusInfo autopilotStatus) {
|
||||
AdasServiceModel.getInstance().uploadAutopilotStatus(autopilotStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void autopilotRoute(AutopilotRouteInfo autopilotRoute) {
|
||||
// if (autopilotRoute == null || autopilotRoute.getModels() == null || autopilotRoute.getModels().size() == 0) {
|
||||
// return;
|
||||
// }
|
||||
// AdasServiceModel.getInstance().uploadAutopilotRoute(autopilotRoute.getModels());
|
||||
// latLngList = new ArrayList<>();
|
||||
// for (AutopilotRoute.RouteModels routeModel : autopilotRoute.getModels()) {
|
||||
// latLngList.add(new MogoLatLng(routeModel.getLat(), routeModel.getLon()));
|
||||
// }
|
||||
// drawLine = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void affirm() {
|
||||
AdasServiceModel.getInstance().dispatchResultUpload(DISPATCH_RESULT_AFFIRM, new IDispatch() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Logger.d(TAG, "");
|
||||
if (dispatchResultListener != null) {
|
||||
DispatchResult dispatchResult = new DispatchResult(
|
||||
new StartLatLon(receiverBean.getStartLat(), receiverBean.getStartLon()),
|
||||
new EndLatLon(receiverBean.getEndLat(), receiverBean.getEndLon()));
|
||||
DispatchData dispatchData = new DispatchData("aiCloudToStartAutopilot", dispatchResult);
|
||||
dispatchResultListener.dispatchAffirm(GsonUtil.jsonFromObject(dispatchData));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String msg) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(boolean manualTrigger) {
|
||||
AdasServiceModel.getInstance().dispatchResultUpload(manualTrigger ?
|
||||
DISPATCH_RESULT_MANUAL_CANCEL : DISPATCH_RESULT_TIMER_CANCEL, new IDispatch() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String msg) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged2(Location location) {
|
||||
//坐标转换
|
||||
MogoLocation loc = new MogoLocation();
|
||||
loc.setTime(loc.getTime());
|
||||
loc.setAccuracy(location.getAccuracy());
|
||||
loc.setSpeed(location.getSpeed());
|
||||
loc.setLongitude(location.getLongitude());
|
||||
loc.setLatitude(location.getLatitude());
|
||||
loc.setAltitude(location.getAltitude());
|
||||
loc.setBearing(location.getBearing());
|
||||
loc.setProvider(location.getProvider());
|
||||
// if (drawLine) {
|
||||
// lineOverlayManager.draw(mogoLocation, latLngList);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged(MogoLatLng mogoLatLng) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 调度指令结果回调
|
||||
*/
|
||||
public interface IDispatchResultListener {
|
||||
//调用确认
|
||||
void dispatchAffirm(String json);
|
||||
}
|
||||
|
||||
public void test() {
|
||||
Logger.d(TAG, "test to trigger mock autopilot");
|
||||
DispatchAdasAutoPilotLocReceiverBean adasAutoPilotLocReceiverBean = new DispatchAdasAutoPilotLocReceiverBean(
|
||||
DISPATCH_SOURCE_HENGYANG, DISPATCH_TYPE_START, "1",
|
||||
26.825571122, 112.5762410415, "测试数据",
|
||||
26.825571122, 112.5762410415, "调度至衡阳首钢",
|
||||
"", "", "开始调度", System.currentTimeMillis());
|
||||
this.receiverBean = adasAutoPilotLocReceiverBean;
|
||||
dispatchRemindDialog.showDialog(adasAutoPilotLocReceiverBean.getEndLocAddress());
|
||||
}
|
||||
|
||||
public void testNotifyAutopilotState() {
|
||||
AutopilotStatusInfo autopilotStatus = new AutopilotStatusInfo();
|
||||
autopilotStatus.setReason("123");
|
||||
autopilotStatus.setSpeed(123);
|
||||
autopilotStatus.setState(0);
|
||||
AdasServiceModel.getInstance().uploadAutopilotStatus(autopilotStatus);
|
||||
}
|
||||
|
||||
public void testUploadAutopilotRoute() {
|
||||
List<AutopilotRoute.RouteModels> list = new ArrayList<>();
|
||||
AutopilotRoute.RouteModels routeModels = new AutopilotRoute.RouteModels();
|
||||
routeModels.setLat(12.12);
|
||||
routeModels.setLon(13.14);
|
||||
list.add(routeModels);
|
||||
AdasServiceModel.getInstance().uploadAutopilotRoute(list);
|
||||
}
|
||||
|
||||
public void testDispatchResultUpload() {
|
||||
AdasServiceModel.getInstance().dispatchResultUpload(DISPATCH_RESULT_AFFIRM, new IDispatch() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String msg) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void testDispatchAutopilot() {
|
||||
DispatchResult dispatchResult = new DispatchResult(
|
||||
new StartLatLon(12.12, 13.13),
|
||||
new EndLatLon(12.12, 13.13));
|
||||
DispatchData dispatchData = new DispatchData("aiCloudToStartAutopilot", dispatchResult);
|
||||
String json = GsonUtil.jsonFromObject(dispatchData);
|
||||
Logger.d(TAG, "testDispatchAutopilot json : " + json);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -271,15 +271,7 @@ public class AdasEventManager implements
|
||||
|
||||
@Override
|
||||
public void onAutopilotRotting(@Nullable AutopilotRouteInfo autopilotRoute) {
|
||||
if (autopilotRoute.getModels() == null || autopilotRoute.getModels().size() == 0) {
|
||||
Logger.d(TAG, "onAutopilotRoute is null !");
|
||||
return;
|
||||
}
|
||||
for (IAdasDataListener listener : iAdasEventListeners) {
|
||||
if (listener != null) {
|
||||
listener.autopilotRoute(autopilotRoute);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -30,15 +30,6 @@ public interface IAdasDataListener {
|
||||
default void autopilotArrive(AutopilotStationInfo autopilotWayArrive) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动驾驶路线回调
|
||||
*
|
||||
* @param autopilotRoute {@link AutopilotRouteInfo}
|
||||
*/
|
||||
default void autopilotRoute(AutopilotRouteInfo autopilotRoute) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 自车定位信息
|
||||
*
|
||||
|
||||
@@ -1,165 +0,0 @@
|
||||
package com.mogo.module.adas.entity;
|
||||
|
||||
public class DispatchAdasAutoPilotLocReceiverBean {
|
||||
|
||||
public static final int DISPATCH_SOURCE_HENGYANG = 1;
|
||||
public static final int DISPATCH_SOURCE_EZHOU = 2;
|
||||
public static final int DISPATCH_TYPE_START = 1;
|
||||
public static final int DISPATCH_TYPE_STOP = 2;
|
||||
|
||||
private int source; // 1:衡阳 2:鄂州
|
||||
private int type; // 1:启动 2:停止
|
||||
private String poiId;
|
||||
|
||||
private double startLat;
|
||||
private double startLon;
|
||||
private String startLocAddress;
|
||||
|
||||
private double endLat;
|
||||
private double endLon;
|
||||
private String endLocAddress;
|
||||
|
||||
private String taskTime;
|
||||
private String flightInfo;
|
||||
private String taskInfo;
|
||||
private long systemTime;
|
||||
|
||||
public DispatchAdasAutoPilotLocReceiverBean(int source, int type, String poiId, double startLat, double startLon, String startLocAddress, double endLat, double endLon, String endLocAddress, String taskTime, String flightInfo, String taskInfo, long systemTime) {
|
||||
this.source = source;
|
||||
this.type = type;
|
||||
this.poiId = poiId;
|
||||
this.startLat = startLat;
|
||||
this.startLon = startLon;
|
||||
this.startLocAddress = startLocAddress;
|
||||
this.endLat = endLat;
|
||||
this.endLon = endLon;
|
||||
this.endLocAddress = endLocAddress;
|
||||
this.taskTime = taskTime;
|
||||
this.flightInfo = flightInfo;
|
||||
this.taskInfo = taskInfo;
|
||||
this.systemTime = systemTime;
|
||||
}
|
||||
|
||||
public int getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public void setSource(int source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getPoiId() {
|
||||
return poiId;
|
||||
}
|
||||
|
||||
public void setPoiId(String poiId) {
|
||||
this.poiId = poiId;
|
||||
}
|
||||
|
||||
public double getStartLat() {
|
||||
return startLat;
|
||||
}
|
||||
|
||||
public void setStartLat(double startLat) {
|
||||
this.startLat = startLat;
|
||||
}
|
||||
|
||||
public double getStartLon() {
|
||||
return startLon;
|
||||
}
|
||||
|
||||
public void setStartLon(double startLon) {
|
||||
this.startLon = startLon;
|
||||
}
|
||||
|
||||
public String getStartLocAddress() {
|
||||
return startLocAddress;
|
||||
}
|
||||
|
||||
public void setStartLocAddress(String startLocAddress) {
|
||||
this.startLocAddress = startLocAddress;
|
||||
}
|
||||
|
||||
public double getEndLat() {
|
||||
return endLat;
|
||||
}
|
||||
|
||||
public void setEndLat(double endLat) {
|
||||
this.endLat = endLat;
|
||||
}
|
||||
|
||||
public double getEndLon() {
|
||||
return endLon;
|
||||
}
|
||||
|
||||
public void setEndLon(double endLon) {
|
||||
this.endLon = endLon;
|
||||
}
|
||||
|
||||
public String getEndLocAddress() {
|
||||
return endLocAddress;
|
||||
}
|
||||
|
||||
public void setEndLocAddress(String endLocAddress) {
|
||||
this.endLocAddress = endLocAddress;
|
||||
}
|
||||
|
||||
public String getTaskTime() {
|
||||
return taskTime;
|
||||
}
|
||||
|
||||
public void setTaskTime(String taskTime) {
|
||||
this.taskTime = taskTime;
|
||||
}
|
||||
|
||||
public String getFlightInfo() {
|
||||
return flightInfo;
|
||||
}
|
||||
|
||||
public void setFlightInfo(String flightInfo) {
|
||||
this.flightInfo = flightInfo;
|
||||
}
|
||||
|
||||
public String getTaskInfo() {
|
||||
return taskInfo;
|
||||
}
|
||||
|
||||
public void setTaskInfo(String taskInfo) {
|
||||
this.taskInfo = taskInfo;
|
||||
}
|
||||
|
||||
public long getSystemTime() {
|
||||
return systemTime;
|
||||
}
|
||||
|
||||
public void setSystemTime(long systemTime) {
|
||||
this.systemTime = systemTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DispatchAdasAutoPilotLocReceiverBean{" +
|
||||
"source=" + source +
|
||||
", type=" + type +
|
||||
", poiId='" + poiId + '\'' +
|
||||
", startLat=" + startLat +
|
||||
", startLon=" + startLon +
|
||||
", startLocAddress='" + startLocAddress + '\'' +
|
||||
", endLat=" + endLat +
|
||||
", endLon=" + endLon +
|
||||
", endLocAddress='" + endLocAddress + '\'' +
|
||||
", taskTime='" + taskTime + '\'' +
|
||||
", flightInfo='" + flightInfo + '\'' +
|
||||
", taskInfo='" + taskInfo + '\'' +
|
||||
", systemTime=" + systemTime +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.mogo.module.adas.entity;
|
||||
|
||||
public class DispatchData {
|
||||
|
||||
private String action;
|
||||
private DispatchResult result;
|
||||
|
||||
public DispatchData(String action, DispatchResult result) {
|
||||
this.action = action;
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public DispatchResult getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(DispatchResult result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DispatchData{" +
|
||||
"action='" + action + '\'' +
|
||||
", result=" + result +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.mogo.module.adas.entity;
|
||||
|
||||
public class DispatchResult {
|
||||
|
||||
private StartLatLon startLatLon;
|
||||
private EndLatLon endLatLon;
|
||||
|
||||
public DispatchResult(StartLatLon startLatLon, EndLatLon endLatLon) {
|
||||
this.startLatLon = startLatLon;
|
||||
this.endLatLon = endLatLon;
|
||||
}
|
||||
|
||||
public StartLatLon getStartLatLon() {
|
||||
return startLatLon;
|
||||
}
|
||||
|
||||
public void setStartLatLon(StartLatLon startLatLon) {
|
||||
this.startLatLon = startLatLon;
|
||||
}
|
||||
|
||||
public EndLatLon getEndLatLon() {
|
||||
return endLatLon;
|
||||
}
|
||||
|
||||
public void setEndLatLon(EndLatLon endLatLon) {
|
||||
this.endLatLon = endLatLon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DispatchResult{" +
|
||||
"startLatLon=" + startLatLon +
|
||||
", endLatLon=" + endLatLon +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.mogo.module.adas.entity;
|
||||
|
||||
public class EndLatLon {
|
||||
|
||||
private double lat;
|
||||
private double lon;
|
||||
|
||||
public EndLatLon(double lat, double lon) {
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EndLatLon{" +
|
||||
"lat=" + lat +
|
||||
", lon=" + lon +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.mogo.module.adas.entity;
|
||||
|
||||
public class ReportDispatchResult {
|
||||
|
||||
private String sn;
|
||||
private int dispatchResult;
|
||||
|
||||
public ReportDispatchResult(String sn, int dispatchResult) {
|
||||
this.sn = sn;
|
||||
this.dispatchResult = dispatchResult;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public int getDispatchResult() {
|
||||
return dispatchResult;
|
||||
}
|
||||
|
||||
public void setDispatchResult(int dispatchResult) {
|
||||
this.dispatchResult = dispatchResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ReportDispatchResult{" +
|
||||
"sn='" + sn + '\'' +
|
||||
", dispatchResult=" + dispatchResult +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package com.mogo.module.adas.entity;
|
||||
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
|
||||
/**
|
||||
* 上报自动驾驶规划的路径
|
||||
*/
|
||||
public class ReportedRoute {
|
||||
private String sn;
|
||||
private AutopilotStatusInfo bean;
|
||||
private String siteList;
|
||||
|
||||
public ReportedRoute(String sn, AutopilotStatusInfo bean) {
|
||||
this.sn = sn;
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
public ReportedRoute(String sn, String siteList) {
|
||||
this.sn = sn;
|
||||
this.siteList = siteList;
|
||||
}
|
||||
|
||||
public String getSiteList() {
|
||||
return siteList;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return "{\"sn\":\"" + sn + "\",\"state\":" + bean.getState() + ",\"speed\":" + bean.getSpeed() + ",\"reason\":\"" + bean.getReason() + "\",\"camera\":" + bean.getCamera() + ",\"radar\":" + bean.getRadar() + ",\"rtk\":" + bean.getRtk() + "}";
|
||||
}
|
||||
|
||||
public String getRoute() {
|
||||
return "{\"sn\":\"" + sn + "\",\"siteList\":" + siteList + "}";
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.mogo.module.adas.entity;
|
||||
|
||||
public class StartLatLon {
|
||||
|
||||
private double lat;
|
||||
private double lon;
|
||||
|
||||
public StartLatLon(double lat, double lon) {
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "StartLatLon{" +
|
||||
"lat=" + lat +
|
||||
", lon=" + lon +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -2,23 +2,14 @@ package com.mogo.module.adas.model;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.network.RequestOptions;
|
||||
import com.mogo.eagle.core.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.adas.entity.AutonomousDriveStatusBean;
|
||||
import com.mogo.module.adas.entity.ReportDispatchResult;
|
||||
import com.mogo.module.adas.entity.ReportSiteBean;
|
||||
import com.mogo.module.adas.entity.ReportedRoute;
|
||||
import com.mogo.module.adas.network.IAdasApiService;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotRoute;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotStatus;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
@@ -34,10 +25,6 @@ public class AdasServiceModel {
|
||||
private static volatile AdasServiceModel instance;
|
||||
private static final byte[] obj = new byte[0];
|
||||
|
||||
public static final int DISPATCH_RESULT_AFFIRM = 0;
|
||||
public static final int DISPATCH_RESULT_MANUAL_CANCEL = 1;
|
||||
public static final int DISPATCH_RESULT_TIMER_CANCEL = 2;
|
||||
|
||||
private final IAdasApiService mAdasApiService;
|
||||
|
||||
private AdasServiceModel() {
|
||||
@@ -55,110 +42,6 @@ public class AdasServiceModel {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报自动驾驶状态
|
||||
*
|
||||
* @param autopilotStatus {@link AutopilotStatus}
|
||||
*/
|
||||
public void uploadAutopilotStatus(AutopilotStatusInfo autopilotStatus) {
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
ReportedRoute reportedRoute = new ReportedRoute(sn, autopilotStatus);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("sn", sn);
|
||||
map.put("data", GsonUtil.jsonFromObject(reportedRoute));
|
||||
mAdasApiService.uploadAutopilotState(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(getContext())) {
|
||||
@Override
|
||||
public void onNext(BaseData o) {
|
||||
super.onNext(o);
|
||||
Logger.d(TAG, "uploadAutopilotStatus success");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.d(TAG, "uploadAutopilotStatus error : " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报自动驾驶路线
|
||||
*
|
||||
* @param list 路线集合
|
||||
*/
|
||||
public void uploadAutopilotRoute(List<AutopilotRoute.RouteModels> list) {
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
ReportedRoute reportedRoute = new ReportedRoute(sn, GsonUtil.jsonFromObject(list));
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("sn", sn);
|
||||
map.put("data", GsonUtil.jsonFromObject(reportedRoute));
|
||||
mAdasApiService.uploadAutopilotRoute(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(getContext())) {
|
||||
@Override
|
||||
public void onNext(BaseData o) {
|
||||
super.onNext(o);
|
||||
Logger.d(TAG, "uploadAutopilotRoute success");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.d(TAG, "uploadAutopilotRoute error : " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报调度处理结果
|
||||
*
|
||||
* @param dispatchResultType int
|
||||
*/
|
||||
public void dispatchResultUpload(int dispatchResultType, IDispatch dispatch) {
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
ReportDispatchResult reportDispatchResult = new ReportDispatchResult(sn, dispatchResultType);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("sn", sn);
|
||||
map.put("data", GsonUtil.jsonFromObject(reportDispatchResult));
|
||||
mAdasApiService.uploadDispatchResult(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(getContext())) {
|
||||
@Override
|
||||
public void onNext(BaseData o) {
|
||||
super.onNext(o);
|
||||
Logger.d(TAG, "dispatchResultUpload success");
|
||||
dispatch.onSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.d(TAG, "dispatchResultUpload error : " + e.getMessage());
|
||||
dispatch.onError(e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updateDriveStatus(int autoPilotStatus, float autoPilotSpeed) {
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
AutonomousDriveStatusBean request = new AutonomousDriveStatusBean(sn, autoPilotStatus, autoPilotSpeed);
|
||||
@@ -184,7 +67,7 @@ public class AdasServiceModel {
|
||||
});
|
||||
}
|
||||
|
||||
public void reportSite(double lon, double lat){
|
||||
public void reportSite(double lon, double lat) {
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
ReportSiteBean reportSiteBean = new ReportSiteBean(sn, lon, lat);
|
||||
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(reportSiteBean));
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.mogo.module.adas.model;
|
||||
|
||||
public interface IDispatch {
|
||||
|
||||
void onSuccess();
|
||||
|
||||
void onError(String msg);
|
||||
}
|
||||
@@ -2,55 +2,30 @@ package com.mogo.module.adas.network;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import okhttp3.RequestBody;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.FieldMap;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.Headers;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
public interface IAdasApiService {
|
||||
|
||||
//上传自动驾驶状态接口
|
||||
/**
|
||||
* 上传自动驾驶状态接口
|
||||
* @param requestBody
|
||||
* @return
|
||||
*/
|
||||
@Headers({"Content-Type:application/json;charset=UTF-8"})
|
||||
@POST("/dataService/autonomousDrive/updateAutonomousDriveStatus")
|
||||
Observable<BaseData> updateAutonomousDriveStatus(@Body RequestBody requestBody);
|
||||
|
||||
//站点上报 用于网约车业务
|
||||
/**
|
||||
* 站点上报 用于网约车业务 云平台绘制路线使用
|
||||
* @param requestBody
|
||||
* @return
|
||||
*/
|
||||
@Headers({"Content-Type:application/json;charset=UTF-8"})
|
||||
@POST("/dataService/autonomousDrive/reportSite")
|
||||
Observable<BaseData> updateReportSite(@Body RequestBody requestBody);
|
||||
|
||||
/**
|
||||
* 上报自动驾驶状态 服务于业务调度
|
||||
*
|
||||
* @param parameters map
|
||||
* @return {@link BaseData}
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/dataService/autoDriver/receiveAutopilotState")
|
||||
Observable<BaseData> uploadAutopilotState(@FieldMap Map<String, Object> parameters);
|
||||
|
||||
/**
|
||||
* 上报自动驾驶路径 服务于业务调度
|
||||
*
|
||||
* @param parameters map
|
||||
* @return {@link BaseData}
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/dataService/autoDriver/receiveCarPreSetPath")
|
||||
Observable<BaseData> uploadAutopilotRoute(@FieldMap Map<String, Object> parameters);
|
||||
|
||||
/**
|
||||
* 上报自动驾驶调度处理结果 服务于业务调度
|
||||
*
|
||||
* @param parameters map
|
||||
* @return {@link BaseData}
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/dataService/autoDriver/receiverDestSiteResult")
|
||||
Observable<BaseData> uploadDispatchResult(@FieldMap Map<String, Object> parameters);
|
||||
}
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
package com.mogo.module.adas.overlay;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.util.ColorUtils;
|
||||
import com.mogo.map.overlay.IMogoOverlayManager;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LineOverlayManager {
|
||||
|
||||
private static final String TAG = "LineOverlayManager";
|
||||
private IMogoPolyline mMoGoPolyline;
|
||||
// 连接线参数
|
||||
private MogoPolylineOptions mPolylineOptions;
|
||||
// 线路径集合
|
||||
private List<MogoLatLng> mPolylinePointList;
|
||||
// 渐变色
|
||||
private List<Integer> mPolylineColors;
|
||||
|
||||
IMogoOverlayManager mogoOverlayManager;
|
||||
|
||||
private Context mContext;
|
||||
|
||||
private IAdasLineOverlayListener lineOverlayListener;
|
||||
|
||||
public LineOverlayManager(Context context) {
|
||||
mPolylineOptions = new MogoPolylineOptions();
|
||||
// 绘制路径集合
|
||||
mPolylinePointList = new ArrayList<>();
|
||||
// 引导线颜色
|
||||
mPolylineColors = new ArrayList<>();
|
||||
mContext = context;
|
||||
mogoOverlayManager = MogoApisHandler.getInstance().getApis().getMapServiceApi().getOverlayManager(mContext);
|
||||
}
|
||||
|
||||
public void setIAdasLineOverlayListener(IAdasLineOverlayListener listener){
|
||||
this.lineOverlayListener = listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制最优路线
|
||||
*
|
||||
* @param polylinePoint 要绘制的经纬度度集合
|
||||
*/
|
||||
public void draw(MogoLocation carLocal, List<MogoLatLng> polylinePoint) {
|
||||
Logger.d(TAG,"ready to draw");
|
||||
if (mMoGoPolyline != null) {
|
||||
mMoGoPolyline.remove();
|
||||
mPolylinePointList.clear();
|
||||
mPolylineColors.clear();
|
||||
}
|
||||
if (polylinePoint != null) {
|
||||
Logger.d(TAG,"draw");
|
||||
// 将当前车辆位置放进去
|
||||
// 过滤后台推送的推荐路线集合
|
||||
for (MogoLatLng polyline : polylinePoint) {
|
||||
//需要剔除已经行驶过的经纬度,这里需要比对推荐路线集合中的点是否在当前车辆行驶方向前面如果不在则抛弃
|
||||
// if (LocationUtils.isPointOnCarFront(carLocal, polyline)) {
|
||||
mPolylinePointList.add(polyline);
|
||||
// }
|
||||
}
|
||||
if(mPolylinePointList.size() < 2 && lineOverlayListener != null){
|
||||
Logger.d(TAG,"finish line");
|
||||
lineOverlayListener.finishLine();
|
||||
}
|
||||
Logger.d(TAG,"point list size : " + mPolylinePointList.size() + " json : " + GsonUtil.jsonFromObject(mPolylinePointList));
|
||||
mPolylineColors.addAll(ColorUtils.getGradientAlpha("#002965ED", "#FF2965ED", "#002965ED", mPolylinePointList.size()));
|
||||
// 替换路径集合
|
||||
mPolylineOptions.setGps(true);
|
||||
mPolylineOptions.points(mPolylinePointList);
|
||||
// 线条粗细,渐变,渐变色值
|
||||
mPolylineOptions.width(25).useGradient(true).colorValues(mPolylineColors);
|
||||
// 绘制线
|
||||
mMoGoPolyline = mogoOverlayManager.addPolyline(mPolylineOptions);
|
||||
}
|
||||
}
|
||||
|
||||
public interface IAdasLineOverlayListener{
|
||||
void finishLine();
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ import android.content.Intent;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.adas.AdasAutoPilotManager;
|
||||
import com.mogo.module.adas.AdasProvider;
|
||||
|
||||
public class AdasTestPanelBroadCastReceiver extends BroadcastReceiver {
|
||||
@@ -40,19 +39,7 @@ public class AdasTestPanelBroadCastReceiver extends BroadcastReceiver {
|
||||
*/
|
||||
private void dispatchSceneTest(int sceneType) {
|
||||
Logger.d(TAG, "sceneType=" + sceneType);
|
||||
if (sceneType == 0) {//打开调度弹窗
|
||||
AdasAutoPilotManager.getInstance().test();
|
||||
} else if(sceneType == 1){ //验证自动驾驶状态上报接口
|
||||
AdasAutoPilotManager.getInstance().testNotifyAutopilotState();
|
||||
} else if(sceneType == 2){ //验证自动驾驶路线上报接口
|
||||
AdasAutoPilotManager.getInstance().testUploadAutopilotRoute();
|
||||
} else if(sceneType == 3){ //验证自动驾驶调度上报接口
|
||||
AdasAutoPilotManager.getInstance().testDispatchResultUpload();
|
||||
} else if(sceneType == 4){ //验证下发给自动驾驶的调用数据
|
||||
AdasAutoPilotManager.getInstance().testDispatchAutopilot();
|
||||
} else if(sceneType == 5){ //验证画线功能
|
||||
TestAdasFuncManager.getInstance().testAddPolyLine();
|
||||
} else if(sceneType == 6){ //测试发送sn
|
||||
if(sceneType == 6){ //测试发送sn
|
||||
AdasProvider adasProvider = ARouter.getInstance().navigation(AdasProvider.class);
|
||||
adasProvider.setBasicInfo();
|
||||
}
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
package com.mogo.module.adas.receiver;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.adas.overlay.LineOverlayManager;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TestAdasFuncManager {
|
||||
|
||||
private static final String TAG = "TestAdasFuncManager";
|
||||
private static volatile TestAdasFuncManager manager;
|
||||
private static final byte[] obj = new byte[0];
|
||||
|
||||
public TestAdasFuncManager() {
|
||||
|
||||
}
|
||||
|
||||
public static TestAdasFuncManager getInstance() {
|
||||
if (manager == null) {
|
||||
synchronized (obj) {
|
||||
if (manager == null) {
|
||||
manager = new TestAdasFuncManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return manager;
|
||||
}
|
||||
|
||||
public void testAddPolyLine() {
|
||||
InputStream is = null;
|
||||
try {
|
||||
is = AbsMogoApplication.getApp().getApplicationContext().getAssets().open("testFile.txt");
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(is));
|
||||
String line = "";
|
||||
List<MogoLatLng> vals = new ArrayList<>();
|
||||
while ((line = br.readLine()) != null) {
|
||||
String json = line.substring(0, line.length() - 1);
|
||||
MogoLatLng si = GsonUtil.objectFromJson(json, MogoLatLng.class);
|
||||
vals.add(si);
|
||||
}
|
||||
Logger.d(TAG, "mogoLatLon size : " + GsonUtil.jsonFromObject(vals));
|
||||
JSONObject data = new JSONObject();
|
||||
double lon = 112.57748204198309;
|
||||
double lat = 26.820175208327566;
|
||||
data.putOpt("lon", lon);
|
||||
data.putOpt("lat", lat);
|
||||
data.putOpt("alt", 0);
|
||||
data.putOpt("speed", 0);
|
||||
data.putOpt("satelliteTime", System.currentTimeMillis());
|
||||
data.putOpt("heading", 240);
|
||||
data.putOpt("acceleration", 0);
|
||||
data.putOpt("yawRate", 0);
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().syncLocation2Map(data);
|
||||
LineOverlayManager lineOverlayManager = new LineOverlayManager(AbsMogoApplication.getApp().getApplicationContext());
|
||||
MogoLocation mogoLocation = new MogoLocation();
|
||||
mogoLocation.setLongitude(lon);
|
||||
mogoLocation.setLatitude(lat);
|
||||
lineOverlayManager.draw(mogoLocation, vals);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
package com.mogo.module.adas.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.adas.R;
|
||||
import com.mogo.module.common.dialog.BaseFloatDialog;
|
||||
|
||||
|
||||
public class DispatchRemindDialog extends BaseFloatDialog {
|
||||
|
||||
private static final String TAG = "DispatchRemindDialog";
|
||||
private static final int MSG_TYPE_TIMER = 0;
|
||||
private static int TIMER = 10;
|
||||
private IDispatchRemindClickListener mListener;
|
||||
|
||||
private final TextView tvTimer;
|
||||
private final TextView tvLoc;
|
||||
|
||||
private Handler handler = new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
if (msg.what == MSG_TYPE_TIMER) {
|
||||
if (TIMER > 0) {
|
||||
TIMER--;
|
||||
Logger.d(TAG,"timer : " + TIMER);
|
||||
tvTimer.setText(String.valueOf(TIMER));
|
||||
handler.sendEmptyMessageDelayed(MSG_TYPE_TIMER,1000L);
|
||||
} else {
|
||||
hideDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public DispatchRemindDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
setContentView(R.layout.dialog_adas_dispatch_remind);
|
||||
setCanceledOnTouchOutside(false);
|
||||
tvTimer = findViewById(R.id.module_adas_dispatch_remind_timer);
|
||||
tvLoc = findViewById(R.id.module_adas_dispatch_remind_loc);
|
||||
Button btnAffirm = (Button) findViewById(R.id.module_adas_dispatch_remind_affirm);
|
||||
Button btnCancel = (Button) findViewById(R.id.module_adas_dispatch_remind_cancel);
|
||||
tvTimer.setText(String.valueOf(TIMER));
|
||||
btnAffirm.setOnClickListener(v -> {
|
||||
if (mListener != null) {
|
||||
mListener.affirm();
|
||||
dismissDialog();
|
||||
}
|
||||
});
|
||||
btnCancel.setOnClickListener(v -> {
|
||||
if (mListener != null) {
|
||||
mListener.cancel(true);
|
||||
dismissDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void showDialog(String locContent) {
|
||||
show();
|
||||
handler.sendEmptyMessage(MSG_TYPE_TIMER);
|
||||
tvLoc.setText(locContent);
|
||||
}
|
||||
|
||||
private void hideDialog() {
|
||||
if (mListener != null) {
|
||||
mListener.cancel(false);
|
||||
}
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
private void dismissDialog(){
|
||||
handler.removeMessages(MSG_TYPE_TIMER);
|
||||
TIMER = 10;
|
||||
dismiss();
|
||||
}
|
||||
|
||||
public void addIDispatchRemindListener(IDispatchRemindClickListener listener) {
|
||||
if (listener == null) {
|
||||
Logger.d(TAG, "addIDispatchRemindListener listener is null");
|
||||
return;
|
||||
}
|
||||
this.mListener = listener;
|
||||
}
|
||||
|
||||
public interface IDispatchRemindClickListener {
|
||||
|
||||
void affirm();
|
||||
|
||||
void cancel(boolean manualTrigger);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="@dimen/adas_dispatch_remind_dialog_corner"/>
|
||||
<solid android:color="@color/adas_dispatch_remind_background"/>
|
||||
</shape>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/adas_dispatch_remind_background" />
|
||||
<corners android:bottomLeftRadius="@dimen/adas_dispatch_remind_dialog_corner" />
|
||||
</shape>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/adas_dispatch_remind_background" />
|
||||
<corners android:bottomRightRadius="@dimen/adas_dispatch_remind_dialog_corner" />
|
||||
</shape>
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
|
||||
<solid android:color="@color/adas_dispatch_remind_count_down_bg"/>
|
||||
</shape>
|
||||
@@ -1,95 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="@dimen/adas_dispatch_remind_dialog_width"
|
||||
android:layout_height="@dimen/adas_dispatch_remind_dialog_height"
|
||||
android:background="@drawable/module_adas_bg_shape">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_adas_dispatch_remind_timer"
|
||||
android:layout_width="@dimen/adas_dispatch_remind_dialog_timer_size"
|
||||
android:layout_height="@dimen/adas_dispatch_remind_dialog_timer_size"
|
||||
android:layout_margin="@dimen/adas_dispatch_remind_dialog_timer_margin"
|
||||
android:background="@drawable/module_adas_timer_bg_shape"
|
||||
android:gravity="center"
|
||||
android:text="10"
|
||||
android:textColor="@color/adas_dispatch_remind_count_down_txt"
|
||||
android:textSize="@dimen/adas_dispatch_remind_dialog_timer_txt_size"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/adas_dispatch_remind_dialog_title_margin_top"
|
||||
android:text="@string/module_adas_dispatch_remind_title"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/adas_dispatch_remind_dialog_title_size"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/adas_dispatch_remind_dialog_content_margin_top"
|
||||
android:text="@string/module_adas_dispatch_remind_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/adas_dispatch_remind_dialog_content_size"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_adas_dispatch_remind_loc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/adas_dispatch_remind_dialog_loc_margin_top"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/adas_dispatch_remind_text_loc"
|
||||
android:textSize="@dimen/adas_dispatch_remind_dialog_loc_size"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginBottom="@dimen/adas_dispatch_remind_dialog_line_margin_bottom"
|
||||
android:background="@color/adas_dispatch_remind_background"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/module_adas_dispatch_remind_affirm"
|
||||
android:layout_width="@dimen/adas_dispatch_remind_dialog_btn_width"
|
||||
android:layout_height="@dimen/adas_dispatch_remind_dialog_line_margin_bottom"
|
||||
android:background="@drawable/module_adas_left_corner_bg"
|
||||
android:gravity="center"
|
||||
android:text="@string/module_adas_dispatch_remind_affirm"
|
||||
android:textColor="@color/adas_dispatch_remind_text_loc"
|
||||
android:textSize="@dimen/adas_dispatch_remind_dialog_title_size"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent" />
|
||||
|
||||
<View
|
||||
android:layout_width="1px"
|
||||
android:layout_height="@dimen/adas_dispatch_remind_dialog_line_margin_bottom"
|
||||
android:layout_marginStart="@dimen/adas_dispatch_remind_dialog_btn_width"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/module_adas_dispatch_remind_cancel"
|
||||
android:layout_width="@dimen/adas_dispatch_remind_dialog_btn_width"
|
||||
android:layout_height="@dimen/adas_dispatch_remind_dialog_line_margin_bottom"
|
||||
android:background="@drawable/module_adas_right_corner_bg"
|
||||
android:gravity="center"
|
||||
android:text="@string/module_adas_dispatch_remind_cancel"
|
||||
android:textColor="@color/adas_dispatch_remind_cancel"
|
||||
android:textSize="@dimen/adas_dispatch_remind_dialog_title_size"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,17 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="adas_dispatch_remind_dialog_width">950px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_height">540px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_corner">32px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_title_size">48px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_title_margin_top">55px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_content_size">38px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_content_margin_top">179px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_loc_size">56px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_loc_margin_top">251px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_line_margin_bottom">152px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_btn_width">474.5px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_timer_margin">20px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_timer_size">46px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_timer_txt_size">24px</dimen>
|
||||
|
||||
</resources>
|
||||
@@ -1,10 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="adas_dispatch_remind_text_loc">#1F9BFE</color>
|
||||
<color name="adas_dispatch_remind_background">#E63B4577</color>
|
||||
<color name="adas_dispatch_remind_count_down_txt">#8E9DD4</color>
|
||||
<color name="adas_dispatch_remind_count_down_bg">#4D000000</color>
|
||||
<color name="adas_dispatch_remind_line">#66B8BFE8</color>
|
||||
<color name="adas_dispatch_remind_cancel">#AFB3C7</color>
|
||||
|
||||
</resources>
|
||||
@@ -1,17 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="adas_dispatch_remind_dialog_width">950px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_height">540px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_corner">32px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_title_size">48px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_title_margin_top">55px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_content_size">38px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_content_margin_top">179px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_loc_size">56px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_loc_margin_top">251px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_line_margin_bottom">152px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_btn_width">474.5px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_timer_margin">20px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_timer_size">46px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_timer_txt_size">24px</dimen>
|
||||
|
||||
</resources>
|
||||
@@ -1,7 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="module_adas_dispatch_remind_title">调度确认</string>
|
||||
<string name="module_adas_dispatch_remind_content">车辆将开启自动驾驶,并行驶至:</string>
|
||||
<string name="module_adas_dispatch_remind_affirm">确认</string>
|
||||
<string name="module_adas_dispatch_remind_cancel">取消</string>
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user