merge
This commit is contained in:
@@ -3,18 +3,15 @@ package com.mogo.och.bus.fragment;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.Group;
|
||||
|
||||
@@ -24,10 +21,7 @@ import com.mogo.commons.mvp.IView;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage;
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig;
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
@@ -45,7 +39,8 @@ import com.mogo.och.bus.R;
|
||||
import com.mogo.och.bus.view.BusArcView;
|
||||
import com.mogo.och.bus.view.SlidePanelView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import record_cache.RecordPanelOuterClass;
|
||||
|
||||
/**
|
||||
* 网约车基础Fragment,主要负责布局通用界面,处理站点面板和通话面板互斥情况
|
||||
@@ -65,7 +60,7 @@ public abstract class BaseOchBusTabFragment<V extends IView, P extends Presenter
|
||||
protected TextView tvOperationStatus;
|
||||
protected RelativeLayout mSettingBtn;
|
||||
protected ImageView mBadcaseBtn;
|
||||
public boolean isOperationStatus;//false-收车,true-出车
|
||||
public boolean isOperationStatus;//false-收车,true-出车
|
||||
private FrameLayout flStationPanelContainer;
|
||||
private Group groupTestPanel;
|
||||
private FrameLayout flSpeed;
|
||||
@@ -119,7 +114,7 @@ public abstract class BaseOchBusTabFragment<V extends IView, P extends Presenter
|
||||
mSwitchMapModeImage = findViewById(R.id.bus_switch_model_icon);
|
||||
mSwitchText = findViewById(R.id.bus_switch_model_text);
|
||||
|
||||
mSwitchMapModeLayout.setOnClickListener(new OnPreventFastClickListener(){
|
||||
mSwitchMapModeLayout.setOnClickListener(new OnPreventFastClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClickImpl(View v) {
|
||||
@@ -141,7 +136,7 @@ public abstract class BaseOchBusTabFragment<V extends IView, P extends Presenter
|
||||
if (DebugConfig.isDebug()) {
|
||||
mouduleArc.setLongClickable(true);
|
||||
mouduleArc.setOnLongClickListener(v -> {
|
||||
Log.d(TAG,"长按显示状态工具栏");
|
||||
Log.d(TAG, "长按显示状态工具栏");
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("oper", 52);
|
||||
MogoApisHandler.getInstance().getApis().getIntentManagerApi().invoke("com.mogo.mock", intent);
|
||||
@@ -168,13 +163,13 @@ public abstract class BaseOchBusTabFragment<V extends IView, P extends Presenter
|
||||
// return true;
|
||||
// });
|
||||
// }
|
||||
onAutopilotStatusChanged(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState(),false);
|
||||
onAutopilotStatusChanged(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState(), false);
|
||||
// 模拟 不可自动驾驶,目前场景是刚开机,adas还未和工控机连接
|
||||
findViewById(R.id.btnAutopilotDisable).setOnClickListener(view ->
|
||||
// MogoApisHandler.getInstance().getApis()
|
||||
// .getAdasControllerApi()
|
||||
// .mockOchStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE, "不能使用")
|
||||
debugAutoPilotStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE)
|
||||
debugAutoPilotStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE)
|
||||
);
|
||||
|
||||
// 模拟 可自动驾驶,工控机连接正常,且处于人工干预状态
|
||||
@@ -182,7 +177,7 @@ public abstract class BaseOchBusTabFragment<V extends IView, P extends Presenter
|
||||
// MogoApisHandler.getInstance().getApis()
|
||||
// .getAdasControllerApi()
|
||||
// .mockOchStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE, "能使用")
|
||||
debugAutoPilotStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE)
|
||||
debugAutoPilotStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE)
|
||||
);
|
||||
|
||||
// 模拟 自动驾驶能力,自动驾驶中,可能是停车,可能是行进,但是是机器在处理车的前进后退,不是人
|
||||
@@ -190,20 +185,20 @@ public abstract class BaseOchBusTabFragment<V extends IView, P extends Presenter
|
||||
// MogoApisHandler.getInstance().getApis()
|
||||
// .getAdasControllerApi()
|
||||
// .mockOchStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING, "Running")
|
||||
debugAutoPilotStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING)
|
||||
debugAutoPilotStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING)
|
||||
);
|
||||
|
||||
// 模拟 自动驾驶网约车回调数据
|
||||
findViewById(R.id.btnAutopilotArrive).setOnClickListener(view ->
|
||||
// MogoApisHandler.getInstance().getApis()
|
||||
// .getAdasControllerApi().mockOchStatus(-1, "Arrived")
|
||||
debugArrivedStation()
|
||||
debugArrivedStation()
|
||||
);
|
||||
|
||||
tvOperationStatus.setOnClickListener(view -> {
|
||||
onChangeOperationStatus();
|
||||
});
|
||||
|
||||
|
||||
mSettingBtn = findViewById(R.id.module_mogo_och_setting_layout);
|
||||
mSettingBtn.setOnClickListener(v -> {
|
||||
// TODO: 2021/12/9
|
||||
@@ -239,17 +234,15 @@ public abstract class BaseOchBusTabFragment<V extends IView, P extends Presenter
|
||||
|
||||
|
||||
@Override
|
||||
public void onAutopilotRecordResult(@Nullable AutoPilotRecordResult record) {
|
||||
if (!HmiBuildConfig.isShowBadCaseView && record != null && record.getType() == 1 && record.getStat() == 100) {
|
||||
CallerDevaToolsManager.INSTANCE.onReceiveBadCaseRecord(record);
|
||||
public void onAutopilotRecordResult(@Nullable RecordPanelOuterClass.RecordPanel recordPanel) {
|
||||
if (!HmiBuildConfig.isShowBadCaseView && recordPanel != null && recordPanel.getType() == 1 && recordPanel.getStat() == 100) {
|
||||
CallerDevaToolsManager.INSTANCE.onReceiveBadCaseRecord(recordPanel);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotIdentifyDataUpdate(@Nullable ArrayList<TrafficData> trafficData) { }
|
||||
|
||||
@Override
|
||||
public void onAutopilotWarnMessage(@Nullable AutopilotWarnMessage autopilotWarnMessage) { }
|
||||
public void onAutopilotWarnMessage(MessagePad.Warn warn) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试到站
|
||||
@@ -295,20 +288,21 @@ public abstract class BaseOchBusTabFragment<V extends IView, P extends Presenter
|
||||
|
||||
/**
|
||||
* 改变自动驾驶状态
|
||||
*
|
||||
* @param autopilotStatus 0:不可用 1:可用状态 2:自动驾驶中
|
||||
*/
|
||||
public void onAutopilotStatusChanged(int autopilotStatus,boolean isAnimateRunning) {
|
||||
public void onAutopilotStatusChanged(int autopilotStatus, boolean isAnimateRunning) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
// ctvAutopilotStatus.setChecked(isInAutopilot);
|
||||
changeAutopilotBtnView(autopilotStatus,isAnimateRunning);
|
||||
changeAutopilotBtnView(autopilotStatus, isAnimateRunning);
|
||||
});
|
||||
}
|
||||
|
||||
private void changeAutopilotBtnView(int autopilotStatus,boolean isAnimateRunning) {
|
||||
Logger.d( TAG, "onStateChangeChangeAutopilotBtnView: " + autopilotStatus +"isAnimateRunning = "+isAnimateRunning);
|
||||
private void changeAutopilotBtnView(int autopilotStatus, boolean isAnimateRunning) {
|
||||
Logger.d(TAG, "onStateChangeChangeAutopilotBtnView: " + autopilotStatus + "isAnimateRunning = " + isAnimateRunning);
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE
|
||||
== autopilotStatus) {//0不可用
|
||||
if (isAnimateRunning){
|
||||
if (isAnimateRunning) {
|
||||
stopAutopilotAnimation();
|
||||
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_wrong_autopilot_icon);
|
||||
ctvAutopilotStatusTv.setTextColor(getResources().getColor(R.color.bus_autopilot_text_color_normal));
|
||||
@@ -326,11 +320,11 @@ public abstract class BaseOchBusTabFragment<V extends IView, P extends Presenter
|
||||
ctvAutopilotStatus.setFocusableInTouchMode(true);
|
||||
// ctvAutopilotStatus.setPressed(false);
|
||||
}
|
||||
},1000);
|
||||
}, 1000);
|
||||
|
||||
}else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE
|
||||
== autopilotStatus){//1可用
|
||||
if (isAnimateRunning){
|
||||
} else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE
|
||||
== autopilotStatus) {//1可用
|
||||
if (isAnimateRunning) {
|
||||
return;
|
||||
}
|
||||
ctvAutopilotStatusTv.setTextColor(getResources().getColor(R.color.bus_autopilot_text_color_normal));
|
||||
@@ -339,9 +333,9 @@ public abstract class BaseOchBusTabFragment<V extends IView, P extends Presenter
|
||||
ctvAutopilotStatus.setSelected(false);
|
||||
ctvAutopilotStatus.setFocusableInTouchMode(true);
|
||||
// ctvAutopilotStatus.setPressed(true);
|
||||
}else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
== autopilotStatus){//2 running
|
||||
if (isAnimateRunning){
|
||||
} else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
== autopilotStatus) {//2 running
|
||||
if (isAnimateRunning) {
|
||||
stopAutopilotAnimation();
|
||||
}
|
||||
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_right_autopilot_icon);
|
||||
@@ -359,7 +353,7 @@ public abstract class BaseOchBusTabFragment<V extends IView, P extends Presenter
|
||||
ctvAutopilotStatus.setFocusableInTouchMode(true);
|
||||
// ctvAutopilotStatus.setPressed(false);
|
||||
}
|
||||
},1000);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -387,14 +381,14 @@ public abstract class BaseOchBusTabFragment<V extends IView, P extends Presenter
|
||||
});
|
||||
}
|
||||
|
||||
public void hidPanel(){
|
||||
getActivity().runOnUiThread(()->{
|
||||
public void hidPanel() {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
flStationPanelContainer.setVisibility(View.GONE);
|
||||
});
|
||||
}
|
||||
|
||||
public void showPanel(){
|
||||
getActivity().runOnUiThread(()->{
|
||||
public void showPanel() {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
flStationPanelContainer.setVisibility(View.VISIBLE);
|
||||
});
|
||||
}
|
||||
@@ -421,6 +415,7 @@ public abstract class BaseOchBusTabFragment<V extends IView, P extends Presenter
|
||||
|
||||
/**
|
||||
* 模拟自动驾驶返回状态
|
||||
*
|
||||
* @param status
|
||||
*/
|
||||
public abstract void debugAutoPilotStatus(int status);
|
||||
@@ -430,18 +425,18 @@ public abstract class BaseOchBusTabFragment<V extends IView, P extends Presenter
|
||||
*/
|
||||
public void startAutopilotAnimation() {
|
||||
// if (MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE){
|
||||
ctvAutopilotStatusTv.setText(getResources().getString(R.string.bus_loading_autopilot_tv));
|
||||
ctvAutopilotStatusTv.setTextColor(getResources().getColor(R.color.bus_autopilot_text_color_normal));
|
||||
ctvAutopilotStatus.setSelected(false);
|
||||
ctvAutopilotStatus.setFocusableInTouchMode(true);
|
||||
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_loading_autopilot_icon);
|
||||
if (autopilotLoadingAnimator == null){
|
||||
autopilotLoadingAnimator = ObjectAnimator.ofFloat(ctvAutopilotStatusIv,"rotation", 0f,360f);
|
||||
autopilotLoadingAnimator.setInterpolator(new LinearInterpolator());
|
||||
autopilotLoadingAnimator.setRepeatCount(-1);//无限循环
|
||||
autopilotLoadingAnimator.setDuration(1000);//设置持续时间
|
||||
}
|
||||
autopilotLoadingAnimator.start();//动画开始
|
||||
ctvAutopilotStatusTv.setText(getResources().getString(R.string.bus_loading_autopilot_tv));
|
||||
ctvAutopilotStatusTv.setTextColor(getResources().getColor(R.color.bus_autopilot_text_color_normal));
|
||||
ctvAutopilotStatus.setSelected(false);
|
||||
ctvAutopilotStatus.setFocusableInTouchMode(true);
|
||||
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_loading_autopilot_icon);
|
||||
if (autopilotLoadingAnimator == null) {
|
||||
autopilotLoadingAnimator = ObjectAnimator.ofFloat(ctvAutopilotStatusIv, "rotation", 0f, 360f);
|
||||
autopilotLoadingAnimator.setInterpolator(new LinearInterpolator());
|
||||
autopilotLoadingAnimator.setRepeatCount(-1);//无限循环
|
||||
autopilotLoadingAnimator.setDuration(1000);//设置持续时间
|
||||
}
|
||||
autopilotLoadingAnimator.start();//动画开始
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -449,7 +444,7 @@ public abstract class BaseOchBusTabFragment<V extends IView, P extends Presenter
|
||||
* 停止自动驾驶中间动画
|
||||
*/
|
||||
public void stopAutopilotAnimation() {
|
||||
if (autopilotLoadingAnimator != null){
|
||||
if (autopilotLoadingAnimator != null) {
|
||||
autopilotLoadingAnimator.end();
|
||||
ctvAutopilotStatusIv.clearAnimation();
|
||||
autopilotLoadingAnimator = null;
|
||||
@@ -458,9 +453,10 @@ public abstract class BaseOchBusTabFragment<V extends IView, P extends Presenter
|
||||
|
||||
/**
|
||||
* 迈速表实时更新
|
||||
*
|
||||
* @param newSpeed
|
||||
*/
|
||||
public void updateSpeedView(float newSpeed){
|
||||
public void updateSpeedView(float newSpeed) {
|
||||
int speed = (int) (Math.abs(newSpeed) * 3.6F); // 倒车时工控机反馈定位信息中speed为负值
|
||||
mouduleArc.setArcColor(Color.parseColor(speed > 60 ? "#DB3137" : "#3E77F6"));
|
||||
mouduleArc.setValues(speed);
|
||||
@@ -487,7 +483,7 @@ public abstract class BaseOchBusTabFragment<V extends IView, P extends Presenter
|
||||
/**
|
||||
* bus调试面板打开关闭
|
||||
*/
|
||||
public void debugTestBar(){
|
||||
public void debugTestBar() {
|
||||
if (groupTestPanel.getVisibility() == View.VISIBLE) {
|
||||
groupTestPanel.setVisibility(View.GONE);
|
||||
} else {
|
||||
|
||||
@@ -6,9 +6,9 @@ import android.graphics.BitmapFactory;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
@@ -26,17 +26,18 @@ import com.mogo.och.bus.presenter.OchBusPresenter;
|
||||
import com.mogo.och.bus.ui.BusSwitchLineActivity;
|
||||
import com.mogo.och.bus.view.SlidePanelView;
|
||||
|
||||
import org.w3c.dom.Text;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
|
||||
/**
|
||||
* 网约车小巴界面
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class OchBusFragment extends BaseOchBusTabFragment< OchBusFragment, OchBusPresenter >
|
||||
public class OchBusFragment extends BaseOchBusTabFragment<OchBusFragment, OchBusPresenter>
|
||||
implements SlidePanelView.OnSlidePanelMoveToEndListener, View.OnClickListener {
|
||||
private static final String TAG = "OchBusFragment";
|
||||
|
||||
@@ -44,7 +45,7 @@ public class OchBusFragment extends BaseOchBusTabFragment< OchBusFragment, OchBu
|
||||
private TextView mStartStationFlag;
|
||||
private TextView mNextStationName;
|
||||
private TextView mEndStationFlag;
|
||||
// private TextView mDebugArrive;
|
||||
// private TextView mDebugArrive;
|
||||
private TextView mSwitchLine; //切换路线
|
||||
private int mCurrentStation = 0;
|
||||
|
||||
@@ -61,24 +62,24 @@ public class OchBusFragment extends BaseOchBusTabFragment< OchBusFragment, OchBu
|
||||
@Override
|
||||
protected void initViews() {
|
||||
super.initViews();
|
||||
mBus = findViewById( R.id.module_och_bus_tag );
|
||||
mCurrentStationName = findViewById( R.id.module_och_bus_current_station );
|
||||
mStartStationFlag = findViewById( R.id.module_och_bus_start_station_tag );
|
||||
mNextStationName = findViewById( R.id.module_och_bus_order_end_station );
|
||||
mEndStationFlag = findViewById( R.id.module_och_bus_end_station_tag );
|
||||
mBus = findViewById(R.id.module_och_bus_tag);
|
||||
mCurrentStationName = findViewById(R.id.module_och_bus_current_station);
|
||||
mStartStationFlag = findViewById(R.id.module_och_bus_start_station_tag);
|
||||
mNextStationName = findViewById(R.id.module_och_bus_order_end_station);
|
||||
mEndStationFlag = findViewById(R.id.module_och_bus_end_station_tag);
|
||||
mSwitchLine = findViewById(R.id.switch_line_btn);
|
||||
// mDebugArrive = findViewById(R.id.module_och_bus_arrive_station);
|
||||
|
||||
if ( DebugConfig.isDebug() ) {
|
||||
mBus.setOnClickListener( view -> {
|
||||
TipToast.shortTip( "重置了车站状态" );
|
||||
if (DebugConfig.isDebug()) {
|
||||
mBus.setOnClickListener(view -> {
|
||||
TipToast.shortTip("重置了车站状态");
|
||||
mPresenter.queryBusRoutes();
|
||||
} );
|
||||
});
|
||||
|
||||
mBus.setOnLongClickListener( view -> {
|
||||
mBus.setOnLongClickListener(view -> {
|
||||
getActivity().finish();
|
||||
return true;
|
||||
} );
|
||||
});
|
||||
//debug下调用测试面板
|
||||
mCurrentStationName.setOnLongClickListener(v -> {
|
||||
debugTestBar();
|
||||
@@ -86,19 +87,19 @@ public class OchBusFragment extends BaseOchBusTabFragment< OchBusFragment, OchBu
|
||||
});
|
||||
}
|
||||
|
||||
Logger.d( TAG, "initView: " + CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState());
|
||||
Logger.d(TAG, "initView: " + CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState());
|
||||
// 初始化的时候设置 UI 按钮状态
|
||||
switch ( CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState() ) {
|
||||
switch (CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState()) {
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE:
|
||||
hideAutopilotBiz();
|
||||
break;
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE:
|
||||
showAutopilotBiz();
|
||||
onAutopilotStatusChanged( IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE ,false);
|
||||
onAutopilotStatusChanged(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE, false);
|
||||
break;
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING:
|
||||
showAutopilotBiz();
|
||||
onAutopilotStatusChanged( IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING ,false);
|
||||
onAutopilotStatusChanged(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING, false);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -114,7 +115,7 @@ public class OchBusFragment extends BaseOchBusTabFragment< OchBusFragment, OchBu
|
||||
@NonNull
|
||||
@Override
|
||||
protected OchBusPresenter createPresenter() {
|
||||
return new OchBusPresenter( this );
|
||||
return new OchBusPresenter(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -128,30 +129,30 @@ public class OchBusFragment extends BaseOchBusTabFragment< OchBusFragment, OchBu
|
||||
* @param stationList 车站列表信息
|
||||
* @param currentStation 当前站点
|
||||
* @param nextStation 下个站点
|
||||
* @param isArrived 是否都站
|
||||
* @param isArrived 是否都站
|
||||
*/
|
||||
public void refreshBusStations( List< OchBusStation > stationList, int currentStation, int nextStation ,boolean isArrived) {
|
||||
public void refreshBusStations(List<OchBusStation> stationList, int currentStation, int nextStation, boolean isArrived) {
|
||||
mCurrentStation = currentStation;
|
||||
if ( getActivity() == null ) {
|
||||
if (getActivity() == null) {
|
||||
return;
|
||||
}
|
||||
getActivity().runOnUiThread( () -> {
|
||||
if ( stationList == null ) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
if (stationList == null) {
|
||||
// 获取小巴数据失败
|
||||
return;
|
||||
}
|
||||
|
||||
// 渲染小巴路线数据
|
||||
renderCurrentStationStatus( stationList, currentStation, nextStation ,isArrived);
|
||||
} );
|
||||
renderCurrentStationStatus(stationList, currentStation, nextStation, isArrived);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新刷新站点信息 isArrived 是否到站
|
||||
*/
|
||||
private void renderCurrentStationStatus( List< OchBusStation > stationList, int currentStation
|
||||
, int nextStation ,boolean isArrived) {
|
||||
Log.d("MapMaker= ","currentStation="+currentStation+",nextStation="+nextStation+"isArrived="+isArrived);
|
||||
private void renderCurrentStationStatus(List<OchBusStation> stationList, int currentStation
|
||||
, int nextStation, boolean isArrived) {
|
||||
Log.d("MapMaker= ", "currentStation=" + currentStation + ",nextStation=" + nextStation + "isArrived=" + isArrived);
|
||||
String currentStationName = null;
|
||||
String nextStationName = null;
|
||||
int startStationFlagVisibility = View.INVISIBLE;
|
||||
@@ -162,70 +163,70 @@ public class OchBusFragment extends BaseOchBusTabFragment< OchBusFragment, OchBu
|
||||
boolean isArriveAtStartStation = false;
|
||||
|
||||
// 获取当前站点的名称
|
||||
currentStationName = stationList.get( currentStation ).getName();
|
||||
currentStationName = stationList.get(currentStation).getName();
|
||||
|
||||
startStation = stationList.get(0);
|
||||
endStation = stationList.get(stationList.size() - 1);
|
||||
|
||||
// 是否到达起点
|
||||
if ( currentStation == 0 ) {
|
||||
if (currentStation == 0) {
|
||||
startStationFlagVisibility = View.VISIBLE;
|
||||
isArriveAtStartStation = true;
|
||||
mStartStationFlag.setText(getResources().getString(R.string.bus_arrive_to_end_start));
|
||||
// Log.d("MapMaker= ","起点=");
|
||||
setOrRemoveMapMaker(true, OchBusConst.BUS_START_MAP_MAKER,startStation.getLat()
|
||||
,startStation.getLon(),R.drawable.icon_station_start_end);
|
||||
setOrRemoveMapMaker(true, OchBusConst.BUS_END_MAP_MAKER,endStation.getLat()
|
||||
,endStation.getLon(),R.drawable.icon_station_start_end);
|
||||
} else if ( currentStation > 0 && currentStation < stationList.size() - 1 ) {// 是否到达站点
|
||||
setOrRemoveMapMaker(true, OchBusConst.BUS_START_MAP_MAKER, startStation.getLat()
|
||||
, startStation.getLon(), R.drawable.icon_station_start_end);
|
||||
setOrRemoveMapMaker(true, OchBusConst.BUS_END_MAP_MAKER, endStation.getLat()
|
||||
, endStation.getLon(), R.drawable.icon_station_start_end);
|
||||
} else if (currentStation > 0 && currentStation < stationList.size() - 1) {// 是否到达站点
|
||||
// Log.d("MapMaker= ","中间=");
|
||||
isArriveAtStation = true;
|
||||
// mStartStationFlag.setText(getResources().getString(R.string.bus_arrive_to_end_start1));
|
||||
setOrRemoveMapMaker(false, OchBusConst.BUS_START_MAP_MAKER,startStation.getLat()
|
||||
,startStation.getLon(),R.drawable.icon_station_start_end);
|
||||
setOrRemoveMapMaker(true, OchBusConst.BUS_END_MAP_MAKER,endStation.getLat()
|
||||
,endStation.getLon(),R.drawable.icon_station_start_end);
|
||||
} else if ( currentStation == stationList.size() - 1 ) {// 是否到达终点
|
||||
setOrRemoveMapMaker(false, OchBusConst.BUS_START_MAP_MAKER, startStation.getLat()
|
||||
, startStation.getLon(), R.drawable.icon_station_start_end);
|
||||
setOrRemoveMapMaker(true, OchBusConst.BUS_END_MAP_MAKER, endStation.getLat()
|
||||
, endStation.getLon(), R.drawable.icon_station_start_end);
|
||||
} else if (currentStation == stationList.size() - 1) {// 是否到达终点
|
||||
// Log.d("MapMaker= ","终点=");
|
||||
isArriveEndStation = true;
|
||||
nextStationName = "--";
|
||||
mStartStationFlag.setText(getResources().getString(R.string.bus_arrive_to_end_end));
|
||||
startStationFlagVisibility = View.VISIBLE;
|
||||
endStationFlagVisibility = View.INVISIBLE;
|
||||
setOrRemoveMapMaker(false, OchBusConst.BUS_START_MAP_MAKER,startStation.getLat()
|
||||
,startStation.getLon(),R.drawable.icon_station_start_end);
|
||||
if (isArrived){
|
||||
setOrRemoveMapMaker(false, OchBusConst.BUS_END_MAP_MAKER,endStation.getLat()
|
||||
,endStation.getLon(),R.drawable.icon_station_start_end);
|
||||
}else {
|
||||
setOrRemoveMapMaker(true, OchBusConst.BUS_END_MAP_MAKER,endStation.getLat()
|
||||
,endStation.getLon(),R.drawable.icon_station_start_end);
|
||||
setOrRemoveMapMaker(false, OchBusConst.BUS_START_MAP_MAKER, startStation.getLat()
|
||||
, startStation.getLon(), R.drawable.icon_station_start_end);
|
||||
if (isArrived) {
|
||||
setOrRemoveMapMaker(false, OchBusConst.BUS_END_MAP_MAKER, endStation.getLat()
|
||||
, endStation.getLon(), R.drawable.icon_station_start_end);
|
||||
} else {
|
||||
setOrRemoveMapMaker(true, OchBusConst.BUS_END_MAP_MAKER, endStation.getLat()
|
||||
, endStation.getLon(), R.drawable.icon_station_start_end);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取下一站点名称
|
||||
if ( nextStation > currentStation && nextStation <= stationList.size() - 1 ) {
|
||||
nextStationName = stationList.get( nextStation ).getName();
|
||||
if (nextStation > currentStation && nextStation <= stationList.size() - 1) {
|
||||
nextStationName = stationList.get(nextStation).getName();
|
||||
}
|
||||
|
||||
// 是否到达终点
|
||||
if ( nextStation == stationList.size() - 1 ) {
|
||||
if (nextStation == stationList.size() - 1) {
|
||||
endStationFlagVisibility = View.VISIBLE;
|
||||
}
|
||||
|
||||
// 重置滑动按钮文字
|
||||
if ( isArriveEndStation ) {
|
||||
showSlidePanle( "单程结束" );
|
||||
} else if ( isArriveAtStartStation ) {
|
||||
showSlidePanle( "滑动出发" );
|
||||
} else if ( isArriveAtStation ) {
|
||||
showSlidePanle( "滑动出发" );
|
||||
if (isArriveEndStation) {
|
||||
showSlidePanle("单程结束");
|
||||
} else if (isArriveAtStartStation) {
|
||||
showSlidePanle("滑动出发");
|
||||
} else if (isArriveAtStation) {
|
||||
showSlidePanle("滑动出发");
|
||||
}
|
||||
|
||||
mCurrentStationName.setText( currentStationName );
|
||||
mNextStationName.setText( nextStationName );
|
||||
mStartStationFlag.setVisibility( startStationFlagVisibility );
|
||||
mEndStationFlag.setVisibility( endStationFlagVisibility );
|
||||
mCurrentStationName.setText(currentStationName);
|
||||
mNextStationName.setText(nextStationName);
|
||||
mStartStationFlag.setVisibility(startStationFlagVisibility);
|
||||
mEndStationFlag.setVisibility(endStationFlagVisibility);
|
||||
}
|
||||
|
||||
public void hideOchBus() {
|
||||
@@ -256,8 +257,8 @@ public class OchBusFragment extends BaseOchBusTabFragment< OchBusFragment, OchBu
|
||||
/**
|
||||
* 设置自动驾驶可用状态
|
||||
*/
|
||||
public void onAutopilotEnableChange( boolean isEnable ) {
|
||||
if ( isEnable ) {
|
||||
public void onAutopilotEnableChange(boolean isEnable) {
|
||||
if (isEnable) {
|
||||
showAutopilotBiz();
|
||||
} else {
|
||||
hideAutopilotBiz();
|
||||
@@ -272,14 +273,15 @@ public class OchBusFragment extends BaseOchBusTabFragment< OchBusFragment, OchBu
|
||||
|
||||
/**
|
||||
* 修改经营状态
|
||||
*
|
||||
* @param launch true-收车,false-出车
|
||||
*/
|
||||
public void changeOperationStatus( boolean launch ) {
|
||||
public void changeOperationStatus(boolean launch) {
|
||||
isOperationStatus = launch;
|
||||
if ( launch ) {
|
||||
if (launch) {
|
||||
// 出车的时候重制站点状态
|
||||
mPresenter.queryBusRoutes();
|
||||
tvOperationStatus.setText( "收车" );
|
||||
tvOperationStatus.setText("收车");
|
||||
showSlidePanle("滑动出发");
|
||||
showPanel();
|
||||
} else {
|
||||
@@ -289,19 +291,20 @@ public class OchBusFragment extends BaseOchBusTabFragment< OchBusFragment, OchBu
|
||||
hidPanel();
|
||||
|
||||
//移除起点终点
|
||||
if (null != startStation){
|
||||
setOrRemoveMapMaker(false, OchBusConst.BUS_START_MAP_MAKER,startStation.getLat()
|
||||
,startStation.getLon(),R.drawable.icon_station_start_end);
|
||||
if (null != startStation) {
|
||||
setOrRemoveMapMaker(false, OchBusConst.BUS_START_MAP_MAKER, startStation.getLat()
|
||||
, startStation.getLon(), R.drawable.icon_station_start_end);
|
||||
}
|
||||
if (null != endStation){
|
||||
setOrRemoveMapMaker(false, OchBusConst.BUS_END_MAP_MAKER,endStation.getLat()
|
||||
,endStation.getLon(),R.drawable.icon_station_start_end);
|
||||
if (null != endStation) {
|
||||
setOrRemoveMapMaker(false, OchBusConst.BUS_END_MAP_MAKER, endStation.getLat()
|
||||
, endStation.getLon(), R.drawable.icon_station_start_end);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* VR模式切换
|
||||
*
|
||||
* @param isVRMode
|
||||
*/
|
||||
public void onVRModeChanged(boolean isVRMode) {
|
||||
@@ -312,13 +315,14 @@ public class OchBusFragment extends BaseOchBusTabFragment< OchBusFragment, OchBu
|
||||
|
||||
/**
|
||||
* 绘制地图起点终点
|
||||
*
|
||||
* @param isAdd
|
||||
* @param uuid
|
||||
* @param iconId
|
||||
*/
|
||||
private void setOrRemoveMapMaker(boolean isAdd, String uuid,double lat,double longi, int iconId){
|
||||
if (isAdd){
|
||||
Log.d("setMapMaker= ",uuid+"=latitude="+lat+",longitude="+longi);
|
||||
private void setOrRemoveMapMaker(boolean isAdd, String uuid, double lat, double longi, int iconId) {
|
||||
if (isAdd) {
|
||||
Log.d("setMapMaker= ", uuid + "=latitude=" + lat + ",longitude=" + longi);
|
||||
MogoMarkerOptions options = new MogoMarkerOptions();
|
||||
options.anchorColor("#000000");//不设置报错,暂时随便设置个
|
||||
options.setGps(true);//使用wgs 必须设置true
|
||||
@@ -329,27 +333,27 @@ public class OchBusFragment extends BaseOchBusTabFragment< OchBusFragment, OchBu
|
||||
options.longitude(longi);
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi()
|
||||
.getMarkerManager(AbsMogoApplication.getApp()).addMarker(uuid, options);
|
||||
}else {
|
||||
Log.d("RemoveMapMaker=",uuid+"=latitude="+lat+",longitude="+longi);
|
||||
} else {
|
||||
Log.d("RemoveMapMaker=", uuid + "=latitude=" + lat + ",longitude=" + longi);
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi()
|
||||
.getMarkerManager(AbsMogoApplication.getApp()).removeMarkers(uuid);
|
||||
}
|
||||
}
|
||||
|
||||
public void debugAutoPilotStatus(int status){
|
||||
public void debugAutoPilotStatus(int status) {
|
||||
mPresenter.debugAutoPilotStatus(status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v.getId() == R.id.switch_line_btn ){//切换路线条件: 自动驾驶过程中,点击则toast提示:自动驾驶中,不可切换路线
|
||||
if (v.getId() == R.id.switch_line_btn) {//切换路线条件: 自动驾驶过程中,点击则toast提示:自动驾驶中,不可切换路线
|
||||
//本次行程未结束,不支持切换路线。点击则toast提示:当前行程未完成,不可切换路线
|
||||
if (CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState()
|
||||
== IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){
|
||||
== IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
TipToast.longTip(getResources().getString(R.string.bus_switch_line_btn_warning1));
|
||||
return;
|
||||
}
|
||||
if (mCurrentStation > 0){
|
||||
if (mCurrentStation > 0) {
|
||||
TipToast.longTip(getResources().getString(R.string.bus_switch_line_btn_warning2));
|
||||
return;
|
||||
}
|
||||
@@ -357,4 +361,9 @@ public class OchBusFragment extends BaseOchBusTabFragment< OchBusFragment, OchBu
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotIdentifyDataUpdate(List<MessagePad.TrackedObject> trafficData) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
package com.mogo.och.bus.presenter;
|
||||
|
||||
import android.location.Location;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo;
|
||||
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.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
@@ -23,17 +22,19 @@ import com.mogo.och.bus.callback.SlidePannelHideCallback;
|
||||
import com.mogo.och.bus.fragment.OchBusFragment;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
|
||||
/**
|
||||
* 网约车小巴
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class OchBusPresenter extends Presenter< OchBusFragment >
|
||||
public class OchBusPresenter extends Presenter<OchBusFragment>
|
||||
implements CarOperationStatusCallback, RefreshBusStationsCallback, SlidePannelHideCallback
|
||||
, IMoGoAutopilotStatusListener, IOCHBusControllerStatusCallback {
|
||||
|
||||
@@ -44,16 +45,16 @@ public class OchBusPresenter extends Presenter< OchBusFragment >
|
||||
private List<OchBusStation> mStationList = new ArrayList<>();
|
||||
private int mCurrentStation = 0;
|
||||
|
||||
public OchBusPresenter( OchBusFragment view ) {
|
||||
super( view );
|
||||
public OchBusPresenter(OchBusFragment view) {
|
||||
super(view);
|
||||
//2021.11.1 鹰眼架构整合,由IMoGoAutopilotStatusListener逐步替代IMogoAdasOCHCallback接口
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, this);
|
||||
OchBusOrderModel.getInstance().init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate( @NonNull LifecycleOwner owner ) {
|
||||
super.onCreate( owner );
|
||||
public void onCreate(@NonNull LifecycleOwner owner) {
|
||||
super.onCreate(owner);
|
||||
OchBusOrderModel.getInstance().queryOperationStatus();
|
||||
OchBusOrderModel.getInstance().queryBusRoutes();
|
||||
initModelListener();
|
||||
@@ -66,39 +67,39 @@ public class OchBusPresenter extends Presenter< OchBusFragment >
|
||||
releaseListener();
|
||||
}
|
||||
|
||||
public void initModelListener(){
|
||||
public void initModelListener() {
|
||||
OchBusOrderModel.getInstance().setCarOperationStatusCallback(this);
|
||||
OchBusOrderModel.getInstance().setRefreshBusStationsCallback(this);
|
||||
OchBusOrderModel.getInstance().setSlidePannelHideCallback(this);
|
||||
OchBusOrderModel.getInstance().setControllerStatusCallback(this);
|
||||
}
|
||||
|
||||
public void releaseListener(){
|
||||
public void releaseListener() {
|
||||
OchBusOrderModel.getInstance().setCarOperationStatusCallback(null);
|
||||
OchBusOrderModel.getInstance().setRefreshBusStationsCallback(null);
|
||||
OchBusOrderModel.getInstance().setSlidePannelHideCallback(null);
|
||||
OchBusOrderModel.getInstance().setControllerStatusCallback(null);
|
||||
}
|
||||
|
||||
public void queryBusRoutes(){
|
||||
public void queryBusRoutes() {
|
||||
OchBusOrderModel.getInstance().queryBusRoutes();
|
||||
}
|
||||
|
||||
public void debugResetStationStatus(){
|
||||
public void debugResetStationStatus() {
|
||||
OchBusOrderModel.getInstance().debugResetStationStatus();
|
||||
}
|
||||
|
||||
public void autoDriveToNextStation(boolean isRestart){
|
||||
public void autoDriveToNextStation(boolean isRestart) {
|
||||
currentAutopilotStatus = -1;
|
||||
OchBusOrderModel.getInstance().autoDriveToNextStation(isRestart);
|
||||
}
|
||||
|
||||
public void restartAutopilot(){
|
||||
public void restartAutopilot() {
|
||||
currentAutopilotStatus = -1;
|
||||
OchBusOrderModel.getInstance().restartAutopilot();
|
||||
}
|
||||
|
||||
public void onChangeOperationStatus(){
|
||||
public void onChangeOperationStatus() {
|
||||
OchBusOrderModel.getInstance().onChangeOperationStatus();
|
||||
}
|
||||
|
||||
@@ -115,9 +116,9 @@ public class OchBusPresenter extends Presenter< OchBusFragment >
|
||||
mStationList.addAll(stationList);
|
||||
mCurrentStation = currentStation;
|
||||
functionDemoModeChange();
|
||||
Log.d("OchBusOrderModel ="," mCurrentStation ="+mCurrentStation);
|
||||
if ( mView != null ) {
|
||||
mView.refreshBusStations( stationList, currentStation, nextStation ,isArrived);
|
||||
Log.d("OchBusOrderModel =", " mCurrentStation =" + mCurrentStation);
|
||||
if (mView != null) {
|
||||
mView.refreshBusStations(stationList, currentStation, nextStation, isArrived);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,32 +126,27 @@ public class OchBusPresenter extends Presenter< OchBusFragment >
|
||||
// Log.d("OchBusOrderModel ="," functionDemoModeChange ="+mCurrentStation);
|
||||
if (FunctionBuildConfig.isDemoMode
|
||||
&& (
|
||||
(mCurrentStation > 0 && mCurrentStation < mStationList.size()-1)
|
||||
(mCurrentStation > 0 && mCurrentStation < mStationList.size() - 1)
|
||||
|| (
|
||||
(mCurrentStation == 0 || mCurrentStation == mStationList.size() -1)
|
||||
(mCurrentStation == 0 || mCurrentStation == mStationList.size() - 1)
|
||||
&& OchBusOrderModel.getInstance().isGoingToNextStation()
|
||||
)
|
||||
)
|
||||
){
|
||||
mView.onAutopilotStatusChanged( IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING ,false);
|
||||
) {
|
||||
mView.onAutopilotStatusChanged(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideSlidePanel() {
|
||||
if (mView != null){
|
||||
if (mView != null) {
|
||||
mView.hideSlidePanel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotArriveAtStation(@Nullable AutopilotStationInfo autopilotStationInfo) {
|
||||
OchBusOrderModel.getInstance().onArriveAt(autopilotStationInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotGuardian(@Nullable AutopilotGuardianStatusInfo autopilotGuardianStatusInfo) {
|
||||
|
||||
public void onAutopilotArriveAtStation(MessagePad.ArrivalNotification arrivalNotification) {
|
||||
OchBusOrderModel.getInstance().onArriveAt(arrivalNotification);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -162,69 +158,69 @@ public class OchBusPresenter extends Presenter< OchBusFragment >
|
||||
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autopilotStatusInfo) {
|
||||
if (autopilotStatusInfo == null) return;
|
||||
int state = autopilotStatusInfo.getState();
|
||||
Logger.d( TAG, "onStateChange: " + state +"currentAutopilotStatus = "+currentAutopilotStatus);
|
||||
switch ( state ) {
|
||||
Logger.d(TAG, "onStateChange: " + state + "currentAutopilotStatus = " + currentAutopilotStatus);
|
||||
switch (state) {
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE:
|
||||
if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE){
|
||||
if (currentAutopilotStatus == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){//2-->1语音提示
|
||||
if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) {
|
||||
if (currentAutopilotStatus == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {//2-->1语音提示
|
||||
// AIAssist.getInstance( getContext() ).speakTTSVoice( "已进入人工驾驶模式" );
|
||||
}
|
||||
currentAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE;
|
||||
// 设置UI【自动驾驶】按钮是否展示
|
||||
mView.onAutopilotEnableChange( true );
|
||||
if ( OchBusOrderModel.getInstance().isGoingToNextStation() ) {
|
||||
mView.onAutopilotEnableChange(true);
|
||||
if (OchBusOrderModel.getInstance().isGoingToNextStation()) {
|
||||
mView.hideSlidePanel();
|
||||
}
|
||||
if (FunctionBuildConfig.isDemoMode
|
||||
&& (
|
||||
(mCurrentStation > 0 && mCurrentStation < mStationList.size()-1)
|
||||
(mCurrentStation > 0 && mCurrentStation < mStationList.size() - 1)
|
||||
|| (
|
||||
(mCurrentStation == 0 || mCurrentStation == mStationList.size() -1)
|
||||
(mCurrentStation == 0 || mCurrentStation == mStationList.size() - 1)
|
||||
&& OchBusOrderModel.getInstance().isGoingToNextStation()
|
||||
)
|
||||
)
|
||||
){
|
||||
Log.d("OchBusOrderModel=","有美化功能");
|
||||
)
|
||||
)
|
||||
) {
|
||||
Log.d("OchBusOrderModel=", "有美化功能");
|
||||
return;
|
||||
}
|
||||
// 改变UI自动驾驶状态
|
||||
mView.onAutopilotStatusChanged( currentAutopilotStatus ,isAnimateRunning);
|
||||
mView.onAutopilotStatusChanged(currentAutopilotStatus, isAnimateRunning);
|
||||
}
|
||||
break;
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING:
|
||||
runOnUIThread(()->mView.stopAutopilotAnimation());
|
||||
if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){
|
||||
runOnUIThread(() -> mView.stopAutopilotAnimation());
|
||||
if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
currentAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING;
|
||||
// 改变UI自动驾驶状态
|
||||
mView.onAutopilotStatusChanged( currentAutopilotStatus ,isAnimateRunning);
|
||||
mView.onAutopilotStatusChanged(currentAutopilotStatus, isAnimateRunning);
|
||||
}
|
||||
isAnimateRunning = false;
|
||||
break;
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE:
|
||||
if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE){
|
||||
if (currentAutopilotStatus == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){//2-->0语音提示
|
||||
if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
|
||||
if (currentAutopilotStatus == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {//2-->0语音提示
|
||||
// AIAssist.getInstance( getContext() ).speakTTSVoice( "自动驾驶已停止,请人工接管" );
|
||||
}
|
||||
currentAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE;
|
||||
if (FunctionBuildConfig.isDemoMode
|
||||
&& (
|
||||
(mCurrentStation > 0 && mCurrentStation < mStationList.size()-1)
|
||||
(mCurrentStation > 0 && mCurrentStation < mStationList.size() - 1)
|
||||
|| (
|
||||
(mCurrentStation == 0 || mCurrentStation == mStationList.size() -1)
|
||||
(mCurrentStation == 0 || mCurrentStation == mStationList.size() - 1)
|
||||
&& OchBusOrderModel.getInstance().isGoingToNextStation()
|
||||
)
|
||||
)
|
||||
){
|
||||
Log.d("OchBusOrderModel=","有美化功能");
|
||||
) {
|
||||
Log.d("OchBusOrderModel=", "有美化功能");
|
||||
return;
|
||||
}
|
||||
mView.onAutopilotEnableChange( false );
|
||||
mView.onAutopilotStatusChanged( currentAutopilotStatus ,isAnimateRunning);
|
||||
mView.onAutopilotEnableChange(false);
|
||||
mView.onAutopilotStatusChanged(currentAutopilotStatus, isAnimateRunning);
|
||||
}
|
||||
isAnimateRunning = false;
|
||||
break;
|
||||
default:
|
||||
mView.onAutopilotEnableChange( false );
|
||||
mView.onAutopilotEnableChange(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -236,7 +232,7 @@ public class OchBusPresenter extends Presenter< OchBusFragment >
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged(Location location) {
|
||||
if (null != location){
|
||||
if (null != location) {
|
||||
runOnUIThread(() -> mView.updateSpeedView(location.getSpeed()));
|
||||
}
|
||||
}
|
||||
@@ -244,7 +240,7 @@ public class OchBusPresenter extends Presenter< OchBusFragment >
|
||||
@Override
|
||||
public void startOpenAutopilot() {
|
||||
isAnimateRunning = true;
|
||||
runOnUIThread(()->mView.startAutopilotAnimation());
|
||||
runOnUIThread(() -> mView.startAutopilotAnimation());
|
||||
// TODO: 2021/8/20 无工控机环境, 手动调起自动驾驶开启返回结果,有工控机环境要删除
|
||||
// UiThreadHandler.postDelayed(new Runnable() {
|
||||
// @Override
|
||||
@@ -254,12 +250,12 @@ public class OchBusPresenter extends Presenter< OchBusFragment >
|
||||
// },2300);
|
||||
}
|
||||
|
||||
private void runOnUIThread( Runnable executor ) {
|
||||
if ( executor == null ) {
|
||||
private void runOnUIThread(Runnable executor) {
|
||||
if (executor == null) {
|
||||
return;
|
||||
}
|
||||
if ( Looper.myLooper() != Looper.getMainLooper() ) {
|
||||
UiThreadHandler.post( executor );
|
||||
if (Looper.myLooper() != Looper.getMainLooper()) {
|
||||
UiThreadHandler.post(executor);
|
||||
} else {
|
||||
executor.run();
|
||||
}
|
||||
@@ -267,11 +263,17 @@ public class OchBusPresenter extends Presenter< OchBusFragment >
|
||||
|
||||
/**
|
||||
* 测试使用
|
||||
*
|
||||
* @param status
|
||||
*/
|
||||
public void debugAutoPilotStatus(int status){
|
||||
public void debugAutoPilotStatus(int status) {
|
||||
AutopilotStatusInfo info = new AutopilotStatusInfo();
|
||||
info.setState(status);
|
||||
onAutopilotStatusResponse(info);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotGuardian(MogoReportMsg.MogoReportMessage guardianInfo) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package com.mogo.och.taxi.passenger.callback;
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/11/1
|
||||
*/
|
||||
public interface IOCHTaxiPassengerAutopilotPlanningCallback {
|
||||
void routeResult(List<AutopilotRouteInfo.RouteModels> models);
|
||||
interface IOCHTaxiAutopilotPlanningCallback {
|
||||
void routeResult(List<MessagePad.Location> models);
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
package com.mogo.och.taxi.callback;
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/11/1
|
||||
*/
|
||||
public interface IOCHTaxiAutopilotPlanningCallback {
|
||||
void routeResult(List<AutopilotRouteInfo.RouteModels> models);
|
||||
void routeResult(List<MessagePad.Location> models);
|
||||
}
|
||||
@@ -14,9 +14,7 @@ import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
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.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
@@ -68,10 +66,12 @@ import java.util.List;
|
||||
import io.reactivex.exceptions.UndeliverableException;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.plugins.RxJavaPlugins;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
*
|
||||
* <p>
|
||||
* 网约车 - 出租车业务逻辑处理
|
||||
*/
|
||||
public class MogoOCHTaxiModelNew {
|
||||
@@ -126,7 +126,7 @@ public class MogoOCHTaxiModelNew {
|
||||
this.mOrderStatusCallback = callback;
|
||||
}
|
||||
|
||||
public void init( Context context ) {
|
||||
public void init(Context context) {
|
||||
mContext = context.getApplicationContext();
|
||||
initListeners();
|
||||
|
||||
@@ -146,27 +146,27 @@ public class MogoOCHTaxiModelNew {
|
||||
public void accept(Throwable e) {
|
||||
if (e instanceof UndeliverableException) {
|
||||
e = e.getCause();
|
||||
Log.d(TAG,"UndeliverableException");
|
||||
Log.d(TAG, "UndeliverableException");
|
||||
}
|
||||
if ((e instanceof IOException)) {//
|
||||
// fine, irrelevant network problem or API that throws on cancellation
|
||||
Log.d(TAG,"IOException");
|
||||
Log.d(TAG, "IOException");
|
||||
return;
|
||||
}
|
||||
if (e instanceof InterruptedException) {
|
||||
// fine, some blocking code was interrupted by a dispose call
|
||||
Log.d(TAG,"InterruptedException");
|
||||
Log.d(TAG, "InterruptedException");
|
||||
return;
|
||||
}
|
||||
if ((e instanceof NullPointerException) || (e instanceof IllegalArgumentException)) {
|
||||
// that's likely a bug in the application
|
||||
Log.d(TAG,"NullPointerException or IllegalArgumentException");
|
||||
Log.d(TAG, "NullPointerException or IllegalArgumentException");
|
||||
Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
|
||||
return;
|
||||
}
|
||||
if (e instanceof IllegalStateException) {
|
||||
// that's a bug in RxJava or in a custom operator
|
||||
Log.d(TAG,"IllegalStateException");
|
||||
Log.d(TAG, "IllegalStateException");
|
||||
Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
|
||||
return;
|
||||
}
|
||||
@@ -180,7 +180,7 @@ public class MogoOCHTaxiModelNew {
|
||||
}
|
||||
}
|
||||
|
||||
public void startOrStopOrderLoop(){
|
||||
public void startOrStopOrderLoop() {
|
||||
if (NetworkUtils.isConnected(mContext)) {
|
||||
startOrStopOrderLoop(mOCHCarStatus == 1);
|
||||
}
|
||||
@@ -195,26 +195,26 @@ public class MogoOCHTaxiModelNew {
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getSocketManagerApi(mContext)
|
||||
.registerLifecycleListener(10010,mSocketLifeCycleLisnter);
|
||||
.registerLifecycleListener(10010, mSocketLifeCycleLisnter);
|
||||
|
||||
// 2021.11.1重构自动驾驶 实现接口 IMoGoAutopilotStatusListener 注册监听 替换IMogoAdasOCHCallback接口
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, mGoAutopilotStatusListener);
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getIntentManagerApi()
|
||||
.registerIntentListener( ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener );
|
||||
.registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener);
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getStatusManagerApi()
|
||||
.registerStatusChangedListener( TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener );
|
||||
.registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener);
|
||||
// 达到起始站围栏监听
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getRegisterCenterApi()
|
||||
.registerCarLocationChangedListener( TAG, mCarLocationChangedListener2);
|
||||
.registerCarLocationChangedListener(TAG, mCarLocationChangedListener2);
|
||||
|
||||
//2021.11.1 自动驾驶路线规划接口
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG,moGoAutopilotPlanningListener);
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, moGoAutopilotPlanningListener);
|
||||
}
|
||||
|
||||
private void releaseListeners() {
|
||||
@@ -275,13 +275,14 @@ public class MogoOCHTaxiModelNew {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String msg) { }
|
||||
public void onFail(int code, String msg) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//更新出车收车状态
|
||||
public void updateCarStatus() {
|
||||
if ( mOCHCarStatus == -1){
|
||||
if (mOCHCarStatus == -1) {
|
||||
queryCarStatus();
|
||||
return;
|
||||
}
|
||||
@@ -316,7 +317,7 @@ public class MogoOCHTaxiModelNew {
|
||||
|
||||
/**
|
||||
* 查询订单状态:进行中/待服务(轮询防止因crash导致应用重启、断网没收到推送等)
|
||||
*
|
||||
* <p>
|
||||
* 注:只有在本地缓存mCurrentOCHOrder为null时(已完成or已取消有明确结果)或id相同且status不同时,
|
||||
* 才更新最新进行中单到本地
|
||||
*/
|
||||
@@ -424,7 +425,7 @@ public class MogoOCHTaxiModelNew {
|
||||
|
||||
//更新当前订单状态
|
||||
public void updateOCHOrderStatus(final OrderStatusEnum orderStatus) {
|
||||
if ( mCurrentOCHOrder == null ) {
|
||||
if (mCurrentOCHOrder == null) {
|
||||
return;
|
||||
}
|
||||
final String orderNo = mCurrentOCHOrder.orderNo;
|
||||
@@ -550,7 +551,7 @@ public class MogoOCHTaxiModelNew {
|
||||
|
||||
/**
|
||||
* 查询新到预约单
|
||||
*
|
||||
* <p>
|
||||
* 注:只有在本地缓存mNewBookingOrder为null时(执行完抢单or司机关闭改单),才更新新到待抢单
|
||||
*/
|
||||
public void queryNewBookingOrder() {
|
||||
@@ -765,7 +766,7 @@ public class MogoOCHTaxiModelNew {
|
||||
|
||||
//检测当前订单
|
||||
public boolean checkCurrentOCHOrder() {
|
||||
if ( mCurrentOCHOrder != null
|
||||
if (mCurrentOCHOrder != null
|
||||
&& mCurrentOCHOrder.startSiteGcjPoint != null
|
||||
&& mCurrentOCHOrder.endSiteGcjPoint != null) {
|
||||
return true;
|
||||
@@ -776,7 +777,7 @@ public class MogoOCHTaxiModelNew {
|
||||
//以当前订单为基础,开启自动驾驶
|
||||
public void startAutoPilot() {
|
||||
if (!checkCurrentOCHOrder()) {
|
||||
Logger.e( TAG, "no order or order is empty." );
|
||||
Logger.e(TAG, "no order or order is empty.");
|
||||
TipToast.shortTip("当前订单不存在或异常!");
|
||||
return;
|
||||
}
|
||||
@@ -800,7 +801,7 @@ public class MogoOCHTaxiModelNew {
|
||||
parameters.endLatLon = new AutopilotControlParameters.AutoPilotLonLat(endWgsLat, endWgsLon);
|
||||
CallerAutoPilotManager.INSTANCE.startAutoPilot(parameters);
|
||||
Logger.d(TAG, "start autopilot with parameter: %s", GsonUtil.jsonFromObject(parameters)
|
||||
+" ,startSiteName="+ mCurrentOCHOrder.startSiteAddr+" ,endSiteName="+mCurrentOCHOrder.endSiteAddr);
|
||||
+ " ,startSiteName=" + mCurrentOCHOrder.startSiteAddr + " ,endSiteName=" + mCurrentOCHOrder.endSiteAddr);
|
||||
if (DebugConfig.isDebug()) {
|
||||
// TipToast.shortTip("Start autopilot!");
|
||||
}
|
||||
@@ -814,7 +815,7 @@ public class MogoOCHTaxiModelNew {
|
||||
try {
|
||||
CallerAutoPilotManager.INSTANCE.cancelAutoPilot();
|
||||
Logger.d(TAG, "结束自动驾驶");
|
||||
} catch ( Exception e ) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -829,7 +830,7 @@ public class MogoOCHTaxiModelNew {
|
||||
double startLat = mCurrentOCHOrder.startSiteGcjPoint.get(1);
|
||||
double distance = CoordinateUtils.calculateLineDistance(
|
||||
startLon, startLat,
|
||||
location.getLongitude(), location.getLatitude() );
|
||||
location.getLongitude(), location.getLatitude());
|
||||
|
||||
if (DebugConfig.isDebug() && mCurrentOCHOrder.orderStatus == OrderStatusEnum.OnTheWayToStartStation.getCode()) {
|
||||
// TipToast.shortTip("距离上车点:" + Double.valueOf(distance).intValue());
|
||||
@@ -840,21 +841,21 @@ public class MogoOCHTaxiModelNew {
|
||||
// mOrderStatusCallback.onCurrentOrderDistToStartChanged((long) distance, 0);
|
||||
// }
|
||||
|
||||
if ( distance > OCHTaxiConst.ARRIVE_AT_START_STATION_DISTANCE ) {
|
||||
if (distance > OCHTaxiConst.ARRIVE_AT_START_STATION_DISTANCE) {
|
||||
distance = CoordinateUtils.calculateLineDistance(startLon, startLat,
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon(),
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat() );
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat());
|
||||
}
|
||||
|
||||
if ( distance <= OCHTaxiConst.ARRIVE_AT_START_STATION_DISTANCE ) {
|
||||
updateOCHOrderStatus( OrderStatusEnum.ArriveAtStartStation);
|
||||
if (distance <= OCHTaxiConst.ARRIVE_AT_START_STATION_DISTANCE) {
|
||||
updateOCHOrderStatus(OrderStatusEnum.ArriveAtStartStation);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: 2021/9/12
|
||||
public void calculateTravelDistance(Location carLocation){
|
||||
if (checkCurrentOCHOrder() && mCurrentOCHOrder.endSiteGcjPoint.size()>0) {
|
||||
public void calculateTravelDistance(Location carLocation) {
|
||||
if (checkCurrentOCHOrder() && mCurrentOCHOrder.endSiteGcjPoint.size() > 0) {
|
||||
double endLon = mCurrentOCHOrder.endSiteGcjPoint.get(0);
|
||||
double endLat = mCurrentOCHOrder.endSiteGcjPoint.get(1);
|
||||
double distance = CoordinateUtils.calculateLineDistance(
|
||||
@@ -870,10 +871,10 @@ public class MogoOCHTaxiModelNew {
|
||||
//监听网络变化,避免启动机器时无网导致无法更新订单信息
|
||||
private IMogoIntentListener mNetWorkIntentListener = new IMogoIntentListener() {
|
||||
@Override
|
||||
public void onIntentReceived( String intentStr, Intent intent ) {
|
||||
Logger.d( TAG, "onIntentReceived = %s", intentStr );
|
||||
if ( ConnectivityManager.CONNECTIVITY_ACTION.equals( intentStr ) ) {
|
||||
if ( NetworkUtils.isConnected( mContext ) ) {
|
||||
public void onIntentReceived(String intentStr, Intent intent) {
|
||||
Logger.d(TAG, "onIntentReceived = %s", intentStr);
|
||||
if (ConnectivityManager.CONNECTIVITY_ACTION.equals(intentStr)) {
|
||||
if (NetworkUtils.isConnected(mContext)) {
|
||||
startOrStopOrderLoop(mOCHCarStatus == 1);
|
||||
queryCarStatus();
|
||||
}
|
||||
@@ -895,20 +896,26 @@ public class MogoOCHTaxiModelNew {
|
||||
|
||||
private IMogoLifecycleListener mSocketLifeCycleLisnter = new IMogoLifecycleListener() {
|
||||
@Override
|
||||
public void onConnectFailure() { Logger.e(TAG,"socket onConnectFailure"); }
|
||||
public void onConnectFailure() {
|
||||
Logger.e(TAG, "socket onConnectFailure");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectSuccess() { Logger.e(TAG,"socket onConnectSuccess"); }
|
||||
public void onConnectSuccess() {
|
||||
Logger.e(TAG, "socket onConnectSuccess");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectLost() { Logger.e(TAG,"socket onConnectLost"); }
|
||||
public void onConnectLost() {
|
||||
Logger.e(TAG, "socket onConnectLost");
|
||||
}
|
||||
};
|
||||
|
||||
// 自车定位
|
||||
private IMogoCarLocationChangedListener2 mCarLocationChangedListener2 = new IMogoCarLocationChangedListener2() {
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged2( Location location ) {
|
||||
public void onCarLocationChanged2(Location location) {
|
||||
IMogoServiceApis apis = MogoApisHandler.getInstance().getApis();
|
||||
MogoLocation mogoLocation = new MogoLocation();
|
||||
mogoLocation.setAccuracy(location.getAccuracy());
|
||||
@@ -970,13 +977,19 @@ public class MogoOCHTaxiModelNew {
|
||||
}
|
||||
updateOCHOrderStatus(OrderStatusEnum.OnTheWayToEndStation);
|
||||
}
|
||||
private IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener(){
|
||||
|
||||
private final IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener() {
|
||||
|
||||
@Override
|
||||
public void onAutopilotGuardian(@Nullable MogoReportMsg.MogoReportMessage guardianInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autopilotStatusInfo) {
|
||||
if (autopilotStatusInfo == null) return;
|
||||
int state = autopilotStatusInfo.getState();
|
||||
Logger.d( TAG, "state = %s", state );
|
||||
Logger.d(TAG, "state = %s", state);
|
||||
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotRunning();
|
||||
if (mCurrentOCHOrder != null
|
||||
@@ -1018,12 +1031,7 @@ public class MogoOCHTaxiModelNew {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotGuardian(@Nullable AutopilotGuardianStatusInfo autopilotGuardianStatusInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotArriveAtStation(@Nullable AutopilotStationInfo data) {
|
||||
public void onAutopilotArriveAtStation(MessagePad.ArrivalNotification data) {
|
||||
if (data == null || !checkCurrentOCHOrder()
|
||||
|| (getCurOrderStatus() == OrderStatusEnum.ArriveAtEndStation)) {
|
||||
return;
|
||||
@@ -1034,34 +1042,35 @@ public class MogoOCHTaxiModelNew {
|
||||
updateOCHOrderStatus(OrderStatusEnum.ArriveAtEndStation);
|
||||
}
|
||||
};
|
||||
private IMoGoAutopilotPlanningListener moGoAutopilotPlanningListener = new IMoGoAutopilotPlanningListener(){
|
||||
private final IMoGoAutopilotPlanningListener moGoAutopilotPlanningListener = new IMoGoAutopilotPlanningListener() {
|
||||
|
||||
@Override
|
||||
public void onAutopilotRotting(MessagePad.GlobalPathResp routeList) {
|
||||
if (null != routeList && routeList.getWayPointsList().size() > 0){
|
||||
// mAutopilotPlanningCallback.routeResult(routeList.getModels());
|
||||
updateOrderRoute(routeList.getWayPointsList());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotTrajectory(ArrayList<ADASTrajectoryInfo> trajectoryInfos) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRotting(AutopilotRouteInfo routeList) {
|
||||
if (null != routeList && routeList.getModels() != null){
|
||||
// mAutopilotPlanningCallback.routeResult(routeList.getModels());
|
||||
updateOrderRoute(routeList.getModels());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 上报订单全路径规划数据
|
||||
* @param models
|
||||
*/
|
||||
public void updateOrderRoute(List<AutopilotRouteInfo.RouteModels> models) {
|
||||
public void updateOrderRoute(List<MessagePad.Location> models) {
|
||||
|
||||
List<OrderRouteUpdateReqBean.Result> points = new ArrayList<>();
|
||||
|
||||
for (int i =0; i < models.size(); i++){
|
||||
OrderRouteUpdateReqBean.Result point = new OrderRouteUpdateReqBean.Result();
|
||||
point.latitude = models.get(i).getLat();
|
||||
point.longitude = models.get(i).getLon();
|
||||
point.latitude = models.get(i).getLatitude();
|
||||
point.longitude = models.get(i).getLongitude();
|
||||
points.add(point);
|
||||
}
|
||||
|
||||
@@ -1079,7 +1088,5 @@ public class MogoOCHTaxiModelNew {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* END
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
@@ -11,11 +11,9 @@ import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.taxi.callback.IOCHTaxiAutopilotPlanningCallback;
|
||||
import com.mogo.och.taxi.constant.OrderStatusEnum;
|
||||
import com.mogo.och.taxi.bean.OrderQueryRespBean;
|
||||
import com.mogo.och.taxi.bean.OrderQueryRouteInfoRespBean;
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.mogo.och.taxi.ui;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
@@ -16,7 +15,6 @@ import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.Group;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
@@ -27,11 +25,8 @@ import com.mogo.commons.mvp.IView;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage;
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig;
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
|
||||
@@ -48,7 +43,8 @@ import com.mogo.module.common.constants.DataTypes;
|
||||
import com.mogo.module.common.view.OnPreventFastClickListener;
|
||||
import com.mogo.och.taxi.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import record_cache.RecordPanelOuterClass;
|
||||
|
||||
|
||||
/**
|
||||
@@ -71,7 +67,7 @@ public abstract class BaseOchTaxiTabFragment<V extends IView, P extends Presente
|
||||
private ImageView mAutopilotImage;
|
||||
private TextView mAutopilotTv;
|
||||
private LinearLayout mMapswitchBtn;
|
||||
private ImageView mCloseNaviIcon;
|
||||
private ImageView mCloseNaviIcon;
|
||||
protected LinearLayout mPersonalBtn;
|
||||
protected RelativeLayout mSettingBtn;
|
||||
protected ImageView mBadcaseBtn;
|
||||
@@ -106,7 +102,7 @@ public abstract class BaseOchTaxiTabFragment<V extends IView, P extends Presente
|
||||
// onAutopilotStatusChanged(false);
|
||||
// });
|
||||
mSpeedView.setOnLongClickListener(v -> {
|
||||
Log.d(TAG,"长按显示状态工具栏");
|
||||
Log.d(TAG, "长按显示状态工具栏");
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("oper", 52);
|
||||
MogoApisHandler.getInstance().getApis().getIntentManagerApi().invoke("com.mogo.mock", intent);
|
||||
@@ -176,7 +172,7 @@ public abstract class BaseOchTaxiTabFragment<V extends IView, P extends Presente
|
||||
// if (DebugConfig.isDebug()) {
|
||||
// ctvAutopilotStatus.setOnLongClickListener(v -> {
|
||||
// if (groupTestPanel.getVisibility() == View.VISIBLE) {
|
||||
groupTestPanel.setVisibility(View.GONE);
|
||||
groupTestPanel.setVisibility(View.GONE);
|
||||
// } else {
|
||||
// groupTestPanel.setVisibility(View.VISIBLE);
|
||||
// }
|
||||
@@ -234,9 +230,9 @@ public abstract class BaseOchTaxiTabFragment<V extends IView, P extends Presente
|
||||
AutopilotControlParameters currentAutopilot = new AutopilotControlParameters();
|
||||
currentAutopilot.isSpeakVoice = true;
|
||||
// 万集东门站
|
||||
currentAutopilot.startLatLon = new AutopilotControlParameters.AutoPilotLonLat(40.194795425,116.724476409);
|
||||
currentAutopilot.startLatLon = new AutopilotControlParameters.AutoPilotLonLat(40.194795425, 116.724476409);
|
||||
// 市政府前街18号
|
||||
currentAutopilot.endLatLon = new AutopilotControlParameters.AutoPilotLonLat(40.1939540844,116.720067);
|
||||
currentAutopilot.endLatLon = new AutopilotControlParameters.AutoPilotLonLat(40.1939540844, 116.720067);
|
||||
// 订单运营类型 (9出租车,10小巴)
|
||||
currentAutopilot.vehicleType = 10;
|
||||
Logger.d(TAG, "模拟 订单站点下发:" + currentAutopilot);
|
||||
@@ -251,11 +247,12 @@ public abstract class BaseOchTaxiTabFragment<V extends IView, P extends Presente
|
||||
showNaviToStartStationFragment(false);
|
||||
});
|
||||
}
|
||||
|
||||
protected void onChangeOperationStatus() {
|
||||
|
||||
}
|
||||
|
||||
protected void onGoToTaxiOrders(){
|
||||
protected void onGoToTaxiOrders() {
|
||||
|
||||
}
|
||||
|
||||
@@ -267,19 +264,16 @@ public abstract class BaseOchTaxiTabFragment<V extends IView, P extends Presente
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAutopilotIdentifyDataUpdate(@Nullable ArrayList<TrafficData> trafficData) { }
|
||||
|
||||
@Override
|
||||
public void onAutopilotRecordResult(@Nullable AutoPilotRecordResult record) {
|
||||
if (!HmiBuildConfig.isShowBadCaseView && record != null && record.getType() == 1 && record.getStat() == 100) {
|
||||
CallerDevaToolsManager.INSTANCE.onReceiveBadCaseRecord(record);
|
||||
public void onAutopilotRecordResult(@Nullable RecordPanelOuterClass.RecordPanel recordPanel) {
|
||||
if (!HmiBuildConfig.isShowBadCaseView && recordPanel != null && recordPanel.getType() == 1 && recordPanel.getStat() == 100) {
|
||||
CallerDevaToolsManager.INSTANCE.onReceiveBadCaseRecord(recordPanel);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotWarnMessage(@Nullable AutopilotWarnMessage autopilotWarnMessage) { }
|
||||
public void onAutopilotWarnMessage(MessagePad.Warn warn) {
|
||||
}
|
||||
|
||||
public void showNotice(String notice) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
@@ -293,6 +287,7 @@ public abstract class BaseOchTaxiTabFragment<V extends IView, P extends Presente
|
||||
* @param status 2 - running 1 - enable 2 - disable
|
||||
*/
|
||||
private int mPrevAPStatus = -1;
|
||||
|
||||
public void onAutopilotStatusChanged(int status) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
if (isStarting && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING != status) {
|
||||
@@ -321,7 +316,8 @@ public abstract class BaseOchTaxiTabFragment<V extends IView, P extends Presente
|
||||
});
|
||||
}
|
||||
|
||||
private AnimationDrawable animationDrawable;
|
||||
private AnimationDrawable animationDrawable;
|
||||
|
||||
public void AutopilotStatusAnimchanged(int status) {
|
||||
// mAutopilotTv.setText(isInAutopilot?"自动驾驶":"开启自动驾驶");
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == status) {
|
||||
@@ -338,12 +334,12 @@ public abstract class BaseOchTaxiTabFragment<V extends IView, P extends Presente
|
||||
}
|
||||
animationDrawable.selectDrawable(0);
|
||||
animationDrawable.start();
|
||||
} else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE == status){
|
||||
} else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE == status) {
|
||||
ctvAutopilotStatus.setClickable(true);
|
||||
mAutopilotTv.setText("自动驾驶");
|
||||
mAutopilotTv.setTextColor(getResources().getColor(R.color.taxi_autopilot_text_color_normal));
|
||||
mAutopilotImage.setImageResource(R.drawable.taxi_ic_autopilot);
|
||||
if (animationDrawable != null){
|
||||
if (animationDrawable != null) {
|
||||
animationDrawable.selectDrawable(0);
|
||||
animationDrawable.stop();
|
||||
}
|
||||
@@ -354,7 +350,7 @@ public abstract class BaseOchTaxiTabFragment<V extends IView, P extends Presente
|
||||
mAutopilotTv.setText("自动驾驶");
|
||||
mAutopilotTv.setTextColor(getResources().getColor(R.color.taxi_autopilot_text_color_disable));
|
||||
mAutopilotImage.setImageResource(R.drawable.taxi_ic_autopilot_disable);
|
||||
if (animationDrawable != null){
|
||||
if (animationDrawable != null) {
|
||||
animationDrawable.selectDrawable(0);
|
||||
animationDrawable.stop();
|
||||
}
|
||||
@@ -390,6 +386,7 @@ public abstract class BaseOchTaxiTabFragment<V extends IView, P extends Presente
|
||||
|
||||
private boolean isStarting = false;
|
||||
private ObjectAnimator autopilotLoadingAnimator;
|
||||
|
||||
public void startOrStopLoadingAnim(boolean start) {
|
||||
if (start) {
|
||||
isStarting = true;
|
||||
@@ -463,14 +460,14 @@ public abstract class BaseOchTaxiTabFragment<V extends IView, P extends Presente
|
||||
public abstract void restartAutopilot();
|
||||
|
||||
|
||||
public void changeOperationViewVisible(int visible){
|
||||
public void changeOperationViewVisible(int visible) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
if (tvOperationStatus == null) return;
|
||||
tvOperationStatus.setVisibility(visible);
|
||||
});
|
||||
}
|
||||
|
||||
public void updateSpeedView(float newSpeed){
|
||||
public void updateSpeedView(float newSpeed) {
|
||||
int speed = (int) (Math.abs(newSpeed) * 3.6F); // 倒车时工控机反馈定位信息中speed为负值
|
||||
mSpeedView.setText(String.valueOf(speed));
|
||||
}
|
||||
@@ -490,22 +487,22 @@ public abstract class BaseOchTaxiTabFragment<V extends IView, P extends Presente
|
||||
// CallerHmiManager.INSTANCE.setCheckStatusViewVisibility(View.GONE);
|
||||
// }
|
||||
|
||||
protected void showNaviToStartStationFragment(boolean isShow){
|
||||
protected void showNaviToStartStationFragment(boolean isShow) {
|
||||
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
|
||||
if (isShow){
|
||||
if (isShow) {
|
||||
// if (ochNaviFragment == null){
|
||||
ochNaviFragment = OCHNaviFragment.newInstance();
|
||||
ochNaviFragment = OCHNaviFragment.newInstance();
|
||||
// }
|
||||
if (ochNaviFragment.isAdded()){
|
||||
if (ochNaviFragment.isAdded()) {
|
||||
return;
|
||||
}
|
||||
transaction.add(R.id.module_mogo_och_navi_panel_container,ochNaviFragment).show(ochNaviFragment);
|
||||
transaction.add(R.id.module_mogo_och_navi_panel_container, ochNaviFragment).show(ochNaviFragment);
|
||||
transaction.commitAllowingStateLoss();
|
||||
mCloseNaviIcon.setVisibility(View.VISIBLE);
|
||||
flNaviPanelContainer.setVisibility(View.VISIBLE);
|
||||
CallerSmpManager.hidePanel();//隐藏小地图
|
||||
}else {
|
||||
if (ochNaviFragment != null){
|
||||
} else {
|
||||
if (ochNaviFragment != null) {
|
||||
ochNaviFragment.onDestroy();
|
||||
transaction.remove(ochNaviFragment);
|
||||
transaction.commitAllowingStateLoss();
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
@@ -25,6 +26,8 @@ import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/18
|
||||
@@ -314,17 +317,17 @@ public class OCHTaxiFragment extends BaseOchTaxiTabFragment<OCHTaxiFragment, OCH
|
||||
MogoOCHTaxiModelNew.getInstance().setOnTheWayToEndStation();
|
||||
});
|
||||
findViewById(R.id.test_bar_send_route).setOnClickListener(v -> {
|
||||
List<AutopilotRouteInfo.RouteModels> list = new ArrayList<>();
|
||||
List<MessagePad.Location> list = new ArrayList<>();
|
||||
for (int i = 0; i < 200 ; i++){
|
||||
AutopilotRouteInfo.RouteModels routeModels = new AutopilotRouteInfo.RouteModels();
|
||||
MessagePad.Location.Builder builder = MessagePad.Location.newBuilder();
|
||||
if (i <= 100){
|
||||
routeModels.setLat(40.199248903658166);
|
||||
routeModels.setLon(116.73435586102245 + i * 0.0001);
|
||||
builder.setLatitude(40.199248903658166);
|
||||
builder.setLongitude(116.73435586102245 + i * 0.0001);
|
||||
}else {
|
||||
routeModels.setLat(40.199248903658166 + i * 0.0001);
|
||||
routeModels.setLon(116.73435586102245 + 100 * 0.0001);
|
||||
builder.setLatitude(40.199248903658166 + i * 0.0001);
|
||||
builder.setLongitude(116.73435586102245 + 100 * 0.0001);
|
||||
}
|
||||
list.add(routeModels);
|
||||
list.add(builder.build());
|
||||
}
|
||||
MogoOCHTaxiModelNew.getInstance().updateOrderRoute(list);
|
||||
});
|
||||
@@ -346,4 +349,9 @@ public class OCHTaxiFragment extends BaseOchTaxiTabFragment<OCHTaxiFragment, OCH
|
||||
testBar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotIdentifyDataUpdate(List<MessagePad.TrackedObject> trafficData) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import kotlinx.coroutines.flow.*
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import record_cache.RecordPanelOuterClass
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
import java.util.concurrent.TimeUnit
|
||||
@@ -20,14 +21,15 @@ import kotlin.random.Random
|
||||
@LargeTest
|
||||
class AutoPilotBadCaseTest {
|
||||
|
||||
lateinit var launch: ActivityScenario<MainLauncherActivity>
|
||||
private lateinit var launch: ActivityScenario<MainLauncherActivity>
|
||||
|
||||
@Before
|
||||
fun launch() {
|
||||
launch = ActivityScenario.launch(MainLauncherActivity::class.java)
|
||||
}
|
||||
|
||||
@ExperimentalCoroutinesApi @Test
|
||||
@ExperimentalCoroutinesApi
|
||||
@Test
|
||||
fun showBadCaseEntrance1(): Unit = runBlocking(Dispatchers.Main) {
|
||||
delay(5000)
|
||||
var index = 0
|
||||
@@ -36,17 +38,19 @@ class AutoPilotBadCaseTest {
|
||||
.asFlow()
|
||||
.onEach {
|
||||
delay(TimeUnit.SECONDS.toMillis(5))
|
||||
CallerDevaToolsManager.onReceiveBadCaseRecord(AutoPilotRecordResult().also {
|
||||
val builder = RecordPanelOuterClass.RecordPanel.newBuilder()
|
||||
builder.also {
|
||||
it.diskFree = (100 + index).toLong()
|
||||
it.duration = 60.0
|
||||
it.fileName = "/user/general/record_$index.log"
|
||||
it.duration = 60.0.toFloat()
|
||||
it.filename = "/user/general/record_$index.log"
|
||||
it.id = 10 + index
|
||||
it.key = "yyy_$index"
|
||||
it.key = index.toLong()
|
||||
it.stat = 100
|
||||
it.type = 1
|
||||
it.timestamp = SimpleDateFormat("yyyyMMddHHmmss").format(Date())
|
||||
index++
|
||||
})
|
||||
}
|
||||
CallerDevaToolsManager.onReceiveBadCaseRecord(builder.build())
|
||||
}
|
||||
.flowOn(Dispatchers.Default)
|
||||
.collect()
|
||||
@@ -54,8 +58,9 @@ class AutoPilotBadCaseTest {
|
||||
}
|
||||
|
||||
|
||||
@ExperimentalCoroutinesApi @Test
|
||||
fun showBadCaseEntrance2():Unit = runBlocking(Dispatchers.Main) {
|
||||
@ExperimentalCoroutinesApi
|
||||
@Test
|
||||
fun showBadCaseEntrance2(): Unit = runBlocking(Dispatchers.Main) {
|
||||
delay(5000)
|
||||
var index = 0
|
||||
(1 until 50)
|
||||
@@ -67,24 +72,27 @@ class AutoPilotBadCaseTest {
|
||||
} else {
|
||||
delay(Random(20).nextLong())
|
||||
}
|
||||
CallerDevaToolsManager.onReceiveBadCaseRecord(AutoPilotRecordResult().also {
|
||||
val builder = RecordPanelOuterClass.RecordPanel.newBuilder()
|
||||
builder.also {
|
||||
it.diskFree = (100 + index).toLong()
|
||||
it.duration = 60.0
|
||||
it.fileName = "/user/general/record_$index.log"
|
||||
it.duration = 60.0.toFloat()
|
||||
it.filename = "/user/general/record_$index.log"
|
||||
it.id = 10 + index
|
||||
it.key = "yyy_$index"
|
||||
it.key = index.toLong()
|
||||
it.stat = 100
|
||||
it.type = 1
|
||||
it.timestamp = SimpleDateFormat("yyyyMMddHHmmss").format(Date())
|
||||
index++
|
||||
})
|
||||
}
|
||||
CallerDevaToolsManager.onReceiveBadCaseRecord(builder.build())
|
||||
}
|
||||
.flowOn(Dispatchers.Default)
|
||||
.collect()
|
||||
delay(TimeUnit.HOURS.toMillis(2))
|
||||
}
|
||||
|
||||
@ExperimentalCoroutinesApi @Test
|
||||
@ExperimentalCoroutinesApi
|
||||
@Test
|
||||
fun showBadCaseEntrance3(): Unit = runBlocking(Dispatchers.Main) {
|
||||
var index = 0
|
||||
(1 until 50)
|
||||
@@ -92,17 +100,19 @@ class AutoPilotBadCaseTest {
|
||||
.asFlow()
|
||||
.onEach {
|
||||
delay(TimeUnit.SECONDS.toMillis(20))
|
||||
CallerDevaToolsManager.onReceiveBadCaseRecord(AutoPilotRecordResult().also {
|
||||
val builder = RecordPanelOuterClass.RecordPanel.newBuilder()
|
||||
builder.also {
|
||||
it.diskFree = (100 + index).toLong()
|
||||
it.duration = 60.0
|
||||
it.fileName = "/user/general/record_$index.log"
|
||||
it.duration = 60.0.toFloat()
|
||||
it.filename = "/user/general/record_$index.log"
|
||||
it.id = 10 + index
|
||||
it.key = "yyy_$index"
|
||||
it.key = index.toLong()
|
||||
it.stat = 100
|
||||
it.type = 1
|
||||
it.timestamp = SimpleDateFormat("yyyyMMddHHmmss").format(Date())
|
||||
index++
|
||||
})
|
||||
}
|
||||
CallerDevaToolsManager.onReceiveBadCaseRecord(builder.build())
|
||||
}
|
||||
.flowOn(Dispatchers.Default)
|
||||
.collect()
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
android:label="@string/app_shell_name"
|
||||
android:largeHeap="true"
|
||||
android:resizeableActivity="false"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme.App"
|
||||
tools:replace="android:label">
|
||||
|
||||
@@ -40,7 +40,7 @@ public class MogoApplication extends MainMoGoApplication {
|
||||
|
||||
@Override
|
||||
protected void initCloudClientConfig() {
|
||||
// todo 使用旧Socket链路 true = 旧链路,false = 新链路
|
||||
// 使用旧Socket链路 true = 旧链路,false = 新链路
|
||||
if (DebugConfig.getProductFlavor().equals("fPadLenovoOchTaxi")
|
||||
|| DebugConfig.getProductFlavor().equals("fPadLenovoOchBus")
|
||||
|| DebugConfig.getProductFlavor().equals("fPadLenovoOchTaxiPassenger")
|
||||
|
||||
1
app_ipc_monitoring/README.md
Normal file
1
app_ipc_monitoring/README.md
Normal file
@@ -0,0 +1 @@
|
||||
# 工控机测试程序
|
||||
62
app_ipc_monitoring/build.gradle
Normal file
62
app_ipc_monitoring/build.gradle
Normal file
@@ -0,0 +1,62 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
buildToolsVersion "29.0.2"
|
||||
defaultConfig {
|
||||
applicationId "com.zhidao.adas.client"
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 22
|
||||
multiDexEnabled true
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
flavorDimensions "multi_device"
|
||||
|
||||
packagingOptions {
|
||||
//解决编译时com.android.builder.merge.DuplicateRelativeFileException: More than one file was found with OS independent path 'META-INF/rxjava.properties'这个错误
|
||||
exclude 'META-INF/rxjava.properties'
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
productFlavors {
|
||||
passenger {
|
||||
dimension "multi_device"
|
||||
buildConfigField 'boolean', 'IS_CLIENT', 'true'
|
||||
}
|
||||
driver {
|
||||
dimension "multi_device"
|
||||
buildConfigField 'boolean', 'IS_CLIENT', 'false'
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.2.0'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
implementation "com.google.code.gson:gson:2.8.9"
|
||||
implementation project(':libraries:mogo-adas')
|
||||
implementation project(':core:mogo-core-data')
|
||||
implementation project(':core:mogo-core-utils')
|
||||
// api "com.zhidao.support.adas:high:1.2.1.2_bate21"
|
||||
implementation 'org.greenrobot:eventbus:3.2.0'
|
||||
implementation 'com.android.support:multidex:1.0.3'
|
||||
implementation 'com.mogo.cloud:telematic:1.3.31'
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.zhidao.adas.client;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
|
||||
assertEquals("com.zhidao.adas.client", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
57
app_ipc_monitoring/src/main/AndroidManifest.xml
Normal file
57
app_ipc_monitoring/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.zhidao.adas.client">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.CALL_PHONE" />
|
||||
<uses-permission android:name="android.permission.OVERRIDE_WIFI_CONFIG" />
|
||||
<uses-permission android:name="android.permission.READ_CALL_LOG" />
|
||||
<uses-permission android:name="android.permission.WRITE_CALL_LOG" />
|
||||
<uses-permission android:name="com.android.voicemail.permission.ADD_VOICEMAIL" />
|
||||
<uses-permission android:name="android.permission.USE_SIP" />
|
||||
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.FLASHLIGHT" />
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" /> <!-- 用于进行网络定位 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <!-- 用于访问GPS定位 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/icon"
|
||||
android:label="@string/app_name"
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
|
||||
<activity
|
||||
android:name=".ui.mian.MainActivity"
|
||||
android:screenOrientation="landscape"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name=".ui.autopilot.AutopilotConfigActivity">
|
||||
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.zhidao.adas.client.base;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* RecycleView Adapter
|
||||
* Created by renfeicui on 2018/10/12.
|
||||
*/
|
||||
public abstract class BaseAdapter<D, VH extends BaseViewHolder> extends RecyclerView.Adapter<VH> {
|
||||
protected String TAG = this.getClass().getSimpleName();
|
||||
protected List<D> mDatas;
|
||||
protected Context mContext;
|
||||
private OnItemClickListener<D> mItemClick;
|
||||
|
||||
public interface OnItemClickListener<D> {
|
||||
void onItemClick(int position, D data);
|
||||
}
|
||||
|
||||
|
||||
public BaseAdapter() {
|
||||
}
|
||||
|
||||
public BaseAdapter(List<D> mDatas) {
|
||||
this.mDatas = mDatas;
|
||||
}
|
||||
|
||||
public BaseAdapter(OnItemClickListener<D> listener) {
|
||||
mItemClick = listener;
|
||||
}
|
||||
|
||||
public BaseAdapter(List<D> mDatas, OnItemClickListener<D> listener) {
|
||||
this.mDatas = mDatas;
|
||||
mItemClick = listener;
|
||||
}
|
||||
|
||||
public void setData(List<D> mDatas) {
|
||||
this.mDatas = mDatas;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener<D> listener) {
|
||||
mItemClick = listener;
|
||||
}
|
||||
|
||||
/***
|
||||
* 获取制定 位置的Data
|
||||
* @param position 下标
|
||||
* @return Data
|
||||
*/
|
||||
public D getItem(int position) {
|
||||
return mDatas == null ? null : mDatas.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mDatas == null ? 0 : mDatas.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull VH viewHolder, int position) {
|
||||
D bean = getItem(position);
|
||||
onBindDataToItem(viewHolder, bean, position);
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public VH onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) {
|
||||
mContext = viewGroup.getContext();
|
||||
return getViewHolder(getItemViewResource(viewGroup));
|
||||
}
|
||||
|
||||
/***
|
||||
* 同onBindViewHolder()
|
||||
* @param viewHolder viewHolder
|
||||
* @param data 数据
|
||||
* @param position 下标
|
||||
*/
|
||||
protected abstract void onBindDataToItem(VH viewHolder, D data, int position);
|
||||
|
||||
/***
|
||||
* 获取Item布局
|
||||
* @return id
|
||||
*/
|
||||
protected abstract View getItemViewResource(ViewGroup viewGroup);
|
||||
|
||||
/**
|
||||
* 获取ViewHolder
|
||||
*
|
||||
* @param view
|
||||
* @return
|
||||
*/
|
||||
protected abstract VH getViewHolder(View view);
|
||||
|
||||
public void onClick(BaseViewHolder viewHolder) {
|
||||
if (mItemClick != null) {
|
||||
mItemClick.onItemClick(viewHolder.getAdapterPosition(), getItem(viewHolder.getAdapterPosition()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.zhidao.adas.client.base;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
|
||||
public abstract class BaseViewHolder<T extends BaseAdapter> extends RecyclerView.ViewHolder {
|
||||
private T adapter;
|
||||
public View itemView;
|
||||
|
||||
public BaseViewHolder(View itemView, final T adapter) {
|
||||
super(itemView);
|
||||
this.itemView = itemView;
|
||||
this.adapter = adapter;
|
||||
itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
adapter.onClick(BaseViewHolder.this);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class ArrivalNotification extends Base {
|
||||
public final MessagePad.ArrivalNotification bean;
|
||||
|
||||
public ArrivalNotification(MessagePad.Header header, MessagePad.ArrivalNotification bean) {
|
||||
super(bean.getSerializedSize(), header);
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + "Data:" + TextFormat.printer().escapingNonAscii(false).printToString(bean);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class AutopilotState extends Base {
|
||||
public final MessagePad.AutopilotState bean;
|
||||
|
||||
public AutopilotState(MessagePad.Header header, MessagePad.AutopilotState bean) {
|
||||
super(bean.getSerializedSize(), header);
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + "Data:" + TextFormat.printer().escapingNonAscii(false).printToString(bean);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public abstract class Base {
|
||||
public final MessagePad.Header header;
|
||||
public final int len;
|
||||
|
||||
public Base(int len, MessagePad.Header header) {
|
||||
this.len = 8 + header.getSerializedSize() + len;
|
||||
this.header = header;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return len + "##Header:[" + TextFormat.printer().escapingNonAscii(false).shortDebugString(header)+"]\n";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class BasicInfoReq extends Base {
|
||||
public final MessagePad.BasicInfoReq bean;
|
||||
|
||||
public BasicInfoReq(MessagePad.Header header, MessagePad.BasicInfoReq bean) {
|
||||
super(bean.getSerializedSize(), header);
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + "Data:" + TextFormat.printer().escapingNonAscii(false).printToString(bean);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class CarConfigResp extends Base {
|
||||
public final MessagePad.CarConfigResp bean;
|
||||
|
||||
public CarConfigResp(MessagePad.Header header, MessagePad.CarConfigResp bean) {
|
||||
super(bean.getSerializedSize(), header);
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + "Data:" + TextFormat.printer().escapingNonAscii(false).printToString(bean);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
public class Config {
|
||||
public final String name;
|
||||
public final String value;
|
||||
|
||||
public Config(String name, String value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import com.zhidao.support.adas.high.common.DigitalTrans;
|
||||
import com.zhidao.support.adas.high.common.ProtocolStatus;
|
||||
|
||||
public class ErrorData {
|
||||
private final ProtocolStatus status;
|
||||
private final byte[] bytes;
|
||||
|
||||
public ErrorData(ProtocolStatus status, byte[] bytes) {
|
||||
this.status = status;
|
||||
this.bytes = bytes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return status + "\n原始数据:" + DigitalTrans.byte2HexStr(bytes);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class GlobalPathResp extends Base {
|
||||
public final MessagePad.GlobalPathResp bean;
|
||||
|
||||
public GlobalPathResp(MessagePad.Header header, MessagePad.GlobalPathResp bean) {
|
||||
super(bean.getSerializedSize(), header);
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + "Data:" + TextFormat.printer().escapingNonAscii(false).printToString(bean);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class GnssInfo extends Base {
|
||||
public final MessagePad.GnssInfo bean;
|
||||
|
||||
public GnssInfo(MessagePad.Header header, MessagePad.GnssInfo bean) {
|
||||
super(bean.getSerializedSize(), header);
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + "Data:" + TextFormat.printer().escapingNonAscii(false).printToString(bean);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
|
||||
public class MogoReportMessage extends Base {
|
||||
public final MogoReportMsg.MogoReportMessage bean;
|
||||
|
||||
public MogoReportMessage(MessagePad.Header header, MogoReportMsg.MogoReportMessage bean) {
|
||||
super(bean.getSerializedSize(), header);
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + "Data:" + TextFormat.printer().escapingNonAscii(false).printToString(bean);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import record_cache.RecordPanelOuterClass;
|
||||
|
||||
public class RecordPanel extends Base {
|
||||
public final RecordPanelOuterClass.RecordPanel bean;
|
||||
|
||||
public RecordPanel(MessagePad.Header header, RecordPanelOuterClass.RecordPanel bean) {
|
||||
super(bean.getSerializedSize(), header);
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + "Data:" + TextFormat.printer().escapingNonAscii(false).printToString(bean);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class TrackedObjects extends Base {
|
||||
private MessagePad.TrackedObjects bean;
|
||||
|
||||
public TrackedObjects(MessagePad.Header header, MessagePad.TrackedObjects bean) {
|
||||
super(bean.getSerializedSize(), header);
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + "Data:" + TextFormat.printer().escapingNonAscii(false).printToString(bean);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class Trajectory extends Base {
|
||||
public final MessagePad.Trajectory bean;
|
||||
|
||||
public Trajectory(MessagePad.Header header, MessagePad.Trajectory bean) {
|
||||
super(bean.getSerializedSize(), header);
|
||||
this.bean = bean;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + "Data:" + TextFormat.printer().escapingNonAscii(false).printToString(bean);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
import chassis.VehicleStateOuterClass;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class VehicleState extends Base {
|
||||
public final VehicleStateOuterClass.VehicleState bean;
|
||||
|
||||
public VehicleState(MessagePad.Header header, VehicleStateOuterClass.VehicleState bean) {
|
||||
super(bean.getSerializedSize(), header);
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + "Data:" + TextFormat.printer().escapingNonAscii(false).printToString(bean);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class Warn extends Base {
|
||||
public final MessagePad.Warn bean;
|
||||
|
||||
public Warn(MessagePad.Header header, MessagePad.Warn bean) {
|
||||
super(bean.getSerializedSize(), header);
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + "Data:" + TextFormat.printer().escapingNonAscii(false).printToString(bean);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.zhidao.adas.client.ui.autopilot;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AiCloudToStartAutopilot {
|
||||
|
||||
private String action = "aiCloudToStartAutopilot";
|
||||
public ResultDTO result;
|
||||
|
||||
public static class ResultDTO {
|
||||
public EndLatLonDTO endLatLon;
|
||||
public Integer speedLimit = 20;
|
||||
public StartLatLonDTO startLatLon;
|
||||
public List<WayLatLonsDTO> wayLatLons;
|
||||
|
||||
public static class EndLatLonDTO {
|
||||
public Double lat;
|
||||
public Double lon;
|
||||
}
|
||||
|
||||
public static class StartLatLonDTO {
|
||||
public Double lat;
|
||||
public Double lon;
|
||||
}
|
||||
|
||||
public static class WayLatLonsDTO {
|
||||
public Double lat;
|
||||
public Double lon;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,305 @@
|
||||
package com.zhidao.adas.client.ui.autopilot;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Switch;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.utils.Constants;
|
||||
import com.zhidao.adas.client.utils.PreferencesUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class AutopilotConfigActivity extends AppCompatActivity {
|
||||
|
||||
public static void launch(Context context) {
|
||||
Intent intent = new Intent(context,AutopilotConfigActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
private Gson gson = new Gson();
|
||||
private EditText start_lon1;
|
||||
private EditText start_lat1;
|
||||
private EditText stop_lon1;
|
||||
private EditText stop_lat1;
|
||||
private EditText t_lon1;
|
||||
private EditText t_lat1;
|
||||
|
||||
private EditText start_lon2;
|
||||
private EditText start_lat2;
|
||||
private EditText stop_lon2;
|
||||
private EditText stop_lat2;
|
||||
private EditText t_lon2;
|
||||
private EditText t_lat2;
|
||||
|
||||
private EditText start_lon3;
|
||||
private EditText start_lat3;
|
||||
private EditText stop_lon3;
|
||||
private EditText stop_lat3;
|
||||
private EditText t_lon3;
|
||||
private EditText t_lat3;
|
||||
|
||||
private EditText start_lon4;
|
||||
private EditText start_lat4;
|
||||
private EditText stop_lon4;
|
||||
private EditText stop_lat4;
|
||||
private EditText t_lon4;
|
||||
private EditText t_lat4;
|
||||
private List<AiCloudToStartAutopilot> list;
|
||||
|
||||
AiCloudToStartAutopilot data1;
|
||||
AiCloudToStartAutopilot data2;
|
||||
AiCloudToStartAutopilot data3;
|
||||
AiCloudToStartAutopilot data4;
|
||||
private String init_all_path = "[\n" +
|
||||
" {\n" +
|
||||
" \"action\": \"aiCloudToStartAutopilot\",\n" +
|
||||
" \"result\": {\n" +
|
||||
" \"endLatLon\": {\n" +
|
||||
" \"lat\": 26.82355278566775,\n" +
|
||||
" \"lon\": 112.57001723522112\n" +
|
||||
" },\n" +
|
||||
" \"speedLimit\": 20,\n" +
|
||||
" \"startLatLon\": {\n" +
|
||||
" \"lat\": 26.820319143036112,\n" +
|
||||
" \"lon\": 112.57770688564666\n" +
|
||||
" },\n" +
|
||||
" \"wayLatLons\": [{\n" +
|
||||
" \"lat\": 40.1984044,\n" +
|
||||
" \"lon\": 116.7323222\n" +
|
||||
" }]\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" {\n" +
|
||||
" \"action\": \"aiCloudToStartAutopilot\",\n" +
|
||||
" \"result\": {\n" +
|
||||
" \"endLatLon\": {\n" +
|
||||
" \"lat\": 40.1979005,\n" +
|
||||
" \"lon\": 116.7261382\n" +
|
||||
" },\n" +
|
||||
" \"speedLimit\": 20,\n" +
|
||||
" \"startLatLon\": {\n" +
|
||||
" \"lat\": 40.1992337,\n" +
|
||||
" \"lon\": 116.7386131\n" +
|
||||
" },\n" +
|
||||
" \"wayLatLons\": [{\n" +
|
||||
" \"lat\": 40.1984044,\n" +
|
||||
" \"lon\": 116.7323222\n" +
|
||||
" }]\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" {\n" +
|
||||
" \"action\": \"aiCloudToStartAutopilot\",\n" +
|
||||
" \"result\": {\n" +
|
||||
" \"endLatLon\": {\n" +
|
||||
" \"lat\": 40.1979005,\n" +
|
||||
" \"lon\": 116.7261382\n" +
|
||||
" },\n" +
|
||||
" \"speedLimit\": 20,\n" +
|
||||
" \"startLatLon\": {\n" +
|
||||
" \"lat\": 40.1992337,\n" +
|
||||
" \"lon\": 116.7386131\n" +
|
||||
" },\n" +
|
||||
" \"wayLatLons\": [{\n" +
|
||||
" \"lat\": 40.1984044,\n" +
|
||||
" \"lon\": 116.7323222\n" +
|
||||
" }]\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" {\n" +
|
||||
" \"action\": \"aiCloudToStartAutopilot\",\n" +
|
||||
" \"result\": {\n" +
|
||||
" \"endLatLon\": {\n" +
|
||||
" \"lat\": 40.1979005,\n" +
|
||||
" \"lon\": 116.7261382\n" +
|
||||
" },\n" +
|
||||
" \"speedLimit\": 20,\n" +
|
||||
" \"startLatLon\": {\n" +
|
||||
" \"lat\": 40.1992337,\n" +
|
||||
" \"lon\": 116.7386131\n" +
|
||||
" },\n" +
|
||||
" \"wayLatLons\": [{\n" +
|
||||
" \"lat\": 40.1984044,\n" +
|
||||
" \"lon\": 116.7323222\n" +
|
||||
" }]\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
"]";
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_autopilot_cloud_config);
|
||||
start_lon1 = findViewById(R.id.start_lon1);
|
||||
start_lat1 = findViewById(R.id.start_lat1);
|
||||
stop_lon1 = findViewById(R.id.stop_lon1);
|
||||
stop_lat1 = findViewById(R.id.stop_lat1);
|
||||
t_lon1 = findViewById(R.id.t_lon1);
|
||||
t_lat1 = findViewById(R.id.t_lat1);
|
||||
|
||||
start_lon2 = findViewById(R.id.start_lon2);
|
||||
start_lat2 = findViewById(R.id.start_lat2);
|
||||
stop_lon2 = findViewById(R.id.stop_lon2);
|
||||
stop_lat2 = findViewById(R.id.stop_lat2);
|
||||
t_lon2 = findViewById(R.id.t_lon2);
|
||||
t_lat2 = findViewById(R.id.t_lat2);
|
||||
|
||||
start_lon3 = findViewById(R.id.start_lon3);
|
||||
start_lat3 = findViewById(R.id.start_lat3);
|
||||
stop_lon3 = findViewById(R.id.stop_lon3);
|
||||
stop_lat3 = findViewById(R.id.stop_lat3);
|
||||
t_lon3 = findViewById(R.id.t_lon3);
|
||||
t_lat3 = findViewById(R.id.t_lat3);
|
||||
|
||||
start_lon4 = findViewById(R.id.start_lon4);
|
||||
start_lat4 = findViewById(R.id.start_lat4);
|
||||
stop_lon4 = findViewById(R.id.stop_lon4);
|
||||
stop_lat4 = findViewById(R.id.stop_lat4);
|
||||
t_lon4 = findViewById(R.id.t_lon4);
|
||||
t_lat4 = findViewById(R.id.t_lat4);
|
||||
//开始执行
|
||||
final Button button = findViewById(R.id.start);
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String json = PreferencesUtils.getString(AutopilotConfigActivity.this, Constants.SEL_PATH, null);
|
||||
if (TextUtils.isEmpty(json)) {
|
||||
Toast.makeText(AutopilotConfigActivity.this, "请先选择路线", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
json = json.split("##")[1];
|
||||
Log.i("开始执行自动驾驶", json);
|
||||
// AdasManager.getInstance().aiCloudToAdasData(json);
|
||||
}
|
||||
});
|
||||
findViewById(R.id.save).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
data1.result.startLatLon.lon = Double.parseDouble(start_lon1.getText().toString().trim());
|
||||
data1.result.startLatLon.lat = Double.parseDouble(start_lat1.getText().toString().trim());
|
||||
data1.result.endLatLon.lon = Double.parseDouble(stop_lon1.getText().toString().trim());
|
||||
data1.result.endLatLon.lat = Double.parseDouble(stop_lat1.getText().toString().trim());
|
||||
data1.result.wayLatLons.get(0).lon = Double.parseDouble(t_lon1.getText().toString().trim());
|
||||
data1.result.wayLatLons.get(0).lat = Double.parseDouble(t_lat1.getText().toString().trim());
|
||||
|
||||
|
||||
data2.result.startLatLon.lon = Double.parseDouble(start_lon2.getText().toString().trim());
|
||||
data2.result.startLatLon.lat = Double.parseDouble(start_lat2.getText().toString().trim());
|
||||
data2.result.endLatLon.lon = Double.parseDouble(stop_lon2.getText().toString().trim());
|
||||
data2.result.endLatLon.lat = Double.parseDouble(stop_lat2.getText().toString().trim());
|
||||
data2.result.wayLatLons.get(0).lon = Double.parseDouble(t_lon2.getText().toString().trim());
|
||||
data2.result.wayLatLons.get(0).lat = Double.parseDouble(t_lat2.getText().toString().trim());
|
||||
|
||||
|
||||
data3.result.startLatLon.lon = Double.parseDouble(start_lon3.getText().toString().trim());
|
||||
data3.result.startLatLon.lat = Double.parseDouble(start_lat3.getText().toString().trim());
|
||||
data3.result.endLatLon.lon = Double.parseDouble(stop_lon3.getText().toString().trim());
|
||||
data3.result.endLatLon.lat = Double.parseDouble(stop_lat3.getText().toString().trim());
|
||||
data3.result.wayLatLons.get(0).lon = Double.parseDouble(t_lon3.getText().toString().trim());
|
||||
data3.result.wayLatLons.get(0).lat = Double.parseDouble(t_lat3.getText().toString().trim());
|
||||
|
||||
|
||||
data4.result.startLatLon.lon = Double.parseDouble(start_lon4.getText().toString().trim());
|
||||
data4.result.startLatLon.lat = Double.parseDouble(start_lat4.getText().toString().trim());
|
||||
data4.result.endLatLon.lon = Double.parseDouble(stop_lon4.getText().toString().trim());
|
||||
data4.result.endLatLon.lat = Double.parseDouble(stop_lat4.getText().toString().trim());
|
||||
data4.result.wayLatLons.get(0).lon = Double.parseDouble(t_lon4.getText().toString().trim());
|
||||
data4.result.wayLatLons.get(0).lat = Double.parseDouble(t_lat4.getText().toString().trim());
|
||||
|
||||
|
||||
PreferencesUtils.putString(AutopilotConfigActivity.this, Constants.ALL_PATH, gson.toJson(list));
|
||||
}
|
||||
});
|
||||
View path1 = findViewById(R.id.path1);
|
||||
View path2 = findViewById(R.id.path2);
|
||||
View path3 = findViewById(R.id.path3);
|
||||
View path4 = findViewById(R.id.path4);
|
||||
path1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(AutopilotConfigActivity.this, "已设置路线1", Toast.LENGTH_SHORT).show();
|
||||
PreferencesUtils.putString(AutopilotConfigActivity.this, Constants.SEL_PATH, "1##" + gson.toJson(list.get(0)));
|
||||
button.setText("开始执行自动驾驶(路线1)");
|
||||
}
|
||||
});
|
||||
path2.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(AutopilotConfigActivity.this, "已设置路线2", Toast.LENGTH_SHORT).show();
|
||||
PreferencesUtils.putString(AutopilotConfigActivity.this, Constants.SEL_PATH, "2##" + gson.toJson(list.get(1)));
|
||||
button.setText("开始执行自动驾驶(路线2)");
|
||||
}
|
||||
});
|
||||
path3.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(AutopilotConfigActivity.this, "已设置路线3", Toast.LENGTH_SHORT).show();
|
||||
PreferencesUtils.putString(AutopilotConfigActivity.this, Constants.SEL_PATH, "3##" + gson.toJson(list.get(2)));
|
||||
button.setText("开始执行自动驾驶(路线3)");
|
||||
}
|
||||
});
|
||||
path4.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(AutopilotConfigActivity.this, "已设置路线4", Toast.LENGTH_SHORT).show();
|
||||
PreferencesUtils.putString(AutopilotConfigActivity.this, Constants.SEL_PATH, "4##" + gson.toJson(list.get(3)));
|
||||
button.setText("开始执行自动驾驶(路线4)");
|
||||
}
|
||||
});
|
||||
|
||||
String allPath = PreferencesUtils.getString(AutopilotConfigActivity.this, Constants.ALL_PATH, init_all_path);
|
||||
list = gson.fromJson(allPath, new TypeToken<List<AiCloudToStartAutopilot>>() {
|
||||
}.getType());
|
||||
data1 = list.get(0);
|
||||
data2 = list.get(1);
|
||||
data3 = list.get(2);
|
||||
data4 = list.get(3);
|
||||
start_lon1.setText(String.valueOf(data1.result.startLatLon.lon));
|
||||
start_lat1.setText(String.valueOf(data1.result.startLatLon.lat));
|
||||
stop_lon1.setText(String.valueOf(data1.result.endLatLon.lon));
|
||||
stop_lat1.setText(String.valueOf(data1.result.endLatLon.lat));
|
||||
t_lon1.setText(String.valueOf(data1.result.wayLatLons.get(0).lon));
|
||||
t_lat1.setText(String.valueOf(data1.result.wayLatLons.get(0).lat));
|
||||
|
||||
start_lon2.setText(String.valueOf(data2.result.startLatLon.lon));
|
||||
start_lat2.setText(String.valueOf(data2.result.startLatLon.lat));
|
||||
stop_lon2.setText(String.valueOf(data2.result.endLatLon.lon));
|
||||
stop_lat2.setText(String.valueOf(data2.result.endLatLon.lat));
|
||||
t_lon2.setText(String.valueOf(data2.result.wayLatLons.get(0).lon));
|
||||
t_lat2.setText(String.valueOf(data2.result.wayLatLons.get(0).lat));
|
||||
|
||||
start_lon3.setText(String.valueOf(data3.result.startLatLon.lon));
|
||||
start_lat3.setText(String.valueOf(data3.result.startLatLon.lat));
|
||||
stop_lon3.setText(String.valueOf(data3.result.endLatLon.lon));
|
||||
stop_lat3.setText(String.valueOf(data3.result.endLatLon.lat));
|
||||
t_lon3.setText(String.valueOf(data3.result.wayLatLons.get(0).lon));
|
||||
t_lat3.setText(String.valueOf(data3.result.wayLatLons.get(0).lat));
|
||||
|
||||
start_lon4.setText(String.valueOf(data4.result.startLatLon.lon));
|
||||
start_lat4.setText(String.valueOf(data4.result.startLatLon.lat));
|
||||
stop_lon4.setText(String.valueOf(data4.result.endLatLon.lon));
|
||||
stop_lat4.setText(String.valueOf(data4.result.endLatLon.lat));
|
||||
t_lon4.setText(String.valueOf(data4.result.wayLatLons.get(0).lon));
|
||||
t_lat4.setText(String.valueOf(data4.result.wayLatLons.get(0).lat));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.zhidao.adas.client.ui.mian;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.base.BaseAdapter;
|
||||
import com.zhidao.adas.client.base.BaseViewHolder;
|
||||
import com.zhidao.adas.client.bean.Config;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/8/13
|
||||
*/
|
||||
public class ConfigAdapter extends BaseAdapter<Config, ConfigAdapter.ViewHolder> {
|
||||
|
||||
|
||||
public ConfigAdapter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(List<Config> mDatas) {
|
||||
super.setData(mDatas);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBindDataToItem(ViewHolder viewHolder, Config data, int position) {
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
viewHolder.name.setText(data.name);
|
||||
viewHolder.value.setText(data.value);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected View getItemViewResource(ViewGroup viewGroup) {
|
||||
return LayoutInflater.from(mContext).inflate(R.layout.item_config, viewGroup, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ViewHolder getViewHolder(View view) {
|
||||
return new ViewHolder(view, this);
|
||||
}
|
||||
|
||||
class ViewHolder extends BaseViewHolder<ConfigAdapter> {
|
||||
TextView name;
|
||||
TextView value;
|
||||
|
||||
public ViewHolder(View itemView, ConfigAdapter adapter) {
|
||||
super(itemView, adapter);
|
||||
name = itemView.findViewById(R.id.name);
|
||||
value = itemView.findViewById(R.id.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.zhidao.adas.client.ui.mian;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.graphics.Color;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.base.BaseAdapter;
|
||||
import com.zhidao.adas.client.base.BaseViewHolder;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
|
||||
//log所用
|
||||
public class DataShowAdapter extends BaseAdapter<String, DataShowAdapter.ViewHolder> {
|
||||
private final int[] colors = {Color.parseColor("#FA8072"), Color.parseColor("#FF00FF"), Color.parseColor("#228B22"), Color.parseColor("#871f78")};
|
||||
private final Random random = new Random();
|
||||
|
||||
public void refreshView(int position) {
|
||||
if (position == -1) {
|
||||
notifyDataSetChanged();
|
||||
} else {
|
||||
notifyItemInserted(position);
|
||||
}
|
||||
// notifyDataSetChanged();
|
||||
// L.i(TAG, "position=" + position);
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
protected void onBindDataToItem(ViewHolder viewHolder, String data, int position) {
|
||||
if (data.contains("##")) {
|
||||
String[] temp = data.split("##");
|
||||
viewHolder.id.setText("[" + temp[0] + "]" + (position + 1) + ". ");
|
||||
viewHolder.editText.setTextColor(colors[random.nextInt(4)]);
|
||||
viewHolder.editText.setText(temp[1]);
|
||||
} else {
|
||||
viewHolder.id.setText((position + 1) + ". ");
|
||||
viewHolder.editText.setTextColor(colors[random.nextInt(4)]);
|
||||
viewHolder.editText.setText(data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected View getItemViewResource(ViewGroup viewGroup) {
|
||||
return LayoutInflater.from(mContext).inflate(R.layout.item_log_info, viewGroup, false);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected ViewHolder getViewHolder(View view) {
|
||||
return new ViewHolder(view, this);
|
||||
}
|
||||
|
||||
|
||||
class ViewHolder extends BaseViewHolder<DataShowAdapter> {
|
||||
EditText editText;
|
||||
TextView id;
|
||||
|
||||
public ViewHolder(View itemView, DataShowAdapter adapter) {
|
||||
super(itemView, adapter);
|
||||
editText = itemView.findViewById(R.id.log);
|
||||
id = itemView.findViewById(R.id.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,273 @@
|
||||
package com.zhidao.adas.client.ui.mian;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.bean.ArrivalNotification;
|
||||
import com.zhidao.adas.client.bean.AutopilotState;
|
||||
import com.zhidao.adas.client.bean.ErrorData;
|
||||
import com.zhidao.adas.client.bean.GlobalPathResp;
|
||||
import com.zhidao.adas.client.bean.GnssInfo;
|
||||
import com.zhidao.adas.client.bean.RecordPanel;
|
||||
import com.zhidao.adas.client.bean.TrackedObjects;
|
||||
import com.zhidao.adas.client.bean.Trajectory;
|
||||
import com.zhidao.adas.client.bean.VehicleState;
|
||||
import com.zhidao.adas.client.bean.Warn;
|
||||
import com.zhidao.adas.client.utils.MyLinearLayoutManager;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
import com.zhidao.support.adas.high.msg.ReportMessage;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/8/16
|
||||
*/
|
||||
public class InfoFragment extends Fragment {
|
||||
|
||||
private String title;
|
||||
private final List<String> data = new ArrayList<>();
|
||||
private DataShowAdapter adapter;
|
||||
|
||||
public InfoFragment() {
|
||||
}
|
||||
|
||||
public InfoFragment(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_info, container, false);
|
||||
initView(view);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
private TextView tvTitle;
|
||||
private RecyclerView rvInfo;
|
||||
|
||||
private void initView(View view) {
|
||||
tvTitle = view.findViewById(R.id.tv_title);
|
||||
rvInfo = view.findViewById(R.id.rv_info);
|
||||
|
||||
CupidLogUtils.w("InfoFragment===>" + title);
|
||||
tvTitle.setText(title);
|
||||
tvTitle.setGravity(Gravity.CENTER);
|
||||
//创建默认的线性LayoutManager 横向的GridLayoutManager
|
||||
MyLinearLayoutManager linearLayoutManager = new MyLinearLayoutManager(this.getContext());
|
||||
linearLayoutManager.setStackFromEnd(true);//列表再底部开始展示,反转后由上面开始展示
|
||||
// linearLayoutManager.setReverseLayout(true);//列表翻转
|
||||
rvInfo.setLayoutManager(linearLayoutManager);
|
||||
//如果可以确定每个item的高度是固定的,设置这个选项可以提高性能
|
||||
rvInfo.setHasFixedSize(false);
|
||||
rvInfo.setNestedScrollingEnabled(false);
|
||||
adapter = new DataShowAdapter();
|
||||
adapter.setData(data);
|
||||
rvInfo.setAdapter(adapter);
|
||||
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onWarnEvent(Warn info) {
|
||||
if (title.equals(MainActivity.TITLE.RECEIVE_WARN)) {
|
||||
if (data.size() > 9) {
|
||||
data.remove(0);
|
||||
}
|
||||
data.add(info.toString());
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onRectEvent(TrackedObjects info) {
|
||||
if (title.equals(MainActivity.TITLE.RECEIVE_TRACKED_OBJECTS)) {
|
||||
if (data.size() > 4) {
|
||||
data.remove(0);
|
||||
}
|
||||
data.add(info.toString());
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onErrorEvent(ErrorData info) {
|
||||
if (title.equals(MainActivity.TITLE.RECEIVE_ERROR)) {
|
||||
if (data.size() > 19) {
|
||||
data.remove(0);
|
||||
}
|
||||
data.add(info.toString());
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void onTurnLightState(int turnLight, boolean brake_light) {
|
||||
StringBuilder builder = new StringBuilder(MainActivity.TITLE.RECEIVE_VEHICLE_STATE + "\t");
|
||||
if (turnLight == 0) {
|
||||
builder.append("左转:关");
|
||||
builder.append("右转:关");
|
||||
} else if (turnLight == 1) {
|
||||
builder.append("左转:开");
|
||||
builder.append("右转:关");
|
||||
} else if (turnLight == 2) {
|
||||
builder.append("左转:关");
|
||||
builder.append("右转:开");
|
||||
}
|
||||
|
||||
builder.append(brake_light ? " 刹车:开" : " 刹车:关");
|
||||
tvTitle.setText(builder.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析转向灯
|
||||
*/
|
||||
private int turnLightTimes = 0;
|
||||
private boolean isOnTurnLight = false;
|
||||
private int turnLight = 0;
|
||||
|
||||
public int setTurnLightState(int turn_light) {
|
||||
if (turn_light == 0) {
|
||||
if (isOnTurnLight) {
|
||||
if (turnLightTimes >= 10) {
|
||||
isOnTurnLight = false;
|
||||
turnLight = 0;
|
||||
}
|
||||
turnLightTimes++;
|
||||
}
|
||||
} else if (turn_light == 1) {
|
||||
turnLightTimes = 0;
|
||||
isOnTurnLight = true;
|
||||
turnLight = 1;
|
||||
} else if (turn_light == 2) {
|
||||
turnLightTimes = 0;
|
||||
isOnTurnLight = true;
|
||||
turnLight = 2;
|
||||
}
|
||||
return turnLight;
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onCarEvent(VehicleState info) {
|
||||
if (title.equals(MainActivity.TITLE.RECEIVE_VEHICLE_STATE)) {
|
||||
if (data.size() > 5) {
|
||||
data.remove(0);
|
||||
}
|
||||
data.add(info.toString());
|
||||
adapter.notifyDataSetChanged();
|
||||
int light = info.bean.getLight().getNumber();//转向灯状态 0是正常 1是左转 2是右转
|
||||
onTurnLightState(setTurnLightState(light), info.bean.getBrakeLightStatus());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onAutoEvent(GnssInfo info) {
|
||||
if (title.equals(MainActivity.TITLE.RECEIVE_GNSS_INFO)) {
|
||||
if (data.size() > 9) {
|
||||
data.remove(0);
|
||||
}
|
||||
data.add(info.toString());
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onAutoEvent(AutopilotState info) {
|
||||
if (title.equals(MainActivity.TITLE.RECEIVE_AUTOPILOT_STATE)) {
|
||||
if (data.size() > 9) {
|
||||
data.remove(0);
|
||||
}
|
||||
data.add(info.toString());
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onTrajectoryEvent(Trajectory info) {
|
||||
if (title.equals(MainActivity.TITLE.RECEIVE_TRAJECTORY)) {
|
||||
if (data.size() > 9) {
|
||||
data.remove(0);
|
||||
}
|
||||
data.add(info.toString());
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onAutopilotWayArriveEvent(ArrivalNotification info) {
|
||||
if (title.equals(MainActivity.TITLE.RECEIVE_ARRIVAL_NOTIFICATION)) {
|
||||
data.add(info.toString());
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onAutopilotRouteEvent(GlobalPathResp info) {
|
||||
if (title.equals(MainActivity.TITLE.RECEIVE_GLOBAL_PATH_RESP)) {
|
||||
data.add(info.toString());
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onAutopilotRecordResultEvent(RecordPanel info) {
|
||||
if (title.equals(MainActivity.TITLE.RECEIVE_RECORD_RESULT)) {
|
||||
data.add(info.toString());
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onAutopilotGuardianInfoEvent(ReportMessage info) {
|
||||
if (title.equals(MainActivity.TITLE.RECEIVE_REPORT_MESSAGE)) {
|
||||
data.add(info.toString());
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.zhidao.adas.client.ui.mian;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.base.BaseAdapter;
|
||||
import com.zhidao.adas.client.base.BaseViewHolder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/8/13
|
||||
*/
|
||||
public class InfoTitleAdapter extends BaseAdapter<String, InfoTitleAdapter.ViewHolder> {
|
||||
private int selectedPosition = 0;//当前选中的下标
|
||||
private boolean isFragment = false;
|
||||
|
||||
public void setSelectedPosition(int position) {
|
||||
if (position != selectedPosition) {
|
||||
notifyItemChanged(position);
|
||||
notifyItemChanged(selectedPosition);
|
||||
selectedPosition = position;
|
||||
}
|
||||
}
|
||||
public InfoTitleAdapter(List<String> data, boolean isFragment) {
|
||||
super(data);
|
||||
this.isFragment = isFragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBindDataToItem(ViewHolder viewHolder, String data, int position) {
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
if (isFragment){
|
||||
viewHolder.itemView.setSelected(selectedPosition == position);
|
||||
}
|
||||
viewHolder.title.setText(data);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected View getItemViewResource(ViewGroup viewGroup) {
|
||||
return LayoutInflater.from(mContext).inflate(R.layout.item_info, viewGroup, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ViewHolder getViewHolder(View view) {
|
||||
return new ViewHolder(view, this);
|
||||
}
|
||||
|
||||
class ViewHolder extends BaseViewHolder<InfoTitleAdapter> {
|
||||
TextView title;
|
||||
|
||||
public ViewHolder(View itemView, InfoTitleAdapter adapter) {
|
||||
super(itemView, adapter);
|
||||
title = itemView.findViewById(R.id.tv_info_title);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,995 @@
|
||||
package com.zhidao.adas.client.ui.mian;
|
||||
|
||||
import static com.mogo.telematic.MogoProtocolMsg.NORMAL_DATA;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.AppCompatButton;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.SimpleItemAnimator;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.mogo.telematic.MogoProtocolMsg;
|
||||
import com.mogo.telematic.NSDNettyManager;
|
||||
import com.mogo.telematic.client.listener.NettyClientListener;
|
||||
import com.mogo.telematic.client.status.ConnectState;
|
||||
import com.mogo.telematic.server.netty.NettyServerListener;
|
||||
import com.zhidao.adas.client.BuildConfig;
|
||||
import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.base.BaseAdapter;
|
||||
import com.zhidao.adas.client.bean.ArrivalNotification;
|
||||
import com.zhidao.adas.client.bean.AutopilotState;
|
||||
import com.zhidao.adas.client.bean.BasicInfoReq;
|
||||
import com.zhidao.adas.client.bean.CarConfigResp;
|
||||
import com.zhidao.adas.client.bean.ErrorData;
|
||||
import com.zhidao.adas.client.bean.GlobalPathResp;
|
||||
import com.zhidao.adas.client.bean.GnssInfo;
|
||||
import com.zhidao.adas.client.bean.MogoReportMessage;
|
||||
import com.zhidao.adas.client.bean.RecordPanel;
|
||||
import com.zhidao.adas.client.bean.TrackedObjects;
|
||||
import com.zhidao.adas.client.bean.Trajectory;
|
||||
import com.zhidao.adas.client.bean.VehicleState;
|
||||
import com.zhidao.adas.client.bean.Warn;
|
||||
import com.zhidao.adas.client.utils.Constants;
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
import com.zhidao.support.adas.high.AdasOptions;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.OnAdasConnectStatusListener;
|
||||
import com.zhidao.support.adas.high.OnMultiDeviceListener;
|
||||
|
||||
import com.zhidao.support.adas.high.bean.IPCUpgradeStateInfo;
|
||||
import com.zhidao.support.adas.high.bean.SSHResult;
|
||||
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
import com.zhidao.support.adas.high.common.ProtocolStatus;
|
||||
import com.zhidao.support.recorder.RecordDataManager;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.net.Inet4Address;
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
import chassis.VehicleStateOuterClass;
|
||||
import io.netty.channel.Channel;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
import record_cache.RecordPanelOuterClass;
|
||||
|
||||
public class MainActivity extends AppCompatActivity implements OnAdasListener, OnAdasConnectStatusListener, BaseAdapter.OnItemClickListener<String> {
|
||||
private final static String TAG = MainActivity.class.getSimpleName();
|
||||
private EditText etIp;
|
||||
private TextView role;
|
||||
private TextView tvIp;
|
||||
private TextView title;
|
||||
private TextView ipcIp;
|
||||
private TextView localIp;
|
||||
private View line;
|
||||
private RadioGroup connectionType;
|
||||
private AppCompatButton connect;
|
||||
private AppCompatButton disconnect;
|
||||
private RadioButton fixation;
|
||||
private RadioButton assign;
|
||||
private Switch switchLog;
|
||||
private RecyclerView infoBtn;
|
||||
private RecyclerView infoFragment;
|
||||
private TextView tvConnectState;
|
||||
private ScheduledExecutorService mExecutorServiceConfigTimer;
|
||||
private Gson gson;
|
||||
|
||||
|
||||
private final List<String> titleFragmentData = new ArrayList<>();
|
||||
private final List<String> titleBtnData = new ArrayList<>();
|
||||
|
||||
private InfoTitleAdapter btnAdapter;
|
||||
private InfoTitleAdapter fragmentAdapter;
|
||||
|
||||
private InfoFragment carFragment;
|
||||
private InfoFragment viewFragment;
|
||||
private InfoFragment canFragment;
|
||||
private InfoFragment autoFragment;
|
||||
private InfoFragment warnFragment;
|
||||
private InfoFragment trajectoryFragment;
|
||||
private InfoFragment autopilotWayArriveFragment;
|
||||
private InfoFragment autopilotRouteFragment;
|
||||
private UpgradeFragment upgradeFragment;
|
||||
private InfoFragment badcseFragment;
|
||||
private InfoFragment errorFragment;
|
||||
private InfoFragment reportMessageFragment;
|
||||
private VersionFragment versionFragment;
|
||||
private FragmentManager manager;
|
||||
private FragmentTransaction transaction;
|
||||
private String ftpTime;
|
||||
private boolean isPad;
|
||||
private long recordKey;
|
||||
private String recordFileName;
|
||||
private int connectStatus;
|
||||
|
||||
|
||||
public interface TITLE {
|
||||
String RECEIVE_TRAJECTORY = "车前引导线";
|
||||
String RECEIVE_TRACKED_OBJECTS = "障碍物信息";
|
||||
String RECEIVE_GNSS_INFO = "惯导信息";
|
||||
String RECEIVE_VEHICLE_STATE = "底盘信息";
|
||||
String RECEIVE_AUTOPILOT_STATE = "自动驾驶状态";
|
||||
String RECEIVE_REPORT_MESSAGE = "监控事件";
|
||||
// String RECEIVE_BASIC_INFO_REQ = "自动驾驶设备基础信息请求";
|
||||
String RECEIVE_CAR_CONFIG_RESP = "信息与配置";
|
||||
String RECEIVE_RECORD_RESULT = "数据采集结果";
|
||||
String RECEIVE_GLOBAL_PATH_RESP = "自动驾驶路径";
|
||||
String RECEIVE_WARN = "预警数据";
|
||||
String RECEIVE_ARRIVAL_NOTIFICATION = "到站提醒";
|
||||
String RECEIVE_IPC_UPGRADE_STATUS = "升级状态";
|
||||
String RECEIVE_ERROR = "错误数据";
|
||||
|
||||
|
||||
String SEND_BASIC_INFO_RESP = "自动驾驶设备基础信息应答";
|
||||
String SEND_SET_AUTOPILOT_MODE_REQ = "设置自动驾驶模式 启动自动驾驶";
|
||||
String SEND_SET_DEMO_MODE_REQ = "设置演示模式";
|
||||
String SEND_CAR_CONFIG_REQ = "车机基础信息请求";
|
||||
String SEND_RECORD_CAUSE = "记录人工接管原因";
|
||||
String SEND_RECORD_DATA = "数据采集请求";
|
||||
String SEND_SET_AUTOPILOT_SPEED_REQ = "设置自动驾驶最大速度";
|
||||
String SEND_GLOBAL_PATH_REQ = "自动驾驶路径请求";
|
||||
String SEND_TRAFFIC_LIGHT_DATA = "发送红绿灯数据到工控机";
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
isPad = isPad(this);
|
||||
if (!isPad)
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
initView();
|
||||
firstFragment();
|
||||
gson = new Gson();
|
||||
initAdas();
|
||||
connectStatus = AdasManager.getInstance().getIpcConnectionStatus();
|
||||
onUpdateConnectStateView();
|
||||
showIPCIP(AdasManager.getInstance().getIpcConnectedIp(), AdasManager.getInstance().getIpcConnectedPort());
|
||||
}
|
||||
|
||||
|
||||
private void connect(boolean isConnect) {
|
||||
if (isConnect) {
|
||||
switch (Constants.getIpcConnectionMode(this)) {
|
||||
case AdasOptions.IPC_CONNECTION_MODE.FIXATION:
|
||||
AdasManager.getInstance().getAdasOptions().setIpcFixationIP(AdasManager.getInstance().getIPCFixationIPList(this));
|
||||
break;
|
||||
case AdasOptions.IPC_CONNECTION_MODE.ASSIGN:
|
||||
String ip = etIp.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(ip)) {
|
||||
Toast.makeText(this, "请输入指定IP", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
AdasManager.getInstance().getAdasOptions().setIpcAssignIP(ip);
|
||||
break;
|
||||
}
|
||||
AdasManager.getInstance().getAdasOptions().setIpcConnectionMode(Constants.getIpcConnectionMode(this));
|
||||
AdasManager.getInstance().connect();
|
||||
} else
|
||||
AdasManager.getInstance().disconnect();
|
||||
}
|
||||
|
||||
|
||||
private void initView() {
|
||||
etIp = findViewById(R.id.et_ip);
|
||||
role = findViewById(R.id.role);
|
||||
line = findViewById(R.id.line);
|
||||
connectionType = findViewById(R.id.connection_type);
|
||||
tvIp = findViewById(R.id.tv_ip);
|
||||
connect = findViewById(R.id.connect);
|
||||
disconnect = findViewById(R.id.disconnect);
|
||||
fixation = findViewById(R.id.fixation);
|
||||
assign = findViewById(R.id.assign);
|
||||
switchLog = findViewById(R.id.switch_log);
|
||||
title = findViewById(R.id.title);
|
||||
infoBtn = findViewById(R.id.info_btn);
|
||||
infoFragment = findViewById(R.id.info_fragment);
|
||||
tvConnectState = findViewById(R.id.tv_connect_state);
|
||||
ipcIp = findViewById(R.id.ipc_ip);
|
||||
localIp = findViewById(R.id.local_ip);
|
||||
|
||||
|
||||
role.setText(BuildConfig.IS_CLIENT ? "乘客" : "司机");
|
||||
if (BuildConfig.IS_CLIENT) {
|
||||
line.setVisibility(View.GONE);
|
||||
connectionType.setVisibility(View.GONE);
|
||||
etIp.setVisibility(View.GONE);
|
||||
tvIp.setVisibility(View.GONE);
|
||||
line.setVisibility(View.GONE);
|
||||
connect.setVisibility(View.GONE);
|
||||
disconnect.setVisibility(View.GONE);
|
||||
}
|
||||
connect.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
connect(true);
|
||||
}
|
||||
});
|
||||
disconnect.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
connect(false);
|
||||
}
|
||||
});
|
||||
initListData();
|
||||
initBtnRecyclerView();
|
||||
initFragmentRecyclerView();
|
||||
switch (Constants.getIpcConnectionMode(this)) {
|
||||
case 0:
|
||||
fixation.setChecked(true);
|
||||
break;
|
||||
case 1:
|
||||
assign.setChecked(true);
|
||||
break;
|
||||
|
||||
}
|
||||
String ip = Constants.getIPCIp(this);
|
||||
if (!TextUtils.isEmpty(ip))
|
||||
etIp.setText(ip);
|
||||
// infoTitleList.add("录音测试");
|
||||
//初始化fragment
|
||||
manager = getSupportFragmentManager();
|
||||
transaction = manager.beginTransaction();
|
||||
|
||||
|
||||
switchLog.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
|
||||
if (b) {
|
||||
AdasManager.getInstance().setEnableLog(true);
|
||||
switchLog.setText("日志:开");
|
||||
|
||||
} else {
|
||||
AdasManager.getInstance().setEnableLog(false);
|
||||
switchLog.setText("日志:关");
|
||||
}
|
||||
}
|
||||
});
|
||||
connectionType.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
||||
int type;
|
||||
switch (checkedId) {
|
||||
default:
|
||||
|
||||
case R.id.assign:
|
||||
type = AdasOptions.IPC_CONNECTION_MODE.ASSIGN;
|
||||
break;
|
||||
case R.id.fixation:
|
||||
type = AdasOptions.IPC_CONNECTION_MODE.FIXATION;
|
||||
break;
|
||||
}
|
||||
Constants.setIpcConnectionMode(MainActivity.this, type);
|
||||
}
|
||||
});
|
||||
etIp.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
if (TextUtils.isEmpty(s)) {
|
||||
Constants.delIPCIp(MainActivity.this);
|
||||
} else {
|
||||
Constants.setIPCIp(MainActivity.this, s.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
}
|
||||
});
|
||||
showLocalIP();
|
||||
title.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
showLocalIP();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initListData() {
|
||||
titleFragmentData.add(TITLE.RECEIVE_GNSS_INFO);
|
||||
titleFragmentData.add(TITLE.RECEIVE_TRAJECTORY);
|
||||
titleFragmentData.add(TITLE.RECEIVE_TRACKED_OBJECTS);
|
||||
titleFragmentData.add(TITLE.RECEIVE_VEHICLE_STATE);
|
||||
titleFragmentData.add(TITLE.RECEIVE_AUTOPILOT_STATE);
|
||||
titleFragmentData.add(TITLE.RECEIVE_REPORT_MESSAGE);
|
||||
titleFragmentData.add(TITLE.RECEIVE_CAR_CONFIG_RESP);
|
||||
titleFragmentData.add(TITLE.RECEIVE_RECORD_RESULT);
|
||||
titleFragmentData.add(TITLE.RECEIVE_GLOBAL_PATH_RESP);
|
||||
titleFragmentData.add(TITLE.RECEIVE_WARN);
|
||||
titleFragmentData.add(TITLE.RECEIVE_ARRIVAL_NOTIFICATION);
|
||||
titleFragmentData.add(TITLE.RECEIVE_IPC_UPGRADE_STATUS);
|
||||
titleFragmentData.add(TITLE.RECEIVE_ERROR);
|
||||
|
||||
|
||||
titleBtnData.add("下发站点1");
|
||||
titleBtnData.add("下发站点2");
|
||||
titleBtnData.add("自动驾驶路径查询");
|
||||
titleBtnData.add("下发SN");
|
||||
titleBtnData.add("数据采集5秒");
|
||||
titleBtnData.add("数据采集start");
|
||||
titleBtnData.add("数据采集end");
|
||||
titleBtnData.add("发送信号灯");
|
||||
titleBtnData.add("速度设置");
|
||||
titleBtnData.add("重启Docker");
|
||||
titleBtnData.add("重启IPC");
|
||||
titleBtnData.add("关机");
|
||||
titleBtnData.add("采集类型");
|
||||
titleBtnData.add("打开演示模式");
|
||||
titleBtnData.add("关闭演示模式");
|
||||
}
|
||||
|
||||
private void initBtnRecyclerView() {
|
||||
//初始info-recycle
|
||||
GridLayoutManager nodLinearLayoutManage = new GridLayoutManager(this, 2);
|
||||
nodLinearLayoutManage.setOrientation(LinearLayoutManager.HORIZONTAL);
|
||||
infoBtn.setLayoutManager(nodLinearLayoutManage);
|
||||
//如果可以确定每个item的高度是固定的,设置这个选项可以提高性能
|
||||
infoBtn.setHasFixedSize(true);
|
||||
//解决局部刷新闪屏问题
|
||||
SimpleItemAnimator animatorInfo = (SimpleItemAnimator) infoBtn.getItemAnimator();
|
||||
if (animatorInfo != null)
|
||||
animatorInfo.setSupportsChangeAnimations(false);
|
||||
//创建并设置Adapter
|
||||
btnAdapter = new InfoTitleAdapter(titleBtnData, false);
|
||||
infoBtn.setAdapter(btnAdapter);
|
||||
btnAdapter.setOnItemClickListener(this);
|
||||
}
|
||||
|
||||
private void initFragmentRecyclerView() {
|
||||
//创建默认的线性LayoutManager 横向的GridLayoutManager
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
|
||||
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
||||
infoFragment.setLayoutManager(linearLayoutManager);
|
||||
//如果可以确定每个item的高度是固定的,设置这个选项可以提高性能
|
||||
infoFragment.setHasFixedSize(true);
|
||||
//解决局部刷新闪屏问题
|
||||
SimpleItemAnimator animator = (SimpleItemAnimator) infoFragment.getItemAnimator();
|
||||
if (animator != null)
|
||||
animator.setSupportsChangeAnimations(false);
|
||||
//创建并设置Adapter
|
||||
fragmentAdapter = new InfoTitleAdapter(titleFragmentData, true);
|
||||
infoFragment.setAdapter(fragmentAdapter);
|
||||
fragmentAdapter.setOnItemClickListener(new BaseAdapter.OnItemClickListener<String>() {
|
||||
|
||||
@Override
|
||||
public void onItemClick(int position, String data) {
|
||||
fragmentAdapter.setSelectedPosition(position);
|
||||
manager = getSupportFragmentManager();
|
||||
transaction = manager.beginTransaction();
|
||||
CupidLogUtils.w(TAG, "TitleAdapter===>name:" + data);
|
||||
switch (data) {
|
||||
case TITLE.RECEIVE_GNSS_INFO:
|
||||
firstFragment();
|
||||
break;
|
||||
case TITLE.RECEIVE_VEHICLE_STATE:
|
||||
if (canFragment == null)
|
||||
canFragment = new InfoFragment(data);
|
||||
if (!canFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, canFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case TITLE.RECEIVE_TRACKED_OBJECTS:
|
||||
if (viewFragment == null)
|
||||
viewFragment = new InfoFragment(data);
|
||||
if (!viewFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, viewFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case TITLE.RECEIVE_AUTOPILOT_STATE:
|
||||
if (autoFragment == null)
|
||||
autoFragment = new InfoFragment(data);
|
||||
if (!autoFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, autoFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case TITLE.RECEIVE_WARN:
|
||||
if (warnFragment == null)
|
||||
warnFragment = new InfoFragment(data);
|
||||
if (!warnFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, warnFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case TITLE.RECEIVE_TRAJECTORY:
|
||||
if (trajectoryFragment == null)
|
||||
trajectoryFragment = new InfoFragment(data);
|
||||
if (!trajectoryFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, trajectoryFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case TITLE.RECEIVE_ARRIVAL_NOTIFICATION:
|
||||
if (autopilotWayArriveFragment == null)
|
||||
autopilotWayArriveFragment = new InfoFragment(data);
|
||||
if (!autopilotWayArriveFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, autopilotWayArriveFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case TITLE.RECEIVE_GLOBAL_PATH_RESP:
|
||||
if (autopilotRouteFragment == null)
|
||||
autopilotRouteFragment = new InfoFragment(data);
|
||||
if (!autopilotRouteFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, autopilotRouteFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case TITLE.RECEIVE_IPC_UPGRADE_STATUS:
|
||||
if (upgradeFragment == null)
|
||||
upgradeFragment = new UpgradeFragment(data);
|
||||
if (!upgradeFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, upgradeFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case TITLE.RECEIVE_RECORD_RESULT:
|
||||
if (badcseFragment == null)
|
||||
badcseFragment = new InfoFragment(data);
|
||||
if (!badcseFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, badcseFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case TITLE.RECEIVE_REPORT_MESSAGE:
|
||||
if (reportMessageFragment == null)
|
||||
reportMessageFragment = new InfoFragment(data);
|
||||
if (!reportMessageFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, reportMessageFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case TITLE.RECEIVE_CAR_CONFIG_RESP:
|
||||
AdasManager.getInstance().sendCarConfigReq();
|
||||
if (versionFragment == null)
|
||||
versionFragment = new VersionFragment("工控机版本\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t固定IP配置");
|
||||
if (!versionFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, versionFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
|
||||
case TITLE.RECEIVE_ERROR:
|
||||
if (errorFragment == null)
|
||||
errorFragment = new InfoFragment(data);
|
||||
if (!errorFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, errorFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void showIPCIP(final String ip, final int port) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!BuildConfig.IS_CLIENT) {
|
||||
String temp = "";
|
||||
ipcIp.setVisibility(View.VISIBLE);
|
||||
if (!TextUtils.isEmpty(ip)) {
|
||||
temp = "IPC IP:" + ip + ":" + port;
|
||||
}
|
||||
ipcIp.setText(temp);
|
||||
} else {
|
||||
ipcIp.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void onUpdateConnectStateView() {
|
||||
String status;
|
||||
int color;
|
||||
switch (connectStatus) {
|
||||
case com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.CONNECTED:
|
||||
status = "已连接";
|
||||
color = R.color.connect_status_connected;
|
||||
break;
|
||||
default:
|
||||
case com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.DISCONNECTED:
|
||||
status = "未连接";
|
||||
color = R.color.connect_status_disconnected;
|
||||
break;
|
||||
case com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.CONNECTING:
|
||||
status = "连接中";
|
||||
color = R.color.connect_status_connecting;
|
||||
break;
|
||||
|
||||
case com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.SEARCH_ADDRESS:
|
||||
status = "搜索IP";
|
||||
color = R.color.connect_status_search_address;
|
||||
break;
|
||||
case com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.NOT_FOUND_ADDRESS:
|
||||
status = "未找到";
|
||||
color = R.color.connect_status_disconnecting;
|
||||
break;
|
||||
}
|
||||
CupidLogUtils.i(TAG, "connectStatus=" + status);
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
tvConnectState.setText(status);
|
||||
tvConnectState.setTextColor(getResources().getColor(color));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void updateText(final TextView tv, final String text) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
tv.setText(text);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onSSHResult(final SSHResult info) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
showToastCenter("IPC命令下发结果:" + info.code + " 命令:" + info.cmd + " 信息:" + info.msg);
|
||||
}
|
||||
});
|
||||
CupidLogUtils.w(TAG, "IPC命令下发结果:" + info.code + " 命令:" + info.cmd + " 信息:" + info.msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(ProtocolStatus status, byte[] bytes) {
|
||||
EventBus.getDefault().postSticky(new ErrorData(status, bytes));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrajectory(MessagePad.Header header, MessagePad.Trajectory trajectory) {
|
||||
EventBus.getDefault().postSticky(new Trajectory(header, trajectory));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrackedObjects(MessagePad.Header header, MessagePad.TrackedObjects trackedObjects) {
|
||||
EventBus.getDefault().postSticky(new TrackedObjects(header, trackedObjects));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGnssInfo(MessagePad.Header header, MessagePad.GnssInfo gnssInfo) {
|
||||
EventBus.getDefault().postSticky(new GnssInfo(header, gnssInfo));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVehicleState(MessagePad.Header header, VehicleStateOuterClass.VehicleState vehicleState) {
|
||||
EventBus.getDefault().postSticky(new VehicleState(header, vehicleState));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotState(MessagePad.Header header, MessagePad.AutopilotState autopilotState) {
|
||||
EventBus.getDefault().postSticky(new AutopilotState(header, autopilotState));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReportMessage(MessagePad.Header header, MogoReportMsg.MogoReportMessage mogoReportMessage) {
|
||||
EventBus.getDefault().postSticky(new MogoReportMessage(header, mogoReportMessage));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBasicInfoReq(MessagePad.Header header, MessagePad.BasicInfoReq basicInfoReq) {
|
||||
BasicInfoReq info = new BasicInfoReq(header, basicInfoReq);
|
||||
AdasManager.getInstance().sendBasicInfoResp("X202021111192N41VY", 1);
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
toastMsg("收到车机基础信息请求:" + info.toString());
|
||||
}
|
||||
});
|
||||
// EventBus.getDefault().postSticky(new BasicInfoReq(header, basicInfoReq));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarConfigResp(MessagePad.Header header, MessagePad.CarConfigResp carConfigResp) {
|
||||
EventBus.getDefault().postSticky(new CarConfigResp(header, carConfigResp));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecordResult(MessagePad.Header header, RecordPanelOuterClass.RecordPanel recordPanel) {
|
||||
recordKey = recordPanel.getKey();
|
||||
recordFileName = recordPanel.getFilename();
|
||||
EventBus.getDefault().postSticky(new RecordPanel(header, recordPanel));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGlobalPathResp(MessagePad.Header header, MessagePad.GlobalPathResp globalPathResp) {
|
||||
EventBus.getDefault().postSticky(new GlobalPathResp(header, globalPathResp));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWarn(MessagePad.Header header, MessagePad.Warn warn) {
|
||||
EventBus.getDefault().postSticky(new Warn(header, warn));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArrivalNotification(MessagePad.Header header, MessagePad.ArrivalNotification arrivalNotification) {
|
||||
EventBus.getDefault().postSticky(new ArrivalNotification(header, arrivalNotification));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpgradeStateInfo(final IPCUpgradeStateInfo info) {
|
||||
EventBus.getDefault().postSticky(info);
|
||||
}
|
||||
|
||||
|
||||
private Toast toast;
|
||||
|
||||
public void showToastCenter(String msg) {
|
||||
if (toast != null) {
|
||||
toast.cancel();
|
||||
toast = null;
|
||||
}
|
||||
toast = Toast.makeText(this, "", Toast.LENGTH_SHORT); //如果有居中显示需求
|
||||
toast.setGravity(Gravity.CENTER, 0, 0);
|
||||
toast.setText(msg);
|
||||
toast.show();
|
||||
}
|
||||
|
||||
|
||||
private void initAdas() {
|
||||
CupidLogUtils.e(TAG, "--->初始化");
|
||||
AdasOptions options;
|
||||
if (BuildConfig.IS_CLIENT) {
|
||||
/*—————————————作为乘客端———————————*/
|
||||
options = new AdasOptions.Builder().setClient(true).build();
|
||||
NSDNettyManager.getInstance().searchAndConnectServer(this, "1234", new NettyClientListener<MogoProtocolMsg>() {
|
||||
|
||||
|
||||
@Override
|
||||
public void onMessageResponseClient(MogoProtocolMsg msg, String sign) {
|
||||
AdasManager.getInstance().parseIPCData(msg.getBody());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClientStatusConnectChanged(int statusCode, String sign) {
|
||||
if (statusCode == ConnectState.STATUS_CONNECT_SUCCESS) {
|
||||
connectStatus = com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.CONNECTED;
|
||||
} else {
|
||||
connectStatus = com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.DISCONNECTED;
|
||||
}
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ipcIp.setVisibility(View.VISIBLE);
|
||||
ipcIp.setText("司机IP:" + NSDNettyManager.getInstance().getConnServerIp());
|
||||
}
|
||||
});
|
||||
onUpdateConnectStateView();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
/*—————————————作为司机端———————————*/
|
||||
int mode = Constants.getIpcConnectionMode(this);
|
||||
switch (mode) {
|
||||
default:
|
||||
case AdasOptions.IPC_CONNECTION_MODE.FIXATION:
|
||||
options = new AdasOptions.Builder().setClient(false).setIpcFixationIP(AdasManager.getInstance().getIPCFixationIPList(this)).setIpcConnectionMode(mode).build();
|
||||
break;
|
||||
case AdasOptions.IPC_CONNECTION_MODE.ASSIGN:
|
||||
options = new AdasOptions.Builder().setClient(false).setIpcAssignIP(Constants.getIPCIp(this)).setIpcConnectionMode(mode).build();
|
||||
break;
|
||||
}
|
||||
|
||||
NSDNettyManager.getInstance().startNSDNettyServerWithSN(this, new NettyServerListener<MogoProtocolMsg>() {
|
||||
@Override
|
||||
public void onMessageResponseServer(MogoProtocolMsg msg, Channel channel) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartServer() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopServer() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChannelConnect(Channel channel) {
|
||||
Log.i(TAG,"onChannelConnect channel="+channel.id());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChannelDisConnect(Channel channel) {
|
||||
Log.i(TAG,"onChannelDisConnect channel="+channel.id());
|
||||
}
|
||||
},"1234567");
|
||||
|
||||
|
||||
}
|
||||
AdasManager.getInstance().create(options, this);
|
||||
|
||||
AdasManager.getInstance().setOnAdasListener(this);
|
||||
// AdasManager.getInstance().setOnAdasConnectStatusListener(this);
|
||||
if (BuildConfig.IS_CLIENT) {
|
||||
/*—————————————作为乘客端———————————*/
|
||||
|
||||
} else {
|
||||
/*—————————————作为司機端———————————*/
|
||||
AdasManager.getInstance().setOnMultiDeviceListener(new OnMultiDeviceListener() {
|
||||
@Override
|
||||
public void onForwardingIPCMessage(byte[] bytes) {
|
||||
// 发送数据给乘客端
|
||||
if (NSDNettyManager.getInstance().isServerStart()) {
|
||||
NSDNettyManager.getInstance().sendMsgToAllClients(new MogoProtocolMsg(NORMAL_DATA, bytes.length, bytes));
|
||||
} else {
|
||||
Log.d("dddd", "司机端Server未启动!");
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
// AdasManager.getInstance().pause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
// AdasManager.getInstance().resume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
AdasManager.getInstance().setOnAdasListener(null);
|
||||
AdasManager.getInstance().disconnect();
|
||||
if (mExecutorServiceConfigTimer != null) {
|
||||
mExecutorServiceConfigTimer.shutdownNow();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onConnectionIPCStatus(int ipcConnectionStatus, String failedMsg) {
|
||||
connectStatus = ipcConnectionStatus;
|
||||
onUpdateConnectStateView();
|
||||
if (connectStatus == com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.CONNECTED) {
|
||||
CupidLogUtils.w(TAG, "===>MainActivity onWebSocketConnectSuccess");
|
||||
showIPCIP(AdasManager.getInstance().getIpcConnectedIp(), AdasManager.getInstance().getIpcConnectedPort());
|
||||
} else if (connectStatus == com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.DISCONNECTED) {
|
||||
toastMsg("连接失败:" + failedMsg);
|
||||
CupidLogUtils.w(TAG, "===>MainActivity onWebSocketConnectFailed");
|
||||
showIPCIP(AdasManager.getInstance().getIpcConnectedIp(), AdasManager.getInstance().getIpcConnectedPort());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void toastMsg(final String msg) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Toast.makeText(MainActivity.this, msg, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showLocalIP() {
|
||||
localIp.setText("本机IP:" + getIpAddressString());
|
||||
}
|
||||
|
||||
private String getIpAddressString() {
|
||||
try {
|
||||
for (Enumeration<NetworkInterface> enNetI = NetworkInterface
|
||||
.getNetworkInterfaces(); enNetI.hasMoreElements(); ) {
|
||||
NetworkInterface netI = enNetI.nextElement();
|
||||
for (Enumeration<InetAddress> enumIpAddr = netI
|
||||
.getInetAddresses(); enumIpAddr.hasMoreElements(); ) {
|
||||
InetAddress inetAddress = enumIpAddr.nextElement();
|
||||
if (inetAddress instanceof Inet4Address && !inetAddress.isLoopbackAddress()) {
|
||||
return inetAddress.getHostAddress();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (SocketException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "127.0.0.1";
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前设备是手机还是平板,代码来自 Google I/O App for Android
|
||||
*
|
||||
* @param context
|
||||
* @return 平板返回 True,手机返回 False
|
||||
*/
|
||||
public static boolean isPad(Context context) {
|
||||
return (context.getResources().getConfiguration().screenLayout
|
||||
& Configuration.SCREENLAYOUT_SIZE_MASK)
|
||||
>= Configuration.SCREENLAYOUT_SIZE_LARGE;
|
||||
}
|
||||
|
||||
private void firstFragment() {
|
||||
if (carFragment == null)
|
||||
carFragment = new InfoFragment(TITLE.RECEIVE_GNSS_INFO);
|
||||
if (!carFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, carFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(int position, String data) {
|
||||
CupidLogUtils.w(TAG, "TitleAdapter===>name:" + data);
|
||||
if (connectStatus == com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.DISCONNECTED) {
|
||||
toastMsg("IPC 未连接");
|
||||
return;
|
||||
}
|
||||
switch (data) {
|
||||
case "下发站点1":
|
||||
MessagePad.Location startLocation = MessagePad.Location.newBuilder()
|
||||
.setLatitude(26.820319143036112)
|
||||
.setLongitude(112.57770688564666)
|
||||
.build();
|
||||
MessagePad.Location endLocation = MessagePad.Location.newBuilder()
|
||||
.setLatitude(26.82355278566775)
|
||||
.setLongitude(112.57001723522112)
|
||||
.build();
|
||||
MessagePad.RouteInfo info = MessagePad.RouteInfo.newBuilder()
|
||||
.setStartLocation(startLocation)
|
||||
.setStartName("KXCNMZ")
|
||||
.setEndLocation(endLocation)
|
||||
.setEndName("SDYJKXCXMBZ")
|
||||
// .addAllWayPoints(null)
|
||||
.setSpeedLimit(0.0)
|
||||
.setVehicleType(9)
|
||||
.setIsSpeakVoice(true)
|
||||
.build();
|
||||
AdasManager.getInstance().sendAutoPilotModeReq(1, 0, info);
|
||||
//"{\"action\":\"aiCloudToStartAutopilot\",\"result\":{\"endLatLon\":{\"lat\":26.82355278566775,\"lon\":112.57001723522112},\"endName\":\"SDYJKXCXMBZ\",\"isSpeakVoice\":true,\"speedLimit\":0.0,\"startLatLon\":{\"lat\":26.820319143036112,\"lon\":112.57770688564666},\"startName\":\"KXCNMZ\",\"vehicleType\":9,\"wayLatLons\":null}}"
|
||||
// " {\"action\":\"aiCloudToStartAutopilot\",\"result\":{\"endLatLon\":{\"lat\":26.819811964643154,\"lon\":112.57732459897345},\"endName\":\"KXCNMDM\",\"isSpeakVoice\":true,\"speedLimit\":0.0,\"startLatLon\":{\"lat\":26.823347858814472,\"lon\":112.56994205894226},\"startName\":\"SDYJKXCXMBDM\",\"vehicleType\":9,\"wayLatLons\":null}}"
|
||||
break;
|
||||
case "下发站点2":
|
||||
MessagePad.Location startLocation2 = MessagePad.Location.newBuilder()
|
||||
.setLatitude(26.823347858814472)
|
||||
.setLongitude(112.56994205894226)
|
||||
.build();
|
||||
MessagePad.Location endLocation2 = MessagePad.Location.newBuilder()
|
||||
.setLatitude(26.819811964643154)
|
||||
.setLongitude(112.57732459897345)
|
||||
.build();
|
||||
MessagePad.RouteInfo info2 = MessagePad.RouteInfo.newBuilder()
|
||||
.setStartLocation(startLocation2)
|
||||
.setStartName("SDYJKXCXMBDM")
|
||||
.setEndLocation(endLocation2)
|
||||
.setEndName("KXCNMDM")
|
||||
// .addAllWayPoints(null)
|
||||
.setSpeedLimit(0.0)
|
||||
.setVehicleType(9)
|
||||
.setIsSpeakVoice(true)
|
||||
.build();
|
||||
AdasManager.getInstance().sendAutoPilotModeReq(1, 0, info2);
|
||||
// "{\"action\":\"aiCloudToStartAutopilot\",\"result\":{\"endLatLon\":{\"lat\":26.82355278566775,\"lon\":112.57001723522112},\"endName\":\"SDYJKXCXMBZ\",\"isSpeakVoice\":true,\"speedLimit\":0.0,\"startLatLon\":{\"lat\":26.820319143036112,\"lon\":112.57770688564666},\"startName\":\"KXCNMZ\",\"vehicleType\":9,\"wayLatLons\":null}}"
|
||||
//" {\"action\":\"aiCloudToStartAutopilot\",\"result\":{\"endLatLon\":{\"lat\":26.819811964643154,\"lon\":112.57732459897345},\"endName\":\"KXCNMDM\",\"isSpeakVoice\":true,\"speedLimit\":0.0,\"startLatLon\":{\"lat\":26.823347858814472,\"lon\":112.56994205894226},\"startName\":\"SDYJKXCXMBDM\",\"vehicleType\":9,\"wayLatLons\":null}}"
|
||||
break;
|
||||
case "自动驾驶路径查询":
|
||||
AdasManager.getInstance().sendGlobalPathReq();
|
||||
break;
|
||||
case "下发SN":
|
||||
//发送sn
|
||||
AdasManager.getInstance().sendBasicInfoResp("X202021111192N41VY", 1);
|
||||
break;
|
||||
case "数据采集5秒":
|
||||
boolean b = AdasManager.getInstance().startRecordPackage(1, 5, 1);
|
||||
CupidLogUtils.w(TAG, "AutopilotRecord===>send:" + b);
|
||||
break;
|
||||
case "数据采集start":
|
||||
boolean bStart = AdasManager.getInstance().startRecordPackage(1, 1);
|
||||
CupidLogUtils.w(TAG, "AutopilotRecord===>send:" + bStart);
|
||||
break;
|
||||
case "数据采集end":
|
||||
boolean bEnd = AdasManager.getInstance().stopRecordPackage(1, 1);
|
||||
CupidLogUtils.w(TAG, "AutopilotRecord===>send:" + bEnd);
|
||||
break;
|
||||
case "录音测试":
|
||||
CupidLogUtils.w(TAG, "录音测试");
|
||||
RecordDataManager.getInstance().init(MainActivity.this, "1234567", "", 22, "", "");
|
||||
RecordDataManager.getInstance().record();
|
||||
break;
|
||||
case "发送信号灯":
|
||||
MessagePad.TrafficLightStatus left = MessagePad.TrafficLightStatus.newBuilder()
|
||||
.setPhaseNo("1")
|
||||
.setColor("R")
|
||||
.setRemain(249)
|
||||
.build();
|
||||
MessagePad.TrafficLightStatus mid = MessagePad.TrafficLightStatus.newBuilder()
|
||||
.setPhaseNo("2")
|
||||
.setColor("G")
|
||||
.setRemain(199)
|
||||
.build();
|
||||
MessagePad.TrafficLightStatus right = MessagePad.TrafficLightStatus.newBuilder()
|
||||
.setPhaseNo("3")
|
||||
.setColor("G")
|
||||
.setRemain(199)
|
||||
.build();
|
||||
MessagePad.TrafficLightDetail detail = MessagePad.TrafficLightDetail.newBuilder()
|
||||
.setLeft(left)
|
||||
.setMid(mid)
|
||||
.setRight(right)
|
||||
.build();
|
||||
AdasManager.getInstance().sendTrafficLightData("10038", 26.848153, 112.574883, "180.0", "SN", 100413, -4, 201, 0, detail);
|
||||
break;
|
||||
case "速度设置":
|
||||
AdasManager.getInstance().sendAutopilotSpeedReq(30);
|
||||
break;
|
||||
case "重启Docker":
|
||||
AdasManager.getInstance().rebootAPDocker();
|
||||
break;
|
||||
case "重启IPC":
|
||||
AdasManager.getInstance().rebootIPC();
|
||||
break;
|
||||
case "关机":
|
||||
AdasManager.getInstance().shutdownIPC();
|
||||
break;
|
||||
case "采集类型":
|
||||
AdasManager.getInstance().sendRecordCause(recordKey, recordFileName, "1", "变道有干扰");
|
||||
break;
|
||||
case "打开演示模式":
|
||||
AdasManager.getInstance().sendDemoModeReq(1);
|
||||
break;
|
||||
case "关闭演示模式":
|
||||
AdasManager.getInstance().sendDemoModeReq(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.zhidao.adas.client.ui.mian;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.zhidao.adas.client.R;
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
import com.zhidao.support.adas.high.bean.IPCUpgradeInfo;
|
||||
import com.zhidao.support.adas.high.bean.IPCUpgradeStateInfo;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* @des 升级页面
|
||||
*/
|
||||
public class UpgradeFragment extends Fragment {
|
||||
private final int[] colors = {Color.parseColor("#FA8072"), Color.parseColor("#FF00FF"), Color.parseColor("#228B22"), Color.parseColor("#871f78")};
|
||||
private final Random random = new Random();
|
||||
|
||||
private String title;
|
||||
|
||||
public UpgradeFragment() {
|
||||
}
|
||||
|
||||
public UpgradeFragment(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_upgrade, container, false);
|
||||
initView(view);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
private TextView tvTitle;
|
||||
private TextView text2;
|
||||
private Button btn1;
|
||||
private Button btn2;
|
||||
|
||||
private void initView(View view) {
|
||||
tvTitle = view.findViewById(R.id.tv_title);
|
||||
text2 = view.findViewById(R.id.text2);
|
||||
btn1 = view.findViewById(R.id.btn1);
|
||||
btn2 = view.findViewById(R.id.btn2);
|
||||
CupidLogUtils.w("InfoFragment===>" + title);
|
||||
tvTitle.setText(title);
|
||||
tvTitle.setGravity(Gravity.CENTER);
|
||||
|
||||
btn1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AdasManager.getInstance().sendBaseInfo(IPCUpgradeInfo.affirm());
|
||||
}
|
||||
});
|
||||
|
||||
btn2.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AdasManager.getInstance().sendBaseInfo(IPCUpgradeInfo.cancel());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onIPCUpgradeStateInfo(IPCUpgradeStateInfo info) {
|
||||
text2.setTextColor(colors[random.nextInt(4)]);
|
||||
text2.setText("IPC升级 \nUpgradeStatus:" + IPCUpgradeStateInfo.UpgradeStatus.getStatus(info.getUpgradeStatus()) +
|
||||
"\nDownloadStatus:" + IPCUpgradeStateInfo.DownloadStatus.getStatus(info.getDownloadStatus()) +
|
||||
"\nUpgradeMode:" + IPCUpgradeStateInfo.UpgradeMode.getStatus(info.getUpgradeMode()) +
|
||||
"\nProgress:" + info.getProgress() +
|
||||
"\nImages:" + info.getImages());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
package com.zhidao.adas.client.ui.mian;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.SimpleItemAnimator;
|
||||
|
||||
import com.zhidao.adas.client.BuildConfig;
|
||||
import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.bean.CarConfigResp;
|
||||
import com.zhidao.adas.client.bean.Config;
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @des 升级页面
|
||||
*/
|
||||
public class VersionFragment extends Fragment {
|
||||
|
||||
|
||||
private String title;
|
||||
private ConfigAdapter adapter;
|
||||
|
||||
public VersionFragment() {
|
||||
}
|
||||
|
||||
public VersionFragment(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_version, container, false);
|
||||
initView(view);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
EventBus.getDefault().register(this);
|
||||
showIps();
|
||||
}
|
||||
|
||||
|
||||
private void showIps() {
|
||||
HashSet<String> ips = AdasManager.getInstance().getIPCFixationIPList(getActivity());
|
||||
if (ips != null && !ips.isEmpty()) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
int i = 0;
|
||||
for (String ip : ips) {
|
||||
i++;
|
||||
builder.append(ip);
|
||||
if (i % 2 == 0) {
|
||||
builder.append("\n");
|
||||
} else {
|
||||
builder.append("\t\t\t\t");
|
||||
}
|
||||
}
|
||||
ipsView.setText(builder.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private TextView tvTitle;
|
||||
|
||||
private TextView ipsView;
|
||||
private Button btn1;
|
||||
private Button btn2;
|
||||
private EditText ipView;
|
||||
private RecyclerView recyclerView;
|
||||
|
||||
private void initView(View view) {
|
||||
tvTitle = view.findViewById(R.id.tv_title);
|
||||
btn1 = view.findViewById(R.id.btn1);
|
||||
ipView = view.findViewById(R.id.ip);
|
||||
btn2 = view.findViewById(R.id.btn2);
|
||||
ipsView = view.findViewById(R.id.ips_view);
|
||||
recyclerView = view.findViewById(R.id.config_list);
|
||||
initFragmentRecyclerView();
|
||||
CupidLogUtils.w("InfoFragment===>" + title);
|
||||
tvTitle.setText(title);
|
||||
tvTitle.setGravity(Gravity.CENTER);
|
||||
|
||||
btn1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String ip = ipView.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(ip)) {
|
||||
Toast.makeText(getContext(), "请输入IP", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
if (AdasManager.getInstance().addIPCFixationIP(getContext(), ip)) {
|
||||
ipView.setText("");
|
||||
showIps();
|
||||
} else {
|
||||
Toast.makeText(getContext(), "IP已存在", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
btn2.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String ip = ipView.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(ip)) {
|
||||
Toast.makeText(getContext(), "请输入IP", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
if (AdasManager.getInstance().delIPCFixationIP(getContext(), ip)) {
|
||||
ipView.setText("");
|
||||
showIps();
|
||||
} else {
|
||||
Toast.makeText(getContext(), "IP不存在", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
if (BuildConfig.IS_CLIENT) {
|
||||
view.findViewById(R.id.ipc_ip_config).setVisibility(View.GONE);
|
||||
view.findViewById(R.id.line1).setVisibility(View.GONE);
|
||||
tvTitle.setText("版本");
|
||||
}
|
||||
// if (AdasManager.getInstance().getIpcConnectionStatus() != Constants.IPC_CONNECTION_STATUS.CONNECTED)
|
||||
showVersion(null);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void showVersion(CarConfigResp adasConfig) {
|
||||
List<Config> list = new ArrayList<>();
|
||||
if (!BuildConfig.IS_CLIENT) {
|
||||
String ip = AdasManager.getInstance().getIpcConnectedIp();
|
||||
String temp = "";
|
||||
if (!TextUtils.isEmpty(ip)) {
|
||||
temp = ip + ":" + AdasManager.getInstance().getIpcConnectedPort();
|
||||
}
|
||||
list.add(new Config("工控机IP:", temp));
|
||||
list.add(new Config("工控机版本:", adasConfig == null ? null : adasConfig.bean.getDockVersion()));
|
||||
list.add(new Config("车牌号:", adasConfig == null ? null : adasConfig.bean.getPlateNumber()));
|
||||
list.add(new Config("MAC地址:", adasConfig == null ? null : adasConfig.bean.getMacAddress()));
|
||||
list.add(new Config("自动驾驶限速:", adasConfig == null ? null : adasConfig.bean.getSpeedLimit() + "m/s"));
|
||||
list.add(new Config("最大自动驾驶限速:", adasConfig == null ? null : adasConfig.bean.getMaxSpeedLimit() + "m/s"));
|
||||
list.add(new Config("最小加速度:", adasConfig == null ? null : adasConfig.bean.getMinAcceleration() + "m/s²"));
|
||||
list.add(new Config("最大加速度:", adasConfig == null ? null : adasConfig.bean.getMaxAcceleration() + "m/s²"));
|
||||
list.add(new Config("IPC通信协议版本:", adasConfig == null ? null : String.valueOf(adasConfig.bean.getProtocolVersion().getNumber())));
|
||||
list.add(new Config("APP通信协议版本:", String.valueOf(AdasManager.getInstance().getProtocolVersion())));
|
||||
}
|
||||
list.add(new Config("ADAS LIB版本:", AdasManager.getInstance().getAdasVersion()));
|
||||
adapter.setData(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
private void initFragmentRecyclerView() {
|
||||
//创建默认的线性LayoutManager 横向的GridLayoutManager
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
|
||||
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
||||
recyclerView.setLayoutManager(linearLayoutManager);
|
||||
//如果可以确定每个item的高度是固定的,设置这个选项可以提高性能
|
||||
recyclerView.setHasFixedSize(true);
|
||||
//解决局部刷新闪屏问题
|
||||
SimpleItemAnimator animator = (SimpleItemAnimator) recyclerView.getItemAnimator();
|
||||
if (animator != null)
|
||||
animator.setSupportsChangeAnimations(false);
|
||||
//创建并设置Adapter
|
||||
adapter = new ConfigAdapter();
|
||||
recyclerView.setAdapter(adapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.zhidao.adas.client.utils;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/10/8
|
||||
*/
|
||||
public class Constants {
|
||||
public static final String ALL_PATH = "all_path";//所有路线
|
||||
public static final String SEL_PATH = "sel_path";//选择的路线
|
||||
|
||||
/***********************是否使用固定IP******************/
|
||||
// 0:固定IP 1:指定 2:UDP
|
||||
private static final String IPC_CONNECTION_MODE = "ipc_connection_mode";
|
||||
|
||||
public static void setIpcConnectionMode(Context context, int type) {
|
||||
PreferencesUtils.putInt(context, IPC_CONNECTION_MODE, type);
|
||||
}
|
||||
|
||||
public static int getIpcConnectionMode(Context context) {
|
||||
return PreferencesUtils.getInt(context, IPC_CONNECTION_MODE, 0);
|
||||
}
|
||||
|
||||
public static boolean delIpcConnectionMode(Context context) {
|
||||
return PreferencesUtils.delete(context, IPC_CONNECTION_MODE);
|
||||
}
|
||||
|
||||
/***********************保存IP******************/
|
||||
private static final String IPC_IP = "ipc_ip";
|
||||
|
||||
public static void setIPCIp(Context context, String ip) {
|
||||
PreferencesUtils.putString(context, IPC_IP, ip);
|
||||
}
|
||||
|
||||
public static String getIPCIp(Context context) {
|
||||
return PreferencesUtils.getString(context, IPC_IP, null);
|
||||
}
|
||||
|
||||
public static boolean delIPCIp(Context context) {
|
||||
return PreferencesUtils.delete(context, IPC_IP);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.zhidao.adas.client.utils;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.Writer;
|
||||
|
||||
/**
|
||||
* @author nie yunlong
|
||||
* @des
|
||||
* @date 2021/2/5
|
||||
*/
|
||||
class FileUtils {
|
||||
|
||||
/**
|
||||
* 创建文件
|
||||
*
|
||||
* @param data
|
||||
* @param name
|
||||
*/
|
||||
public static void createFile(Context context, String data, String name) {
|
||||
try {
|
||||
File file = new File(context.getExternalFilesDir(null) + "/" + name);
|
||||
if (!file.exists()) {
|
||||
file.createNewFile();
|
||||
}
|
||||
Writer out = new FileWriter(file,true);
|
||||
out.write(data);
|
||||
out.append("\n");
|
||||
out.flush();
|
||||
out.close();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.zhidao.adas.client.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
public class MyLinearLayoutManager extends LinearLayoutManager {
|
||||
public MyLinearLayoutManager(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public MyLinearLayoutManager(Context context, int orientation, boolean reverseLayout) {
|
||||
super(context, orientation, reverseLayout);
|
||||
}
|
||||
|
||||
public MyLinearLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsPredictiveItemAnimations() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
|
||||
//override this method and implement code as below
|
||||
try {
|
||||
super.onLayoutChildren(recycler, state);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,286 @@
|
||||
package com.zhidao.adas.client.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
public class PreferencesUtils {
|
||||
|
||||
public static String PREFERENCE_NAME = "control";
|
||||
|
||||
public static boolean hasString(Context context, String key) {
|
||||
if (context == null) return false;
|
||||
SharedPreferences settings = context.getSharedPreferences(
|
||||
PREFERENCE_NAME, Context.MODE_PRIVATE);
|
||||
return settings.contains(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* put string preferences
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to modify
|
||||
* @param value The new value for the preference
|
||||
* @return True if the new values were successfully written to persistent
|
||||
* storage.
|
||||
*/
|
||||
public static boolean putString(Context context, String key, String value) {
|
||||
|
||||
if (context == null) return false;
|
||||
SharedPreferences settings = context.getSharedPreferences(
|
||||
PREFERENCE_NAME, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = settings.edit();
|
||||
editor.putString(key, value);
|
||||
return editor.commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* get string preferences
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to retrieve
|
||||
* @return The preference value if it exists, or null. Throws
|
||||
* ClassCastException if there is a preference with this name that
|
||||
* is not a string
|
||||
* @see #getString(Context, String, String)
|
||||
*/
|
||||
public static String getString(Context context, String key) {
|
||||
if (context == null) return null;
|
||||
return getString(context, key, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* get string preferences
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to retrieve
|
||||
* @param defaultValue Value to return if this preference does not exist
|
||||
* @return The preference value if it exists, or defValue. Throws
|
||||
* ClassCastException if there is a preference with this name that
|
||||
* is not a string
|
||||
*/
|
||||
public static String getString(Context context, String key,
|
||||
String defaultValue) {
|
||||
|
||||
if (context == null) return defaultValue;
|
||||
SharedPreferences settings = context.getSharedPreferences(
|
||||
PREFERENCE_NAME, Context.MODE_PRIVATE);
|
||||
return settings.getString(key, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* put int preferences
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to modify
|
||||
* @param value The new value for the preference
|
||||
* @return True if the new values were successfully written to persistent
|
||||
* storage.
|
||||
*/
|
||||
public static boolean putInt(Context context, String key, int value) {
|
||||
|
||||
if (context == null) return false;
|
||||
SharedPreferences settings = context.getSharedPreferences(
|
||||
PREFERENCE_NAME, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = settings.edit();
|
||||
editor.putInt(key, value);
|
||||
return editor.commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* get int preferences
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to retrieve
|
||||
* @return The preference value if it exists, or -1. Throws
|
||||
* ClassCastException if there is a preference with this name that
|
||||
* is not a int
|
||||
* @see #getInt(Context, String, int)
|
||||
*/
|
||||
public static int getInt(Context context, String key) {
|
||||
|
||||
if (context == null) return -1;
|
||||
SharedPreferences settings = context.getSharedPreferences(
|
||||
PREFERENCE_NAME, Context.MODE_PRIVATE);
|
||||
return getInt(context, key, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* get int preferences
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to retrieve
|
||||
* @param defaultValue Value to return if this preference does not exist
|
||||
* @return The preference value if it exists, or defValue. Throws
|
||||
* ClassCastException if there is a preference with this name that
|
||||
* is not a int
|
||||
*/
|
||||
public static int getInt(Context context, String key, int defaultValue) {
|
||||
if (context == null) return defaultValue;
|
||||
SharedPreferences settings = context.getSharedPreferences(
|
||||
PREFERENCE_NAME, Context.MODE_PRIVATE);
|
||||
return settings.getInt(key, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* put long preferences
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to modify
|
||||
* @param value The new value for the preference
|
||||
* @return True if the new values were successfully written to persistent
|
||||
* storage.
|
||||
*/
|
||||
public static boolean putLong(Context context, String key, long value) {
|
||||
if (context == null) return false;
|
||||
SharedPreferences settings = context.getSharedPreferences(
|
||||
PREFERENCE_NAME, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = settings.edit();
|
||||
editor.putLong(key, value);
|
||||
return editor.commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* get long preferences
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to retrieve
|
||||
* @return The preference value if it exists, or -1. Throws
|
||||
* ClassCastException if there is a preference with this name that
|
||||
* is not a long
|
||||
* @see #getLong(Context, String, long)
|
||||
*/
|
||||
public static long getLong(Context context, String key) {
|
||||
if (context == null) return -1;
|
||||
return getLong(context, key, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* get long preferences
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to retrieve
|
||||
* @param defaultValue Value to return if this preference does not exist
|
||||
* @return The preference value if it exists, or defValue. Throws
|
||||
* ClassCastException if there is a preference with this name that
|
||||
* is not a long
|
||||
*/
|
||||
public static long getLong(Context context, String key, long defaultValue) {
|
||||
if (context == null) return defaultValue;
|
||||
SharedPreferences settings = context.getSharedPreferences(
|
||||
PREFERENCE_NAME, Context.MODE_PRIVATE);
|
||||
|
||||
return settings.getLong(key, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* put float preferences
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to modify
|
||||
* @param value The new value for the preference
|
||||
* @return True if the new values were successfully written to persistent
|
||||
* storage.
|
||||
*/
|
||||
public static boolean putFloat(Context context, String key, float value) {
|
||||
if (context == null) return false;
|
||||
SharedPreferences settings = context.getSharedPreferences(
|
||||
PREFERENCE_NAME, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = settings.edit();
|
||||
editor.putFloat(key, value);
|
||||
return editor.commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* get float preferences
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to retrieve
|
||||
* @return The preference value if it exists, or -1. Throws
|
||||
* ClassCastException if there is a preference with this name that
|
||||
* is not a float
|
||||
* @see #getFloat(Context, String, float)
|
||||
*/
|
||||
public static float getFloat(Context context, String key) {
|
||||
if (context == null) return -1;
|
||||
return getFloat(context, key, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* get float preferences
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to retrieve
|
||||
* @param defaultValue Value to return if this preference does not exist
|
||||
* @return The preference value if it exists, or defValue. Throws
|
||||
* ClassCastException if there is a preference with this name that
|
||||
* is not a float
|
||||
*/
|
||||
public static float getFloat(Context context, String key, float defaultValue) {
|
||||
if (context == null) return defaultValue;
|
||||
SharedPreferences settings = context.getSharedPreferences(
|
||||
PREFERENCE_NAME, Context.MODE_PRIVATE);
|
||||
return settings.getFloat(key, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* put boolean preferences
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to modify
|
||||
* @param value The new value for the preference
|
||||
* @return True if the new values were successfully written to persistent
|
||||
* storage.
|
||||
*/
|
||||
public static boolean putBoolean(Context context, String key, boolean value) {
|
||||
if (context == null) return false;
|
||||
SharedPreferences settings = context.getSharedPreferences(
|
||||
PREFERENCE_NAME, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = settings.edit();
|
||||
editor.putBoolean(key, value);
|
||||
return editor.commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* get boolean preferences, default is false
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to retrieve
|
||||
* @return The preference value if it exists, or false. Throws
|
||||
* ClassCastException if there is a preference with this name that
|
||||
* is not a boolean
|
||||
* @see #getBoolean(Context, String, boolean)
|
||||
*/
|
||||
public static boolean getBoolean(Context context, String key) {
|
||||
if (context == null) return false;
|
||||
return getBoolean(context, key, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* get boolean preferences
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to retrieve
|
||||
* @param defaultValue Value to return if this preference does not exist
|
||||
* @return The preference value if it exists, or defValue. Throws
|
||||
* ClassCastException if there is a preference with this name that
|
||||
* is not a boolean
|
||||
*/
|
||||
public static boolean getBoolean(Context context, String key,
|
||||
boolean defaultValue) {
|
||||
if (context == null) return defaultValue;
|
||||
SharedPreferences settings = context.getSharedPreferences(
|
||||
PREFERENCE_NAME, Context.MODE_PRIVATE);
|
||||
return settings.getBoolean(key, defaultValue);
|
||||
}
|
||||
|
||||
|
||||
public static boolean delete(Context context, String key) {
|
||||
if (context == null) return false;
|
||||
SharedPreferences settings = context.getSharedPreferences(
|
||||
PREFERENCE_NAME, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = settings.edit();
|
||||
editor.remove(key);
|
||||
return editor.commit();
|
||||
}
|
||||
|
||||
}
|
||||
BIN
app_ipc_monitoring/src/main/res/drawable/border_title.png
Normal file
BIN
app_ipc_monitoring/src/main/res/drawable/border_title.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.3 KiB |
19
app_ipc_monitoring/src/main/res/drawable/btn_bg.xml
Normal file
19
app_ipc_monitoring/src/main/res/drawable/btn_bg.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<!-- 圆角深红色按钮 -->
|
||||
<solid android:color="#4D0A0A" />
|
||||
<corners android:radius="8dip" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:state_pressed="false">
|
||||
<shape android:shape="rectangle">
|
||||
<!-- 圆角红色按钮 -->
|
||||
<solid android:color="#D9534F" />
|
||||
<corners android:radius="8dip" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</selector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="162.5625dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="2601"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M0,1023.61V697.58h19.71V326.22h-19.71V0h355.2V19.91h1890.72V0h355.2v326.22h-19.71v371.36h19.71v326.02h-355.2v-19.71H355.2v19.71H59.21M355.2,39.62v19.71H59.21v266.89h-19.71v371.36h19.71v266.89h295.98v19.71h1890.72v-19.71h296V697.58h19.71V326.22h-19.71V59.33h-296V39.62H355.2z"
|
||||
android:fillColor="#0e932e"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="162.5625dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="2601"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M0,1023.61V697.58h19.71V326.22h-19.71V0h355.2V19.91h1890.72V0h355.2v326.22h-19.71v371.36h19.71v326.02h-355.2v-19.71H355.2v19.71H59.21M355.2,39.62v19.71H59.21v266.89h-19.71v371.36h19.71v266.89h295.98v19.71h1890.72v-19.71h296V697.58h19.71V326.22h-19.71V59.33h-296V39.62H355.2z"
|
||||
android:fillColor="#d81e06"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="162.5625dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="2601"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M0,1023.61V697.58h19.71V326.22h-19.71V0h355.2V19.91h1890.72V0h355.2v326.22h-19.71v371.36h19.71v326.02h-355.2v-19.71H355.2v19.71H59.21M355.2,39.62v19.71H59.21v266.89h-19.71v371.36h19.71v266.89h295.98v19.71h1890.72v-19.71h296V697.58h19.71V326.22h-19.71V59.33h-296V39.62H355.2z"
|
||||
android:fillColor="#f4ea2a"/>
|
||||
</vector>
|
||||
69
app_ipc_monitoring/src/main/res/drawable/icon.xml
Normal file
69
app_ipc_monitoring/src/main/res/drawable/icon.xml
Normal file
@@ -0,0 +1,69 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="200dp"
|
||||
android:height="200dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M871.68,277.12L972.8,491.52V569.6s-8.32,76.16 -78.08,95.36H108.16S57.6,668.16 44.8,646.4V516.48s-2.56,-34.56 38.4,-52.48l202.24,-49.28s123.52,-136.32 154.24,-144.64l432,7.04z"
|
||||
android:fillColor="#F8F8FF"/>
|
||||
<path
|
||||
android:pathData="M99.84,678.4c-17.92,0 -53.12,-3.2 -65.92,-25.6 -1.28,-1.92 -1.92,-4.48 -1.92,-6.4V516.48c0,-5.76 0,-44.16 46.08,-64 0.64,0 1.28,-0.64 1.92,-0.64l198.4,-48c26.24,-28.8 126.72,-136.96 157.44,-145.28 1.28,0 2.56,-0.64 3.84,-0.64l432,6.4c5.12,0 9.6,3.2 11.52,7.04L984.32,486.4c0.64,1.92 1.28,3.84 1.28,5.76V571.52c-0.64,3.2 -10.24,85.12 -87.68,106.88 -1.28,0 -2.56,0.64 -3.2,0.64H108.16c-1.28,-0.64 -4.48,-0.64 -8.32,-0.64zM57.6,642.56c8.32,8.32 33.92,11.52 49.92,10.24H892.8c56.32,-16.64 66.56,-76.8 67.2,-83.84V494.72l-96,-204.8 -421.76,-6.4c-19.2,7.68 -88.32,76.16 -146.56,140.16 -1.92,1.92 -3.84,3.2 -6.4,3.84l-201.6,49.28c-30.72,14.08 -30.08,38.4 -30.08,39.04v126.72z"
|
||||
android:fillColor="#708DB7"/>
|
||||
<path
|
||||
android:pathData="M771.2,659.2m-140.16,0a140.16,140.16 0,1 0,280.32 0,140.16 140.16,0 1,0 -280.32,0Z"
|
||||
android:fillColor="#CBD6E2"/>
|
||||
<path
|
||||
android:pathData="M771.2,812.16c-84.48,0 -152.96,-68.48 -152.96,-152.96s68.48,-152.96 152.96,-152.96 152.96,68.48 152.96,152.96 -69.12,152.96 -152.96,152.96zM771.2,531.84c-70.4,0 -127.36,56.96 -127.36,127.36s56.96,127.36 127.36,127.36c70.4,0 127.36,-56.96 127.36,-127.36s-57.6,-127.36 -127.36,-127.36z"
|
||||
android:fillColor="#708DB7"/>
|
||||
<path
|
||||
android:pathData="M771.2,659.2m-56.32,0a56.32,56.32 0,1 0,112.64 0,56.32 56.32,0 1,0 -112.64,0Z"
|
||||
android:fillColor="#DFECF7"/>
|
||||
<path
|
||||
android:pathData="M771.2,728.32c-38.4,0 -69.12,-30.72 -69.12,-69.12s30.72,-69.12 69.12,-69.12 69.12,30.72 69.12,69.12 -31.36,69.12 -69.12,69.12zM771.2,615.68c-23.68,0 -43.52,19.2 -43.52,43.52s19.2,43.52 43.52,43.52 43.52,-19.2 43.52,-43.52 -19.84,-43.52 -43.52,-43.52z"
|
||||
android:fillColor="#708DB7"/>
|
||||
<path
|
||||
android:pathData="M305.92,667.52m-140.16,0a140.16,140.16 0,1 0,280.32 0,140.16 140.16,0 1,0 -280.32,0Z"
|
||||
android:fillColor="#CBD6E2"/>
|
||||
<path
|
||||
android:pathData="M305.92,820.48c-84.48,0 -152.96,-68.48 -152.96,-152.96s68.48,-152.96 152.96,-152.96 152.96,68.48 152.96,152.96 -69.12,152.96 -152.96,152.96zM305.92,540.16c-70.4,0 -127.36,56.96 -127.36,127.36s56.96,127.36 127.36,127.36c70.4,0 127.36,-56.96 127.36,-127.36s-57.6,-127.36 -127.36,-127.36z"
|
||||
android:fillColor="#708DB7"/>
|
||||
<path
|
||||
android:pathData="M305.92,667.52m-56.32,0a56.32,56.32 0,1 0,112.64 0,56.32 56.32,0 1,0 -112.64,0Z"
|
||||
android:fillColor="#DFECF7"/>
|
||||
<path
|
||||
android:pathData="M305.92,736.64c-38.4,0 -69.12,-30.72 -69.12,-69.12s30.72,-69.12 69.12,-69.12 69.12,30.72 69.12,69.12 -31.36,69.12 -69.12,69.12zM305.92,624c-23.68,0 -43.52,19.2 -43.52,43.52s19.2,43.52 43.52,43.52 43.52,-19.2 43.52,-43.52 -19.84,-43.52 -43.52,-43.52z"
|
||||
android:fillColor="#708DB7"/>
|
||||
<path
|
||||
android:pathData="M117.76,464s5.76,64 -65.92,96.64l1.92,-55.68s2.56,-28.8 32.64,-39.04l31.36,-8.32v6.4z"
|
||||
android:fillColor="#FEF185"/>
|
||||
<path
|
||||
android:pathData="M38.4,580.48l2.56,-76.8c0,-1.28 3.2,-37.12 40.96,-49.92h0.64L128,441.6l2.56,21.12c0,3.2 5.76,73.6 -73.6,109.44L38.4,580.48zM65.92,505.6l-0.64,32.64c31.36,-21.76 38.4,-49.92 39.68,-64.64l-15.36,4.48c-20.48,7.04 -23.04,25.6 -23.68,27.52z"
|
||||
android:fillColor="#708DB7"/>
|
||||
<path
|
||||
android:pathData="M850.56,309.12l55.04,131.2 -568.96,-9.6 122.24,-128.64z"
|
||||
android:fillColor="#D0E5FE"/>
|
||||
<path
|
||||
android:pathData="M905.6,454.4l-569.6,-10.24c-5.12,0 -9.6,-3.2 -11.52,-8.32s-1.28,-10.24 2.56,-14.08l122.24,-128.64c2.56,-2.56 5.76,-4.48 9.6,-3.84l391.68,6.4c5.12,0 9.6,3.2 11.52,7.68l55.68,131.2c1.92,3.84 1.28,8.96 -1.28,12.8 -2.56,4.48 -6.4,7.04 -10.88,7.04zM366.08,418.56l520.32,8.32 -44.8,-105.6 -377.6,-6.4 -97.92,103.68z"
|
||||
android:fillColor="#708DB7"/>
|
||||
<path
|
||||
android:pathData="M582.4,300.8v147.2"
|
||||
android:fillColor="#F8F8FF"/>
|
||||
<path
|
||||
android:pathData="M569.6,300.8h25.6v147.2h-25.6z"
|
||||
android:fillColor="#708DB7"/>
|
||||
<path
|
||||
android:pathData="M246.4,355.2h-0.64c-7.04,-0.64 -12.16,-6.4 -12.16,-13.44 1.92,-31.36 27.52,-42.88 44.16,-42.88 7.04,0 12.8,5.76 12.8,12.8s-5.76,12.8 -12.8,12.8c-3.84,0 -17.28,1.92 -18.56,19.2 0,6.4 -5.76,11.52 -12.8,11.52z"
|
||||
android:fillColor="#708DB7"/>
|
||||
<path
|
||||
android:pathData="M197.76,336.64h-0.64c-7.04,-0.64 -12.16,-6.4 -12.16,-13.44 3.2,-51.84 44.8,-65.92 66.56,-65.92 7.04,0 12.8,5.76 12.8,12.8s-5.76,12.8 -12.8,12.8c-3.84,0 -38.4,1.92 -40.96,41.6 -0.64,6.4 -6.4,12.16 -12.8,12.16z"
|
||||
android:fillColor="#708DB7"/>
|
||||
<path
|
||||
android:pathData="M136.32,322.56h-0.64c-7.04,-0.64 -12.16,-6.4 -12.16,-13.44 4.48,-83.2 71.04,-104.96 104.96,-104.96 7.04,0 12.8,5.76 12.8,12.8s-5.76,12.8 -12.8,12.8c-3.2,0 -74.88,1.28 -80,80.64 0,7.04 -5.76,12.16 -12.16,12.16z"
|
||||
android:fillColor="#708DB7"/>
|
||||
<path
|
||||
android:pathData="M524.8,486.4h44.8"
|
||||
android:fillColor="#F8F8FF"/>
|
||||
<path
|
||||
android:pathData="M569.6,499.2h-44.8c-7.04,0 -12.8,-5.76 -12.8,-12.8s5.76,-12.8 12.8,-12.8h44.8c7.04,0 12.8,5.76 12.8,12.8s-5.76,12.8 -12.8,12.8z"
|
||||
android:fillColor="#708DB7"/>
|
||||
</vector>
|
||||
31
app_ipc_monitoring/src/main/res/drawable/item_bg.xml
Normal file
31
app_ipc_monitoring/src/main/res/drawable/item_bg.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_selected="true">
|
||||
<shape android:shape="rectangle">
|
||||
<!-- 圆角红色按钮 -->
|
||||
<solid android:color="#00BFFF" />
|
||||
<corners android:radius="8dp" />
|
||||
<!--边框填充色,边框宽度-->
|
||||
<stroke android:width="1dp" android:color="#B0E0E6" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<!-- 圆角深红色按钮 -->
|
||||
<solid android:color="#808080" />
|
||||
<corners android:radius="8dp" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:state_pressed="false">
|
||||
<shape android:shape="rectangle">
|
||||
<!-- 圆角红色按钮 -->
|
||||
<solid android:color="#C0C0C0" />
|
||||
<corners android:radius="8dp" />
|
||||
<!--边框填充色,边框宽度-->
|
||||
<stroke android:width="1dp" android:color="#808080" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</selector>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="#7CFC00" android:state_pressed="true" />
|
||||
<item android:color="#7CFC00" android:state_checked="true" />
|
||||
<item android:color="#8B4513" android:state_selected="true" />
|
||||
<item android:color="#FFFFFF" />
|
||||
</selector>
|
||||
@@ -0,0 +1,529 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#FFF"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/start"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="开始执行自动驾驶" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/save"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="存储配置" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/path1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="路线1"
|
||||
android:textColor="#000"
|
||||
android:textSize="25sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="开始Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/start_lon1"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="开始Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/start_lat1"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="结束Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/stop_lon1"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="结束Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/stop_lat1"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="途径点Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/t_lon1"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="途径点Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/t_lat1"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#000" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/path2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="路线2"
|
||||
android:textColor="#000"
|
||||
android:textSize="25sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="开始Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/start_lon2"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="开始Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/start_lat2"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="结束Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/stop_lon2"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="结束Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/stop_lat2"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="途径点Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/t_lon2"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="途径点Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/t_lat2"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/path3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="路线3"
|
||||
android:textColor="#000"
|
||||
android:textSize="25sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="开始Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/start_lon3"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="开始Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/start_lat3"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="结束Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/stop_lon3"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="结束Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/stop_lat3"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="途径点Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/t_lon3"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="途径点Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/t_lat3"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#000" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/path4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="路线4"
|
||||
android:textColor="#000"
|
||||
android:textSize="25sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="开始Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/start_lon4"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="开始Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/start_lat4"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="结束Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/stop_lon4"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="结束Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/stop_lat4"
|
||||
android:layout_width="120dp"
|
||||
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="途径点Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/t_lon4"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="途径点Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/t_lat4"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
297
app_ipc_monitoring/src/main/res/layout/activity_guardian.xml
Normal file
297
app_ipc_monitoring/src/main/res/layout/activity_guardian.xml
Normal file
@@ -0,0 +1,297 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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:orientation="vertical"
|
||||
tools:context=".ui.guardian.GuardianActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_top"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:background="@color/colorBlue2"
|
||||
android:padding="15dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_car_type"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent"
|
||||
android:text="车型"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="16dp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/colorWhile"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_ws_state"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent"
|
||||
android:text="ws状态"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="16dp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/colorWhile"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_cloud_state"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent"
|
||||
android:text="云状态"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="16dp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/colorWhile"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_guardian_update"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent"
|
||||
android:text="点击查询"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="16dp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/colorLimeGreen"
|
||||
android:onClick="clientQuery"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_eagle_hz"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent"
|
||||
android:text="0"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="16dp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/colorLimeGreen"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_net_flow"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent"
|
||||
android:text="net"
|
||||
android:gravity="right"
|
||||
android:textSize="12dp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/colorWhile"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<HorizontalScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="center"
|
||||
android:text="软件节点"
|
||||
android:layout_margin="5dp"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textStyle="bold"
|
||||
android:background="@drawable/border_title"/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_node"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/include_line"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_topic"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="center"
|
||||
android:text="Topic"
|
||||
android:layout_margin="5dp"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textStyle="bold"
|
||||
android:background="@drawable/border_title" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_topic"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/include_line"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="center"
|
||||
android:text="硬件节点"
|
||||
android:layout_margin="5dp"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textStyle="bold"
|
||||
android:background="@drawable/border_title" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_hardware"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/include_line"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_cpu"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="center"
|
||||
android:text="CPU状态"
|
||||
android:layout_margin="5dp"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textStyle="bold"
|
||||
android:background="@drawable/border_title" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_cpu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/include_line"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_cpu_program"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="center"
|
||||
android:layout_margin="5dp"
|
||||
android:text="CPU Top10"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textStyle="bold"
|
||||
android:background="@drawable/border_title" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_cpu_program"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/include_line"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_mem"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="center"
|
||||
android:text="内存状态"
|
||||
android:layout_margin="5dp"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textStyle="bold"
|
||||
android:background="@drawable/border_title" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_mem"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/include_line"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_mem_program"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="center"
|
||||
android:layout_margin="5dp"
|
||||
android:text="内存 Top10"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textStyle="bold"
|
||||
android:background="@drawable/border_title" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_mem_program"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/include_line"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_disk"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="center"
|
||||
android:layout_margin="5dp"
|
||||
android:text="磁盘状态"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textStyle="bold"
|
||||
android:background="@drawable/border_title"/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_disk"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
</HorizontalScrollView>
|
||||
</LinearLayout>
|
||||
49
app_ipc_monitoring/src/main/res/layout/activity_main.xml
Normal file
49
app_ipc_monitoring/src/main/res/layout/activity_main.xml
Normal file
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#F5F5F5"
|
||||
tools:context=".ui.mian.MainActivity">
|
||||
|
||||
<include
|
||||
android:id="@+id/include_title"
|
||||
layout="@layout/item_main" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@+id/include_title"
|
||||
android:layout_margin="3dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/info_fragment"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight=".15" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fl_info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#ffffff" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/info_btn"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight=".225" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
34
app_ipc_monitoring/src/main/res/layout/fragment_info.xml
Normal file
34
app_ipc_monitoring/src/main/res/layout/fragment_info.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/colorWhile"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="25dp"
|
||||
android:background="#DCDCDC">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_gravity="center"
|
||||
android:text="INFO TITLE"
|
||||
android:textColor="#40E0D0"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
||||
70
app_ipc_monitoring/src/main/res/layout/fragment_upgrade.xml
Normal file
70
app_ipc_monitoring/src/main/res/layout/fragment_upgrade.xml
Normal file
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/colorWhile"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="25dp"
|
||||
android:background="#DCDCDC">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_gravity="center"
|
||||
android:text="INFO TITLE"
|
||||
android:textColor="#40E0D0"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center">
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:background="@drawable/btn_bg"
|
||||
android:text="确定升级"
|
||||
android:textColor="#ffffff" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:background="@drawable/btn_bg"
|
||||
android:text="取消升级"
|
||||
android:textColor="#ffffff" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:background="@drawable/btn_bg"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="延迟升级(最长50分钟)"
|
||||
android:textColor="#ffffff" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textColor="#000"
|
||||
android:textSize="18sp" />
|
||||
</LinearLayout>
|
||||
115
app_ipc_monitoring/src/main/res/layout/fragment_version.xml
Normal file
115
app_ipc_monitoring/src/main/res/layout/fragment_version.xml
Normal file
@@ -0,0 +1,115 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/colorWhile"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="25dp"
|
||||
android:background="#DCDCDC">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_gravity="center"
|
||||
android:text="INFO TITLE"
|
||||
android:textColor="#40E0D0"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="20dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/config_list"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<View
|
||||
android:id="@+id/line1"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/colorAccent" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/ipc_ip_config"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/ip"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:digits="0123456789.:"
|
||||
android:gravity="center"
|
||||
android:hint="输入IP添加或删除"
|
||||
android:imeOptions="flagNoExtractUi"
|
||||
android:inputType="number"
|
||||
android:maxLength="21"
|
||||
android:maxLines="1"
|
||||
android:minWidth="100dp"
|
||||
android:textSize="16dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:background="@drawable/btn_bg"
|
||||
android:text="添加"
|
||||
android:textColor="#ffffff"
|
||||
app:layout_constraintEnd_toStartOf="@id/btn2"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/ip" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_toEndOf="@id/btn1"
|
||||
android:background="@drawable/btn_bg"
|
||||
android:text="删除"
|
||||
android:textColor="#ffffff"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/btn1"
|
||||
app:layout_constraintTop_toBottomOf="@id/ip" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ips_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:lineSpacingExtra="5dp"
|
||||
android:textIsSelectable="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btn1" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
14
app_ipc_monitoring/src/main/res/layout/include_line.xml
Normal file
14
app_ipc_monitoring/src/main/res/layout/include_line.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?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:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp">
|
||||
|
||||
<View
|
||||
android:layout_width="2dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/colorSlateGray"/>
|
||||
|
||||
</LinearLayout>
|
||||
14
app_ipc_monitoring/src/main/res/layout/include_line2.xml
Normal file
14
app_ipc_monitoring/src/main/res/layout/include_line2.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?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:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:background="@color/colorSlateGray"/>
|
||||
|
||||
</LinearLayout>
|
||||
20
app_ipc_monitoring/src/main/res/layout/item_config.xml
Normal file
20
app_ipc_monitoring/src/main/res/layout/item_config.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:text="工控机IP:"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp" />
|
||||
</LinearLayout>
|
||||
19
app_ipc_monitoring/src/main/res/layout/item_info.xml
Normal file
19
app_ipc_monitoring/src/main/res/layout/item_info.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="4dp"
|
||||
android:background="@drawable/item_bg">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_info_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:text="INFO"
|
||||
android:textColor="@drawable/item_text_color"
|
||||
android:textSize="16dp" />
|
||||
|
||||
</LinearLayout>
|
||||
42
app_ipc_monitoring/src/main/res/layout/item_log_info.xml
Normal file
42
app_ipc_monitoring/src/main/res/layout/item_log_info.xml
Normal file
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--测试列表Item-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/layout_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingBottom="4dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/log"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/transparent"
|
||||
android:cursorVisible="false"
|
||||
android:focusable="false"
|
||||
android:textSize="14dp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
200
app_ipc_monitoring/src/main/res/layout/item_main.xml
Normal file
200
app_ipc_monitoring/src/main/res/layout/item_main.xml
Normal file
@@ -0,0 +1,200 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="55dp"
|
||||
android:background="@color/colorBlue2"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="工控机"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textSize="18dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/role"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBaseline="@id/title"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_toEndOf="@id/title"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textSize="14dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/local_ip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBaseline="@id/title"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_toEndOf="@id/role"
|
||||
android:gravity="center_vertical"
|
||||
android:text="本机IP:"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textSize="10dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ipc_ip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/local_ip"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_toEndOf="@id/role"
|
||||
android:gravity="center_vertical"
|
||||
android:text="IPC IP:"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textSize="10dp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_connect_state"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="20dp"
|
||||
android:gravity="right|center_vertical"
|
||||
android:text="未连接"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textSize="16dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<View
|
||||
android:id="@+id/line2"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_toStartOf="@+id/tv_connect_state"
|
||||
android:background="#fff124" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/switch_log"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toLeftOf="@+id/line2"
|
||||
android:checked="true"
|
||||
android:text="日志:开"
|
||||
android:textColor="@color/colorWhile" />
|
||||
|
||||
|
||||
<View
|
||||
android:id="@+id/line1"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_toStartOf="@+id/switch_log"
|
||||
android:background="#fff124" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/disconnect"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_toStartOf="@+id/line1"
|
||||
android:background="@drawable/btn_bg"
|
||||
android:text="断开"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textSize="16dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/connect"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_toStartOf="@+id/disconnect"
|
||||
android:background="@drawable/btn_bg"
|
||||
android:text="连接"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textSize="16dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<View
|
||||
android:id="@+id/line"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_toStartOf="@+id/connect"
|
||||
android:background="#fff124" />
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/connection_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toStartOf="@+id/line"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/assign"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="指定"
|
||||
android:textColor="#ffffff" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/fixation"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="固定"
|
||||
android:textColor="#ffffff" />
|
||||
</RadioGroup>
|
||||
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_ip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_toStartOf="@+id/connection_type"
|
||||
android:digits="0123456789.:"
|
||||
android:gravity="right|center_vertical"
|
||||
android:hint="IP地址"
|
||||
android:imeOptions="flagNoExtractUi"
|
||||
android:inputType="number"
|
||||
android:maxLength="21"
|
||||
android:maxLines="1"
|
||||
android:minWidth="100dp"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textSize="16dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_ip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_toStartOf="@+id/et_ip"
|
||||
android:gravity="right|center_vertical"
|
||||
android:text="指定IP:"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textSize="16dp"
|
||||
android:textStyle="bold" />
|
||||
</RelativeLayout>
|
||||
63
app_ipc_monitoring/src/main/res/layout/item_node.xml
Normal file
63
app_ipc_monitoring/src/main/res/layout/item_node.xml
Normal file
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/ic_border_green"
|
||||
android:id="@+id/ll_state"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingLeft="25dp"
|
||||
android:paddingRight="20dp"
|
||||
android:layout_marginTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="NAME"
|
||||
android:textSize="15dp"
|
||||
android:textColor="@color/colorBlock"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_node_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="NODE_NAME"
|
||||
android:textSize="15dp"
|
||||
android:textColor="@color/colorBlock"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginBottom="6dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_node_state"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="NODE_STATE"
|
||||
android:textSize="15dp"
|
||||
android:textColor="@color/colorBlock"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_disk_one"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/colorBlock"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_disk_two"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/colorBlock"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_disk_three"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/colorBlock"
|
||||
android:visibility="gone"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
20
app_ipc_monitoring/src/main/res/values/colors.xml
Normal file
20
app_ipc_monitoring/src/main/res/values/colors.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#008577</color>
|
||||
<color name="colorPrimaryDark">#00574B</color>
|
||||
<color name="colorAccent">#D81B60</color>
|
||||
<color name="colorGold">#FFD700</color>
|
||||
<color name="colorBlue">#102b6a</color>
|
||||
<color name="colorBlue2">#224b8f</color>
|
||||
<color name="colorWhile">#FFFFFF</color>
|
||||
<color name="colorBlock">#000000</color>
|
||||
<color name="colorDeepPink">#FF1493</color>
|
||||
<color name="colorCrimson">#DC143C</color>
|
||||
<color name="colorLimeGreen">#32CD32</color>
|
||||
<color name="colorSlateGray">#708090</color>
|
||||
<color name="connect_status_connected">#32CD32</color>
|
||||
<color name="connect_status_disconnected">#DC143C</color>
|
||||
<color name="connect_status_connecting">#FF00FF</color>
|
||||
<color name="connect_status_disconnecting">#DAA520</color>
|
||||
<color name="connect_status_search_address">#1E90FF</color>
|
||||
</resources>
|
||||
3
app_ipc_monitoring/src/main/res/values/strings.xml
Normal file
3
app_ipc_monitoring/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">工控机监控</string>
|
||||
</resources>
|
||||
20
app_ipc_monitoring/src/main/res/values/styles.xml
Normal file
20
app_ipc_monitoring/src/main/res/values/styles.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">#224b8f</item>
|
||||
<item name="colorPrimaryDark">@color/colorBlue</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.NoActionBar">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
<item name="android:windowBackground">@android:color/white</item>
|
||||
<item name="android:windowEnableSplitTouch">false</item>
|
||||
<item name="android:splitMotionEvents">false</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<network-security-config>
|
||||
<base-config cleartextTrafficPermitted="true" />
|
||||
</network-security-config>
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.zhidao.adas.client;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ buildscript {
|
||||
classpath 'com.volcengine:apm_insight_plugin:1.4.1'
|
||||
classpath 'com.mogo.cloud:thread_opt:1.0.1'
|
||||
classpath 'com.mogo.cloud:systrace:1.0.1'
|
||||
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.8'
|
||||
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.18'
|
||||
|
||||
// classpath ("com.tencent.matrix:matrix-gradle-plugin:0.6.6") { changing = true }
|
||||
}
|
||||
|
||||
@@ -231,15 +231,15 @@ ext {
|
||||
androidx_runner : "androidx.test:runner:1.3.0",
|
||||
androidx_espresso_core : "androidx.test.espresso:espresso-core:3.3.0",
|
||||
|
||||
//========================== ProtoBuf =======================
|
||||
protoc : "com.google.protobuf:protoc:3.12.4",
|
||||
protobuf_java : "com.google.protobuf:protobuf-java:3.12.4",
|
||||
protobuf_java_util : "com.google.protobuf:protobuf-java-util:3.12.4",
|
||||
|
||||
//========================= DataStore ======================
|
||||
androidx_datastore_preferences : "androidx.datastore:datastore-preferences:1.0.0",
|
||||
androidx_datastore : "androidx.datastore:datastore:1.0.0",
|
||||
|
||||
//======================== ProtoBuffer =====================
|
||||
google_proto_java_util : "com.google.protobuf:protobuf-java-util:3.6.1",
|
||||
google_proto_java : "com.google.protobuf:protobuf-java:3.6.1",
|
||||
google_protoc : "com.google.protobuf:protoc:3.6.1"
|
||||
|
||||
]
|
||||
|
||||
}
|
||||
@@ -5,22 +5,24 @@ import android.content.Context
|
||||
import androidx.annotation.RequiresPermission
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlCmdParameter
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
|
||||
import com.mogo.eagle.core.data.autopilot.toRouteInfo
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.constants.MoGoConfig
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_ADAS_IMPL
|
||||
import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
|
||||
import com.mogo.eagle.core.data.trafficlight.toTrafficLightDetail
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotProvider
|
||||
import com.mogo.eagle.core.function.api.map.collect.IMoGoMapDataCollectProvider
|
||||
import com.mogo.eagle.core.function.autopilot.adapter.MoGoAdasListenerImpl
|
||||
import com.mogo.eagle.core.function.autopilot.adapter.MoGoAdasMsgConnectStatusListenerImpl
|
||||
import com.mogo.eagle.core.function.autopilot.adapter.MoGoHandAdasMsgManager
|
||||
import com.mogo.eagle.core.function.autopilot.server.AsyncDataToAutopilotServer
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.telematic.MogoProtocolMsg
|
||||
@@ -35,7 +37,6 @@ import com.zhidao.support.adas.high.bean.IPCUpgradeInfo
|
||||
import com.zhidao.support.adas.high.common.Constants
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils
|
||||
import io.netty.channel.Channel
|
||||
import java.util.*
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
|
||||
@@ -54,47 +55,44 @@ class MoGoAutopilotProvider :
|
||||
get() = TAG
|
||||
|
||||
override fun init(context: Context) {
|
||||
MoGoHandAdasMsgManager.getInstance();
|
||||
Logger.d(TAG, "初始化工控机连接……")
|
||||
MoGoHandAdasMsgManager.getInstance()
|
||||
CallerLogger.i("$M_ADAS_IMPL$TAG", "初始化工控机连接……")
|
||||
mContext = context
|
||||
// 初始化ADAS 域控制器
|
||||
CupidLogUtils.setEnableLog(false)
|
||||
CupidLogUtils.setIsWriteLog(false)
|
||||
// TODO 临时方案,根据不同的身份标识,连接不同的工控机IP
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {// 司机
|
||||
// 注册地图采集功能
|
||||
CallerMapDataCollectorManager.registerOnMapCollectTaskListener(this)
|
||||
// "192.168.1.102"
|
||||
val options = AdasOptions.Builder()
|
||||
.setIpcConnectionMode(AdasOptions.IPC_CONNECTION_MODE.FIXATION)
|
||||
.setIpcFixationIP(AdasManager.getInstance().getIPCFixationIPList(mContext))
|
||||
.setClient(false)
|
||||
.build()
|
||||
.setIpcConnectionMode(AdasOptions.IPC_CONNECTION_MODE.FIXATION)
|
||||
.setIpcFixationIP(AdasManager.getInstance().getIPCFixationIPList(mContext))
|
||||
.setClient(false)
|
||||
.build()
|
||||
|
||||
AdasManager.getInstance().create(context, options)
|
||||
AdasManager.getInstance().create(options, MoGoAdasMsgConnectStatusListenerImpl())
|
||||
NSDNettyManager.getInstance().startNSDNettyServerWithSN(context, object :
|
||||
NettyServerListener<MogoProtocolMsg> {
|
||||
override fun onMessageResponseServer(msg: MogoProtocolMsg?, channel: Channel?) {
|
||||
Logger.d(TAG, "Receive client data is:${msg?.toString()}")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "Receive client data is:${msg?.toString()}")
|
||||
}
|
||||
|
||||
override fun onStartServer() {
|
||||
ToastUtils.showShort("司机端服务启动成功!")
|
||||
Logger.d(TAG, "onStartServer")
|
||||
}
|
||||
|
||||
override fun onStopServer() {
|
||||
ToastUtils.showLong("司机端服务停止!")
|
||||
Logger.d(TAG, "onStopServer")
|
||||
}
|
||||
|
||||
override fun onChannelConnect(channel: Channel?) {
|
||||
val socketAddress = channel?.remoteAddress().toString()
|
||||
Logger.d(TAG, "Client ip is:${socketAddress}")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "Client ip is:${socketAddress}")
|
||||
}
|
||||
|
||||
override fun onChannelDisConnect(channel: Channel?) {
|
||||
Logger.d(TAG, "onChannelDisConnect")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "onChannelDisConnect")
|
||||
}
|
||||
}, MoGoAiCloudClientConfig.getInstance().sn)
|
||||
} else {
|
||||
@@ -103,39 +101,38 @@ class MoGoAutopilotProvider :
|
||||
//FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true
|
||||
// "192.168.1.103"
|
||||
val options = AdasOptions
|
||||
.Builder()
|
||||
.setClient(true)
|
||||
.build()
|
||||
AdasManager.getInstance().create(context, options)
|
||||
.Builder()
|
||||
.setClient(true)
|
||||
.build()
|
||||
AdasManager.getInstance().create(options, MoGoAdasMsgConnectStatusListenerImpl())
|
||||
NSDNettyManager.getInstance()
|
||||
.searchAndConnectServer(context, MoGoAiCloudClientConfig.getInstance().sn, object :
|
||||
NettyClientListener<MogoProtocolMsg> {
|
||||
override fun onMessageResponseClient(msg: MogoProtocolMsg?, sign: String?) {
|
||||
Logger.d(TAG, "收到司机端的数据!")
|
||||
// 乘客端收到adas数据直接解析,后续分发解析后的数据流程同司机端
|
||||
msg?.let {
|
||||
AdasManager.getInstance().parseIPCData(it.body)
|
||||
Logger.d(TAG, "解析司机端数据完毕!")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onClientStatusConnectChanged(statusCode: Int, sign: String?) {
|
||||
when (statusCode) {
|
||||
ConnectState.STATUS_CONNECT_SUCCESS -> {
|
||||
Logger.d(TAG, "乘客端连接司机端服务成功! sign is:${sign}")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "乘客端连接司机端服务成功! sign is:${sign}")
|
||||
}
|
||||
else -> {
|
||||
ToastUtils.showLong("和司机端连接异常!")
|
||||
Logger.d(TAG, "client statusCode is:${statusCode}")
|
||||
CallerLogger.d(
|
||||
"$M_ADAS_IMPL$TAG",
|
||||
"client statusCode is:${statusCode}"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
//////////////////////////////////注意先后顺序,AdasManager.getInstance().create后才可以设置监听/////////////////////////////////////////////
|
||||
// 监听 adas 连接状态
|
||||
AdasManager.getInstance()
|
||||
.setOnAdasConnectStatusListener(MoGoAdasMsgConnectStatusListenerImpl())
|
||||
|
||||
// 监听ADAS-SDK获取到的工控机数据(乘客也需注册)
|
||||
AdasManager.getInstance().setOnAdasListener(MoGoAdasListenerImpl())
|
||||
// 司机端监听
|
||||
@@ -143,17 +140,15 @@ class MoGoAutopilotProvider :
|
||||
AdasManager.getInstance().setOnMultiDeviceListener { bytes ->
|
||||
// 发送数据给乘客端
|
||||
if (NSDNettyManager.getInstance().isServerStart) {
|
||||
Logger.d(
|
||||
TAG,
|
||||
"司机端透传数据给乘客端!"
|
||||
)
|
||||
NSDNettyManager.getInstance()
|
||||
.sendMsgToAllClients(MogoProtocolMsg(NORMAL_DATA, bytes.size, bytes))
|
||||
} else {
|
||||
Logger.d(TAG, "司机端Server未启动!")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "司机端Server未启动!")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CallerLogger.i("$M_ADAS_IMPL$TAG", "initServer……")
|
||||
// 同步数据给工控机的服务
|
||||
AsyncDataToAutopilotServer.INSTANCE.initServer()
|
||||
// 同步是否开启美化模式
|
||||
@@ -177,8 +172,9 @@ class MoGoAutopilotProvider :
|
||||
SharedPrefsMgr.getInstance(it).putString(MoGoConfig.AUTOPILOT_IP, autoPilotIp)
|
||||
}
|
||||
// 设置IP地址
|
||||
AdasManager.getInstance().adasOptions.setIpcConnectionMode(AdasOptions.IPC_CONNECTION_MODE.ASSIGN)
|
||||
AdasManager.getInstance().adasOptions.setIpcAssignIP(autoPilotIp)
|
||||
AdasManager.getInstance().adasOptions.ipcConnectionMode =
|
||||
AdasOptions.IPC_CONNECTION_MODE.ASSIGN
|
||||
AdasManager.getInstance().adasOptions.ipcAssignIP = autoPilotIp
|
||||
// 打开通讯连接
|
||||
AdasManager.getInstance().connect()
|
||||
return ""
|
||||
@@ -192,66 +188,75 @@ class MoGoAutopilotProvider :
|
||||
|
||||
override fun onMapCollectStart(cmdId: Int, cmdTime: Long) {
|
||||
val result = recordPackage(2, cmdId)
|
||||
Logger.d(TAG, "开始记录包: [$cmdId, $result]")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "开始记录包: [$cmdId, $result]")
|
||||
}
|
||||
|
||||
override fun onMapCollectEnd(cmdId: Int, cmdTime: Long) {
|
||||
val result = stopRecord(2, cmdId)
|
||||
Logger.d(TAG, "结束记录包: [$cmdId, $result]")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "结束记录包: [$cmdId, $result]")
|
||||
}
|
||||
|
||||
override fun startAutoPilot(result: AutopilotControlParameters) {
|
||||
override fun startAutoPilot(controlParameters: AutopilotControlParameters) {
|
||||
if (AdasManager.getInstance().ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTED) {
|
||||
val parameter = AutopilotControlCmdParameter("aiCloudToStartAutopilot", result)
|
||||
AdasManager.getInstance().aiCloudToAdasData(GsonUtils.toJson(parameter))
|
||||
AdasManager.getInstance().sendAutoPilotModeReq(1, 1, controlParameters.toRouteInfo())
|
||||
} else {
|
||||
Logger.e(TAG, "车机与工控机链接失败,无法开启自动驾驶")
|
||||
CallerLogger.e("$M_ADAS_IMPL$TAG", "车机与工控机链接失败,无法开启自动驾驶")
|
||||
}
|
||||
}
|
||||
|
||||
override fun sendTrafficLightData(trafficLightResult: TrafficLightResult) {
|
||||
AdasManager.getInstance().sendTrafficLightData(
|
||||
trafficLightResult.crossId,
|
||||
trafficLightResult.lat,
|
||||
trafficLightResult.lon,
|
||||
trafficLightResult.heading,
|
||||
trafficLightResult.direction,
|
||||
trafficLightResult.lightId,
|
||||
trafficLightResult.laneNo,
|
||||
trafficLightResult.arrowNo,
|
||||
trafficLightResult.flashYellow,
|
||||
trafficLightResult.toTrafficLightDetail()
|
||||
)
|
||||
}
|
||||
|
||||
override fun sendMessageToAutopilot(jsonString: String) {
|
||||
AdasManager.getInstance().sendMessage(jsonString)
|
||||
}
|
||||
|
||||
override fun cancelAutoPilot() {
|
||||
if (AdasManager.getInstance().ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTED) {
|
||||
AdasManager.getInstance().controlAutopilotCarHead()
|
||||
AdasManager.getInstance().sendAutoPilotModeReq(0, 1, null)
|
||||
} else {
|
||||
Logger.e(TAG, "车机与工控机链接失败,无法断开自动驾驶")
|
||||
CallerLogger.e("$M_ADAS_IMPL$TAG", "车机与工控机链接失败,无法断开自动驾驶")
|
||||
}
|
||||
}
|
||||
|
||||
override fun recordPackage(): Boolean {
|
||||
return AdasManager.getInstance()
|
||||
.recordPackage(1, (System.currentTimeMillis() / 1000).toInt())
|
||||
.startRecordPackage((System.currentTimeMillis() / 1000).toInt(), 1)
|
||||
}
|
||||
|
||||
override fun recordPackage(type: Int, id: Int): Boolean {
|
||||
return AdasManager.getInstance().recordPackage(type, id)
|
||||
return AdasManager.getInstance().startRecordPackage(id, type)
|
||||
}
|
||||
|
||||
override fun recordPackage(type: Int, id: Int, duration: Int): Boolean {
|
||||
return AdasManager.getInstance().recordPackage(type, id, duration)
|
||||
return AdasManager.getInstance().startRecordPackage(id, duration, type)
|
||||
}
|
||||
|
||||
override fun stopRecord(type: Int, id: Int): Boolean {
|
||||
return AdasManager.getInstance().stopRecord(type, id)
|
||||
return AdasManager.getInstance().stopRecordPackage(id, type)
|
||||
}
|
||||
|
||||
override fun setEnableLog(isEnableLog: Boolean) {
|
||||
CupidLogUtils.setEnableLog(isEnableLog)
|
||||
}
|
||||
|
||||
override fun setIsWriteLog(isWriteLog: Boolean) {
|
||||
CupidLogUtils.setIsWriteLog(isWriteLog)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
CallerMapDataCollectorManager.unRegisterOnMapCollectTaskListener(this)
|
||||
}
|
||||
|
||||
override fun setAutoPilotSpeed(speed: Int): Boolean {
|
||||
return AdasManager.getInstance().setSpeed(speed)
|
||||
return AdasManager.getInstance().sendAutopilotSpeedReq(speed.toDouble())
|
||||
}
|
||||
|
||||
override fun setIPCShutDown() {
|
||||
@@ -263,21 +268,24 @@ class MoGoAutopilotProvider :
|
||||
}
|
||||
|
||||
override fun recordCause(key: String?, name: String?, id: String?, reason: String?) {
|
||||
AdasManager.getInstance().recordCause(key, name, id, reason)
|
||||
key?.let {
|
||||
AdasManager.getInstance()
|
||||
.sendRecordCause(it.toLong(), name ?: "", id ?: "", reason ?: "")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 工控机升级确认
|
||||
*/
|
||||
override fun setIPCUpgradeAffirm() {
|
||||
AdasManager.getInstance().sendBaseInfo(IPCUpgradeInfo.affirm());
|
||||
AdasManager.getInstance().sendBaseInfo(IPCUpgradeInfo.affirm())
|
||||
}
|
||||
|
||||
/**
|
||||
* 工控机升级取消
|
||||
*/
|
||||
override fun setIPCUpgradeCancel() {
|
||||
AdasManager.getInstance().sendBaseInfo(IPCUpgradeInfo.cancel());
|
||||
AdasManager.getInstance().sendBaseInfo(IPCUpgradeInfo.cancel())
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -287,22 +295,36 @@ class MoGoAutopilotProvider :
|
||||
*/
|
||||
override fun setDemoMode(isEnable: Boolean) {
|
||||
if (isEnable) {
|
||||
AdasManager.getInstance().enableDemoMode()
|
||||
AdasManager.getInstance().sendDemoModeReq(1)
|
||||
} else {
|
||||
AdasManager.getInstance().disableDemoMode()
|
||||
AdasManager.getInstance().sendDemoModeReq(0)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 办公室调试使用,强制开启自动驾驶,将 status,pilotmode,control_pilotmode,强追设置为 1
|
||||
* 办公室调试使用,强制开启自动驾驶,将 status,pilotMode,control_pilotMode,强追设置为 1
|
||||
* isEnable = true 开启
|
||||
* isEnable = false 关闭
|
||||
*/
|
||||
override fun setControlAutopilotCarAuto(isEnable: Boolean) {
|
||||
if (isEnable) {
|
||||
AdasManager.getInstance().controlAutopilotCarAuto()
|
||||
AdasManager.getInstance().sendAutoPilotModeReq(1, 0, null)
|
||||
} else {
|
||||
AdasManager.getInstance().controlAutopilotCarHead()
|
||||
AdasManager.getInstance().sendAutoPilotModeReq(0, 0, null)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求工控机基础配置信息
|
||||
*/
|
||||
override fun getCarConfig() {
|
||||
AdasManager.getInstance().sendCarConfigReq()
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全局路径
|
||||
*/
|
||||
override fun getGlobalPath() {
|
||||
AdasManager.getInstance().sendGlobalPathReq()
|
||||
}
|
||||
}
|
||||
@@ -1,365 +0,0 @@
|
||||
package com.mogo.eagle.core.function.autopilot.adapter;
|
||||
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ARRIVE;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_GUARDIAN;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_RECORD;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ROUTE;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_STATUS;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_WARN;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_CAR_STATE;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_RECT_DATA;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_ADAS;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_DATA;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo;
|
||||
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.autopilot.AutopilotWarnMessage;
|
||||
import com.mogo.eagle.core.data.config.HdMapBuildConfig;
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData;
|
||||
import com.mogo.eagle.core.function.autopilot.utils.AdasObjectConvertUtils;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
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.module.service.MarkerServiceHandler;
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotRoute;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotStatus;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotWayArrive;
|
||||
import com.zhidao.support.adas.high.bean.CarLaneInfo;
|
||||
import com.zhidao.support.adas.high.bean.CarStateInfo;
|
||||
import com.zhidao.support.adas.high.bean.IPCUpgradeStateInfo;
|
||||
import com.zhidao.support.adas.high.bean.LightStatueInfo;
|
||||
import com.zhidao.support.adas.high.bean.ObstaclesInfo;
|
||||
import com.zhidao.support.adas.high.bean.RectInfo;
|
||||
import com.zhidao.support.adas.high.bean.SSHResult;
|
||||
import com.zhidao.support.adas.high.bean.TrajectoryInfo;
|
||||
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
|
||||
import com.zhidao.support.adas.high.bean.guardian.AutopilotGuardianInfo;
|
||||
import com.zhidao.support.adas.high.bean.record.AutopilotRecordResult;
|
||||
import com.zhjt.service.chain.ChainLog;
|
||||
import com.zhjt.service.chain.TracingConstants;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/22
|
||||
* <p>
|
||||
* 适配ADAS 回调监听分发,这里不做业务,只做数据包装及分发处理
|
||||
*/
|
||||
public class MoGoAdasListenerImpl implements OnAdasListener {
|
||||
private final String TAG = "OnAdasListenerAdapter";
|
||||
|
||||
@ChainLog(linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = TracingConstants.Endpoint.PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_RECT_DATA,
|
||||
paramIndexes = {0},
|
||||
clientPkFileName = "sn")
|
||||
@Override
|
||||
public void onRectData(RectInfo rectInfo) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
ArrayList<TrafficData> recognizedListResults = AdasObjectConvertUtils.INSTANCE.regroupTrafficDataData(rectInfo.getModels());
|
||||
CallerAutopilotIdentifyListenerManager.INSTANCE.invokeAutopilotIdentifyDataUpdate(recognizedListResults);
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = TracingConstants.Endpoint.PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_CAR_STATE,
|
||||
paramIndexes = {0},
|
||||
clientPkFileName = "sn")
|
||||
@Override
|
||||
public void onCarStateData(CarStateInfo carStateInfo) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
// Logger.d(TAG, "--------carStateInfo.toString() = " + carStateInfo.toString());
|
||||
AutopilotCarStateInfo autopilotCarStateInfo = AdasObjectConvertUtils.INSTANCE.fromAdasCarStateInfoObject(carStateInfo);
|
||||
// 将数据通过数据中心分发出去
|
||||
CallerAutopilotCarStatusListenerManager.INSTANCE.invokeAutopilotCarStateData(autopilotCarStateInfo);
|
||||
// 同步给MAP地图
|
||||
adasCarDataCallback(autopilotCarStateInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void adasCarDataCallback(@Nullable AutopilotCarStateInfo stateInfo) {
|
||||
|
||||
if (stateInfo != null && stateInfo.getValues() != null) {
|
||||
//Logger.d(TAG,"同步自车数据给地图……");
|
||||
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().setLastLat(stateInfo.getValues().getLat());
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().setLastLon(stateInfo.getValues().getLon());
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().setSatelliteTime(stateInfo.getValues().getSatelliteTime());
|
||||
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("heading", stateInfo.getValues().getHeading());
|
||||
data.putOpt("acceleration", stateInfo.getValues().getAcceleration());
|
||||
data.putOpt("yawRate", stateInfo.getValues().getYaw_rate());
|
||||
data.putOpt("gpsProvider", 1);
|
||||
try {
|
||||
data.putOpt("systemTime", Long.parseLong(stateInfo.getValues().getSystemTime()));
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
data.putOpt("satelliteTime", Long.parseLong(stateInfo.getValues().getSatelliteTime()));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
data.putOpt("receiverDataTime", Long.parseLong(stateInfo.getValues().getReceiverDataTime()));
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
data.putOpt("adasSatelliteTime", Long.parseLong(stateInfo.getValues().getAdasSatelliteTime()));
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
}
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map(data);
|
||||
SnapshotLocationDataCenter.getInstance().syncAdasLocationInfo(data);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = TracingConstants.Endpoint.PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_STATUS,
|
||||
paramIndexes = {0},
|
||||
clientPkFileName = "sn")
|
||||
@Override
|
||||
public void autopilotStatus(AutopilotStatus autopilotStatus) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
AutopilotStatus.ValuesBean autopilotStatusValues = autopilotStatus.getValues();
|
||||
|
||||
if (autopilotStatusValues != null) {
|
||||
// 初始化自动驾驶状态信息
|
||||
AutopilotStatusInfo autopilotStatusInfo = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo();
|
||||
autopilotStatusInfo.setState(autopilotStatusValues.getState());
|
||||
autopilotStatusInfo.setPilotmode(autopilotStatusValues.getPilotmode());
|
||||
autopilotStatusInfo.setControl_pilotmode(autopilotStatusValues.getControl_pilotmode());
|
||||
autopilotStatusInfo.setReason(autopilotStatusValues.getReason());
|
||||
autopilotStatusInfo.setCamera(autopilotStatusValues.getCamera());
|
||||
autopilotStatusInfo.setRtk(autopilotStatusValues.getRtk());
|
||||
autopilotStatusInfo.setRadar(autopilotStatusValues.getRadar());
|
||||
autopilotStatusInfo.setSpeed(autopilotStatusValues.getSpeed());
|
||||
// 初始化自动驾驶状态信息
|
||||
if (autopilotStatusInfo.getVersion() == null) {
|
||||
autopilotStatusInfo.setVersion(AdasManager.getInstance().getAdasConfig().getVersion());
|
||||
}
|
||||
if (autopilotStatusInfo.getConnectIP() == null) {
|
||||
autopilotStatusInfo.setConnectIP(AdasManager.getInstance().getAdasConfig().getAddress());
|
||||
}
|
||||
if (autopilotStatusInfo.getDockVersion() == null) {
|
||||
autopilotStatusInfo.setDockVersion(AdasManager.getInstance().getAdasConfig().getDockVersion());
|
||||
}
|
||||
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutoPilotStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = TracingConstants.Endpoint.PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ARRIVE,
|
||||
paramIndexes = {0},
|
||||
clientPkFileName = "sn")
|
||||
@Override
|
||||
public void autopilotArrive(AutopilotWayArrive autopilotWayArrive) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
// Logger.d(TAG, "autopilotArrive : " + autopilotWayArrive);
|
||||
if (autopilotWayArrive != null) {
|
||||
AutopilotWayArrive.ResultBean result = autopilotWayArrive.getResult();
|
||||
if (result != null) {
|
||||
AutopilotWayArrive.ResultBean.EndLatLonBean endLatLon = result.getEndLatLon();
|
||||
if (endLatLon != null) {
|
||||
AutopilotStationInfo stationInfo = new AutopilotStationInfo(result.getCarType(), endLatLon.getLon(), endLatLon.getLat());
|
||||
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.invokeArriveAtStation(stationInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = TracingConstants.Endpoint.PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ROUTE,
|
||||
paramIndexes = {0},
|
||||
clientPkFileName = "sn")
|
||||
@Override
|
||||
public void onAutopilotRoute(AutopilotRoute route) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
// Logger.d(TAG, "onAutopilotRoute : " + route.toString());
|
||||
AutopilotRouteInfo autopilotRoute = AdasObjectConvertUtils.INSTANCE.fromAdasAutopilotRoute(route);
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.invokeAutopilotRotting(autopilotRoute);
|
||||
}
|
||||
}
|
||||
|
||||
// @ChainLog(linkCode = CHAIN_LINK_ADAS,
|
||||
// endpoint = TracingConstants.Endpoint.PAD,
|
||||
// nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_TRAJECTORY,
|
||||
// paramIndexes = {0},
|
||||
// clientPkFileName = "sn")
|
||||
@Override
|
||||
public void onAutopilotTrajectory(List<TrajectoryInfo> trajectoryList) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
// Logger.d(TAG, "onAutopilotTrajectory : " + trajectoryList);
|
||||
ArrayList<ADASTrajectoryInfo> trajectoryInfoArrayList = new ArrayList<>();
|
||||
if (trajectoryList != null && trajectoryList.size() > 0) {
|
||||
for (TrajectoryInfo trajectory : trajectoryList) {
|
||||
ADASTrajectoryInfo adasTrajectoryInfo = new ADASTrajectoryInfo();
|
||||
adasTrajectoryInfo.setLat(trajectory.getLat());
|
||||
adasTrajectoryInfo.setLon(trajectory.getLon());
|
||||
adasTrajectoryInfo.setAcceleration(trajectory.getAcceleration());
|
||||
adasTrajectoryInfo.setAccumulatedDis(trajectory.getAccumulatedDis());
|
||||
adasTrajectoryInfo.setTime(trajectory.getTime());
|
||||
adasTrajectoryInfo.setVelocity(trajectory.getVelocity());
|
||||
adasTrajectoryInfo.setAlt(trajectory.getAlt());
|
||||
adasTrajectoryInfo.setKappa(trajectory.getKappa());
|
||||
adasTrajectoryInfo.setTheta(trajectory.getTheta());
|
||||
trajectoryInfoArrayList.add(adasTrajectoryInfo);
|
||||
}
|
||||
// Log.e(TAG, "time:" + System.currentTimeMillis() + "trajectoryInfoArrayList:" + trajectoryInfoArrayList);
|
||||
}
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.invokeAutopilotTrajectory(trajectoryInfoArrayList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotSNRequest() {
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutopilotSNRequest();
|
||||
}
|
||||
|
||||
@ChainLog(linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = TracingConstants.Endpoint.PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_GUARDIAN,
|
||||
paramIndexes = {0},
|
||||
clientPkFileName = "sn")
|
||||
@Override
|
||||
public void onAutopilotGuardian(AutopilotGuardianInfo guardianInfo) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
AutopilotGuardianStatusInfo autopilotRoute = AdasObjectConvertUtils.INSTANCE.fromAutopilotGuardianInfo(guardianInfo);
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutopilotGuardian(autopilotRoute);
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = TracingConstants.Endpoint.PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_RECORD,
|
||||
paramIndexes = {0},
|
||||
clientPkFileName = "sn")
|
||||
@Override
|
||||
public void onAutopilotRecord(AutopilotRecordResult result) {
|
||||
if (result != null) {
|
||||
AutoPilotRecordResult real = new AutoPilotRecordResult();
|
||||
real.setDiskFree(result.getDiskFree());
|
||||
real.setId(result.getId());
|
||||
real.setDuration(result.getDuration());
|
||||
real.setNote(result.getNote());
|
||||
real.setTotal(result.getTotalSize());
|
||||
real.setType(result.getType());
|
||||
real.setFileName(result.getFilename());
|
||||
real.setKey(result.getKey());
|
||||
real.setStat(result.getStat());
|
||||
real.setTimestamp(result.getTimestamp());
|
||||
CallerAutopilotIdentifyListenerManager.INSTANCE.invokeAutopilotRecordResult(real);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onLightStateData(LightStatueInfo lightStatueInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onObstaclesInfo(ObstaclesInfo obstaclesInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLaneInfo(CarLaneInfo carLaneInfo) {
|
||||
|
||||
}
|
||||
|
||||
@ChainLog(linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = TracingConstants.Endpoint.PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_WARN,
|
||||
paramIndexes = {0},
|
||||
clientPkFileName = "sn")
|
||||
@Override
|
||||
public void onWarnMessage(WarnMessageInfo warnMessageInfo) {
|
||||
final AutopilotWarnMessage warnMessage = AdasObjectConvertUtils.INSTANCE.fromAdasObject(warnMessageInfo);
|
||||
CallerAutopilotIdentifyListenerManager.INSTANCE.invokeAutopilotWarnMessage(warnMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoSize(int width, int height) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 工控机升级状态
|
||||
*
|
||||
* @param info 工控机升级状态
|
||||
*/
|
||||
@Override
|
||||
public void onUpgradeStateInfo(IPCUpgradeStateInfo info) {
|
||||
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 onSSHResult(SSHResult info) {
|
||||
if(info!=null && "docker restart autocar_default_1".equals(info.cmd)){
|
||||
CallerHmiManager.INSTANCE.showDockerRebootResult(info.code, info.msg);
|
||||
}else{
|
||||
Logger.d(TAG,"onSSHResult : result info is null");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,311 @@
|
||||
package com.mogo.eagle.core.function.autopilot.adapter
|
||||
|
||||
import chassis.VehicleStateOuterClass
|
||||
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.config.HdMapBuildConfig
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ARRIVE
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_GUARDIAN
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_RECORD
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ROUTE
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_STATUS
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_TRAJECTORY
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_WARN
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_CAR_STATE
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_RECT_DATA
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_LINK_ADAS
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_LINK_LOG_WEB_SOCKET_DATA
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_ADAS_IMPL
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeArriveAtStation
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutoPilotStatus
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotGuardian
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotSNRequest
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager.invokeAutopilotCarConfigData
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager.invokeAutopilotCarStateData
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager.invokeAutopilotIdentifyDataUpdate
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager.invokeAutopilotRecordResult
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager.invokeAutopilotWarnMessage
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager.invokeAutopilotRotting
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager.invokeAutopilotTrajectory
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showAdUpgradeStatus
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showDockerRebootResult
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.module.common.MogoApisHandler
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter
|
||||
import com.mogo.module.service.MarkerServiceHandler
|
||||
import com.zhidao.support.adas.high.AdasManager
|
||||
import com.zhidao.support.adas.high.OnAdasListener
|
||||
import com.zhidao.support.adas.high.bean.IPCUpgradeStateInfo
|
||||
import com.zhidao.support.adas.high.bean.SSHResult
|
||||
import com.zhidao.support.adas.high.common.ProtocolStatus
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
import com.zhjt.service.chain.TracingConstants.Endpoint.Companion.PAD
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo.telematics.pad.MessagePad.TrackedObject
|
||||
import mogo_msg.MogoReportMsg
|
||||
import record_cache.RecordPanelOuterClass
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* @author emArrow
|
||||
* @since 2022/3/11
|
||||
*
|
||||
*
|
||||
* 适配ADAS 回调监听分发,这里不做业务,只做数据包装及分发处理
|
||||
*/
|
||||
class MoGoAdasListenerImpl : OnAdasListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "OnAdasListenerAdapter"
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_TRAJECTORY,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onTrajectory(header: MessagePad.Header, trajectory: MessagePad.Trajectory?) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
val trajectoryInfoArrayList = ArrayList<ADASTrajectoryInfo>()
|
||||
if (trajectory != null && trajectory.pointsList.size > 0) {
|
||||
for (trajectory in trajectory.pointsList) {
|
||||
val adasTrajectoryInfo = ADASTrajectoryInfo()
|
||||
adasTrajectoryInfo.lat = trajectory.latitude
|
||||
adasTrajectoryInfo.lon = trajectory.longitude
|
||||
adasTrajectoryInfo.acceleration = trajectory.acceleration
|
||||
adasTrajectoryInfo.accumulatedDis = trajectory.accumulatedDis
|
||||
adasTrajectoryInfo.time = trajectory.time
|
||||
adasTrajectoryInfo.velocity = trajectory.velocity
|
||||
adasTrajectoryInfo.alt = trajectory.altitude
|
||||
adasTrajectoryInfo.kappa = trajectory.kappa
|
||||
adasTrajectoryInfo.theta = trajectory.theta
|
||||
trajectoryInfoArrayList.add(adasTrajectoryInfo)
|
||||
}
|
||||
}
|
||||
invokeAutopilotTrajectory(trajectoryInfoArrayList)
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_RECT_DATA,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onTrackedObjects(
|
||||
header: MessagePad.Header,
|
||||
trackedObjects: MessagePad.TrackedObjects
|
||||
) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
invokeAutopilotIdentifyDataUpdate(trackedObjects.objsList as List<TrackedObject>?)
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_CAR_STATE,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onGnssInfo(header: MessagePad.Header, gnssInfo: MessagePad.GnssInfo?) {
|
||||
invokeAutopilotCarStateData(gnssInfo)
|
||||
// 同步给MAP地图
|
||||
if (gnssInfo != null) {
|
||||
MogoApisHandler.getInstance().apis.adasControllerApi.lastLat = gnssInfo.latitude
|
||||
MogoApisHandler.getInstance().apis.adasControllerApi.lastLon = gnssInfo.longitude
|
||||
MogoApisHandler.getInstance().apis.adasControllerApi.satelliteTime =
|
||||
java.lang.Double.valueOf(gnssInfo.satelliteTime).toLong()
|
||||
if (1 == FunctionBuildConfig.gpsProvider) {
|
||||
MarkerServiceHandler.getApis().mapServiceApi.mapUIController.syncLocation2Map(
|
||||
gnssInfo
|
||||
)
|
||||
SnapshotLocationDataCenter.getInstance().syncAdasLocationInfo(gnssInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onVehicleState(
|
||||
header: MessagePad.Header,
|
||||
vehicleState: VehicleStateOuterClass.VehicleState?
|
||||
) {
|
||||
if (vehicleState != null) {
|
||||
//转向灯数据
|
||||
CallerAutopilotVehicleStateListenerManager.invokeAutopilotLightSwitchData(vehicleState.light)
|
||||
//刹车灯数据
|
||||
CallerAutopilotVehicleStateListenerManager.invokeAutopilotBrakeLightData(vehicleState.brakeLightStatus)
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_STATUS,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onAutopilotState(
|
||||
header: MessagePad.Header,
|
||||
autopilotState: MessagePad.AutopilotState?
|
||||
) {
|
||||
if (autopilotState != null) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
// 初始化自动驾驶状态信息
|
||||
val autopilotStatusInfo = getAutoPilotStatusInfo()
|
||||
autopilotStatusInfo.state = autopilotState.state
|
||||
autopilotStatusInfo.pilotmode = autopilotState.autopilotMode
|
||||
autopilotStatusInfo.reason = autopilotState.reason
|
||||
autopilotStatusInfo.camera = autopilotState.camera
|
||||
autopilotStatusInfo.rtk = autopilotState.rtk
|
||||
autopilotStatusInfo.radar = autopilotState.radar
|
||||
autopilotStatusInfo.speed = autopilotState.speed.toFloat()
|
||||
autopilotStatusInfo.version = AdasManager.getInstance().adasVersion
|
||||
if (autopilotStatusInfo.connectIP == null) {
|
||||
autopilotStatusInfo.connectIP = AdasManager.getInstance().ipcConnectedIp
|
||||
}
|
||||
if (autopilotStatusInfo.dockVersion == null) {
|
||||
AdasManager.getInstance().carConfig?.let {
|
||||
autopilotStatusInfo.dockVersion = it.dockVersion
|
||||
}
|
||||
}
|
||||
invokeAutoPilotStatus()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_GUARDIAN,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onReportMessage(
|
||||
header: MessagePad.Header,
|
||||
mogoReportMessage: MogoReportMsg.MogoReportMessage?
|
||||
) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
invokeAutopilotGuardian(mogoReportMessage)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBasicInfoReq(
|
||||
header: MessagePad.Header,
|
||||
basicInfoReq: MessagePad.BasicInfoReq?
|
||||
) {
|
||||
invokeAutopilotSNRequest()
|
||||
}
|
||||
|
||||
override fun onCarConfigResp(
|
||||
header: MessagePad.Header,
|
||||
carConfigResp: MessagePad.CarConfigResp?
|
||||
) {
|
||||
if (HdMapBuildConfig.isMapLoaded && carConfigResp != null) {
|
||||
invokeAutopilotCarConfigData(carConfigResp)
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_RECORD,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onRecordResult(
|
||||
header: MessagePad.Header,
|
||||
recordPanel: RecordPanelOuterClass.RecordPanel?
|
||||
) {
|
||||
if (recordPanel != null) {
|
||||
invokeAutopilotRecordResult(recordPanel)
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ROUTE,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onGlobalPathResp(
|
||||
header: MessagePad.Header,
|
||||
globalPathResp: MessagePad.GlobalPathResp?
|
||||
) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
invokeAutopilotRotting(globalPathResp)
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_WARN,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onWarn(header: MessagePad.Header, warn: MessagePad.Warn?) {
|
||||
invokeAutopilotWarnMessage(warn)
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ARRIVE,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onArrivalNotification(
|
||||
header: MessagePad.Header,
|
||||
arrivalNotification: MessagePad.ArrivalNotification?
|
||||
) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
invokeArriveAtStation(arrivalNotification)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onUpgradeStateInfo(info: IPCUpgradeStateInfo) {
|
||||
if (info != null) {
|
||||
CallerLogger.d(
|
||||
"$M_ADAS_IMPL$TAG", "onUpgradeStateInfo " +
|
||||
" upgrade mode=" + info.upgradeMode +
|
||||
" download status=" + info.downloadStatus +
|
||||
" download progress current=" + info.progress.current +
|
||||
" download progress total=" + info.progress.total +
|
||||
" download version=" + info.images +
|
||||
" upgrade status=" + info.upgradeStatus
|
||||
)
|
||||
showAdUpgradeStatus(
|
||||
info.upgradeMode, info.downloadStatus, info.progress.current,
|
||||
info.progress.total, info.images, info.upgradeStatus
|
||||
)
|
||||
} else {
|
||||
CallerLogger.w("$M_ADAS_IMPL$TAG", "onUpgradeStateInfo : upgrade state info is null")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSSHResult(info: SSHResult?) {
|
||||
if (info != null && "docker restart autocar_default_1" == info.cmd) {
|
||||
showDockerRebootResult(info.code, info.msg)
|
||||
} else {
|
||||
CallerLogger.w("$M_ADAS_IMPL$TAG", "onSSHResult : result info is null")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError(status: ProtocolStatus, bytes: ByteArray) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,29 +2,27 @@ package com.mogo.eagle.core.function.autopilot.adapter
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_ADAS_IMPL
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.autopilot.network.AdasServiceModel
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.zhidao.support.adas.high.AdasManager
|
||||
import com.zhidao.support.adas.high.OnAdasConnectStatusListener
|
||||
import com.zhidao.support.adas.high.bean.BasicInfo
|
||||
import com.zhidao.support.adas.high.common.Constants
|
||||
import io.reactivex.Flowable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
/**
|
||||
* ADAS-SDK与工控机连接状态回调
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
|
||||
IMoGoAutopilotStatusListener {
|
||||
private val TAG = "MoGoAdasMsgConnectStatusListenerImpl"
|
||||
private val TAG = "ConnectStatus"
|
||||
|
||||
//自动驾驶状态
|
||||
private var mCurrentAutopilotStatus = -1
|
||||
@@ -35,10 +33,10 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
|
||||
|
||||
override fun onConnectionIPCStatus(ipcConnectionStatus: Int, reason: String?) {
|
||||
if (ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTED) {
|
||||
Logger.d(TAG, "webSocket 连接成功")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "webSocket 连接成功")
|
||||
// 初始化自动驾驶状态信息
|
||||
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectIP =
|
||||
AdasManager.getInstance().adasConfig.address
|
||||
AdasManager.getInstance().ipcConnectedIp
|
||||
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectStatus = true
|
||||
CallerAutoPilotStatusListenerManager.invokeAutoPilotStatus()
|
||||
|
||||
@@ -48,17 +46,17 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
|
||||
// 开启轮训上传自动驾驶状态
|
||||
updateDriveStatusTask()
|
||||
} else if (ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.DISCONNECTED) {
|
||||
Logger.d(TAG, "webSocket 连接失败 reason:$reason")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "webSocket 连接失败 reason:$reason")
|
||||
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectIP =
|
||||
AdasManager.getInstance().adasConfig.address
|
||||
AdasManager.getInstance().ipcConnectedIp
|
||||
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectStatus = false
|
||||
CallerAutoPilotStatusListenerManager.invokeAutoPilotStatus()
|
||||
} else if (ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTING) {
|
||||
Logger.d(TAG, "webSocket 正在连接")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "webSocket 正在连接")
|
||||
} else if (ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.SEARCH_ADDRESS) {
|
||||
Logger.d(TAG, "webSocket 正在搜索工控机IP")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "webSocket 正在搜索工控机IP")
|
||||
} else if (ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.NOT_FOUND_ADDRESS) {
|
||||
Logger.d(TAG, "webSocket 找不到可用IP 传入的IP不可用或固定IP列表中所有IP不可用")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "webSocket 找不到可用IP 传入的IP不可用或固定IP列表中所有IP不可用")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,10 +68,10 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
|
||||
syncBasicInfoToAutopilot()
|
||||
}
|
||||
|
||||
override fun onAutopilotArriveAtStation(autopilotWayArrive: AutopilotStationInfo?) {
|
||||
if (autopilotWayArrive != null) {
|
||||
val lon = autopilotWayArrive.lon
|
||||
val lat = autopilotWayArrive.lat
|
||||
override fun onAutopilotArriveAtStation(arrivalNotification: MessagePad.ArrivalNotification?) {
|
||||
if (arrivalNotification != null && arrivalNotification.endLocation != null) {
|
||||
val lon = arrivalNotification.endLocation.longitude
|
||||
val lat = arrivalNotification.endLocation.latitude
|
||||
AdasServiceModel.getInstance().reportSite(lon, lat)
|
||||
}
|
||||
}
|
||||
@@ -89,20 +87,17 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
|
||||
* 同步SN信息给工控机
|
||||
*/
|
||||
private fun syncBasicInfoToAutopilot() {
|
||||
Logger.d(TAG, "同步PAD的SN给工控机……")
|
||||
val info = BasicInfo()
|
||||
// 设置PAD-SN给工控
|
||||
info.setSn(MoGoAiCloudClientConfig.getInstance().sn)
|
||||
// 设置网络环境
|
||||
info.setNetEnvironment(DebugConfig.getNetMode())
|
||||
AdasManager.getInstance().setBasicInfo(info)
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "同步PAD的SN给工控机……")
|
||||
// 设置PAD-SN给工控,网络环境
|
||||
AdasManager.getInstance()
|
||||
.sendBasicInfoResp(MoGoAiCloudClientConfig.getInstance().sn, DebugConfig.getNetMode())
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传自动驾驶状态任务
|
||||
*/
|
||||
private fun updateDriveStatusTask() {
|
||||
Logger.d(TAG, "updateDriveStatusTask")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "updateDriveStatusTask")
|
||||
Flowable.interval(0, 5, TimeUnit.SECONDS)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.unsubscribeOn(Schedulers.io())
|
||||
|
||||
@@ -1,28 +1,24 @@
|
||||
package com.mogo.eagle.core.function.autopilot.adapter;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
import com.mogo.module.common.drawer.IdentifyDataDrawer;
|
||||
import com.zhidao.support.adas.high.bean.CarStateInfo;
|
||||
import com.zhidao.support.obu.ami.AmiClientManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import chassis.Chassis;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import record_cache.RecordPanelOuterClass;
|
||||
|
||||
public class MoGoHandAdasMsgManager implements
|
||||
IMoGoAutopilotIdentifyListener,
|
||||
IMoGoAutopilotCarStateListener {
|
||||
IMoGoAutopilotVehicleStateListener {
|
||||
|
||||
private final String TAG = "AdasEventManager";
|
||||
|
||||
@@ -30,7 +26,7 @@ public class MoGoHandAdasMsgManager implements
|
||||
|
||||
private MoGoHandAdasMsgManager() {
|
||||
CallerAutopilotIdentifyListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerAutopilotCarStatusListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerAutopilotVehicleStateListenerManager.INSTANCE.addListener(TAG, this);
|
||||
}
|
||||
|
||||
public static MoGoHandAdasMsgManager getInstance() {
|
||||
@@ -44,40 +40,25 @@ public class MoGoHandAdasMsgManager implements
|
||||
return moGoHandAdasMsgManager;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAutopilotCarStateData(@Nullable AutopilotCarStateInfo autoPilotCarStateInfo) {
|
||||
// 获取的自动驾驶车辆信息不是空的时候
|
||||
if (autoPilotCarStateInfo != null) {
|
||||
//can数据转发
|
||||
AutopilotCarStateInfo.ValuesBean bean = autoPilotCarStateInfo.getValues();
|
||||
|
||||
if (bean != null) {
|
||||
//转向灯状态 0是正常 1是左转 2是右转
|
||||
//turnLightOften 是sdk适配的字段,后期建议CarStateInfo和AutopilotCarStateInfo统一成一个
|
||||
int turnLight = bean.getTurnLightOften();
|
||||
AmiClientManager.getInstance().setTurnLightState(turnLight);
|
||||
int brakeLight = bean.getBrake_light(); //1刹车灯亮 其他为松开
|
||||
// Logger.d(TAG, "onCarStateData ---- turnLight = " + turnLight + "---brakeLight = " + brakeLight);
|
||||
//设置转向灯
|
||||
if (turnLight == 1 || turnLight == 2) {
|
||||
CallerHmiManager.INSTANCE.showBrakeLight(0);
|
||||
CallerHmiManager.INSTANCE.showTurnLight(turnLight);
|
||||
}
|
||||
|
||||
//设置刹车信息
|
||||
if (turnLight == 0){
|
||||
CallerHmiManager.INSTANCE.showBrakeLight(brakeLight);
|
||||
}
|
||||
} else {
|
||||
Logger.e(TAG, "bean == null ");
|
||||
}
|
||||
public void onAutopilotLightSwitchData(Chassis.LightSwitch lightSwitch) {
|
||||
//can数据转发 转向灯状态 0是正常 1是左转 2是右转
|
||||
if (lightSwitch != null) {
|
||||
int turnLightNum = lightSwitch.getNumber();
|
||||
AmiClientManager.getInstance().setTurnLightState(turnLightNum);
|
||||
//设置转向灯
|
||||
CallerHmiManager.INSTANCE.showTurnLight(turnLightNum);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotBrakeLightData(boolean brakeLight) {
|
||||
//设置刹车信息
|
||||
CallerHmiManager.INSTANCE.showBrakeLight(brakeLight ? 1 : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotIdentifyDataUpdate(@Nullable ArrayList<TrafficData> trafficData) {
|
||||
public void onAutopilotIdentifyDataUpdate(List<MessagePad.TrackedObject> trafficData) {
|
||||
try {
|
||||
if (FunctionBuildConfig.isDrawIdentifyData) {
|
||||
ThreadUtils.getSinglePool().execute(() ->
|
||||
@@ -92,13 +73,13 @@ public class MoGoHandAdasMsgManager implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotWarnMessage(@Nullable AutopilotWarnMessage autopilotWarnMessage) {
|
||||
public void onAutopilotWarnMessage(MessagePad.Warn warn) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAutopilotRecordResult(AutoPilotRecordResult result) {
|
||||
public void onAutopilotRecordResult(RecordPanelOuterClass.RecordPanel recordPanel) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.eagle.core.function.autopilot.entity;
|
||||
|
||||
/**
|
||||
* Created by XuYong on 2021/5/28 16:12
|
||||
* Created by SuYong on 2021/5/28 16:12
|
||||
*/
|
||||
public class AutonomousDriveStatusBean {
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.eagle.core.function.autopilot.entity;
|
||||
|
||||
/**
|
||||
* Created by XuYong on 2021/5/31 16:24
|
||||
* Created by SuYong on 2021/5/31 16:24
|
||||
*/
|
||||
public class ReportSiteBean {
|
||||
private String sn;
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.mogo.eagle.core.function.autopilot.entity.ReportSiteBean;
|
||||
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;
|
||||
|
||||
@@ -89,7 +88,6 @@ public class AdasServiceModel {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
Logger.d(TAG, "autopilotArrive success");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
package com.mogo.eagle.core.function.autopilot.server
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlCmdParameter
|
||||
import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
|
||||
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
|
||||
import com.mogo.eagle.core.function.call.trafficlight.CallTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
@@ -25,12 +22,10 @@ class AsyncDataToAutopilotServer private constructor() : IMoGoTrafficLightListen
|
||||
}
|
||||
|
||||
fun initServer() {
|
||||
Logger.d(TAG, "initServer……")
|
||||
CallTrafficLightListenerManager.registerTrafficLightListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) {
|
||||
val autopilotControlCmdParameter = AutopilotControlCmdParameter("light", trafficLightResult)
|
||||
CallerAutoPilotManager.sendDataToAutopilot(GsonUtils.toJson(autopilotControlCmdParameter))
|
||||
CallerAutoPilotManager.sendTrafficLightData(trafficLightResult)
|
||||
}
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
package com.mogo.eagle.core.function.autopilot.utils
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage
|
||||
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData
|
||||
import com.zhidao.support.adas.high.bean.AutopilotRoute
|
||||
import com.zhidao.support.adas.high.bean.CarStateInfo
|
||||
import com.zhidao.support.adas.high.bean.RectInfo
|
||||
import com.zhidao.support.adas.high.bean.WarnMessageInfo
|
||||
import com.zhidao.support.adas.high.bean.guardian.AutopilotGuardianInfo
|
||||
import com.zhidao.utils.common.GsonUtil
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/10/18 1:32 下午
|
||||
*/
|
||||
object AdasObjectConvertUtils {
|
||||
val TAG = "AdasObjectConvertUtils"
|
||||
|
||||
fun fromAutopilotGuardianInfo(autopilotGuardianInfo: AutopilotGuardianInfo): AutopilotGuardianStatusInfo? {
|
||||
return GsonUtil.objectFromJson(
|
||||
GsonUtil.jsonFromObject(autopilotGuardianInfo),
|
||||
AutopilotGuardianStatusInfo::class.java
|
||||
)
|
||||
}
|
||||
|
||||
fun fromAdasAutopilotRoute(carStateInfo: AutopilotRoute): AutopilotRouteInfo? {
|
||||
return GsonUtil.objectFromJson(
|
||||
GsonUtil.jsonFromObject(carStateInfo),
|
||||
AutopilotRouteInfo::class.java
|
||||
)
|
||||
}
|
||||
|
||||
fun fromAdasCarStateInfoObject(carStateInfo: CarStateInfo): AutopilotCarStateInfo? {
|
||||
return GsonUtil.objectFromJson(
|
||||
GsonUtil.jsonFromObject(carStateInfo),
|
||||
AutopilotCarStateInfo::class.java
|
||||
)
|
||||
}
|
||||
|
||||
fun fromAdasObject(info: WarnMessageInfo?): AutopilotWarnMessage? {
|
||||
if (info == null) {
|
||||
return null
|
||||
}
|
||||
val warnMessage = AutopilotWarnMessage()
|
||||
warnMessage.content = info.content
|
||||
warnMessage.level = info.level
|
||||
try {
|
||||
warnMessage.type = info.type.toInt()
|
||||
} catch (e: NumberFormatException) {
|
||||
return null
|
||||
}
|
||||
warnMessage.value = info.value
|
||||
return warnMessage
|
||||
}
|
||||
|
||||
fun regroupTrafficDataData(datums: List<RectInfo.RectBean?>?): ArrayList<TrafficData>? {
|
||||
if (datums == null || datums.isEmpty()) {
|
||||
return null
|
||||
}
|
||||
val recognizedListResults: ArrayList<TrafficData> = ArrayList()
|
||||
for (model in datums) {
|
||||
if (model == null) {
|
||||
continue
|
||||
}
|
||||
val recognizedListResult = fromAdasTrafficDataObject(model)
|
||||
if (recognizedListResult != null) {
|
||||
recognizedListResults.add(recognizedListResult)
|
||||
}
|
||||
}
|
||||
return recognizedListResults
|
||||
}
|
||||
|
||||
fun fromAdasTrafficDataObject(model: RectInfo.RectBean?): TrafficData? {
|
||||
if (model == null) {
|
||||
return null
|
||||
}
|
||||
val result = TrafficData()
|
||||
result.uuid = model.uuid
|
||||
result.lat = model.lat
|
||||
result.lon = model.lon
|
||||
result.type = TrafficTypeEnum.getType(model.type.toInt())
|
||||
result.heading = model.heading
|
||||
result.systemTime = model.systemTime.toLong()
|
||||
result.satelliteTime = model.satelliteTime.toLong()
|
||||
result.alt = model.alt
|
||||
result.speed = model.speed
|
||||
result.carId = model.carId
|
||||
result.dataAccuracy = model.dataAccuracy
|
||||
result.distance = model.distance
|
||||
result.threatLevel = model.drawlevel
|
||||
|
||||
//Log.d(TAG, "TrafficData = $result")
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ package com.mogo.eagle.core.function.carcorder.service
|
||||
import android.content.Intent
|
||||
import android.hardware.usb.UsbDevice
|
||||
import android.os.IBinder
|
||||
import android.util.Log
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_CORDER
|
||||
import com.mogo.usbcamera.UVCCameraHelper
|
||||
import com.serenegiant.usb.IFrameCallback
|
||||
import com.serenegiant.usb.USBMonitor
|
||||
@@ -51,7 +51,7 @@ class CarcorderService : BaseService() {
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
if (DEBUG) {
|
||||
Logger.d(TAG, "onCreate……")
|
||||
CallerLogger.d("$M_CORDER$TAG", "onCreate……")
|
||||
}
|
||||
if (mUSBMonitor == null) {
|
||||
mUSBMonitor = USBMonitor(applicationContext, mOnDeviceConnectListener)
|
||||
@@ -63,7 +63,7 @@ class CarcorderService : BaseService() {
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
if (DEBUG) Log.d(TAG, "onDestroy:")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onDestroy:")
|
||||
if (mUSBMonitor != null) {
|
||||
mUSBMonitor!!.unregister()
|
||||
mUSBMonitor = null
|
||||
@@ -80,14 +80,14 @@ class CarcorderService : BaseService() {
|
||||
}
|
||||
|
||||
override fun onRebind(intent: Intent) {
|
||||
if (DEBUG) Log.d(TAG, "onRebind:$intent")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onRebind:$intent")
|
||||
}
|
||||
|
||||
|
||||
override fun onUnbind(intent: Intent): Boolean {
|
||||
if (DEBUG) Log.d(TAG, "onUnbind:$intent")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onUnbind:$intent")
|
||||
|
||||
if (DEBUG) Log.d(TAG, "onUnbind:finished")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onUnbind:finished")
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -102,25 +102,25 @@ class CarcorderService : BaseService() {
|
||||
*/
|
||||
private val mOnDeviceConnectListener: OnDeviceConnectListener = object : OnDeviceConnectListener {
|
||||
override fun onAttach(device: UsbDevice) {
|
||||
if (DEBUG) Log.d(TAG, "OnDeviceConnectListener#onAttach:${device.deviceName}---mDeviceList:${mDeviceList?.size}")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "OnDeviceConnectListener#onAttach:${device.deviceName}---mDeviceList:${mDeviceList?.size}")
|
||||
mUSBMonitor!!.requestPermission(device)
|
||||
}
|
||||
|
||||
override fun onConnect(device: UsbDevice, ctrlBlock: UsbControlBlock, createNew: Boolean) {
|
||||
if (DEBUG) Log.d(TAG, "OnDeviceConnectListener#onConnect:${device.deviceName}")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "OnDeviceConnectListener#onConnect:${device.deviceName}")
|
||||
openCamera(device, ctrlBlock, createNew)
|
||||
}
|
||||
|
||||
override fun onDisconnect(device: UsbDevice, ctrlBlock: UsbControlBlock) {
|
||||
if (DEBUG) Log.d(TAG, "OnDeviceConnectListener#onDisconnect:${device.deviceName}")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "OnDeviceConnectListener#onDisconnect:${device.deviceName}")
|
||||
}
|
||||
|
||||
override fun onDettach(device: UsbDevice) {
|
||||
if (DEBUG) Log.d(TAG, "OnDeviceConnectListener#onDettach:${device.deviceName}")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "OnDeviceConnectListener#onDettach:${device.deviceName}")
|
||||
}
|
||||
|
||||
override fun onCancel(device: UsbDevice) {
|
||||
if (DEBUG) Log.d(TAG, "OnDeviceConnectListener#onCancel:${device.deviceName}")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "OnDeviceConnectListener#onCancel:${device.deviceName}")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ class CarcorderService : BaseService() {
|
||||
mUVCCamera = UVCCamera()
|
||||
mUVCCamera!!.open(ctrlBlock)
|
||||
mUVCCamera!!.setStatusCallback { statusClass, event, selector, statusAttribute, data ->
|
||||
if (DEBUG) Log.d(TAG, "IStatusCallback#onStatus(statusClass=${statusClass},event=${event},selector=${selector},statusAttribute=${statusAttribute},data=${data})")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "IStatusCallback#onStatus(statusClass=${statusClass},event=${event},selector=${selector},statusAttribute=${statusAttribute},data=${data})")
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -156,7 +156,7 @@ class CarcorderService : BaseService() {
|
||||
* 视频帧回掉
|
||||
*/
|
||||
private val mIFrameCallback = IFrameCallback { frame ->
|
||||
if (DEBUG) Log.d(TAG, "IFrameCallback#onFrame:${frame}")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "IFrameCallback#onFrame:${frame}")
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,8 +2,8 @@ package com.mogo.eagle.core.function.carcorder.service
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.IBinder
|
||||
import android.util.Log
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_CORDER
|
||||
import com.serenegiant.usb.common.BaseService
|
||||
|
||||
/**
|
||||
@@ -17,14 +17,14 @@ class LivePushService : BaseService() {
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
if (DEBUG) {
|
||||
Logger.d(TAG, "onCreate……")
|
||||
CallerLogger.d("$M_CORDER$TAG", "onCreate……")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
if (DEBUG) Log.d(TAG, "onDestroy:")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onDestroy:")
|
||||
|
||||
}
|
||||
|
||||
@@ -38,14 +38,14 @@ class LivePushService : BaseService() {
|
||||
}
|
||||
|
||||
override fun onRebind(intent: Intent) {
|
||||
if (DEBUG) Log.d(TAG, "onRebind:$intent")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onRebind:$intent")
|
||||
}
|
||||
|
||||
|
||||
override fun onUnbind(intent: Intent): Boolean {
|
||||
if (DEBUG) Log.d(TAG, "onUnbind:$intent")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onUnbind:$intent")
|
||||
|
||||
if (DEBUG) Log.d(TAG, "onUnbind:finished")
|
||||
if (DEBUG) CallerLogger.d("$M_CORDER$TAG", "onUnbind:finished")
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.mogo.eagle.core.function.chat.facade.aop
|
||||
|
||||
import android.os.Looper
|
||||
import android.util.Log
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_CHAT
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import org.aspectj.lang.ProceedingJoinPoint
|
||||
import org.aspectj.lang.reflect.CodeSignature
|
||||
import org.aspectj.lang.reflect.MethodSignature
|
||||
@@ -37,7 +38,7 @@ open class BaseAspectj {
|
||||
if (Looper.myLooper() != Looper.getMainLooper()) {
|
||||
builder.append("[Thread:\"").append(Thread.currentThread().name).append("\"]")
|
||||
}
|
||||
Log.i(asTag(cls), builder.toString())
|
||||
CallerLogger.d(M_CHAT + asTag(cls), builder.toString())
|
||||
}
|
||||
|
||||
fun exitMethod(joinPoint: ProceedingJoinPoint, result: Any?, lengthMill: Long) {
|
||||
@@ -50,10 +51,10 @@ open class BaseAspectj {
|
||||
&& signature.returnType != Void.TYPE
|
||||
|
||||
val builder = StringBuilder("\u21E0 ")
|
||||
.append(methodName)
|
||||
.append("[")
|
||||
.append(lengthMill)
|
||||
.append("ms]")
|
||||
.append(methodName)
|
||||
.append("[")
|
||||
.append(lengthMill)
|
||||
.append("ms]")
|
||||
|
||||
if (hasReturnType) {
|
||||
builder.append(" = ")
|
||||
@@ -61,7 +62,7 @@ open class BaseAspectj {
|
||||
result.toString()
|
||||
})
|
||||
}
|
||||
Log.i(asTag(cls), builder.toString())
|
||||
CallerLogger.d(M_CHAT + asTag(cls), builder.toString())
|
||||
}
|
||||
|
||||
private fun asTag(cls: Class<*>): String {
|
||||
|
||||
@@ -4,14 +4,11 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Handler
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import com.gme.TMG.ITMGContext
|
||||
import com.gme.av.sdk.AVError
|
||||
import com.gme.av.sig.AuthBuffer
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.function.api.chat.biz.ChatConsts
|
||||
import com.mogo.eagle.core.function.chat.facade.utils.log
|
||||
import com.mogo.eagle.core.utilcode.util.BuildConfig
|
||||
import com.mogo.eagle.core.utilcode.util.Utils
|
||||
import java.lang.ref.WeakReference
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
@@ -30,7 +27,7 @@ internal object GMEApi {
|
||||
}
|
||||
|
||||
private val Intent.result: Int
|
||||
get() = getIntExtra("result" , -1)
|
||||
get() = getIntExtra("result", -1)
|
||||
|
||||
private val Intent.errorInfo: String
|
||||
get() = getStringExtra("error_info") ?: ""
|
||||
@@ -46,7 +43,7 @@ internal object GMEApi {
|
||||
private var ctx: WeakReference<Context>? = null
|
||||
|
||||
private val tmgCtx by lazy {
|
||||
ITMGContext.GetInstance(ctx?.get()?: Utils.getApp())
|
||||
ITMGContext.GetInstance(ctx?.get() ?: Utils.getApp())
|
||||
}
|
||||
|
||||
private val delegate = object : ITMGContext.ITMGDelegate() {
|
||||
@@ -79,7 +76,7 @@ internal object GMEApi {
|
||||
log(ChatConsts.TAG, "成员进房====$it===ownId:$openId")
|
||||
it.toInt() > 99999
|
||||
}.toTypedArray()
|
||||
if (filtered.isEmpty()) {
|
||||
if (filtered.isEmpty()) {
|
||||
log(ChatConsts.TAG, "成员为空,无操作")
|
||||
return
|
||||
}
|
||||
@@ -95,11 +92,11 @@ internal object GMEApi {
|
||||
}
|
||||
|
||||
fun enableAudio() {
|
||||
Log.d(ChatConsts.TAG, "-- enable audio --- 1 ---")
|
||||
log(ChatConsts.TAG, "-- enable audio --- 1 ---")
|
||||
if (!hasInit.get()) {
|
||||
return
|
||||
}
|
||||
Log.d(ChatConsts.TAG, "-- enable audio --- 2 ---")
|
||||
log(ChatConsts.TAG, "-- enable audio --- 2 ---")
|
||||
val audioCtrl = tmgCtx.GetAudioCtrl()
|
||||
//开启麦克
|
||||
audioCtrl?.EnableMic(true)
|
||||
@@ -112,11 +109,11 @@ internal object GMEApi {
|
||||
}
|
||||
|
||||
fun disableAudio() {
|
||||
Log.d(ChatConsts.TAG, "-- disable audio --- 1 ---")
|
||||
log(ChatConsts.TAG, "-- disable audio --- 1 ---")
|
||||
if (!hasInit.get()) {
|
||||
return
|
||||
}
|
||||
Log.d(ChatConsts.TAG, "-- disable audio --- 2 ---")
|
||||
log(ChatConsts.TAG, "-- disable audio --- 2 ---")
|
||||
val audioCtrl = tmgCtx.GetAudioCtrl()
|
||||
audioCtrl?.EnableSpeaker(false)
|
||||
//开启麦克
|
||||
@@ -190,7 +187,7 @@ internal object GMEApi {
|
||||
return
|
||||
}
|
||||
if (mute) {
|
||||
tmgCtx.GetAudioCtrl()?.SetMicVolume(0)
|
||||
tmgCtx.GetAudioCtrl()?.SetMicVolume(0)
|
||||
} else {
|
||||
tmgCtx.GetAudioCtrl()?.SetMicVolume(100)
|
||||
}
|
||||
@@ -199,17 +196,17 @@ internal object GMEApi {
|
||||
|
||||
sealed class GmeState {
|
||||
|
||||
class InitSuccess(val openId: String): GmeState()
|
||||
class InitSuccess(val openId: String) : GmeState()
|
||||
|
||||
class InitFail(val code: Int): GmeState()
|
||||
class InitFail(val code: Int) : GmeState()
|
||||
|
||||
object EnterRoomSuccess: GmeState()
|
||||
object EnterRoomSuccess : GmeState()
|
||||
|
||||
class EnterRoomFail(val code: Int, val msg: String): GmeState()
|
||||
class EnterRoomFail(val code: Int, val msg: String) : GmeState()
|
||||
|
||||
class UserChangeInRoom(val isEnter: Boolean, val left: Array<String>): GmeState()
|
||||
class UserChangeInRoom(val isEnter: Boolean, val left: Array<String>) : GmeState()
|
||||
|
||||
object ExitRoomSuccess: GmeState()
|
||||
object ExitRoomSuccess : GmeState()
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ class VehicleMonitoringManager : ICheckProvider, IMogoStatusChangedListener {
|
||||
private var hasTipShow = false //是否已经弹框提示
|
||||
var dialog: CheckDialog? = null
|
||||
override fun init(context: Context) {
|
||||
LogUtils.dTag(TAG, "初始化 CheckProvider 模块")
|
||||
mContext = context
|
||||
MogoApisHandler.getInstance().apis.statusManagerApi.registerStatusChangedListener(
|
||||
TAG,
|
||||
|
||||
@@ -7,7 +7,6 @@ import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
@@ -91,20 +90,15 @@ public class CheckActivity extends AppCompatActivity {
|
||||
mRecyclerView.setAdapter(mCheckAdapter);
|
||||
}
|
||||
|
||||
|
||||
private void checkAction() {
|
||||
CheckNetWork.INSTANCE.checkNetWork(this.getApplicationContext(), new ICheckResultCallBack() {
|
||||
@Override
|
||||
public void callBackWithCheckData(CheckResultData data) {
|
||||
Log.d("CheckActivity", "车辆自检结果是:" + data.toString());
|
||||
ThreadUtils.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (data != null && mCheckAdapter != null) {
|
||||
mCheckAdapter.errorMsg = null;
|
||||
mCheckAdapter.mCheckResultData = data;
|
||||
mCheckAdapter.notifyDataSetChanged();
|
||||
}
|
||||
ThreadUtils.runOnUiThread(() -> {
|
||||
if (data != null && mCheckAdapter != null) {
|
||||
mCheckAdapter.errorMsg = null;
|
||||
mCheckAdapter.mCheckResultData = data;
|
||||
mCheckAdapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -121,7 +115,6 @@ public class CheckActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* **************************************************************************************检测动画
|
||||
*/
|
||||
@@ -180,16 +173,12 @@ public class CheckActivity extends AppCompatActivity {
|
||||
public void animatorScanCarBorder(boolean show, int weight) {
|
||||
if (show) {
|
||||
mValueAnimator = ValueAnimator.ofInt(0, weight);
|
||||
} else {
|
||||
}
|
||||
mValueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
Rect rect = new Rect(0, 0, (int) mValueAnimator.getAnimatedValue(), scanTopImageView.getHeight());
|
||||
setProgressBarRefresh((int) mValueAnimator.getAnimatedValue());
|
||||
scanTopImageView.setClip(rect);
|
||||
tipsImageView.setClip(rect);
|
||||
}
|
||||
mValueAnimator.addUpdateListener(animation -> {
|
||||
Rect rect = new Rect(0, 0, (int) mValueAnimator.getAnimatedValue(), scanTopImageView.getHeight());
|
||||
setProgressBarRefresh((int) mValueAnimator.getAnimatedValue());
|
||||
scanTopImageView.setClip(rect);
|
||||
tipsImageView.setClip(rect);
|
||||
});
|
||||
mValueAnimator.setDuration(DURATION_TIME);
|
||||
mValueAnimator.start();
|
||||
@@ -200,7 +189,7 @@ public class CheckActivity extends AppCompatActivity {
|
||||
*/
|
||||
public void setProgressBarRefresh(int animateValue) {
|
||||
if (mProgressBar != null) {
|
||||
double scale = new BigDecimal((float) animateValue / scanBottomCarImage.getWidth())
|
||||
double scale = BigDecimal.valueOf((float) animateValue / scanBottomCarImage.getWidth())
|
||||
.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
|
||||
if (mProgressBar.getProgress() < 100) {
|
||||
mProgressBar.setProgress((int) scale);
|
||||
@@ -231,7 +220,7 @@ public class CheckActivity extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mCheckAdapter.ondestry();
|
||||
mCheckAdapter.onDestroy();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.eagle.core.function.check.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -23,7 +22,6 @@ import com.mogo.eagle.core.function.check.net.CheckResultData;
|
||||
*/
|
||||
public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
private static final String TAG = "CheckActivity";
|
||||
LayoutInflater mLayoutInflater;
|
||||
CheckResultData mCheckResultData;
|
||||
private Context mContext;
|
||||
@@ -51,13 +49,11 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
if (viewType == CheckItemInfo.CheckAdapterStyleEnum.ITEM_TYPE_CHECK_TITLE) {
|
||||
View v = mLayoutInflater.inflate(R.layout.check_titel, parent,
|
||||
false);
|
||||
CheckTitleViewHolder holder = new CheckTitleViewHolder(v);
|
||||
return holder;
|
||||
return new CheckTitleViewHolder(v);
|
||||
}
|
||||
View v = mLayoutInflater.inflate(R.layout.check_list, parent,
|
||||
false);
|
||||
CheckListViewHolder holder = new CheckListViewHolder(v);
|
||||
return holder;
|
||||
return new CheckListViewHolder(v);
|
||||
}
|
||||
|
||||
public void dismissDialog() {
|
||||
@@ -66,7 +62,7 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
}
|
||||
}
|
||||
|
||||
public void ondestry() {
|
||||
public void onDestroy() {
|
||||
mContext = null;
|
||||
mCheckInfoListDialog = null;
|
||||
}
|
||||
@@ -74,9 +70,9 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
/**
|
||||
* 顶部view列表
|
||||
*/
|
||||
class CheckTitleViewHolder extends RecyclerView.ViewHolder {
|
||||
private ImageView errorImage;
|
||||
private TextView mTextView;
|
||||
private static class CheckTitleViewHolder extends RecyclerView.ViewHolder {
|
||||
private final ImageView errorImage;
|
||||
private final TextView mTextView;
|
||||
|
||||
public CheckTitleViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
@@ -88,11 +84,11 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
/**
|
||||
* 版本->软件检测
|
||||
*/
|
||||
class CheckListViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView viewTitle;
|
||||
private static class CheckListViewHolder extends RecyclerView.ViewHolder {
|
||||
private final TextView viewTitle;
|
||||
private TextView iconAutoTitle;
|
||||
private TextView autoRiskState;
|
||||
private ImageView iconAuto;
|
||||
private final TextView autoRiskState;
|
||||
private final ImageView iconAuto;
|
||||
|
||||
public CheckListViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
@@ -135,7 +131,6 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
((CheckListViewHolder) holder).autoRiskState.setText("存在异常项");
|
||||
}
|
||||
((CheckListViewHolder) holder).iconAuto.setOnClickListener(v -> {
|
||||
Log.d(TAG, "硬件检测结果:");
|
||||
if (mCheckInfoListDialog != null) {
|
||||
mCheckInfoListDialog.dismiss();
|
||||
}
|
||||
@@ -155,7 +150,6 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
((CheckListViewHolder) holder).autoRiskState.setText("存在异常项");
|
||||
}
|
||||
((CheckListViewHolder) holder).iconAuto.setOnClickListener(v -> {
|
||||
Log.d(TAG, "系统检测结果:");
|
||||
if (mCheckInfoListDialog != null) {
|
||||
mCheckInfoListDialog.dismiss();
|
||||
}
|
||||
|
||||
@@ -19,9 +19,7 @@ import com.mogo.module.common.dialog.BaseFloatDialog;
|
||||
*/
|
||||
public class CheckDialog extends BaseFloatDialog {
|
||||
|
||||
private ImageView cancel;
|
||||
private boolean showWarning;
|
||||
private TextView checkDetail;
|
||||
private Context mContext;
|
||||
|
||||
public CheckDialog(@NonNull Context context, boolean hasError) {
|
||||
@@ -37,11 +35,11 @@ public class CheckDialog extends BaseFloatDialog {
|
||||
|
||||
public void initView() {
|
||||
setContentView(R.layout.check_dialog);
|
||||
cancel = findViewById(R.id.cancel_button);
|
||||
ImageView cancel = findViewById(R.id.cancel_button);
|
||||
cancel.setOnClickListener(v -> {
|
||||
dismiss();
|
||||
});
|
||||
checkDetail = findViewById(R.id.check_detail);
|
||||
TextView checkDetail = findViewById(R.id.check_detail);
|
||||
checkDetail.setOnClickListener(v -> {
|
||||
dismiss();
|
||||
if (mContext != null) {
|
||||
@@ -50,17 +48,15 @@ public class CheckDialog extends BaseFloatDialog {
|
||||
});
|
||||
|
||||
//根据条件显示体检页面/风险提示
|
||||
if (showWarning == true) {
|
||||
if (showWarning) {
|
||||
findViewById(R.id.error_view).setVisibility(View.VISIBLE);
|
||||
findViewById(R.id.check_view).setVisibility(View.INVISIBLE);
|
||||
|
||||
} else {
|
||||
findViewById(R.id.error_view).setVisibility(View.INVISIBLE);
|
||||
findViewById(R.id.check_view).setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void cancel() {
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -25,14 +24,14 @@ public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
LayoutInflater mLayoutInflater;
|
||||
private Context mContext;
|
||||
private String mStyle;
|
||||
private List<CheckResultData.CheckListItem> showData;
|
||||
private final List<CheckResultData.CheckListItem> showData;
|
||||
//item类型
|
||||
public static final int ITEM_TYPE_CONTENT = 0;//内容
|
||||
public static final int ITEM_TYPE_BOTTOM = 1;//footer类型
|
||||
//适配UI的空白表格
|
||||
private int mBottomCount = 0;
|
||||
|
||||
public CheckInfoAdapter(Context context, String style, List checkResultData) {
|
||||
public CheckInfoAdapter(Context context, String style, List<CheckResultData.CheckListItem> checkResultData) {
|
||||
mContext = context;
|
||||
mStyle = style;
|
||||
showData = checkResultData;
|
||||
@@ -50,7 +49,7 @@ public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
}
|
||||
View v = mLayoutInflater.inflate(R.layout.check_info_adapter, parent,
|
||||
false);
|
||||
CheckInfoAdapter.CheckInfoViewHolder holder = new CheckInfoAdapter.CheckInfoViewHolder(v);
|
||||
CheckInfoAdapter.CheckInfoViewHolder holder = new CheckInfoViewHolder(v);
|
||||
return holder;
|
||||
}
|
||||
|
||||
@@ -62,7 +61,7 @@ public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
if (position < showData.size() * 2) {
|
||||
int index = position / 2;
|
||||
CheckResultData.CheckListItem positionItem = showData.get(index);
|
||||
if (isEven(position) == true) {//偶数隐藏图片显示检测指标
|
||||
if (isEven(position)) {//偶数隐藏图片显示检测指标
|
||||
((CheckInfoViewHolder) holder).checkIcon.setVisibility(View.GONE);
|
||||
((CheckInfoViewHolder) holder).mTextView.setText(positionItem.getName());
|
||||
} else {//奇数显示图片和检测指标结果
|
||||
@@ -105,9 +104,9 @@ public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
return showData.size() * 2 + mBottomCount;
|
||||
}
|
||||
|
||||
public class CheckInfoViewHolder extends RecyclerView.ViewHolder {
|
||||
private ImageView checkIcon;
|
||||
private TextView mTextView;
|
||||
private static class CheckInfoViewHolder extends RecyclerView.ViewHolder {
|
||||
private final ImageView checkIcon;
|
||||
private final TextView mTextView;
|
||||
|
||||
public CheckInfoViewHolder(View v) {
|
||||
super(v);
|
||||
@@ -116,7 +115,7 @@ public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
}
|
||||
}
|
||||
|
||||
public class CheckInfoFooter extends RecyclerView.ViewHolder {
|
||||
private static class CheckInfoFooter extends RecyclerView.ViewHolder {
|
||||
public CheckInfoFooter(View v) {
|
||||
super(v);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
@@ -19,9 +18,8 @@ import androidx.recyclerview.widget.StaggeredGridLayoutManager;
|
||||
* @since: 9/22/21
|
||||
*/
|
||||
public class CheckInfoGridItemDivider extends RecyclerView.ItemDecoration {
|
||||
private String TAG = getClass().getSimpleName();
|
||||
private static final int[] ATTRS = new int[]{android.R.attr.listDivider};
|
||||
private Drawable divider;
|
||||
private final Drawable divider;
|
||||
|
||||
public CheckInfoGridItemDivider(Context context) {
|
||||
final TypedArray a = context.obtainStyledAttributes(ATTRS);
|
||||
@@ -44,7 +42,6 @@ public class CheckInfoGridItemDivider extends RecyclerView.ItemDecoration {
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
|
||||
|
||||
drawHorizontal(c, parent);
|
||||
drawVertical(c, parent);
|
||||
|
||||
@@ -138,10 +135,7 @@ public class CheckInfoGridItemDivider extends RecyclerView.ItemDecoration {
|
||||
|
||||
//是否为第一行
|
||||
private boolean isFirstRaw(int pos, int spanCount) {
|
||||
if (pos < spanCount) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return pos < spanCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -63,7 +63,7 @@ public class CheckInfoListDialog extends BaseFloatDialog {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
List resultData = showInfoResult();
|
||||
List<CheckResultData.CheckListItem> resultData = showInfoResult();
|
||||
CheckInfoAdapter adapter = new CheckInfoAdapter(mContext, mStyle, resultData);
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
//关闭按钮
|
||||
@@ -72,13 +72,13 @@ public class CheckInfoListDialog extends BaseFloatDialog {
|
||||
});
|
||||
}
|
||||
|
||||
public List showInfoResult() {
|
||||
public List<CheckResultData.CheckListItem> showInfoResult() {
|
||||
|
||||
if (result.size() > 0) {
|
||||
result.clear();
|
||||
}
|
||||
try {
|
||||
List<CheckResultData.CheckListItem> checkListResult = new ArrayList();
|
||||
List<CheckResultData.CheckListItem> checkListResult = new ArrayList<CheckResultData.CheckListItem>();
|
||||
try {
|
||||
if (mStyle.equals(CheckItemInfo.CheckInfoStyle.CHECK_INFO_STYLE_DEVICES)) {
|
||||
checkListResult = mCheckResultData.getData().getDevices();
|
||||
|
||||
@@ -15,8 +15,8 @@ import com.mogo.eagle.core.function.check.R;
|
||||
* @since: 9/29/21
|
||||
*/
|
||||
public class CheckInfoRecyclerView extends RecyclerView {
|
||||
private int maxHeight = (int) getContext().getResources().getDimension(R.dimen.check_height);
|
||||
private int maxWeight = (int) getContext().getResources().getDimension(R.dimen.check_width);
|
||||
private final int maxHeight = (int) getContext().getResources().getDimension(R.dimen.check_height);
|
||||
private final int maxWeight = (int) getContext().getResources().getDimension(R.dimen.check_width);
|
||||
|
||||
public CheckInfoRecyclerView(@NonNull Context context) {
|
||||
super(context);
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.util.AttributeSet;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.util.LogUtils;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
@@ -32,7 +31,6 @@ class CheckLinearLayout extends LinearLayoutManager {
|
||||
super.onLayoutChildren(recycler, state);
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
e.printStackTrace();
|
||||
LogUtils.dTag("CheckLinearLayout", "崩溃信息--" + e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ android {
|
||||
}
|
||||
protobuf {
|
||||
protoc {
|
||||
artifact = rootProject.ext.dependencies.google_protoc
|
||||
artifact = rootProject.ext.dependencies.protoc
|
||||
}
|
||||
generateProtoTasks {
|
||||
all().each { task ->
|
||||
@@ -76,10 +76,9 @@ dependencies {
|
||||
|
||||
implementation rootProject.ext.dependencies.androidx_datastore
|
||||
implementation rootProject.ext.dependencies.androidxroomruntime
|
||||
implementation rootProject.ext.dependencies.androidxroomktx
|
||||
kapt rootProject.ext.dependencies.androidxroomcompiler
|
||||
|
||||
implementation rootProject.ext.dependencies.google_proto_java
|
||||
implementation rootProject.ext.dependencies.androidxroomktx
|
||||
implementation rootProject.ext.dependencies.protobuf_java
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.androidxrecyclerview
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user