fit dispatch

This commit is contained in:
zhongchao
2021-08-11 15:17:33 +08:00
parent dc0c4af82a
commit aff5e67ea9
4 changed files with 220 additions and 99 deletions

17
.idea/misc.xml generated
View File

@@ -8,6 +8,23 @@
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
<groovy codeStyle="LEGACY" />
</component>
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="../../../../../layout/custom_preview.xml" value="0.19947916666666668" />
<entry key="modules/mogo-module-service/src/main/res/drawable/bg_adas_dispatch.xml" value="0.184" />
<entry key="modules/mogo-module-service/src/main/res/drawable/bg_adas_dispatch_affirm.xml" value="0.19166666666666668" />
<entry key="modules/mogo-module-service/src/main/res/drawable/bg_map_marker_blue_info.xml" value="0.184" />
<entry key="modules/mogo-module-service/src/main/res/drawable/module_service_dispatch_cars_affirm_bg.xml" value="0.218" />
<entry key="modules/mogo-module-service/src/main/res/drawable/module_service_dispatch_cars_bg.xml" value="0.218" />
<entry key="modules/mogo-module-service/src/main/res/drawable/module_service_dispatch_cars_cancel_bg.xml" value="0.218" />
<entry key="modules/mogo-module-service/src/main/res/drawable/module_service_dispatch_timer_bg.xml" value="0.218" />
<entry key="modules/mogo-module-service/src/main/res/layout/module_dialog_adas_dispatch_cars.xml" value="0.5546876453218006" />
<entry key="modules/mogo-module-service/src/main/res/layout/module_dialog_adas_dispatch_remind.xml" value="0.35734252929687504" />
<entry key="modules/mogo-module-service/src/main/res/layout/module_services_fragment_online_car_panel.xml" value="0.28919677734374993" />
</map>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>

View File

@@ -1,5 +1,12 @@
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;
@@ -8,7 +15,7 @@ import android.os.Message;
import com.mogo.map.MogoLatLng;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.module.adas.entity.AdasAutoPilotLocReceiverBean;
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;
@@ -27,14 +34,9 @@ import com.zhidao.support.adas.high.bean.AutopilotStatus;
import java.util.ArrayList;
import java.util.List;
import static com.mogo.module.adas.AdasConstant.MODULE_TAG;
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;
//todo 后续拆解是否放到网约车模块,画线部分已与产品沟通,放入后续迭代需求
//负责监听自动驾驶状态并进行状态上报,自动驾驶路线上报,接收调度指令展示指令弹窗
public class AdasAutoPilotManager implements IMogoOnMessageListener<AdasAutoPilotLocReceiverBean>
public class AdasAutoPilotManager implements IMogoOnMessageListener<DispatchAdasAutoPilotLocReceiverBean>
, IAdasDataListener
, DispatchRemindDialog.IDispatchRemindClickListener
, IMogoCarLocationChangedListener2 {
@@ -50,7 +52,7 @@ public class AdasAutoPilotManager implements IMogoOnMessageListener<AdasAutoPilo
private LineOverlayManager lineOverlayManager;
private MogoLocation mogoLocation;
private IDispatchResultListener dispatchResultListener;
private AdasAutoPilotLocReceiverBean receiverBean;
private DispatchAdasAutoPilotLocReceiverBean receiverBean;
private List<MogoLatLng> latLngList;
private boolean drawLine;
@@ -74,8 +76,8 @@ public class AdasAutoPilotManager implements IMogoOnMessageListener<AdasAutoPilo
public void handleMessage(Message msg) {
super.handleMessage(msg);
if (msg.what == MSG_TYPE_SHOW_DIALOG) {
AdasAutoPilotLocReceiverBean msgData = (AdasAutoPilotLocReceiverBean) msg.obj;
dispatchRemindDialog.showDialog(msgData.getPoiAddress());
DispatchAdasAutoPilotLocReceiverBean msgData = (DispatchAdasAutoPilotLocReceiverBean) msg.obj;
dispatchRemindDialog.showDialog(msgData.getEndLocAddress());
}
}
};
@@ -101,26 +103,29 @@ public class AdasAutoPilotManager implements IMogoOnMessageListener<AdasAutoPilo
}
@Override
public Class<AdasAutoPilotLocReceiverBean> target() {
return AdasAutoPilotLocReceiverBean.class;
public Class<DispatchAdasAutoPilotLocReceiverBean> target() {
return DispatchAdasAutoPilotLocReceiverBean.class;
}
@Override
public void onMsgReceived(AdasAutoPilotLocReceiverBean adasAutoPilotLocReceiverBean) {
public void onMsgReceived(DispatchAdasAutoPilotLocReceiverBean adasAutoPilotLocReceiverBean) {
if (adasAutoPilotLocReceiverBean != null
&& adasAutoPilotLocReceiverBean.getLat() != 0.0
&& adasAutoPilotLocReceiverBean.getLon() != 0.0
&& adasAutoPilotLocReceiverBean.getPoiAddress() != null) {
if (AdasEventManager.getInstance().getAutopilotValuesStatus() != null &&
AdasEventManager.getInstance().getAutopilotValuesStatus().getPilotmode() == 1) {
Logger.d(TAG, "onMsgReceived 接收到服务端调度信息,但现在已经在自动驾驶状态,下发重复 略过");
return;
&& 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);
}
this.receiverBean = adasAutoPilotLocReceiverBean;
Message message = new Message();
message.what = MSG_TYPE_SHOW_DIALOG;
message.obj = adasAutoPilotLocReceiverBean;
handler.sendMessage(message);
}
}
@@ -150,8 +155,8 @@ public class AdasAutoPilotManager implements IMogoOnMessageListener<AdasAutoPilo
Logger.d(TAG, "");
if (dispatchResultListener != null) {
DispatchResult dispatchResult = new DispatchResult(
new StartLatLon(mogoLocation.getLatitude(), mogoLocation.getLongitude()),
new EndLatLon(receiverBean.getLat(), receiverBean.getLon()));
new StartLatLon(receiverBean.getStartLat(), receiverBean.getStartLon()),
new EndLatLon(receiverBean.getEndLat(), receiverBean.getEndLon()));
DispatchData dispatchData = new DispatchData("aiCloudToStartAutopilot", dispatchResult);
dispatchResultListener.dispatchAffirm(GsonUtil.jsonFromObject(dispatchData));
}
@@ -213,10 +218,13 @@ public class AdasAutoPilotManager implements IMogoOnMessageListener<AdasAutoPilo
public void test() {
Logger.d(TAG, "test to trigger mock autopilot");
AdasAutoPilotLocReceiverBean adasAutoPilotLocReceiverBean = new AdasAutoPilotLocReceiverBean(
"1", 26.825571122, 112.5762410415, "测试数据", System.currentTimeMillis());
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.getPoiAddress());
dispatchRemindDialog.showDialog(adasAutoPilotLocReceiverBean.getEndLocAddress());
}
public void testNotifyAutopilotState() {

View File

@@ -1,69 +0,0 @@
package com.mogo.module.adas.entity;
public class AdasAutoPilotLocReceiverBean {
private String poiId;
private double lat;
private double lon;
private String poiAddress;
private long systemTime;
public AdasAutoPilotLocReceiverBean(String poiId, double lat, double lon, String poiAddress, long systemTime) {
this.poiId = poiId;
this.lat = lat;
this.lon = lon;
this.poiAddress = poiAddress;
this.systemTime = systemTime;
}
public String getPoiId() {
return poiId;
}
public void setPoiId(String poiId) {
this.poiId = poiId;
}
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;
}
public String getPoiAddress() {
return poiAddress;
}
public void setPoiAddress(String poiAddress) {
this.poiAddress = poiAddress;
}
public long getSystemTime() {
return systemTime;
}
public void setSystemTime(long systemTime) {
this.systemTime = systemTime;
}
@Override
public String toString() {
return "AdasAutoPilotLocReceiverBean{" +
"poiId=" + poiId +
", lat=" + lat +
", lon=" + lon +
", poiAddress='" + poiAddress + '\'' +
", systemTime=" + systemTime +
'}';
}
}

View File

@@ -0,0 +1,165 @@
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 +
'}';
}
}