Merge branch 'dev/dev_eagle_architecture_upgrade' into dev/dev_eagle_check
# Conflicts: # app/build.gradle # app/src/main/java/com/mogo/launcher/MogoApplication.java # gradle.properties # 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/status/EnvStatusManager.java # services/mogo-service-api/src/main/java/com/mogo/service/IMogoServiceApis.java # services/mogo-service-api/src/main/java/com/mogo/service/MogoServicePaths.java # services/mogo-service/src/main/java/com/mogo/service/impl/MogoServiceApis.java
This commit is contained in:
@@ -17,7 +17,7 @@ import com.mogo.module.service.marker.MapMarkerManager;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.adas.IMogoADASController;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.connection.IMogoSocketManager;
|
||||
import com.mogo.service.cloud.socket.IMogoSocketManager;
|
||||
import com.mogo.service.datamanager.IMogoDataManager;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.imageloader.IMogoImageloader;
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import com.mogo.commons.FunctionBuildConfig;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.storage.SpStorage;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
@@ -832,8 +833,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
return;
|
||||
}
|
||||
mInternalUnWakeupRegisterStatus = true;
|
||||
// AIAssist.getInstance( mContext ).registerUnWakeupCommand( ServiceConst.CMD_UN_WAKE_PREV,ServiceConst.CMD_UN_WAKE_PREV_UN_WAKE_WORDS, this );
|
||||
// AIAssist.getInstance( mContext ).registerUnWakeupCommand( ServiceConst.CMD_UN_WAKE_NEXT,ServiceConst.CMD_UN_WAKE_NEXT_UN_WAKE_WORDS, this );
|
||||
AIAssist.getInstance( mContext ).registerUnWakeupCommand( ServiceConst.CMD_UN_WAKEUP_MY_LOCATION, ServiceConst.CMD_UN_WAKEUP_WORDS_MY_LOCATION, this );
|
||||
}
|
||||
|
||||
@@ -845,8 +844,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
return;
|
||||
}
|
||||
mInternalUnWakeupRegisterStatus = false;
|
||||
// AIAssist.getInstance( mContext ).unregisterUnWakeupCommand( ServiceConst.CMD_UN_WAKE_PREV, this );
|
||||
// AIAssist.getInstance( mContext ).unregisterUnWakeupCommand( ServiceConst.CMD_UN_WAKE_NEXT, this );
|
||||
AIAssist.getInstance( mContext ).unregisterUnWakeupCommand( ServiceConst.CMD_UN_WAKEUP_MY_LOCATION, this );
|
||||
}
|
||||
|
||||
@@ -982,10 +979,11 @@ public class MogoServices implements IMogoMapListener,
|
||||
data.putOpt( "heading", stateInfo.getValues().getHeading() );
|
||||
data.putOpt( "acceleration", stateInfo.getValues().getAcceleration() );
|
||||
data.putOpt( "yawRate", stateInfo.getValues().getYaw_rate() );
|
||||
data.putOpt( "gpsProvider", 1 );
|
||||
try {
|
||||
data.putOpt( "systemTime", Long.parseLong( stateInfo.getValues().getSystemTime() ) );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
// e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
data.putOpt( "satelliteTime", Long.parseLong( stateInfo.getValues().getSatelliteTime() ) );
|
||||
@@ -995,12 +993,12 @@ public class MogoServices implements IMogoMapListener,
|
||||
try {
|
||||
data.putOpt( "receiverDataTime", Long.parseLong( stateInfo.getValues().getReceiverDataTime() ) );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
// e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
data.putOpt( "adasSatelliteTime", Long.parseLong( stateInfo.getValues().getAdasSatelliteTime() ) );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
// e.printStackTrace();
|
||||
}
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map( data );
|
||||
SnapshotLocationDataCenter.getInstance().syncAdasLocationInfo( data );
|
||||
|
||||
@@ -3,8 +3,8 @@ package com.mogo.module.service.autopilot;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.service.adas.RemoteControlAutoPilotParameters;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.service.connection.IMogoSocketManager;
|
||||
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
|
||||
import com.mogo.service.cloud.socket.IMogoSocketManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
|
||||
@@ -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,275 @@
|
||||
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.cloud.commons.utils.CoordinateUtils;
|
||||
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.IMogoServiceApis;
|
||||
import com.mogo.service.adas.IMogoAdasOCHCallback;
|
||||
import com.mogo.service.adas.RemoteControlAutoPilotParameters;
|
||||
import com.mogo.service.adas.entity.AdasOCHData;
|
||||
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
|
||||
import com.mogo.service.entrance.IMogoEntranceAutopilotStatusClickListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
//负责监听自动驾驶状态并进行状态上报,自动驾驶路线上报,接收调度指令展示指令弹窗
|
||||
public class DispatchAutoPilotManager implements IMogoOnMessageListener<DispatchAdasAutoPilotLocReceiverBean>
|
||||
, IDispatchRemindClickListener
|
||||
, IMogoCarLocationChangedListener2, IMogoAdasOCHCallback, IMogoEntranceAutopilotStatusClickListener {
|
||||
|
||||
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 boolean isDispatch = false;
|
||||
private boolean isArriveEnd = false;
|
||||
|
||||
private IMogoServiceApis mApis;
|
||||
|
||||
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;
|
||||
}
|
||||
isDispatch = true;
|
||||
isArriveEnd = false;
|
||||
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;
|
||||
mApis = MogoApisHandler.getInstance().getApis();
|
||||
|
||||
mApis.getSocketManagerApi(context).registerOnMessageListener(MSG_SOCKET_TYPE, this);
|
||||
mApis.getRegisterCenterApi()
|
||||
.registerCarLocationChangedListener(TAG, this);
|
||||
mApis.getAdasControllerApi()
|
||||
.addAdasOCHCallback(this);
|
||||
mApis.getEntranceButtonController().addEntranceAutopilotStatusClickListener(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() {
|
||||
startAutoPilot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String msg) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void startAutoPilot() {
|
||||
RemoteControlAutoPilotParameters currentAutopilot = new RemoteControlAutoPilotParameters();
|
||||
currentAutopilot.isSpeakVoice = false;
|
||||
List<RemoteControlAutoPilotParameters.AutoPilotLonLat> wayLatLon = new ArrayList<>();
|
||||
for (MogoLatLng mogoLatLng : receiverBean.getStopsList()) {
|
||||
wayLatLon.add(new RemoteControlAutoPilotParameters.AutoPilotLonLat(mogoLatLng.lat, mogoLatLng.lon));
|
||||
}
|
||||
currentAutopilot.wayLatLons = wayLatLon;
|
||||
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);
|
||||
mApis.getAdasControllerApi().aiCloudToAdasData(currentAutopilot);
|
||||
}
|
||||
|
||||
@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) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArriveAt(AdasOCHData data) {
|
||||
Logger.d(TAG, "onArriveAt data : " + data.toString());
|
||||
double endLat = data.lat;
|
||||
double endLon = data.lon;
|
||||
// 计算是不是到了终点
|
||||
float distanceFromSelf = CoordinateUtils.calculateLineDistance(receiverBean.getEndLon(), receiverBean.getEndLat()
|
||||
, endLon, endLat);
|
||||
Logger.d(TAG, "onArriveAt cal distance : " + distanceFromSelf);
|
||||
if (distanceFromSelf < 10) {
|
||||
Logger.d(TAG, "onArriveAt end location");
|
||||
isDispatch = false;
|
||||
isArriveEnd = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateChanged(int state, String reason) {
|
||||
autoPilotStatus = state;
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void click() {
|
||||
// 确保到达终点后,再次点击,不会有回馈,并且在下次调开始时,才会重置
|
||||
if (isArriveEnd) {
|
||||
return;
|
||||
}
|
||||
//todo 确认是否要根据停靠时自动驾驶状态,再次开启自动驾驶
|
||||
// 确保处于调度中并且返回的自动驾驶状态为1才开启自动驾驶
|
||||
if (isDispatch ) {
|
||||
startAutoPilot();
|
||||
}
|
||||
}
|
||||
|
||||
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(), new ArrayList<>());
|
||||
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(), new ArrayList<>());
|
||||
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(), new ArrayList<>());
|
||||
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) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -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,180 @@
|
||||
package com.mogo.module.service.dispatch.bean;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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;
|
||||
private List<MogoLatLng> stopsList;
|
||||
|
||||
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, List<MogoLatLng> stopsList) {
|
||||
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;
|
||||
this.stopsList = stopsList;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public List<MogoLatLng> getStopsList() {
|
||||
return stopsList;
|
||||
}
|
||||
|
||||
public void setStopsList(List<MogoLatLng> stopsList) {
|
||||
this.stopsList = stopsList;
|
||||
}
|
||||
|
||||
@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 +
|
||||
", stopsList=" + stopsList +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -553,7 +553,7 @@ public class MockIntentHandler implements IntentHandler {
|
||||
.position(new MogoLatLng(39.981971055705, 116.41150648393))
|
||||
.gps(true)
|
||||
.controlAngle(true)
|
||||
.icon3DRes(R.raw.othercar)
|
||||
.icon3DRes(R.raw.special_vehicle)
|
||||
.rotate((float) 358.526123);
|
||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(context).addMarker(DataTypes.TYPE_MARKER_ADAS, options);
|
||||
List<MogoLatLng> latLngs = new ArrayList<>();
|
||||
@@ -729,7 +729,7 @@ public class MockIntentHandler implements IntentHandler {
|
||||
try {
|
||||
if (readers != null) {
|
||||
for (BufferedReader reader : readers) {
|
||||
reader.close();
|
||||
if (reader != null) reader.close();
|
||||
}
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
@@ -902,8 +902,8 @@ public class MockIntentHandler implements IntentHandler {
|
||||
final long start = System.currentTimeMillis();
|
||||
|
||||
if (readers == null) {
|
||||
readers = new BufferedReader[200];
|
||||
for (int i = 0; i < 200; i++) {
|
||||
readers = new BufferedReader[10];
|
||||
for (int i = 0; i < 10; i++) {
|
||||
readers[i] = new BufferedReader(new InputStreamReader(AbsMogoApplication.getApp().getAssets().open("adas" + i + ".txt")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.network.ParamsProvider;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
@@ -23,7 +22,7 @@ import com.mogo.module.service.network.ZhidaoRefreshModel;
|
||||
import com.mogo.module.service.network.bean.LauncherCardAdvertisementData;
|
||||
import com.mogo.module.service.network.bean.TtsConfigBody;
|
||||
import com.mogo.module.service.network.bean.TtsConfigData;
|
||||
import com.mogo.service.passport.IMogoTicketCallback;
|
||||
import com.mogo.service.cloud.passport.IMogoTicketCallback;
|
||||
import com.mogo.utils.AppUtils;
|
||||
import com.mogo.utils.NetworkUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -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;
|
||||
@@ -10,7 +11,7 @@ import android.os.Bundle;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
|
||||
import com.mogo.service.locationinfo.CloudLocationInfo;
|
||||
import com.mogo.service.cloud.location.CloudLocationInfo;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public class MogoRTKLocation {
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.text.TextUtils;
|
||||
|
||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.FunctionBuildConfig;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
@@ -19,7 +20,6 @@ import com.mogo.module.common.drawer.AdasRecognizedResultDrawer;
|
||||
import com.mogo.module.common.drawer.MarkerDrawer;
|
||||
import com.mogo.module.common.drawer.OnlineCarDrawer;
|
||||
import com.mogo.module.common.drawer.RoadConditionDrawer;
|
||||
import com.mogo.module.common.drawer.SnapshotSetDataDrawer;
|
||||
import com.mogo.module.common.drawer.marker.IMarkerView;
|
||||
import com.mogo.module.common.drawer.marker.MapMarkerAdapter;
|
||||
import com.mogo.module.common.drawer.marker.OnlineCarMarkerView;
|
||||
@@ -37,7 +37,7 @@ import com.mogo.module.service.network.RefreshModel;
|
||||
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.cloud.socket.IMogoLifecycleListener;
|
||||
import com.mogo.service.module.IMogoBizActionDoneListener;
|
||||
import com.mogo.utils.ResourcesHelper;
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
@@ -101,6 +101,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* @param context 上下文对象
|
||||
*/
|
||||
public void init(Context context) {
|
||||
Logger.d(TAG, "<------init------>");
|
||||
|
||||
if (mContext != null) {
|
||||
return;
|
||||
@@ -146,11 +147,11 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
@Override
|
||||
public void onMsgReceived(SocketDownData.LauncherSnapshotProto mogoSnapshotSetData) {
|
||||
DebugConfig.setStatus(DebugConfig.sDownloadSnapshot, true);
|
||||
// SnapshotSetDataDrawer.getInstance().renderSnapshotData(mogoSnapshotSetData);
|
||||
// Message msg = mSnapshotHandler.obtainMessage();
|
||||
// msg.obj = mogoSnapshotSetData;
|
||||
// msg.what = MSG_SNAPSHOT;
|
||||
// msg.sendToTarget();
|
||||
// SnapshotSetDataDrawer.getInstance().renderSnapshotData(mogoSnapshotSetData);
|
||||
// Message msg = mSnapshotHandler.obtainMessage();
|
||||
// msg.obj = mogoSnapshotSetData;
|
||||
// msg.what = MSG_SNAPSHOT;
|
||||
// msg.sendToTarget();
|
||||
}
|
||||
});
|
||||
MogoApisHandler.getInstance()
|
||||
@@ -175,85 +176,89 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
|
||||
// adas 每隔一定频率传递过来的数据
|
||||
MarkerServiceHandler.getApis().getAdasControllerApi().addAdasRecognizedDataCallback(resultList -> {
|
||||
// Message msg = mSnapshotHandler.obtainMessage();
|
||||
// msg.obj = resultList;
|
||||
// msg.what = MSG_ADAS;
|
||||
// msg.sendToTarget();
|
||||
AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult(resultList);
|
||||
// Message msg = mSnapshotHandler.obtainMessage();
|
||||
// msg.obj = resultList;
|
||||
// msg.what = MSG_ADAS;
|
||||
// msg.sendToTarget();
|
||||
// 使用与渠道配置一样的gps提供者提供的数据 修改fPadLenovo.gradle文件中的GPS_PROVIDER字段控制渲染来源
|
||||
Logger.d(TAG, "result.addAdasRecognizedDataCallback == 3 ------> ");
|
||||
if (FunctionBuildConfig.gpsProvider != 2) {
|
||||
AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult(resultList);
|
||||
}
|
||||
|
||||
//添加自车的定位图标,碰撞只有一个预警,还需要和adas 联调,
|
||||
// for ( ADASRecognizedResult result : resultList) {
|
||||
// if (result.drawlevel == 3) { //找出可能碰撞的车
|
||||
// Logger.d("liyz", "result.drawlevel == 3 ------> ");
|
||||
//// 绘制他车的线,从列表中查出可能碰撞的车的经纬度(没有或者只有一个),然后预设20米的长度
|
||||
//// 绘制碰撞的他车指引线,需要实时给数据更新 TODO
|
||||
// drawLimberCollisionPolyline(result);
|
||||
// //通过这个传值到 AMapViewWrapper,根据数据更新自车的模型数据
|
||||
// MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().setAdasRecognizedResult(result.drawlevel);
|
||||
// }
|
||||
// }
|
||||
// for ( ADASRecognizedResult result : resultList) {
|
||||
// if (result.drawlevel == 3) { //找出可能碰撞的车
|
||||
// Logger.d("liyz", "result.drawlevel == 3 ------> ");
|
||||
//// 绘制他车的线,从列表中查出可能碰撞的车的经纬度(没有或者只有一个),然后预设20米的长度
|
||||
//// 绘制碰撞的他车指引线,需要实时给数据更新 TODO
|
||||
// drawLimberCollisionPolyline(result);
|
||||
// //通过这个传值到 AMapViewWrapper,根据数据更新自车的模型数据
|
||||
// MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().setAdasRecognizedResult(result.drawlevel);
|
||||
// }
|
||||
// }
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * 实时绘制连线
|
||||
// *
|
||||
// * @param result
|
||||
// */
|
||||
// private void drawLimberCollisionPolyline(ADASRecognizedResult result) {
|
||||
// if (result != null) {
|
||||
// IMogoPolyline polyLine = LimberCollisionPolyline.getInstance().getPolyLine();
|
||||
// MogoLatLng startLatLng = new MogoLatLng(result.lat, result.lon);
|
||||
// MogoLatLng endLatlng = Trigonometric.getNewLocation(startLatLng, 20, result.heading);
|
||||
// Log.d(TAG, "红色区域起始点 = " + startLatLng.lon + "," + startLatLng.lat
|
||||
// + "终点" + endLatlng.lon + "," + endLatlng.lat + "--heading =" + result.heading);
|
||||
// if (polyLine != null) {
|
||||
// Log.d(TAG, "drawStopLine polyLine != null");
|
||||
// polyLine.setPoints(Arrays.asList(startLatLng, endLatlng));
|
||||
// } else {
|
||||
// List<MogoLatLng> latLngs = new ArrayList<>();
|
||||
// latLngs.add(startLatLng);
|
||||
// latLngs.add(endLatlng);
|
||||
// LimberCollisionPolyline.getInstance().draw((float) result.roadWidth, latLngs);
|
||||
// }
|
||||
// } else {
|
||||
// LimberCollisionPolyline.getInstance().clearLine();
|
||||
// }
|
||||
// }
|
||||
// /**
|
||||
// * 实时绘制连线
|
||||
// *
|
||||
// * @param result
|
||||
// */
|
||||
// private void drawLimberCollisionPolyline(ADASRecognizedResult result) {
|
||||
// if (result != null) {
|
||||
// IMogoPolyline polyLine = LimberCollisionPolyline.getInstance().getPolyLine();
|
||||
// MogoLatLng startLatLng = new MogoLatLng(result.lat, result.lon);
|
||||
// MogoLatLng endLatlng = Trigonometric.getNewLocation(startLatLng, 20, result.heading);
|
||||
// Log.d(TAG, "红色区域起始点 = " + startLatLng.lon + "," + startLatLng.lat
|
||||
// + "终点" + endLatlng.lon + "," + endLatlng.lat + "--heading =" + result.heading);
|
||||
// if (polyLine != null) {
|
||||
// Log.d(TAG, "drawStopLine polyLine != null");
|
||||
// polyLine.setPoints(Arrays.asList(startLatLng, endLatlng));
|
||||
// } else {
|
||||
// List<MogoLatLng> latLngs = new ArrayList<>();
|
||||
// latLngs.add(startLatLng);
|
||||
// latLngs.add(endLatlng);
|
||||
// LimberCollisionPolyline.getInstance().draw((float) result.roadWidth, latLngs);
|
||||
// }
|
||||
// } else {
|
||||
// LimberCollisionPolyline.getInstance().clearLine();
|
||||
// }
|
||||
// }
|
||||
|
||||
// private final static int MSG_SNAPSHOT = 1;
|
||||
// private final static int MSG_ADAS = 2;
|
||||
//
|
||||
// /**
|
||||
// * todo 后续从云端和adas侧拿到的数据 需求对数据流进行重新架构以扩展除添加marker外的其他预警类业务
|
||||
// * todo (应需要模块主动注册adas或云端数据回调,在具体模块内添加绘制需求,需要与地图侧确认是否支持并发)
|
||||
// */
|
||||
// private final Handler mSnapshotHandler = new Handler(WorkThreadHandler.newInstance("snapshot-thread").getLooper()) {
|
||||
// @Override
|
||||
// public void handleMessage(Message msg) {
|
||||
// super.handleMessage(msg);
|
||||
// switch (msg.what) {
|
||||
// case MSG_SNAPSHOT:
|
||||
// if (msg.obj instanceof SocketDownData.LauncherSnapshotProto) {
|
||||
// SnapshotSetDataDrawer.getInstance().renderSnapshotData(((SocketDownData.LauncherSnapshotProto) msg.obj));
|
||||
// } else {
|
||||
// SnapshotSetDataDrawer.getInstance().renderSnapshotData(null);
|
||||
// }
|
||||
// break;
|
||||
// case MSG_ADAS:
|
||||
// // 绘制近景识别到的车辆
|
||||
// if (msg.obj instanceof List) {
|
||||
// List<ADASRecognizedResult> recognizedResults = (List<ADASRecognizedResult>) msg.obj;
|
||||
// AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult(recognizedResults);
|
||||
// }
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
// private final static int MSG_SNAPSHOT = 1;
|
||||
// private final static int MSG_ADAS = 2;
|
||||
//
|
||||
// /**
|
||||
// * todo 后续从云端和adas侧拿到的数据 需求对数据流进行重新架构以扩展除添加marker外的其他预警类业务
|
||||
// * todo (应需要模块主动注册adas或云端数据回调,在具体模块内添加绘制需求,需要与地图侧确认是否支持并发)
|
||||
// */
|
||||
// private final Handler mSnapshotHandler = new Handler(WorkThreadHandler.newInstance("snapshot-thread").getLooper()) {
|
||||
// @Override
|
||||
// public void handleMessage(Message msg) {
|
||||
// super.handleMessage(msg);
|
||||
// switch (msg.what) {
|
||||
// case MSG_SNAPSHOT:
|
||||
// if (msg.obj instanceof SocketDownData.LauncherSnapshotProto) {
|
||||
// SnapshotSetDataDrawer.getInstance().renderSnapshotData(((SocketDownData.LauncherSnapshotProto) msg.obj));
|
||||
// } else {
|
||||
// SnapshotSetDataDrawer.getInstance().renderSnapshotData(null);
|
||||
// }
|
||||
// break;
|
||||
// case MSG_ADAS:
|
||||
// // 绘制近景识别到的车辆
|
||||
// if (msg.obj instanceof List) {
|
||||
// List<ADASRecognizedResult> recognizedResults = (List<ADASRecognizedResult>) msg.obj;
|
||||
// AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult(recognizedResults);
|
||||
// }
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
|
||||
/**
|
||||
* 地图上的Marker点击回调
|
||||
@@ -657,9 +662,9 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
int radius,
|
||||
boolean fitBounds) {
|
||||
|
||||
// if ( DebugConfig.isNeedUploadCoordinatesDurationInTime() ) {//todo 实时在线车辆需要注释,否则在2D模式下不能展示
|
||||
// return;
|
||||
// }
|
||||
// if ( DebugConfig.isNeedUploadCoordinatesDurationInTime() ) {//todo 实时在线车辆需要注释,否则在2D模式下不能展示
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (DebugConfig.isDebug()) {
|
||||
if (!DebugConfig.isRequestOnlineCarData()) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
@@ -17,6 +18,7 @@ import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.wm.WindowManagerView;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.utils.NetworkUtils;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
|
||||
import static com.mogo.utils.CommonUtils.getVersionName;
|
||||
|
||||
@@ -80,7 +82,14 @@ public class EnvStatusManager {
|
||||
"网络状态",
|
||||
"App版本",
|
||||
"Map版本",
|
||||
<<<<<<< HEAD
|
||||
"SN"
|
||||
=======
|
||||
"SN",
|
||||
"OBU状态",
|
||||
"HV状态",
|
||||
"RV状态"
|
||||
>>>>>>> dev/dev_eagle_architecture_upgrade
|
||||
};
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (int i = 0; i < sStatusName.length; i++) {
|
||||
@@ -100,6 +109,18 @@ public class EnvStatusManager {
|
||||
}
|
||||
} else if(i == 10){
|
||||
stringBuilder.append(MoGoAiCloudClientConfig.getInstance().getSn()).append("\n");
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
} else if (i == 11) {
|
||||
boolean isObuConnect = SharedPrefsMgr.getInstance(mContext).getBoolean("OBU", false);
|
||||
stringBuilder.append(isObuConnect == true ? "已连接" : "未连接").append("\n");
|
||||
} else if (i == 12) {
|
||||
boolean isHv = SharedPrefsMgr.getInstance( mContext ).getBoolean("OBU_HV", false );
|
||||
stringBuilder.append(isHv == true ? "已连接" : "未连接").append("\n");
|
||||
} else if (i == 13) {
|
||||
boolean isRv = SharedPrefsMgr.getInstance( mContext ).getBoolean("OBU_RV", false );
|
||||
stringBuilder.append(isRv == true ? "已连接" : "未连接").append("\n");
|
||||
>>>>>>> dev/dev_eagle_architecture_upgrade
|
||||
} else {
|
||||
stringBuilder.append("true".equals(DebugConfig.getStatus(i, true)) ? "正常" : "异常").append("\n");
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import com.mogo.module.service.network.bean.MockSocketSendData;
|
||||
import com.mogo.realtime.api.MoGoAiCloudRealTime;
|
||||
import com.mogo.realtime.socket.IMogoCloudOnMsgListener;
|
||||
import com.mogo.service.adas.IMogoADASController;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.mogo.module.service.utils;
|
||||
import android.location.Location;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.service.locationinfo.CloudLocationInfo;
|
||||
import com.mogo.service.cloud.location.CloudLocationInfo;
|
||||
|
||||
/**
|
||||
* 定位数据类型转换工具
|
||||
|
||||
@@ -4,7 +4,7 @@ import android.os.SystemClock;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.service.locationinfo.CloudLocationInfo;
|
||||
import com.mogo.service.cloud.location.CloudLocationInfo;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
Reference in New Issue
Block a user