Merge branch 'dev_robotaxi-d-app-module_280_220608_2.8.0' into dev_robotaxi-d-app-module_280_taxi_passenger

This commit is contained in:
yangyakun
2022-06-16 17:32:45 +08:00
104 changed files with 2062 additions and 393 deletions

View File

@@ -15,6 +15,14 @@ public class BusRoutesResult {
private String description;
private int status;
//线路轨迹相关字段
public String csvFileUrl; //轨迹文件下载的cos url默认“”
public String csvFileMd5; //轨迹文件md5默认“”
public String txtFileUrl; //打点文件下载的cos url默认“”
public String txtFileMd5; //轨迹文件md5默认“”
public long contrailSaveTime; //上传轨迹完成时间戳ms用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖
public String carModel; //[optional] 车型号如红旗H9默认“”暂不加入校验逻辑、用于人工排查问题
public int getLineId() {
return lineId;
}

View File

@@ -0,0 +1,5 @@
package com.mogo.och.taxi.passenger.callback;
public interface ITPClickStartAutopilotCallback {
void onClickCallback();
}

View File

@@ -11,7 +11,6 @@ import androidx.lifecycle.LifecycleOwner;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.mvp.Presenter;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.network.utils.GsonUtil;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryRespBean;
@@ -19,7 +18,6 @@ import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerADASStatusCallback;
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerControllerStatusCallback;
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerOrderStatusCallback;
import com.mogo.och.taxi.passenger.callback.ITaxiPassengerCommonCallback;
import com.mogo.och.taxi.passenger.callback.ITaxiPassengerCommonValueCallback;
import com.mogo.och.taxi.passenger.constant.TaxiPassengerOrderStatusEnum;
import com.mogo.och.taxi.passenger.model.TaxiPassengerGeocodeSearchModel;
import com.mogo.och.taxi.passenger.model.TaxiPassengerModel;
@@ -149,7 +147,7 @@ public class BaseTaxiPassengerPresenter extends Presenter<TaxiPassengerBaseFragm
if (TaxiPassengerOrderStatusEnum.Cancel.getCode() == order.orderStatus){
runOnUIThread(() -> {
mView.showOrHideServingOrderFragment(false);
mView.showOrHideStartAutopilotBtn(false);
// mView.showOrHideStartAutopilotView(false);
mView.showOrHidePressengerCheckPager(false, "",
"", "", "", "");
mView.showOrHideArrivedEndLayout(false,"","");
@@ -170,10 +168,10 @@ public class BaseTaxiPassengerPresenter extends Presenter<TaxiPassengerBaseFragm
// TODO: 2022/6/10 若司机端已经确认,则显示开始行程按钮 并且可点击
//TODO: 2022/6/10 若订单取消或者隐藏则隐藏开始行程按钮
if (TaxiPassengerOrderStatusEnum.UserArriveAtStart.getCode() == order.orderStatus){
mView.showOrHideStartAutopilotBtn(true);
// mView.showOrHideStartAutopilotView(true);
}
if (TaxiPassengerOrderStatusEnum.OnTheWayToEnd.getCode() == order.orderStatus){
mView.showOrHideStartAutopilotBtn(false);
// mView.showOrHideStartAutopilotView(false);
}
// 30 用户到达上车点 并通过了手机号后四位验证
// 40 服务中

View File

@@ -11,9 +11,11 @@ import android.view.animation.AnimationUtils
import android.widget.ImageView
import android.widget.RelativeLayout
import android.widget.TextView
import androidx.appcompat.widget.AppCompatImageView
import com.amap.api.navi.view.PoiInputSearchWidget
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.OverlayViewUtils
import com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer
import com.mogo.och.common.module.wigets.OCHBorderShadowLayout
import com.mogo.och.taxi.passenger.R
@@ -53,6 +55,7 @@ class TaxiPassengerArrivedView :RelativeLayout, View.OnClickListener {
private lateinit var ivStarFourth: ImageView
private lateinit var ivStarFifth: ImageView
private lateinit var ivAnimalList: ImageView
private lateinit var acivClose: AppCompatImageView
private lateinit var svpFrame: SimpleVideoPlayer
private var subscribe: Disposable?=null
private var orderNo = ""
@@ -85,6 +88,7 @@ class TaxiPassengerArrivedView :RelativeLayout, View.OnClickListener {
ochShadowLayout = findViewById(R.id.och_shadow_layout)
ochThankShadowLayout = findViewById(R.id.och_thank_shadow_layout)
ivAnimalList = findViewById(R.id.iv_animal_list)
acivClose = findViewById(R.id.aciv_close)
svpFrame = findViewById(R.id.svp_frame)
svpFrame.setBackgroundResource(R.drawable.tail_ani_0000)
svpFrame.setIsTouchWiget(false)
@@ -103,6 +107,11 @@ class TaxiPassengerArrivedView :RelativeLayout, View.OnClickListener {
false
}
acivClose.setOnClickListener {
ochShadowLayout.visibility = View.GONE
OverlayViewUtils.dismissOverlayView(this@TaxiPassengerArrivedView)
}
val url = "android.resource://" + context.packageName + "/" + R.raw.end_video
gsyVideoOptionBuilder.setUrl(url)
.setCacheWithPlay(false)
@@ -281,7 +290,13 @@ class TaxiPassengerArrivedView :RelativeLayout, View.OnClickListener {
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
// 正在展示感谢页面
taxiPassengerCommonCallback?.onCommonCallback()
if (taxiPassengerCommonCallback == null) {
// 没有用户确定页面
OverlayViewUtils.dismissOverlayView(this@TaxiPassengerArrivedView)
} else {
// 有排队展示的用户确定页面
taxiPassengerCommonCallback?.onCommonCallback()
}
}
}

View File

@@ -26,6 +26,7 @@ import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.constants.DataTypes;
import com.mogo.och.common.module.wigets.OCHBorderShadowLayout;
import com.mogo.och.taxi.passenger.R;
import com.mogo.och.taxi.passenger.callback.ITPClickStartAutopilotCallback;
import com.mogo.och.taxi.passenger.presenter.BaseTaxiPassengerPresenter;
import com.mogo.och.taxi.passenger.ui.leftmenu.OverlayLeftViewUtils;
import com.mogo.och.taxi.passenger.ui.video.TaxiPassengerMogoConsultView;
@@ -41,7 +42,7 @@ import java.lang.ref.WeakReference;
* @author tongchenfei
*/
public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFragment, BaseTaxiPassengerPresenter>
implements IMogoMapListener, TaxiPassengerTaxiView {
implements IMogoMapListener, TaxiPassengerTaxiView, ITPClickStartAutopilotCallback {
static final String TAG = "TaxiPassengerBaseFragment";
@@ -50,12 +51,10 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
private ImageView mMapswitchBtn;
private TaxiPassengerTrafficLightView mTrafficLightView;
private TaxiPassengerV2XNotificationView mV2XNotificationView;
private OCHBorderShadowLayout mStartAutopilotBtnView;
private TextView mStartAutopilotBtn;
// private ConstraintLayout mArrivedEndCL;
private WeakReference<TaxiPassengerArrivedView> mArrivedEndView;
private WeakReference<TaxiPassengerCheckView> mArrivedCheckView;
private WeakReference<TaxiPassengerStartAutopilotView> mStartAutopilotView;
protected TaxiPassengerServingOrderFragment ochServingOrderFragment = null;
@@ -79,9 +78,6 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
mAutopilotImage = findViewById(R.id.module_och_autopilot_iv);
flNaviPanelContainer = findViewById(R.id.module_mogo_och_navi_panel_container);
mStartAutopilotBtnView = findViewById(R.id.taxi_p_start_autopilot_shadow);
mStartAutopilotBtn = findViewById(R.id.taxi_p_start_autopilot);
mTrafficLightView = findViewById(R.id.traffic_light_view);
CallerHmiManager.INSTANCE.setProxyTrafficLightView(mTrafficLightView);
@@ -136,10 +132,6 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
OverlayViewUtils.showOverlayView(getActivity(),new TaxiPassengerMogoConsultView(getContext()));
ToastUtils.showShort("测试点击");
});
mStartAutopilotBtn.setOnClickListener(view -> {
ToastUtils.showShort("等待接口。。。。");
});
}
private void initArrivedView(){
@@ -281,15 +273,28 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
}
}
/**
* 显示或者隐藏 "点击开始按钮"
* 显示或者隐藏乘客可点击自动驾驶页面
* 乘客验证成功,页面显示,按钮置于不可点击
* 司机端确认可点击开启自动驾驶, 按钮置为可点击
* 订单前往目的地,页面消失
* @param isShow
*/
public void showOrHideStartAutopilotBtn(boolean isShow){
public void showOrHideStartAutopilotView(boolean isShow, boolean isClickable){
if (isShow){
mStartAutopilotBtnView.setVisibility(View.VISIBLE);
if (mStartAutopilotView == null || mStartAutopilotView.get() == null){
mStartAutopilotView = new WeakReference<>(new TaxiPassengerStartAutopilotView(getContext()));
}
OverlayViewUtils.showOverlayView(getActivity(),mStartAutopilotView.get());
mStartAutopilotView.get().setOnClickStartAutopilotBtnCallback(this);
mStartAutopilotView.get().updateStartAutopilotBtnStatus(isClickable);
}else {
mStartAutopilotBtnView.setVisibility(View.GONE);
if (mStartAutopilotView == null || mStartAutopilotView.get() == null){
return;
}
OverlayViewUtils.dismissOverlayView(mStartAutopilotView.get());
}
}
@@ -323,11 +328,9 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
String passengerNum,
String carNumber,
String phone){
// 正在展示打分页面或者正在展示感谢页面
showOrHideArrivedEndLayout(false, "","");
showOrHideArrivedEndLayout(false, "", "");
showOrHidePressengerCheckPager(true, startSiteAddr,
endSiteAddr, passengerNum, carNumber, phone);
}
/**
@@ -373,4 +376,9 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
mArrivedEndView.get().scoreFail();
}
}
@Override
public void onClickCallback() {
//todo 点击开始自动驾驶按钮
}
}

View File

@@ -0,0 +1,57 @@
package com.mogo.och.taxi.passenger.ui;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.och.common.module.wigets.OCHBorderShadowLayout;
import com.mogo.och.taxi.passenger.R;
import com.mogo.och.taxi.passenger.callback.ITPClickStartAutopilotCallback;
/**
* @author: wangmingjun
* @date: 2022/6/14
*/
public class TaxiPassengerStartAutopilotView extends RelativeLayout implements View.OnClickListener {
private TextView mStartAutopilotBtn;
private ITPClickStartAutopilotCallback mClickCallback;
public TaxiPassengerStartAutopilotView(Context context) {
super(context);
}
public TaxiPassengerStartAutopilotView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public TaxiPassengerStartAutopilotView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initView(context);
}
private void initView(Context context) {
LayoutInflater.from(context).inflate(R.layout.taxi_p_start_autopilot_view, this, true);
mStartAutopilotBtn = findViewById(R.id.taxi_p_start_autopilot);
mStartAutopilotBtn.setOnClickListener(this);
}
public void setOnClickStartAutopilotBtnCallback(ITPClickStartAutopilotCallback clickCallback){
this.mClickCallback = clickCallback;
}
@Override
public void onClick(View v) {
if (v.getId() == R.id.taxi_p_start_autopilot){
ToastUtils.showShort("等待接口。。。。");
}
}
public void updateStartAutopilotBtnStatus(boolean isClickable){
mStartAutopilotBtn.setClickable(isClickable);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@@ -14,6 +14,16 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/aciv_close"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:src="@drawable/taxi_p_passenger_arrived_close"
android:layout_marginEnd="@dimen/dp_70"
android:layout_marginTop="@dimen/dp_140"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<com.mogo.och.common.module.wigets.OCHBorderShadowLayout
android:id="@+id/och_shadow_layout"
android:layout_width="wrap_content"

View File

@@ -130,32 +130,4 @@
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.mogo.och.common.module.wigets.OCHBorderShadowLayout
android:id="@+id/taxi_p_start_autopilot_shadow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:bgColor="@color/taxi_p_map_bg"
app:blurRadius="@dimen/dp_80"
app:shadowColor="@color/taxi_p_start_autopilot_bg_shadow"
app:shadowRadius="@dimen/dp_80"
app:shadow_position="outer"
app:xOffset="0px"
app:yOffset="0px"
android:visibility="gone"
android:layout_marginBottom="@dimen/dp_120"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent">
<TextView
android:id="@+id/taxi_p_start_autopilot"
android:layout_width="@dimen/taxi_p_start_autopilot_btn_width"
android:layout_height="@dimen/taxi_p_start_autopilot_btn_height"
android:gravity="center"
android:text="@string/taxi_p_start_autopilot_txt"
android:textSize="@dimen/taxi_p_start_autopilot_txt_size"
android:textStyle="bold"
android:textColor="@android:color/white"
android:elevation="5dp"
android:background="@drawable/taxi_p_start_autopilot_txt_btn_bg"/>
</com.mogo.och.common.module.wigets.OCHBorderShadowLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:ignore="MissingDefaultResource"
android:background="@drawable/taxi_p_passenger_check_panel_bg">
<com.mogo.och.common.module.wigets.OCHBorderShadowLayout
android:id="@+id/taxi_p_start_autopilot_shadow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:bgColor="@color/taxi_p_map_bg"
app:blurRadius="@dimen/dp_80"
app:shadowColor="@color/taxi_p_start_autopilot_bg_shadow"
app:shadowRadius="@dimen/dp_80"
app:shadow_position="outer"
app:xOffset="0px"
app:yOffset="0px"
android:layout_marginBottom="@dimen/dp_120"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent">
<TextView
android:id="@+id/taxi_p_start_autopilot"
android:layout_width="@dimen/taxi_p_start_autopilot_btn_width"
android:layout_height="@dimen/taxi_p_start_autopilot_btn_height"
android:gravity="center"
android:text="@string/taxi_p_start_autopilot_txt"
android:textSize="@dimen/taxi_p_start_autopilot_txt_size"
android:textStyle="bold"
android:textColor="@android:color/white"
android:elevation="5dp"
android:background="@drawable/taxi_p_start_autopilot_txt_btn_bg"/>
</com.mogo.och.common.module.wigets.OCHBorderShadowLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -52,12 +52,12 @@ public class OrderQueryRespBean extends BaseData {
//线路轨迹相关字段
public long lineId; //路线id默认-1
public String trajUrl; //轨迹文件下载的cos url默认“”
public String trajMd5; //轨迹文件md5默认“”
public String stopUrl; //打点文件下载的cos url默认“”
public String stopMd5; //轨迹文件md5默认“”
public long timestamp; //上传轨迹完成时间戳ms用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖
public String vehicleModel; //[optional] 车型号如红旗H9默认“”暂不加入校验逻辑、用于人工排查问题
public String csvFileUrl; //轨迹文件下载的cos url默认“”
public String csvFileMd5; //轨迹文件md5默认“”
public String txtFileUrl; //打点文件下载的cos url默认“”
public String txtFileMd5; //轨迹文件md5默认“”
public long contrailSaveTime; //上传轨迹完成时间戳ms用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖
public String carModel; //[optional] 车型号如红旗H9默认“”暂不加入校验逻辑、用于人工排查问题
// !!!接口中暂无此字段仅用于本地实现逻辑使用起始站目的站距离km
public double travelDistance;

View File

@@ -1304,7 +1304,7 @@ public class TaxiModel {
/**
* 调试使用,没有乘客屏时可使用此按钮跳过乘客验证
*/
public void debugPassengerCheckDone() {
public void jumpPassengerCheckDone() {
if (mCurrentOCHOrder == null
|| mCurrentOCHOrder.orderStatus != TaxiOrderStatusEnum.ArriveAtStart.getCode()
|| mCurrentOCHOrder.passengerPhone == null || mCurrentOCHOrder.passengerPhone.length() < 5) {

View File

@@ -95,6 +95,13 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
TaxiModel.getInstance().startAutoPilot(isRestart);
}
/**
* 跳过乘客验证环节
*/
public void jumpPassengerCheckDone(){
TaxiModel.getInstance().jumpPassengerCheckDone();
}
// 更新出车/收车状态
public void updateCarStatus() {
TaxiModel.getInstance().updateCarStatus();

View File

@@ -92,6 +92,9 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
private TextView mGoAheadStationTitleTv31;
private TextView mCatchStationTitleTv31;
private ImageView mNaviIcon;
private TextView mPassengerNum;
private TextView mPassengerPhone;
private ConstraintLayout mPassengerInfoLayout;
private TextView mNoDatasTv;
@@ -125,6 +128,11 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
mCatchStationTitleTv31 = view.findViewById(R.id.go_ahead_station_catch_31);
mGoAheadStationTitleTv31 = view.findViewById(R.id.go_ahead_station_31);
mArrivedStationTitleTv32 = view.findViewById(R.id.arrive_station_32);
mPassengerInfoLayout = view.findViewById(R.id.module_och_taxi_order_passenger_data);
mPassengerNum = view.findViewById(R.id.taxi_passenger_num);
mPassengerPhone = view.findViewById(R.id.taxi_passenger_phone);
mNoDatasTv = view.findViewById(R.id.no_order_data_tv);
mNoDataView = view.findViewById(R.id.being_no_data_view);
mOrderCancel.setOnClickListener(this);
@@ -173,15 +181,11 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
GradientDrawable background = (GradientDrawable) mOrderServerStatus.getBackground();//GradientDrawable是Drawable的子类
background.setColor(Color.parseColor("#FF1D5EF3"));
mOrderServerStatus.setClickable(true);
// String strHtml3 = "<font color=\"#CAD6FF\">送乘客至</font><br>"
// + "<b><font color=\"#FFFFFF\"><big>" + order.endSiteAddr + "<big></font></b>";
mTitleTV2.setText("送乘客至");
mStationTv2.setText(order.endSiteAddr);
// String strHtml2 = "<font color=\"#CAD6FF\">距离 </font>" + "<b><font color=\"#FFFFFF\">- -</font></b>" + "<font color=\"#CAD6FF\"> 公里,</font>"
// + "<font color=\"#CAD6FF\">用时 </font>" + "<b><font color=\"#FFFFFF\">- -</font></b>" + "<font color=\"#CAD6FF\"> 分钟</font>";
// mDistanceAndTime.setText(Html.fromHtml(strHtml2));
} else if (TaxiOrderStatusEnum.OnTheWayToEnd.getCode() == order.orderStatus) {
CallerLogger.INSTANCE.d(M_TAXI + TAG, "已经去往终点");
mContentModule3.setVisibility(View.GONE);
mContentModule2.setVisibility(View.VISIBLE);
mOrderStatus.setText(R.string.module_och_taxi_on_the_way_2_end_station);
@@ -228,14 +232,19 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
if (TaxiOrderStatusEnum.ArriveAtStart.getCode() == order.orderStatus){
CallerLogger.INSTANCE.d(M_TAXI + TAG, "车辆已经达到起点");
mPassengerInfoLayout.setVisibility(View.VISIBLE);
mPassengerNum.setText(order.passengerNum + "");
mPassengerPhone.setText(order.passengerPhone);
mOrderStatus.setText(R.string.module_och_taxi_waiting);
mOrderServerStatus.setText(R.string.module_och_taxi_order_server_start_wait_check);
mOrderServerStatus.setTextColor(Color.parseColor("#4DFFFFFF"));
mOrderServerStatus.setTextColor(Color.parseColor("#FFFFFF"));
GradientDrawable background = (GradientDrawable) mOrderServerStatus.getBackground();//GradientDrawable是Drawable的子类
background.setColor(Color.parseColor("#4D1D5EF3"));
mOrderServerStatus.setClickable(false);
mOrderServerStatus.setClickable(true);
}else if (TaxiOrderStatusEnum.UserArriveAtStart.getCode() == order.orderStatus ){
CallerLogger.INSTANCE.d(M_TAXI + TAG, "乘客已上车验证成功");
mPassengerInfoLayout.setVisibility(View.GONE);
mOrderStatus.setText(R.string.module_och_taxi_user_check_success);
mOrderServerStatus.setText(R.string.module_och_taxi_order_server_start);
GradientDrawable background = (GradientDrawable) mOrderServerStatus.getBackground();//GradientDrawable是Drawable的子类
@@ -244,44 +253,7 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
mOrderServerStatus.setClickable(true);
}
}else if (TaxiOrderStatusEnum.ArriveAtStart.getCode() == order.orderStatus) {
mContentModule2.setVisibility(View.GONE);
mContentModule3.setVisibility(View.VISIBLE);
mArrivedStartTimeTv32.setVisibility(View.VISIBLE);
mContentModule32.setVisibility(View.VISIBLE);
mContentModule31.setVisibility(View.GONE);
mOrderOtherContent3.setVisibility(View.GONE);
mOrderStatus.setText(R.string.module_och_taxi_waiting);
mOrderServerStatus.setText(R.string.module_och_taxi_order_server_start);
GradientDrawable background = (GradientDrawable) mOrderServerStatus.getBackground();//GradientDrawable是Drawable的子类
background.setColor(Color.parseColor("#FF1D5EF3"));
mOrderServerStatus.setTextColor(Color.parseColor("#FFFFFF"));
mOrderServerStatus.setClickable(true);
Calendar currentCale = DateTimeUtils.getCurrentDateTime();
String currentHM = DateTimeUtil.formatCalendarToString(currentCale, DateTimeUtil.TAXI_HH_mm);
String currentDay = DateTimeUtil.formatCalendarToString(currentCale, DateTimeUtil.TAXI_yyyy_MM_dd);
String strHtml11 = "<font color=\"#CAD6FF\">已于</font><br>"
+ "<b><font color=\"#FFFFFF\"><big><big>" + currentHM + "</big></big></font></b>"
+ "<font color=\"#CAD6FF\">" + " " + "到达乘客上车地点</font>";
mArrivedStartTimeTv32.setLineHeight(60);
mArrivedStartTimeTv32.setText(Html.fromHtml(strHtml11));
// String strHtml12 = "<font color=\"#CAD6FF\">送乘客至</font><br>"
// + "<b><font color=\"#FFFFFF\"><big>" + order.endSiteAddr + "</big</font></b>";
mArrivedStationTitleTv32.setText("送乘客至");
mStationTv32.setText(order.endSiteAddr);
currentCale.add(Calendar.MINUTE, 10);
String strHtml13 = "";
if (currentDay.equals(DateTimeUtil.formatCalendarToString(currentCale, DateTimeUtil.TAXI_yyyy_MM_dd))) {
strHtml13 = "<font color=\"#CAD6FF\">免费等待至 </font>"
+ "<b><font color=\"#FFFFFF\"><big>" + DateTimeUtil.formatCalendarToString(currentCale, DateTimeUtil.TAXI_HH_mm) + "</big></b></font>";
} else {
strHtml13 = "<font color=\"#CAD6FF\">免费等待至</font>"
+ "<font color=\"#FFFFFF\"><big>" + DateTimeUtil.formatCalendarToString(currentCale, DateTimeUtil.TAXI_MM_dd_HH_mm) + "</big></font>";
}
mDistanceAndTime3.setText(Html.fromHtml(strHtml13));
} else if (TaxiModel.getInstance().checkCurrentOCHOrder()) {
}else if (TaxiModel.getInstance().checkCurrentOCHOrder()) {
CallerLogger.INSTANCE.d(M_TAXI + TAG, "前往乘客上车地点");
mContentModule2.setVisibility(View.GONE);
mContentModule3.setVisibility(View.VISIBLE);
@@ -290,6 +262,9 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
mContentModule32.setVisibility(View.GONE);
mOrderOtherContent3.setVisibility(View.VISIBLE);
mDistanceAndTime3.setVisibility(View.VISIBLE);
mPassengerInfoLayout.setVisibility(View.VISIBLE);
mPassengerNum.setText(order.passengerNum + "");
mPassengerPhone.setText(order.passengerPhone);
mOrderStatus.setText(R.string.module_och_taxi_new_order);
mOrderServerStatus.setText(R.string.module_och_taxi_order_server_start);
mOrderServerStatus.setTextColor(Color.parseColor("#4DFFFFFF"));
@@ -298,10 +273,8 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
mOrderServerStatus.setClickable(false);
mGoAheadStationTitleTv31.setText("前往");
mCatchStationTitleTv31.setText("接乘客");
// String strHtml0 = "<font color=\"#CAD6FF\">前往</font><br>"
// + "<b><font color=\"#FFFFFF\"><big>" + order.startSiteAddr + "</big></font></b><br>"
// + "<font color=\"#CAD6FF\">接乘客</font>";
mStationTv31.setText(order.startSiteAddr);
Calendar currentCale = DateTimeUtils.getCurrentDateTime();
Calendar startCale = DateTimeUtil.formatLongToCalendar(order.bookingTime);
String currentDay = DateTimeUtil.formatCalendarToString(currentCale, DateTimeUtil.TAXI_yyyy_MM_dd);
@@ -415,6 +388,9 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
} else if (TaxiOrderStatusEnum.UserArriveAtStart.getCode() == mCurrentOrder.orderStatus) {//点击服务,开启自动驾驶
mTaxiFragment.startAutoPilot();
showNotice(getResources().getString(R.string.module_och_taxi_order_server_start_auto_tip));
return;
}else if (TaxiOrderStatusEnum.ArriveAtStart.getCode() == mCurrentOrder.orderStatus){ //到达乘客上车点,司机可跳过乘客屏认证
mTaxiFragment.jumpPassengerCheckDone();
}
}
@@ -472,7 +448,6 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
setOrRemoveMapMaker(true, TaxiConst.TAXI_END_MAP_MAKER,order.endSitePoint,R.raw.end_marker);
break;
case ArriveAtEnd:
mCurrentOrder = null;
mTtsLessThan200Tip = 0;
mOrderCancel.setVisibility(View.GONE);
showNotice(mActivity.getString(R.string.module_och_taxi_order_auto_arrive_end_tip));
@@ -520,13 +495,8 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
@Override
public void onClick(View v) {
if (v.getId() == R.id.module_och_taxi_order_server_status_tv) {
switch (mOrderServerStatus.getText().toString().trim()) {
case "开始服务":
case "服务完成":
CallerLogger.INSTANCE.d(M_TAXI + TAG, mOrderServerStatus.getText().toString());
startOrEndService();
break;
}
CallerLogger.INSTANCE.d(M_TAXI + TAG, mOrderServerStatus.getText().toString());
startOrEndService();
} else if (v.getId() == R.id.module_och_taxi_order_cancel_iv) {
new TaxiOrderCancelDialog(mTaxiFragment, mActivity, mOrderNo, saveOrderState).show();
} else if (v.getId() == R.id.module_och_taxi_navi_iv) {

View File

@@ -225,6 +225,10 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
}
}
public void jumpPassengerCheckDone(){
mPresenter.jumpPassengerCheckDone();
}
public void completeOrderService(TaxiOrderStatusEnum status) {
mPresenter.updateCurOrderStatus(status);
}
@@ -355,9 +359,6 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
}
TaxiModel.getInstance().setOnTheWayToEndStation();
});
findViewById(R.id.test_passenger_check_done).setOnClickListener(v -> {
TaxiModel.getInstance().debugPassengerCheckDone();
});
}
private void testRouteInfoUpload() {

View File

@@ -101,18 +101,55 @@
android:paddingRight="40px"
android:visibility="visible"
app:layout_constraintBottom_toTopOf="@+id/module_och_taxi_order_server_status_tv">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/module_och_taxi_order_passenger_data"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="130px">
<TextView
android:id="@+id/taxi_passenger_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:text="--"
android:textColor="@android:color/white"
android:textSize="@dimen/taxi_passenger_txt_size"/>
<TextView
android:id="@+id/taxi_passenger_phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toRightOf="@+id/taxi_passenger_num"
app:layout_constraintTop_toTopOf="@+id/taxi_passenger_num"
android:layout_marginLeft="@dimen/dp_30"
android:text="--"
android:textColor="@android:color/white"
android:textSize="@dimen/taxi_passenger_txt_size"/>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/dp_2"
app:layout_constraintTop_toBottomOf="@+id/taxi_passenger_phone"
app:layout_constraintLeft_toLeftOf="@+id/taxi_passenger_num"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginTop="@dimen/dp_30"
android:background="@color/taxi_passenger_line_color"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/module_och_taxi_order_had_arrived_time_32"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="150px"
android:layout_marginTop="@dimen/dp_30"
android:lineSpacingExtra="16px"
android:textColor="#CAD6FF"
android:textSize="17sp"
android:textSize="30px"
android:visibility="visible"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_goneMarginTop="50px"
app:layout_constraintTop_toBottomOf="@+id/module_och_taxi_order_passenger_data"
app:layout_goneMarginTop="@dimen/dp_150"
tools:text="已于 - - 到达乘客上车点" />
<LinearLayout
android:id="@+id/module_och_taxi_order_go_ahead_station_31"
@@ -120,15 +157,15 @@
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="visible"
android:layout_marginTop="@dimen/dp_30"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
app:layout_constraintTop_toBottomOf="@+id/module_och_taxi_order_passenger_data">
<TextView
android:id="@+id/go_ahead_station_31"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#CAD6FF"
android:layout_marginTop="150px"
android:textSize="17sp"
android:textSize="30px"
android:text="前往"/>
<TextView
android:id="@+id/module_och_taxi_order_start_station_31"
@@ -141,21 +178,22 @@
android:ellipsize="end"
android:lineSpacingExtra="10px"
android:textColor="#FFFFFF"
android:textSize="23sp"
android:textSize="42px"
tools:text="- -" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8px"
android:layout_gravity="center_vertical">
<TextView
android:id="@+id/go_ahead_station_catch_31"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#CAD6FF"
android:textSize="17sp"
android:gravity="center_horizontal"
android:text="接乘客"/>
android:text="接乘客"
android:textColor="#CAD6FF"
android:textSize="28px" />
<ImageView
android:id="@+id/module_och_taxi_navi_iv"
android:layout_width="wrap_content"
@@ -183,7 +221,7 @@
android:inputType="textMultiLine"
android:lineSpacingExtra="16px"
android:textColor="#CAD6FF"
android:textSize="17sp"
android:textSize="30px"
tools:text="送乘客至" />
<TextView
android:id="@+id/module_och_taxi_order_end_station_32"
@@ -195,7 +233,7 @@
android:ellipsize="end"
android:lineSpacingExtra="16px"
android:textColor="#FFFFFF"
android:textSize="23sp"
android:textSize="42px"
tools:text="- -" />
</LinearLayout>
@@ -207,7 +245,7 @@
android:inputType="textMultiLine"
android:lineSpacingExtra="16px"
android:textColor="#CAD6FF"
android:textSize="17sp"
android:textSize="30px"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@+id/module_och_taxi_order_arrive_station_32"
tools:text="乘客将于 - - 用车" />
@@ -219,9 +257,9 @@
android:layout_marginBottom="180px"
android:inputType="textMultiLine"
android:lineSpacingExtra="16px"
android:text="距离 - - 公里,用时 - - 分钟"
android:text="距离 -- 公里,用时 -- 分钟"
android:textColor="#CAD6FF"
android:textSize="16sp"
android:textSize="32px"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@+id/module_och_taxi_order_go_ahead_station_31"/>

View File

@@ -62,13 +62,6 @@
android:onClick="testToEnd"
android:text="到达目的地"
android:textSize="12sp" />
<Button
android:id="@+id/test_passenger_check_done"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="testToEnd"
android:text="跳过乘客验证"
android:textSize="12sp" />
</LinearLayout>
</com.mogo.och.common.module.wigets.OCHBorderShadowLayout>

View File

@@ -101,4 +101,6 @@
<dimen name="taxi_traffic_light_icon_size">154px</dimen>
<dimen name="taxi_traffic_light_time_view_width">130px</dimen>
<dimen name="taxi_traffic_light_time_size">60px</dimen>
<dimen name="taxi_passenger_txt_size">34px</dimen>
</resources>

View File

@@ -101,4 +101,6 @@
<dimen name="taxi_traffic_light_icon_size">154px</dimen>
<dimen name="taxi_traffic_light_time_view_width">130px</dimen>
<dimen name="taxi_traffic_light_time_size">60px</dimen>
<dimen name="taxi_passenger_txt_size">34px</dimen>
</resources>

View File

@@ -22,4 +22,6 @@
<color name="taxi_traffic_light_green_color_down">#FF006D43</color>
<color name="taxi_traffic_light_yellow_color_up">#FFFFE198</color>
<color name="taxi_traffic_light_yellow_color_down">#FFFF9B00</color>
<color name="taxi_passenger_line_color">#657EE2</color>
</resources>

View File

@@ -99,4 +99,6 @@
<dimen name="taxi_traffic_light_icon_size">154px</dimen>
<dimen name="taxi_traffic_light_time_view_width">130px</dimen>
<dimen name="taxi_traffic_light_time_size">60px</dimen>
<dimen name="taxi_passenger_txt_size">34px</dimen>
</resources>

View File

@@ -31,7 +31,7 @@ project.android.productFlavors {
// 连接的工控机IP地址
buildConfigField 'String', 'ADAS_CONNECT_IP', "\"192.168.8.102\""
// 构建的是否是演示(美化)模式
buildConfigField 'boolean', 'IS_DEMO_MODE', 'true'
buildConfigField 'boolean', 'IS_DEMO_MODE', 'false'
}
}

View File

@@ -31,6 +31,6 @@ project.android.productFlavors {
// 连接的工控机IP地址
buildConfigField 'String', 'ADAS_CONNECT_IP', "\"192.168.1.104\""
// 构建的是否是演示(美化)模式
buildConfigField 'boolean', 'IS_DEMO_MODE', 'true'
buildConfigField 'boolean', 'IS_DEMO_MODE', 'false'
}
}

View File

@@ -33,6 +33,6 @@ project.android.productFlavors {
// 连接的工控机IP地址
buildConfigField 'String', 'ADAS_CONNECT_IP', "\"192.168.8.102\""
// 构建的是否是演示(美化)模式
buildConfigField 'boolean', 'IS_DEMO_MODE', 'true'
buildConfigField 'boolean', 'IS_DEMO_MODE', 'false'
}
}

View File

@@ -31,6 +31,6 @@ project.android.productFlavors {
// 连接的工控机IP地址
buildConfigField 'String', 'ADAS_CONNECT_IP', "\"192.168.8.103\""
// 构建的是否是演示(美化)模式
buildConfigField 'boolean', 'IS_DEMO_MODE', 'true'
buildConfigField 'boolean', 'IS_DEMO_MODE', 'false'
}
}

View File

@@ -34,7 +34,7 @@ project.android.productFlavors {
// 连接的工控机IP地址
buildConfigField 'String', 'ADAS_CONNECT_IP', "\"192.168.1.102\""
// 构建的是否是演示(美化)模式
buildConfigField 'boolean', 'IS_DEMO_MODE', 'true'
buildConfigField 'boolean', 'IS_DEMO_MODE', 'false'
}
}

View File

@@ -33,7 +33,7 @@ project.android.productFlavors {
// 连接的工控机IP地址
buildConfigField 'String', 'ADAS_CONNECT_IP', "\"192.168.1.103\""
// 构建的是否是演示(美化)模式
buildConfigField 'boolean', 'IS_DEMO_MODE', 'true'
buildConfigField 'boolean', 'IS_DEMO_MODE', 'false'
}
}

View File

@@ -31,7 +31,7 @@ project.android.productFlavors {
// 连接的工控机IP地址
buildConfigField 'String', 'ADAS_CONNECT_IP', "\"192.168.8.102\""
// 构建的是否是演示(美化)模式
buildConfigField 'boolean', 'IS_DEMO_MODE', 'true'
buildConfigField 'boolean', 'IS_DEMO_MODE', 'false'
}
}

View File

@@ -31,7 +31,7 @@ project.android.productFlavors {
// 连接的工控机IP地址
buildConfigField 'String', 'ADAS_CONNECT_IP', "\"192.168.1.102\""
// 构建的是否是演示(美化)模式
buildConfigField 'boolean', 'IS_DEMO_MODE', 'true'
buildConfigField 'boolean', 'IS_DEMO_MODE', 'false'
}
}

View File

@@ -99,8 +99,5 @@ class ConfigStartUp : AndroidStartup<Boolean>() {
FunctionBuildConfig.skinMode = 1
}
// 是否是演示美化模式会存在SP中方便做现场恢复
FunctionBuildConfig.isDemoMode =
SharedPrefsMgr.getInstance(context).getBoolean(MoGoConfig.IS_DEMO_MODE, false)
}
}

View File

@@ -69,6 +69,7 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation rootProject.ext.dependencies.gson
implementation project(':libraries:mogo-adas')
implementation project(':libraries:mogo-adas-backgrounder-permission')
// implementation 'com.zhidao.support.adas:high:2.6.6.0'
// implementation 'com.zhjt.mogo.adas.data:adas-data:2.6.6.0'
compileOnly project(':core:mogo-core-data')

View File

@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.zhidao.adas.client">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.DEVICE_POWER"/>
<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" />
@@ -61,6 +63,40 @@
android:theme="@style/AppTheme.NoActionBar">
</activity>
<!-- 开机启动 -->
<receiver
android:name="BootCompletedReceive"
android:enabled="true"
android:exported="true"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED"
android:process=":daemon">
<intent-filter android:priority="1000">
<action
android:name="android.net.conn.CONNECTIVITY_CHANGE"
tools:ignore="BatteryLife" />
<action android:name="android.net.ethernet.ETH_STATE_CHANGED" />
<action android:name="mitv.network.ethernet.action.ETHERNET_STATE_CHANGED" />
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
<action android:name="com.duokan.duokanplayer.BOOT_COMPLETED" />
<action android:name="android.intent.action.LETV_SCREENON" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="com.android.server.action.NETWORK_STATS_UPDATED" />
<action android:name="android.intent.action.MEDIA_MOUNTED" />
<action android:name="android.intent.action.MEDIA_UNMOUNTED" />
<action android:name="android.intent.action.MEDIA_EJECT" />
<data android:scheme="file" />
</intent-filter>
</receiver>
</application>
</manifest>

View File

@@ -0,0 +1,13 @@
package com.zhidao.adas.client;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
public class BootCompletedReceive extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.i("开机", "启动");
}
}

View File

@@ -12,6 +12,7 @@ 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.MyPointCloud;
import com.zhidao.adas.client.bean.OriginalPointCloudData;
import com.zhidao.adas.client.bean.PerceptionTrafficLight;
import com.zhidao.adas.client.bean.PlanningObjects;
import com.zhidao.adas.client.bean.PredictionObstacleTrajectory;
@@ -112,6 +113,7 @@ public class DataDistribution {
public final List<String> listStatusInfo = new ArrayList<>();
public final List<String> listErrorData = new ArrayList<>();
public final List<String> listPointCloud = new ArrayList<>();
public final List<String> listOriginalPointCloud = new ArrayList<>();
public final List<String> listPlanningObjects = new ArrayList<>();
public String cutDown(String str) {
@@ -148,6 +150,14 @@ public class DataDistribution {
if (listener != null && Constants.TITLE.RECEIVE_POINT_CLOUD.equals(listener.first)) {
listener.second.onRefresh();
}
} else if (data instanceof OriginalPointCloudData) {
listOriginalPointCloud.add(0, time + str);
if (listOriginalPointCloud.size() > LIST_SIZE) {
listOriginalPointCloud.remove(listOriginalPointCloud.size() - 1);
}
if (listener != null && Constants.TITLE.RECEIVE_POINT_CLOUD_ORIGINAL.equals(listener.first)) {
listener.second.onRefresh();
}
} else if (data instanceof PlanningObjects) {
listPlanningObjects.add(0, time + str);
if (listPlanningObjects.size() > LIST_SIZE) {

View File

@@ -2,13 +2,15 @@ package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
public class ArrivalNotification extends BaseInfo {
public final MessagePad.ArrivalNotification bean;
public ArrivalNotification(MessagePad.Header header, MessagePad.ArrivalNotification bean) {
super("接收", bean.getSerializedSize(), header);
public ArrivalNotification(MessagePad.Header header, MessagePad.ArrivalNotification bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}

View File

@@ -2,13 +2,15 @@ package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
public class AutopilotState extends BaseInfo {
public final MessagePad.AutopilotState bean;
public AutopilotState(MessagePad.Header header, MessagePad.AutopilotState bean) {
super("接收", bean.getSerializedSize(), header);
public AutopilotState(MessagePad.Header header, MessagePad.AutopilotState bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}

View File

@@ -1,7 +1,8 @@
package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import mogo.telematics.pad.MessagePad;
@@ -10,12 +11,14 @@ public abstract class BaseInfo {
public final long nowTime;
public final MessagePad.Header header;
public final int len;
private SimpleDateFormat sdf;
public BaseInfo(String action, int len, MessagePad.Header header) {
public BaseInfo(String action, int len, MessagePad.Header header, SimpleDateFormat sdf) {
this.action = action;
nowTime = System.currentTimeMillis();
this.len = 8 + header.getSerializedSize() + len;
this.header = header;
this.sdf = sdf;
}
public BaseInfo(String action, int len) {
@@ -27,6 +30,8 @@ public abstract class BaseInfo {
@Override
public String toString() {
return "原始数据长度:"+len + "\nHeader:[" + TextFormat.printer().escapingNonAscii(false).shortDebugString(header) + "]\n";
return "原始数据长度:" + len + "\nHeader:[" + "MessageID:" + header.getMsgID() +
" MessageType:" + header.getMsgType() + " 发送时间:" + sdf.format(new Date((long) (header.getTimestamp() * 1000)))
+ " 数据源时间:" + sdf.format(new Date((long) (header.getSourceTimestamp() * 1000))) + "]\n";
}
}

View File

@@ -2,13 +2,15 @@ package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
public class BasicInfoReq extends BaseInfo {
public final MessagePad.BasicInfoReq bean;
public BasicInfoReq(MessagePad.Header header, MessagePad.BasicInfoReq bean) {
super("接收", bean.getSerializedSize(), header);
public BasicInfoReq(MessagePad.Header header, MessagePad.BasicInfoReq bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}

View File

@@ -2,13 +2,15 @@ package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
public class CarConfigResp extends BaseInfo {
public final MessagePad.CarConfigResp bean;
public CarConfigResp(MessagePad.Header header, MessagePad.CarConfigResp bean) {
super("接收", bean.getSerializedSize(), header);
public CarConfigResp(MessagePad.Header header, MessagePad.CarConfigResp bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}

View File

@@ -2,13 +2,15 @@ package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
public class GlobalPathResp extends BaseInfo {
public final MessagePad.GlobalPathResp bean;
public GlobalPathResp(MessagePad.Header header, MessagePad.GlobalPathResp bean) {
super("接收", bean.getSerializedSize(), header);
public GlobalPathResp(MessagePad.Header header, MessagePad.GlobalPathResp bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}

View File

@@ -2,13 +2,15 @@ package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
public class GnssInfo extends BaseInfo {
public final MessagePad.GnssInfo bean;
public GnssInfo(MessagePad.Header header, MessagePad.GnssInfo bean) {
super("接收", bean.getSerializedSize(), header);
public GnssInfo(MessagePad.Header header, MessagePad.GnssInfo bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}

View File

@@ -2,14 +2,16 @@ package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
import mogo_msg.MogoReportMsg;
public class MogoReportMessage extends BaseInfo {
public final MogoReportMsg.MogoReportMessage bean;
public MogoReportMessage(MessagePad.Header header, MogoReportMsg.MogoReportMessage bean) {
super("接收", bean.getSerializedSize(), header);
public MogoReportMessage(MessagePad.Header header, MogoReportMsg.MogoReportMessage bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}

View File

@@ -2,14 +2,16 @@ package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
import rule_segement.MogoPointCloudOuterClass;
public class MyPointCloud extends BaseInfo {
public final MogoPointCloudOuterClass.MogoPointCloud bean;
public MyPointCloud(MessagePad.Header header, MogoPointCloudOuterClass.MogoPointCloud bean) {
super("接收", bean.getSerializedSize(), header);
public MyPointCloud(MessagePad.Header header, MogoPointCloudOuterClass.MogoPointCloud bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}

View File

@@ -0,0 +1,17 @@
package com.zhidao.adas.client.bean;
import com.zhidao.support.adas.high.common.ByteUtil;
public class OriginalPointCloudData extends BaseInfo {
private final byte[] pointCloud;
public OriginalPointCloudData(byte[] pointCloud) {
super("接收", pointCloud.length);
this.pointCloud = pointCloud;
}
@Override
public String toString() {
return "\n" + ByteUtil.byteArrToHex(pointCloud);
}
}

View File

@@ -2,14 +2,16 @@ package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
import perception.TrafficLightOuterClass;
public class PerceptionTrafficLight extends BaseInfo {
public final TrafficLightOuterClass.TrafficLights bean;
public PerceptionTrafficLight(MessagePad.Header header, TrafficLightOuterClass.TrafficLights bean) {
super("接收", bean.getSerializedSize(), header);
public PerceptionTrafficLight(MessagePad.Header header, TrafficLightOuterClass.TrafficLights bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}

View File

@@ -2,13 +2,15 @@ package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
public class PlanningObjects extends BaseInfo {
public final MessagePad.PlanningObjects bean;
public PlanningObjects(MessagePad.Header header, MessagePad.PlanningObjects bean) {
super("接收", bean.getSerializedSize(), header);
public PlanningObjects(MessagePad.Header header, MessagePad.PlanningObjects bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}

View File

@@ -2,14 +2,16 @@ package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
import prediction.Prediction;
public class PredictionObstacleTrajectory extends BaseInfo {
public final Prediction.mPredictionObjects bean;
public PredictionObstacleTrajectory(MessagePad.Header header, Prediction.mPredictionObjects bean) {
super("接收", bean.getSerializedSize(), header);
public PredictionObstacleTrajectory(MessagePad.Header header, Prediction.mPredictionObjects bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}

View File

@@ -2,14 +2,16 @@ package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
import record_cache.RecordPanelOuterClass;
public class RecordPanel extends BaseInfo {
public final RecordPanelOuterClass.RecordPanel bean;
public RecordPanel(MessagePad.Header header, RecordPanelOuterClass.RecordPanel bean) {
super("接收", bean.getSerializedSize(), header);
public RecordPanel(MessagePad.Header header, RecordPanelOuterClass.RecordPanel bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}

View File

@@ -2,14 +2,16 @@ package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
import system_master.SystemStatusInfo;
public class StatusInfo extends BaseInfo {
public final SystemStatusInfo.StatusInfo bean;
public StatusInfo(MessagePad.Header header, SystemStatusInfo.StatusInfo bean) {
super("接收", bean.getSerializedSize(), header);
public StatusInfo(MessagePad.Header header, SystemStatusInfo.StatusInfo bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}

View File

@@ -2,13 +2,15 @@ package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
public class TrackedObjects extends BaseInfo {
private MessagePad.TrackedObjects bean;
public TrackedObjects(MessagePad.Header header, MessagePad.TrackedObjects bean) {
super("接收", bean.getSerializedSize(), header);
public TrackedObjects(MessagePad.Header header, MessagePad.TrackedObjects bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}

View File

@@ -2,13 +2,15 @@ package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
public class Trajectory extends BaseInfo {
public final MessagePad.Trajectory bean;
public Trajectory(MessagePad.Header header, MessagePad.Trajectory bean) {
super("接收", bean.getSerializedSize(), header);
public Trajectory(MessagePad.Header header, MessagePad.Trajectory bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}
@Override

View File

@@ -2,14 +2,16 @@ package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import chassis.VehicleStateOuterClass;
import mogo.telematics.pad.MessagePad;
public class VehicleState extends BaseInfo {
public final VehicleStateOuterClass.VehicleState bean;
public VehicleState(MessagePad.Header header, VehicleStateOuterClass.VehicleState bean) {
super("接收", bean.getSerializedSize(), header);
public VehicleState(MessagePad.Header header, VehicleStateOuterClass.VehicleState bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}

View File

@@ -2,13 +2,15 @@ package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import java.text.SimpleDateFormat;
import mogo.telematics.pad.MessagePad;
public class Warn extends BaseInfo {
public final MessagePad.Warn bean;
public Warn(MessagePad.Header header, MessagePad.Warn bean) {
super("接收", bean.getSerializedSize(), header);
public Warn(MessagePad.Header header, MessagePad.Warn bean, SimpleDateFormat sdf) {
super("接收", bean.getSerializedSize(), header, sdf);
this.bean = bean;
}

View File

@@ -0,0 +1,150 @@
package com.zhidao.adas.client.log;
import android.os.Environment;
import android.text.TextUtils;
import com.zhidao.adas.client.utils.Constants;
import com.zhidao.support.adas.high.common.ThreadPoolManager;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.concurrent.Future;
import java.util.concurrent.LinkedBlockingQueue;
/**
* 与服务器交互日志管理任务
*/
public class ConnectStatusSave {
private static final String TAG = ConnectStatusSave.class.getSimpleName();
private static final String LOG_FILE_NAME = "ConnectStatus-%s.log";//文件名称
private volatile static ConnectStatusSave INSTANCE;
private static final long MAX_CAPACITY = 20 * 1024 * 1024L;//单文件最大存储容量 kb
private final LinkedBlockingQueue<String> queue;
private BufferedWriter buff = null;
private final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss-SSS", Locale.getDefault());
private File file;
private volatile long capacity = MAX_CAPACITY;
private Future future;
private ConnectStatusSave() {
queue = new LinkedBlockingQueue<>();
}
public static ConnectStatusSave getInstance() {
if (INSTANCE == null) {
synchronized (ConnectStatusSave.class) {
if (INSTANCE == null) {
INSTANCE = new ConnectStatusSave();
}
}
}
return INSTANCE;
}
public boolean isSdcardUse() {
boolean bl = false;
if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
bl = true;
}
return bl;
}
private synchronized void getFile() throws IOException {
if (isSdcardUse()) {
String time = sdf.format(new Date());
String childPath = time.split("_")[0] + File.separator;
file = new File(Constants.ROOT_PATH + childPath + String.format(LOG_FILE_NAME, time));
if (!file.exists()) {
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
file.createNewFile();
}
FileWriter fw = new FileWriter(file, true);
buff = new BufferedWriter(fw);
}
}
public void saveLog(String info) {
if (isStart()) {
queue.add(info);
}
}
public boolean isStart() {
return future != null;
}
public void start() {
if (future == null) {
future = ThreadPoolManager.getsInstance().submit(new WriteThread());
}
}
public void stop() {
if (future != null) {
Runnable runnable = new Runnable() {
@Override
public void run() {
queue.clear();
if (!future.isCancelled()) {
future.cancel(true);
}
future = null;
closeBufferedWriter();
}
};
ThreadPoolManager.getsInstance().execute(runnable);
}
}
private void closeBufferedWriter() {
if (buff != null) {
try {
buff.flush();
buff.close();
} catch (IOException e) {
e.printStackTrace();
}
buff = null;
}
}
private class WriteThread implements Runnable {
@Override
public void run() {
synchronized (this) {
while (!Thread.currentThread().isInterrupted()) {
try {
long size = 0;
if (file != null) {
size = file.length();
}
if (size > capacity || file == null || !file.exists() || buff == null) {
closeBufferedWriter();
getFile();
}
String data = queue.take();
if (buff != null && !TextUtils.isEmpty(data)) {
buff.write(data);
buff.newLine();
buff.flush();
}
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
}

View File

@@ -3,6 +3,7 @@ package com.zhidao.adas.client.log;
import android.os.Environment;
import android.text.TextUtils;
import com.zhidao.adas.client.utils.Constants;
import com.zhidao.support.adas.high.common.ThreadPoolManager;
import java.io.BufferedWriter;
@@ -20,7 +21,6 @@ import java.util.concurrent.LinkedBlockingQueue;
*/
public class LogSave {
private static final String TAG = LogSave.class.getSimpleName();
private static final String ROOT_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "IPCMonitoring" + File.separator;//程序外部存储跟目录
private static final String LOG_FILE_NAME = "%s.log";//文件名称
private volatile static LogSave INSTANCE;
private static final long MAX_CAPACITY = 20 * 1024 * 1024L;//单文件最大存储容量 kb
@@ -59,7 +59,7 @@ public class LogSave {
if (isSdcardUse()) {
String time = sdf.format(new Date());
String childPath = time.split("_")[0] + File.separator;
file = new File(ROOT_PATH + childPath + String.format(LOG_FILE_NAME, time));
file = new File(Constants.ROOT_PATH + childPath + String.format(LOG_FILE_NAME, time));
if (!file.exists()) {
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();

View File

@@ -129,6 +129,8 @@ public class InfoFragment extends BaseFragment {
adapter.setData(DataDistribution.getInstance().listPredictionObstacleTrajectory);
} else if (Constants.TITLE.RECEIVE_POINT_CLOUD.equals(title)) {
adapter.setData(DataDistribution.getInstance().listPointCloud);
}else if (Constants.TITLE.RECEIVE_POINT_CLOUD_ORIGINAL.equals(title)) {
adapter.setData(DataDistribution.getInstance().listOriginalPointCloud);
} else if (Constants.TITLE.RECEIVE_PLANNING_OBJECTS.equals(title)) {
adapter.setData(DataDistribution.getInstance().listPlanningObjects);
}else{

View File

@@ -7,11 +7,14 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Configuration;
import android.net.Uri;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Message;
import android.os.PowerManager;
import android.provider.Settings;
import android.text.Editable;
import android.text.Html;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
@@ -62,6 +65,7 @@ import com.zhidao.adas.client.bean.GnssInfo;
import com.zhidao.adas.client.bean.IPCConnectState;
import com.zhidao.adas.client.bean.MogoReportMessage;
import com.zhidao.adas.client.bean.MyPointCloud;
import com.zhidao.adas.client.bean.OriginalPointCloudData;
import com.zhidao.adas.client.bean.PerceptionTrafficLight;
import com.zhidao.adas.client.bean.PlanningObjects;
import com.zhidao.adas.client.bean.PredictionObstacleTrajectory;
@@ -71,6 +75,7 @@ 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.log.ConnectStatusSave;
import com.zhidao.adas.client.log.LogSave;
import com.zhidao.adas.client.utils.Constants;
import com.zhidao.support.adas.high.AdasManager;
@@ -88,10 +93,13 @@ import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ScheduledExecutorService;
@@ -107,6 +115,7 @@ import system_master.SystemStatusInfo;
public class MainActivity extends BaseActivity implements OnAdasListener, OnAdasConnectStatusListener, BaseAdapter.OnItemClickListener<String> {
private final static String TAG = MainActivity.class.getSimpleName();
private final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.getDefault());
private static final int WHAT_IPC_IP = 0x00;
private static final int WHAT_DRIVER_IP = 0x01;
private static final int WHAT_IPC_CONNECT_STATE = 0x02;
@@ -115,6 +124,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
private ImageView tvIp;
private TextView title;
private TextView ipcIp;
private TextView background;
private TextView localIp;
private View line;
private View line1;
@@ -161,12 +171,15 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
// LogSave.getInstance().stop();
// }
PowerManager.WakeLock wakeLock;
WifiManager.WifiLock wifiLock;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initHandler();
ConnectStatusSave.getInstance().start();
isPad = isPad(this);
if (!isPad)
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
@@ -177,6 +190,40 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
onUpdateConnectStateView();
showIPCIP();
canDrawOverlays();
// PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE);
// wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
// wakeLock.acquire();
// int wifiLockType = WifiManager.WIFI_MODE_FULL;
// try {
// wifiLockType = WifiManager.class.getField("WIFI_MODE_FULL_HIGH_PERF").getInt(null);
// } catch (Exception e) {
// // 我们必须运行在一个pre-Honeycomb设备上。
// Log.w(TAG, "无法获得高性能wifi锁.");
// }
// WifiManager wifiManager = WifiManager.class.cast(getApplicationContext().getSystemService(WIFI_SERVICE));
// wifiLock = wifiManager.createWifiLock(wifiLockType, TAG);
// wifiLock.acquire();
}
@Override
protected void onDestroy() {
super.onDestroy();
AdasManager.getInstance().setOnAdasListener(null);
AdasManager.getInstance().disconnect();
if (mExecutorServiceConfigTimer != null) {
mExecutorServiceConfigTimer.shutdownNow();
}
DataDistribution.getInstance().stop();
if (floatWindow != null) {
floatWindow.hideFloatWindow();
floatWindow = null;
}
ConnectStatusSave.getInstance().stop();
// 释放唤醒锁, 如果没有其它唤醒锁存在, 设备会很快进入休眠状态
if (wakeLock != null)
wakeLock.release();
if (wifiLock != null)
wifiLock.release();
}
private void canDrawOverlays() {
@@ -214,6 +261,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
private void initView() {
include_title = findViewById(R.id.include_title);
etIp = findViewById(R.id.et_ip);
background = findViewById(R.id.background);
role = findViewById(R.id.role);
line = findViewById(R.id.line);
line1 = findViewById(R.id.line1);
@@ -477,6 +525,22 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
}
}
});
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
// String str = "后台运行:" + (AdasManager.getInstance().isPermissionLongBackgroundRunning(this) ? "<font color='red'>已优化</font>" : "<font color='red'>未优化</font>");
// background.setText(Html.fromHtml(str, Html.FROM_HTML_MODE_LEGACY));
// background.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
//
//// Permission.requestAddDataSaverWhite(MainActivity.this);
//// AdasManager.getInstance().requestIgnoreBatteryOptimizations(MainActivity.this);
// AdasManager.getInstance().showPermissionLongBackgroundRunningDialog(MainActivity.this);
// }
// });
// } else {
// background.setVisibility(View.GONE);
// }
}
private void showListPopupWindow() {
@@ -517,6 +581,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
titleFragmentData.add(Constants.TITLE.RECEIVE_PERCEPTION_TRAFFIC_LIGHT);
titleFragmentData.add(Constants.TITLE.RECEIVE_PREDICTION_OBSTACLE_TRAJECTORY);
titleFragmentData.add(Constants.TITLE.RECEIVE_POINT_CLOUD);
titleFragmentData.add(Constants.TITLE.RECEIVE_POINT_CLOUD_ORIGINAL);
titleFragmentData.add(Constants.TITLE.RECEIVE_PLANNING_OBJECTS);
titleFragmentData.add(Constants.TITLE.RECEIVE_CAR_CONFIG_RESP);
titleFragmentData.add(Constants.TITLE.RECEIVE_RECORD_RESULT);
@@ -527,18 +592,21 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
titleFragmentData.add(Constants.TITLE.RECEIVE_ERROR);
titleBtnData.add("自动驾驶模式");
titleBtnData.add("自动驾驶路径查询");
titleBtnData.add("下发SN");
titleBtnData.add("数据采集5秒");
titleBtnData.add("数据采集start");
titleBtnData.add("数据采集end");
titleBtnData.add("发送信号灯");
titleBtnData.add("自动驾驶限速");
titleBtnData.add("重启所有节点");
titleBtnData.add("采集类型");
titleBtnData.add("打开演示模式");
titleBtnData.add("关闭演示模式");
titleBtnData.add(Constants.TITLE.SEND_SET_AUTOPILOT_MODE_REQ);
titleBtnData.add(Constants.TITLE.SEND_GLOBAL_PATH_REQ);
titleBtnData.add(Constants.TITLE.SEND_STATUS_QUERY_REQ);
titleBtnData.add(Constants.TITLE.SEND_BASIC_INFO_RESP);
titleBtnData.add(Constants.TITLE.SEND_RECORD_DATA_5);
titleBtnData.add(Constants.TITLE.SEND_RECORD_DATA_START);
titleBtnData.add(Constants.TITLE.SEND_RECORD_DATA_END);
titleBtnData.add(Constants.TITLE.SEND_TRAFFIC_LIGHT_DATA);
titleBtnData.add(Constants.TITLE.SEND_SET_AUTOPILOT_SPEED_REQ);
titleBtnData.add(Constants.TITLE.SEND_SYSTEM_CMD_REQ_REBOOT);
titleBtnData.add(Constants.TITLE.SEND_RECORD_CAUSE);
titleBtnData.add(Constants.TITLE.SEND_SET_DEMO_MODE_REQ_OPEN);
titleBtnData.add(Constants.TITLE.SEND_SET_DEMO_MODE_REQ_CLOSE);
titleBtnData.add(Constants.TITLE.SEND_SET_RAIN_MODE_REQ_OPEN);
titleBtnData.add(Constants.TITLE.SEND_SET_RAIN_MODE_REQ_CLOSE);
}
private void initBtnRecyclerView() {
@@ -690,56 +758,56 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
@Override
public void onTrajectory(MessagePad.Header header, MessagePad.Trajectory trajectory) {
Trajectory base = new Trajectory(header, trajectory);
Trajectory base = new Trajectory(header, trajectory, sdf);
DataDistribution.getInstance().addData(base);
}
@Override
public void onTrackedObjects(MessagePad.Header header, MessagePad.TrackedObjects trackedObjects) {
TrackedObjects base = new TrackedObjects(header, trackedObjects);
TrackedObjects base = new TrackedObjects(header, trackedObjects, sdf);
DataDistribution.getInstance().addData(base);
}
@Override
public void onGnssInfo(MessagePad.Header header, MessagePad.GnssInfo gnssInfo) {
GnssInfo base = new GnssInfo(header, gnssInfo);
GnssInfo base = new GnssInfo(header, gnssInfo, sdf);
DataDistribution.getInstance().addData(base);
}
@Override
public void onVehicleState(MessagePad.Header header, VehicleStateOuterClass.VehicleState vehicleState) {
VehicleState base = new VehicleState(header, vehicleState);
VehicleState base = new VehicleState(header, vehicleState, sdf);
DataDistribution.getInstance().addData(base);
}
@Override
public void onAutopilotState(MessagePad.Header header, MessagePad.AutopilotState autopilotState) {
AutopilotState base = new AutopilotState(header, autopilotState);
AutopilotState base = new AutopilotState(header, autopilotState, sdf);
DataDistribution.getInstance().addData(base);
}
@Override
public void onReportMessage(MessagePad.Header header, MogoReportMsg.MogoReportMessage mogoReportMessage) {
MogoReportMessage base = new MogoReportMessage(header, mogoReportMessage);
MogoReportMessage base = new MogoReportMessage(header, mogoReportMessage, sdf);
DataDistribution.getInstance().addData(base);
}
@Override
public void onPerceptionTrafficLight(MessagePad.Header header, TrafficLightOuterClass.TrafficLights trafficLights) {
PerceptionTrafficLight base = new PerceptionTrafficLight(header, trafficLights);
PerceptionTrafficLight base = new PerceptionTrafficLight(header, trafficLights, sdf);
DataDistribution.getInstance().addData(base);
}
@Override
public void onPredictionObstacleTrajectory(MessagePad.Header header, Prediction.mPredictionObjects predictionObjects) {
PredictionObstacleTrajectory base = new PredictionObstacleTrajectory(header, predictionObjects);
PredictionObstacleTrajectory base = new PredictionObstacleTrajectory(header, predictionObjects, sdf);
DataDistribution.getInstance().addData(base);
}
@Override
public void onPointCloud(MessagePad.Header header, MogoPointCloudOuterClass.MogoPointCloud pointCloud) {
MyPointCloud base = new MyPointCloud(header, pointCloud);
MyPointCloud base = new MyPointCloud(header, pointCloud, sdf);
DataDistribution.getInstance().addData(base);
// String data = PointCloudDecoder.decode(header, pointCloud);
// Log.i("dddd", "data==" + data.length());
@@ -747,15 +815,21 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
// LogSave.getInstance().saveLog("转换数据=" + data);
}
@Override
public void onPointCloud(byte[] pointCloud) {
OriginalPointCloudData base = new OriginalPointCloudData(pointCloud);
DataDistribution.getInstance().addData(base);
}
@Override
public void onPlanningObjects(MessagePad.Header header, MessagePad.PlanningObjects planningObjects) {
PlanningObjects base = new PlanningObjects(header, planningObjects);
PlanningObjects base = new PlanningObjects(header, planningObjects, sdf);
DataDistribution.getInstance().addData(base);
}
@Override
public void onBasicInfoReq(MessagePad.Header header, MessagePad.BasicInfoReq basicInfoReq) {
BasicInfoReq info = new BasicInfoReq(header, basicInfoReq);
BasicInfoReq info = new BasicInfoReq(header, basicInfoReq, sdf);
DataDistribution.getInstance().addData(info);
AdasManager.getInstance().sendBasicInfoResp("X202021111192N41VY", 0);
showToastCenter("收到车机基础信息请求:" + info.toString());
@@ -763,13 +837,13 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
@Override
public void onCarConfigResp(MessagePad.Header header, MessagePad.CarConfigResp carConfigResp) {
CarConfigResp base = new CarConfigResp(header, carConfigResp);
CarConfigResp base = new CarConfigResp(header, carConfigResp, sdf);
DataDistribution.getInstance().addData(base);
}
@Override
public void onRecordResult(MessagePad.Header header, RecordPanelOuterClass.RecordPanel recordPanel) {
RecordPanel base = new RecordPanel(header, recordPanel);
RecordPanel base = new RecordPanel(header, recordPanel, sdf);
DataDistribution.getInstance().addData(base);
recordKey = recordPanel.getKey();
recordFileName = recordPanel.getFilename();
@@ -777,25 +851,25 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
@Override
public void onGlobalPathResp(MessagePad.Header header, MessagePad.GlobalPathResp globalPathResp) {
GlobalPathResp base = new GlobalPathResp(header, globalPathResp);
GlobalPathResp base = new GlobalPathResp(header, globalPathResp, sdf);
DataDistribution.getInstance().addData(base);
}
@Override
public void onWarn(MessagePad.Header header, MessagePad.Warn warn) {
Warn base = new Warn(header, warn);
Warn base = new Warn(header, warn, sdf);
DataDistribution.getInstance().addData(base);
}
@Override
public void onArrivalNotification(MessagePad.Header header, MessagePad.ArrivalNotification arrivalNotification) {
ArrivalNotification base = new ArrivalNotification(header, arrivalNotification);
ArrivalNotification base = new ArrivalNotification(header, arrivalNotification, sdf);
DataDistribution.getInstance().addData(base);
}
@Override
public void onStatusQueryResp(MessagePad.Header header, SystemStatusInfo.StatusInfo statusInfo) {
StatusInfo base = new StatusInfo(header, statusInfo);
StatusInfo base = new StatusInfo(header, statusInfo, sdf);
DataDistribution.getInstance().addData(base);
}
@@ -892,21 +966,11 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
}
@Override
protected void onDestroy() {
super.onDestroy();
AdasManager.getInstance().setOnAdasListener(null);
AdasManager.getInstance().disconnect();
if (mExecutorServiceConfigTimer != null) {
mExecutorServiceConfigTimer.shutdownNow();
}
DataDistribution.getInstance().stop();
}
@Override
public void onConnectionIPCStatus(int ipcConnectionStatus, String reason) {
Log.i(TAG, "连接状态=" + (reason == null ? "主动断开连接" : reason));
// Log.i(TAG, "连接状态=" + (reason == null ? "主动断开连接" : reason));
String time = sdf.format(new Date());
ConnectStatusSave.getInstance().saveLog(time + " ipcConnectionStatus=" + ipcConnectionStatus + " reason=" + reason);
connectStatusList.add(0, new IPCConnectState(reason == null ? "主动断开连接" : reason, getStatusColor(ipcConnectionStatus)));
if (connectStatusList.size() > 100) {
connectStatusList.remove(connectStatusList.size() - 1);
@@ -924,12 +988,12 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
getHandler().sendEmptyMessage(WHAT_IPC_IP);
}
// LogSave.getInstance().saveLog("连接状态", status);
CupidLogUtils.i(TAG, "connectStatus=" + status);
// CupidLogUtils.i(TAG, "connectStatus=" + status);
}
@Override
public void onCompatibility(VersionCompatibility versionCompatibility) {
showToastCenter("所连工控机:\n" + versionCompatibility.toString(), Toast.LENGTH_LONG);
showToastCenter("所连工控机:\n" + (versionCompatibility == null ? "未连接" : versionCompatibility.toString()), Toast.LENGTH_LONG);
}
private void showLocalIP() {
@@ -998,8 +1062,8 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
showToastCenter("IPC 未连接");
return;
}
switch (position) {
case 0:
switch (data) {
case Constants.TITLE.SEND_SET_AUTOPILOT_MODE_REQ:
// MessagePad.Line.Builder line = MessagePad.Line.newBuilder();
// line.setLineId(10);
// line.setTrajUrl("我是TrajUrl");
@@ -1015,32 +1079,34 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
if (!autoPilotModeDialog.isShowing()) {
autoPilotModeDialog.show();
}
break;
case 1:
case Constants.TITLE.SEND_GLOBAL_PATH_REQ:
//自动驾驶路径查询
AdasManager.getInstance().sendGlobalPathReq();
break;
case 2:
//发送sn
AdasManager.getInstance().sendBasicInfoResp("X202021111192N41VY", 1);
case Constants.TITLE.SEND_STATUS_QUERY_REQ:
AdasManager.getInstance().sendStatusQueryReq();
break;
case 3:
case Constants.TITLE.SEND_BASIC_INFO_RESP:
//发送sn
AdasManager.getInstance().sendBasicInfoResp("X202021111192N41VY", 0);
break;
case Constants.TITLE.SEND_RECORD_DATA_5:
//数据采集5秒
boolean b = AdasManager.getInstance().startRecordPackage(1, 5, 1);
CupidLogUtils.w(TAG, "AutopilotRecord===>send:" + b);
break;
case 4:
case Constants.TITLE.SEND_RECORD_DATA_START:
//数据采集start
boolean bStart = AdasManager.getInstance().startRecordPackage(1, 1);
CupidLogUtils.w(TAG, "AutopilotRecord===>send:" + bStart);
break;
case 5:
case Constants.TITLE.SEND_RECORD_DATA_END:
//数据采集end
boolean bEnd = AdasManager.getInstance().stopRecordPackage(1, 1);
CupidLogUtils.w(TAG, "AutopilotRecord===>send:" + bEnd);
break;
case 6:
case Constants.TITLE.SEND_TRAFFIC_LIGHT_DATA:
//发送信号灯
MessagePad.TrafficLightStatus left = MessagePad.TrafficLightStatus.newBuilder()
.setPhaseNo("1")
@@ -1062,9 +1128,9 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
.setMid(mid)
.setRight(right)
.build();
AdasManager.getInstance().sendTrafficLightData("10038", 26.848153, 112.574883, "180.0", "SN", 100413, -4, 201, 0, detail);
AdasManager.getInstance().sendTrafficLightData("10038", 26.848153, 112.574883, "180.0", "SN", 100413, -4, 201, 0, detail, System.currentTimeMillis());
break;
case 7:
case Constants.TITLE.SEND_SET_AUTOPILOT_SPEED_REQ:
//速度设置
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("自动驾驶限速");
@@ -1091,23 +1157,31 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
builder.show();//显示Dialog对话框
break;
case 8:
case Constants.TITLE.SEND_SYSTEM_CMD_REQ_REBOOT:
//重启所有节点
AdasManager.getInstance().sendSystemCmdReq(MessagePad.SystemCmdType.SYSTEMCMD_REBOOT);
break;
case 9:
case Constants.TITLE.SEND_RECORD_CAUSE:
//采集类型
AdasManager.getInstance().sendRecordCause(recordKey, recordFileName, "1", "变道有干扰");
break;
case 10:
case Constants.TITLE.SEND_SET_DEMO_MODE_REQ_OPEN:
//打开演示模式
AdasManager.getInstance().sendDemoModeReq(1);
break;
case 11:
case Constants.TITLE.SEND_SET_DEMO_MODE_REQ_CLOSE:
//关闭演示模式
AdasManager.getInstance().sendDemoModeReq(0);
break;
case Constants.TITLE.SEND_SET_RAIN_MODE_REQ_OPEN:
//打开雨天模式
AdasManager.getInstance().sendRainModeReq(1);
break;
case Constants.TITLE.SEND_SET_RAIN_MODE_REQ_CLOSE:
//关闭雨天模式
AdasManager.getInstance().sendRainModeReq(0);
break;
}
}

View File

@@ -1,6 +1,7 @@
package com.zhidao.adas.client.utils;
import android.content.Context;
import android.os.Environment;
import android.text.TextUtils;
import com.google.gson.reflect.TypeToken;
@@ -8,8 +9,11 @@ import com.zhidao.adas.client.bean.AutoPilotMode;
import com.zhidao.support.adas.high.common.JsonUtil;
import com.zhidao.support.adas.high.common.MessageType;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
/**
* @author song kenan
@@ -17,6 +21,9 @@ import java.util.List;
* @date 2021/10/8
*/
public class Constants {
public static final String ROOT_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "IPCMonitoring" + File.separator;//程序外部存储跟目录
public static final String FILE_PATH = ROOT_PATH + "Crash" + File.separator;
private static final String ALL_PATH = "all_path";//所有路线
private static final String DEFAULT_PATH = "[{\"endLatLon\":{\"latitude\":40.19774,\"longitude\":116.72704},\"endName\":\"汇源果汁\",\"name\":\"北京市顺义区北小营镇\",\"speedLimit\":20.0,\"startLatLon\":{\"latitude\":40.20047,\"longitude\":116.73512},\"startName\":\"13号路口西\"},{\"endLatLon\":{\"latitude\":40.19996,\"longitude\":116.73584},\"endName\":\"13号路口主路\",\"name\":\"北京市顺义区北小营镇\",\"speedLimit\":20.0,\"startLatLon\":{\"latitude\":40.19763,\"longitude\":116.72686},\"startName\":\"汇源果汁\"}]";
@@ -151,6 +158,7 @@ public class Constants {
String RECEIVE_PERCEPTION_TRAFFIC_LIGHT = MessageType.TYPE_RECEIVE_PERCEPTION_TRAFFIC_LIGHT.desc;
String RECEIVE_PREDICTION_OBSTACLE_TRAJECTORY = MessageType.TYPE_RECEIVE_PREDICTION_OBSTACLE_TRAJECTORY.desc;
String RECEIVE_POINT_CLOUD = MessageType.TYPE_RECEIVE_POINT_CLOUD.desc;
String RECEIVE_POINT_CLOUD_ORIGINAL = "点云原始透传";
String RECEIVE_PLANNING_OBJECTS = MessageType.TYPE_RECEIVE_PLANNING_OBJECTS.desc;
// String RECEIVE_BASIC_INFO_REQ = "自动驾驶设备基础信息请求";
@@ -164,5 +172,23 @@ public class Constants {
String RECEIVE_ERROR = "错误数据";
String SEND_SET_AUTOPILOT_MODE_REQ="自动驾驶模式";
String SEND_GLOBAL_PATH_REQ="自动驾驶路径查询";
String SEND_STATUS_QUERY_REQ="状态查询";
String SEND_BASIC_INFO_RESP="下发SN";
String SEND_RECORD_DATA_5="数据采集5秒";
String SEND_RECORD_DATA_START="数据采集Start";
String SEND_RECORD_DATA_END="数据采集End";
String SEND_TRAFFIC_LIGHT_DATA="发送信号灯";
String SEND_SET_AUTOPILOT_SPEED_REQ="自动驾驶限速";
String SEND_SYSTEM_CMD_REQ_REBOOT="重启所有节点";
String SEND_RECORD_CAUSE="采集类型";
String SEND_SET_DEMO_MODE_REQ_OPEN="打开演示模式";
String SEND_SET_DEMO_MODE_REQ_CLOSE="关闭演示模式";
String SEND_SET_RAIN_MODE_REQ_OPEN="打开雨天模式";
String SEND_SET_RAIN_MODE_REQ_CLOSE="关闭雨天模式";
}
}

View File

@@ -23,7 +23,6 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
@@ -40,7 +39,7 @@ import java.util.Objects;
* @since Ver 1.0 I used to be a programmer like you, then I took an arrow in the knee
*/
public class CrashHandler implements UncaughtExceptionHandler {
private static final String FILE_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "IPCMonitoring" + File.separator + "Crash" + File.separator;//程序外部存储跟目录
/**
* Log日志的tag
* String : TAG
@@ -75,7 +74,7 @@ public class CrashHandler implements UncaughtExceptionHandler {
*
* @since 2013-3-21下午8:46:15
*/
private final Map<String, String> mLogInfo = new HashMap<String, String>();
private Map<String, String> mLogInfo = new HashMap<String, String>();
/**
* 用于格式化日期,作为日志文件名的一部分(FIXME 注意在windows下文件名无法使用等符号)
* SimpleDateFormat : mSimpleDateFormat
@@ -219,8 +218,11 @@ public class CrashHandler implements UncaughtExceptionHandler {
for (Field field : mFields) {
try {
field.setAccessible(true);
mLogInfo.put(field.getName(), Objects.requireNonNull(field.get("")).toString());
} catch (IllegalArgumentException | IllegalAccessException e) {
mLogInfo.put(field.getName(), field.get("").toString());
Log.d(TAG, field.getName() + ":" + field.get(""));
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
@@ -270,8 +272,8 @@ public class CrashHandler implements UncaughtExceptionHandler {
String mFileName = mContext.getPackageName() + "_Exception-" + mTime + ".log";
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
try {
File mDirectory = new File(FILE_PATH);
Log.v(TAG, mDirectory.toString());
File mDirectory = new File(Constants.FILE_PATH);
Log.d(TAG, mDirectory.toString());
if (!mDirectory.exists())
mDirectory.mkdirs();
FileOutputStream mFileOutputStream = new FileOutputStream(mDirectory + File.separator + mFileName);

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffffff" />
<stroke
android:width="0.8dp"
android:color="#ffffff" />
<!-- 圆角 -->
<corners android:radius="6dp" />
</shape>

View File

@@ -3,7 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_dialog">
android:background="@drawable/bg_adas_dialog">
<TextView
android:id="@+id/title"

View File

@@ -6,23 +6,42 @@
android:focusable="true"
android:focusableInTouchMode="true">
<TextView
android:id="@+id/title"
<LinearLayout
android:id="@+id/title_layout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:gravity="center_vertical"
android:text="@string/app_name"
android:textColor="@color/colorWhile"
android:textSize="18dp"
android:textStyle="bold" />
android:orientation="vertical">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:text="@string/app_name"
android:textColor="@color/colorWhile"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/background"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="后台运行:"
android:textColor="@color/colorWhile"
android:textSize="12sp"
android:textStyle="bold" />
</LinearLayout>
<ImageView
android:id="@+id/role"
android:layout_width="22dp"
android:layout_height="match_parent"
android:layout_marginStart="5dp"
android:layout_toEndOf="@id/title"
android:layout_toEndOf="@id/title_layout"
android:scaleType="centerInside"
android:src="@drawable/selector_role" />

View File

@@ -2,7 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_float"
android:background="@drawable/bg_adas_dialog"
android:orientation="vertical">

View File

@@ -176,6 +176,8 @@ class MoGoAutopilotProvider :
AsyncDataToAutopilotServer.INSTANCE.initServer()
// 同步是否开启美化模式
setDemoMode(FunctionBuildConfig.isDemoMode)
// 同步是否开启雨天模式
setRainMode(FunctionBuildConfig.isRainMode)
}
/**
@@ -259,7 +261,8 @@ class MoGoAutopilotProvider :
trafficLightResult.laneNo,
trafficLightResult.arrowNo,
trafficLightResult.flashYellow,
trafficLightResult.toTrafficLightDetail()
trafficLightResult.toTrafficLightDetail(),
trafficLightResult.timeStamp
)
}
@@ -355,6 +358,27 @@ class MoGoAutopilotProvider :
}
}
/**
* 雨天模式
* isEnable = true 开启
* isEnable = false 关闭
*/
override fun setRainMode(isEnable: Boolean) {
if(isEnable){
AdasManager.getInstance().sendRainModeReq(1)
}else{
AdasManager.getInstance().sendRainModeReq(0)
}
}
/**
* 发送工控机所有节点重启命令
*/
override fun sendIpcReboot() {
//重启所有节点
AdasManager.getInstance().sendSystemCmdReq(MessagePad.SystemCmdType.SYSTEMCMD_REBOOT)
}
/**
* 办公室调试使用,强制开启自动驾驶,将 statuspilotModecontrol_pilotMode强追设置为 1
* isEnable = true 开启

View File

@@ -248,6 +248,10 @@ class MoGoAdasListenerImpl : OnAdasListener {
CallerAutopilotPointCloudListenerManager.invokeAutopilotPointCloudDataUpdate(header,pointCloud)
}
override fun onPointCloud(pointCloud: ByteArray?) {
//点云数据透传
}
override fun onPlanningObjects(
header: MessagePad.Header?,
planningObjects: MessagePad.PlanningObjects?

View File

@@ -4,8 +4,10 @@ import android.annotation.SuppressLint
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.commons.debug.DebugConfig
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
import com.mogo.eagle.core.function.autopilot.network.AdasServiceModel
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_ADAS_IMPL
@@ -50,7 +52,10 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
syncBasicInfoToAutopilot()
// 开启轮询上传自动驾驶状态
updateDriveStatusTask()
//每次工控机连接成功后,需同步当前设置的美化模式状态
CallerAutoPilotManager.setDemoMode(FunctionBuildConfig.isDemoMode)
//每次工控机连接成功后,需同步当前设置的雨天模式状态
CallerAutoPilotManager.setRainMode(FunctionBuildConfig.isRainMode)
} else if (ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.DISCONNECTED) {
CallerLogger.d("$M_ADAS_IMPL$TAG", "webSocket 连接失败 reason:$reason")
if (connectStatus) {

View File

@@ -122,6 +122,7 @@ class TeleMsgHandler : IMsgHandler {
if (!isFirstDisc) {
isFirstDisc = true
}
AdasManager.getInstance().startDispatchHandler()
ToastUtils.showShort("连接司机屏成功!")
invokeNettyConnResult("乘客屏连接司机屏成功")
val byteArray = byteArrayOf(0)
@@ -138,14 +139,18 @@ class TeleMsgHandler : IMsgHandler {
AppConfigInfo.iPCMacAddress = ""
ToastUtils.showLong("断开和司机屏的连接!")
invokeNettyConnResult("断开和司机屏的连接!")
AdasManager.getInstance().stopDispatchHandler()
}
}
ConnectState.STATUS_CONNECT_ERROR -> {
AppConfigInfo.plateNumber = ""
ToastUtils.showLong("和司机端连接异常!")
invokeNettyConnResult("乘客屏和司机屏连接异常,错误为:$content")
AdasManager.getInstance().stopDispatchHandler()
}
else -> {
AdasManager.getInstance().stopDispatchHandler()
}
else -> {}
}
}

View File

@@ -69,7 +69,6 @@ import mogo.telematics.pad.MessagePad
import mogo_msg.MogoReportMsg
import java.text.SimpleDateFormat
import java.util.*
import kotlin.collections.ArrayList
import kotlin.math.abs
/**
@@ -540,9 +539,29 @@ class DebugSettingView @JvmOverloads constructor(
if (!FunctionBuildConfig.isDemoMode) {
tbIsDrawAutopilotTrajectoryData.isChecked = false
}
SharedPrefsMgr.getInstance(context).putBoolean(MoGoConfig.IS_DEMO_MODE, isChecked)
}
// 雨天模式,上一次勾选的数据
tbIsRainMode.isChecked = FunctionBuildConfig.isRainMode
//雨天模式
tbIsRainMode.setOnCheckedChangeListener { _, isChecked ->
CallerAutoPilotManager.setRainMode(isChecked)
FunctionBuildConfig.isRainMode = isChecked
}
//雨天模式按钮只在司机屏生效,乘客屏不显示
if(AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)){
tbIsRainMode.visibility = View.GONE
}
//重启工控机所有节点
btnIpcReboot.onClick{
CallerAutoPilotManager.sendIpcReboot()
ToastUtils.showLong("重启命令已发送")
}
//只在司机端设置工控机节点重启功能
if(AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)){
btnIpcReboot.visibility = View.GONE
}
// 强制绘制引导线
tbIsDrawAutopilotTrajectoryData.setOnCheckedChangeListener { _, isChecked ->
@@ -612,7 +631,35 @@ class DebugSettingView @JvmOverloads constructor(
tbDrawPointCloudData.isChecked = FunctionBuildConfig.isDrawPointCloudData
//是否渲染点云数据
tbDrawPointCloudData.setOnCheckedChangeListener { _, isChecked ->
FunctionBuildConfig.isDrawPointCloudData = isChecked
CallerHDMapManager.setIsDrawPointCloud(isChecked)
}
//设置点云大小
btnPointCloudSize.setOnClickListener{
val cloudSize = etPointCloudSize.text.toString()
if(cloudSize.isEmpty()){
ToastUtils.showShort("请输入正确的点云大小")
}else{
try {
val cloudSizeFloat = cloudSize.toFloat()
CallerHDMapManager.setPointCloudSize(cloudSizeFloat)
}catch (e: Exception){
ToastUtils.showShort("点云大小格式输入不正确")
}
}
}
//设置点云颜色
btnPointCloudColor.setOnClickListener {
val cloudColor = etPointCloudColor.text.toString()
if(cloudColor.isEmpty()){
ToastUtils.showShort("请输入正确的点云颜色")
}else{
try {
CallerHDMapManager.setPointCloudColor(cloudColor)
}catch (e: Exception){
ToastUtils.showShort("点云大小颜色输入不正确")
}
}
}
// 模拟自动驾驶中
@@ -986,6 +1033,13 @@ class DebugSettingView @JvmOverloads constructor(
L.setEnableLog(isChecked)
}
/**
* 设置是否输出高精地图日志 true-打印日志false-不打印日志
*/
tbHdMapLog.setOnCheckedChangeListener { _, isChecked ->
CallerHDMapManager.setDebugMode(isChecked)
}
cbTraceLog.isChecked = CallerDevaToolsManager.getTraceLogStatus()
//链路Log输出日志
cbTraceLog.setOnCheckedChangeListener { _, isChecked ->

View File

@@ -221,6 +221,27 @@
android:textSize="@dimen/dp_24"
android:background="@drawable/radio_button_normal_background_right"/>
<ToggleButton
android:id="@+id/tbIsRainMode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:textColor="#000"
android:textOff="开启雨天模式"
android:textOn="关闭雨天模式"
android:textSize="@dimen/dp_24"
android:background="@drawable/radio_button_normal_background_right"/>
<Button
android:id="@+id/btnIpcReboot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:text="重启IPC节点"
android:textSize="@dimen/dp_24"
android:background="@drawable/radio_button_normal_background_right"
/>
<ToggleButton
android:id="@+id/tbDeviceBind"
android:layout_width="match_parent"
@@ -1527,12 +1548,76 @@
app:layout_constraintRight_toRightOf="parent"
/>
<Button
android:id="@+id/btnPointCloudSize"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="@dimen/dp_10"
android:layout_margin="2dp"
android:text="设置点云大小"
android:textSize="@dimen/dp_24"
app:layout_constraintTop_toBottomOf="@id/tbDrawPointCloudData"
app:layout_constraintLeft_toLeftOf="parent"
/>
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/etPointCloudSize"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginEnd="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_10"
android:background="@drawable/debug_setting_edit_bg"
android:gravity="center"
android:hint="请输入点云大小"
android:textColor="#1A1A1A"
android:textSize="14sp"
app:layout_constraintLeft_toRightOf="@id/btnPointCloudSize"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/btnPointCloudSize"
app:layout_constraintBottom_toBottomOf="@id/btnPointCloudSize"
/>
<Button
android:id="@+id/btnPointCloudColor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="@dimen/dp_10"
android:layout_margin="2dp"
android:text="设置点云颜色"
android:textSize="@dimen/dp_24"
app:layout_constraintTop_toBottomOf="@id/btnPointCloudSize"
app:layout_constraintLeft_toLeftOf="parent"
/>
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/etPointCloudColor"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginEnd="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_10"
android:background="@drawable/debug_setting_edit_bg"
android:gravity="center"
android:hint="请输入点云颜色"
android:textColor="#1A1A1A"
android:textSize="14sp"
app:layout_constraintLeft_toRightOf="@id/btnPointCloudColor"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/btnPointCloudColor"
app:layout_constraintBottom_toBottomOf="@id/btnPointCloudColor"
/>
<RadioGroup
android:id="@+id/rgGpsProvider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintTop_toBottomOf="@id/tbChangeAutoPilotStatus">
app:layout_constraintTop_toBottomOf="@id/btnPointCloudColor">
<RadioButton
android:id="@+id/rbGpsProviderAndroid"
@@ -1654,6 +1739,16 @@
android:textOn="关闭「OBU」Log"
android:textSize="@dimen/dp_24" />
<ToggleButton
android:id="@+id/tbHdMapLog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:gravity="center"
android:textOff="打开「HD-MAP」Log"
android:textOn="关闭「HD-MAP」Log"
android:textSize="@dimen/dp_24"
/>
</com.google.android.flexbox.FlexboxLayout>

View File

@@ -21,6 +21,8 @@ import com.mogo.map.IMogoMap;
import com.mogo.map.IMogoUiSettings;
import com.mogo.map.MogoMapView;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.zhidaoauto.map.sdk.open.MapAutoApi;
import com.zhidaoauto.map.sdk.open.business.PointCloudHelper;
/**
* @author donghongyu
@@ -275,4 +277,30 @@ public class MapFragment extends MvpFragment<MapView, MapPresenter>
}
}
@Override
public void setPointCloudSize(float pointCloudSize) {
//设置点云大小
PointCloudHelper.INSTANCE.setPointCloudSize(pointCloudSize);
}
@Override
public void setPointCloudColor(@NonNull String color) {
// 设置点云颜色
PointCloudHelper.INSTANCE.setPointCloudColor(color);
}
@Override
public void setIsDrawPointCloud(boolean isDrawPointCloud) {
// 是否绘制点云
PointCloudHelper.INSTANCE.setIsDrawPointCloud(isDrawPointCloud);
}
/**
* 设置地图是否是Debug模式
* @param debugMode 是否开启Debug模式
*/
@Override
public void setDebugMode(boolean debugMode) {
MapAutoApi.INSTANCE.setDebugMode(debugMode);
}
}

View File

@@ -102,6 +102,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
V2XManager.init(V2XConfig.Builder().also {
it.aiCloudConfig(MoGoAiCloudClientConfig.getInstance())
it.context(context)
it.loggable(true)
it.distanceForTriggerRefresh(200f) //行驶超过200包含刷新道路周边信息短链请求
it.durationForTriggerRefresh(
60,

View File

@@ -8,7 +8,7 @@ package com.mogo.eagle.core.data.config
object FunctionBuildConfig {
/**
* 是否是演示(美化)模式会存在SP中方便做现场恢复
* 是否是演示(美化)模式
* 1.当点击【开始服务taxi/滑动出发bus】btn后不管实际自动驾驶按钮「state值」如何变更自动驾驶按钮都呈现2的状态。
* 只是自动驾驶按钮的样式为2-被选中的状态
* 若点击,则可继续向自动驾驶系统发送启动自动驾驶的命令。
@@ -18,6 +18,17 @@ object FunctionBuildConfig {
@JvmField
var isDemoMode = false
/**
* 是否是雨天模式
* 默认关闭
* 打开后可实现过滤到误检的雨天水花,带来两个效果变化:
* 1、鹰眼感知到的误识别物体减少
* 2、自动驾驶因为水花误识别导致的点刹减少
*/
@Volatile
@JvmField
var isRainMode = false
/**
* 当前APP的身份模式
*

View File

@@ -17,9 +17,6 @@ object MoGoConfig {
// CMD全量日志抓取当时时间
const val CATCH_LOG_TIME = "CATCH_LOG_TIME"
// 是否是演示美化模式会存在SP中方便做现场恢复
const val IS_DEMO_MODE = "IS_DEMO_MODE"
//根据加速度判断是否刹车阈值
const val BRAKE_ACCELERATION_THRESHOLD = "BRAKE_ACCELERATION_THRESHOLD"

View File

@@ -40,6 +40,7 @@ data class TrafficLightResult(
val laneNo: Int, //车道号
val arrowNo: Int, //当前车道对应地面要素转向
val laneList: TrafficLightDetail, //灯态具体信息
val flashYellow: Int// 黄灯总时间
val flashYellow: Int,// 黄灯总时间
val timeStamp: Long //当前卫星时间,单位:ms
) {
}

View File

@@ -120,6 +120,18 @@ interface IMoGoAutopilotProvider : IMoGoFunctionServerProvider {
*/
fun setDemoMode(isEnable: Boolean)
/**
* 雨天模式
* isEnable = true 开启
* isEnable = false 关闭
*/
fun setRainMode(isEnable: Boolean)
/**
* 发送工控机所有节点重启命令
*/
fun sendIpcReboot()
/**
* 办公室调试使用,强制开启自动驾驶,将 statuspilotmodecontrol_pilotmode强追设置为 1
* isEnable = true 开启

View File

@@ -42,4 +42,33 @@ interface IMoGoMapFragmentProvider : IMoGoFunctionServerProvider {
* @param isDayMode true-白天模式false-夜间模式
*/
fun stepInVrMode(isDayMode: Boolean)
/**
* 打开点云绘制
*
* @param isDrawPointCloud 是否绘制点云
*/
fun setIsDrawPointCloud(isDrawPointCloud: Boolean)
/**
* 设制点云大小
*
* @param pointCloudSize 点云的点大小
*/
fun setPointCloudSize(pointCloudSize: Float)
/**
* 设置点云颜色
*
* @param color // color:"#RRGGBB*
*/
fun setPointCloudColor(color: String)
/**
* 设置地图是否是Debug模式
* @param debugMode 是否开启Debug模式
*/
fun setDebugMode(debugMode: Boolean)
}

View File

@@ -156,6 +156,22 @@ object CallerAutoPilotManager {
providerApi?.setDemoMode(isEnable)
}
/**
* 雨天模式
* isEnable = true 开启
* isEnable = false 关闭
*/
fun setRainMode(isEnable: Boolean){
providerApi?.setRainMode(isEnable)
}
/**
* 发送工控机所有节点重启命令
*/
fun sendIpcReboot(){
providerApi?.sendIpcReboot()
}
/**
* 办公室调试使用,强制开启自动驾驶,将 statuspilotmodecontrol_pilotmode强追设置为 1
* isEnable = true 开启

View File

@@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.call.map
import androidx.annotation.RawRes
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths
import com.mogo.eagle.core.data.map.CenterLine
import com.mogo.eagle.core.function.api.map.hd.IMoGoMapFragmentProvider
@@ -58,4 +59,40 @@ object CallerHDMapManager : CallerBase() {
fun stepInVrMode(isDayMode: Boolean) {
return mapProviderApi.stepInVrMode(isDayMode)
}
/**
*
* 打开点云绘制
*
* @param isDrawPointCloud 是否绘制点云
*/
fun setIsDrawPointCloud(isDrawPointCloud: Boolean) {
FunctionBuildConfig.isDrawPointCloudData = isDrawPointCloud
return mapProviderApi.setIsDrawPointCloud(isDrawPointCloud)
}
/**
* 设制点云大小
* @param pointCloudSize 点云的点大小
*/
fun setPointCloudSize(pointCloudSize: Float) {
return mapProviderApi.setPointCloudSize(pointCloudSize)
}
/**
* 设置点云颜色
*
* @param color // color:"#RRGGBB*
*/
fun setPointCloudColor(color: String) {
return mapProviderApi.setPointCloudColor(color)
}
/**
* 设置地图是否是Debug模式
* @param debugMode 是否开启Debug模式
*/
fun setDebugMode(debugMode: Boolean){
return mapProviderApi.setDebugMode(debugMode)
}
}

View File

@@ -63,26 +63,26 @@ SERVICE_CHAIN_VERSION=1.1.0
LOGLIB_VERSION=1.3.0
######## MogoAiCloudSDK Version ########
# 网络请求LOGLIB_VERSION
MOGO_NETWORK_VERSION=1.4.1
MOGO_NETWORK_VERSION=1.4.3.3
# 鉴权
MOGO_PASSPORT_VERSION=1.4.1
MOGO_PASSPORT_VERSION=1.4.3.3
# 常链接
MOGO_SOCKET_VERSION=1.4.1
MOGO_SOCKET_VERSION=1.4.3.3
# 数据采集
MOGO_REALTIME_VERSION=1.4.1
MOGO_REALTIME_VERSION=1.4.3.3
# 探路,道路事件发布,获取
MOGO_TANLU_VERSION=1.4.1
MOGO_TANLU_VERSION=1.4.3.3
# 直播推流
MOGO_LIVE_VERSION=1.4.1
MOGO_LIVE_VERSION=1.4.3.3
# 直播拉流
MOGO_TRAFFICLIVE_VERSION=1.4.1
MOGO_TRAFFICLIVE_VERSION=1.4.3.3
# 定位服务
MOGO_LOCATION_VERSION=1.4.1
MOGO_LOCATION_VERSION=1.4.3.3
# 远程通讯模块
MOGO_TELEMATIC_VERSION=1.4.1
MOGO_TELEMATIC_VERSION=1.4.3.3
######## MogoAiCloudSDK Version ########
# 自研地图
MAP_SDK_VERSION=2.2.0.7
MAP_SDK_VERSION=2.2.0.9
MAP_SDK_OPERATION_VERSION=1.0.13
# websocket
WEBSOCKET_VERSION=1.1.7
@@ -155,7 +155,7 @@ MOGO_OCH_TAXI_VERSION=2.0.66
# mogoAiCloud sdk services
MOGO_AICLOUD_SERVICES_SDK_VERSION=2.1.16.10
# v2x-sdk
MOGO_V2X_SDK_VERSION=1.4.1
MOGO_V2X_SDK_VERSION=1.4.3.3
################# 旧版本架构模块版本 #################

View File

@@ -0,0 +1 @@
/build

View File

@@ -0,0 +1,463 @@
#### 说明
# ADAS LIB
## 与工控机交互LIB
# 使用方法参见【app_ipc_monitoring】中的代码
## 可用接口
~~~java
/**
* 设置多设备监听
*
* @param l 监听
*/
AdasManager.getInstance().setOnMultiDeviceListener(OnMultiDeviceListener l);
~~~
~~~java
/**
* 设置工控机数据监听
*
* @param l 监听
*/
AdasManager.getInstance().setOnAdasListener(OnAdasListener l);
~~~
~~~java
/**
* 创建一个连接
*
* @param options 连接参数
* @param onAdasConnectStatusListener 连接状态监听
*/
AdasManager.getInstance().create(AdasOptions options, OnAdasConnectStatusListener onAdasConnectStatusListener);
~~~
~~~java
/**
* ADAS LIB 版本
*
* @return 版本
*/
AdasManager.getInstance().getAdasVersion();
~~~
~~~java
/**
* 获取协议版本
*
* @return 版本
*/
AdasManager.getInstance().getProtocolVersion();
~~~
~~~java
/**
* 获取工控机配置信息
*
* @return 配置信息 未连接为null 断开连接会清空
*/
AdasManager.getInstance().getCarConfig();
~~~
~~~java
/**
* 连接工控机
*/
AdasManager.getInstance().connect();
~~~
~~~java
/**
* 与工控机断开连接
*/
AdasManager.getInstance().disconnect();
~~~
~~~java
/**
* 获取当前工控机的链接状态
*
* @return {@link Constants.IPC_CONNECTION_STATUS}
*/
AdasManager.getInstance().getIpcConnectionStatus();
~~~
~~~java
/**
* Log是否开启打印
*/
AdasManager.getInstance().setEnableLog(boolean isEnableLog);
~~~
~~~java
/**
* 系统命令请求, 比如系统重启,启用新镜像
*
* @param type SystemCmdType。SYSTEMCMD_REBOOT 重启所有节点
* SystemCmdType。SYSTEMCMD_EMPLOY_NEW_IMAGE 使用新镜像(推镜像)
* SystemCmdType。SYSTEMCMD_SHUT_DOWN 关机
* @return boolean
*/
AdasManager.getInstance().sendSystemCmdReq(@NonNull MessagePad.SystemCmdType type);
~~~
~~~java
/**
* 解析工控机发送过来的数据
* 多设备时使用
*
* @param bytes 数据
*/
AdasManager.getInstance().parseIPCData(byte[] bytes);
~~~
~~~java
/**
* 获取工控机链接配置
*
* @return 工控机链接参数
*/
AdasManager.getInstance().getAdasOptions();
~~~
~~~java
/**
* 获取已经链接成功的工控机IP 未连接为null
*
* @return ip null:表示未连接
*/
AdasManager.getInstance().getIpcConnectedIp();
~~~
~~~java
/**
* 获取已经链接成功的工控机端口
*
* @return 端口 未连接为默认端口
*/
AdasManager.getInstance().getIpcConnectedPort();
~~~
~~~java
/**
* 自动驾驶设备基础信息应答
*
* @param sn SN
* @param environment 1: 研发环境, 2:测试环境, 3:生产环境 4:演示环境
* @return
*/
AdasManager.getInstance().sendBasicInfoResp(@NonNull String sn, int environment);
~~~
~~~java
/**
* 设置自动驾驶模式 启动自动驾驶
*
* @param mode 1: enter autopilot mode, 0: quit autopilot mode
* @param source 命令来源: 0: pad模拟(模拟时routeInfo传null), 1: AICloud业务
* @param routeInfo 自动驾驶路径信息
* @return
*/
AdasManager.getInstance().sendAutoPilotModeReq(int mode, int source, MessagePad.RouteInfo routeInfo);
~~~
~~~java
/**
* 设置演示模式
*
* @param enable 1: enable, 0: disable
* @return
*/
AdasManager.getInstance().sendDemoModeReq(int enable);
~~~
~~~java
/**
* 车机基础信息请求
*
* @return
*/
AdasManager.getInstance().sendCarConfigReq();
~~~
~~~java
/**
* 记录人工接管原因
*
* @param key bag key 唯一标识
* @param filename 文件路径
* @param reasonID 接管原因id
* @param reason 接管原因
* @return
*/
AdasManager.getInstance().sendRecordCause(long key, @NonNull String filename, @NonNull String reasonID, @NonNull String reason);
~~~
~~~java
/**
* 同下
*
* @param id
* @param type
* @return
*/
AdasManager.getInstance().startRecordPackage(int id, int type);
~~~
~~~java
/**
* 同下
*
* @param id
* @param type
* @return
*/
AdasManager.getInstance().startRecordPackage(int id, int duration, int type);
~~~
~~~java
/**
* 同下
*
* @param id
* @param type
* @return
*/
AdasManager.getInstance().stopRecordPackage(int id, int type);
~~~
~~~java
/**
* 数据采集请求 主动录制Bag包
*
* @param id 采集id
* @param duration 采集时间长
* @param type 采集类型, 1:badcase, 2: map; 3: rests
* @param isRecord 采集指令, true: 采集, false: 停止采集
* @param sustain 是否持续采集
* @return
*/
AdasManager.getInstance().sendRecordData(int id, int duration, int type, boolean isRecord);
~~~
~~~java
/**
* 设置自动驾驶最大速度
*
* @param speedLimit 最大车辆速度 m/s
* @return
*/
AdasManager.getInstance().sendAutopilotSpeedReq(double speedLimit);
~~~
~~~java
/**
* 发送红绿灯数据到工控机
*
* @param crossID roadID
* @param latitude
* @param longitude
* @param heading 红绿灯方向
* @param direction 路的航向角
* @param lightId 红绿灯ID
* @param laneNo 车道号
* @param arrowNo 当前车道对应地面要素转向
* @param flashYellow 黄灯总时间
* @param laneDetail 灯态具体信息
* @return
*/
AdasManager.getInstance().sendTrafficLightData(@NonNull String crossID, double latitude, double longitude, @NonNull String heading, @NonNull String direction, int lightId, int laneNo, int arrowNo, int flashYellow, MessagePad.TrafficLightDetail laneDetail);
~~~
~~~java
/**
* 自动驾驶路径请求
*
* @return
*/
AdasManager.getInstance().sendGlobalPathReq();
~~~
~~~java
/**
* 获取工控机固定IP列表
*
* @return 返回默认工控机IP列表
*/
AdasManager.getInstance().getIPCFixationIPList(Context context);
~~~
~~~java
/**
* 增加工控机固定IP
*
* @param ipcIP IP
*/
AdasManager.getInstance().addIPCFixationIP(Context context, String ipcIP);
~~~
~~~java
/**
* 删除指定的工控机固定IP
*
* @param ipcIP IP
*/
AdasManager.getInstance().delIPCFixationIP(Context context, String ipcIP);
~~~
~~~java
/**
* 删除所有工控机固定IP
*/
AdasManager.getInstance().delIPCFixationIP(Context context);
~~~
## OnAdasListener
### 工控机数据回调
#### 回调中对象的字段详情参见各个proto文件
~~~java
/**
* 自动驾驶局部轨迹 前车引导线
*
* @param header 头
* @param trajectory 数据
*/
void onTrajectory(MessagePad.Header header, MessagePad.Trajectory trajectory);
~~~
~~~java
/**
* 障碍物 他车数据
*
* @param header 头
* @param trackedObjects 数据
*/
void onTrackedObjects(MessagePad.Header header, MessagePad.TrackedObjects trackedObjects);
~~~
~~~java
/**
* 惯导信息
*
* @param header 头
* @param gnssInfo 数据
*/
void onGnssInfo(MessagePad.Header header, MessagePad.GnssInfo gnssInfo);
~~~
~~~java
/**
* 底盘信息, 透传底盘状态pb参考底盘
*
* @param header 头
* @param vehicleState 数据
*/
void onVehicleState(MessagePad.Header header, VehicleStateOuterClass.VehicleState vehicleState);
~~~
~~~java
/**
* 自动驾驶状态
*
* @param header 头
* @param autopilotState 数据
*/
void onAutopilotState(MessagePad.Header header, MessagePad.AutopilotState autopilotState);
~~~
~~~java
/**
* 监控事件报告
*
* @param header 头
* @param mogoReportMessage 数据
*/
void onReportMessage(MessagePad.Header header, MogoReportMsg.MogoReportMessage mogoReportMessage);
~~~
~~~java
/**
* 感知红绿灯
*
* @param header 头
* @param trafficLights 感知红绿灯
*/
void onPerceptionTrafficLight(MessagePad.Header header, TrafficLightOuterClass.TrafficLights trafficLights);
~~~
~~~java
/**
* 他车轨迹预测
*
* @param header 头
* @param predictionObjects 他车轨迹预测数据
*/
void onPredictionObstacleTrajectory(MessagePad.Header header, Prediction.mPredictionObjects predictionObjects);
~~~
~~~java
/**
* 自动驾驶设备基础信息请求
*
* @param header 头
* @param basicInfoReq 数据 目前没有任何参数
*/
void onBasicInfoReq(MessagePad.Header header, MessagePad.BasicInfoReq basicInfoReq);
~~~
~~~java
/**
* 车机基础信息应答
*
* @param header 头
* @param carConfigResp 数据
*/
void onCarConfigResp(MessagePad.Header header, MessagePad.CarConfigResp carConfigResp);
~~~
~~~java
/**
* 数据采集结果
*
* @param header 头
* @param recordPanel 数据
*/
void onRecordResult(MessagePad.Header header, RecordPanelOuterClass.RecordPanel recordPanel);
~~~
~~~java
/**
* 自动驾驶路径应答
*
* @param header 头
* @param globalPathResp 数据
*/
void onGlobalPathResp(MessagePad.Header header, MessagePad.GlobalPathResp globalPathResp);
~~~
~~~java
/**
* 报警信息
* 暂时保留,目前没有使用
*
* @param header 头
* @param warn 数据
*/
@Deprecated
void onWarn(MessagePad.Header header, MessagePad.Warn warn);
~~~
~~~java
/**
* 到站提醒 自动驾驶站点
*
* @param header 头
* @param arrivalNotification 数据
*/
void onArrivalNotification(MessagePad.Header header, MessagePad.ArrivalNotification arrivalNotification);
~~~
~~~java
/**
* 向IPC发送命令返回结果
*
* @param info
*/
void onSSHResult(SSHResult info);
~~~
~~~java
/**
* 数据错误
*
* @param status 错误原因
* @param bytes 原始数据
*/
void onError(ProtocolStatus status, byte[] bytes);
~~~
## OnAdasConnectStatusListener
### 连接状态监听
~~~java
/**
* 与工控机链接状态变化
*
* @param ipcConnectionStatus {@link Constants.IPC_CONNECTION_STATUS}
* @param reason 连接信息 需要判null
* 如果ipcConnectionStatus==Constants.IPC_CONNECTION_STATUS.DISCONNECTED&&reason==null 表示主动断开连接
*/
void onConnectionIPCStatus(@Define.IPCConnectionStatus int ipcConnectionStatus, @Nullable String reason);
~~~
## OnMultiDeviceListener
### 多设备链接监听
~~~java
/**
* 转发工控机消息
* 如果是客户端此回调不会被调用
*
* @param bytes 数据
*/
void onForwardingIPCMessage(byte[] bytes);
~~~

View File

@@ -0,0 +1,36 @@
plugins {
id 'com.android.library'
}
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
// buildToolsVersion rootProject.ext.android.buildToolsVersion
defaultConfig {
minSdkVersion 21
targetSdkVersion rootProject.ext.android.targetSdkVersion
// versionCode Integer.valueOf(VERSION_CODE)
// versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
//
// buildConfigField "String", "AP_VERSION", "\"${AP_VERSION}\""
versionCode rootProject.versionCode as int
versionName rootProject.versionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation rootProject.ext.dependencies.androidxappcompat
}

View File

@@ -0,0 +1,3 @@
GROUP=com.mogo.adas
POM_ARTIFACT_ID=mogo-adas
VERSION_CODE=1

View File

@@ -0,0 +1,26 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-----MogoMap-----
-keep class com.mogo.map.MogoNavi{
private <init>();
}

View File

@@ -0,0 +1,14 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.zhidao.support.adas.high.permission">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<application>
<activity
android:name=".dialog.PermissionLongBackgroundRunningDialog"
android:theme="@style/PermissionLongBackgroundRunningDialogStyle" />
</application>
</manifest>

View File

@@ -0,0 +1,111 @@
package com.zhidao.support.adas.high.permission;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.Uri;
import android.os.PowerManager;
import android.provider.Settings;
import android.util.Log;
import com.zhidao.support.adas.high.permission.dialog.PermissionLongBackgroundRunningDialog;
/**
* 长时间后台运行权限检查
*/
public class BackgrounderPermission {
public void showPermissionLongBackgroundRunningDialog(Context context) {
Intent intent = new Intent(context, PermissionLongBackgroundRunningDialog.class);
context.startActivity(intent);
}
/**
* 获取当前是否开启电池优化
*
* @param context 上下文
* @return 否在设备的电源白名单上 true 表示未优化
*/
public boolean isIgnoringBatteryOptimizations(Context context) {
boolean isIgnoring = false;
PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
if (powerManager != null) {
isIgnoring = powerManager.isIgnoringBatteryOptimizations(context.getPackageName());
}
return isIgnoring;
}
/**
* 申请 关闭电池优化权限
*
* @param context
*/
public void requestIgnoreBatteryOptimizations(Context context) {
Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
intent.setData(Uri.parse("package:" + context.getPackageName()));
context.startActivity(intent);
}
/**
* 是否忽略计费网络限制
* 后台运行时网络限制
*
* @param context
* @return
*/
public boolean isIgnoringMeteredNetworkRestrictions(Context context) {
ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
// 检查设备是否在计费网络
// if (connMgr.isActiveNetworkMetered()) {
// Checks users Data Saver settings.
switch (connMgr.getRestrictBackgroundStatus()) {
case ConnectivityManager.RESTRICT_BACKGROUND_STATUS_ENABLED:
// 用户已为此应用启用流量节省程序。应用应努力限制前台流量消耗,并妥善处理后台流量消耗限制。
Log.i("Permission", "用户已为此应用启用流量节省程序。应用应努力限制前台流量消耗,并妥善处理后台流量消耗限制。");
return false;
case ConnectivityManager.RESTRICT_BACKGROUND_STATUS_WHITELISTED:
// 用户已启用流量节省程序,但应用在白名单中。应用应努力限制前台和后台流量消耗。
Log.i("Permission", "用户已启用流量节省程序,但应用在白名单中。应用应努力限制前台和后台流量消耗。");
return false;
case ConnectivityManager.RESTRICT_BACKGROUND_STATUS_DISABLED:
// 流量节省程序已停用。
Log.i("Permission", "流量节省程序已停用。");
return true;
}
// } else {
// // 设备不在计费网络,为所欲为
// Log.i("Permission","设备不在计费网络,为所欲为");
// return true;
// }
Log.i("dddd", "其他");
return false;
}
/**
* 除非应用的核心功能受到不利影响,否则 Google Play 政策禁止应用请求直接豁免 Android 6.0+ 中的电源管理功能(低电耗模式和应用待机模式)
*/
public static void requestAddDataSaverWhite(Context context) {
// ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
// if (connMgr != null && connMgr.getRestrictBackgroundStatus() == ConnectivityManager.RESTRICT_BACKGROUND_STATUS_ENABLED) {
Intent intent = new Intent(Settings.ACTION_IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS);
intent.setData(Uri.parse("package:" + context.getPackageName()));
context.startActivity(intent);
// }
}
/**
* 是否允许长时间后台运行
*
* @param context 上下文
* @return
*/
public boolean isPermissionLongBackgroundRunning(Context context) {
return isIgnoringBatteryOptimizations(context) && isIgnoringMeteredNetworkRestrictions(context);
}
}

View File

@@ -0,0 +1,41 @@
package com.zhidao.support.adas.high.permission.dialog;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.zhidao.support.adas.high.permission.R;
/**
* 数据用量及电池优化 权限申请
* 高版本Android系统会针对熄屏、休眠或后台 对电池WiFi等进行优化长时间网络可能会断开连接
*/
public class PermissionLongBackgroundRunningDialog extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
overridePendingTransition(R.anim.dialog_in, R.anim.dialog_out);
setContentView(R.layout.dialog_adas_permission_long_background_running);
// //设置弹出窗口与屏幕对齐
// Window win = this.getWindow();
// int density = (int) (getResources().getDisplayMetrics().density + 0.5f);
////设置内边距这里设置为10dp
// win.getDecorView().setPadding(10 * density, 10 * density, 10 * density, 10 * density);
// WindowManager.LayoutParams lp = win.getAttributes();
////设置窗口宽度
// lp.width = WindowManager.LayoutParams.MATCH_PARENT;
////设置窗口高度
// lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
////设置Dialog位置
// lp.gravity = Gravity.TOP;
// win.setAttributes(lp);
}
@Override
public void finish() {
super.finish();
//在此时设置转场动画
overridePendingTransition(R.anim.dialog_out, R.anim.dialog_in);
}
}

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="300"
android:fromYDelta="50%"
android:toYDelta="100%" />
<alpha
android:duration="300"
android:fromAlpha="0"
android:toAlpha="1" />
</set>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="300"
android:fromYDelta="50%"
android:toYDelta="0" />
<alpha
android:duration="300"
android:fromAlpha="0"
android:toAlpha="1" />
</set>

View File

@@ -3,7 +3,7 @@
<solid android:color="#FAFFFFFF" />
<stroke
android:width="0.8dp"
android:color="#A140E0D0" />
android:color="#81666666" />
<!-- 圆角 -->
<corners android:radius="6dp" />
</shape>

View File

@@ -0,0 +1,13 @@
<?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:background="@drawable/bg_adas_dialog"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="由于系统默认启动了电池优化功能,此功会影响熄屏或休眠后网络连接"
android:textColor="#000000" />
</LinearLayout>

View File

@@ -0,0 +1,3 @@
<resources>
<string name="app_name">adas-backgrounder-permission</string>
</resources>

View File

@@ -0,0 +1,21 @@
<resources>
<style name="PermissionLongBackgroundRunningDialogStyle" parent="Theme.AppCompat.Dialog">
<!--设置dialog的背景-->
<item name="android:windowBackground">@android:color/transparent</item>
<!--设置Dialog的windowFrame框为无-->
<item name="android:windowFrame">@null</item>
<!--设置无标题-->
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<!--是否浮现在activity之上-->
<item name="android:windowIsFloating">true</item>
<!--是否半透明-->
<item name="android:windowIsTranslucent">true</item>
<!--设置窗口内容不覆盖-->
<item name="android:windowContentOverlay">@null</item>
<!--背景是否模糊显示-->
<item name="android:backgroundDimEnabled">true</item>
</style>
</resources>

View File

@@ -40,13 +40,14 @@ enum MessageType
MsgTypeTrajectoryDownloadReq = 0x10110; //轨迹下载请求
MsgTypeStatusQueryReq = 0x10111; //状态查询请求
MsgTypeStatusQueryResp = 0x10112; //状态查询应答
MsgTypeSetRainModeReq = 0x10113; //设置雨天模式
}
message Header
{
uint64 msgID = 1; //消息唯一id自增
MessageType msgType = 2; //消息类型
double timestamp = 3; //telematics消息发送时间, 单位:秒
double timestamp = 3; //消息发送时间, 单位:秒
double sourceTimestamp = 4; //数据源消息发送时间, 单位:秒
}
@@ -298,6 +299,7 @@ message TrafficLightData
int32 arrowNo = 8; //当前车道对应地面要素转向
int32 flashYellow = 9; //黄灯总时间
TrafficLightDetail laneDetail = 10; //灯态具体信息
uint64 timestamp =11;//当前卫星时间, 单位: ms
}
// message definition for MsgTypeWarn
@@ -337,5 +339,9 @@ message StatusQueryReq
// message definition for MsgTypeStatusQueryResp
// refer to system_status_info.proto
// message definition for MsgTypeSetRainModeReq
message SetRainModeReq
{
uint32 enable = 1; //1: enable, 0: disable
}

View File

@@ -3,21 +3,21 @@ syntax = "proto2";
package system_master;
enum SystemState {
SYS_STARTING = 0;
SYS_RUNNING = 1;
SYS_EXITING = 2;
SYS_FAULT = 3;
PILOT_READY = 4;
AUTO_PILOT_STARTING = 5;
AUTO_PILOT_RUNNING = 6;
REMOTE_PILOT_STARTING = 7;
REMOTE_PILOT_RUNNING = 8;
SYS_STARTING = 0; //系统正在启动
SYS_RUNNING = 1; //系统运行中
SYS_EXITING = 2; //系统正在关闭 例如重启
SYS_FAULT = 3; //系统异常
PILOT_READY = 4; //自动驾驶准备就绪,轨迹下载完成,可以开始自动驾驶
AUTO_PILOT_STARTING = 5; //正在开始自动驾驶 自动驾驶命令已下发,正在启动中
AUTO_PILOT_RUNNING = 6; //自动驾驶运行中
REMOTE_PILOT_STARTING = 7; //平行驾驶启动中
REMOTE_PILOT_RUNNING = 8; //平行驾驶运行中
}
enum HealthState {
NORMAL = 0;
FAULT = 1;
UNKNOW = 2;
NORMAL = 0;//正常
FAULT = 1;//异常
UNKNOW = 2;//未知
}
message HealthInfo{
@@ -29,19 +29,19 @@ message HealthInfo{
message TopicInfo{
optional string name = 1; //topic name
optional int32 hz = 2;
optional int32 hz = 2; //Topic发送的频率
// optional int32 max_delay = 3; //unit msec
}
message DropTopic{
required int32 sum = 1; //dropped topic sum
required int32 sum = 1; //dropped topic sum 有多少个Topic掉帧
repeated TopicInfo topic = 2;
}
message StatusInfo {
required SystemState sys_state=1; // 当前消息状态
repeated HealthInfo health_info=2; // 健康检查状态信息
repeated HealthInfo health_info=2; // 健康检查状态信息
optional DropTopic topic_drop_info=3; // topic 掉频信息, 如有掉频添加没有不添加
optional string reserved = 4; // 预留可选字段,用于接口扩充或者,其他信息补充
}

View File

@@ -61,11 +61,15 @@ import okio.ByteString;
*/
public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnectListener, IPCFixationIPHelper.IIPCFixationIPListener, DispatchHandler.OnDispatchHandlerListener {
private static final String TAG = AdasChannel.class.getSimpleName();
private static final String THREAD_NAME_DISPATCH_EVENT = "IPCEventDispatchHandler";//除点云单独拆分线程以外都是用此名称
private static final String THREAD_NAME_DISPATCH_POINT_CLOUD = "IPCPointCloudDispatchHandler";
private static final String THREAD_NAME_DISPATCH_PARSE_POINT_CLOUD = "IPCParsePointCloudDispatchHandler";//解析点云线程 地图支持后将会删除
private FpgaSocket mSocket;
private RawUnpack rawUnpack;//业务数据拆包
private RawPack rawPack;//数据打包
private DispatchHandler dispatchHandler;//分发
private DispatchHandler dispatchHandlerPointCloud;//点云分发
private DispatchHandler dispatchHandlerPointCloud;//原始的点云数据分发
private DispatchHandler dispatchHandlerParsePointCloud;//解析过的点云数据分发 地图支持后将会删除
private Timer checkCompatibilityTimer;//检查版本兼容性定时器 连接成功后5秒内等待工控机发送配置信息
/**
* 与工控机链接状态
@@ -78,10 +82,6 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
*/
public static final boolean isUseQueue = false;
/**
* 本通道是否启用分发线程 收发和分发拆分成两个线程
*/
public static final boolean ADAS_CHANNEL_IS_USE_DISPATCH_HANDLER = true;
/**
* 消息工厂
@@ -156,11 +156,10 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
rawPack = new RawPack();
//消息工厂
myMessageFactory = new MyMessageFactory();
//司机端以及启用线程分发
if (!adasOptions.isClient() && ADAS_CHANNEL_IS_USE_DISPATCH_HANDLER) {
dispatchHandler = new DispatchHandler(this);
dispatchHandlerPointCloud = new DispatchHandler(this);
}
//启用线程分发
dispatchHandler = new DispatchHandler(THREAD_NAME_DISPATCH_EVENT, this);
dispatchHandlerPointCloud = new DispatchHandler(THREAD_NAME_DISPATCH_POINT_CLOUD, this);
dispatchHandlerParsePointCloud = new DispatchHandler(THREAD_NAME_DISPATCH_PARSE_POINT_CLOUD, this);
}
/**
@@ -267,16 +266,15 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
ReceiveTimeoutManager.getInstance().refreshLast(header.getTimestamp());
// CupidLogUtils.w("--->websocket byte read header = " + messageType.toString());
//判断是否是司机屏幕,是否切换分发线程
if (!adasOptions.isClient() && ADAS_CHANNEL_IS_USE_DISPATCH_HANDLER) {
if (header.getMsgType() == MessageType.TYPE_RECEIVE_POINT_CLOUD.typeCode) {
if (dispatchHandlerPointCloud != null)
dispatchHandlerPointCloud.sendRawMessage(raw);
} else {
if (dispatchHandler != null)
dispatchHandler.sendRawMessage(raw);
if (header.getMsgType() == MessageType.TYPE_RECEIVE_POINT_CLOUD.typeCode) {
if (dispatchHandlerPointCloud != null) {
dispatchHandlerPointCloud.sendRawMessage(raw);
}
if (dispatchHandlerParsePointCloud != null)
dispatchHandlerParsePointCloud.sendRawMessage(raw);
} else {
dispatchRaw(raw);
if (dispatchHandler != null)
dispatchHandler.sendRawMessage(raw);
}
} else {
callError(raw.getProtocolStatus(), byteString.toByteArray());
@@ -288,37 +286,37 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
}
}
/**
* 分发和解析
*
* @param raw
*/
private void dispatchRaw(RawData raw) {
try {
if (rawUnpack != null) {
if (raw.getProtocolStatus() == ProtocolStatus.SUCCEED) {
MessagePad.Header header = raw.getHeader();
MessagePad.MessageType messageType = header.getMsgType();
IMsg iMsg = myMessageFactory.createMessage(messageType);
if (iMsg == null) {
callError(ProtocolStatus.MESSAGE_TYPE_UNKNOWN, raw.originalData.toByteArray());
return;
}
iMsg.handlerMsg(raw, mAdasListener);
} else {
callError(raw.getProtocolStatus(), raw.originalData.toByteArray());
}
}
} catch (Exception e) {
callError(ProtocolStatus.BUSINESS_DATA_PARSE_FAILED, raw.originalData.toByteArray());
CupidLogUtils.e(TAG, "原始数据:" + ByteUtil.byteArrToHex(raw.originalData.toByteArray()), e);
}
}
@Override
public void onDispatchRaw(RawData raw) {
dispatchRaw(raw);
public void onDispatchRaw(String threadName, RawData raw) {
//分发点云原始数据
if (THREAD_NAME_DISPATCH_POINT_CLOUD.equals(threadName)) {
mAdasListener.onPointCloud(raw.originalData.toByteArray());
} else {
try {
if (rawUnpack != null) {
if (raw.getProtocolStatus() == ProtocolStatus.SUCCEED) {
MessagePad.Header header = raw.getHeader();
MessagePad.MessageType messageType = header.getMsgType();
IMsg iMsg = myMessageFactory.createMessage(messageType);
if (iMsg == null) {
callError(ProtocolStatus.MESSAGE_TYPE_UNKNOWN, raw.originalData.toByteArray());
return;
}
iMsg.handlerMsg(raw, mAdasListener);
} else {
callError(raw.getProtocolStatus(), raw.originalData.toByteArray());
}
}
} catch (Exception e) {
callError(ProtocolStatus.BUSINESS_DATA_PARSE_FAILED, raw.originalData.toByteArray());
CupidLogUtils.e(TAG, "原始数据:" + ByteUtil.byteArrToHex(raw.originalData.toByteArray()), e);
}
}
}
private void callError(ProtocolStatus status, byte[] bytes) {
@@ -475,32 +473,44 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
adasConnectStatusListener.onConnectionIPCStatus(ipcConnectionStatus.get(), reason);
}
if (status == Constants.IPC_CONNECTION_STATUS.CONNECTED) {
if (ADAS_CHANNEL_IS_USE_DISPATCH_HANDLER) {
if (dispatchHandler != null) {
dispatchHandler.start();
}
if (dispatchHandlerPointCloud != null) {
dispatchHandlerPointCloud.start();
}
}
startDispatchHandler();
startCheckCompatibility();
} else {
stopCheckCompatibility();
}
if (status == Constants.IPC_CONNECTION_STATUS.DISCONNECTED) {
AdasManager.getInstance().setCarConfig(null);
if (ADAS_CHANNEL_IS_USE_DISPATCH_HANDLER) {
if (dispatchHandler != null) {
dispatchHandler.stop();
}
if (dispatchHandlerPointCloud != null) {
dispatchHandlerPointCloud.stop();
}
}
stopDispatchHandler();
}
CupidLogUtils.i(TAG, "工控机连接状态 status=" + status + " reason=" + reason);
}
@Override
public void startDispatchHandler() {
if (dispatchHandler != null) {
dispatchHandler.start();
}
if (dispatchHandlerPointCloud != null) {
dispatchHandlerPointCloud.start();
}
if (dispatchHandlerParsePointCloud != null) {
dispatchHandlerParsePointCloud.start();
}
}
@Override
public void stopDispatchHandler() {
if (dispatchHandler != null) {
dispatchHandler.stop();
}
if (dispatchHandlerPointCloud != null) {
dispatchHandlerPointCloud.stop();
}
if (dispatchHandlerParsePointCloud != null) {
dispatchHandlerParsePointCloud.stop();
}
}
/**
* 检查兼容性
*/
@@ -794,12 +804,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
* @param arrowNo 当前车道对应地面要素转向
* @param flashYellow 黄灯总时间
* @param laneDetail 灯态具体信息
* @param timestamp 当前卫星时间, 单位: ms
* @return
*/
@Override
public boolean sendTrafficLightData(@NonNull String crossID, double latitude, double longitude,
@NonNull String heading, @NonNull String direction, int lightId, int laneNo,
int arrowNo, int flashYellow, MessagePad.TrafficLightDetail laneDetail) {
int arrowNo, int flashYellow, MessagePad.TrafficLightDetail laneDetail, long timestamp) {
if (crossID == null) {
crossID = "";
}
@@ -821,6 +832,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
builder.setFlashYellow(flashYellow);
if (laneDetail != null)
builder.setLaneDetail(laneDetail);
builder.setTimestamp(timestamp);
MessagePad.TrafficLightData req = builder.build();
return sendWsMessage(MessageType.TYPE_SEND_TRAFFIC_LIGHT_DATA.typeCode, req.toByteArray());
}
@@ -875,5 +887,21 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
.build();
return sendWsMessage(MessageType.TYPE_SEND_STATUS_QUERY_REQ.typeCode, req.toByteArray());
}
/**
* 设置雨天模式
*
* @param enable 1: enable, 0: disable
* @return boolean
*/
@Override
public boolean sendRainModeReq(int enable) {
MessagePad.SetRainModeReq req = MessagePad.SetRainModeReq
.newBuilder()
.setEnable(enable)
.build();
return sendWsMessage(MessageType.TYPE_SEND_SET_RAIN_MODE_REQ.typeCode, req.toByteArray());
}
}

View File

@@ -200,6 +200,20 @@ public class AdasManager implements IAdasNetCommApi {
}
}
@Override
public void startDispatchHandler() {
if (mChannel != null) {
mChannel.startDispatchHandler();
}
}
@Override
public void stopDispatchHandler() {
if (mChannel != null) {
mChannel.stopDispatchHandler();
}
}
/**
* 获取工控机链接配置
*
@@ -365,11 +379,12 @@ public class AdasManager implements IAdasNetCommApi {
* @param arrowNo 当前车道对应地面要素转向
* @param flashYellow 黄灯总时间
* @param laneDetail 灯态具体信息
* @param timestamp 当前卫星时间, 单位: ms
* @return
*/
@Override
public boolean sendTrafficLightData(@NonNull String crossID, double latitude, double longitude, @NonNull String heading, @NonNull String direction, int lightId, int laneNo, int arrowNo, int flashYellow, MessagePad.TrafficLightDetail laneDetail) {
return mChannel != null && mChannel.sendTrafficLightData(crossID, latitude, longitude, heading, direction, lightId, laneNo, arrowNo, flashYellow, laneDetail);
public boolean sendTrafficLightData(@NonNull String crossID, double latitude, double longitude, @NonNull String heading, @NonNull String direction, int lightId, int laneNo, int arrowNo, int flashYellow, MessagePad.TrafficLightDetail laneDetail, long timestamp) {
return mChannel != null && mChannel.sendTrafficLightData(crossID, latitude, longitude, heading, direction, lightId, laneNo, arrowNo, flashYellow, laneDetail, timestamp);
}
/**
@@ -416,6 +431,17 @@ public class AdasManager implements IAdasNetCommApi {
return mChannel != null && mChannel.sendStatusQueryReq();
}
/**
* 设置雨天模式
*
* @param enable 1: enable, 0: disable
* @return boolean
*/
@Override
public boolean sendRainModeReq(int enable) {
return mChannel != null && mChannel.sendRainModeReq(enable);
}
/**
* 获取工控机固定IP列表
*

View File

@@ -157,11 +157,12 @@ public interface IAdasNetCommApi {
* @param arrowNo 当前车道对应地面要素转向
* @param flashYellow 黄灯总时间
* @param laneDetail 灯态具体信息
* @param timestamp 当前卫星时间, 单位: ms
* @return boolean
*/
boolean sendTrafficLightData(@NonNull String crossID, double latitude, double longitude,
@NonNull String heading, @NonNull String direction, int lightId, int laneNo,
int arrowNo, int flashYellow, MessagePad.TrafficLightDetail laneDetail);
int arrowNo, int flashYellow, MessagePad.TrafficLightDetail laneDetail, long timestamp);
/**
* 自动驾驶路径请求
@@ -195,6 +196,13 @@ public interface IAdasNetCommApi {
*/
boolean sendStatusQueryReq();
/**
* 设置雨天模式
*
* @param enable 1: enable, 0: disable
* @return boolean
*/
boolean sendRainModeReq(int enable);
// TODO 需求暂停 待讨论
// boolean getRoutes();
@@ -206,6 +214,16 @@ public interface IAdasNetCommApi {
*/
void decoderRaw(byte[] bytes);
/**
* 启动分发线程
*/
void startDispatchHandler();
/**
* 停止分发线程
*/
void stopDispatchHandler();
/**
* Log是否开启打印
*/

Some files were not shown because too many files have changed in this diff Show More