Merge branch 'feature/feature_show_dispatch' into feature/feature_mogo_obu
# Conflicts: # .idea/gradle.xml # .idea/misc.xml # OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/OchBusPresenter.java # OCH/mogo-och-taxi/src/main/res/values/strings.xml # app/src/main/java/com/mogo/launcher/MogoApplication.java # config.gradle # foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java # foudations/mogo-aicloud-services-apk/src/main/java/com/mogo/aicloud/services/socket/MogoAiCloudSocketManager.java # foudations/mogo-aicloud-services-sdk/src/main/java/com/mogo/aicloud/services/socket/MogoAiCloudSocketManager.java # foudations/mogo-commons/src/main/java/com/mogo/commons/constants/SharedPrefsConstants.java # gradle.properties # libraries/map-custom/build.gradle # libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java # libraries/map-custom/src/main/java/com/mogo/map/impl/custom/uicontroller/AMapUIController.java # modules/mogo-module-common/src/main/java/com/mogo/module/common/datacenter/SnapshotLocationDataCenter.java # modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/AdasRecognizedResultDrawer.java # modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/BaseDrawer.java # modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java # modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java # modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java # modules/mogo-module-service/src/main/java/com/mogo/module/service/spi/SPIRealTimeUpload.java # modules/mogo-module-service/src/main/java/com/mogo/module/service/status/EnvStatusManager.java # modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapDirectionView.java # modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapProvider.java # modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java # services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoADASController.java # services/mogo-service-api/src/main/java/com/mogo/service/connection/IMogoSocketManager.java # services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java # services/mogo-service/src/main/java/com/mogo/service/impl/connection/MogoSocketManager.java
This commit is contained in:
@@ -16,6 +16,7 @@ import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.module.common.utils.CarSeries;
|
||||
import com.mogo.module.service.dispatch.DispatchAutoPilotManager;
|
||||
import com.mogo.module.service.location.MogoRTKLocation;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
@@ -104,6 +105,7 @@ public class MogoServiceProvider implements IMogoModuleProvider {
|
||||
// MogoRTKLocation.getInstance().init(); //todo RTK LOCATION Close
|
||||
MogoServices.getInstance().preInit( context );
|
||||
MogoServices.getInstance().init( AbsMogoApplication.getApp() );
|
||||
DispatchAutoPilotManager.getInstance().initSocket(context);
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
}, 5_000L );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.mogo.module.service.dispatch;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.module.service.dispatch.bean.DispatchAdasAutoPilotLocReceiverBean;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
|
||||
public class DispatchAirportDialog extends DispatchBaseDialog {
|
||||
|
||||
private static final String TAG = "DispatchAirportDialog";
|
||||
private IDispatchRemindClickListener mListener;
|
||||
|
||||
private final TextView tvStartLoc;
|
||||
private final TextView tvEndLoc;
|
||||
private final TextView tvTaskTime;
|
||||
private final TextView tvFlightInfo;
|
||||
private final TextView tvTaskContent;
|
||||
|
||||
public DispatchAirportDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
setContentView(R.layout.module_dialog_adas_dispatch_airport);
|
||||
setCanceledOnTouchOutside(false);
|
||||
tvStartLoc = findViewById(R.id.module_services_dispatch_dialog_start_content);
|
||||
tvEndLoc = findViewById(R.id.module_services_dispatch_dialog_end_content);
|
||||
tvTaskTime = findViewById(R.id.module_services_dispatch_dialog_task_time);
|
||||
tvFlightInfo = findViewById(R.id.module_services_dispatch_dialog_flight_time);
|
||||
tvTaskContent = findViewById(R.id.module_services_dispatch_dialog_task_content);
|
||||
Button btnAffirm = (Button) findViewById(R.id.module_services_dispatch_dialog_confirm);
|
||||
btnAffirm.setOnClickListener(v -> {
|
||||
if (mListener != null) {
|
||||
mListener.affirm();
|
||||
dismissDialog();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showDialog(DispatchAdasAutoPilotLocReceiverBean dispatchContent) {
|
||||
show();
|
||||
if (!TextUtils.isEmpty(dispatchContent.getStartLocAddress())) {
|
||||
tvStartLoc.setText(dispatchContent.getStartLocAddress());
|
||||
}
|
||||
if (!TextUtils.isEmpty(dispatchContent.getEndLocAddress())) {
|
||||
tvEndLoc.setText(dispatchContent.getEndLocAddress());
|
||||
}
|
||||
if (!TextUtils.isEmpty(dispatchContent.getTaskTime())) {
|
||||
tvTaskTime.setText(dispatchContent.getTaskTime());
|
||||
}
|
||||
if (!TextUtils.isEmpty(dispatchContent.getFlightInfo())) {
|
||||
tvFlightInfo.setText(dispatchContent.getFlightInfo());
|
||||
}
|
||||
if (!TextUtils.isEmpty(dispatchContent.getTaskInfo())) {
|
||||
tvTaskContent.setText(dispatchContent.getTaskInfo());
|
||||
}
|
||||
}
|
||||
|
||||
private void dismissDialog() {
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addIDispatchRemindListener(IDispatchRemindClickListener listener) {
|
||||
if (listener == null) {
|
||||
Logger.d(TAG, "addIDispatchRemindListener listener is null");
|
||||
return;
|
||||
}
|
||||
this.mListener = listener;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
package com.mogo.module.service.dispatch;
|
||||
|
||||
import static com.mogo.module.service.dispatch.model.DispatchServiceModel.DISPATCH_RESULT_AFFIRM;
|
||||
import static com.mogo.module.service.dispatch.model.DispatchServiceModel.DISPATCH_RESULT_MANUAL_CANCEL;
|
||||
import static com.mogo.module.service.dispatch.model.DispatchServiceModel.DISPATCH_RESULT_TIMER_CANCEL;
|
||||
|
||||
import android.content.Context;
|
||||
import android.location.Location;
|
||||
import android.os.Handler;
|
||||
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.common.MogoApisHandler;
|
||||
import com.mogo.module.service.dispatch.bean.DispatchAdasAutoPilotLocReceiverBean;
|
||||
import com.mogo.module.service.dispatch.model.DispatchServiceModel;
|
||||
import com.mogo.module.service.dispatch.model.IDispatch;
|
||||
import com.mogo.service.adas.IMogoAdasOCHCallback;
|
||||
import com.mogo.service.adas.RemoteControlAutoPilotParameters;
|
||||
import com.mogo.service.adas.entity.AdasOCHData;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
//负责监听自动驾驶状态并进行状态上报,自动驾驶路线上报,接收调度指令展示指令弹窗
|
||||
public class DispatchAutoPilotManager implements IMogoOnMessageListener<DispatchAdasAutoPilotLocReceiverBean>
|
||||
, IDispatchRemindClickListener
|
||||
, IMogoCarLocationChangedListener2, IMogoAdasOCHCallback {
|
||||
|
||||
private static final String TAG = "DispatchAutoPilotManager";
|
||||
private static volatile DispatchAutoPilotManager 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 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() {
|
||||
|
||||
}
|
||||
|
||||
public static DispatchAutoPilotManager getInstance() {
|
||||
if (instance == null) {
|
||||
synchronized (obj) {
|
||||
if (instance == null) {
|
||||
instance = new DispatchAutoPilotManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private final Handler handler = new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
if (msg.what == MSG_TYPE_SHOW_DIALOG) {
|
||||
if (dispatchDialogManager.isShowing()) {
|
||||
Logger.d(TAG, "此时已经有调度,又收到调度信息");
|
||||
return;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public void initSocket(Context context) {
|
||||
mContext = context;
|
||||
MogoApisHandler.getInstance().getApis()
|
||||
.getSocketManagerApi(context).registerOnMessageListener(MSG_SOCKET_TYPE, this);
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi()
|
||||
.registerCarLocationChangedListener(TAG, this);
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi()
|
||||
.addAdasOCHCallback(this);
|
||||
dispatchDialogManager = DispatchDialogManager.getInstance(context);
|
||||
dispatchDialogManager.addIDispatchRemindListener(this);
|
||||
handler.sendEmptyMessageDelayed(MSG_TYPE_UPLOAD_AUTOPILOT_STATUS, 1000L);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<DispatchAdasAutoPilotLocReceiverBean> target() {
|
||||
return DispatchAdasAutoPilotLocReceiverBean.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(DispatchAdasAutoPilotLocReceiverBean adasAutoPilotLocReceiverBean) {
|
||||
if (adasAutoPilotLocReceiverBean != null
|
||||
&& adasAutoPilotLocReceiverBean.getStartLat() != 0.0
|
||||
&& adasAutoPilotLocReceiverBean.getStartLon() != 0.0) {
|
||||
this.receiverBean = adasAutoPilotLocReceiverBean;
|
||||
Message message = new Message();
|
||||
message.what = MSG_TYPE_SHOW_DIALOG;
|
||||
message.obj = adasAutoPilotLocReceiverBean;
|
||||
handler.sendMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void affirm() {
|
||||
dispatchDialogManager.releaseDialog();
|
||||
DispatchServiceModel.getInstance().dispatchResultUpload(DISPATCH_RESULT_AFFIRM, new IDispatch() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
RemoteControlAutoPilotParameters currentAutopilot = new RemoteControlAutoPilotParameters();
|
||||
currentAutopilot.isSpeakVoice = false;
|
||||
currentAutopilot.startLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat(receiverBean.getStartLat(), receiverBean.getStartLon());
|
||||
currentAutopilot.endLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat(receiverBean.getEndLat(), receiverBean.getEndLon());
|
||||
currentAutopilot.vehicleType = 10;
|
||||
Logger.d(TAG, "开启自动驾驶====" + currentAutopilot);
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().aiCloudToAdasData(currentAutopilot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String msg) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(boolean manualTrigger) {
|
||||
dispatchDialogManager.releaseDialog();
|
||||
DispatchServiceModel.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());
|
||||
mogoLocation = loc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged(MogoLatLng mogoLatLng) {
|
||||
|
||||
}
|
||||
|
||||
public void testAutopilotStatus() {
|
||||
autoPilotStatus = 2;
|
||||
}
|
||||
|
||||
public void testEZhouStart() {
|
||||
Logger.d(TAG, "test to trigger mock testEZhouStart");
|
||||
DispatchAdasAutoPilotLocReceiverBean adasAutoPilotLocReceiverBean = new DispatchAdasAutoPilotLocReceiverBean(
|
||||
DispatchAdasAutoPilotLocReceiverBean.DISPATCH_SOURCE_EZHOU, DispatchAdasAutoPilotLocReceiverBean.DISPATCH_TYPE_START, "1",
|
||||
26.825571122, 112.5762410415, "起点---5号跑道",
|
||||
26.825571122, 112.5762410415, "终点---鄂州机场",
|
||||
"5分钟", "AR453航班", "你车需执行编号ca1098次航班的引导任务,从A区A1到B区B1", System.currentTimeMillis());
|
||||
this.receiverBean = adasAutoPilotLocReceiverBean;
|
||||
DispatchDialogManager.getInstance(mContext).showDialog(adasAutoPilotLocReceiverBean);
|
||||
}
|
||||
|
||||
public void testEZhouStop() {
|
||||
Logger.d(TAG, "test to trigger mock testEZhouStop");
|
||||
DispatchAdasAutoPilotLocReceiverBean adasAutoPilotLocReceiverBean = new DispatchAdasAutoPilotLocReceiverBean(
|
||||
DispatchAdasAutoPilotLocReceiverBean.DISPATCH_SOURCE_EZHOU, DispatchAdasAutoPilotLocReceiverBean.DISPATCH_TYPE_STOP, "1",
|
||||
0.0, 0.0, "",
|
||||
0.0, 0.0, "",
|
||||
"", "", "", System.currentTimeMillis());
|
||||
this.receiverBean = adasAutoPilotLocReceiverBean;
|
||||
DispatchDialogManager.getInstance(mContext).showDialog(adasAutoPilotLocReceiverBean);
|
||||
}
|
||||
|
||||
public void testHengYangStart() {
|
||||
Logger.d(TAG, "test to trigger mock testHengYangStart");
|
||||
DispatchAdasAutoPilotLocReceiverBean adasAutoPilotLocReceiverBean = new DispatchAdasAutoPilotLocReceiverBean(
|
||||
DispatchAdasAutoPilotLocReceiverBean.DISPATCH_SOURCE_HENGYANG, DispatchAdasAutoPilotLocReceiverBean.DISPATCH_TYPE_START, "2",
|
||||
26.825571122, 112.5762410415, "衡阳科学城",
|
||||
26.825571122, 112.5762410415, "衡阳首钢集团",
|
||||
"", "", "", System.currentTimeMillis());
|
||||
this.receiverBean = adasAutoPilotLocReceiverBean;
|
||||
DispatchDialogManager.getInstance(mContext).showDialog(adasAutoPilotLocReceiverBean);
|
||||
}
|
||||
|
||||
public void testDispatchResultUpload() {
|
||||
DispatchServiceModel.getInstance().dispatchResultUpload(DISPATCH_RESULT_AFFIRM, new IDispatch() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String msg) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArriveAt(AdasOCHData data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateChanged(int state, String reason) {
|
||||
autoPilotStatus = state;
|
||||
this.reason = reason;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mogo.module.service.dispatch;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.module.common.dialog.BaseFloatDialog;
|
||||
import com.mogo.module.service.dispatch.bean.DispatchAdasAutoPilotLocReceiverBean;
|
||||
|
||||
public abstract class DispatchBaseDialog extends BaseFloatDialog {
|
||||
|
||||
public DispatchBaseDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public abstract void addIDispatchRemindListener(IDispatchRemindClickListener listener);
|
||||
|
||||
public abstract void showDialog(DispatchAdasAutoPilotLocReceiverBean dispatchContent);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.mogo.module.service.dispatch;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.module.service.dispatch.bean.DispatchAdasAutoPilotLocReceiverBean;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public class DispatchCarsDialog extends DispatchBaseDialog{
|
||||
|
||||
private static final String TAG = "DispatchCarsDialog";
|
||||
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 final 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 DispatchCarsDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
setContentView(R.layout.module_dialog_adas_dispatch_cars);
|
||||
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();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void hideDialog() {
|
||||
if (mListener != null) {
|
||||
mListener.cancel(false);
|
||||
}
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
private void dismissDialog(){
|
||||
handler.removeMessages(MSG_TYPE_TIMER);
|
||||
TIMER = 10;
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addIDispatchRemindListener(IDispatchRemindClickListener listener) {
|
||||
if (listener == null) {
|
||||
Logger.d(TAG, "addIDispatchRemindListener listener is null");
|
||||
return;
|
||||
}
|
||||
this.mListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showDialog(DispatchAdasAutoPilotLocReceiverBean dispatchContent) {
|
||||
if(TextUtils.isEmpty(dispatchContent.getEndLocAddress())){
|
||||
return;
|
||||
}
|
||||
show();
|
||||
handler.sendEmptyMessage(MSG_TYPE_TIMER);
|
||||
tvLoc.setText(dispatchContent.getEndLocAddress());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.mogo.module.service.dispatch;
|
||||
|
||||
import static com.mogo.module.service.dispatch.bean.DispatchAdasAutoPilotLocReceiverBean.DISPATCH_SOURCE_EZHOU;
|
||||
import static com.mogo.module.service.dispatch.bean.DispatchAdasAutoPilotLocReceiverBean.DISPATCH_SOURCE_HENGYANG;
|
||||
import static com.mogo.module.service.dispatch.bean.DispatchAdasAutoPilotLocReceiverBean.DISPATCH_TYPE_START;
|
||||
import static com.mogo.module.service.dispatch.bean.DispatchAdasAutoPilotLocReceiverBean.DISPATCH_TYPE_STOP;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.module.service.dispatch.bean.DispatchAdasAutoPilotLocReceiverBean;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public class DispatchDialogManager {
|
||||
|
||||
private static final String TAG = "DispatchDialogManager";
|
||||
private static volatile DispatchDialogManager manager;
|
||||
private static final byte[] obj = new byte[0];
|
||||
private Context mContext;
|
||||
private IDispatchRemindClickListener mListener;
|
||||
private DispatchBaseDialog dialog;
|
||||
|
||||
private DispatchDialogManager(Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
public static DispatchDialogManager getInstance(Context context) {
|
||||
if (manager == null) {
|
||||
synchronized (obj) {
|
||||
if (manager == null) {
|
||||
manager = new DispatchDialogManager(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
return manager;
|
||||
}
|
||||
|
||||
public void addIDispatchRemindListener(IDispatchRemindClickListener listener) {
|
||||
if (listener == null) {
|
||||
Logger.d(TAG, "addIDispatchRemindListener listener is null");
|
||||
return;
|
||||
}
|
||||
this.mListener = listener;
|
||||
}
|
||||
|
||||
public boolean isShowing() {
|
||||
return dialog != null && dialog.isShowing();
|
||||
}
|
||||
|
||||
public void showDialog(DispatchAdasAutoPilotLocReceiverBean msgData) {
|
||||
if (msgData == null) {
|
||||
return;
|
||||
}
|
||||
switch (msgData.getSource()) {
|
||||
case DISPATCH_SOURCE_HENGYANG:
|
||||
dispatchHengYang(msgData);
|
||||
break;
|
||||
case DISPATCH_SOURCE_EZHOU:
|
||||
dispatchEZhou(msgData);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void dispatchHengYang(DispatchAdasAutoPilotLocReceiverBean msgData) {
|
||||
if (msgData.getType() == DISPATCH_TYPE_START) { //衡阳只有开始调度
|
||||
if (dialog != null && dialog.isShowing()) { //避免下发两次
|
||||
return;
|
||||
}
|
||||
if (dialog == null) {
|
||||
dialog = new DispatchCarsDialog(mContext);
|
||||
}
|
||||
dialog.addIDispatchRemindListener(mListener);
|
||||
dialog.showDialog(msgData);
|
||||
}
|
||||
}
|
||||
|
||||
private void dispatchEZhou(DispatchAdasAutoPilotLocReceiverBean msgData) {
|
||||
switch (msgData.getType()) {
|
||||
case DISPATCH_TYPE_START:
|
||||
if (dialog != null && dialog.isShowing()) { //避免下发两次
|
||||
return;
|
||||
}
|
||||
if (dialog == null) {
|
||||
dialog = new DispatchAirportDialog(mContext);
|
||||
}
|
||||
dialog.addIDispatchRemindListener(mListener);
|
||||
dialog.showDialog(msgData);
|
||||
break;
|
||||
case DISPATCH_TYPE_STOP:
|
||||
//语音播报
|
||||
voice();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void voice() {
|
||||
AIAssist.getInstance(mContext).speakTTSVoice("请立即停车!请立即停车!");
|
||||
}
|
||||
|
||||
public void releaseDialog() {
|
||||
if (dialog != null) {
|
||||
if (dialog.isShowing()) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
dialog = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.mogo.module.service.dispatch;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public class DispatchTestPanelBroadCastReceiver extends BroadcastReceiver {
|
||||
|
||||
private static final String TAG = "DispatchTestPanelBroadCastReceiver";
|
||||
|
||||
/**
|
||||
* Adas测试控制面板广播Action
|
||||
*/
|
||||
public static final String BROADCAST_TEST_PANEL_CONTROL_TYPE_EXTRA_KEY = "sceneType";
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
try {
|
||||
int sceneType = intent.getIntExtra(BROADCAST_TEST_PANEL_CONTROL_TYPE_EXTRA_KEY, 0);
|
||||
Logger.d(TAG, "textPanelOpenType:" + sceneType);
|
||||
// 分发场景
|
||||
dispatchSceneTest(sceneType);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分发处理场景
|
||||
*
|
||||
* @param sceneType 场景类型
|
||||
*/
|
||||
private void dispatchSceneTest(int sceneType) {
|
||||
Logger.d(TAG, "sceneType=" + sceneType);
|
||||
if (sceneType == 0) {
|
||||
DispatchAutoPilotManager.getInstance().testEZhouStart();
|
||||
} else if (sceneType == 1) {
|
||||
DispatchAutoPilotManager.getInstance().testEZhouStop();
|
||||
} else if (sceneType == 2) {
|
||||
DispatchAutoPilotManager.getInstance().testHengYangStart();
|
||||
} else if (sceneType == 3) { //验证自动驾驶调度上报接口
|
||||
DispatchAutoPilotManager.getInstance().testDispatchResultUpload();
|
||||
} else if (sceneType == 4) { //更改自动驾驶状态上报
|
||||
DispatchAutoPilotManager.getInstance().testAutopilotStatus();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.mogo.module.service.dispatch;
|
||||
|
||||
public interface IDispatchRemindClickListener {
|
||||
|
||||
void affirm();
|
||||
|
||||
void cancel(boolean manualTrigger);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.mogo.module.service.dispatch.bean;
|
||||
|
||||
/**
|
||||
* Created by XuYong on 2021/5/28 16:12
|
||||
*/
|
||||
public class AutonomousDriveStatusBean {
|
||||
|
||||
private String sn;
|
||||
private int status;
|
||||
private float vehicleSpeed;
|
||||
|
||||
public AutonomousDriveStatusBean(String sn, int status, float vehicleSpeed) {
|
||||
this.sn = sn;
|
||||
this.status = status;
|
||||
this.vehicleSpeed = vehicleSpeed;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public float getVehicleSpeed() {
|
||||
return vehicleSpeed;
|
||||
}
|
||||
|
||||
public void setVehicleSpeed(float vehicleSpeed) {
|
||||
this.vehicleSpeed = vehicleSpeed;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.mogo.module.service.dispatch.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/6/21
|
||||
*/
|
||||
|
||||
public class AutopilotRoute {
|
||||
|
||||
@SerializedName("action")
|
||||
private String action;
|
||||
@SerializedName("models")
|
||||
private List<RouteModels> models;
|
||||
|
||||
public static class RouteModels {
|
||||
@SerializedName("lat")
|
||||
private Double lat;
|
||||
@SerializedName("lon")
|
||||
private Double 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 "RouteModels{" +
|
||||
"lat=" + lat +
|
||||
", lon=" + lon +
|
||||
'}';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public List<RouteModels> getModels() {
|
||||
return models;
|
||||
}
|
||||
|
||||
public void setModels(List<RouteModels> models) {
|
||||
this.models = models;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutopilotRoute{" +
|
||||
"action='" + action + '\'' +
|
||||
", models=" + models +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.mogo.module.service.dispatch.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author nie yunlong
|
||||
* @des
|
||||
* @date 2020/7/14
|
||||
*/
|
||||
public class AutopilotStatus implements Serializable {
|
||||
|
||||
/**
|
||||
* action : autopilotstate
|
||||
* values : {"state":0,"reason":""}
|
||||
*/
|
||||
|
||||
private String action;
|
||||
private ValuesBean values;
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public ValuesBean getValues() {
|
||||
return values;
|
||||
}
|
||||
|
||||
public void setValues(ValuesBean values) {
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
public static class ValuesBean {
|
||||
/**
|
||||
* 0是不可用 1是ready 2是自动驾驶start
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private int state;
|
||||
/**
|
||||
* 车速 m/s
|
||||
*/
|
||||
private float speed;
|
||||
/**
|
||||
* 不可用原因
|
||||
*/
|
||||
private String reason;
|
||||
/**
|
||||
* 摄像头状态 1代表开启,0代表关闭
|
||||
*/
|
||||
private int camera;
|
||||
/**
|
||||
* 雷达状态 1代表开启,0代表关闭
|
||||
*/
|
||||
private int radar;
|
||||
/**
|
||||
* RTK状态 1代表开启,0代表关闭
|
||||
*/
|
||||
private int rtk;
|
||||
/**
|
||||
* 自动驾驶状态 0非自动驾驶,1自动驾驶
|
||||
*/
|
||||
private int pilotmode;
|
||||
|
||||
|
||||
public int getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(int state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public String getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public void setReason(String reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public float getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
public void setSpeed(float speed) {
|
||||
this.speed = speed;
|
||||
}
|
||||
public int getCamera() {
|
||||
return camera;
|
||||
}
|
||||
|
||||
public int getRadar() {
|
||||
return radar;
|
||||
}
|
||||
|
||||
public int getRtk() {
|
||||
return rtk;
|
||||
}
|
||||
|
||||
public int getPilotmode() {
|
||||
return pilotmode;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
package com.mogo.module.service.dispatch.bean;
|
||||
|
||||
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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.mogo.module.service.dispatch.bean;
|
||||
|
||||
import com.mogo.module.service.dispatch.model.DispatchResult;
|
||||
|
||||
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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.mogo.module.service.dispatch.bean;
|
||||
|
||||
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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.mogo.module.service.dispatch.bean;
|
||||
|
||||
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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.mogo.module.service.dispatch.bean;
|
||||
|
||||
/**
|
||||
* Created by XuYong on 2021/5/31 16:24
|
||||
*/
|
||||
public class ReportSiteBean {
|
||||
private String sn;
|
||||
private double lon;
|
||||
private double lat;
|
||||
|
||||
public ReportSiteBean(String sn, double lon, double lat) {
|
||||
this.sn = sn;
|
||||
this.lon = lon;
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.mogo.module.service.dispatch.bean;
|
||||
|
||||
|
||||
/**
|
||||
* 上报自动驾驶规划的路径
|
||||
*/
|
||||
public class ReportedRoute {
|
||||
private String sn;
|
||||
private AutopilotStatus.ValuesBean bean;
|
||||
private String siteList;
|
||||
|
||||
public ReportedRoute(String sn, AutopilotStatus.ValuesBean 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 + "}";
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.mogo.module.service.dispatch.bean;
|
||||
|
||||
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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.mogo.module.service.dispatch.model;
|
||||
|
||||
import com.mogo.module.service.dispatch.bean.EndLatLon;
|
||||
import com.mogo.module.service.dispatch.bean.StartLatLon;
|
||||
|
||||
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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
package com.mogo.module.service.dispatch.model;
|
||||
|
||||
import static com.mogo.commons.context.ContextHolderUtil.getContext;
|
||||
import static com.mogo.module.common.constants.HostConst.DATA_SERVICE_HOST;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.service.dispatch.bean.AutopilotRoute;
|
||||
import com.mogo.module.service.dispatch.bean.AutopilotStatus;
|
||||
import com.mogo.module.service.dispatch.bean.ReportDispatchResult;
|
||||
import com.mogo.module.service.dispatch.bean.ReportedRoute;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
public class DispatchServiceModel {
|
||||
|
||||
private static final String TAG = "DispatchServiceModel";
|
||||
private static volatile DispatchServiceModel 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 IDispatchAdasApiService mAdasApiService;
|
||||
|
||||
private DispatchServiceModel() {
|
||||
this.mAdasApiService = MogoApisHandler.getInstance().getApis().getNetworkApi().create(IDispatchAdasApiService.class, DATA_SERVICE_HOST);
|
||||
}
|
||||
|
||||
public static DispatchServiceModel getInstance() {
|
||||
if (instance == null) {
|
||||
synchronized (obj) {
|
||||
if (instance == null) {
|
||||
instance = new DispatchServiceModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报自动驾驶状态
|
||||
*/
|
||||
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);
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.mogo.module.service.dispatch.model;
|
||||
|
||||
public interface IDispatch {
|
||||
|
||||
void onSuccess();
|
||||
|
||||
void onError(String msg);
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.mogo.module.service.dispatch.model;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.FieldMap;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
public interface IDispatchAdasApiService {
|
||||
|
||||
/**
|
||||
* 上报自动驾驶路径 服务于业务调度
|
||||
*
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* 上报自动驾驶状态 服务于业务调度
|
||||
*
|
||||
* @param parameters map
|
||||
* @return {@link BaseData}
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/dataService/autoDriver/receiveAutopilotState")
|
||||
Observable<BaseData> uploadAutopilotState(@FieldMap Map<String, Object> parameters);
|
||||
}
|
||||
@@ -599,8 +599,8 @@ public class MockIntentHandler implements IntentHandler {
|
||||
DebugConfig.setSelfCarSpeedYOffset(intent.getIntExtra("yOffset", 20));
|
||||
break;
|
||||
case 51:// 模拟路口车辆移动
|
||||
mLocationMockHandler.sendEmptyMessageDelayed(100, 0L);
|
||||
mLocationMockHandler.sendEmptyMessageDelayed(101, 1000L);
|
||||
// mLocationMockHandler.sendEmptyMessageDelayed(100, 0L);
|
||||
// mLocationMockHandler.sendEmptyMessageDelayed(101, 1000L);
|
||||
break;
|
||||
case 52:
|
||||
// 打开连调工控机、ADAS的控制面板
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.module.service.location;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.location.Criteria;
|
||||
import android.location.Location;
|
||||
@@ -29,6 +30,7 @@ public class MogoRTKLocation {
|
||||
private MogoRTKLocation() {
|
||||
}
|
||||
|
||||
@SuppressLint("MissingPermission")
|
||||
public void init() {
|
||||
locationManager = (LocationManager) AbsMogoApplication.getApp().getApplicationContext().getSystemService(Context.LOCATION_SERVICE);
|
||||
String provider = locationManager.getBestProvider(getCriteria(), true);
|
||||
@@ -102,7 +104,7 @@ public class MogoRTKLocation {
|
||||
if (locationManager != null && locationListener != null) {
|
||||
locationManager.removeUpdates(locationListener);
|
||||
} else {
|
||||
Logger.d(TAG, "stop failed , reason : loc" + locationManager + " , or loc listener: " + locationListener + " is null");
|
||||
Logger.d(TAG, "stop failed , listener: " + locationListener + " is null");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ import com.mogo.realtime.api.MoGoAiCloudRealTime;
|
||||
import com.mogo.realtime.socket.IMogoCloudOnMsgListener;
|
||||
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
import com.mogo.service.connection.IMogoLifecycleListener;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedResult;
|
||||
import com.mogo.service.module.IMogoBizActionDoneListener;
|
||||
import com.mogo.utils.ResourcesHelper;
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mogo.module.service.spi;
|
||||
|
||||
import com.elegant.spi.annotations.Service;
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
|
||||
import com.mogo.realtime.api.IRealTimeProvider;
|
||||
import com.mogo.realtime.entity.SocketReceiveDataProto3;
|
||||
|
||||
|
||||
@Service(value = IRealTimeProvider.class)
|
||||
public class SPIRealTimeUpload implements IRealTimeProvider {
|
||||
|
||||
@Override
|
||||
public SocketReceiveDataProto3.SocketReceiveDataProto getLocationMsg() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user