Merge branch 'dev_robotaxi-d-app-module_251_220125_2.5.1' into dev_MogoAP_eagle-220_211207_8.0.17_merge
# Conflicts: # app/build.gradle
This commit is contained in:
@@ -2,14 +2,4 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.module.adas">
|
||||
|
||||
|
||||
<application>
|
||||
<receiver android:name=".receiver.AdasTestPanelBroadCastReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="com.adas.test_panel_control" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -1,269 +0,0 @@
|
||||
package com.mogo.module.adas;
|
||||
|
||||
import static com.mogo.module.adas.AdasConstant.MODULE_TAG;
|
||||
import static com.mogo.module.adas.entity.DispatchAdasAutoPilotLocReceiverBean.DISPATCH_SOURCE_HENGYANG;
|
||||
import static com.mogo.module.adas.entity.DispatchAdasAutoPilotLocReceiverBean.DISPATCH_TYPE_START;
|
||||
import static com.mogo.module.adas.model.AdasServiceModel.DISPATCH_RESULT_AFFIRM;
|
||||
import static com.mogo.module.adas.model.AdasServiceModel.DISPATCH_RESULT_MANUAL_CANCEL;
|
||||
import static com.mogo.module.adas.model.AdasServiceModel.DISPATCH_RESULT_TIMER_CANCEL;
|
||||
|
||||
import android.content.Context;
|
||||
import android.location.Location;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.module.adas.entity.DispatchAdasAutoPilotLocReceiverBean;
|
||||
import com.mogo.module.adas.entity.DispatchData;
|
||||
import com.mogo.module.adas.entity.DispatchResult;
|
||||
import com.mogo.module.adas.entity.EndLatLon;
|
||||
import com.mogo.module.adas.entity.StartLatLon;
|
||||
import com.mogo.module.adas.model.AdasServiceModel;
|
||||
import com.mogo.module.adas.model.IDispatch;
|
||||
import com.mogo.module.adas.overlay.LineOverlayManager;
|
||||
import com.mogo.module.adas.view.DispatchRemindDialog;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotRoute;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
//todo 后续拆解是否放到网约车模块,画线部分已与产品沟通,放入后续迭代需求
|
||||
//负责监听自动驾驶状态并进行状态上报,自动驾驶路线上报,接收调度指令展示指令弹窗
|
||||
public class AdasAutoPilotManager implements IMogoOnMessageListener<DispatchAdasAutoPilotLocReceiverBean>
|
||||
, IAdasDataListener
|
||||
, DispatchRemindDialog.IDispatchRemindClickListener
|
||||
, IMogoCarLocationChangedListener2 {
|
||||
|
||||
private static final String TAG = "AdasAutoPilotManager";
|
||||
private static volatile AdasAutoPilotManager instance;
|
||||
private static final byte[] obj = new byte[0];
|
||||
private Context mContext;
|
||||
private static final int MSG_SOCKET_TYPE = 501000;
|
||||
private static final int MSG_TYPE_SHOW_DIALOG = 0;
|
||||
|
||||
private DispatchRemindDialog dispatchRemindDialog;
|
||||
private LineOverlayManager lineOverlayManager;
|
||||
private IDispatchResultListener dispatchResultListener;
|
||||
private DispatchAdasAutoPilotLocReceiverBean receiverBean;
|
||||
private List<MogoLatLng> latLngList;
|
||||
private boolean drawLine;
|
||||
|
||||
private AdasAutoPilotManager() {
|
||||
|
||||
}
|
||||
|
||||
public static AdasAutoPilotManager getInstance() {
|
||||
if (instance == null) {
|
||||
synchronized (obj) {
|
||||
if (instance == null) {
|
||||
instance = new AdasAutoPilotManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private final Handler handler = new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
if (msg.what == MSG_TYPE_SHOW_DIALOG) {
|
||||
DispatchAdasAutoPilotLocReceiverBean msgData = (DispatchAdasAutoPilotLocReceiverBean) msg.obj;
|
||||
dispatchRemindDialog.showDialog(msgData.getEndLocAddress());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public void initSocket(Context context) {
|
||||
mContext = context;
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getSocketManagerApi(context).registerOnMessageListener(MSG_SOCKET_TYPE, this);
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi()
|
||||
.registerCarLocationChangedListener(MODULE_TAG, this);
|
||||
AdasEventManager.getInstance().addEventListener(this);
|
||||
dispatchRemindDialog = new DispatchRemindDialog(context);
|
||||
dispatchRemindDialog.addIDispatchRemindListener(this);
|
||||
if (lineOverlayManager == null) {
|
||||
lineOverlayManager = new LineOverlayManager(mContext);
|
||||
lineOverlayManager.setIAdasLineOverlayListener(() -> drawLine = false);
|
||||
}
|
||||
}
|
||||
|
||||
public void addIDispatchResult(IDispatchResultListener listener) {
|
||||
this.dispatchResultListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<DispatchAdasAutoPilotLocReceiverBean> target() {
|
||||
return DispatchAdasAutoPilotLocReceiverBean.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(DispatchAdasAutoPilotLocReceiverBean adasAutoPilotLocReceiverBean) {
|
||||
if (adasAutoPilotLocReceiverBean != null
|
||||
&& adasAutoPilotLocReceiverBean.getEndLat() != 0.0
|
||||
&& adasAutoPilotLocReceiverBean.getEndLon() != 0.0
|
||||
&& adasAutoPilotLocReceiverBean.getEndLocAddress() != null) {
|
||||
// if (AdasEventManager.getInstance().getAutopilotValuesStatus() != null &&
|
||||
// AdasEventManager.getInstance().getAutopilotValuesStatus().getPilotmode() == 1) {
|
||||
// Logger.d(TAG, "onMsgReceived 接收到服务端调度信息,但现在已经在自动驾驶状态,下发重复 略过");
|
||||
// return;
|
||||
// }
|
||||
if (adasAutoPilotLocReceiverBean.getSource() == DISPATCH_SOURCE_HENGYANG
|
||||
&& adasAutoPilotLocReceiverBean.getType() == DISPATCH_TYPE_START) {
|
||||
this.receiverBean = adasAutoPilotLocReceiverBean;
|
||||
Message message = new Message();
|
||||
message.what = MSG_TYPE_SHOW_DIALOG;
|
||||
message.obj = adasAutoPilotLocReceiverBean;
|
||||
handler.sendMessage(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyAutopilotState(AutopilotStatusInfo autopilotStatus) {
|
||||
AdasServiceModel.getInstance().uploadAutopilotStatus(autopilotStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void autopilotRoute(AutopilotRouteInfo autopilotRoute) {
|
||||
// if (autopilotRoute == null || autopilotRoute.getModels() == null || autopilotRoute.getModels().size() == 0) {
|
||||
// return;
|
||||
// }
|
||||
// AdasServiceModel.getInstance().uploadAutopilotRoute(autopilotRoute.getModels());
|
||||
// latLngList = new ArrayList<>();
|
||||
// for (AutopilotRoute.RouteModels routeModel : autopilotRoute.getModels()) {
|
||||
// latLngList.add(new MogoLatLng(routeModel.getLat(), routeModel.getLon()));
|
||||
// }
|
||||
// drawLine = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void affirm() {
|
||||
AdasServiceModel.getInstance().dispatchResultUpload(DISPATCH_RESULT_AFFIRM, new IDispatch() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Logger.d(TAG, "");
|
||||
if (dispatchResultListener != null) {
|
||||
DispatchResult dispatchResult = new DispatchResult(
|
||||
new StartLatLon(receiverBean.getStartLat(), receiverBean.getStartLon()),
|
||||
new EndLatLon(receiverBean.getEndLat(), receiverBean.getEndLon()));
|
||||
DispatchData dispatchData = new DispatchData("aiCloudToStartAutopilot", dispatchResult);
|
||||
dispatchResultListener.dispatchAffirm(GsonUtil.jsonFromObject(dispatchData));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String msg) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(boolean manualTrigger) {
|
||||
AdasServiceModel.getInstance().dispatchResultUpload(manualTrigger ?
|
||||
DISPATCH_RESULT_MANUAL_CANCEL : DISPATCH_RESULT_TIMER_CANCEL, new IDispatch() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String msg) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged2(Location location) {
|
||||
//坐标转换
|
||||
MogoLocation loc = new MogoLocation();
|
||||
loc.setTime(loc.getTime());
|
||||
loc.setAccuracy(location.getAccuracy());
|
||||
loc.setSpeed(location.getSpeed());
|
||||
loc.setLongitude(location.getLongitude());
|
||||
loc.setLatitude(location.getLatitude());
|
||||
loc.setAltitude(location.getAltitude());
|
||||
loc.setBearing(location.getBearing());
|
||||
loc.setProvider(location.getProvider());
|
||||
// if (drawLine) {
|
||||
// lineOverlayManager.draw(mogoLocation, latLngList);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged(MogoLatLng mogoLatLng) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 调度指令结果回调
|
||||
*/
|
||||
public interface IDispatchResultListener {
|
||||
//调用确认
|
||||
void dispatchAffirm(String json);
|
||||
}
|
||||
|
||||
public void test() {
|
||||
Logger.d(TAG, "test to trigger mock autopilot");
|
||||
DispatchAdasAutoPilotLocReceiverBean adasAutoPilotLocReceiverBean = new DispatchAdasAutoPilotLocReceiverBean(
|
||||
DISPATCH_SOURCE_HENGYANG, DISPATCH_TYPE_START, "1",
|
||||
26.825571122, 112.5762410415, "测试数据",
|
||||
26.825571122, 112.5762410415, "调度至衡阳首钢",
|
||||
"", "", "开始调度", System.currentTimeMillis());
|
||||
this.receiverBean = adasAutoPilotLocReceiverBean;
|
||||
dispatchRemindDialog.showDialog(adasAutoPilotLocReceiverBean.getEndLocAddress());
|
||||
}
|
||||
|
||||
public void testNotifyAutopilotState() {
|
||||
AutopilotStatusInfo autopilotStatus = new AutopilotStatusInfo();
|
||||
autopilotStatus.setReason("123");
|
||||
autopilotStatus.setSpeed(123);
|
||||
autopilotStatus.setState(0);
|
||||
AdasServiceModel.getInstance().uploadAutopilotStatus(autopilotStatus);
|
||||
}
|
||||
|
||||
public void testUploadAutopilotRoute() {
|
||||
List<AutopilotRoute.RouteModels> list = new ArrayList<>();
|
||||
AutopilotRoute.RouteModels routeModels = new AutopilotRoute.RouteModels();
|
||||
routeModels.setLat(12.12);
|
||||
routeModels.setLon(13.14);
|
||||
list.add(routeModels);
|
||||
AdasServiceModel.getInstance().uploadAutopilotRoute(list);
|
||||
}
|
||||
|
||||
public void testDispatchResultUpload() {
|
||||
AdasServiceModel.getInstance().dispatchResultUpload(DISPATCH_RESULT_AFFIRM, new IDispatch() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String msg) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void testDispatchAutopilot() {
|
||||
DispatchResult dispatchResult = new DispatchResult(
|
||||
new StartLatLon(12.12, 13.13),
|
||||
new EndLatLon(12.12, 13.13));
|
||||
DispatchData dispatchData = new DispatchData("aiCloudToStartAutopilot", dispatchResult);
|
||||
String json = GsonUtil.jsonFromObject(dispatchData);
|
||||
Logger.d(TAG, "testDispatchAutopilot json : " + json);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.mogo.module.adas;
|
||||
|
||||
/**
|
||||
* Created by XuYong on 2021/5/28 15:24
|
||||
*/
|
||||
public class AdasConstant {
|
||||
public static final String MODULE_TAG = "AdasConstant";
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo;
|
||||
@@ -27,9 +28,9 @@ import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
import com.mogo.module.adas.model.AdasServiceModel;
|
||||
import com.mogo.module.common.drawer.IdentifyDataDrawer;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotStateModel;
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
import com.zhidao.support.adas.high.OnAdasMsgConnectStatusListener;
|
||||
import com.zhidao.support.adas.high.bean.BasicInfo;
|
||||
import com.zhidao.support.obu.ami.AmiClientManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -56,15 +57,11 @@ public class AdasEventManager implements
|
||||
|
||||
private final Gson gson;
|
||||
private final ArrayList<IAdasDataListener> iAdasEventListeners = new ArrayList<>();
|
||||
private final ArrayList<IAdasStatusListener> iAdasStatusListeners = new ArrayList<>();
|
||||
//自动驾驶状态
|
||||
private int mCurrentAutopilotStatus = -1;
|
||||
//自动驾驶车速度
|
||||
private float mCurrentAutopilotSpeed = 0;
|
||||
//自动驾驶状态
|
||||
private AutopilotStatusInfo mAutopilotValuesStatus = null;
|
||||
|
||||
private IAdasProviderBizListener providerBizListener;
|
||||
|
||||
private AdasEventManager() {
|
||||
gson = GsonUtil.getGson();
|
||||
@@ -98,32 +95,19 @@ public class AdasEventManager implements
|
||||
iAdasEventListeners.remove(listener);
|
||||
}
|
||||
|
||||
public void addStatusListener(IAdasStatusListener listener) {
|
||||
Logger.d(TAG, "添加adas状态事件监听");
|
||||
if (iAdasStatusListeners.contains(listener)) {
|
||||
return;
|
||||
}
|
||||
iAdasStatusListeners.add(listener);
|
||||
/**
|
||||
* 同步SN信息给工控机
|
||||
*/
|
||||
public void syncBasicInfoToAutopilot() {
|
||||
Logger.d(TAG, "同步PAD的SN给工控机……");
|
||||
BasicInfo info = new BasicInfo();
|
||||
info.setSn(MoGoAiCloudClientConfig.getInstance().getSn());
|
||||
AdasManager.getInstance().setBasicInfo(info);
|
||||
}
|
||||
|
||||
public void removeStatusListener(IAdasStatusListener listener) {
|
||||
Logger.d(TAG, "注销adas状态事件监听");
|
||||
iAdasStatusListeners.remove(listener);
|
||||
}
|
||||
|
||||
public void removeStatusListener() {
|
||||
Logger.d(TAG, "注销adas状态事件监听");
|
||||
iAdasStatusListeners.clear();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAutopilotSNRequest() {
|
||||
if (providerBizListener != null) {
|
||||
providerBizListener.getDeviceSn();
|
||||
} else {
|
||||
Logger.e(TAG, "onAutopilotSNRequest providerBizListener is null");
|
||||
}
|
||||
syncBasicInfoToAutopilot();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -134,9 +118,11 @@ public class AdasEventManager implements
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().setConnectStatus(true);
|
||||
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutoPilotStatus();
|
||||
for (IAdasStatusListener listener : iAdasStatusListeners) {
|
||||
listener.onServiceConnected();
|
||||
}
|
||||
|
||||
// 同步SN给工控机
|
||||
syncBasicInfoToAutopilot();
|
||||
|
||||
// 开启轮训上传自动驾驶状态
|
||||
updateDriveStatusTask();
|
||||
}
|
||||
|
||||
@@ -146,9 +132,6 @@ public class AdasEventManager implements
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().setConnectIP(AdasManager.getInstance().getAdasConfig().getAddress());
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().setConnectStatus(false);
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutoPilotStatus();
|
||||
for (IAdasStatusListener listener : iAdasStatusListeners) {
|
||||
listener.onServiceDisconnected();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateDriveStatusTask() {
|
||||
@@ -168,27 +151,12 @@ public class AdasEventManager implements
|
||||
AdasServiceModel.getInstance().reportSite(lon, lat);
|
||||
}
|
||||
|
||||
public AdasAIDLAutopilotStateModel autopilotStateCall() {
|
||||
AdasAIDLAutopilotStateModel adasAIDLAutopilotStateModel = new AdasAIDLAutopilotStateModel();
|
||||
if (mAutopilotValuesStatus != null) {
|
||||
adasAIDLAutopilotStateModel.setSpeed(mAutopilotValuesStatus.getSpeed());
|
||||
adasAIDLAutopilotStateModel.setState(mAutopilotValuesStatus.getState());
|
||||
adasAIDLAutopilotStateModel.setReason(mAutopilotValuesStatus.getReason());
|
||||
}
|
||||
return adasAIDLAutopilotStateModel;
|
||||
}
|
||||
|
||||
public void setProviderBizListener(IAdasProviderBizListener listener) {
|
||||
providerBizListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NonNull AutopilotStatusInfo autoPilotStatusInfo) {
|
||||
int state = autoPilotStatusInfo.getState();
|
||||
float speed = autoPilotStatusInfo.getSpeed();
|
||||
mCurrentAutopilotStatus = state;
|
||||
mCurrentAutopilotSpeed = speed;
|
||||
this.mAutopilotValuesStatus = autoPilotStatusInfo;
|
||||
for (IAdasDataListener listener : iAdasEventListeners) {
|
||||
if (listener != null) {
|
||||
listener.notifyAutopilotState(autoPilotStatusInfo);
|
||||
@@ -202,11 +170,6 @@ public class AdasEventManager implements
|
||||
double lon = autopilotWayArrive.getLon();
|
||||
double lat = autopilotWayArrive.getLat();
|
||||
reportSite(lon, lat);
|
||||
for (IAdasDataListener listener : iAdasEventListeners) {
|
||||
if (listener != null) {
|
||||
listener.autopilotArrive(autopilotWayArrive);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,12 +181,15 @@ public class AdasEventManager implements
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//can数据转发
|
||||
AutopilotCarStateInfo.ValuesBean bean = autoPilotCarStateInfo.getValues();
|
||||
if (bean != null) {
|
||||
int turn_light = bean.getTurn_light(); //转向灯状态 0是正常 1是左转 2是右转
|
||||
AmiClientManager.getInstance().setTurnLightState(turn_light);
|
||||
// 获取的自动驾驶车辆信息不是空的时候
|
||||
if (autoPilotCarStateInfo != null) {
|
||||
//can数据转发
|
||||
AutopilotCarStateInfo.ValuesBean bean = autoPilotCarStateInfo.getValues();
|
||||
if (bean != null) {
|
||||
//转向灯状态 0是正常 1是左转 2是右转
|
||||
int turnLight = bean.getTurn_light();
|
||||
AmiClientManager.getInstance().setTurnLightState(turnLight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,48 +214,22 @@ public class AdasEventManager implements
|
||||
|
||||
@Override
|
||||
public void onAutopilotWarnMessage(@Nullable AutopilotWarnMessage autopilotWarnMessage) {
|
||||
Logger.d(TAG, "onWarnMessage " + autopilotWarnMessage);
|
||||
//报警model
|
||||
for (IAdasDataListener listener : iAdasEventListeners) {
|
||||
if (listener != null) {
|
||||
listener.onWarnMessage(autopilotWarnMessage);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotTrajectory(ArrayList<ADASTrajectoryInfo> trajectoryInfo) {
|
||||
if (trajectoryInfo != null && trajectoryInfo.size() > 0) {
|
||||
for (IAdasDataListener listener : iAdasEventListeners) {
|
||||
if (listener != null) {
|
||||
listener.onAutopilotTrajectory(trajectoryInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAutopilotRotting(@Nullable AutopilotRouteInfo autopilotRoute) {
|
||||
if (autopilotRoute.getModels() == null || autopilotRoute.getModels().size() == 0) {
|
||||
Logger.d(TAG, "onAutopilotRoute is null !");
|
||||
return;
|
||||
}
|
||||
for (IAdasDataListener listener : iAdasEventListeners) {
|
||||
if (listener != null) {
|
||||
listener.autopilotRoute(autopilotRoute);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRecordResult(AutoPilotRecordResult result) {
|
||||
if (result != null) {
|
||||
for (IAdasDataListener listener : iAdasEventListeners) {
|
||||
if (listener != null) {
|
||||
listener.onAutopilotRecordResult(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,22 +24,22 @@ object AdasObjectUtils {
|
||||
|
||||
fun fromAutopilotGuardianInfo(autopilotGuardianInfo: AutopilotGuardianInfo): AutopilotGuardianStatusInfo? {
|
||||
return GsonUtil.objectFromJson(
|
||||
GsonUtil.jsonFromObject(autopilotGuardianInfo),
|
||||
AutopilotGuardianStatusInfo::class.java
|
||||
GsonUtil.jsonFromObject(autopilotGuardianInfo),
|
||||
AutopilotGuardianStatusInfo::class.java
|
||||
)
|
||||
}
|
||||
|
||||
fun fromAdasAutopilotRoute(carStateInfo: AutopilotRoute): AutopilotRouteInfo? {
|
||||
return GsonUtil.objectFromJson(
|
||||
GsonUtil.jsonFromObject(carStateInfo),
|
||||
AutopilotRouteInfo::class.java
|
||||
GsonUtil.jsonFromObject(carStateInfo),
|
||||
AutopilotRouteInfo::class.java
|
||||
)
|
||||
}
|
||||
|
||||
fun fromAdasCarStateInfoObject(carStateInfo: CarStateInfo): AutopilotCarStateInfo? {
|
||||
return GsonUtil.objectFromJson(
|
||||
GsonUtil.jsonFromObject(carStateInfo),
|
||||
AutopilotCarStateInfo::class.java
|
||||
GsonUtil.jsonFromObject(carStateInfo),
|
||||
AutopilotCarStateInfo::class.java
|
||||
)
|
||||
}
|
||||
|
||||
@@ -47,8 +47,7 @@ object AdasObjectUtils {
|
||||
if (info == null) {
|
||||
return null
|
||||
}
|
||||
val warnMessage =
|
||||
AutopilotWarnMessage()
|
||||
val warnMessage = AutopilotWarnMessage()
|
||||
warnMessage.content = info.content
|
||||
warnMessage.level = info.level
|
||||
try {
|
||||
|
||||
@@ -4,12 +4,10 @@ import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotStateModel;
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
import com.zhidao.support.adas.high.bean.BasicInfo;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
|
||||
|
||||
@@ -30,33 +28,28 @@ public class AdasProvider implements IProvider {
|
||||
Logger.d(TAG, "初始化 AdasProvider 模块");
|
||||
adasEventManager = AdasEventManager.getInstance();
|
||||
initAdas(context, adasEventManager);
|
||||
addAdasStatusListener(new IAdasStatusListener() {
|
||||
@Override
|
||||
public void onServiceConnected() {
|
||||
Logger.d(TAG, "adas statusListener connected & send sn");
|
||||
setBasicInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceDisconnected() {
|
||||
Logger.d(TAG, "adas statuslistener disconnected");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initAdas(Context context, AdasEventManager adasEventManager) {
|
||||
CupidLogUtils.setEnableLog(false);
|
||||
CupidLogUtils.setIsWriteLog(false);
|
||||
AdasManager.getInstance().create(context);
|
||||
// TODO 临时方案,根据不同的身份标识,连接不同的工控机IP
|
||||
switch (FunctionBuildConfig.appIdentityMode) {
|
||||
case 0:
|
||||
// 司机
|
||||
AdasManager.getInstance().create(context, "192.168.1.102");
|
||||
break;
|
||||
case 1:
|
||||
// 乘客
|
||||
AdasManager.getInstance().create(context, "192.168.1.103");
|
||||
break;
|
||||
default:
|
||||
// 默认采用UDP寻址方式
|
||||
AdasManager.getInstance().create(context);
|
||||
break;
|
||||
}
|
||||
AdasManager.getInstance().setOnAdasListener(new OnAdasListenerAdapter());
|
||||
AdasManager.getInstance().setOnAdasConnectStatusListener(adasEventManager);
|
||||
adasEventManager.setProviderBizListener(this::setBasicInfo);
|
||||
}
|
||||
|
||||
public void setBasicInfo() {
|
||||
BasicInfo info = new BasicInfo();
|
||||
info.setSn(MoGoAiCloudClientConfig.getInstance().getSn());
|
||||
AdasManager.getInstance().setBasicInfo(info);
|
||||
}
|
||||
|
||||
public void addAdasEventListener(IAdasDataListener listener) {
|
||||
@@ -67,40 +60,8 @@ public class AdasProvider implements IProvider {
|
||||
adasEventManager.removeEventListener(listener);
|
||||
}
|
||||
|
||||
public void addAdasStatusListener(IAdasStatusListener listener) {
|
||||
adasEventManager.addStatusListener(listener);
|
||||
}
|
||||
|
||||
public void removeAdasStatusListener() {
|
||||
adasEventManager.removeStatusListener();
|
||||
}
|
||||
|
||||
public void sendWsMessage(String msg) {
|
||||
AdasManager.getInstance().aiCloudToAdasData(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询自动驾驶路线,接口回调至 OnAdasListener
|
||||
*/
|
||||
public void queryAutopilotRoute() {
|
||||
AdasManager.getInstance().queryAutopilotRoute();
|
||||
}
|
||||
|
||||
public void cancelPilot() {
|
||||
if (AdasManager.getInstance().isSocketConnect()) {
|
||||
AdasManager.getInstance().controlAutopilotCarHead();
|
||||
}
|
||||
}
|
||||
|
||||
public void hideAdas() {
|
||||
|
||||
}
|
||||
|
||||
public void killAdas() {
|
||||
|
||||
}
|
||||
|
||||
public AdasAIDLAutopilotStateModel autopilotStateCall() {
|
||||
return adasEventManager.autopilotStateCall();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,43 +1,9 @@
|
||||
package com.mogo.module.adas;
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface IAdasDataListener {
|
||||
|
||||
default void sendMsg(String msg) {
|
||||
|
||||
}
|
||||
|
||||
default void onWarnMessage(AutopilotWarnMessage autopilotWarnMessage) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 自动驾驶到达站点回调接口
|
||||
*
|
||||
* @param autopilotWayArrive
|
||||
*/
|
||||
default void autopilotArrive(AutopilotStationInfo autopilotWayArrive) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动驾驶路线回调
|
||||
*
|
||||
* @param autopilotRoute {@link AutopilotRouteInfo}
|
||||
*/
|
||||
default void autopilotRoute(AutopilotRouteInfo autopilotRoute) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 自车定位信息
|
||||
@@ -55,18 +21,4 @@ public interface IAdasDataListener {
|
||||
default void notifyAutopilotState(AutopilotStatusInfo autopilotStatus) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 车前引导路径回调
|
||||
* @param trajectory
|
||||
*/
|
||||
default void onAutopilotTrajectory(ArrayList<ADASTrajectoryInfo> trajectory) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 采集任务结果回调
|
||||
* @param record 结果数据
|
||||
*/
|
||||
default void onAutopilotRecordResult(AutoPilotRecordResult record) {}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
package com.mogo.module.adas;
|
||||
|
||||
public interface IAdasProviderBizListener {
|
||||
|
||||
void getDeviceSn();
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.mogo.module.adas;
|
||||
|
||||
/**
|
||||
* Created by XuYong on 4/28/21 16:19
|
||||
*/
|
||||
public interface IAdasStatusListener {
|
||||
|
||||
void onServiceConnected();
|
||||
|
||||
void onServiceDisconnected();
|
||||
}
|
||||
@@ -88,7 +88,7 @@ public class OnAdasListenerAdapter implements OnAdasListener {
|
||||
// Log.w("DHY-location", bean.getLon() + "," + bean.getLat() + " OnAdasListenerAdapter-onCarStateData:");
|
||||
|
||||
if (bean != null) {
|
||||
int turnLight = bean.getTurn_light(); //转向灯状态 0是正常 1是左转 2是右转
|
||||
int turnLight = bean.getTurnLightOften(); //转向灯状态 0是正常 1是左转 2是右转
|
||||
AmiClientManager.getInstance().setTurnLightState(turnLight);
|
||||
int brakeLight = bean.getBrake_light(); //TODO
|
||||
// Logger.d(TAG, "onCarStateData ---- turnLight = " + turnLight + "---brakeLight = " + brakeLight);
|
||||
@@ -285,39 +285,21 @@ public class OnAdasListenerAdapter implements OnAdasListener {
|
||||
*/
|
||||
@Override
|
||||
public void onUpgradeStateInfo(IPCUpgradeStateInfo info) {
|
||||
// if(info!=null){
|
||||
// Logger.d(TAG,"onUpgradeStateInfo : "+info.getUpgradeStatus());
|
||||
// boolean upgradeStatus=false;//工控机升级状态,true代表升级成功 false代表升级失败,默认为false
|
||||
// if(info.getUpgradeStatus() == IPCUpgradeStateInfo.Status.SUCCESSFUL.code){
|
||||
// upgradeStatus=true;//升级成功
|
||||
// //升级结束确认
|
||||
// AdasManager.getInstance().sendBaseInfo(IPCUpgradeInfo.upgradeFinishAffirm());
|
||||
// }else if(info.getUpgradeStatus() == IPCUpgradeStateInfo.Status.FAILED.code){
|
||||
// upgradeStatus=false;//升级失败
|
||||
// }
|
||||
// Logger.d(TAG,"onUpgradeStateInfo : "+(upgradeStatus ? "升级成功" :"升级失败"));
|
||||
// CallerHmiManager.INSTANCE.showAdUpgradeStatus(upgradeStatus);
|
||||
// }else{
|
||||
// Logger.d(TAG,"onUpgradeStateInfo : upgrade status info is null");
|
||||
// }
|
||||
if(info != null){
|
||||
Logger.d(TAG,"onUpgradeStateInfo "+
|
||||
" upgrade mode="+info.getUpgradeMode()+
|
||||
" download status="+info.getDownloadStatus()+
|
||||
" download progress current="+info.getProgress().getCurrent()+
|
||||
" download progress total="+info.getProgress().getTotal()+
|
||||
" download version="+info.getImages()+
|
||||
" upgrade status="+info.getUpgradeStatus());
|
||||
CallerHmiManager.INSTANCE.showAdUpgradeStatus(info.getUpgradeMode(),info.getDownloadStatus(),info.getProgress().getCurrent(),
|
||||
info.getProgress().getTotal(),info.getImages(),info.getUpgradeStatus());
|
||||
}else{
|
||||
Logger.d(TAG,"onUpgradeStateInfo : upgrade state info is null");
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 工控机下载状态
|
||||
// * @param info 工控机升级包下载进度
|
||||
// */
|
||||
// @Override
|
||||
// public void onUpgradePatchDownloadStatus(IPCUpgradePatchDownloadStatusInfo info) {
|
||||
// if(info!=null){
|
||||
// Logger.d(TAG,"onUpgradePatchDownloadStatus : status="+info.getDownloadStatus() +
|
||||
// " version="+info.getDownloadVersion()+ " progress="+info.getDownloadProgress());
|
||||
// CallerHmiManager.INSTANCE.showAdDownloadStatus(info.getDownloadVersion(),info.getDownloadStatus(),info.getDownloadProgress());
|
||||
// }else{
|
||||
// Logger.d(TAG,"onUpgradePatchDownloadStatus : download status info is null");
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
public void onSSHResult(SSHResult info) {
|
||||
|
||||
@@ -1,165 +0,0 @@
|
||||
package com.mogo.module.adas.entity;
|
||||
|
||||
public class DispatchAdasAutoPilotLocReceiverBean {
|
||||
|
||||
public static final int DISPATCH_SOURCE_HENGYANG = 1;
|
||||
public static final int DISPATCH_SOURCE_EZHOU = 2;
|
||||
public static final int DISPATCH_TYPE_START = 1;
|
||||
public static final int DISPATCH_TYPE_STOP = 2;
|
||||
|
||||
private int source; // 1:衡阳 2:鄂州
|
||||
private int type; // 1:启动 2:停止
|
||||
private String poiId;
|
||||
|
||||
private double startLat;
|
||||
private double startLon;
|
||||
private String startLocAddress;
|
||||
|
||||
private double endLat;
|
||||
private double endLon;
|
||||
private String endLocAddress;
|
||||
|
||||
private String taskTime;
|
||||
private String flightInfo;
|
||||
private String taskInfo;
|
||||
private long systemTime;
|
||||
|
||||
public DispatchAdasAutoPilotLocReceiverBean(int source, int type, String poiId, double startLat, double startLon, String startLocAddress, double endLat, double endLon, String endLocAddress, String taskTime, String flightInfo, String taskInfo, long systemTime) {
|
||||
this.source = source;
|
||||
this.type = type;
|
||||
this.poiId = poiId;
|
||||
this.startLat = startLat;
|
||||
this.startLon = startLon;
|
||||
this.startLocAddress = startLocAddress;
|
||||
this.endLat = endLat;
|
||||
this.endLon = endLon;
|
||||
this.endLocAddress = endLocAddress;
|
||||
this.taskTime = taskTime;
|
||||
this.flightInfo = flightInfo;
|
||||
this.taskInfo = taskInfo;
|
||||
this.systemTime = systemTime;
|
||||
}
|
||||
|
||||
public int getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public void setSource(int source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getPoiId() {
|
||||
return poiId;
|
||||
}
|
||||
|
||||
public void setPoiId(String poiId) {
|
||||
this.poiId = poiId;
|
||||
}
|
||||
|
||||
public double getStartLat() {
|
||||
return startLat;
|
||||
}
|
||||
|
||||
public void setStartLat(double startLat) {
|
||||
this.startLat = startLat;
|
||||
}
|
||||
|
||||
public double getStartLon() {
|
||||
return startLon;
|
||||
}
|
||||
|
||||
public void setStartLon(double startLon) {
|
||||
this.startLon = startLon;
|
||||
}
|
||||
|
||||
public String getStartLocAddress() {
|
||||
return startLocAddress;
|
||||
}
|
||||
|
||||
public void setStartLocAddress(String startLocAddress) {
|
||||
this.startLocAddress = startLocAddress;
|
||||
}
|
||||
|
||||
public double getEndLat() {
|
||||
return endLat;
|
||||
}
|
||||
|
||||
public void setEndLat(double endLat) {
|
||||
this.endLat = endLat;
|
||||
}
|
||||
|
||||
public double getEndLon() {
|
||||
return endLon;
|
||||
}
|
||||
|
||||
public void setEndLon(double endLon) {
|
||||
this.endLon = endLon;
|
||||
}
|
||||
|
||||
public String getEndLocAddress() {
|
||||
return endLocAddress;
|
||||
}
|
||||
|
||||
public void setEndLocAddress(String endLocAddress) {
|
||||
this.endLocAddress = endLocAddress;
|
||||
}
|
||||
|
||||
public String getTaskTime() {
|
||||
return taskTime;
|
||||
}
|
||||
|
||||
public void setTaskTime(String taskTime) {
|
||||
this.taskTime = taskTime;
|
||||
}
|
||||
|
||||
public String getFlightInfo() {
|
||||
return flightInfo;
|
||||
}
|
||||
|
||||
public void setFlightInfo(String flightInfo) {
|
||||
this.flightInfo = flightInfo;
|
||||
}
|
||||
|
||||
public String getTaskInfo() {
|
||||
return taskInfo;
|
||||
}
|
||||
|
||||
public void setTaskInfo(String taskInfo) {
|
||||
this.taskInfo = taskInfo;
|
||||
}
|
||||
|
||||
public long getSystemTime() {
|
||||
return systemTime;
|
||||
}
|
||||
|
||||
public void setSystemTime(long systemTime) {
|
||||
this.systemTime = systemTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DispatchAdasAutoPilotLocReceiverBean{" +
|
||||
"source=" + source +
|
||||
", type=" + type +
|
||||
", poiId='" + poiId + '\'' +
|
||||
", startLat=" + startLat +
|
||||
", startLon=" + startLon +
|
||||
", startLocAddress='" + startLocAddress + '\'' +
|
||||
", endLat=" + endLat +
|
||||
", endLon=" + endLon +
|
||||
", endLocAddress='" + endLocAddress + '\'' +
|
||||
", taskTime='" + taskTime + '\'' +
|
||||
", flightInfo='" + flightInfo + '\'' +
|
||||
", taskInfo='" + taskInfo + '\'' +
|
||||
", systemTime=" + systemTime +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.mogo.module.adas.entity;
|
||||
|
||||
public class DispatchData {
|
||||
|
||||
private String action;
|
||||
private DispatchResult result;
|
||||
|
||||
public DispatchData(String action, DispatchResult result) {
|
||||
this.action = action;
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public DispatchResult getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(DispatchResult result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DispatchData{" +
|
||||
"action='" + action + '\'' +
|
||||
", result=" + result +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.mogo.module.adas.entity;
|
||||
|
||||
public class DispatchResult {
|
||||
|
||||
private StartLatLon startLatLon;
|
||||
private EndLatLon endLatLon;
|
||||
|
||||
public DispatchResult(StartLatLon startLatLon, EndLatLon endLatLon) {
|
||||
this.startLatLon = startLatLon;
|
||||
this.endLatLon = endLatLon;
|
||||
}
|
||||
|
||||
public StartLatLon getStartLatLon() {
|
||||
return startLatLon;
|
||||
}
|
||||
|
||||
public void setStartLatLon(StartLatLon startLatLon) {
|
||||
this.startLatLon = startLatLon;
|
||||
}
|
||||
|
||||
public EndLatLon getEndLatLon() {
|
||||
return endLatLon;
|
||||
}
|
||||
|
||||
public void setEndLatLon(EndLatLon endLatLon) {
|
||||
this.endLatLon = endLatLon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DispatchResult{" +
|
||||
"startLatLon=" + startLatLon +
|
||||
", endLatLon=" + endLatLon +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.mogo.module.adas.entity;
|
||||
|
||||
public class EndLatLon {
|
||||
|
||||
private double lat;
|
||||
private double lon;
|
||||
|
||||
public EndLatLon(double lat, double lon) {
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EndLatLon{" +
|
||||
"lat=" + lat +
|
||||
", lon=" + lon +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.mogo.module.adas.entity;
|
||||
|
||||
public class ReportDispatchResult {
|
||||
|
||||
private String sn;
|
||||
private int dispatchResult;
|
||||
|
||||
public ReportDispatchResult(String sn, int dispatchResult) {
|
||||
this.sn = sn;
|
||||
this.dispatchResult = dispatchResult;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public int getDispatchResult() {
|
||||
return dispatchResult;
|
||||
}
|
||||
|
||||
public void setDispatchResult(int dispatchResult) {
|
||||
this.dispatchResult = dispatchResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ReportDispatchResult{" +
|
||||
"sn='" + sn + '\'' +
|
||||
", dispatchResult=" + dispatchResult +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package com.mogo.module.adas.entity;
|
||||
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
|
||||
/**
|
||||
* 上报自动驾驶规划的路径
|
||||
*/
|
||||
public class ReportedRoute {
|
||||
private String sn;
|
||||
private AutopilotStatusInfo bean;
|
||||
private String siteList;
|
||||
|
||||
public ReportedRoute(String sn, AutopilotStatusInfo bean) {
|
||||
this.sn = sn;
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
public ReportedRoute(String sn, String siteList) {
|
||||
this.sn = sn;
|
||||
this.siteList = siteList;
|
||||
}
|
||||
|
||||
public String getSiteList() {
|
||||
return siteList;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return "{\"sn\":\"" + sn + "\",\"state\":" + bean.getState() + ",\"speed\":" + bean.getSpeed() + ",\"reason\":\"" + bean.getReason() + "\",\"camera\":" + bean.getCamera() + ",\"radar\":" + bean.getRadar() + ",\"rtk\":" + bean.getRtk() + "}";
|
||||
}
|
||||
|
||||
public String getRoute() {
|
||||
return "{\"sn\":\"" + sn + "\",\"siteList\":" + siteList + "}";
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.mogo.module.adas.entity;
|
||||
|
||||
public class StartLatLon {
|
||||
|
||||
private double lat;
|
||||
private double lon;
|
||||
|
||||
public StartLatLon(double lat, double lon) {
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "StartLatLon{" +
|
||||
"lat=" + lat +
|
||||
", lon=" + lon +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -2,23 +2,14 @@ package com.mogo.module.adas.model;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.network.RequestOptions;
|
||||
import com.mogo.eagle.core.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.adas.entity.AutonomousDriveStatusBean;
|
||||
import com.mogo.module.adas.entity.ReportDispatchResult;
|
||||
import com.mogo.module.adas.entity.ReportSiteBean;
|
||||
import com.mogo.module.adas.entity.ReportedRoute;
|
||||
import com.mogo.module.adas.network.IAdasApiService;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotRoute;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotStatus;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
@@ -34,10 +25,6 @@ public class AdasServiceModel {
|
||||
private static volatile AdasServiceModel instance;
|
||||
private static final byte[] obj = new byte[0];
|
||||
|
||||
public static final int DISPATCH_RESULT_AFFIRM = 0;
|
||||
public static final int DISPATCH_RESULT_MANUAL_CANCEL = 1;
|
||||
public static final int DISPATCH_RESULT_TIMER_CANCEL = 2;
|
||||
|
||||
private final IAdasApiService mAdasApiService;
|
||||
|
||||
private AdasServiceModel() {
|
||||
@@ -55,110 +42,6 @@ public class AdasServiceModel {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报自动驾驶状态
|
||||
*
|
||||
* @param autopilotStatus {@link AutopilotStatus}
|
||||
*/
|
||||
public void uploadAutopilotStatus(AutopilotStatusInfo autopilotStatus) {
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
ReportedRoute reportedRoute = new ReportedRoute(sn, autopilotStatus);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("sn", sn);
|
||||
map.put("data", GsonUtil.jsonFromObject(reportedRoute));
|
||||
mAdasApiService.uploadAutopilotState(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(getContext())) {
|
||||
@Override
|
||||
public void onNext(BaseData o) {
|
||||
super.onNext(o);
|
||||
Logger.d(TAG, "uploadAutopilotStatus success");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.d(TAG, "uploadAutopilotStatus error : " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报自动驾驶路线
|
||||
*
|
||||
* @param list 路线集合
|
||||
*/
|
||||
public void uploadAutopilotRoute(List<AutopilotRoute.RouteModels> list) {
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
ReportedRoute reportedRoute = new ReportedRoute(sn, GsonUtil.jsonFromObject(list));
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("sn", sn);
|
||||
map.put("data", GsonUtil.jsonFromObject(reportedRoute));
|
||||
mAdasApiService.uploadAutopilotRoute(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(getContext())) {
|
||||
@Override
|
||||
public void onNext(BaseData o) {
|
||||
super.onNext(o);
|
||||
Logger.d(TAG, "uploadAutopilotRoute success");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.d(TAG, "uploadAutopilotRoute error : " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报调度处理结果
|
||||
*
|
||||
* @param dispatchResultType int
|
||||
*/
|
||||
public void dispatchResultUpload(int dispatchResultType, IDispatch dispatch) {
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
ReportDispatchResult reportDispatchResult = new ReportDispatchResult(sn, dispatchResultType);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("sn", sn);
|
||||
map.put("data", GsonUtil.jsonFromObject(reportDispatchResult));
|
||||
mAdasApiService.uploadDispatchResult(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(getContext())) {
|
||||
@Override
|
||||
public void onNext(BaseData o) {
|
||||
super.onNext(o);
|
||||
Logger.d(TAG, "dispatchResultUpload success");
|
||||
dispatch.onSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.d(TAG, "dispatchResultUpload error : " + e.getMessage());
|
||||
dispatch.onError(e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updateDriveStatus(int autoPilotStatus, float autoPilotSpeed) {
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
AutonomousDriveStatusBean request = new AutonomousDriveStatusBean(sn, autoPilotStatus, autoPilotSpeed);
|
||||
@@ -184,7 +67,7 @@ public class AdasServiceModel {
|
||||
});
|
||||
}
|
||||
|
||||
public void reportSite(double lon, double lat){
|
||||
public void reportSite(double lon, double lat) {
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
ReportSiteBean reportSiteBean = new ReportSiteBean(sn, lon, lat);
|
||||
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(reportSiteBean));
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.mogo.module.adas.model;
|
||||
|
||||
public interface IDispatch {
|
||||
|
||||
void onSuccess();
|
||||
|
||||
void onError(String msg);
|
||||
}
|
||||
@@ -2,55 +2,30 @@ package com.mogo.module.adas.network;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import okhttp3.RequestBody;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.FieldMap;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.Headers;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
public interface IAdasApiService {
|
||||
|
||||
//上传自动驾驶状态接口
|
||||
/**
|
||||
* 上传自动驾驶状态接口
|
||||
* @param requestBody
|
||||
* @return
|
||||
*/
|
||||
@Headers({"Content-Type:application/json;charset=UTF-8"})
|
||||
@POST("/dataService/autonomousDrive/updateAutonomousDriveStatus")
|
||||
Observable<BaseData> updateAutonomousDriveStatus(@Body RequestBody requestBody);
|
||||
|
||||
//站点上报 用于网约车业务
|
||||
/**
|
||||
* 站点上报 用于网约车业务 云平台绘制路线使用
|
||||
* @param requestBody
|
||||
* @return
|
||||
*/
|
||||
@Headers({"Content-Type:application/json;charset=UTF-8"})
|
||||
@POST("/dataService/autonomousDrive/reportSite")
|
||||
Observable<BaseData> updateReportSite(@Body RequestBody requestBody);
|
||||
|
||||
/**
|
||||
* 上报自动驾驶状态 服务于业务调度
|
||||
*
|
||||
* @param parameters map
|
||||
* @return {@link BaseData}
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/dataService/autoDriver/receiveAutopilotState")
|
||||
Observable<BaseData> uploadAutopilotState(@FieldMap Map<String, Object> parameters);
|
||||
|
||||
/**
|
||||
* 上报自动驾驶路径 服务于业务调度
|
||||
*
|
||||
* @param parameters map
|
||||
* @return {@link BaseData}
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/dataService/autoDriver/receiveCarPreSetPath")
|
||||
Observable<BaseData> uploadAutopilotRoute(@FieldMap Map<String, Object> parameters);
|
||||
|
||||
/**
|
||||
* 上报自动驾驶调度处理结果 服务于业务调度
|
||||
*
|
||||
* @param parameters map
|
||||
* @return {@link BaseData}
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/dataService/autoDriver/receiverDestSiteResult")
|
||||
Observable<BaseData> uploadDispatchResult(@FieldMap Map<String, Object> parameters);
|
||||
}
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
package com.mogo.module.adas.overlay;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.util.ColorUtils;
|
||||
import com.mogo.map.overlay.IMogoOverlayManager;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LineOverlayManager {
|
||||
|
||||
private static final String TAG = "LineOverlayManager";
|
||||
private IMogoPolyline mMoGoPolyline;
|
||||
// 连接线参数
|
||||
private MogoPolylineOptions mPolylineOptions;
|
||||
// 线路径集合
|
||||
private List<MogoLatLng> mPolylinePointList;
|
||||
// 渐变色
|
||||
private List<Integer> mPolylineColors;
|
||||
|
||||
IMogoOverlayManager mogoOverlayManager;
|
||||
|
||||
private Context mContext;
|
||||
|
||||
private IAdasLineOverlayListener lineOverlayListener;
|
||||
|
||||
public LineOverlayManager(Context context) {
|
||||
mPolylineOptions = new MogoPolylineOptions();
|
||||
// 绘制路径集合
|
||||
mPolylinePointList = new ArrayList<>();
|
||||
// 引导线颜色
|
||||
mPolylineColors = new ArrayList<>();
|
||||
mContext = context;
|
||||
mogoOverlayManager = MogoApisHandler.getInstance().getApis().getMapServiceApi().getOverlayManager(mContext);
|
||||
}
|
||||
|
||||
public void setIAdasLineOverlayListener(IAdasLineOverlayListener listener){
|
||||
this.lineOverlayListener = listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制最优路线
|
||||
*
|
||||
* @param polylinePoint 要绘制的经纬度度集合
|
||||
*/
|
||||
public void draw(MogoLocation carLocal, List<MogoLatLng> polylinePoint) {
|
||||
Logger.d(TAG,"ready to draw");
|
||||
if (mMoGoPolyline != null) {
|
||||
mMoGoPolyline.remove();
|
||||
mPolylinePointList.clear();
|
||||
mPolylineColors.clear();
|
||||
}
|
||||
if (polylinePoint != null) {
|
||||
Logger.d(TAG,"draw");
|
||||
// 将当前车辆位置放进去
|
||||
// 过滤后台推送的推荐路线集合
|
||||
for (MogoLatLng polyline : polylinePoint) {
|
||||
//需要剔除已经行驶过的经纬度,这里需要比对推荐路线集合中的点是否在当前车辆行驶方向前面如果不在则抛弃
|
||||
// if (LocationUtils.isPointOnCarFront(carLocal, polyline)) {
|
||||
mPolylinePointList.add(polyline);
|
||||
// }
|
||||
}
|
||||
if(mPolylinePointList.size() < 2 && lineOverlayListener != null){
|
||||
Logger.d(TAG,"finish line");
|
||||
lineOverlayListener.finishLine();
|
||||
}
|
||||
Logger.d(TAG,"point list size : " + mPolylinePointList.size() + " json : " + GsonUtil.jsonFromObject(mPolylinePointList));
|
||||
mPolylineColors.addAll(ColorUtils.getGradientAlpha("#002965ED", "#FF2965ED", "#002965ED", mPolylinePointList.size()));
|
||||
// 替换路径集合
|
||||
mPolylineOptions.setGps(true);
|
||||
mPolylineOptions.points(mPolylinePointList);
|
||||
// 线条粗细,渐变,渐变色值
|
||||
mPolylineOptions.width(25).useGradient(true).colorValues(mPolylineColors);
|
||||
// 绘制线
|
||||
mMoGoPolyline = mogoOverlayManager.addPolyline(mPolylineOptions);
|
||||
}
|
||||
}
|
||||
|
||||
public interface IAdasLineOverlayListener{
|
||||
void finishLine();
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
package com.mogo.module.adas.receiver;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.adas.AdasAutoPilotManager;
|
||||
import com.mogo.module.adas.AdasProvider;
|
||||
|
||||
public class AdasTestPanelBroadCastReceiver extends BroadcastReceiver {
|
||||
|
||||
private static final String TAG = "AdasTestPanelBroadCastReceiver";
|
||||
|
||||
/**
|
||||
* Adas测试控制面板广播Action
|
||||
*/
|
||||
public static final String BROADCAST_TEST_PANEL_CONTROL_TYPE_EXTRA_KEY = "sceneType";
|
||||
|
||||
private Context mContext;
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
try {
|
||||
this.mContext = context;
|
||||
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) {//打开调度弹窗
|
||||
AdasAutoPilotManager.getInstance().test();
|
||||
} else if(sceneType == 1){ //验证自动驾驶状态上报接口
|
||||
AdasAutoPilotManager.getInstance().testNotifyAutopilotState();
|
||||
} else if(sceneType == 2){ //验证自动驾驶路线上报接口
|
||||
AdasAutoPilotManager.getInstance().testUploadAutopilotRoute();
|
||||
} else if(sceneType == 3){ //验证自动驾驶调度上报接口
|
||||
AdasAutoPilotManager.getInstance().testDispatchResultUpload();
|
||||
} else if(sceneType == 4){ //验证下发给自动驾驶的调用数据
|
||||
AdasAutoPilotManager.getInstance().testDispatchAutopilot();
|
||||
} else if(sceneType == 5){ //验证画线功能
|
||||
TestAdasFuncManager.getInstance().testAddPolyLine();
|
||||
} else if(sceneType == 6){ //测试发送sn
|
||||
AdasProvider adasProvider = ARouter.getInstance().navigation(AdasProvider.class);
|
||||
adasProvider.setBasicInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
package com.mogo.module.adas.receiver;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.adas.overlay.LineOverlayManager;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TestAdasFuncManager {
|
||||
|
||||
private static final String TAG = "TestAdasFuncManager";
|
||||
private static volatile TestAdasFuncManager manager;
|
||||
private static final byte[] obj = new byte[0];
|
||||
|
||||
public TestAdasFuncManager() {
|
||||
|
||||
}
|
||||
|
||||
public static TestAdasFuncManager getInstance() {
|
||||
if (manager == null) {
|
||||
synchronized (obj) {
|
||||
if (manager == null) {
|
||||
manager = new TestAdasFuncManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return manager;
|
||||
}
|
||||
|
||||
public void testAddPolyLine() {
|
||||
InputStream is = null;
|
||||
try {
|
||||
is = AbsMogoApplication.getApp().getApplicationContext().getAssets().open("testFile.txt");
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(is));
|
||||
String line = "";
|
||||
List<MogoLatLng> vals = new ArrayList<>();
|
||||
while ((line = br.readLine()) != null) {
|
||||
String json = line.substring(0, line.length() - 1);
|
||||
MogoLatLng si = GsonUtil.objectFromJson(json, MogoLatLng.class);
|
||||
vals.add(si);
|
||||
}
|
||||
Logger.d(TAG, "mogoLatLon size : " + GsonUtil.jsonFromObject(vals));
|
||||
JSONObject data = new JSONObject();
|
||||
double lon = 112.57748204198309;
|
||||
double lat = 26.820175208327566;
|
||||
data.putOpt("lon", lon);
|
||||
data.putOpt("lat", lat);
|
||||
data.putOpt("alt", 0);
|
||||
data.putOpt("speed", 0);
|
||||
data.putOpt("satelliteTime", System.currentTimeMillis());
|
||||
data.putOpt("heading", 240);
|
||||
data.putOpt("acceleration", 0);
|
||||
data.putOpt("yawRate", 0);
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().syncLocation2Map(data);
|
||||
LineOverlayManager lineOverlayManager = new LineOverlayManager(AbsMogoApplication.getApp().getApplicationContext());
|
||||
MogoLocation mogoLocation = new MogoLocation();
|
||||
mogoLocation.setLongitude(lon);
|
||||
mogoLocation.setLatitude(lat);
|
||||
lineOverlayManager.draw(mogoLocation, vals);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
package com.mogo.module.adas.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.adas.R;
|
||||
import com.mogo.module.common.dialog.BaseFloatDialog;
|
||||
|
||||
|
||||
public class DispatchRemindDialog extends BaseFloatDialog {
|
||||
|
||||
private static final String TAG = "DispatchRemindDialog";
|
||||
private static final int MSG_TYPE_TIMER = 0;
|
||||
private static int TIMER = 10;
|
||||
private IDispatchRemindClickListener mListener;
|
||||
|
||||
private final TextView tvTimer;
|
||||
private final TextView tvLoc;
|
||||
|
||||
private Handler handler = new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
if (msg.what == MSG_TYPE_TIMER) {
|
||||
if (TIMER > 0) {
|
||||
TIMER--;
|
||||
Logger.d(TAG,"timer : " + TIMER);
|
||||
tvTimer.setText(String.valueOf(TIMER));
|
||||
handler.sendEmptyMessageDelayed(MSG_TYPE_TIMER,1000L);
|
||||
} else {
|
||||
hideDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public DispatchRemindDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
setContentView(R.layout.dialog_adas_dispatch_remind);
|
||||
setCanceledOnTouchOutside(false);
|
||||
tvTimer = findViewById(R.id.module_adas_dispatch_remind_timer);
|
||||
tvLoc = findViewById(R.id.module_adas_dispatch_remind_loc);
|
||||
Button btnAffirm = (Button) findViewById(R.id.module_adas_dispatch_remind_affirm);
|
||||
Button btnCancel = (Button) findViewById(R.id.module_adas_dispatch_remind_cancel);
|
||||
tvTimer.setText(String.valueOf(TIMER));
|
||||
btnAffirm.setOnClickListener(v -> {
|
||||
if (mListener != null) {
|
||||
mListener.affirm();
|
||||
dismissDialog();
|
||||
}
|
||||
});
|
||||
btnCancel.setOnClickListener(v -> {
|
||||
if (mListener != null) {
|
||||
mListener.cancel(true);
|
||||
dismissDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void showDialog(String locContent) {
|
||||
show();
|
||||
handler.sendEmptyMessage(MSG_TYPE_TIMER);
|
||||
tvLoc.setText(locContent);
|
||||
}
|
||||
|
||||
private void hideDialog() {
|
||||
if (mListener != null) {
|
||||
mListener.cancel(false);
|
||||
}
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
private void dismissDialog(){
|
||||
handler.removeMessages(MSG_TYPE_TIMER);
|
||||
TIMER = 10;
|
||||
dismiss();
|
||||
}
|
||||
|
||||
public void addIDispatchRemindListener(IDispatchRemindClickListener listener) {
|
||||
if (listener == null) {
|
||||
Logger.d(TAG, "addIDispatchRemindListener listener is null");
|
||||
return;
|
||||
}
|
||||
this.mListener = listener;
|
||||
}
|
||||
|
||||
public interface IDispatchRemindClickListener {
|
||||
|
||||
void affirm();
|
||||
|
||||
void cancel(boolean manualTrigger);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="@dimen/adas_dispatch_remind_dialog_corner"/>
|
||||
<solid android:color="@color/adas_dispatch_remind_background"/>
|
||||
</shape>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/adas_dispatch_remind_background" />
|
||||
<corners android:bottomLeftRadius="@dimen/adas_dispatch_remind_dialog_corner" />
|
||||
</shape>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/adas_dispatch_remind_background" />
|
||||
<corners android:bottomRightRadius="@dimen/adas_dispatch_remind_dialog_corner" />
|
||||
</shape>
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
|
||||
<solid android:color="@color/adas_dispatch_remind_count_down_bg"/>
|
||||
</shape>
|
||||
@@ -1,95 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="@dimen/adas_dispatch_remind_dialog_width"
|
||||
android:layout_height="@dimen/adas_dispatch_remind_dialog_height"
|
||||
android:background="@drawable/module_adas_bg_shape">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_adas_dispatch_remind_timer"
|
||||
android:layout_width="@dimen/adas_dispatch_remind_dialog_timer_size"
|
||||
android:layout_height="@dimen/adas_dispatch_remind_dialog_timer_size"
|
||||
android:layout_margin="@dimen/adas_dispatch_remind_dialog_timer_margin"
|
||||
android:background="@drawable/module_adas_timer_bg_shape"
|
||||
android:gravity="center"
|
||||
android:text="10"
|
||||
android:textColor="@color/adas_dispatch_remind_count_down_txt"
|
||||
android:textSize="@dimen/adas_dispatch_remind_dialog_timer_txt_size"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/adas_dispatch_remind_dialog_title_margin_top"
|
||||
android:text="@string/module_adas_dispatch_remind_title"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/adas_dispatch_remind_dialog_title_size"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/adas_dispatch_remind_dialog_content_margin_top"
|
||||
android:text="@string/module_adas_dispatch_remind_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/adas_dispatch_remind_dialog_content_size"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_adas_dispatch_remind_loc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/adas_dispatch_remind_dialog_loc_margin_top"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/adas_dispatch_remind_text_loc"
|
||||
android:textSize="@dimen/adas_dispatch_remind_dialog_loc_size"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginBottom="@dimen/adas_dispatch_remind_dialog_line_margin_bottom"
|
||||
android:background="@color/adas_dispatch_remind_background"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/module_adas_dispatch_remind_affirm"
|
||||
android:layout_width="@dimen/adas_dispatch_remind_dialog_btn_width"
|
||||
android:layout_height="@dimen/adas_dispatch_remind_dialog_line_margin_bottom"
|
||||
android:background="@drawable/module_adas_left_corner_bg"
|
||||
android:gravity="center"
|
||||
android:text="@string/module_adas_dispatch_remind_affirm"
|
||||
android:textColor="@color/adas_dispatch_remind_text_loc"
|
||||
android:textSize="@dimen/adas_dispatch_remind_dialog_title_size"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent" />
|
||||
|
||||
<View
|
||||
android:layout_width="1px"
|
||||
android:layout_height="@dimen/adas_dispatch_remind_dialog_line_margin_bottom"
|
||||
android:layout_marginStart="@dimen/adas_dispatch_remind_dialog_btn_width"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/module_adas_dispatch_remind_cancel"
|
||||
android:layout_width="@dimen/adas_dispatch_remind_dialog_btn_width"
|
||||
android:layout_height="@dimen/adas_dispatch_remind_dialog_line_margin_bottom"
|
||||
android:background="@drawable/module_adas_right_corner_bg"
|
||||
android:gravity="center"
|
||||
android:text="@string/module_adas_dispatch_remind_cancel"
|
||||
android:textColor="@color/adas_dispatch_remind_cancel"
|
||||
android:textSize="@dimen/adas_dispatch_remind_dialog_title_size"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,17 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="adas_dispatch_remind_dialog_width">950px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_height">540px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_corner">32px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_title_size">48px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_title_margin_top">55px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_content_size">38px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_content_margin_top">179px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_loc_size">56px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_loc_margin_top">251px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_line_margin_bottom">152px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_btn_width">474.5px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_timer_margin">20px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_timer_size">46px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_timer_txt_size">24px</dimen>
|
||||
|
||||
</resources>
|
||||
@@ -1,10 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="adas_dispatch_remind_text_loc">#1F9BFE</color>
|
||||
<color name="adas_dispatch_remind_background">#E63B4577</color>
|
||||
<color name="adas_dispatch_remind_count_down_txt">#8E9DD4</color>
|
||||
<color name="adas_dispatch_remind_count_down_bg">#4D000000</color>
|
||||
<color name="adas_dispatch_remind_line">#66B8BFE8</color>
|
||||
<color name="adas_dispatch_remind_cancel">#AFB3C7</color>
|
||||
|
||||
</resources>
|
||||
@@ -1,17 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="adas_dispatch_remind_dialog_width">950px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_height">540px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_corner">32px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_title_size">48px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_title_margin_top">55px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_content_size">38px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_content_margin_top">179px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_loc_size">56px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_loc_margin_top">251px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_line_margin_bottom">152px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_btn_width">474.5px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_timer_margin">20px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_timer_size">46px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_timer_txt_size">24px</dimen>
|
||||
|
||||
</resources>
|
||||
@@ -1,7 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="module_adas_dispatch_remind_title">调度确认</string>
|
||||
<string name="module_adas_dispatch_remind_content">车辆将开启自动驾驶,并行驶至:</string>
|
||||
<string name="module_adas_dispatch_remind_affirm">确认</string>
|
||||
<string name="module_adas_dispatch_remind_cancel">取消</string>
|
||||
|
||||
</resources>
|
||||
@@ -358,7 +358,6 @@ class CallChatCenter private constructor() : IBizCallChat.IBizCallBack, IVoiceCo
|
||||
@Synchronized
|
||||
private fun showLauncherCallingView() {
|
||||
Logger.d(TAG, "showLauncherCallingView : onlineCarPanelApi hidePanel")
|
||||
serviceApi?.onlineCarPanelApi?.hidePanel()
|
||||
if (!showCallWindowFromDefault) {
|
||||
Logger.d(TAG, "showLauncherCallingView : 接听电话,隐藏用户信息窗口")
|
||||
hideUserWindow()
|
||||
|
||||
@@ -7,27 +7,16 @@ package com.mogo.module.common.constants;
|
||||
*/
|
||||
public class HostConst {
|
||||
public static final String DEVA_HOST = "http://dzt-deva.zhidaozhixing.com";
|
||||
public static final String IM_HOST = "http://dzt-im.zhidaozhixing.com";
|
||||
public static final String LAUNCHER_SNAPSHOT_HOST = "http://dzt-launcherSnapshot.zhidaozhixing.com";
|
||||
public static final String CHANNEL_MANAGER_HOST = "http://dzt-channelManager.zhidaozhixing.com";
|
||||
public static final String DATA_SERVICE_HOST = "http://dzt-dataService.zhidaozhixing.com";
|
||||
public static final String REALTIME_LOCATION_HOST = "http://dzt-realtimeLocation.zhidaozhixing.com";
|
||||
public static final String INSTANT_HOST = "http://dzt-Instant.zhidaozhixing.com";
|
||||
public static final String GEOFENCE_HOST = "http://dzt-geoFenceCarService.zhidaozhixing.com";
|
||||
public static final String CARLIFE_HOST = "http://dzt-carlife.zhidaozhixing.com";
|
||||
public static final String STRATEGY_PUSH_HOST = "http://dzt-strategyPush.zhidaozhixing.com";
|
||||
public static final String TRAVEL_CONDITION_HOST = "http://dzt-travelCondition.zhidaozhixing.com";
|
||||
public static final String TMC_HOST = "http://dzt-tmcServer.zhidaozhixing.com";
|
||||
public static final String IM_SOCKET_DOMAIN = "dzt-im.zhidaozhixing.com";
|
||||
public static final String WEBSOCKET_DOMAIN = "dzt-Instant.zhidaozhixing.com";
|
||||
public static final String CAMERA_STREAM_HOST = "http://dzt-smartTransportationAiCloud.zhidaozhixing.com";
|
||||
public static final String OPEN_CAMERA_STREAM_HOST = "http://10.0.16.6:18080";
|
||||
public static final String MEC_ETL_HOST = "http://dzt-mecEtl.zhidaozhixing.com";
|
||||
|
||||
public static final String CITY_HOST = "http://dzt-city.zhidaozhixing.com";
|
||||
public static final String SOCKET_CENTER_DOMAIN = "socketRegion";
|
||||
|
||||
// 网约车
|
||||
public static final String OCH_DOMAIN = "http://dzt-hailing.zhidaozhixing.com";
|
||||
|
||||
}
|
||||
|
||||
@@ -47,19 +47,12 @@ public class BaseFloatDialog extends Dialog {
|
||||
@Override
|
||||
public void show() {
|
||||
Logger.d(TAG, "onShow====");
|
||||
if (DebugConfig.isNeedHideAdasWhenShare()) {
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().closeADAS();
|
||||
}
|
||||
super.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
Logger.d(TAG, "onDismiss====");
|
||||
if (DebugConfig.isNeedHideAdasWhenShare()
|
||||
&& MogoApisHandler.getInstance().getApis().getStatusManagerApi().isMainPageOnResume()) {
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().showADAS();
|
||||
}
|
||||
super.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,10 +18,8 @@ import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.listener.MogoMapListenerHandler;
|
||||
import com.mogo.map.navi.IMogoAimlessModeListener;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
@@ -49,7 +47,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
implements EntranceView,
|
||||
IMogoNaviListener,
|
||||
IMogoMapListener,
|
||||
IMogoAimlessModeListener,
|
||||
IMogoStatusChangedListener,
|
||||
IMogoIntentListener {
|
||||
|
||||
@@ -203,10 +200,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviInfoUpdate(MogoNaviInfo naviinfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartNavi() {
|
||||
@@ -225,9 +218,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
TopViewAnimHelper.getInstance().hideNaviView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateTraffic2(MogoTraffic traffic) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLockMap(boolean isLock) {
|
||||
@@ -243,18 +233,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
Logger.d(TAG, "descriptor=" + descriptor + " isTrue=" + isTrue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapModeChanged(EnumMapUI ui) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapVisualAngleChanged(VisualAngleMode visualAngleMode) {
|
||||
|
||||
}
|
||||
|
||||
private final Handler handler = new Handler();
|
||||
|
||||
private void listenSeekNumber() {
|
||||
mStatusManager.registerStatusChangedListener(TAG, StatusDescriptor.SEEK_HELPING, this);
|
||||
}
|
||||
@@ -265,7 +243,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
if (mMogoRegisterCenter != null) {
|
||||
mMogoRegisterCenter.unregisterMogoNaviListener(TYPE_ENTRANCE);
|
||||
mMogoRegisterCenter.unregisterMogoMapListener(TYPE_ENTRANCE);
|
||||
mMogoRegisterCenter.unregisterMogoAimlessModeListener(TAG);
|
||||
}
|
||||
if (mStatusManager != null) {
|
||||
mStatusManager.unregisterStatusChangedListener(TAG, StatusDescriptor.UPLOADING, this);
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
|
||||
@@ -4,21 +4,17 @@ import android.location.Location;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.model.MogoPoi;
|
||||
import com.mogo.map.navi.IMogoAimlessModeListener;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.map.navi.IMogoNaviListener2;
|
||||
import com.mogo.map.navi.MogoCongestionInfo;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.module.main.registercenter.MogoRegisterCenterHandler;
|
||||
@@ -39,10 +35,8 @@ import java.util.Iterator;
|
||||
public class EventDispatchCenter implements
|
||||
IMogoNaviListener,
|
||||
IMogoMarkerClickListener,
|
||||
IMogoAimlessModeListener,
|
||||
IMogoCarLocationChangedListener2,
|
||||
IMogoMapListener,
|
||||
IMogoNaviListener2,
|
||||
IMogoLocationListener,
|
||||
IAdasSettingUIListener,
|
||||
IAdasSkinStyleListener {
|
||||
@@ -96,41 +90,6 @@ public class EventDispatchCenter implements
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateTraffic2( MogoTraffic traffic ) {
|
||||
Iterator< IMogoAimlessModeListener > iterator = MogoRegisterCenterHandler.getInstance().getAimlessModeListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoAimlessModeListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
try {
|
||||
listener.onUpdateTraffic2( traffic );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateCongestion( MogoCongestionInfo info ) {
|
||||
Iterator< IMogoAimlessModeListener > iterator = MogoRegisterCenterHandler.getInstance().getAimlessModeListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoAimlessModeListener listener = iterator.next();
|
||||
if ( listener != null ) {
|
||||
try {
|
||||
listener.onUpdateCongestion( info );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged( MogoLatLng latLng ) {
|
||||
@@ -455,10 +414,6 @@ public class EventDispatchCenter implements
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateTraffic( MogoTraffic traffic ) {
|
||||
Logger.e( TAG, "error. call deprecated method, use onUpdateTraffic2 instead." );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged( MogoLocation location ) {
|
||||
@@ -479,42 +434,6 @@ public class EventDispatchCenter implements
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArriveDestination() {
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoNaviListener listener = iterator.next();
|
||||
if ( listener instanceof IMogoNaviListener2 ) {
|
||||
try {
|
||||
( ( IMogoNaviListener2 ) listener ).onArriveDestination();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEndEmulatorNavi() {
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoNaviListener listener = iterator.next();
|
||||
if ( listener instanceof IMogoNaviListener2 ) {
|
||||
try {
|
||||
( ( IMogoNaviListener2 ) listener ).onEndEmulatorNavi();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void northModel() {
|
||||
Iterator< IMogoADASControlStatusChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.mogo.module.main;
|
||||
|
||||
import static com.mogo.module.main.MainPresenter.MOGO_PERMISSION_REQUEST_CODE;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
@@ -52,6 +50,8 @@ import com.zhidao.autopilot.support.api.AutopilotServiceManage;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.mogo.module.main.MainPresenter.MOGO_PERMISSION_REQUEST_CODE;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-23
|
||||
@@ -72,8 +72,6 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
protected IMogoStatusManager mMogoStatusManager;
|
||||
|
||||
protected View mEntrance;
|
||||
protected View mEventPanel;
|
||||
protected View mHistoryMessagePanel;
|
||||
protected FrameLayout mFloatingLayout;
|
||||
protected View mCoverUpLayout;
|
||||
|
||||
@@ -96,16 +94,13 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
getWindow().setBackgroundDrawable(null);
|
||||
|
||||
mEntrance = findViewById(R.id.module_main_id_entrance_fragment_container);
|
||||
mEventPanel = findViewById(R.id.module_main_id_event_panel_fragment_container);
|
||||
mFloatingLayout = findViewById(R.id.module_main_id_floating_view);
|
||||
mCoverUpLayout = findViewById(R.id.module_main_id_cover_up);
|
||||
mHistoryMessagePanel = findViewById(R.id.module_main_id_message_history_fragment_container);
|
||||
|
||||
clSpecialEffect = findViewById(R.id.cl_special_effect);
|
||||
|
||||
FloatingViewHandler.init(mFloatingLayout);
|
||||
|
||||
mServiceApis.getOnlineCarPanelApi().initContainer(R.id.module_main_id_message_history_fragment_container, this);
|
||||
if (CallChatApi.getInstance().getApiProvider() != null) {
|
||||
CallChatApi.getInstance().getApiProvider().initVehicleTeamContainer("init", R.id.module_main_id_message_history_fragment_container, this);
|
||||
}
|
||||
@@ -122,14 +117,12 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
// 隐藏布局
|
||||
protected void hideLayout() {
|
||||
mEntrance.setVisibility(View.GONE);
|
||||
mEventPanel.setVisibility(View.GONE);
|
||||
mFloatingLayout.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
// 显示布局
|
||||
protected void showLayout() {
|
||||
mEntrance.setVisibility(View.VISIBLE);
|
||||
mEventPanel.setVisibility(View.VISIBLE);
|
||||
mFloatingLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@@ -185,8 +178,6 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
if (mServiceApis == null) {
|
||||
mServiceApis = MogoApisHandler.getInstance().getApis();
|
||||
}
|
||||
//mServiceApis.getShareManager().resetContext(this);
|
||||
|
||||
mMogoStatusManager = mServiceApis.getStatusManagerApi();
|
||||
mMogoStatusManager.setMainPageLaunchedStatus(TAG, true);
|
||||
AutopilotServiceManage.getInstance().init(getContext());
|
||||
@@ -200,8 +191,6 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
|
||||
if (mServiceApis.getMapServiceApi() != null) {
|
||||
mServiceApis.getMapServiceApi().getHostListenerRegister().registerHostMapListener(EventDispatchCenter.getInstance());
|
||||
mServiceApis.getMapServiceApi().getHostListenerRegister().registerHostNaviListener(EventDispatchCenter.getInstance());
|
||||
mServiceApis.getMapServiceApi().getHostListenerRegister().registerHostAimlessModeListener(EventDispatchCenter.getInstance());
|
||||
mServiceApis.getMapServiceApi().getHostListenerRegister().registerMarkerClickListener(EventDispatchCenter.getInstance());
|
||||
}
|
||||
|
||||
@@ -210,7 +199,6 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
if (DebugConfig.isMapBased()) {
|
||||
EventDispatchCenter.getInstance().setMapLoadedCallback(() -> {
|
||||
Logger.d(TAG, "map loaded." + Thread.currentThread().getName());
|
||||
resetMapUiStyle();
|
||||
// 延时加载其他模块
|
||||
getWindow().getDecorView().postDelayed(new Runnable() {
|
||||
@Override
|
||||
@@ -243,11 +231,6 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
}
|
||||
}
|
||||
|
||||
private void resetMapUiStyle() {
|
||||
final EnumMapUI mapUI = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getCurrentSkinMode();
|
||||
mServiceApis.getMapServiceApi().getMapUIController().changeMapMode(mapUI);
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载其它模块
|
||||
*/
|
||||
@@ -278,7 +261,7 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
|
||||
protected void loadContainerModules() {
|
||||
MogoModulesManager.getInstance().loadEntrancesModule(R.id.module_main_id_entrance_fragment_container);
|
||||
MogoModulesManager.getInstance().loadEventPanelModule(R.id.module_main_id_event_panel_fragment_container);
|
||||
//MogoModulesManager.getInstance().loadEventPanelModule(R.id.module_main_id_event_panel_fragment_container);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -334,33 +317,20 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
super.onResume();
|
||||
mMogoStatusManager.setMainPageResumeStatus(TAG, true);
|
||||
mMogoStatusManager.setMainPageIsBackgroundStatus(TAG, false);
|
||||
if (mCoverUpLayout.getVisibility() != View.VISIBLE) {
|
||||
mServiceApis.getAdasControllerApi().showADAS();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
mMogoStatusManager.setMainPageResumeStatus(TAG, false);
|
||||
if (shouldCloseADASPanelWhenPause()) {
|
||||
mServiceApis.getAdasControllerApi().closeADAS();
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean shouldCloseADASPanelWhenPause() {
|
||||
// m4 系列因为按home键会造成页面pause后resume,造成adas panel 闪烁
|
||||
// f 系列加上上滑返回桌面后会走 mIsHomeKeyDown = true,但是不会造成页面pause
|
||||
// 独立 app 任何情况下都需要隐藏 adas
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
mMogoStatusManager.setMainPageIsBackgroundStatus(TAG, true);
|
||||
if (shouldCloseADASPanelWhenPause()) {
|
||||
mServiceApis.getAdasControllerApi().closeADAS();
|
||||
if (mMogoStatusManager != null) {
|
||||
mMogoStatusManager.setMainPageIsBackgroundStatus(TAG, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -404,8 +374,6 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mServiceApis.getMapServiceApi().getHostListenerRegister().unregisterMarkerClickListener();
|
||||
mServiceApis.getMapServiceApi().getHostListenerRegister().unregisterHostAimlessModeListener();
|
||||
mServiceApis.getMapServiceApi().getHostListenerRegister().unregisterHostNaviListener();
|
||||
mServiceApis.getMapServiceApi().getHostListenerRegister().unregisterHostMapListener();
|
||||
mServiceApis.getRegisterCenterApi().unregisterADASControlStatusChangedListener(TAG);
|
||||
mMogoStatusManager.setMainPageLaunchedStatus(TAG, false);
|
||||
@@ -419,8 +387,6 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
AdasConfigApiController.getInstance().release();
|
||||
mServiceApis.getAdasControllerApi().release();
|
||||
Logger.d(TAG, "destroy.");
|
||||
mServiceApis.getRefreshStrategyControllerApi().clearAllData();
|
||||
mServiceApis.getOnlineCarPanelApi().clear();
|
||||
ContextHolderUtil.releaseContext();
|
||||
MogoModulesManager.getInstance().onDestroy();
|
||||
SchemeIntent.getInstance().clear();
|
||||
|
||||
@@ -151,9 +151,6 @@ public class SchemeIntent implements IMogoStatusChangedListener {
|
||||
case TYPE_LAUNCH:
|
||||
handleLaunchIntent(target);
|
||||
break;
|
||||
case TYPE_SHOW_ONLINE_CAR_PANEL:
|
||||
handleShowOnlineCarPanel(target);
|
||||
break;
|
||||
case TYPE_SHOW_HISTORY_PANEL:
|
||||
handleShowEventPanel(0);
|
||||
break;
|
||||
@@ -178,16 +175,12 @@ public class SchemeIntent implements IMogoStatusChangedListener {
|
||||
mApis.getAnalyticsApi().track("appenterfront", properties);
|
||||
}
|
||||
|
||||
private void handleShowOnlineCarPanel(Uri uri) {
|
||||
mApis.getOnlineCarPanelApi().showPanel();
|
||||
}
|
||||
|
||||
/*
|
||||
* 语音打开事件面板
|
||||
* */
|
||||
private void handleShowEventPanel(int item) {
|
||||
Logger.d(TAG, "语音打开事件面板" + item);
|
||||
mApis.getEventPanelManager().showPanelWithSelectedItem(item);
|
||||
//mApis.getEventPanelManager().showPanelWithSelectedItem(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -39,14 +39,6 @@ public interface MogoModulesHandler {
|
||||
*/
|
||||
void loadBaseModule();
|
||||
|
||||
|
||||
/**
|
||||
* 加载事件面板
|
||||
*
|
||||
* @param containerId
|
||||
*/
|
||||
void loadEventPanelModule(int containerId);
|
||||
|
||||
/**
|
||||
* 释放各个模块资源
|
||||
*/
|
||||
|
||||
@@ -137,12 +137,6 @@ public class MogoModulesManager implements MogoModulesHandler {
|
||||
addFragment( provider, containerId );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadEventPanelModule( int containerId ) {
|
||||
IMogoModuleProvider provider = MogoApisHandler.getInstance().getApis().getEventPanelManager();
|
||||
addFragment( provider, containerId );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadBaseModule() {
|
||||
List< MogoModule > baseModules = MogoModulePaths.getBaseModules();
|
||||
|
||||
@@ -6,9 +6,9 @@ import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.check.CallerCheckManager;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.service.adas.IMogoAdasOCHCallback;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
@@ -25,14 +25,14 @@ public class VehicleMonitoring implements Handler.Callback {
|
||||
//非自动驾驶测试数据 后期根据需求做修改
|
||||
private static final long MANUAL_CHECK_STATUS_DELAY = 30 * 1000;
|
||||
//自动驾驶状态
|
||||
private static int AutopilotStatus = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus();
|
||||
private static int AutopilotStatus = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState();
|
||||
|
||||
public VehicleMonitoring(Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
public void vehicleCheck() {
|
||||
if (AutopilotStatus == IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING) {
|
||||
if (AutopilotStatus == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
Log.d(TAG, "自动驾驶中...");
|
||||
mHandler.sendEmptyMessageDelayed(AutopilotStatus, AUTO_CHECK_STATUS_DELAY);
|
||||
} else {
|
||||
@@ -44,14 +44,14 @@ public class VehicleMonitoring implements Handler.Callback {
|
||||
|
||||
@Override
|
||||
public boolean handleMessage(Message msg) {
|
||||
AutopilotStatus = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus();
|
||||
AutopilotStatus = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState();
|
||||
switch (msg.what) {
|
||||
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING:
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING:
|
||||
vehicleMonitor();
|
||||
mHandler.sendEmptyMessageDelayed(AutopilotStatus, AUTO_CHECK_STATUS_DELAY);
|
||||
return true;
|
||||
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_DISABLE:
|
||||
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_ENABLE:
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE:
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE:
|
||||
vehicleMonitor();
|
||||
mHandler.sendEmptyMessageDelayed(AutopilotStatus, MANUAL_CHECK_STATUS_DELAY);
|
||||
return true;
|
||||
|
||||
@@ -3,13 +3,12 @@ package com.mogo.module.main.registercenter;
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.navi.IMogoAimlessModeListener;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
@@ -90,16 +89,6 @@ public class MogoRegisterCenter implements IMogoRegisterCenter {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterMogoStaticMarkerClickListener(tag, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoAimlessModeListener(String tag, IMogoAimlessModeListener listener) {
|
||||
MogoRegisterCenterHandler.getInstance().registerMogoAimlessModeListener(tag, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoAimlessModeListener(String tag) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterMogoAimlessModeListener(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerCarLocationChangedListener(String tag, IMogoCarLocationChangedListener listener) {
|
||||
MogoRegisterCenterHandler.getInstance().registerCarLocationChangedListener(tag, listener);
|
||||
|
||||
@@ -5,7 +5,6 @@ import android.content.Context;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.navi.IMogoAimlessModeListener;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
@@ -34,7 +33,6 @@ public class MogoRegisterCenterHandler implements IMogoRegisterCenter {
|
||||
private final Map<String, IMogoLocationListener> mLocation = new HashMap<>();
|
||||
private final Map<String, IMogoMarkerClickListener> mMarker = new HashMap<>();
|
||||
private final Map<String, ArrayList<IMogoMarkerClickListener>> mStaticMarker = new HashMap<>();
|
||||
private final Map<String, IMogoAimlessModeListener> mAimless = new HashMap<>();
|
||||
private final Map<String, IMogoCarLocationChangedListener> mCarLocations = new ConcurrentHashMap<>();
|
||||
private final Map<String, IMogoADASControlStatusChangedListener> mADAS = new HashMap<>();
|
||||
|
||||
@@ -128,16 +126,6 @@ public class MogoRegisterCenterHandler implements IMogoRegisterCenter {
|
||||
list.remove(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoAimlessModeListener(String tag, IMogoAimlessModeListener listener) {
|
||||
mAimless.put(tag, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoAimlessModeListener(String tag) {
|
||||
mAimless.remove(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerCarLocationChangedListener(String tag, IMogoCarLocationChangedListener listener) {
|
||||
mCarLocations.put(tag, listener);
|
||||
@@ -162,22 +150,6 @@ public class MogoRegisterCenterHandler implements IMogoRegisterCenter {
|
||||
public void init(Context context) {
|
||||
}
|
||||
|
||||
public IMogoModuleLifecycle getLifecycleListener(String tag) {
|
||||
return mLifecycle.get(tag);
|
||||
}
|
||||
|
||||
public IMogoMapListener getMapListener(String tag) {
|
||||
return mMap.get(tag);
|
||||
}
|
||||
|
||||
public IMogoNaviListener getNaviListener(String tag) {
|
||||
return mNavi.get(tag);
|
||||
}
|
||||
|
||||
public IMogoLocationListener getLocationListener(String tag) {
|
||||
return mLocation.get(tag);
|
||||
}
|
||||
|
||||
public IMogoMarkerClickListener getMarkerListener(String tag) {
|
||||
return mMarker.get(tag);
|
||||
}
|
||||
@@ -186,10 +158,6 @@ public class MogoRegisterCenterHandler implements IMogoRegisterCenter {
|
||||
return mStaticMarker.get(tag);
|
||||
}
|
||||
|
||||
public Iterator<IMogoModuleLifecycle> getLifecycleListeners() {
|
||||
return mLifecycle.values().iterator();
|
||||
}
|
||||
|
||||
public Iterator<IMogoMapListener> getMapListeners() {
|
||||
return mMap.values().iterator();
|
||||
}
|
||||
@@ -203,15 +171,6 @@ public class MogoRegisterCenterHandler implements IMogoRegisterCenter {
|
||||
return mLocation.values().iterator();
|
||||
}
|
||||
|
||||
public Iterator<IMogoMarkerClickListener> getMarkerListeners() {
|
||||
return mMarker.values().iterator();
|
||||
}
|
||||
|
||||
public Iterator<IMogoAimlessModeListener> getAimlessModeListeners() {
|
||||
return mAimless.values().iterator();
|
||||
}
|
||||
|
||||
|
||||
public Iterator<IMogoCarLocationChangedListener> getCarLocationChangedListener() {
|
||||
return mCarLocations.values().iterator();
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.navi.MogoCarLocationChangedListenerRegister;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.main.EventDispatchCenter;
|
||||
import com.mogo.module.main.cards.MogoModulesManager;
|
||||
@@ -48,6 +49,7 @@ class MogoMainService extends Service implements IMogoLocationListener {
|
||||
Logger.d(TAG, "5秒已过,启动基础服务……");
|
||||
loadBaseModules();
|
||||
initADAS();
|
||||
initGpsSimulatorListener();
|
||||
HdMapBuildConfig.isMapLoaded = true;
|
||||
}, 5_000L
|
||||
);
|
||||
@@ -79,6 +81,14 @@ class MogoMainService extends Service implements IMogoLocationListener {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化自车定位监听
|
||||
*/
|
||||
private void initGpsSimulatorListener() {
|
||||
Logger.d(TAG, "注册自车位置监听");
|
||||
MogoCarLocationChangedListenerRegister.getInstance().registerCarLocationChangedListener(EventDispatchCenter.getInstance());
|
||||
}
|
||||
|
||||
private void loadBaseModules() {
|
||||
Logger.d(TAG, "加载基本模块");
|
||||
MogoModulesManager.getInstance().loadBaseModule();
|
||||
|
||||
@@ -61,15 +61,15 @@
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<!-- 右边事件面板 -->
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_event_panel_fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/module_main_id_entrance_fragment_container_marginLeft"
|
||||
android:paddingLeft="@dimen/module_main_event_panel_fragment_paddingLeft"
|
||||
android:paddingTop="@dimen/module_main_event_panel_fragment_paddingTop"
|
||||
android:paddingRight="@dimen/module_main_event_panel_fragment_paddingRight"
|
||||
android:paddingBottom="@dimen/module_main_event_panel_fragment_paddingBottom" />
|
||||
<!-- <FrameLayout-->
|
||||
<!-- android:id="@+id/module_main_id_event_panel_fragment_container"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent"-->
|
||||
<!-- android:layout_marginLeft="@dimen/module_main_id_entrance_fragment_container_marginLeft"-->
|
||||
<!-- android:paddingLeft="@dimen/module_main_event_panel_fragment_paddingLeft"-->
|
||||
<!-- android:paddingTop="@dimen/module_main_event_panel_fragment_paddingTop"-->
|
||||
<!-- android:paddingRight="@dimen/module_main_event_panel_fragment_paddingRight"-->
|
||||
<!-- android:paddingBottom="@dimen/module_main_event_panel_fragment_paddingBottom" />-->
|
||||
|
||||
<!-- 目的地车友 -->
|
||||
<FrameLayout
|
||||
|
||||
@@ -9,6 +9,4 @@
|
||||
-keep interface com.mogo.module.service.intent.IntentHandler{*;}
|
||||
-keep interface com.mogo.module.service.network.RefreshApiService{*;}
|
||||
-keep interface com.mogo.module.service.network.RefreshCallback{*;}
|
||||
-keep interface com.mogo.module.service.network.bean.DemoUserInfoEntity{*;}
|
||||
-keep interface com.mogo.module.service.ttsConfig.TtsConfigApiService{*;}
|
||||
-keep class com.mogo.module.service.ServiceConst{*;}
|
||||
-keep class com.mogo.module.service.ServiceConst{*;}
|
||||
@@ -23,9 +23,7 @@
|
||||
#-----ServiceModule-----
|
||||
-keep class com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo.*{*;}
|
||||
-keep class com.mogo.module.service.network.RefreshBody.*{*;}
|
||||
-keep class com.mogo.module.service.network.bean.DemoUserInfoEntity.*{*;}
|
||||
-keep interface com.mogo.module.service.intent.IntentHandler
|
||||
-keep interface com.mogo.module.service.network.RefreshApiService
|
||||
-keep interface com.mogo.module.service.network.RefreshCallback
|
||||
-keep interface com.mogo.module.service.network.bean.DemoUserInfoEntity
|
||||
-keep class com.mogo.module.service.ServiceConst
|
||||
@@ -10,16 +10,13 @@ import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
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.module.service.routeoverlay.MogoRouteOverlayManager;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
|
||||
@@ -13,7 +13,6 @@ import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.storage.SpStorage;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo;
|
||||
@@ -25,10 +24,8 @@ import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.map.IDestroyable;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.navi.IMogoAimlessModeListener;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
@@ -36,7 +33,6 @@ import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.service.autopilot.AutoPilotRemoteController;
|
||||
import com.mogo.module.service.handler.MainLooperHandler;
|
||||
import com.mogo.module.service.handler.RefreshWorkThreadHandler;
|
||||
import com.mogo.module.service.intent.IntentHandlerFactory;
|
||||
@@ -82,7 +78,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
IMogoLocationListener,
|
||||
IMogoNaviListener,
|
||||
IMogoIntentListener,
|
||||
IMogoAimlessModeListener,
|
||||
IMogoVoiceCmdCallBack,
|
||||
FragmentStackTransactionListener,
|
||||
IMogoCarLocationChangedListener2,
|
||||
@@ -323,7 +318,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
mRegisterCenter.registerMogoMapListener( ServiceConst.TYPE, this );
|
||||
mRegisterCenter.registerMogoLocationListener( ServiceConst.TYPE, this );
|
||||
mRegisterCenter.registerMogoNaviListener( ServiceConst.TYPE, this );
|
||||
mRegisterCenter.registerMogoAimlessModeListener( ServiceConst.TYPE, this );
|
||||
mRegisterCenter.registerCarLocationChangedListener( ServiceConst.TYPE, this );
|
||||
|
||||
mActionManager = MarkerServiceHandler.getActionManager();
|
||||
@@ -350,8 +344,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
|
||||
mFragmentManager.addMainFragmentStackTransactionListener( this );
|
||||
|
||||
AutoPilotRemoteController.getInstance().start();
|
||||
|
||||
Intent intent = new Intent( "com.freedom.ser.ACTION" );
|
||||
intent.addFlags( Intent.FLAG_INCLUDE_STOPPED_PACKAGES );
|
||||
mContext.sendBroadcast( intent );
|
||||
@@ -671,11 +663,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
* 刷新数据
|
||||
*/
|
||||
private void notifyRefreshData( MogoLatLng latLng, int radius, RefreshCallback callback ) {
|
||||
|
||||
if ( !DebugConfig.isMapBased() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !mStatusManager.isMainPageLaunched() ) {
|
||||
return;
|
||||
}
|
||||
@@ -733,25 +720,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
restartAutoRefreshAtTime( 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateTraffic2( MogoTraffic traffic ) {
|
||||
|
||||
if ( traffic == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( mCurrentLimit == traffic.getSpeedLimit() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
mCurrentLimit = traffic.getSpeedLimit();
|
||||
|
||||
Logger.i( TAG, "speed = %d, desc = %s", traffic.getSpeedLimit(), traffic.getDesc() );
|
||||
// 发送当前限速到 adas
|
||||
Intent intent = new Intent( "com.mogo.launcher.adas" );
|
||||
intent.putExtra( "adas_speed_limit", traffic.getSpeedLimit() );
|
||||
mContext.sendBroadcast( intent );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onIntentReceived( String command, Intent intent ) {
|
||||
@@ -828,7 +796,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
mStatusManager.setSearchUIShow( TAG, false );
|
||||
}
|
||||
mUiController.recoverLockMode();
|
||||
mADASController.showADAS();
|
||||
} else {
|
||||
mUiController.showMyLocation( false );
|
||||
AIAssist.getInstance( mContext ).registerUnWakeupCommand( ServiceConst.CMD_BACK, ServiceConst.CMD_BACK_WORDS, this );
|
||||
@@ -847,7 +814,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
SpStorage.setNavigationTarget( "" );
|
||||
Logger.d( TAG, "onStopNavi: remove MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH msg" );
|
||||
mHandler.removeMessages( ServiceConst.MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH );
|
||||
}
|
||||
|
||||
@@ -107,9 +107,6 @@ abstract class StatusChangedAdapter implements IMogoStatusChangedListener {
|
||||
}
|
||||
};
|
||||
}
|
||||
//MogoApisHandler.getInstance().getApis().getShareManager().dismissShareDialog();
|
||||
MogoApisHandler.getInstance().getApis().getOnlineCarPanelApi().hidePanel();
|
||||
MogoApisHandler.getInstance().getApis().getEventPanelManager().hidePanel();
|
||||
if (mCarsChattingProvider == null) {
|
||||
mCarsChattingProvider = (ICarsChattingProvider) ARouter.getInstance().build(CallChattingProviderConstant.CAR_CALL_PROVIDER).navigation();
|
||||
}
|
||||
@@ -143,7 +140,6 @@ abstract class StatusChangedAdapter implements IMogoStatusChangedListener {
|
||||
mIsFirstAccOn = false;
|
||||
return;
|
||||
}
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().showADAS();
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getSingletonLocationClient(AbsMogoApplication.getApp()).start();
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMarkerManager(AbsMogoApplication.getApp()).removeMarkers();
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
package com.mogo.module.service.autopilot;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
|
||||
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
|
||||
import com.mogo.service.cloud.socket.IMogoSocketManager;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/16
|
||||
*
|
||||
* 远端控制自动驾驶
|
||||
*/
|
||||
class AutoPilotRemoteController {
|
||||
|
||||
private static final String TAG = "AutoPilotRemoteController";
|
||||
|
||||
private static volatile AutoPilotRemoteController sInstance;
|
||||
|
||||
private IMogoSocketManager mMogoSocketManager;
|
||||
|
||||
private IMogoOnMessageListener<AutopilotControlParameters> mParametersListener = new IMogoOnMessageListener<AutopilotControlParameters>() {
|
||||
@Override
|
||||
public Class<AutopilotControlParameters> target() {
|
||||
return AutopilotControlParameters.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived( AutopilotControlParameters obj ) {
|
||||
if ( obj == null ) {
|
||||
Logger.e( TAG, "远端控制参数为null", new NullPointerException() );
|
||||
return;
|
||||
}
|
||||
String json = GsonUtil.jsonFromObject( obj );
|
||||
Logger.d( TAG, json );
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().aiCloudToAdasData( obj );
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 远端控制自动驾驶的消息类型
|
||||
*/
|
||||
public static final int MSG_TYPE_REMOTE_CONTROL_AUTOPILOT = 401014;
|
||||
|
||||
private AutoPilotRemoteController() {
|
||||
mMogoSocketManager = MogoApisHandler.getInstance().getApis().getSocketManagerApi( AbsMogoApplication.getApp() );
|
||||
}
|
||||
|
||||
public static AutoPilotRemoteController getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( AutoPilotRemoteController.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new AutoPilotRemoteController();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public void start() {
|
||||
mMogoSocketManager.registerOnMessageListener( MSG_TYPE_REMOTE_CONTROL_AUTOPILOT, mParametersListener );
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
if ( mMogoSocketManager != null ) {
|
||||
mMogoSocketManager.unregisterOnMessageListener( MSG_TYPE_REMOTE_CONTROL_AUTOPILOT, mParametersListener );
|
||||
}
|
||||
mMogoSocketManager = null;
|
||||
mParametersListener = null;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +1,5 @@
|
||||
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;
|
||||
@@ -12,12 +8,16 @@ import android.os.Message;
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.api.hmi.autopilot.IMoGoCheckAutoPilotBtnListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
@@ -27,16 +27,22 @@ import com.mogo.module.service.dispatch.bean.DispatchAdasAutoPilotLocReceiverBea
|
||||
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.cloud.socket.IMogoOnMessageListener;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
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;
|
||||
|
||||
//负责监听自动驾驶状态并进行状态上报,自动驾驶路线上报,接收调度指令展示指令弹窗
|
||||
public class DispatchAutoPilotManager implements IMogoOnMessageListener<DispatchAdasAutoPilotLocReceiverBean>
|
||||
, IDispatchRemindClickListener
|
||||
, IMogoCarLocationChangedListener2, IMogoAdasOCHCallback, IMoGoCheckAutoPilotBtnListener, IMoGoAutopilotPlanningListener {
|
||||
, IDispatchRemindClickListener, IMogoCarLocationChangedListener2,
|
||||
IMoGoCheckAutoPilotBtnListener, IMoGoAutopilotPlanningListener, IMoGoAutopilotStatusListener {
|
||||
|
||||
private static final String TAG = "DispatchAutoPilotManager";
|
||||
private static volatile DispatchAutoPilotManager instance;
|
||||
@@ -98,15 +104,26 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
|
||||
mApis.getSocketManagerApi(context).registerOnMessageListener(MSG_SOCKET_TYPE, this);
|
||||
mApis.getRegisterCenterApi()
|
||||
.registerCarLocationChangedListener(TAG, this);
|
||||
mApis.getAdasControllerApi()
|
||||
.addAdasOCHCallback(this);
|
||||
// 添加自动驾驶按钮选中监听
|
||||
CallerHmiListenerManager.INSTANCE.addCheckAutoPilotBtnListener(TAG, this);
|
||||
// 添加 规划路径相关回调 监听
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, this);
|
||||
// 添加 ADAS状态 监听
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, this);
|
||||
dispatchDialogManager = DispatchDialogManager.getInstance(context);
|
||||
dispatchDialogManager.addIDispatchRemindListener(this);
|
||||
handler.sendEmptyMessageDelayed(MSG_TYPE_UPLOAD_AUTOPILOT_STATUS, 1000L);
|
||||
}
|
||||
|
||||
public void release() {
|
||||
// 添加自动驾驶按钮选中监听
|
||||
CallerHmiListenerManager.INSTANCE.removeCheckAutoPilotBtnListener(TAG);
|
||||
// 添加 规划路径相关回调 监听
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.removeListener(TAG);
|
||||
// 添加 ADAS状态 监听
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.removeListener(TAG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<DispatchAdasAutoPilotLocReceiverBean> target() {
|
||||
return DispatchAdasAutoPilotLocReceiverBean.class;
|
||||
@@ -195,34 +212,6 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArriveAt(AutopilotStationInfo data) {
|
||||
if(!isDispatch){
|
||||
return;
|
||||
}
|
||||
if(data == null){
|
||||
return;
|
||||
}
|
||||
Logger.d(TAG, "onArriveAt data : " + data.toString());
|
||||
double endLat = data.getLat();
|
||||
double endLon = data.getLon();
|
||||
// 计算是不是到了终点
|
||||
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 onCheck(boolean isChecked) {
|
||||
if (isChecked) {
|
||||
@@ -302,4 +291,42 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
|
||||
}
|
||||
DispatchServiceModel.getInstance().uploadAutopilotRoute(autopilotRoute.getModels());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autoPilotStatusInfo) {
|
||||
autoPilotStatus = autoPilotStatusInfo.getState();
|
||||
this.reason = autoPilotStatusInfo.getReason();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotArriveAtStation(@Nullable AutopilotStationInfo autopilotWayArrive) {
|
||||
if (!isDispatch) {
|
||||
return;
|
||||
}
|
||||
if (autopilotWayArrive == null) {
|
||||
return;
|
||||
}
|
||||
Logger.d(TAG, "onArriveAt data : " + autopilotWayArrive.toString());
|
||||
double endLat = autopilotWayArrive.getLat();
|
||||
double endLon = autopilotWayArrive.getLon();
|
||||
// 计算是不是到了终点
|
||||
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 onAutopilotSNRequest() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotGuardian(@Nullable AutopilotGuardianStatusInfo guardianInfo) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public class DispatchServiceModel {
|
||||
@Override
|
||||
public void onNext(BaseData o) {
|
||||
super.onNext(o);
|
||||
Logger.d(TAG, "uploadAutopilotStatus success");
|
||||
//Logger.d(TAG, "uploadAutopilotStatus success");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,37 +3,16 @@ package com.mogo.module.service.handler;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.network.ParamsProvider;
|
||||
import com.mogo.commons.storage.SpStorage;
|
||||
import com.mogo.eagle.core.network.RequestOptions;
|
||||
import com.mogo.eagle.core.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
import com.mogo.module.service.MogoServices;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.service.network.RefreshApiService;
|
||||
import com.mogo.module.service.network.bean.HomeCompanyDistanceForPushData;
|
||||
import com.mogo.module.service.network.bean.HomeCompanyDistanceForPushResponse;
|
||||
import com.mogo.module.service.onlinecar.panel.NavigationTargetInfo;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/12/14
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
abstract class MainLooperHandler extends Handler {
|
||||
public abstract class MainLooperHandler extends Handler {
|
||||
|
||||
private static final String TAG = "MainLooperHandler";
|
||||
|
||||
@@ -52,9 +31,6 @@ abstract class MainLooperHandler extends Handler {
|
||||
case ServiceConst.MSG_LOOP_REQUEST:
|
||||
handleLoopRequestMessage( msg );
|
||||
break;
|
||||
case ServiceConst.MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH:
|
||||
handleScheduleCalculateNotHomeCompanyDistanceForPushMessage( msg );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,62 +38,4 @@ abstract class MainLooperHandler extends Handler {
|
||||
|
||||
protected abstract void handleLoopRequestMessage( Message msg );
|
||||
|
||||
protected void handleScheduleCalculateNotHomeCompanyDistanceForPushMessage( Message msg ) {
|
||||
handleCalculationNotHomeCompanyDistanceForPush( msg.arg1 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发起计算导航目的地推送策略
|
||||
*
|
||||
* @param time 第x次重试
|
||||
*/
|
||||
private void handleCalculationNotHomeCompanyDistanceForPush( final int time ) {
|
||||
if ( time > 3 ) {
|
||||
return;
|
||||
}
|
||||
String json = SpStorage.getNavigationTarget();
|
||||
if ( !TextUtils.isEmpty( json ) ) {
|
||||
try {
|
||||
NavigationTargetInfo info = GsonUtil.objectFromJson( json, NavigationTargetInfo.class );
|
||||
|
||||
Logger.d( TAG, "info = %s", info );
|
||||
|
||||
HomeCompanyDistanceForPushData data = new HomeCompanyDistanceForPushData();
|
||||
data.lat = Double.valueOf( info.getToPoiLatitude() );
|
||||
data.lon = Double.valueOf( info.getToPoiLongitude() );
|
||||
|
||||
final Map< String, Object > query = new ParamsProvider.Builder( AbsMogoApplication.getApp() ).build();
|
||||
query.put( "data", GsonUtil.jsonFromObject( data ) );
|
||||
MogoApisHandler.getInstance().getApis().getNetworkApi().create(RefreshApiService.class, HostConst.TRAVEL_CONDITION_HOST).calculationNotHomeCompanyDistanceForPush( query )
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< HomeCompanyDistanceForPushResponse >( RequestOptions.create( AbsMogoApplication.getApp() ) ) {
|
||||
@Override
|
||||
public void onSuccess( HomeCompanyDistanceForPushResponse o ) {
|
||||
super.onSuccess( o );
|
||||
if ( o != null && o.result != null ) {
|
||||
Logger.d( TAG, "calculationNotHomeCompanyDistanceForPush result %s", o.result.pushFlag );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( Throwable e ) {
|
||||
super.onError( e );
|
||||
Logger.d( TAG, "re scheduleCalculationNotHomeCompanyDistanceForPush after 30s" );
|
||||
// 延时30s重试
|
||||
MogoServices.getInstance().scheduleCalculationNotHomeCompanyDistanceForPush( time + 1, 30_000L );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( String message, int code ) {
|
||||
super.onError( message, code );
|
||||
}
|
||||
} );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "handleCalculationNotHomeCompanyDistanceForPush" );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
package com.mogo.module.service.intent;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.service.receiver.MogoReceiver;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/6/5
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class ADASStatusIntentHandler implements IntentHandler {
|
||||
|
||||
private static volatile ADASStatusIntentHandler sInstance;
|
||||
|
||||
private ADASStatusIntentHandler() {
|
||||
}
|
||||
|
||||
public static ADASStatusIntentHandler getInstance() {
|
||||
if (sInstance == null) {
|
||||
synchronized (ADASStatusIntentHandler.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new ADASStatusIntentHandler();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(Context context, Intent intent) {
|
||||
if (intent == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (MogoReceiver.ACTIION_ADAS.equals(intent.getAction())) {
|
||||
|
||||
int status = intent.getIntExtra(MogoReceiver.PARAM_ADAS_STATUS, 0);
|
||||
MarkerServiceHandler.getMogoStatusManager().setADASUIShow(ServiceConst.TYPE, status == 1);
|
||||
}
|
||||
// 由于adas可能调高此处的调用频率,存在anr风险,且此处没有作用,所以暂时注释掉
|
||||
else {
|
||||
String msg = intent.getStringExtra("adasMsg");
|
||||
if (TextUtils.isEmpty(msg)) {
|
||||
return;
|
||||
}
|
||||
Logger.d("ADAS COOR", msg);
|
||||
|
||||
AutopilotCarStateInfo stateInfo = GsonUtil.objectFromJson(msg, AutopilotCarStateInfo.class);
|
||||
if (stateInfo != null && stateInfo.getValues() != null) {
|
||||
JSONObject data = new JSONObject();
|
||||
try {
|
||||
data.putOpt("lon", stateInfo.getValues().getLon());
|
||||
data.putOpt("lat", stateInfo.getValues().getLat());
|
||||
data.putOpt("alt", stateInfo.getValues().getAlt());
|
||||
data.putOpt("speed", stateInfo.getValues().getGnss_speed());
|
||||
data.putOpt("satelliteTime", stateInfo.getValues().getSatelliteTime());
|
||||
data.putOpt("heading", stateInfo.getValues().getHeading());
|
||||
data.putOpt("acceleration", stateInfo.getValues().getAcceleration());
|
||||
data.putOpt("yawRate", stateInfo.getValues().getYaw_rate());
|
||||
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map(data);
|
||||
SnapshotLocationDataCenter.getInstance().syncAdasLocationInfo(data);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,14 +10,13 @@ import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.service.launchercard.LauncherCardRefresher;
|
||||
import com.mogo.module.service.receiver.AccStatusReceiver;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/6/5
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class AccStatusIntentHandler implements IntentHandler {
|
||||
public class AccStatusIntentHandler implements IntentHandler {
|
||||
|
||||
public static final byte ACC_ON = 1;
|
||||
public static final byte ACC_OFF = 0;
|
||||
|
||||
@@ -27,8 +27,6 @@ public class IntentHandlerFactory {
|
||||
mHandlers.put( Intent.ACTION_POWER_CONNECTED, AccStatusIntentHandler.getInstance() );
|
||||
mHandlers.put( Intent.ACTION_POWER_DISCONNECTED, AccStatusIntentHandler.getInstance() );
|
||||
mHandlers.put( AccStatusReceiver.ACTION_NWD_ACC, AccStatusIntentHandler.getInstance() );
|
||||
mHandlers.put( MogoReceiver.ACTION_ADAS_STATUS, ADASStatusIntentHandler.getInstance() );
|
||||
mHandlers.put( MogoReceiver.ACTIION_ADAS, ADASStatusIntentHandler.getInstance() );
|
||||
mHandlers.put( MogoReceiver.ACTION_VOICE_READY, new AIAssistIntentHandler() );
|
||||
mHandlers.put( ServiceConst.COMMAND_BACK, WholeVoiceCommandIntentHandler.getInstance() );
|
||||
mHandlers.put( MogoReceiver.ACTION_MOGO, new MogoControllerIntentHandler() );
|
||||
|
||||
@@ -30,7 +30,6 @@ import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.search.geo.IMogoGeoSearch;
|
||||
import com.mogo.map.search.geo.IMogoGeoSearchListener;
|
||||
import com.mogo.map.search.geo.MogoGeocodeResult;
|
||||
@@ -124,15 +123,6 @@ public class MockIntentHandler implements IntentHandler {
|
||||
query.setRadius(1000);
|
||||
geoSearch.getFromLocationAsyn(query);
|
||||
break;
|
||||
case 12: {// 控制ADAS显示隐藏
|
||||
boolean status2 = intent.getBooleanExtra("status", false);
|
||||
if (status2) {
|
||||
MarkerServiceHandler.getADASController().showADAS();
|
||||
} else {
|
||||
MarkerServiceHandler.getADASController().closeADAS();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 14: {//测试点的动画移动,模拟周边车辆移动
|
||||
List<MogoLatLng> mogoLatLngs = new ArrayList<>();
|
||||
mogoLatLngs.add(new MogoLatLng(39.615986, 116.396716));
|
||||
@@ -248,7 +238,6 @@ public class MockIntentHandler implements IntentHandler {
|
||||
.owner(TAG)
|
||||
.autoManager(false);
|
||||
int duration = intent.getIntExtra("duration", 30);
|
||||
MarkerServiceHandler.getApis().getRefreshStrategyControllerApi().restartAutoRefreshAtTime(duration);
|
||||
IMogoMarker marker = MarkerServiceHandler.getMarkerManager().addMarker(TAG, options);
|
||||
MarkerServiceHandler.getMogoStatusManager().setUserInteractionStatus(TAG, true, false);
|
||||
if (!MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode()) {
|
||||
@@ -422,22 +411,6 @@ public class MockIntentHandler implements IntentHandler {
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 43://
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getAdasControllerApi()
|
||||
.onAutopilotArriveLike(intent.getIntExtra("type", 8));
|
||||
break;
|
||||
case 44:// 控制自动驾驶
|
||||
AutopilotControlParameters parameters = new AutopilotControlParameters();
|
||||
parameters.vehicleType = 9;
|
||||
parameters.startLatLon = new AutopilotControlParameters.AutoPilotLonLat(40.1690522746, 116.567374558);
|
||||
parameters.endLatLon = new AutopilotControlParameters.AutoPilotLonLat(40.1651999405, 116.567217441);
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getAdasControllerApi()
|
||||
.aiCloudToAdasData(parameters);
|
||||
break;
|
||||
case 45:// 测试开启鹰眼模式
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
package com.mogo.module.service.location;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.location.Criteria;
|
||||
import android.location.Location;
|
||||
import android.location.LocationListener;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
|
||||
import com.mogo.service.cloud.location.CloudLocationInfo;
|
||||
|
||||
public class MogoRTKLocation {
|
||||
|
||||
private static final String TAG = "MogoRTKLocation";
|
||||
private LocationManager locationManager;
|
||||
|
||||
public static MogoRTKLocation getInstance() {
|
||||
return RTKHolder.rtkLoc;
|
||||
}
|
||||
|
||||
private static class RTKHolder {
|
||||
private static final MogoRTKLocation rtkLoc = new MogoRTKLocation();
|
||||
}
|
||||
|
||||
private MogoRTKLocation() {
|
||||
}
|
||||
|
||||
@SuppressLint("MissingPermission")
|
||||
public void init() {
|
||||
locationManager = (LocationManager) AbsMogoApplication.getApp().getApplicationContext().getSystemService(Context.LOCATION_SERVICE);
|
||||
String provider = locationManager.getBestProvider(getCriteria(), true);
|
||||
Logger.d(TAG, "init provider : " + provider);
|
||||
if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
|
||||
try {
|
||||
locationManager.requestLocationUpdates(provider, 0, 0, locationListener);
|
||||
Location location = locationManager.getLastKnownLocation(provider);
|
||||
if (location != null) {
|
||||
Logger.i(TAG, "location : " + location.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Logger.d(TAG, "RTK LocationManager requestLocationUpdates has Exception : " + e.getMessage());
|
||||
}
|
||||
} else {
|
||||
Logger.d(TAG, "RTK LocationManager Provider GPS_PROVIDER unable");
|
||||
}
|
||||
}
|
||||
|
||||
private Criteria getCriteria() {
|
||||
Criteria criteria = new Criteria();
|
||||
criteria.setAccuracy(Criteria.ACCURACY_FINE); //高精
|
||||
criteria.setAltitudeRequired(false);
|
||||
criteria.setBearingRequired(true);
|
||||
criteria.setSpeedRequired(true);
|
||||
criteria.setPowerRequirement(Criteria.POWER_LOW);
|
||||
return criteria;
|
||||
}
|
||||
|
||||
private final LocationListener locationListener = new LocationListener() {
|
||||
@Override
|
||||
public void onLocationChanged(Location location) {
|
||||
if (location != null) {
|
||||
CloudLocationInfo cloudLocationInfo = new CloudLocationInfo();
|
||||
if (location.getLatitude() != 0.0 && location.getLongitude() != 0.0) {
|
||||
cloudLocationInfo.setAlt(location.getAltitude());
|
||||
cloudLocationInfo.setHeading(location.getBearing());
|
||||
cloudLocationInfo.setLat(location.getLatitude());
|
||||
cloudLocationInfo.setLon(location.getLongitude());
|
||||
cloudLocationInfo.setSpeed(location.getSpeed());
|
||||
cloudLocationInfo.setSatelliteTime(location.getTime());
|
||||
cloudLocationInfo.setSystemTime(System.currentTimeMillis());
|
||||
cloudLocationInfo.setTileId(String.valueOf(MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController()
|
||||
.getTileId(location.getLongitude(), location.getLatitude())));
|
||||
SnapshotLocationDataCenter.getInstance().syncLocationInfo(cloudLocationInfo);
|
||||
}
|
||||
} else {
|
||||
Logger.e(TAG, "location == null");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(String provider, int status, Bundle extras) {
|
||||
Logger.d(TAG, "onStatusChanged status: " + status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProviderEnabled(String provider) {
|
||||
Logger.d(TAG, "onProviderEnabled");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProviderDisabled(String provider) {
|
||||
Logger.d(TAG, "onProviderEnabled");
|
||||
}
|
||||
};
|
||||
|
||||
public void stop() {
|
||||
Logger.d(TAG, "stop RTK Location");
|
||||
if (locationManager != null && locationListener != null) {
|
||||
locationManager.removeUpdates(locationListener);
|
||||
} else {
|
||||
Logger.d(TAG, "stop failed , listener: " + locationListener + " is null");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package com.mogo.module.service.network;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.service.network.bean.DemoUserInfoEntity;
|
||||
import com.mogo.module.service.network.bean.HomeCompanyDistanceForPushResponse;
|
||||
import com.mogo.module.service.network.bean.TtsConfigData;
|
||||
|
||||
@@ -11,7 +10,6 @@ import java.util.Map;
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.FieldMap;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
/**
|
||||
@@ -40,12 +38,6 @@ public interface RefreshApiService {
|
||||
@POST( "/yycp-launcherSnapshot/user/queryOnLineCarWithRoute" )
|
||||
Observable< MarkerResponse > queryOnLineCarWithRoute( @FieldMap Map< String, Object > parameters );
|
||||
|
||||
/**
|
||||
* 查询演示车用户信息
|
||||
*/
|
||||
@GET( "/yycp-launcherSnapshot/mock/getMockUserInfos" )
|
||||
Observable< DemoUserInfoEntity > getMockUsers();
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST( "/yycp-travel-condition/trajectoryPrediction/calculationNotHomeCompanyDistanceForPush" )
|
||||
Observable< HomeCompanyDistanceForPushResponse > calculationNotHomeCompanyDistanceForPush( @FieldMap Map< String, Object > parameters );
|
||||
|
||||
@@ -1,267 +0,0 @@
|
||||
package com.mogo.module.service.network.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/4/24 4:20 PM
|
||||
* desc : TODO 前瞻需求演示使用的用户数据
|
||||
* version: 1.0
|
||||
*/
|
||||
public class DemoUserInfoEntity extends BaseData {
|
||||
|
||||
/**
|
||||
* code : 0
|
||||
* msg :
|
||||
* detailMsg :
|
||||
* result : {"userList":[{"sceneType":"1","location":{"lat":39.97541,"lon":116.41782761},"userInfo":{"sn":"ZD801B1920L00818","userId":1,"userName":"用户昵称","userHead":"https://www.baidu.com/img/baidu_jgylogo3.png","gender":"男","age":20,"lastActiveweekAvgscore":"96","safeLabel":"老司机","safeLabelType":1}},{"sceneType":"2","location":{"lat":39.97541,"lon":116.41782761},"userInfo":{"sn":"ZD802B1932L00779","userId":1,"userName":"用户昵称","userHead":"https://www.baidu.com/img/baidu_jgylogo3.png","gender":"男","age":20,"lastActiveweekAvgscore":"96","safeLabel":"老司机","safeLabelType":1}},{"sceneType":"3","location":{"lat":39.97541,"lon":116.41782761},"userInfo":{"sn":"ZD802B1932L00779","userId":1,"userName":"用户昵称","userHead":"https://www.baidu.com/img/baidu_jgylogo3.png","gender":"男","age":20,"lastActiveweekAvgscore":"96","safeLabel":"老司机","safeLabelType":1}}]}
|
||||
*/
|
||||
|
||||
private String detailMsg;
|
||||
private ResultBean result;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public String getDetailMsg() {
|
||||
return detailMsg;
|
||||
}
|
||||
|
||||
public void setDetailMsg(String detailMsg) {
|
||||
this.detailMsg = detailMsg;
|
||||
}
|
||||
|
||||
public ResultBean getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(ResultBean result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public static class ResultBean {
|
||||
private List<UserListBean> userList;
|
||||
|
||||
public List<UserListBean> getUserList() {
|
||||
return userList;
|
||||
}
|
||||
|
||||
public void setUserList(List<UserListBean> userList) {
|
||||
this.userList = userList;
|
||||
}
|
||||
|
||||
public static class UserListBean {
|
||||
/**
|
||||
* sceneType : 1
|
||||
* location : {"lat":39.97541,"lon":116.41782761}
|
||||
* userInfo : {"sn":"ZD801B1920L00818","userId":1,"userName":"用户昵称","userHead":"https://www.baidu.com/img/baidu_jgylogo3.png","gender":"男","age":20,"lastActiveweekAvgscore":"96","safeLabel":"老司机","safeLabelType":1}
|
||||
*/
|
||||
|
||||
private String sceneType;
|
||||
private LocationBean location;
|
||||
private UserInfoBean userInfo;
|
||||
|
||||
public String getSceneType() {
|
||||
return sceneType;
|
||||
}
|
||||
|
||||
public void setSceneType(String sceneType) {
|
||||
this.sceneType = sceneType;
|
||||
}
|
||||
|
||||
public LocationBean getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(LocationBean location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public UserInfoBean getUserInfo() {
|
||||
return userInfo;
|
||||
}
|
||||
|
||||
public void setUserInfo(UserInfoBean userInfo) {
|
||||
this.userInfo = userInfo;
|
||||
}
|
||||
|
||||
public static class LocationBean {
|
||||
/**
|
||||
* lat : 39.97541
|
||||
* lon : 116.41782761
|
||||
*/
|
||||
|
||||
private double lat;
|
||||
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 "LocationBean{" +
|
||||
"lat=" + lat +
|
||||
", lon=" + lon +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
public static class UserInfoBean {
|
||||
/**
|
||||
* sn : ZD801B1920L00818
|
||||
* userId : 1
|
||||
* userName : 用户昵称
|
||||
* userHead : https://www.baidu.com/img/baidu_jgylogo3.png
|
||||
* gender : 男
|
||||
* age : 20
|
||||
* lastActiveweekAvgscore : 96
|
||||
* safeLabel : 老司机
|
||||
* safeLabelType : 1
|
||||
*/
|
||||
|
||||
private String sn;
|
||||
private int userId;
|
||||
private String userName;
|
||||
private String userHead;
|
||||
private String gender;
|
||||
private int age;
|
||||
private String lastActiveweekAvgscore;
|
||||
private String safeLabel;
|
||||
private int safeLabelType;
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public int getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(int userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getUserHead() {
|
||||
return userHead;
|
||||
}
|
||||
|
||||
public void setUserHead(String userHead) {
|
||||
this.userHead = userHead;
|
||||
}
|
||||
|
||||
public String getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public int getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
public void setAge(int age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public String getLastActiveweekAvgscore() {
|
||||
return lastActiveweekAvgscore;
|
||||
}
|
||||
|
||||
public void setLastActiveweekAvgscore(String lastActiveweekAvgscore) {
|
||||
this.lastActiveweekAvgscore = lastActiveweekAvgscore;
|
||||
}
|
||||
|
||||
public String getSafeLabel() {
|
||||
return safeLabel;
|
||||
}
|
||||
|
||||
public void setSafeLabel(String safeLabel) {
|
||||
this.safeLabel = safeLabel;
|
||||
}
|
||||
|
||||
public int getSafeLabelType() {
|
||||
return safeLabelType;
|
||||
}
|
||||
|
||||
public void setSafeLabelType(int safeLabelType) {
|
||||
this.safeLabelType = safeLabelType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserInfoBean{" +
|
||||
"sn='" + sn + '\'' +
|
||||
", userId=" + userId +
|
||||
", userName='" + userName + '\'' +
|
||||
", userHead='" + userHead + '\'' +
|
||||
", gender='" + gender + '\'' +
|
||||
", age=" + age +
|
||||
", lastActiveweekAvgscore='" + lastActiveweekAvgscore + '\'' +
|
||||
", safeLabel='" + safeLabel + '\'' +
|
||||
", safeLabelType=" + safeLabelType +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserListBean{" +
|
||||
"sceneType='" + sceneType + '\'' +
|
||||
", location=" + location +
|
||||
", userInfo=" + userInfo +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "V2XDemoUserInfoEntity{" +
|
||||
"detailMsg='" + detailMsg + '\'' +
|
||||
", result=" + result +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package com.mogo.module.service.network.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
/**
|
||||
* @author :zhuangyan
|
||||
* @date : 2020/11/17 11:43
|
||||
* @desc :分体机tts播报信息返回
|
||||
*/
|
||||
public class TtsConfigEntity extends BaseData {
|
||||
public Result result;
|
||||
|
||||
public Result getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(Result result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public static class Result {
|
||||
private String word;
|
||||
|
||||
public String getWord() {
|
||||
return word;
|
||||
}
|
||||
|
||||
public void setWord(String word) {
|
||||
this.word = word;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.mogo.module.service.onlinecar.panel;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/9/21
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
class ContainerHandler {
|
||||
|
||||
public static int sContainerId = 0;
|
||||
public static FragmentActivity sAttachContext;
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.mogo.module.service.onlinecar.panel;
|
||||
|
||||
import com.mogo.commons.mvp.IView;
|
||||
import com.mogo.module.common.entity.MarkerOnlineCar;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/9/21
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
interface IOnlineCarPanelView extends IView {
|
||||
|
||||
void showLoading(boolean visible);
|
||||
|
||||
void renderOnlineCarList( List< MarkerOnlineCar > onlineCars, double lon, double lat );
|
||||
|
||||
void renderEmptyUi( OnlineCarStrategy strategy );
|
||||
|
||||
void renderNoNavigationInfoUi();
|
||||
|
||||
void renderErrorUi();
|
||||
|
||||
void removeSelf();
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
package com.mogo.module.service.onlinecar.panel;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/9/21
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
class NavigationTargetInfo {
|
||||
|
||||
|
||||
/**
|
||||
* FromPoiName : 东城区小黄庄北街2号
|
||||
* FromPoiAddr : 在中国银行(北京安贞桥支行)附近
|
||||
* FromPoiLongitude : 116.41082763671875
|
||||
* FromPoiLatitude : 39.96831130981445
|
||||
* ToPoiName : 北京市北京市北小营镇宏大工业开发中心A座7号
|
||||
* ToPoiLongitude : 116.74490356445312
|
||||
* ToPoiLatitude : 40.19820785522461
|
||||
*/
|
||||
private String FromPoiName;
|
||||
private String FromPoiAddr;
|
||||
private String FromPoiLongitude;
|
||||
private String FromPoiLatitude;
|
||||
private String ToPoiName;
|
||||
private String ToPoiLongitude;
|
||||
private String ToPoiLatitude;
|
||||
|
||||
public String getFromPoiName() {
|
||||
return FromPoiName;
|
||||
}
|
||||
|
||||
public void setFromPoiName( String FromPoiName ) {
|
||||
this.FromPoiName = FromPoiName;
|
||||
}
|
||||
|
||||
public String getFromPoiAddr() {
|
||||
return FromPoiAddr;
|
||||
}
|
||||
|
||||
public void setFromPoiAddr( String FromPoiAddr ) {
|
||||
this.FromPoiAddr = FromPoiAddr;
|
||||
}
|
||||
|
||||
public String getFromPoiLongitude() {
|
||||
return FromPoiLongitude;
|
||||
}
|
||||
|
||||
public void setFromPoiLongitude( String FromPoiLongitude ) {
|
||||
this.FromPoiLongitude = FromPoiLongitude;
|
||||
}
|
||||
|
||||
public String getFromPoiLatitude() {
|
||||
return FromPoiLatitude;
|
||||
}
|
||||
|
||||
public void setFromPoiLatitude( String FromPoiLatitude ) {
|
||||
this.FromPoiLatitude = FromPoiLatitude;
|
||||
}
|
||||
|
||||
public String getToPoiName() {
|
||||
return ToPoiName;
|
||||
}
|
||||
|
||||
public void setToPoiName( String ToPoiName ) {
|
||||
this.ToPoiName = ToPoiName;
|
||||
}
|
||||
|
||||
public String getToPoiLongitude() {
|
||||
return ToPoiLongitude;
|
||||
}
|
||||
|
||||
public void setToPoiLongitude( String ToPoiLongitude ) {
|
||||
this.ToPoiLongitude = ToPoiLongitude;
|
||||
}
|
||||
|
||||
public String getToPoiLatitude() {
|
||||
return ToPoiLatitude;
|
||||
}
|
||||
|
||||
public void setToPoiLatitude( String ToPoiLatitude ) {
|
||||
this.ToPoiLatitude = ToPoiLatitude;
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package com.mogo.module.service.onlinecar.panel;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.service.strategy.IMogoOnlineCarListPanelProvider;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/9/21
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
@Route( path = MogoServicePaths.PATH_ONLINE_CAR_PANEL )
|
||||
class OnlineCarListPanelProvider implements IMogoOnlineCarListPanelProvider {
|
||||
|
||||
private static final String TAG = "OnlineCarListPanelProvider";
|
||||
|
||||
@Override
|
||||
public void initContainer( int containerId, FragmentActivity activity ) {
|
||||
ContainerHandler.sContainerId = containerId;
|
||||
ContainerHandler.sAttachContext = activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showPanel() {
|
||||
if ( ContainerHandler.sAttachContext == null ) {
|
||||
return;
|
||||
}
|
||||
Fragment fragment = new OnlineCarPanelFragment();
|
||||
Logger.d( TAG, "showPanel" );
|
||||
ContainerHandler.sAttachContext
|
||||
.getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace( ContainerHandler.sContainerId, fragment, TAG )
|
||||
.commitNowAllowingStateLoss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hidePanel() {
|
||||
if ( ContainerHandler.sAttachContext == null ) {
|
||||
return;
|
||||
}
|
||||
Logger.d( TAG, "hidePanel" );
|
||||
Fragment fragment = ContainerHandler.sAttachContext.getSupportFragmentManager().findFragmentByTag( TAG );
|
||||
if ( fragment != null ) {
|
||||
ContainerHandler.sAttachContext
|
||||
.getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
.remove( fragment )
|
||||
.commitNowAllowingStateLoss();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
ContainerHandler.sContainerId = 0;
|
||||
ContainerHandler.sAttachContext = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,140 +0,0 @@
|
||||
package com.mogo.module.service.onlinecar.panel;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.api.CallChatApi;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.MarkerOnlineCar;
|
||||
import com.mogo.module.common.entity.MarkerUserInfo;
|
||||
import com.mogo.module.common.glide.SkinAbleBitmapTarget;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.module.service.Utils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.ResourcesHelper;
|
||||
import com.zhidao.carchattingprovider.CallChattingProviderConstant;
|
||||
import com.zhidao.carchattingprovider.ICarsChattingProvider;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/9/21
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
class OnlineCarPanelAdapter extends RecyclerView.Adapter<OnlineCarPanelAdapter.VH> {
|
||||
|
||||
private static final String TAG = "OnlineCarPanelAdapter";
|
||||
|
||||
private List<MarkerOnlineCar> mDatums;
|
||||
private double mToLon;
|
||||
private double mToLat;
|
||||
|
||||
public OnlineCarPanelAdapter(List<MarkerOnlineCar> mDatums, double mToLon, double mToLat) {
|
||||
this.mDatums = mDatums;
|
||||
this.mToLon = mToLon;
|
||||
this.mToLat = mToLat;
|
||||
}
|
||||
|
||||
public void setDatums(List<MarkerOnlineCar> mDatums) {
|
||||
this.mDatums = mDatums;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public OnlineCarPanelAdapter.VH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new VH(LayoutInflater.from(parent.getContext()).inflate(R.layout.module_services_online_car_panel_item, null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull OnlineCarPanelAdapter.VH holder, int position) {
|
||||
holder.bind(mDatums.get(position), mToLon, mToLat);
|
||||
holder.call.setOnClickListener(view -> {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
MarkerUserInfo userInfo = mDatums.get(position).getUserInfo();
|
||||
params.put(CallChattingProviderConstant.CCPROVIDER_SN, userInfo.getSn());
|
||||
params.put(CallChattingProviderConstant.CCPROVIDER_USER_IMG, userInfo.getUserHead());
|
||||
params.put(CallChattingProviderConstant.CCPROVIDER_USER_AGE, userInfo.getAgeNumber() + "");
|
||||
params.put(CallChattingProviderConstant.CCPROVIDER_NICK_NAME, userInfo.getUserName());
|
||||
params.put(CallChattingProviderConstant.CCPROVIDER_USER_SEX, userInfo.getGender() + "");
|
||||
MarkerLocation location = mDatums.get(position).getLocation();
|
||||
params.put(CallChattingProviderConstant.CCPROVIDER_ADDRESS, location.getAddress());
|
||||
params.put(CallChattingProviderConstant.CCPROVIDER_LAT, location.getLat() + "");
|
||||
params.put(CallChattingProviderConstant.CCPROVIDER_LON, location.getLon() + "");
|
||||
ICarsChattingProvider carChatting = MarkerServiceHandler.getCarChatting();
|
||||
if ( carChatting != null ) {
|
||||
carChatting.call(params);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mDatums == null ? 0 : mDatums.size();
|
||||
}
|
||||
|
||||
public static class VH extends RecyclerView.ViewHolder {
|
||||
|
||||
private ImageView avatar;
|
||||
private TextView nickname;
|
||||
private TextView distance;
|
||||
private TextView detail;
|
||||
private TextView call;
|
||||
|
||||
public VH(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
RecyclerView.LayoutParams params = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
params.bottomMargin = ResourcesHelper.getDimensionPixelSize(itemView.getContext(), R.dimen.module_services_panel_item_marginBottom);
|
||||
itemView.setLayoutParams(params);
|
||||
avatar = itemView.findViewById(R.id.module_services_id_panel_item_avatar);
|
||||
nickname = itemView.findViewById(R.id.module_services_id_panel_item_nickname);
|
||||
distance = itemView.findViewById(R.id.module_services_id_panel_item_distance);
|
||||
detail = itemView.findViewById(R.id.module_services_id_panel_item_detail);
|
||||
call = itemView.findViewById(R.id.module_services_id_panel_item_call);
|
||||
}
|
||||
|
||||
public void bind(MarkerOnlineCar car, double lon, double lat) {
|
||||
RequestOptions options = new RequestOptions().circleCrop().placeholder(R.drawable.module_common_default_user_head).error(R.drawable.module_common_default_user_head);
|
||||
GlideApp.with(itemView.getContext()).asBitmap().apply(options).load(car.getUserInfo().getUserHead()).into(new SkinAbleBitmapTarget(avatar, options));
|
||||
nickname.setText(car.getUserInfo().getUserName());
|
||||
String content = getDistanceStr(car.getLocation(), lon, lat);
|
||||
distance.setText(content);
|
||||
detail.setOnClickListener(view -> {
|
||||
MogoApisHandler.getInstance().getApis().getAnalyticsApi().track("Mogoer_List_click", null);
|
||||
try {
|
||||
CallChatApi.getInstance().showUserWindow(itemView.getContext(), car);
|
||||
} catch (Exception e) {
|
||||
Logger.e(TAG, e, "detail.OnClick");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private String getDistanceStr(MarkerLocation location, double lon, double lat) {
|
||||
if (location == null) {
|
||||
return "未知";
|
||||
}
|
||||
float distance = Utils.calculateLineDistance(location.getLon(), location.getLat(), lon, lat);
|
||||
if (distance >= 1000) {
|
||||
return String.format("%.1f公里", distance / 1000);
|
||||
} else {
|
||||
return String.format("%.1f米", distance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,189 +0,0 @@
|
||||
package com.mogo.module.service.onlinecar.panel;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.entity.MarkerOnlineCar;
|
||||
import com.mogo.module.common.view.OnPreventFastClickListener;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/9/21
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class OnlineCarPanelFragment extends MvpFragment< IOnlineCarPanelView, OnlineCarPanelPresenter > implements IOnlineCarPanelView {
|
||||
private String TAG = "OnlineCarPanelFragment";
|
||||
|
||||
private RecyclerView mList;
|
||||
private View mErrorPanel;
|
||||
|
||||
private View mRefreshPanel;
|
||||
private TextView mEmptyTip;
|
||||
private View m20KMStrategy;
|
||||
private View m40KMStrategy;
|
||||
|
||||
private ProgressBar mLoading;
|
||||
|
||||
private OnlineCarPanelAdapter mOnlineCarPanelAdapter;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_services_fragment_online_car_panel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTagName() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
findViewById( R.id.module_services_id_close ).setOnClickListener( new OnPreventFastClickListener() {
|
||||
@Override
|
||||
public void onClickImpl( View v ) {
|
||||
removeSelf();
|
||||
}
|
||||
} );
|
||||
mList = findViewById( R.id.module_services_id_recycler_view );
|
||||
mRefreshPanel = findViewById( R.id.module_services_id_load_strategy_container );
|
||||
mErrorPanel = findViewById( R.id.module_services_id_error_container );
|
||||
m20KMStrategy = findViewById( R.id.module_services_id_20Km_radius );
|
||||
m40KMStrategy = findViewById( R.id.module_services_id_40Km_radius );
|
||||
mEmptyTip = findViewById( R.id.module_services_empty_tip );
|
||||
mLoading = findViewById( R.id.module_services_id_loading );
|
||||
|
||||
mList.setLayoutManager( new LinearLayoutManager( getContext(), LinearLayoutManager.VERTICAL, false ) );
|
||||
|
||||
m20KMStrategy.setOnClickListener( new OnPreventFastClickListener() {
|
||||
@Override
|
||||
public void onClickImpl( View v ) {
|
||||
mPresenter.next20KMStrategy();
|
||||
}
|
||||
} );
|
||||
m40KMStrategy.setOnClickListener( new OnPreventFastClickListener() {
|
||||
@Override
|
||||
public void onClickImpl( View v ) {
|
||||
mPresenter.next40KMStrategy();
|
||||
}
|
||||
} );
|
||||
mErrorPanel.setOnClickListener( new OnPreventFastClickListener() {
|
||||
@Override
|
||||
public void onClickImpl( View v ) {
|
||||
mPresenter.loadOnlineCar();
|
||||
}
|
||||
} );
|
||||
|
||||
mRootView.setOnClickListener( view -> {
|
||||
} );
|
||||
}
|
||||
|
||||
public void refreshPanel() {
|
||||
mPresenter.refreshPanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showLoading( boolean visible ) {
|
||||
if ( visible ) {
|
||||
mRefreshPanel.setVisibility( View.GONE );
|
||||
mList.setVisibility( View.GONE );
|
||||
mErrorPanel.setVisibility( View.GONE );
|
||||
mLoading.setVisibility( View.VISIBLE );
|
||||
} else {
|
||||
mLoading.setVisibility( View.GONE );
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected OnlineCarPanelPresenter createPresenter() {
|
||||
return new OnlineCarPanelPresenter( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderOnlineCarList( List< MarkerOnlineCar > onlineCars, double lon, double lat ) {
|
||||
mRefreshPanel.setVisibility( View.GONE );
|
||||
mErrorPanel.setVisibility( View.GONE );
|
||||
mList.setVisibility( View.VISIBLE );
|
||||
mLoading.setVisibility( View.GONE );
|
||||
if ( mOnlineCarPanelAdapter == null ) {
|
||||
mOnlineCarPanelAdapter = new OnlineCarPanelAdapter( onlineCars, lon, lat );
|
||||
mList.setAdapter( mOnlineCarPanelAdapter );
|
||||
} else {
|
||||
mOnlineCarPanelAdapter.setDatums( onlineCars );
|
||||
}
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( String.format( "为您找到%s个车友", onlineCars.size() ) );
|
||||
Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "number", onlineCars.size() );
|
||||
MogoApisHandler.getInstance().getApis().getAnalyticsApi().track( "Mogoer_List_number", properties );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderEmptyUi( OnlineCarStrategy strategy ) {
|
||||
mErrorPanel.setVisibility( View.GONE );
|
||||
mList.setVisibility( View.GONE );
|
||||
mRefreshPanel.setVisibility( View.VISIBLE );
|
||||
mLoading.setVisibility( View.GONE );
|
||||
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "未找到车友" );
|
||||
if ( strategy == null ) {
|
||||
m20KMStrategy.setVisibility( View.GONE );
|
||||
m40KMStrategy.setVisibility( View.GONE );
|
||||
mEmptyTip.setText( getString( R.string.module_services_online_car_panel_empty_tmpl, OnlineCarStrategy.Strategy3.getRadiusKM() ) );
|
||||
} else {
|
||||
switch ( strategy ) {
|
||||
case Strategy3:
|
||||
m20KMStrategy.setVisibility( View.GONE );
|
||||
m40KMStrategy.setVisibility( View.GONE );
|
||||
case Strategy2:
|
||||
m20KMStrategy.setVisibility( View.GONE );
|
||||
case Default:
|
||||
break;
|
||||
}
|
||||
mEmptyTip.setText( getString( R.string.module_services_online_car_panel_empty_tmpl, strategy.getRadiusKM() ) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderNoNavigationInfoUi() {
|
||||
mList.setVisibility( View.GONE );
|
||||
mRefreshPanel.setVisibility( View.GONE );
|
||||
mErrorPanel.setVisibility( View.VISIBLE );
|
||||
mLoading.setVisibility( View.GONE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderErrorUi() {
|
||||
mList.setVisibility( View.GONE );
|
||||
mRefreshPanel.setVisibility( View.GONE );
|
||||
mLoading.setVisibility( View.GONE );
|
||||
mErrorPanel.setVisibility( View.VISIBLE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeSelf() {
|
||||
MogoApisHandler.getInstance().getApis().getOnlineCarPanelApi().hidePanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
if ( mPresenter != null ) {
|
||||
mPresenter.destroy();
|
||||
}
|
||||
super.onDestroyView();
|
||||
}
|
||||
}
|
||||
@@ -1,122 +0,0 @@
|
||||
package com.mogo.module.service.onlinecar.panel;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.storage.SpStorage;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.map.IDestroyable;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.map.navi.IMogoNaviListener2;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.service.network.RefreshCallback;
|
||||
import com.mogo.module.service.network.RefreshModel;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/9/21
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
class OnlineCarPanelPresenter extends Presenter< IOnlineCarPanelView > implements
|
||||
RefreshCallback< MarkerResponse >,
|
||||
IMogoNaviListener2,
|
||||
IDestroyable {
|
||||
|
||||
private static final String TAG = "OnlineCarPanelPresenter";
|
||||
|
||||
public static final int LIMIT = 20;
|
||||
private RefreshModel mRefreshModel;
|
||||
private OnlineCarStrategy mStrategy;
|
||||
private NavigationTargetInfo mNavigationTargetInfo;
|
||||
private Double mToLat;
|
||||
private Double mToLon;
|
||||
|
||||
public OnlineCarPanelPresenter( IOnlineCarPanelView view ) {
|
||||
super( view );
|
||||
mRefreshModel = new RefreshModel( getContext() );
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().registerMogoNaviListener( TAG, this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
mView.removeSelf();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate( @NonNull LifecycleOwner owner ) {
|
||||
super.onCreate( owner );
|
||||
refreshPanel();
|
||||
}
|
||||
|
||||
public void next20KMStrategy() {
|
||||
mStrategy = OnlineCarStrategy.Strategy2;
|
||||
loadOnlineCar();
|
||||
}
|
||||
|
||||
public void next40KMStrategy() {
|
||||
mStrategy = OnlineCarStrategy.Strategy3;
|
||||
loadOnlineCar();
|
||||
}
|
||||
|
||||
public void refreshPanel() {
|
||||
mStrategy = OnlineCarStrategy.Default;
|
||||
String json = SpStorage.getNavigationTarget();
|
||||
if ( TextUtils.isEmpty( json ) ) {
|
||||
mView.renderNoNavigationInfoUi();
|
||||
return;
|
||||
}
|
||||
Logger.d( TAG, json );
|
||||
mNavigationTargetInfo = GsonUtil.objectFromJson( json, NavigationTargetInfo.class );
|
||||
loadOnlineCar();
|
||||
}
|
||||
|
||||
public void loadOnlineCar() {
|
||||
if ( mNavigationTargetInfo == null ) {
|
||||
mView.renderNoNavigationInfoUi();
|
||||
return;
|
||||
}
|
||||
mView.showLoading( true );
|
||||
try {
|
||||
mToLat = Double.valueOf( mNavigationTargetInfo.getToPoiLatitude() );
|
||||
mToLon = Double.valueOf( mNavigationTargetInfo.getToPoiLongitude() );
|
||||
mRefreshModel.queryOnLineCarWithRoute( new MogoLatLng( mToLat, mToLon ),
|
||||
false,
|
||||
false,
|
||||
mStrategy.getRadius(),
|
||||
LIMIT,
|
||||
true,
|
||||
this
|
||||
);
|
||||
} catch ( Exception e ) {
|
||||
mView.renderNoNavigationInfoUi();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess( MarkerResponse o ) {
|
||||
if ( o == null
|
||||
|| o.getResult() == null
|
||||
|| o.getResult().getOnlineCar() == null
|
||||
|| o.getResult().getOnlineCar().isEmpty() ) {
|
||||
mView.renderEmptyUi( mStrategy );
|
||||
} else {
|
||||
mView.renderOnlineCarList( o.getResult().getOnlineCar(), mToLon, mToLat );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail() {
|
||||
mView.renderErrorUi();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().unregisterMogoNaviListener( TAG );
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package com.mogo.module.service.onlinecar.panel;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/9/21
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
enum OnlineCarStrategy {
|
||||
|
||||
Strategy3( 40_000, null ),
|
||||
Strategy2( 20_000, Strategy3 ),
|
||||
Default( 10_000, Strategy2 ),
|
||||
;
|
||||
|
||||
private int radius;
|
||||
private OnlineCarStrategy next;
|
||||
|
||||
OnlineCarStrategy( int radius, OnlineCarStrategy next ) {
|
||||
this.radius = radius;
|
||||
this.next = next;
|
||||
}
|
||||
|
||||
public int getRadius() {
|
||||
return radius;
|
||||
}
|
||||
|
||||
public int getRadiusKM() {
|
||||
return radius / 1000;
|
||||
}
|
||||
|
||||
public OnlineCarStrategy getNext() {
|
||||
return next;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.mogo.module.service.routeoverlay;
|
||||
|
||||
import android.content.Context;
|
||||
import android.location.Location;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
|
||||
@@ -10,6 +8,7 @@ import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
|
||||
@@ -18,7 +17,7 @@ import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -27,7 +26,9 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MogoRouteOverlayManager implements IMoGoAutopilotPlanningListener, IMoGoAutopilotStatusListener, IMoGoMapLocationListener {
|
||||
public class MogoRouteOverlayManager implements
|
||||
IMoGoAutopilotPlanningListener, IMoGoAutopilotStatusListener,
|
||||
IMoGoMapLocationListener {
|
||||
private static volatile MogoRouteOverlayManager sInstance;
|
||||
private Context mContext;
|
||||
private String TAG = "MogoRouteOverlayManager";
|
||||
@@ -88,7 +89,7 @@ public class MogoRouteOverlayManager implements IMoGoAutopilotPlanningListener,
|
||||
builder.append(a.getLat()).append(",");
|
||||
mogoLatLngs.add(new MogoLatLng(a.getLat(), a.getLon()));
|
||||
}
|
||||
if (STATUS_AUTOPILOT == 1) {
|
||||
if (FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData || STATUS_AUTOPILOT == 1){
|
||||
RouteOverlayDrawer.getInstance(mContext).drawTrajectoryList(mogoLatLngs);
|
||||
}
|
||||
builder.append("}");
|
||||
@@ -114,9 +115,9 @@ public class MogoRouteOverlayManager implements IMoGoAutopilotPlanningListener,
|
||||
this.STATUS_AUTOPILOT = autoPilotStatusInfo.getControl_pilotmode();
|
||||
//Log.d("lianglihui","onAutopilotStatusResponse:"+STATUS_AUTOPILOT);
|
||||
if (STATUS_AUTOPILOT == 1 ){
|
||||
if (mEnding != null){
|
||||
RouteOverlayDrawer.getInstance(mContext).addEndingMarker(mEnding.lat,mEnding.lon);
|
||||
}
|
||||
// if (mEnding != null){
|
||||
// RouteOverlayDrawer.getInstance(mContext).addEndingMarker(mEnding.lat,mEnding.lon);
|
||||
// }
|
||||
}else {
|
||||
RouteOverlayDrawer.getInstance(mContext).clearEndingMarker();
|
||||
RouteOverlayDrawer.getInstance(mContext).clearMogoRouteOverlay();
|
||||
@@ -126,6 +127,12 @@ public class MogoRouteOverlayManager implements IMoGoAutopilotPlanningListener,
|
||||
@Override
|
||||
public void onAutopilotArriveAtStation(@Nullable AutopilotStationInfo autopilotWayArrive) {
|
||||
|
||||
if(autopilotWayArrive == null){
|
||||
return;
|
||||
}
|
||||
Logger.d(TAG, "onArriveAt data : " + autopilotWayArrive.toString());
|
||||
//演示模式下 到达终点将忽略 引导线绘制 选项关闭
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -142,4 +149,5 @@ public class MogoRouteOverlayManager implements IMoGoAutopilotPlanningListener,
|
||||
public void onLocationChanged(@Nullable MogoLocation location) {
|
||||
mLocation = location;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
package com.mogo.module.service.strategy;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.service.MogoServices;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.service.strategy.IMogoRefreshStrategyController;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-13
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
@Route( path = MogoServicePaths.PATH_REFRESH_STRATEGY_API )
|
||||
public class MogoRefreshStrategyController implements IMogoRefreshStrategyController {
|
||||
|
||||
private static final String TAG = "MogoRefreshStrategyController";
|
||||
|
||||
@Override
|
||||
public boolean restartAutoRefreshAtTime( int delay ) {
|
||||
try {
|
||||
MogoServices.getInstance().restartAutoRefreshAtTime( delay );
|
||||
return true;
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "restartAutoRefreshAtTime" );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearAllData() {
|
||||
MogoServices.getInstance().clearAllData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetLocationUpDelay(long delay) {
|
||||
// MogoRTKLocation.getInstance().resetUploadDelay(delay);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package com.mogo.module.service.unwake;
|
||||
|
||||
/**
|
||||
* 全局免唤醒常量类
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class GlobalUnwakeConst {
|
||||
public static final String MODULE_NAME = "GlobalUnwakeManager";
|
||||
|
||||
// command
|
||||
public static final String VOICE_CMD_GO_TO_SHARE = "com.zhidao.share";
|
||||
/**
|
||||
* 这个是实时路况,不是拥堵,拥堵放在了extention模块里面处理
|
||||
*/
|
||||
public static final String VOICE_CMD_PUB_ROAD_CONDITION = "com.zhidao.pathfinder.report.roadCondition";
|
||||
/**
|
||||
* 故障求助
|
||||
*/
|
||||
public static final String VOICE_CMD_PUB_TROUBLE_HELP = "com.zhidao.auxiliaryDriving" +
|
||||
".pubTroubleHelp";
|
||||
/**
|
||||
* 关闭分享框 唤醒
|
||||
*/
|
||||
public static final String VOICE_CMD_SHARE_DIALOG_CLOSE = "com.zhidao.share.close";
|
||||
/**
|
||||
* 两次未回复关闭分享对话框
|
||||
*/
|
||||
public static final String VOICE_CMD_NO_REPLY_SHARE_DIALOG_CLOSE = "com.zhidao.share.dialog" +
|
||||
".close";
|
||||
/**
|
||||
* 免唤醒词上报拥堵,但是现在当唤醒词使用
|
||||
*/
|
||||
public static final String UNWAKE_UPLOAD_ROAD_CONDITION = "command_upload_roadcondition";
|
||||
/**
|
||||
* 免唤醒词上报实时路况
|
||||
*/
|
||||
public static final String UNWAKE_UPLOAD_REAL_TIME_TRAFFIC = "command_upload_real_time_traffic";
|
||||
|
||||
/**
|
||||
* 唤醒词查询出行动态
|
||||
*/
|
||||
public static final String VOICE_QUERY_HISTORY_INDEX = "com.zhidao.query.trip.event";
|
||||
/**
|
||||
* 唤醒词查询周边事件
|
||||
*/
|
||||
public static final String VOICE_QUERY_SURROUNDING_INDEX = "com.zhidao.query.nearby.event";
|
||||
/**
|
||||
* 唤醒词查询热心指数
|
||||
*/
|
||||
public static final String VOICE_QUERY_HEART_INDEX = "com.zhidao.query.myshare.index";
|
||||
|
||||
// 词
|
||||
public static final String[] UPLOAD_REAL_TIME_TRAFFIC = {"上报实时路况", "上报路况"};
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
package com.mogo.module.service.unwake;
|
||||
|
||||
import static com.mogo.module.service.unwake.GlobalUnwakeConst.UNWAKE_UPLOAD_REAL_TIME_TRAFFIC;
|
||||
import static com.mogo.module.service.unwake.GlobalUnwakeConst.UNWAKE_UPLOAD_ROAD_CONDITION;
|
||||
import static com.mogo.module.service.unwake.GlobalUnwakeConst.UPLOAD_REAL_TIME_TRAFFIC;
|
||||
import static com.mogo.module.service.unwake.GlobalUnwakeConst.VOICE_CMD_GO_TO_SHARE;
|
||||
import static com.mogo.module.service.unwake.GlobalUnwakeConst.VOICE_CMD_NO_REPLY_SHARE_DIALOG_CLOSE;
|
||||
import static com.mogo.module.service.unwake.GlobalUnwakeConst.VOICE_CMD_PUB_ROAD_CONDITION;
|
||||
import static com.mogo.module.service.unwake.GlobalUnwakeConst.VOICE_CMD_PUB_TROUBLE_HELP;
|
||||
import static com.mogo.module.service.unwake.GlobalUnwakeConst.VOICE_CMD_SHARE_DIALOG_CLOSE;
|
||||
import static com.mogo.module.service.unwake.GlobalUnwakeConst.VOICE_QUERY_HEART_INDEX;
|
||||
import static com.mogo.module.service.unwake.GlobalUnwakeConst.VOICE_QUERY_HISTORY_INDEX;
|
||||
import static com.mogo.module.service.unwake.GlobalUnwakeConst.VOICE_QUERY_SURROUNDING_INDEX;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
|
||||
/**
|
||||
* 全局免唤醒管理
|
||||
* 包括唤醒词指令和全局免唤醒词指令
|
||||
* 有几个Module仅仅是因为要注册全局免唤醒词,加到了BaseModule中,为了将这部分Module从BaseModule中去掉,特抽离全局免唤醒词注册监听逻辑
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
@Route(path = MogoServicePaths.PATH_GLOBAL_UNWAKE)
|
||||
public class GlobalUnwakeManager implements IProvider, IMogoIntentListener, IMogoVoiceCmdCallBack {
|
||||
private IMogoIntentManager intentManager;
|
||||
private Context context;
|
||||
private static final String TAG = "GlobalUnwakeManager";
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
Logger.d(TAG, "全局免唤醒模块初始化====");
|
||||
this.context = context;
|
||||
intentManager = MogoApisHandler.getInstance().getApis().getIntentManagerApi();
|
||||
intentManager.registerIntentListener(VOICE_CMD_GO_TO_SHARE, this);
|
||||
intentManager.registerIntentListener(VOICE_CMD_PUB_TROUBLE_HELP, this);
|
||||
intentManager.registerIntentListener(VOICE_CMD_PUB_ROAD_CONDITION, this);
|
||||
intentManager.registerIntentListener(VOICE_CMD_SHARE_DIALOG_CLOSE, this);
|
||||
intentManager.registerIntentListener(VOICE_CMD_NO_REPLY_SHARE_DIALOG_CLOSE, this);
|
||||
intentManager.registerIntentListener(UNWAKE_UPLOAD_ROAD_CONDITION, this);
|
||||
intentManager.registerIntentListener(VOICE_QUERY_HEART_INDEX, this);
|
||||
intentManager.registerIntentListener(VOICE_QUERY_HISTORY_INDEX, this);
|
||||
intentManager.registerIntentListener(VOICE_QUERY_SURROUNDING_INDEX, this);
|
||||
|
||||
// 免唤醒词注册,全局免唤醒
|
||||
AIAssist.getInstance(context).registerUnWakeupCommand(UNWAKE_UPLOAD_REAL_TIME_TRAFFIC,
|
||||
UPLOAD_REAL_TIME_TRAFFIC, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onIntentReceived(String intentStr, Intent intent) {
|
||||
// 此处只接受处理语音相关广播
|
||||
Logger.d(TAG, "收到唤醒词指令: " + intentStr);
|
||||
switch (intentStr) {
|
||||
// 分享相关唤醒词
|
||||
case VOICE_CMD_GO_TO_SHARE:
|
||||
case VOICE_CMD_PUB_TROUBLE_HELP:
|
||||
case VOICE_CMD_PUB_ROAD_CONDITION:
|
||||
case VOICE_CMD_SHARE_DIALOG_CLOSE:
|
||||
case VOICE_CMD_NO_REPLY_SHARE_DIALOG_CLOSE:
|
||||
case UNWAKE_UPLOAD_ROAD_CONDITION:
|
||||
//TODO
|
||||
// MogoApisHandler.getInstance().getApis().getShareManager().onGlobalUnwake(intentStr, intent);
|
||||
break;
|
||||
case VOICE_QUERY_HISTORY_INDEX:
|
||||
Log.d("语音指令","VOICE_QUERY_HISTORY_INDEX");
|
||||
showPanelByStatus("showHistoryPanel", 0);
|
||||
break;
|
||||
case VOICE_QUERY_SURROUNDING_INDEX:
|
||||
Log.d("语音指令","VOICE_QUERY_SURROUNDING_INDEX");
|
||||
showPanelByStatus("showSurroundingPanel", 1);
|
||||
break;
|
||||
case VOICE_QUERY_HEART_INDEX:
|
||||
Log.d("语音指令","VOICE_QUERY_HEART_INDEX");
|
||||
showPanelByStatus("showSharePanel", 2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据主页状态调用不同打开方式
|
||||
* @param target 面板类型
|
||||
* @param type 面板位置索引
|
||||
*/
|
||||
private void showPanelByStatus(String target, int type){
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isMainPageOnResume() ) {
|
||||
MogoApisHandler.getInstance().getApis().getEventPanelManager().showPanelWithSelectedItem(type);
|
||||
} else {
|
||||
Intent start = new Intent( Intent.ACTION_VIEW );
|
||||
start.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
|
||||
start.setData( Uri.parse( "mogo://launcher/main/switch2?type="+target ) );
|
||||
context.startActivity( start );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCmdSelected(String cmd) {
|
||||
Logger.d(TAG, "收到免唤醒词指令: " + cmd);
|
||||
if (UNWAKE_UPLOAD_REAL_TIME_TRAFFIC.equals(cmd)) {
|
||||
//TODO
|
||||
// MogoApisHandler.getInstance().getApis().getShareManager().onGlobalUnwake(cmd, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/map_amap_id_cursor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/map_api_ic_current_location2_cursor" />
|
||||
</LinearLayout>
|
||||
@@ -1,133 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/module_services_online_car_panel_marginRight"
|
||||
android:layout_marginTop="@dimen/module_services_online_car_panel_marginTop"
|
||||
android:layout_marginRight="@dimen/module_services_online_car_panel_marginRight"
|
||||
android:layout_marginBottom="@dimen/module_services_online_car_panel_marginBottom"
|
||||
android:background="@drawable/module_services_online_car_panel_background"
|
||||
android:paddingLeft="@dimen/module_services_online_car_panel_paddingLeft"
|
||||
android:paddingRight="@dimen/module_services_online_car_panel_paddingLeft">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_services_id_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/module_services_online_car_panel_title_margin_top"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/module_services_online_car_panel_title"
|
||||
android:textColor="@color/module_services_online_car_panel_title_textColor"
|
||||
android:textSize="@dimen/module_services_online_car_panel_title_text_size" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/module_services_id_close"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginTop="@dimen/module_services_online_car_panel_close_margin_top"
|
||||
android:src="@drawable/module_common_close_selector" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/module_services_id_loading"
|
||||
android:layout_width="45dp"
|
||||
android:layout_height="43dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_gravity="center"
|
||||
android:indeterminateTint="#256BFF"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.5" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/module_services_id_recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/module_services_online_car_panel_recycler_view_margin_top"
|
||||
android:overScrollMode="never" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/module_services_id_load_strategy_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
tools:visibility="visible"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/module_services_online_car_panel_empty_icon" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_services_empty_tip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/module_services_empty_tip_marginTop"
|
||||
android:textColor="@color/module_services_empty_tip_textColor"
|
||||
android:textSize="@dimen/module_services_empty_tip_textSize"
|
||||
android:textStyle="bold"
|
||||
tools:text="很抱歉,目的地10公里内未找到车友" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/module_services_panel_strategy_button_marginTop"
|
||||
android:gravity="center">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_services_id_20Km_radius"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/module_services_load_strategy_marginRight"
|
||||
android:background="@drawable/module_services_panel_strategy_button_bkg"
|
||||
android:paddingLeft="@dimen/module_services_load_strategy_paddingLeft"
|
||||
android:paddingTop="@dimen/module_services_load_strategy_paddingTop"
|
||||
android:paddingRight="@dimen/module_services_load_strategy_paddingLeft"
|
||||
android:paddingBottom="@dimen/module_services_load_strategy_paddingTop"
|
||||
android:text="@string/module_services_str_20Km_radius"
|
||||
android:textColor="@color/module_services_load_strategy_textColor"
|
||||
android:textSize="@dimen/module_services_load_strategy_textSize"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_services_id_40Km_radius"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/module_services_panel_strategy_button_bkg"
|
||||
android:paddingLeft="@dimen/module_services_load_strategy_paddingLeft"
|
||||
android:paddingTop="@dimen/module_services_load_strategy_paddingTop"
|
||||
android:paddingRight="@dimen/module_services_load_strategy_paddingLeft"
|
||||
android:paddingBottom="@dimen/module_services_load_strategy_paddingTop"
|
||||
android:text="@string/module_services_str_40Km_radius"
|
||||
android:textColor="@color/module_services_load_strategy_textColor"
|
||||
android:textSize="@dimen/module_services_load_strategy_textSize"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/module_services_id_error_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/module_services_online_car_panel_recycler_view_margin_top"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/module_services_error_text"
|
||||
android:textColor="@color/module_services_error_textColor"
|
||||
android:textSize="@dimen/module_services_empty_tip_textSize" />
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
@@ -1,89 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/module_services_panel_item_marginBottom"
|
||||
android:background="@drawable/module_services_panel_item_bkg"
|
||||
android:paddingTop="@dimen/module_services_panel_item_padding"
|
||||
android:paddingStart="@dimen/module_services_panel_item_start"
|
||||
android:paddingBottom="@dimen/module_services_panel_item_padding">
|
||||
|
||||
<com.mogo.eagle.core.widget.CustomCircleImageView
|
||||
android:id="@+id/module_services_id_panel_item_avatar"
|
||||
android:layout_width="@dimen/module_services_panel_item_avatar_size"
|
||||
android:layout_height="@dimen/module_services_panel_item_avatar_size"
|
||||
android:src="@drawable/module_common_default_user_head"
|
||||
app:civ_border_color="@color/module_services_id_panel_item_avatar_border_color"
|
||||
app:civ_border_width="@dimen/module_services_id_panel_item_avatar_border_width"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_services_id_panel_item_nickname"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/module_services_panel_item_nickname_marginLeft"
|
||||
android:layout_marginTop="@dimen/module_services_panel_item_nickname_marginTop"
|
||||
android:textColor="@color/module_services_panel_item_nickname_textColor"
|
||||
android:textSize="@dimen/module_services_panel_item_nickname_textSize"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toRightOf="@+id/module_services_id_panel_item_avatar"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="1111111" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_services_id_panel_item_distance_tag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/module_services_panel_item_distance_textColor"
|
||||
android:textSize="@dimen/module_services_panel_item_distance_textSize"
|
||||
android:layout_marginBottom="@dimen/module_services_panel_item_distance_tag_marginBottom"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/module_services_id_panel_item_nickname"
|
||||
android:text="@string/module_services_panel_item_distance_tag_text" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_services_id_panel_item_distance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/module_services_id_panel_item_distance_marginLeft"
|
||||
android:textColor="@color/module_services_panel_item_nickname_textColor"
|
||||
android:textSize="@dimen/module_services_panel_item_distance_textSize"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/module_services_id_panel_item_distance_tag"
|
||||
app:layout_constraintLeft_toRightOf="@+id/module_services_id_panel_item_distance_tag"
|
||||
tools:text="980M" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_services_id_panel_item_call"
|
||||
android:layout_width="@dimen/modle_car_panel_call"
|
||||
android:layout_height="@dimen/modle_car_panel_call"
|
||||
android:layout_marginEnd="@dimen/modle_car_panel_call_margin"
|
||||
android:background="@drawable/module_common_selector_call"
|
||||
android:padding="@dimen/module_services_panel_item_detail_padding"
|
||||
android:textColor="@color/module_services_panel_item_detail_textColor"
|
||||
android:textSize="@dimen/module_services_panel_item_detail_textSize"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/module_services_id_panel_item_detail"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_services_id_panel_item_detail"
|
||||
android:layout_width="@dimen/modle_car_panel_call"
|
||||
android:background="@drawable/selector_service_car_panel_details"
|
||||
android:layout_height="@dimen/modle_car_panel_call"
|
||||
android:padding="@dimen/module_services_panel_item_detail_padding"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/module_services_panel_item_detail_textColor"
|
||||
android:textSize="@dimen/module_services_panel_item_detail_textSize"
|
||||
android:layout_marginRight="@dimen/module_services_panel_item_start"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="90px"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_services_status_tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="90px"
|
||||
android:textColor="#000"
|
||||
android:textSize="40px" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/module_services_status_iv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right|center_vertical"
|
||||
android:src="@drawable/module_common_icon_close_vr" />
|
||||
</FrameLayout>
|
||||
Reference in New Issue
Block a user