changed the logic of autopilot status upload
This commit is contained in:
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -20,7 +20,7 @@
|
||||
<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_airport.xml" value="0.31746031746031744" />
|
||||
<entry key="modules/mogo-module-service/src/main/res/layout/module_dialog_adas_dispatch_cars.xml" value="0.4688995215311005" />
|
||||
<entry key="modules/mogo-module-service/src/main/res/layout/module_dialog_adas_dispatch_cars.xml" value="0.596429428757663" />
|
||||
<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>
|
||||
|
||||
@@ -13,7 +13,6 @@ import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.service.dispatch.bean.AutopilotStatus;
|
||||
import com.mogo.module.service.dispatch.bean.DispatchAdasAutoPilotLocReceiverBean;
|
||||
import com.mogo.module.service.dispatch.model.DispatchServiceModel;
|
||||
import com.mogo.module.service.dispatch.model.IDispatch;
|
||||
@@ -34,10 +33,13 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
|
||||
private Context mContext;
|
||||
private static final int MSG_SOCKET_TYPE = 501000;
|
||||
private static final int MSG_TYPE_SHOW_DIALOG = 0;
|
||||
private static final int MSG_TYPE_UPLOAD_AUTOPILOT_STATUS = 1;
|
||||
|
||||
private DispatchDialogManager dispatchDialogManager;
|
||||
private MogoLocation mogoLocation;
|
||||
private DispatchAdasAutoPilotLocReceiverBean receiverBean;
|
||||
private int autoPilotStatus = 0;
|
||||
private String reason = null;
|
||||
|
||||
private DispatchAutoPilotManager() {
|
||||
|
||||
@@ -65,6 +67,9 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
|
||||
}
|
||||
DispatchAdasAutoPilotLocReceiverBean msgData = (DispatchAdasAutoPilotLocReceiverBean) msg.obj;
|
||||
dispatchDialogManager.showDialog(msgData);
|
||||
} else if (msg.what == MSG_TYPE_UPLOAD_AUTOPILOT_STATUS) {
|
||||
DispatchServiceModel.getInstance().uploadAutopilotStatus(autoPilotStatus, reason);
|
||||
handler.sendEmptyMessageDelayed(MSG_TYPE_UPLOAD_AUTOPILOT_STATUS, 1000L);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -79,6 +84,7 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
|
||||
.addAdasOCHCallback(this);
|
||||
dispatchDialogManager = DispatchDialogManager.getInstance(context);
|
||||
dispatchDialogManager.addIDispatchRemindListener(this);
|
||||
handler.sendEmptyMessageDelayed(MSG_TYPE_UPLOAD_AUTOPILOT_STATUS, 1000L);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -158,6 +164,10 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
|
||||
|
||||
}
|
||||
|
||||
public void testAutopilotStatus() {
|
||||
autoPilotStatus = 2;
|
||||
}
|
||||
|
||||
public void testEZhouStart() {
|
||||
Logger.d(TAG, "test to trigger mock testEZhouStart");
|
||||
DispatchAdasAutoPilotLocReceiverBean adasAutoPilotLocReceiverBean = new DispatchAdasAutoPilotLocReceiverBean(
|
||||
@@ -212,12 +222,7 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
|
||||
|
||||
@Override
|
||||
public void onStateChanged(int state, String reason) {
|
||||
AutopilotStatus autopilotStatus = new AutopilotStatus();
|
||||
autopilotStatus.setAction("autopilotstate");
|
||||
AutopilotStatus.ValuesBean valuesBean = new AutopilotStatus.ValuesBean();
|
||||
valuesBean.setState(state);
|
||||
valuesBean.setReason(reason);
|
||||
autopilotStatus.setValues(valuesBean);
|
||||
DispatchServiceModel.getInstance().uploadAutopilotStatus(autopilotStatus);
|
||||
autoPilotStatus = state;
|
||||
this.reason = reason;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@ public class DispatchTestPanelBroadCastReceiver extends BroadcastReceiver {
|
||||
DispatchAutoPilotManager.getInstance().testHengYangStart();
|
||||
} else if (sceneType == 3) { //验证自动驾驶调度上报接口
|
||||
DispatchAutoPilotManager.getInstance().testDispatchResultUpload();
|
||||
} else if (sceneType == 4) { //更改自动驾驶状态上报
|
||||
DispatchAutoPilotManager.getInstance().testAutopilotStatus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,11 +51,16 @@ public class DispatchServiceModel {
|
||||
|
||||
/**
|
||||
* 上报自动驾驶状态
|
||||
*
|
||||
* @param autopilotStatus {@link AutopilotStatus}
|
||||
*/
|
||||
public void uploadAutopilotStatus(AutopilotStatus autopilotStatus) {
|
||||
public void uploadAutopilotStatus(int state, String reason) {
|
||||
AutopilotStatus autopilotStatus = new AutopilotStatus();
|
||||
autopilotStatus.setAction("autopilotstate");
|
||||
AutopilotStatus.ValuesBean valuesBean = new AutopilotStatus.ValuesBean();
|
||||
valuesBean.setState(state);
|
||||
valuesBean.setReason(reason);
|
||||
autopilotStatus.setValues(valuesBean);
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
|
||||
ReportedRoute reportedRoute = new ReportedRoute(sn, autopilotStatus.getValues());
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("sn", sn);
|
||||
|
||||
Reference in New Issue
Block a user