Cherry pick

Signed-off-by: 董宏宇 <martindhy@gmail.com>
This commit is contained in:
donghongyu
2021-09-06 18:22:58 +08:00
committed by 董宏宇
parent d3845f2b4f
commit 5716dc1f4b
13 changed files with 284 additions and 62 deletions

View File

@@ -13,6 +13,7 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckedTextView;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageButton;
@@ -67,6 +68,8 @@ import com.mogo.module.extensions.utils.TopViewAnimHelper;
import com.mogo.module.extensions.utils.TopViewNoLinkageAnimHelper;
import com.mogo.module.share.manager.ServiceApisManager;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.adas.IMogoAdasOCHCallback;
import com.mogo.service.adas.entity.AdasOCHData;
import com.mogo.service.analytics.IMogoAnalytics;
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
import com.mogo.service.entrance.ButtonIndex;
@@ -205,6 +208,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
private TextView tvRed;
private TextView tvGreen;
private CheckedTextView ctvAutopilotStatus;
/**
* 内部变量标识是否在vrMode用于方法执行过滤避免重复或异常调用
@@ -271,6 +275,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mMove2CurrentLocation = findViewById(R.id.module_entrance_id_move2_current_location);
mUserHeadImg = findViewById(R.id.ivUserHeadImg);
groupFix = findViewById(R.id.groupFix);
ctvAutopilotStatus = findViewById(R.id.module_mogo_autopilot_status);
ConstraintLayout rootView = findViewById(R.id.module_entrance_id_top_motion_layout);
if (rootView != null) {
@@ -341,6 +346,17 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
});
}
onAutopilotStatusChanged(
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() == IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING);
ctvAutopilotStatus.setOnClickListener(new OnPreventFastClickListener() {
@Override
public void onClickImpl(View v) {
// 如果能自动驾驶,就自动驾驶,不能就提示
autopilotStatusClick();
}
});
dealWeatherContainer();
listenSeekNumber();
@@ -376,6 +392,21 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
}
}
/**
* 自动驾驶状态改变
*
* @param isInAutopilot true - 在自动驾驶中 false - 不在自动驾驶中
*/
public void onAutopilotStatusChanged(boolean isInAutopilot) {
getActivity().runOnUiThread(() -> {
ctvAutopilotStatus.setChecked(isInAutopilot);
});
}
private void autopilotStatusClick() {
EntranceViewHolder.getInstance().entranceAutopilotStatusClick();
}
private int debugPanelClickCount = 0;
private long lastDebugPanelClickTime = 0;
@@ -1368,4 +1399,18 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
public void onCarLocationChanged(MogoLatLng latLng) {
}
@Override
public void onArriveAt(AdasOCHData data) {
}
@Override
public void onStateChanged(int state, String reason) {
if(state == IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING){
ctvAutopilotStatus.setChecked(true);
}else{
ctvAutopilotStatus.setChecked(false);
}
}
}

View File

@@ -8,6 +8,7 @@ import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.module.extensions.utils.EntranceViewHolder;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.entrance.ButtonIndex;
import com.mogo.service.entrance.IMogoEntranceAutopilotStatusClickListener;
import com.mogo.service.entrance.IMogoEntranceButtonController;
import com.mogo.service.windowview.IMogoEntranceViewListener;
@@ -70,6 +71,16 @@ public class MogoEntranceButtonControllerImpl implements IMogoEntranceButtonCont
EntranceViewHolder.getInstance().removeEntranceViewListener(listener);
}
@Override
public void addEntranceAutopilotStatusClickListener(IMogoEntranceAutopilotStatusClickListener listener) {
EntranceViewHolder.getInstance().addEntranceAutopilotStatusClickListener(listener);
}
@Override
public void removeEntranceAutopilotStatusClickListener(IMogoEntranceAutopilotStatusClickListener listener) {
EntranceViewHolder.getInstance().removeEntranceAutopilotStatusClickListener(listener);
}
@Override
public void init( Context context ) {

View File

@@ -15,7 +15,7 @@ import java.util.Map;
*/
public class MogoEntranceButtons {
private static Map< ButtonIndex, TextView > sButtons = new HashMap<>();
private static final Map< ButtonIndex, TextView > sButtons = new HashMap<>();
public static void save( ButtonIndex index, TextView btn ) {
sButtons.put( index, btn );

View File

@@ -1,5 +1,7 @@
package com.mogo.module.extensions.utils;
import static com.mogo.service.entrance.IMogoEntranceButtonController.NOTICE_TYPE_SEEK_HELP;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -10,6 +12,7 @@ import android.widget.TextView;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.extensions.R;
import com.mogo.module.extensions.bean.BottomLayerViewWrapper;
import com.mogo.service.entrance.IMogoEntranceAutopilotStatusClickListener;
import com.mogo.service.windowview.IMogoEntranceViewListener;
import com.mogo.utils.logger.Logger;
@@ -17,20 +20,20 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import static com.mogo.service.entrance.IMogoEntranceButtonController.NOTICE_TYPE_SEEK_HELP;
/**
* 入口页view管理
*
* @author tongchenfei
*/
public class EntranceViewHolder {
private static final String TAG = "EntranceViewHolder";
private List<BottomLayerViewWrapper> preAddView = new ArrayList<>();
private List<View> leftFeaturePreAddView = new ArrayList<>();
private View preAddLeftNoticeView = null;
private EntranceViewHolder(){}
private EntranceViewHolder() {
}
private volatile static EntranceViewHolder instance = null;
public static EntranceViewHolder getInstance(){
public static EntranceViewHolder getInstance() {
if (instance == null) {
synchronized (EntranceViewHolder.class) {
if (instance == null) {
@@ -40,13 +43,18 @@ public class EntranceViewHolder {
}
return instance;
}
private final List<BottomLayerViewWrapper> preAddView = new ArrayList<>();
private final List<View> leftFeaturePreAddView = new ArrayList<>();
private View preAddLeftNoticeView = null;
private ViewGroup rootViewGroup = null;
private ViewGroup featureViewGroup = null;
private ViewGroup leftNoticeContainer = null;
public void initRootViewGroup(View rootView) {
Logger.i(TAG, "initRootViewGroup==");
if(rootView instanceof ViewGroup) {
if (rootView instanceof ViewGroup) {
Logger.d(TAG, "initRootViewGroup 赋值");
rootViewGroup = (ViewGroup) rootView.getParent();
leftNoticeContainer =
@@ -82,12 +90,12 @@ public class EntranceViewHolder {
Logger.d(TAG, "addBottomLayerView, rootViewGroup is null: " + (rootViewGroup == null) +
"\n x: " + x + ", y: " + y);
BottomLayerViewWrapper wrapper = new BottomLayerViewWrapper(view, x, y);
if(rootViewGroup == null) {
if(!preAddView.contains(wrapper)) {
if (rootViewGroup == null) {
if (!preAddView.contains(wrapper)) {
preAddView.add(wrapper);
}
}else{
if(!containView(view)) {
} else {
if (!containView(view)) {
realAddView(wrapper);
}
}
@@ -96,7 +104,7 @@ public class EntranceViewHolder {
private boolean containView(View view) {
int count = rootViewGroup.getChildCount();
for (int i = 0; i < count; i++) {
if(rootViewGroup.getChildAt(i).equals(view)){
if (rootViewGroup.getChildAt(i).equals(view)) {
return true;
}
}
@@ -106,7 +114,7 @@ public class EntranceViewHolder {
private boolean containFeatureView(View view) {
int count = featureViewGroup.getChildCount();
for (int i = 0; i < count; i++) {
if(featureViewGroup.getChildAt(i).equals(view)){
if (featureViewGroup.getChildAt(i).equals(view)) {
return true;
}
}
@@ -116,7 +124,7 @@ public class EntranceViewHolder {
/**
* 使用的时候需要预先判断rootViewGroup是否为空本方法默认rootViewGroup不为空
*/
private void realAddView(BottomLayerViewWrapper wrapper){
private void realAddView(BottomLayerViewWrapper wrapper) {
FrameLayout.LayoutParams params =
new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT);
@@ -145,10 +153,10 @@ public class EntranceViewHolder {
Logger.d(TAG, "addLeftFeatureView==" + view);
if (featureViewGroup == null) {
// 先缓存起来,等待时机加载
if(!leftFeaturePreAddView.contains(view)) {
if (!leftFeaturePreAddView.contains(view)) {
leftFeaturePreAddView.add(view);
}
}else{
} else {
// 直接加载
if (!containFeatureView(view)) {
featureViewGroup.addView(view);
@@ -171,7 +179,7 @@ public class EntranceViewHolder {
public void showLeftNoticeView(View view) {
if(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
if (leftNoticeContainer != null) {
realShowLeftNoticeView(view);
} else {
@@ -181,7 +189,7 @@ public class EntranceViewHolder {
}
public void hideLeftNoticeView(View view) {
if(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
if (preAddLeftNoticeView != null && preAddLeftNoticeView == view) {
preAddLeftNoticeView = null;
}
@@ -191,7 +199,7 @@ public class EntranceViewHolder {
}
}
public void forceHideNoticeView(){
public void forceHideNoticeView() {
for (IMogoEntranceViewListener listener : listeners) {
listener.onViewRemoved(currentShowNoticeType);
}
@@ -203,8 +211,9 @@ public class EntranceViewHolder {
}
private int currentShowNoticeType = 0;
public void showLeftNoticeByType(int noticeType, int iconRes, String content){
if(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
public void showLeftNoticeByType(int noticeType, int iconRes, String content) {
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
if (currentShowNoticeType != noticeType && currentShowNoticeType != 0) {
for (IMogoEntranceViewListener listener : listeners) {
listener.onViewRemoved(currentShowNoticeType);
@@ -221,21 +230,21 @@ public class EntranceViewHolder {
}
public void hideLeftNoticeByType(int noticeType) {
if(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
if (currentShowNoticeType == noticeType) {
forceHideNoticeView();
}
}
}
private View generateNoticeViewByType(int noticeType,int iconRes, String content) {
private View generateNoticeViewByType(int noticeType, int iconRes, String content) {
View view =
LayoutInflater.from(leftNoticeContainer.getContext()).inflate(R.layout.item_vr_left_notice, leftNoticeContainer, false);
ImageView icon = view.findViewById(R.id.module_ext_iv_left_notice_icon);
if (noticeType == NOTICE_TYPE_SEEK_HELP) {
// 自车求助,是橘色的背景
icon.setBackgroundResource(R.drawable.module_ext_left_notice_icon_orange_bg);
}else{
} else {
// 其他是红色背景
icon.setBackgroundResource(R.drawable.module_ext_left_notice_icon_red_bg);
}
@@ -245,7 +254,7 @@ public class EntranceViewHolder {
return view;
}
private void realShowLeftNoticeView(View view){
private void realShowLeftNoticeView(View view) {
leftNoticeContainer.setVisibility(View.VISIBLE);
leftNoticeContainer.removeAllViews();
leftNoticeContainer.addView(view);
@@ -260,7 +269,8 @@ public class EntranceViewHolder {
leftNoticeContainer.setVisibility(View.GONE);
}
private List<IMogoEntranceViewListener> listeners = new ArrayList<>();
private final List<IMogoEntranceViewListener> listeners = new ArrayList<>();
private final List<IMogoEntranceAutopilotStatusClickListener> btnClickListeners = new ArrayList<>();
public void addEntranceViewListener(IMogoEntranceViewListener listener) {
listeners.add(listener);
@@ -270,7 +280,21 @@ public class EntranceViewHolder {
listeners.remove(listener);
}
public void release(){
public void addEntranceAutopilotStatusClickListener(IMogoEntranceAutopilotStatusClickListener listener) {
btnClickListeners.add(listener);
}
public void removeEntranceAutopilotStatusClickListener(IMogoEntranceAutopilotStatusClickListener listener) {
btnClickListeners.remove(listener);
}
public void entranceAutopilotStatusClick() {
for (IMogoEntranceAutopilotStatusClickListener listener : btnClickListeners) {
listener.click();
}
}
public void release() {
rootViewGroup = null;
featureViewGroup = null;
leftNoticeContainer = null;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true">
<shape android:shape="rectangle">
<corners android:bottomLeftRadius="20px" android:bottomRightRadius="45px" android:topLeftRadius="45px" android:topRightRadius="20px" />
<gradient android:angle="315" android:endColor="#2B6EFF" android:startColor="#2B6EFF" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<corners android:bottomLeftRadius="20px" android:bottomRightRadius="45px" android:topLeftRadius="45px" android:topRightRadius="20px" />
<gradient android:angle="315" android:endColor="#3B4577" android:startColor="#3B4577" />
</shape>
</item>
</selector>

View File

@@ -6,6 +6,26 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<CheckedTextView
android:id="@+id/module_mogo_autopilot_status"
android:layout_width="@dimen/module_mogo_autopilot_status_bg_width"
android:layout_height="@dimen/module_mogo_autopilot_status_bg_height"
android:layout_marginLeft="@dimen/module_mogo_autopilot_status_margin_left"
android:layout_marginTop="@dimen/module_mogo_autopilot_status_margin_top"
android:background="@drawable/module_mogo_autopilot_status_bg"
android:drawableLeft="@drawable/module_ext_ic_autopilot"
android:drawablePadding="@dimen/dp_30"
android:elevation="@dimen/dp_10"
android:gravity="center_vertical"
android:paddingLeft="@dimen/module_mogo_autopilot_status_padding"
android:text="自动驾驶"
android:textColor="#FFFFFF"
android:textSize="@dimen/module_mogo_autopilot_status_text_size"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
<include
layout="@layout/module_ext_layout_extensions"
android:layout_width="match_parent"

View File

@@ -8,4 +8,11 @@
<dimen name="module_switch_text_size">36px</dimen>
<dimen name="module_switch_image">50px</dimen>
<dimen name="module_switch_image_circle">60px</dimen>
<dimen name="module_mogo_autopilot_status_bg_width">460px</dimen>
<dimen name="module_mogo_autopilot_status_bg_height">140px</dimen>
<dimen name="module_mogo_autopilot_status_margin_left">40px</dimen>
<dimen name="module_mogo_autopilot_status_margin_top">530px</dimen>
<dimen name="module_mogo_autopilot_status_padding">92px</dimen>
<dimen name="module_mogo_autopilot_status_text_size">44px</dimen>
</resources>

View File

@@ -251,4 +251,11 @@
<dimen name="module_switch_image">35px</dimen>
<dimen name="module_switch_image_circle">38px</dimen>
<dimen name="module_mogo_autopilot_status_bg_width">460px</dimen>
<dimen name="module_mogo_autopilot_status_bg_height">140px</dimen>
<dimen name="module_mogo_autopilot_status_margin_left">40px</dimen>
<dimen name="module_mogo_autopilot_status_margin_top">530px</dimen>
<dimen name="module_mogo_autopilot_status_padding">92px</dimen>
<dimen name="module_mogo_autopilot_status_text_size">44px</dimen>
</resources>

View File

@@ -9,6 +9,7 @@ import android.location.Location;
import android.os.Handler;
import android.os.Message;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.map.MogoLatLng;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
@@ -16,16 +17,21 @@ import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.service.dispatch.bean.DispatchAdasAutoPilotLocReceiverBean;
import com.mogo.module.service.dispatch.model.DispatchServiceModel;
import com.mogo.module.service.dispatch.model.IDispatch;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.adas.IMogoAdasOCHCallback;
import com.mogo.service.adas.RemoteControlAutoPilotParameters;
import com.mogo.service.adas.entity.AdasOCHData;
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
import com.mogo.service.connection.IMogoOnMessageListener;
import com.mogo.service.entrance.IMogoEntranceAutopilotStatusClickListener;
import com.mogo.utils.logger.Logger;
import java.util.ArrayList;
import java.util.List;
//负责监听自动驾驶状态并进行状态上报,自动驾驶路线上报,接收调度指令展示指令弹窗
public class DispatchAutoPilotManager implements IMogoOnMessageListener<DispatchAdasAutoPilotLocReceiverBean>
, IDispatchRemindClickListener
, IMogoCarLocationChangedListener2, IMogoAdasOCHCallback {
, IMogoCarLocationChangedListener2, IMogoAdasOCHCallback, IMogoEntranceAutopilotStatusClickListener {
private static final String TAG = "DispatchAutoPilotManager";
private static volatile DispatchAutoPilotManager instance;
@@ -40,6 +46,10 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
private DispatchAdasAutoPilotLocReceiverBean receiverBean;
private int autoPilotStatus = 0;
private String reason = null;
private boolean isDispatch = false;
private boolean isArriveEnd = false;
private IMogoServiceApis mApis;
private DispatchAutoPilotManager() {
@@ -65,6 +75,8 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
Logger.d(TAG, "此时已经有调度,又收到调度信息");
return;
}
isDispatch = true;
isArriveEnd = false;
DispatchAdasAutoPilotLocReceiverBean msgData = (DispatchAdasAutoPilotLocReceiverBean) msg.obj;
dispatchDialogManager.showDialog(msgData);
} else if (msg.what == MSG_TYPE_UPLOAD_AUTOPILOT_STATUS) {
@@ -76,12 +88,14 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
public void initSocket(Context context) {
mContext = context;
MogoApisHandler.getInstance().getApis()
.getSocketManagerApi(context).registerOnMessageListener(MSG_SOCKET_TYPE, this);
MogoApisHandler.getInstance().getApis().getRegisterCenterApi()
mApis = MogoApisHandler.getInstance().getApis();
mApis.getSocketManagerApi(context).registerOnMessageListener(MSG_SOCKET_TYPE, this);
mApis.getRegisterCenterApi()
.registerCarLocationChangedListener(TAG, this);
MogoApisHandler.getInstance().getApis().getAdasControllerApi()
mApis.getAdasControllerApi()
.addAdasOCHCallback(this);
mApis.getEntranceButtonController().addEntranceAutopilotStatusClickListener(this);
dispatchDialogManager = DispatchDialogManager.getInstance(context);
dispatchDialogManager.addIDispatchRemindListener(this);
handler.sendEmptyMessageDelayed(MSG_TYPE_UPLOAD_AUTOPILOT_STATUS, 1000L);
@@ -111,13 +125,7 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
DispatchServiceModel.getInstance().dispatchResultUpload(DISPATCH_RESULT_AFFIRM, new IDispatch() {
@Override
public void onSuccess() {
RemoteControlAutoPilotParameters currentAutopilot = new RemoteControlAutoPilotParameters();
currentAutopilot.isSpeakVoice = false;
currentAutopilot.startLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat(receiverBean.getStartLat(), receiverBean.getStartLon());
currentAutopilot.endLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat(receiverBean.getEndLat(), receiverBean.getEndLon());
currentAutopilot.vehicleType = 10;
Logger.d(TAG, "开启自动驾驶====" + currentAutopilot);
MogoApisHandler.getInstance().getApis().getAdasControllerApi().aiCloudToAdasData(currentAutopilot);
startAutoPilot();
}
@Override
@@ -127,6 +135,21 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
});
}
private void startAutoPilot() {
RemoteControlAutoPilotParameters currentAutopilot = new RemoteControlAutoPilotParameters();
currentAutopilot.isSpeakVoice = false;
List<RemoteControlAutoPilotParameters.AutoPilotLonLat> wayLatLon = new ArrayList<>();
for (MogoLatLng mogoLatLng : receiverBean.getStopsList()) {
wayLatLon.add(new RemoteControlAutoPilotParameters.AutoPilotLonLat(mogoLatLng.lat, mogoLatLng.lon));
}
currentAutopilot.wayLatLons = wayLatLon;
currentAutopilot.startLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat(receiverBean.getStartLat(), receiverBean.getStartLon());
currentAutopilot.endLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat(receiverBean.getEndLat(), receiverBean.getEndLon());
currentAutopilot.vehicleType = 10;
Logger.d(TAG, "开启自动驾驶====" + currentAutopilot);
mApis.getAdasControllerApi().aiCloudToAdasData(currentAutopilot);
}
@Override
public void cancel(boolean manualTrigger) {
dispatchDialogManager.releaseDialog();
@@ -164,6 +187,40 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
}
@Override
public void onArriveAt(AdasOCHData data) {
double endLat = data.lat;
double endLon = data.lon;
// 计算是不是到了终点
float distanceFromSelf = CoordinateUtils.calculateLineDistance(receiverBean.getEndLon(), receiverBean.getEndLat()
, endLon, endLat);
Logger.d(TAG, "onArriveAt cal distance : " + distanceFromSelf);
if (distanceFromSelf < 10) {
Logger.d(TAG, "onArriveAt end location");
isDispatch = false;
isArriveEnd = true;
}
}
@Override
public void onStateChanged(int state, String reason) {
autoPilotStatus = state;
this.reason = reason;
}
@Override
public void click() {
// 确保到达终点后,再次点击,不会有回馈,并且在下次调开始时,才会重置
if (isArriveEnd) {
return;
}
//todo 确认是否要根据停靠时自动驾驶状态,再次开启自动驾驶
// 确保处于调度中并且返回的自动驾驶状态为1才开启自动驾驶
if (isDispatch ) {
startAutoPilot();
}
}
public void testAutopilotStatus() {
autoPilotStatus = 2;
}
@@ -174,7 +231,7 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
DispatchAdasAutoPilotLocReceiverBean.DISPATCH_SOURCE_EZHOU, DispatchAdasAutoPilotLocReceiverBean.DISPATCH_TYPE_START, "1",
26.825571122, 112.5762410415, "起点---5号跑道",
26.825571122, 112.5762410415, "终点---鄂州机场",
"5分钟", "AR453航班", "你车需执行编号ca1098次航班的引导任务从A区A1到B区B1", System.currentTimeMillis());
"5分钟", "AR453航班", "你车需执行编号ca1098次航班的引导任务从A区A1到B区B1", System.currentTimeMillis(), new ArrayList<>());
this.receiverBean = adasAutoPilotLocReceiverBean;
DispatchDialogManager.getInstance(mContext).showDialog(adasAutoPilotLocReceiverBean);
}
@@ -185,7 +242,7 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
DispatchAdasAutoPilotLocReceiverBean.DISPATCH_SOURCE_EZHOU, DispatchAdasAutoPilotLocReceiverBean.DISPATCH_TYPE_STOP, "1",
0.0, 0.0, "",
0.0, 0.0, "",
"", "", "", System.currentTimeMillis());
"", "", "", System.currentTimeMillis(), new ArrayList<>());
this.receiverBean = adasAutoPilotLocReceiverBean;
DispatchDialogManager.getInstance(mContext).showDialog(adasAutoPilotLocReceiverBean);
}
@@ -196,7 +253,7 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
DispatchAdasAutoPilotLocReceiverBean.DISPATCH_SOURCE_HENGYANG, DispatchAdasAutoPilotLocReceiverBean.DISPATCH_TYPE_START, "2",
26.825571122, 112.5762410415, "衡阳科学城",
26.825571122, 112.5762410415, "衡阳首钢集团",
"", "", "", System.currentTimeMillis());
"", "", "", System.currentTimeMillis(), new ArrayList<>());
this.receiverBean = adasAutoPilotLocReceiverBean;
DispatchDialogManager.getInstance(mContext).showDialog(adasAutoPilotLocReceiverBean);
}
@@ -214,15 +271,4 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
}
});
}
@Override
public void onArriveAt(AdasOCHData data) {
}
@Override
public void onStateChanged(int state, String reason) {
autoPilotStatus = state;
this.reason = reason;
}
}

View File

@@ -1,5 +1,9 @@
package com.mogo.module.service.dispatch.bean;
import com.mogo.map.MogoLatLng;
import java.util.List;
public class DispatchAdasAutoPilotLocReceiverBean {
public static final int DISPATCH_SOURCE_HENGYANG = 1;
@@ -23,8 +27,9 @@ public class DispatchAdasAutoPilotLocReceiverBean {
private String flightInfo;
private String taskInfo;
private long systemTime;
private List<MogoLatLng> stopsList;
public DispatchAdasAutoPilotLocReceiverBean(int source, int type, String poiId, double startLat, double startLon, String startLocAddress, double endLat, double endLon, String endLocAddress, String taskTime, String flightInfo, String taskInfo, long systemTime) {
public DispatchAdasAutoPilotLocReceiverBean(int source, int type, String poiId, double startLat, double startLon, String startLocAddress, double endLat, double endLon, String endLocAddress, String taskTime, String flightInfo, String taskInfo, long systemTime, List<MogoLatLng> stopsList) {
this.source = source;
this.type = type;
this.poiId = poiId;
@@ -38,6 +43,7 @@ public class DispatchAdasAutoPilotLocReceiverBean {
this.flightInfo = flightInfo;
this.taskInfo = taskInfo;
this.systemTime = systemTime;
this.stopsList = stopsList;
}
public int getSource() {
@@ -144,6 +150,14 @@ public class DispatchAdasAutoPilotLocReceiverBean {
this.systemTime = systemTime;
}
public List<MogoLatLng> getStopsList() {
return stopsList;
}
public void setStopsList(List<MogoLatLng> stopsList) {
this.stopsList = stopsList;
}
@Override
public String toString() {
return "DispatchAdasAutoPilotLocReceiverBean{" +
@@ -160,6 +174,7 @@ public class DispatchAdasAutoPilotLocReceiverBean {
", flightInfo='" + flightInfo + '\'' +
", taskInfo='" + taskInfo + '\'' +
", systemTime=" + systemTime +
", stopsList=" + stopsList +
'}';
}
}

View File

@@ -0,0 +1,6 @@
package com.mogo.service.entrance;
public interface IMogoEntranceAutopilotStatusClickListener {
void click();
}

View File

@@ -68,10 +68,11 @@ public interface IMogoEntranceButtonController extends IProvider {
* @param index
* @return
*/
TextView getButton( ButtonIndex index );
TextView getButton(ButtonIndex index);
/**
* 添加低层级view使用ViewGroup.addView(v,0)实现
*
* @param view 将要添加的view
*/
void addBottomLayerView(View view);
@@ -79,65 +80,89 @@ public interface IMogoEntranceButtonController extends IProvider {
/**
* 添加低层级view使用ViewGroup.addView(v,0)实现
* 可指定x,y位置
*
* @param view 将要添加的view
* @param x leftMargin
* @param y topMargin
* @param x leftMargin
* @param y topMargin
*/
void addBottomLayerView(View view, int x, int y);
/**
* 移除对应的底层view
*
* @param view 待移除view
*/
void removeBottomLayerView(View view);
/**
* 添加左下角功能View按顺序添加到最底端
*
* @param view 待添加view
*/
void addLeftFeatureView(View view);
/**
* 移除左下角功能按钮
*
* @param view 待移除view
*/
void removeLeftFeatureView(View view);
/**
* 设置vr模式下左下角提示view
*
* @param view 目前是adas提示和求助
*/
void showLeftNoticeView(View view);
/**
* 隐藏vr模式下左下角提示view需要与{@link #showLeftNoticeView(View)}成对使用
*
* @param view 待隐藏view
*/
void hideLeftNoticeView(View view);
/**
* 根据noticeType添加左侧提示
*
* @param noticeType {@link #NOTICE_TYPE_SUDDENLY_BREAK}...
* @param iconRes 本地 icon res
* @param content 提示内容
* @param iconRes 本地 icon res
* @param content 提示内容
*/
void showLeftNoticeByType(int noticeType, int iconRes, String content);
/**
* 移除noticeType需要与{@link #showLeftNoticeByType(int, int, String)}成对使用
*
* @param noticeType {@link #NOTICE_TYPE_SUDDENLY_BREAK}...
*/
void hideLeftNoticeByType(int noticeType);
/**
* 添加view状态回调监听
*
* @param listener 回调监听
*/
void addEntranceViewListener(IMogoEntranceViewListener listener);
/**
* 移除view状态回调监听
*
* @param listener 回调监听
*/
void removeEntranceViewListener(IMogoEntranceViewListener listener);
/**
* 添加entrance 自动驾驶状态监听
*
* @param listener {@link IMogoEntranceAutopilotStatusClickListener}
*/
void addEntranceAutopilotStatusClickListener(IMogoEntranceAutopilotStatusClickListener listener);
/**
* 移除entrance 自动驾驶状态监听
*
* @param listener {@link IMogoEntranceAutopilotStatusClickListener}
*/
void removeEntranceAutopilotStatusClickListener(IMogoEntranceAutopilotStatusClickListener listener);
}