From 5886f4feb7e89771bcabf92980b548cb23293e96 Mon Sep 17 00:00:00 2001 From: zhongchao Date: Fri, 11 Mar 2022 20:04:11 +0800 Subject: [PATCH] rebase --- .../bus/fragment/BaseOchBusTabFragment.java | 106 +++--- .../mogo/och/bus/fragment/OchBusFragment.java | 177 +++++---- .../och/bus/presenter/OchBusOrderModel.java | 359 +++++++++--------- .../och/bus/presenter/OchBusPresenter.java | 128 ++++--- .../IOCHTaxiAutopilotPlanningCallback.java | 5 +- .../passenger/model/MogoOCHTaxiModelNew.java | 112 +++--- .../passenger/presenter/OCHTaxiPresenter.java | 5 +- .../taxi/passenger/ui/OCHTaxiFragment.java | 5 +- .../IOCHTaxiAutopilotPlanningCallback.java | 5 +- .../och/taxi/model/MogoOCHTaxiModelNew.java | 125 +++--- .../och/taxi/presenter/OCHTaxiPresenter.java | 5 +- .../och/taxi/ui/BaseOchTaxiTabFragment.java | 63 ++- .../com/mogo/och/taxi/ui/OCHTaxiFragment.java | 11 +- .../functions/test/AutoPilotBadCaseTest.kt | 50 ++- app/src/main/AndroidManifest.xml | 1 + .../com/mogo/launcher/MogoApplication.java | 2 +- build.gradle | 2 +- .../autopilot/MoGoAutopilotProvider.kt | 59 ++- .../autopilot/adapter/MoGoAdasListenerImpl.kt | 310 +++++++++++++++ .../MoGoAdasMsgConnectStatusListenerImpl.kt | 24 +- .../adapter/MoGoHandAdasMsgManager.java | 59 ++- .../DevaToolsProvider.kt | 4 +- .../badcase/BadCaseManager.kt | 14 +- .../logcatch/MogoLogCatchManager.kt | 2 - .../dispatch/DispatchAutoPilotManager.java | 28 +- .../core/function/hmi/ui/MoGoHmiFragment.kt | 6 +- .../hmi/ui/setting/DebugSettingView.kt | 145 ++++--- .../hmi/ui/tools/AutoPilotAndCheckView.kt | 24 +- .../hmi/ui/widget/AutoPilotStatusView.kt | 5 - .../core/function/smp/SmallMapFragment.java | 60 ++- .../obu/mogo/MogoPrivateObuManager.kt | 2 - core/mogo-core-data/build.gradle | 26 +- .../data/autopilot/AutopilotStatusInfo.kt | 4 - .../core/data/deva/chain/ChainConstant.kt | 6 +- .../src/main/proto/message_pad.proto | 9 +- core/mogo-core-function-api/build.gradle | 1 - .../IMoGoAutopilotCarConfigListener.kt | 17 + .../IMoGoAutopilotCarStateListener.kt | 6 +- .../IMoGoAutopilotIdentifyListener.kt | 15 +- .../IMoGoAutopilotPlanningListener.kt | 6 +- .../api/autopilot/IMoGoAutopilotProvider.kt | 6 - .../autopilot/IMoGoAutopilotStatusListener.kt | 14 +- .../IMoGoAutopilotVehicleStateListener.kt | 21 + .../api/devatools/IDevaToolsProvider.kt | 4 +- .../call/autopilot/CallerAutoPilotManager.kt | 4 - .../CallerAutoPilotStatusListenerManager.kt | 18 +- ...CallerAutopilotCarConfigListenerManager.kt | 73 ++++ ...CallerAutopilotCarStatusListenerManager.kt | 10 +- .../CallerAutopilotIdentifyListenerManager.kt | 19 +- .../CallerAutopilotPlanningListenerManager.kt | 10 +- ...lerAutopilotVehicleStateListenerManager.kt | 85 +++++ .../call/devatools/CallerDevaToolsManager.kt | 3 +- .../mogo/map/impl/custom/AMapViewWrapper.java | 66 ++-- .../com/mogo/map/impl/custom/AMapWrapper.java | 6 +- .../custom/uicontroller/AMapUIController.java | 9 + .../map/impl/custom/utils/ObjectUtils.java | 12 +- libraries/mogo-adas-data/build.gradle | 63 +++ libraries/mogo-adas-data/gradle.properties | 3 + .../src/main/AndroidManifest.xml | 1 + libraries/mogo-adas/build.gradle | 12 +- .../zhidao/support/adas/high/AdasChannel.java | 64 ++-- .../support/adas/high/IAdasNetCommApi.java | 29 +- .../support/adas/high/chain/AdasChain.java | 15 + .../adas/high/common/CupidLogUtils.java | 13 - .../support/adas/high/socket/FpgaSocket.java | 15 +- .../src/main/java/com/mogo/map/IMogoMap.java | 4 +- .../mogo/map/marker/IMogoMarkerManager.java | 4 +- .../uicontroller/IMogoMapUIController.java | 6 + .../com/mogo/map/MogoMapUIController.java | 10 + .../java/com/mogo/map/MogoMarkerManager.java | 7 +- modules.txt | 1 + .../src/main/AndroidManifest.xml | 12 +- .../SnapshotLocationDataCenter.java | 52 ++- .../mogo/module/common/drawer/BaseDrawer.java | 6 +- .../common/drawer/IdentifyDataDrawer.java | 18 +- .../common/drawer/SnapshotSetDataDrawer.java | 16 +- .../service/intent/MockIntentHandler.java | 16 +- .../routeoverlay/MogoRouteOverlayManager.java | 48 +-- .../service/adas/IMogoADASController.java | 6 +- .../service/impl/adas/MogoADASController.java | 6 +- settings.gradle | 4 +- 81 files changed, 1689 insertions(+), 1095 deletions(-) create mode 100644 core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt create mode 100644 core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotCarConfigListener.kt create mode 100644 core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt create mode 100644 core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarConfigListenerManager.kt create mode 100644 core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt create mode 100644 libraries/mogo-adas-data/build.gradle create mode 100644 libraries/mogo-adas-data/gradle.properties create mode 100644 libraries/mogo-adas-data/src/main/AndroidManifest.xml create mode 100644 libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/chain/AdasChain.java diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BaseOchBusTabFragment.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BaseOchBusTabFragment.java index c881ebcc7d..60d9fa8eca 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BaseOchBusTabFragment.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/BaseOchBusTabFragment.java @@ -3,18 +3,15 @@ package com.mogo.och.bus.fragment; import android.animation.ObjectAnimator; import android.content.Intent; import android.graphics.Color; -import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.animation.LinearInterpolator; import android.widget.FrameLayout; import android.widget.ImageView; -import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; -import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.constraintlayout.widget.Group; @@ -24,10 +21,7 @@ import com.mogo.commons.mvp.IView; import com.mogo.commons.mvp.MvpFragment; import com.mogo.commons.mvp.Presenter; import com.mogo.commons.voice.AIAssist; -import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult; -import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage; import com.mogo.eagle.core.data.config.HmiBuildConfig; -import com.mogo.eagle.core.data.traffic.TrafficData; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener; import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager; @@ -45,7 +39,8 @@ import com.mogo.och.bus.R; import com.mogo.och.bus.view.BusArcView; import com.mogo.och.bus.view.SlidePanelView; -import java.util.ArrayList; +import mogo.telematics.pad.MessagePad; +import record_cache.RecordPanelOuterClass; /** * 网约车基础Fragment,主要负责布局通用界面,处理站点面板和通话面板互斥情况 @@ -65,7 +60,7 @@ public abstract class BaseOchBusTabFragment { - Log.d(TAG,"长按显示状态工具栏"); + Log.d(TAG, "长按显示状态工具栏"); Intent intent = new Intent(); intent.putExtra("oper", 52); MogoApisHandler.getInstance().getApis().getIntentManagerApi().invoke("com.mogo.mock", intent); @@ -168,13 +163,13 @@ public abstract class BaseOchBusTabFragment // MogoApisHandler.getInstance().getApis() // .getAdasControllerApi() // .mockOchStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE, "不能使用") - debugAutoPilotStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) + debugAutoPilotStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) ); // 模拟 可自动驾驶,工控机连接正常,且处于人工干预状态 @@ -182,7 +177,7 @@ public abstract class BaseOchBusTabFragment // MogoApisHandler.getInstance().getApis() // .getAdasControllerApi().mockOchStatus(-1, "Arrived") - debugArrivedStation() + debugArrivedStation() ); tvOperationStatus.setOnClickListener(view -> { onChangeOperationStatus(); }); - + mSettingBtn = findViewById(R.id.module_mogo_och_setting_layout); mSettingBtn.setOnClickListener(v -> { // TODO: 2021/12/9 @@ -239,17 +234,15 @@ public abstract class BaseOchBusTabFragment trafficData) { } - - @Override - public void onAutopilotWarnMessage(@Nullable AutopilotWarnMessage autopilotWarnMessage) { } + public void onAutopilotWarnMessage(MessagePad.Warn warn) { + } /** * 测试到站 @@ -295,20 +288,21 @@ public abstract class BaseOchBusTabFragment { // ctvAutopilotStatus.setChecked(isInAutopilot); - changeAutopilotBtnView(autopilotStatus,isAnimateRunning); + changeAutopilotBtnView(autopilotStatus, isAnimateRunning); }); } - private void changeAutopilotBtnView(int autopilotStatus,boolean isAnimateRunning) { - Logger.d( TAG, "onStateChangeChangeAutopilotBtnView: " + autopilotStatus +"isAnimateRunning = "+isAnimateRunning); + private void changeAutopilotBtnView(int autopilotStatus, boolean isAnimateRunning) { + Logger.d(TAG, "onStateChangeChangeAutopilotBtnView: " + autopilotStatus + "isAnimateRunning = " + isAnimateRunning); if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE == autopilotStatus) {//0不可用 - if (isAnimateRunning){ + if (isAnimateRunning) { stopAutopilotAnimation(); ctvAutopilotStatusIv.setImageResource(R.drawable.bus_wrong_autopilot_icon); ctvAutopilotStatusTv.setTextColor(getResources().getColor(R.color.bus_autopilot_text_color_normal)); @@ -326,11 +320,11 @@ public abstract class BaseOchBusTabFragment{ + public void hidPanel() { + getActivity().runOnUiThread(() -> { flStationPanelContainer.setVisibility(View.GONE); }); } - public void showPanel(){ - getActivity().runOnUiThread(()->{ + public void showPanel() { + getActivity().runOnUiThread(() -> { flStationPanelContainer.setVisibility(View.VISIBLE); }); } @@ -421,6 +415,7 @@ public abstract class BaseOchBusTabFragment 60 ? "#DB3137" : "#3E77F6")); mouduleArc.setValues(speed); @@ -487,7 +483,7 @@ public abstract class BaseOchBusTabFragment +public class OchBusFragment extends BaseOchBusTabFragment implements SlidePanelView.OnSlidePanelMoveToEndListener, View.OnClickListener { private static final String TAG = "OchBusFragment"; @@ -44,7 +45,7 @@ public class OchBusFragment extends BaseOchBusTabFragment< OchBusFragment, OchBu private TextView mStartStationFlag; private TextView mNextStationName; private TextView mEndStationFlag; -// private TextView mDebugArrive; + // private TextView mDebugArrive; private TextView mSwitchLine; //切换路线 private int mCurrentStation = 0; @@ -61,24 +62,24 @@ public class OchBusFragment extends BaseOchBusTabFragment< OchBusFragment, OchBu @Override protected void initViews() { super.initViews(); - mBus = findViewById( R.id.module_och_bus_tag ); - mCurrentStationName = findViewById( R.id.module_och_bus_current_station ); - mStartStationFlag = findViewById( R.id.module_och_bus_start_station_tag ); - mNextStationName = findViewById( R.id.module_och_bus_order_end_station ); - mEndStationFlag = findViewById( R.id.module_och_bus_end_station_tag ); + mBus = findViewById(R.id.module_och_bus_tag); + mCurrentStationName = findViewById(R.id.module_och_bus_current_station); + mStartStationFlag = findViewById(R.id.module_och_bus_start_station_tag); + mNextStationName = findViewById(R.id.module_och_bus_order_end_station); + mEndStationFlag = findViewById(R.id.module_och_bus_end_station_tag); mSwitchLine = findViewById(R.id.switch_line_btn); // mDebugArrive = findViewById(R.id.module_och_bus_arrive_station); - if ( DebugConfig.isDebug() ) { - mBus.setOnClickListener( view -> { - TipToast.shortTip( "重置了车站状态" ); + if (DebugConfig.isDebug()) { + mBus.setOnClickListener(view -> { + TipToast.shortTip("重置了车站状态"); mPresenter.queryBusRoutes(); - } ); + }); - mBus.setOnLongClickListener( view -> { + mBus.setOnLongClickListener(view -> { getActivity().finish(); return true; - } ); + }); //debug下调用测试面板 mCurrentStationName.setOnLongClickListener(v -> { debugTestBar(); @@ -86,19 +87,19 @@ public class OchBusFragment extends BaseOchBusTabFragment< OchBusFragment, OchBu }); } - Logger.d( TAG, "initView: " + CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState()); + Logger.d(TAG, "initView: " + CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState()); // 初始化的时候设置 UI 按钮状态 - switch ( CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState() ) { + switch (CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState()) { case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE: hideAutopilotBiz(); break; case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE: showAutopilotBiz(); - onAutopilotStatusChanged( IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE ,false); + onAutopilotStatusChanged(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE, false); break; case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING: showAutopilotBiz(); - onAutopilotStatusChanged( IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING ,false); + onAutopilotStatusChanged(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING, false); break; default: break; @@ -114,7 +115,7 @@ public class OchBusFragment extends BaseOchBusTabFragment< OchBusFragment, OchBu @NonNull @Override protected OchBusPresenter createPresenter() { - return new OchBusPresenter( this ); + return new OchBusPresenter(this); } @Override @@ -128,30 +129,30 @@ public class OchBusFragment extends BaseOchBusTabFragment< OchBusFragment, OchBu * @param stationList 车站列表信息 * @param currentStation 当前站点 * @param nextStation 下个站点 - * @param isArrived 是否都站 + * @param isArrived 是否都站 */ - public void refreshBusStations( List< OchBusStation > stationList, int currentStation, int nextStation ,boolean isArrived) { + public void refreshBusStations(List stationList, int currentStation, int nextStation, boolean isArrived) { mCurrentStation = currentStation; - if ( getActivity() == null ) { + if (getActivity() == null) { return; } - getActivity().runOnUiThread( () -> { - if ( stationList == null ) { + getActivity().runOnUiThread(() -> { + if (stationList == null) { // 获取小巴数据失败 return; } // 渲染小巴路线数据 - renderCurrentStationStatus( stationList, currentStation, nextStation ,isArrived); - } ); + renderCurrentStationStatus(stationList, currentStation, nextStation, isArrived); + }); } /** * 重新刷新站点信息 isArrived 是否到站 */ - private void renderCurrentStationStatus( List< OchBusStation > stationList, int currentStation - , int nextStation ,boolean isArrived) { - Log.d("MapMaker= ","currentStation="+currentStation+",nextStation="+nextStation+"isArrived="+isArrived); + private void renderCurrentStationStatus(List stationList, int currentStation + , int nextStation, boolean isArrived) { + Log.d("MapMaker= ", "currentStation=" + currentStation + ",nextStation=" + nextStation + "isArrived=" + isArrived); String currentStationName = null; String nextStationName = null; int startStationFlagVisibility = View.INVISIBLE; @@ -162,70 +163,70 @@ public class OchBusFragment extends BaseOchBusTabFragment< OchBusFragment, OchBu boolean isArriveAtStartStation = false; // 获取当前站点的名称 - currentStationName = stationList.get( currentStation ).getName(); + currentStationName = stationList.get(currentStation).getName(); startStation = stationList.get(0); endStation = stationList.get(stationList.size() - 1); // 是否到达起点 - if ( currentStation == 0 ) { + if (currentStation == 0) { startStationFlagVisibility = View.VISIBLE; isArriveAtStartStation = true; mStartStationFlag.setText(getResources().getString(R.string.bus_arrive_to_end_start)); // Log.d("MapMaker= ","起点="); - setOrRemoveMapMaker(true, OchBusConst.BUS_START_MAP_MAKER,startStation.getLat() - ,startStation.getLon(),R.drawable.icon_station_start_end); - setOrRemoveMapMaker(true, OchBusConst.BUS_END_MAP_MAKER,endStation.getLat() - ,endStation.getLon(),R.drawable.icon_station_start_end); - } else if ( currentStation > 0 && currentStation < stationList.size() - 1 ) {// 是否到达站点 + setOrRemoveMapMaker(true, OchBusConst.BUS_START_MAP_MAKER, startStation.getLat() + , startStation.getLon(), R.drawable.icon_station_start_end); + setOrRemoveMapMaker(true, OchBusConst.BUS_END_MAP_MAKER, endStation.getLat() + , endStation.getLon(), R.drawable.icon_station_start_end); + } else if (currentStation > 0 && currentStation < stationList.size() - 1) {// 是否到达站点 // Log.d("MapMaker= ","中间="); isArriveAtStation = true; // mStartStationFlag.setText(getResources().getString(R.string.bus_arrive_to_end_start1)); - setOrRemoveMapMaker(false, OchBusConst.BUS_START_MAP_MAKER,startStation.getLat() - ,startStation.getLon(),R.drawable.icon_station_start_end); - setOrRemoveMapMaker(true, OchBusConst.BUS_END_MAP_MAKER,endStation.getLat() - ,endStation.getLon(),R.drawable.icon_station_start_end); - } else if ( currentStation == stationList.size() - 1 ) {// 是否到达终点 + setOrRemoveMapMaker(false, OchBusConst.BUS_START_MAP_MAKER, startStation.getLat() + , startStation.getLon(), R.drawable.icon_station_start_end); + setOrRemoveMapMaker(true, OchBusConst.BUS_END_MAP_MAKER, endStation.getLat() + , endStation.getLon(), R.drawable.icon_station_start_end); + } else if (currentStation == stationList.size() - 1) {// 是否到达终点 // Log.d("MapMaker= ","终点="); isArriveEndStation = true; nextStationName = "--"; mStartStationFlag.setText(getResources().getString(R.string.bus_arrive_to_end_end)); startStationFlagVisibility = View.VISIBLE; endStationFlagVisibility = View.INVISIBLE; - setOrRemoveMapMaker(false, OchBusConst.BUS_START_MAP_MAKER,startStation.getLat() - ,startStation.getLon(),R.drawable.icon_station_start_end); - if (isArrived){ - setOrRemoveMapMaker(false, OchBusConst.BUS_END_MAP_MAKER,endStation.getLat() - ,endStation.getLon(),R.drawable.icon_station_start_end); - }else { - setOrRemoveMapMaker(true, OchBusConst.BUS_END_MAP_MAKER,endStation.getLat() - ,endStation.getLon(),R.drawable.icon_station_start_end); + setOrRemoveMapMaker(false, OchBusConst.BUS_START_MAP_MAKER, startStation.getLat() + , startStation.getLon(), R.drawable.icon_station_start_end); + if (isArrived) { + setOrRemoveMapMaker(false, OchBusConst.BUS_END_MAP_MAKER, endStation.getLat() + , endStation.getLon(), R.drawable.icon_station_start_end); + } else { + setOrRemoveMapMaker(true, OchBusConst.BUS_END_MAP_MAKER, endStation.getLat() + , endStation.getLon(), R.drawable.icon_station_start_end); } } // 获取下一站点名称 - if ( nextStation > currentStation && nextStation <= stationList.size() - 1 ) { - nextStationName = stationList.get( nextStation ).getName(); + if (nextStation > currentStation && nextStation <= stationList.size() - 1) { + nextStationName = stationList.get(nextStation).getName(); } // 是否到达终点 - if ( nextStation == stationList.size() - 1 ) { + if (nextStation == stationList.size() - 1) { endStationFlagVisibility = View.VISIBLE; } // 重置滑动按钮文字 - if ( isArriveEndStation ) { - showSlidePanle( "单程结束" ); - } else if ( isArriveAtStartStation ) { - showSlidePanle( "滑动出发" ); - } else if ( isArriveAtStation ) { - showSlidePanle( "滑动出发" ); + if (isArriveEndStation) { + showSlidePanle("单程结束"); + } else if (isArriveAtStartStation) { + showSlidePanle("滑动出发"); + } else if (isArriveAtStation) { + showSlidePanle("滑动出发"); } - mCurrentStationName.setText( currentStationName ); - mNextStationName.setText( nextStationName ); - mStartStationFlag.setVisibility( startStationFlagVisibility ); - mEndStationFlag.setVisibility( endStationFlagVisibility ); + mCurrentStationName.setText(currentStationName); + mNextStationName.setText(nextStationName); + mStartStationFlag.setVisibility(startStationFlagVisibility); + mEndStationFlag.setVisibility(endStationFlagVisibility); } public void hideOchBus() { @@ -256,8 +257,8 @@ public class OchBusFragment extends BaseOchBusTabFragment< OchBusFragment, OchBu /** * 设置自动驾驶可用状态 */ - public void onAutopilotEnableChange( boolean isEnable ) { - if ( isEnable ) { + public void onAutopilotEnableChange(boolean isEnable) { + if (isEnable) { showAutopilotBiz(); } else { hideAutopilotBiz(); @@ -272,14 +273,15 @@ public class OchBusFragment extends BaseOchBusTabFragment< OchBusFragment, OchBu /** * 修改经营状态 + * * @param launch true-收车,false-出车 */ - public void changeOperationStatus( boolean launch ) { + public void changeOperationStatus(boolean launch) { isOperationStatus = launch; - if ( launch ) { + if (launch) { // 出车的时候重制站点状态 mPresenter.queryBusRoutes(); - tvOperationStatus.setText( "收车" ); + tvOperationStatus.setText("收车"); showSlidePanle("滑动出发"); showPanel(); } else { @@ -289,19 +291,20 @@ public class OchBusFragment extends BaseOchBusTabFragment< OchBusFragment, OchBu hidPanel(); //移除起点终点 - if (null != startStation){ - setOrRemoveMapMaker(false, OchBusConst.BUS_START_MAP_MAKER,startStation.getLat() - ,startStation.getLon(),R.drawable.icon_station_start_end); + if (null != startStation) { + setOrRemoveMapMaker(false, OchBusConst.BUS_START_MAP_MAKER, startStation.getLat() + , startStation.getLon(), R.drawable.icon_station_start_end); } - if (null != endStation){ - setOrRemoveMapMaker(false, OchBusConst.BUS_END_MAP_MAKER,endStation.getLat() - ,endStation.getLon(),R.drawable.icon_station_start_end); + if (null != endStation) { + setOrRemoveMapMaker(false, OchBusConst.BUS_END_MAP_MAKER, endStation.getLat() + , endStation.getLon(), R.drawable.icon_station_start_end); } } } /** * VR模式切换 + * * @param isVRMode */ public void onVRModeChanged(boolean isVRMode) { @@ -312,13 +315,14 @@ public class OchBusFragment extends BaseOchBusTabFragment< OchBusFragment, OchBu /** * 绘制地图起点终点 + * * @param isAdd * @param uuid * @param iconId */ - private void setOrRemoveMapMaker(boolean isAdd, String uuid,double lat,double longi, int iconId){ - if (isAdd){ - Log.d("setMapMaker= ",uuid+"=latitude="+lat+",longitude="+longi); + private void setOrRemoveMapMaker(boolean isAdd, String uuid, double lat, double longi, int iconId) { + if (isAdd) { + Log.d("setMapMaker= ", uuid + "=latitude=" + lat + ",longitude=" + longi); MogoMarkerOptions options = new MogoMarkerOptions(); options.anchorColor("#000000");//不设置报错,暂时随便设置个 options.setGps(true);//使用wgs 必须设置true @@ -329,27 +333,27 @@ public class OchBusFragment extends BaseOchBusTabFragment< OchBusFragment, OchBu options.longitude(longi); MogoApisHandler.getInstance().getApis().getMapServiceApi() .getMarkerManager(AbsMogoApplication.getApp()).addMarker(uuid, options); - }else { - Log.d("RemoveMapMaker=",uuid+"=latitude="+lat+",longitude="+longi); + } else { + Log.d("RemoveMapMaker=", uuid + "=latitude=" + lat + ",longitude=" + longi); MogoApisHandler.getInstance().getApis().getMapServiceApi() .getMarkerManager(AbsMogoApplication.getApp()).removeMarkers(uuid); } } - public void debugAutoPilotStatus(int status){ + public void debugAutoPilotStatus(int status) { mPresenter.debugAutoPilotStatus(status); } @Override public void onClick(View v) { - if (v.getId() == R.id.switch_line_btn ){//切换路线条件: 自动驾驶过程中,点击则toast提示:自动驾驶中,不可切换路线 + if (v.getId() == R.id.switch_line_btn) {//切换路线条件: 自动驾驶过程中,点击则toast提示:自动驾驶中,不可切换路线 //本次行程未结束,不支持切换路线。点击则toast提示:当前行程未完成,不可切换路线 if (CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState() - == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){ + == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) { TipToast.longTip(getResources().getString(R.string.bus_switch_line_btn_warning1)); return; } - if (mCurrentStation > 0){ + if (mCurrentStation > 0) { TipToast.longTip(getResources().getString(R.string.bus_switch_line_btn_warning2)); return; } @@ -357,4 +361,9 @@ public class OchBusFragment extends BaseOchBusTabFragment< OchBusFragment, OchBu startActivity(intent); } } + + @Override + public void onAutopilotIdentifyDataUpdate(@Nullable ArrayList trafficData) { + + } } diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/OchBusOrderModel.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/OchBusOrderModel.java index 3fb034c010..62659a6cf7 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/OchBusOrderModel.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/OchBusOrderModel.java @@ -57,11 +57,12 @@ import io.reactivex.exceptions.UndeliverableException; import io.reactivex.functions.Consumer; import io.reactivex.plugins.RxJavaPlugins; import io.reactivex.schedulers.Schedulers; +import mogo.telematics.pad.MessagePad; /** * @author congtaowang * @since 2021/3/23 - * + *

* 小巴订单管理 */ public class OchBusOrderModel { @@ -79,7 +80,7 @@ public class OchBusOrderModel { private Context mContext; private Disposable mBusOrdersDisposable; //定时轮询小巴车订单 private List prevBusOrderIds = new ArrayList<>(); - private final List< OchBusStation > stationList = new ArrayList<>(); + private final List stationList = new ArrayList<>(); private OchBusRoutesResult ochBusRoutesResult = null; /** * 用来表示是否正在开往下一站 @@ -100,7 +101,7 @@ public class OchBusOrderModel { private final Handler handler = new Handler(new Handler.Callback() { @Override public boolean handleMessage(Message msg) { - if ( msg.what == MSG_QUERY_BUS_STATION ) { + if (msg.what == MSG_QUERY_BUS_STATION) { OchBusOrderModel.getInstance().queryBusRoutes(); return true; } @@ -109,9 +110,9 @@ public class OchBusOrderModel { }); public static OchBusOrderModel getInstance() { - if ( sInstance == null ) { - synchronized ( OchBusOrderModel.class ) { - if ( sInstance == null ) { + if (sInstance == null) { + synchronized (OchBusOrderModel.class) { + if (sInstance == null) { sInstance = new OchBusOrderModel(); } } @@ -135,7 +136,7 @@ public class OchBusOrderModel { MogoApisHandler.getInstance() .getApis() .getStatusManagerApi() - .registerStatusChangedListener( TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener ); + .registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener); } //2022.1.28 @@ -147,31 +148,31 @@ public class OchBusOrderModel { public void accept(Throwable e) { if (e instanceof UndeliverableException) { e = e.getCause(); - Log.d(TAG,"UndeliverableException"); + Log.d(TAG, "UndeliverableException"); } if ((e instanceof IOException)) {// // fine, irrelevant network problem or API that throws on cancellation - Log.d(TAG,"IOException"); + Log.d(TAG, "IOException"); return; } if (e instanceof InterruptedException) { // fine, some blocking code was interrupted by a dispose call - Log.d(TAG,"InterruptedException"); + Log.d(TAG, "InterruptedException"); return; } if ((e instanceof NullPointerException) || (e instanceof IllegalArgumentException)) { // that's likely a bug in the application - Log.d(TAG,"NullPointerException or IllegalArgumentException"); + Log.d(TAG, "NullPointerException or IllegalArgumentException"); Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e); return; } if (e instanceof IllegalStateException) { // that's a bug in RxJava or in a custom operator - Log.d(TAG,"IllegalStateException"); + Log.d(TAG, "IllegalStateException"); Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e); return; } - Log.d(TAG,"Undeliverable exception"); + Log.d(TAG, "Undeliverable exception"); } }); @@ -179,15 +180,15 @@ public class OchBusOrderModel { startLoopBusOrders(); } - public void setCarOperationStatusCallback(CarOperationStatusCallback callback){ + public void setCarOperationStatusCallback(CarOperationStatusCallback callback) { this.carOperationStatusCallback = callback; } - public void setRefreshBusStationsCallback(RefreshBusStationsCallback callback){ + public void setRefreshBusStationsCallback(RefreshBusStationsCallback callback) { this.refreshBusStationsCallback = callback; } - public void setSlidePannelHideCallback(SlidePannelHideCallback callback){ + public void setSlidePannelHideCallback(SlidePannelHideCallback callback) { this.slidePannelHideCallback = callback; } @@ -215,7 +216,7 @@ public class OchBusOrderModel { @Override public void onSuccess(OchBusOrdersResponse o) { if (o.data != null && o.data.orders != null && o.data.orders.size() > 0) { - Logger.d( TAG, "获取到bus订单数据: " + o.data.orders.toString() ); + Logger.d(TAG, "获取到bus订单数据: " + o.data.orders.toString()); List busOrders = o.data.orders; for (int i = 0; i < busOrders.size(); i++) { OchBusOrder order = busOrders.get(i); @@ -248,7 +249,7 @@ public class OchBusOrderModel { }); } - public void release(){ + public void release() { if (mBusOrdersDisposable != null) { mBusOrdersDisposable.dispose(); } @@ -286,7 +287,7 @@ public class OchBusOrderModel { private IMogoCarLocationChangedListener2 mCarLocationChangedListener2 = new IMogoCarLocationChangedListener2() { @Override - public void onCarLocationChanged2( Location location ) { + public void onCarLocationChanged2(Location location) { // Log.d(TAG,"location = "+location.getLongitude()+","+location.getLatitude()); IMogoServiceApis apis = MogoApisHandler.getInstance().getApis(); MogoLocation mogoLocation = new MogoLocation(); @@ -319,19 +320,20 @@ public class OchBusOrderModel { * 查询小巴路线 */ public void queryBusRoutes() { - Logger.d( TAG, "查询小巴路线"); + Logger.d(TAG, "查询小巴路线"); OCHBusServiceManager.getInstance().queryBusRoutes(mContext, new OCHServiceCallback() { @Override public void onSuccess(OchBusRoutesResponse data) { - if ( data == null + if (data == null || data.getResult() == null || data.getResult().getSites() == null - || data.getResult().getSites().isEmpty() ) { + || data.getResult().getSites().isEmpty()) { return; } - Logger.d( TAG, "获取到小巴路线数据: " + data ); - renderBusStationsStatus( data.getResult()); + Logger.d(TAG, "获取到小巴路线数据: " + data); + renderBusStationsStatus(data.getResult()); } + @Override public void onFail(String failMsg) { // 重复请求小巴路线,直至成功 @@ -345,60 +347,61 @@ public class OchBusOrderModel { * 测试、重置站点状态 */ public void debugResetStationStatus() { - Logger.d( TAG, "测试、重置站点状态"); + Logger.d(TAG, "测试、重置站点状态"); OCHBusServiceManager.getInstance().resetStationStatus(mContext, currentLineId , new OCHServiceCallback() { - @Override - public void onSuccess(OchBusRoutesResponse o) { - Logger.d(TAG, "获取到小巴路线数据: " + o); - isGoingToNextStation = false; - if (o.getResult() == null || o.getResult().getSites() == null || o.getResult().getSites().isEmpty()) { - return; - } - renderBusStationsStatus(o.getResult()); - } + @Override + public void onSuccess(OchBusRoutesResponse o) { + Logger.d(TAG, "获取到小巴路线数据: " + o); + isGoingToNextStation = false; + if (o.getResult() == null || o.getResult().getSites() == null || o.getResult().getSites().isEmpty()) { + return; + } + renderBusStationsStatus(o.getResult()); + } - @Override - public void onFail(String failMsg) { - // 重复请求小巴路线,直至成功 - queryBusStationDelay(); - } - }); + @Override + public void onFail(String failMsg) { + // 重复请求小巴路线,直至成功 + queryBusStationDelay(); + } + }); } /** * 离站上报 */ - public void leaveStation(boolean isOneWayOver,boolean isRestart){ - Log.d(TAG,"leaveStation-backgroundCurrentStationIndex = "+backgroundCurrentStationIndex); + public void leaveStation(boolean isOneWayOver, boolean isRestart) { + Log.d(TAG, "leaveStation-backgroundCurrentStationIndex = " + backgroundCurrentStationIndex); OCHBusServiceManager.getInstance().leaveStation(mContext, stationList.get(backgroundCurrentStationIndex).getSeq() , stationList.get(backgroundCurrentStationIndex).getSiteId(), new OCHServiceCallback() { - @Override - public void onSuccess(OchBusRoutesResponse o) { - if ( o.getResult() == null || o.getResult().getSites() == null || o.getResult().getSites().isEmpty() ) { - return; - } - if (!isOneWayOver){ - Logger.d( TAG, "自动驾驶开启开往下一站====" ); - //需要更改当前站和下一站的状态 然后渲染 - RenderLeaveStationSuccess(o.getResult(),isRestart); - }else { - Logger.d( TAG, "单程真的结束了====" ); - isGoingToNextStation = false; - currentStationIndex = 0; - backgroundCurrentStationIndex = 0; - CallerAutoPilotManager.INSTANCE.cancelAutoPilot(); - queryBusRoutes(); - } - } - @Override - public void onFail(String failMsg) { - if (!NetworkUtils.isConnected(mContext)) { - TipToast.shortTip("网络异常,请稍后重试"); - } - } - }); + @Override + public void onSuccess(OchBusRoutesResponse o) { + if (o.getResult() == null || o.getResult().getSites() == null || o.getResult().getSites().isEmpty()) { + return; + } + if (!isOneWayOver) { + Logger.d(TAG, "自动驾驶开启开往下一站===="); + //需要更改当前站和下一站的状态 然后渲染 + RenderLeaveStationSuccess(o.getResult(), isRestart); + } else { + Logger.d(TAG, "单程真的结束了===="); + isGoingToNextStation = false; + currentStationIndex = 0; + backgroundCurrentStationIndex = 0; + CallerAutoPilotManager.INSTANCE.cancelAutoPilot(); + queryBusRoutes(); + } + } + + @Override + public void onFail(String failMsg) { + if (!NetworkUtils.isConnected(mContext)) { + TipToast.shortTip("网络异常,请稍后重试"); + } + } + }); } /** @@ -406,7 +409,7 @@ public class OchBusOrderModel { * 服务端返回的OchBusRoutesResult逻辑, 离开站为当前站, 到达下一站后才会将下一站置为当前站, * 车机端展示是离开当前站,下一站设置为当前站, 所以服务端数据回来要做处理,不能直接渲染 */ - private void RenderLeaveStationSuccess(OchBusRoutesResult result,boolean isRestart) { + private void RenderLeaveStationSuccess(OchBusRoutesResult result, boolean isRestart) { renderBusStationsStatus(result); if (slidePannelHideCallback != null) { slidePannelHideCallback.hideSlidePanel(); @@ -418,16 +421,17 @@ public class OchBusOrderModel { return; } isGoingToNextStation = true; - AIAssist.getInstance( mContext ).speakTTSVoice( "欢迎乘坐’蘑菇车联‘无人驾驶小巴车,请您坐好,注意乘车安全,行程即将开始" ); + AIAssist.getInstance(mContext).speakTTSVoice("欢迎乘坐’蘑菇车联‘无人驾驶小巴车,请您坐好,注意乘车安全,行程即将开始"); } /** * 开启自动驾驶 + * * @param isRestart */ private void startAutopilot(boolean isRestart) { - OchBusStation currentStation = stationList.get( currentStationIndex -1); - OchBusStation nextStation = stationList.get( currentStationIndex); + OchBusStation currentStation = stationList.get(currentStationIndex - 1); + OchBusStation nextStation = stationList.get(currentStationIndex); // if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE // == Integer.parseInt(DebugConfig.getAutoPilotStatus())) { @@ -438,12 +442,12 @@ public class OchBusOrderModel { currentAutopilot.startName = PinYinUtil.getPinYinHeadChar(currentStation.getName()); currentAutopilot.endName = PinYinUtil.getPinYinHeadChar(nextStation.getName()); currentAutopilot.startLatLon = new AutopilotControlParameters - .AutoPilotLonLat( currentStation.getLat(), currentStation.getLon() ); + .AutoPilotLonLat(currentStation.getLat(), currentStation.getLon()); currentAutopilot.endLatLon = new AutopilotControlParameters - .AutoPilotLonLat( nextStation.getLat(), nextStation.getLon() ); + .AutoPilotLonLat(nextStation.getLat(), nextStation.getLon()); currentAutopilot.vehicleType = VEHICLE_TYPE; - Logger.d( TAG, "开启自动驾驶====" + currentAutopilot.toString() - +" startLatLon="+currentStation.getName()+",endLatLon="+nextStation.getName()); + Logger.d(TAG, "开启自动驾驶====" + currentAutopilot.toString() + + " startLatLon=" + currentStation.getName() + ",endLatLon=" + nextStation.getName()); CallerAutoPilotManager.INSTANCE.startAutoPilot(currentAutopilot); if (mControllerStatusCallback != null) { mControllerStatusCallback.startOpenAutopilot(); @@ -454,14 +458,14 @@ public class OchBusOrderModel { * 到站后重置站点状态 */ private void arriveSiteStation(boolean isRestart) { - Log.d(TAG,"arriveSiteStation-currentStationIndex = "+currentStationIndex); + Log.d(TAG, "arriveSiteStation-currentStationIndex = " + currentStationIndex); OCHBusServiceManager.getInstance().arriveSiteStation(mContext , stationList.get(currentStationIndex).getSeq(), stationList.get(currentStationIndex).getSiteId() , new OCHServiceCallback() { @Override public void onSuccess(BaseData o) { - Log.d(TAG,"arriveSiteStation success"); - if (!isRestart){ + Log.d(TAG, "arriveSiteStation success"); + if (!isRestart) { renderArriveBusStation(); } } @@ -476,12 +480,12 @@ public class OchBusOrderModel { } private void renderArriveBusStation() { - List< OchBusStation > site = ochBusRoutesResult.getSites(); - if (site != null && site.size() > 0){ + List site = ochBusRoutesResult.getSites(); + if (site != null && site.size() > 0) { backgroundCurrentStationIndex = currentStationIndex; - if (refreshBusStationsCallback != null){ + if (refreshBusStationsCallback != null) { refreshBusStationsCallback.refreshBusStations(stationList, currentStationIndex - , getNextStopStation(),true); + , getNextStopStation(), true); } } } @@ -490,7 +494,7 @@ public class OchBusOrderModel { * 查询到站下车乘客 */ private void queryStationLeaveAwayPassengers() { - Logger.d( TAG, "查询到站下车乘客"); + Logger.d(TAG, "查询到站下车乘客"); OCHBusServiceManager.getInstance().queryStationLeaveAwayPassengers(mContext , stationList.get(currentStationIndex).getSeq(), stationList.get(currentStationIndex).getSiteId() @@ -499,7 +503,7 @@ public class OchBusOrderModel { public void onSuccess(QueryLeaveAwayPassengersResponse o) { hadQueryLeaveAwayPassager = true; arriveSiteStation(false); - playLeavePassengersMsg( o ); + playLeavePassengersMsg(o); queryBusOrders(); } @@ -514,7 +518,7 @@ public class OchBusOrderModel { /** * 收车 */ - public void stopTakeOrder(){ + public void stopTakeOrder() { OCHBusServiceManager.getInstance().stopTakeOrder(mContext, new OCHServiceCallback() { @Override public void onSuccess(BaseData o) { @@ -522,11 +526,12 @@ public class OchBusOrderModel { carOperationStatusCallback.changeOperationStatus(isWorking()); startOrStopOrderLoop(mIsWorking); } + @Override public void onFail(String failMsg) { if (!NetworkUtils.isConnected(mContext)) { TipToast.shortTip("网络异常,请稍后重试"); - }else { + } else { TipToast.shortTip(failMsg); } } @@ -536,24 +541,25 @@ public class OchBusOrderModel { /** * 出车 */ - public void startTakeOrder(){ + public void startTakeOrder() { OCHBusServiceManager.getInstance().startTakeOrder(mContext, new OCHServiceCallback() { @Override public void onSuccess(BaseData o) { mIsWorking = !mIsWorking; startOrStopOrderLoop(mIsWorking); - if ( stationList != null && stationList.size() > 0 ) { - AIAssist.getInstance( mContext ).speakTTSVoice( "车辆已整备完毕,请前往" - + stationList.get( currentStationIndex ).getName() + "站点" ); + if (stationList != null && stationList.size() > 0) { + AIAssist.getInstance(mContext).speakTTSVoice("车辆已整备完毕,请前往" + + stationList.get(currentStationIndex).getName() + "站点"); } carOperationStatusCallback.changeOperationStatus(isWorking()); queryBusRoutes(); } + @Override public void onFail(String failMsg) { if (!NetworkUtils.isConnected(mContext)) { TipToast.shortTip("网络异常,请稍后重试"); - }else { + } else { TipToast.shortTip(failMsg); } } @@ -564,91 +570,93 @@ public class OchBusOrderModel { * 查询运营状态 */ public void queryOperationStatus() { - Logger.d( TAG, "查询运营状态"); + Logger.d(TAG, "查询运营状态"); OCHBusServiceManager.getInstance().queryOperationStatus(mContext , new OCHServiceCallback() { - @Override - public void onSuccess(OchBusOperationStatusResponse o) { - if ( o.data != null ) { - mIsWorking = o.data.serviceStatus == 1; - Logger.d( TAG, "查询运营状态 result.status: " + o.data.serviceStatus); - startOrStopOrderLoop(mIsWorking); - } - carOperationStatusCallback.changeOperationStatus(isWorking()); - } - @Override - public void onFail(String failMsg) { - if (!NetworkUtils.isConnected(mContext)) { - TipToast.shortTip("网络异常,请稍后重试"); - } - } - }); + @Override + public void onSuccess(OchBusOperationStatusResponse o) { + if (o.data != null) { + mIsWorking = o.data.serviceStatus == 1; + Logger.d(TAG, "查询运营状态 result.status: " + o.data.serviceStatus); + startOrStopOrderLoop(mIsWorking); + } + carOperationStatusCallback.changeOperationStatus(isWorking()); + } + + @Override + public void onFail(String failMsg) { + if (!NetworkUtils.isConnected(mContext)) { + TipToast.shortTip("网络异常,请稍后重试"); + } + } + }); } /** * 开启自动驾驶到下一站 */ - public void autoDriveToNextStation( boolean isRestart ) { - if ( backgroundCurrentStationIndex >= stationList.size() - 1 ) { + public void autoDriveToNextStation(boolean isRestart) { + if (backgroundCurrentStationIndex >= stationList.size() - 1) { // 当前站是最后一站,结束当前行程 travelOver(); return; } - leaveStation(false,isRestart); + leaveStation(false, isRestart); } /** * 渲染站点信息 * 服务端返回的OchBusRoutesResult逻辑, 离开站为当前站, 到达下一站后才会将下一站置为当前站, * 车机端展示是离开当前站,下一站设置为当前站, 所以服务端数据回来要做处理current index,不能直接渲染 + * * @param result */ private void renderBusStationsStatus(OchBusRoutesResult result) { if (result == null) return; ochBusRoutesResult = result; - List< OchBusStation > site = result.getSites(); + List site = result.getSites(); currentLineId = result.getLineId(); stationList.clear(); - stationList.addAll( site ); - for ( int i = 0; i < stationList.size(); i++ ) { - OchBusStation s = stationList.get( i ); + stationList.addAll(site); + for (int i = 0; i < stationList.size(); i++) { + OchBusStation s = stationList.get(i); // 是否正在开往下一站 - if ( s.isLeaving()) { + if (s.isLeaving()) { isGoingToNextStation = true; } // 当前站点信息 - if (s.getDrivingStatus() == STATION_STATUS_STOPPED ) { + if (s.getDrivingStatus() == STATION_STATUS_STOPPED) { currentStationIndex = i; break; } } backgroundCurrentStationIndex = currentStationIndex; OchBusStation currentStation = stationList.get(currentStationIndex); - Logger.d( TAG, "渲染站点信息服务端currentStationIndex="+currentStationIndex - +" isLeaving()="+currentStation.isLeaving()); + Logger.d(TAG, "渲染站点信息服务端currentStationIndex=" + currentStationIndex + + " isLeaving()=" + currentStation.isLeaving()); //当前站点是始发站,告诉服务端到达始发站。 如果没有这个节点, 服务器不知道始发站到达状态 // ,订单开始站下在始发站的状态流转有问题 - if (currentStationIndex == 0 && !currentStation.isLeaving()){ + if (currentStationIndex == 0 && !currentStation.isLeaving()) { arriveSiteStation(true); } // 美化是否开始 if (FunctionBuildConfig.isDemoMode && ((currentStationIndex > 0 - && currentStationIndex < stationList.size()-1) - || (stationList.get(0).isLeaving() || stationList.get(stationList.size() -1).isLeaving()))){//行驶过程中设置美化 + && currentStationIndex < stationList.size() - 1) + || (stationList.get(0).isLeaving() || stationList.get(stationList.size() - 1).isLeaving()))) {//行驶过程中设置美化 FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true; Logger.d(TAG, "美化模式-ignore:置为true(每次滑动出发)"); } - if (refreshBusStationsCallback != null){ - if (currentStation.isLeaving()){//如果服务端的当前站是leaving状态,展示当前站需要+1 - currentStationIndex ++; + if (refreshBusStationsCallback != null) { + if (currentStation.isLeaving()) {//如果服务端的当前站是leaving状态,展示当前站需要+1 + currentStationIndex++; refreshBusStationsCallback.refreshBusStations(stationList - , currentStationIndex, getNextStopStation(),false); - }else{ + , currentStationIndex, getNextStopStation(), false); + } else { refreshBusStationsCallback.refreshBusStations(stationList - , currentStationIndex, getNextStopStation(),true); + , currentStationIndex, getNextStopStation(), true); } } - if ( currentStation.isLeaving() && slidePannelHideCallback != null) { + if (currentStation.isLeaving() && slidePannelHideCallback != null) { slidePannelHideCallback.hideSlidePanel(); } } @@ -658,19 +666,19 @@ public class OchBusOrderModel { * * @param lastStopStation */ - private void resetNextStopStation( int lastStopStation ) { - Logger.d( TAG, "重置下一站"); + private void resetNextStopStation(int lastStopStation) { + Logger.d(TAG, "重置下一站"); int nextStopStation = getNextStopStation(); - if ( nextStopStation < 0 ) { + if (nextStopStation < 0) { return; } - if ( lastStopStation <= nextStopStation || nextStopStation <= currentStationIndex ) { + if (lastStopStation <= nextStopStation || nextStopStation <= currentStationIndex) { return; } - if ( CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState() - == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING ) { + if (CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState() + == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) { // 自动驾驶中动态设置下一个停靠站点/ - autoDriveToNextStation( true ); + autoDriveToNextStation(true); } } @@ -680,12 +688,12 @@ public class OchBusOrderModel { * @return -1 当前已是最后一个站点 */ private int getNextStopStation() { - if ( currentStationIndex >= stationList.size() - 1 ) { + if (currentStationIndex >= stationList.size() - 1) { return -1; } int nextStationIndex = currentStationIndex + 1; - for ( ; nextStationIndex < stationList.size() - 1; nextStationIndex++ ) { - if ( stationList.get( nextStationIndex ).getIfStop() == 1 ) { + for (; nextStationIndex < stationList.size() - 1; nextStationIndex++) { + if (stationList.get(nextStationIndex).getIfStop() == 1) { break; } break; @@ -697,16 +705,16 @@ public class OchBusOrderModel { * 延时查询站点信心 */ private void queryBusStationDelay() { - handler.sendEmptyMessageDelayed( MSG_QUERY_BUS_STATION, QUERY_BUS_STATION_DELAY ); + handler.sendEmptyMessageDelayed(MSG_QUERY_BUS_STATION, QUERY_BUS_STATION_DELAY); } /** * 在踩刹车、控制方向盘等操作后,会停止自动驾驶,重启自动驾驶的话相当于重新设置自动驾驶目的地 */ public void restartAutopilot() { - Logger.d( TAG, "重启自动驾驶===" + isGoingToNextStation ); - if ( isGoingToNextStation ) { - autoDriveToNextStation( true ); + Logger.d(TAG, "重启自动驾驶===" + isGoingToNextStation); + if (isGoingToNextStation) { + autoDriveToNextStation(true); } } @@ -715,25 +723,25 @@ public class OchBusOrderModel { * * @param awayPassengersResponse */ - private void playLeavePassengersMsg( QueryLeaveAwayPassengersResponse awayPassengersResponse ) { - Logger.d( TAG, "播报下车乘客信息currentStationIndex="+currentStationIndex); + private void playLeavePassengersMsg(QueryLeaveAwayPassengersResponse awayPassengersResponse) { + Logger.d(TAG, "播报下车乘客信息currentStationIndex=" + currentStationIndex); - if ( currentStationIndex > stationList.size() - 1 ) { + if (currentStationIndex > stationList.size() - 1) { return; } - String station = stationList.get( currentStationIndex ).getName(); - StringBuilder builder = new StringBuilder( "已到达" ); - builder.append( station ); - if ( !station.endsWith( "站" ) ) { - builder.append( "站" ); + String station = stationList.get(currentStationIndex).getName(); + StringBuilder builder = new StringBuilder("已到达"); + builder.append(station); + if (!station.endsWith("站")) { + builder.append("站"); } - if ( awayPassengersResponse == null || awayPassengersResponse.data == null - || awayPassengersResponse.data.orders == null || awayPassengersResponse.data.orders.isEmpty() ) { - Logger.d( TAG, "播报下车乘客信息为null"); + if (awayPassengersResponse == null || awayPassengersResponse.data == null + || awayPassengersResponse.data.orders == null || awayPassengersResponse.data.orders.isEmpty()) { + Logger.d(TAG, "播报下车乘客信息为null"); } else { - builder.append( ",请尾号为 " ); - for ( QueryLeaveAwayPassengersResponse.LeaveAwayPassenger leaveAwayPassenger : awayPassengersResponse.data.orders ) { - if ( leaveAwayPassenger == null ) { + builder.append(",请尾号为 "); + for (QueryLeaveAwayPassengersResponse.LeaveAwayPassenger leaveAwayPassenger : awayPassengersResponse.data.orders) { + if (leaveAwayPassenger == null) { continue; } String tailNum = null; @@ -743,23 +751,23 @@ public class OchBusOrderModel { e.printStackTrace(); tailNum = leaveAwayPassenger.passengerPhone; } - builder.append( tailNum ).append( "。" ); + builder.append(tailNum).append("。"); } - builder.append( "的乘客下车" ); + builder.append("的乘客下车"); } builder.append(",带好随身物品,下车请注意安全"); Logger.d(TAG, "TTS:" + builder.toString()); - AIAssist.getInstance( mContext ).speakTTSVoice( builder.toString() ); + AIAssist.getInstance(mContext).speakTTSVoice(builder.toString()); } /** * 修改小巴运营状态 */ public void onChangeOperationStatus() { - Logger.d( TAG, "修改小巴运营状态"); - if (isWorking()){//收车 + Logger.d(TAG, "修改小巴运营状态"); + if (isWorking()) {//收车 stopTakeOrder(); - }else {//出车 + } else {//出车 startTakeOrder(); } } @@ -770,14 +778,14 @@ public class OchBusOrderModel { private void travelOver() { // Logger.d( TAG, "行程结束"); - if ( currentStationIndex >= stationList.size() ) { - Logger.e( TAG, "travel over index out of station list" ); + if (currentStationIndex >= stationList.size()) { + Logger.e(TAG, "travel over index out of station list"); return; } - Logger.d( TAG, "单程结束====" ); + Logger.d(TAG, "单程结束===="); CallerAutoPilotManager.INSTANCE.cancelAutoPilot(); - AIAssist.getInstance( mContext ).speakTTSVoice( "感谢您体验'蘑菇车联'无人驾驶小巴车,请您携带好随身物品,我们下次再见" ); - leaveStation(true,true); + AIAssist.getInstance(mContext).speakTTSVoice("感谢您体验'蘑菇车联'无人驾驶小巴车,请您携带好随身物品,我们下次再见"); + leaveStation(true, true); } public boolean isWorking() { @@ -786,18 +794,19 @@ public class OchBusOrderModel { /** * 到站 + * * @param data */ - public void onArriveAt( AutopilotStationInfo data){ - if ( currentStationIndex > stationList.size() - 1 ) { - Logger.e( TAG, "到站异常,取消后续操作结束" ); + public void onArriveAt(MessagePad.ArrivalNotification data) { + if (currentStationIndex > stationList.size() - 1) { + Logger.e(TAG, "到站异常,取消后续操作结束"); return; } - if (FunctionBuildConfig.isDemoMode && currentStationIndex == stationList.size() - 1){//到达最后一站结束美化 + if (FunctionBuildConfig.isDemoMode && currentStationIndex == stationList.size() - 1) {//到达最后一站结束美化 FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false; Logger.d(TAG, "美化模式-ignore:置为false(到最后一站)"); } - Logger.d( TAG, "到站====currentStationIndex=" + currentStationIndex); + Logger.d(TAG, "到站====currentStationIndex=" + currentStationIndex); isGoingToNextStation = false; // 到达站点后,更新站点状态 // currentStationIndex = getNextStopStation(); @@ -805,12 +814,12 @@ public class OchBusOrderModel { UiThreadHandler.postDelayed(new Runnable() {// 先查询下车乘客,再上报到站,便于后台筛查下车订单 @Override public void run() { - if (!hadQueryLeaveAwayPassager){ + if (!hadQueryLeaveAwayPassager) { arriveSiteStation(false); } hadQueryLeaveAwayPassager = false; } - },1500); + }, 1500); } public boolean isGoingToNextStation() { diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/OchBusPresenter.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/OchBusPresenter.java index 6b741f08cf..b1886bb4fc 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/OchBusPresenter.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/OchBusPresenter.java @@ -1,14 +1,13 @@ package com.mogo.och.bus.presenter; + import android.location.Location; import android.os.Looper; import android.util.Log; import androidx.annotation.NonNull; import androidx.lifecycle.LifecycleOwner; + import com.mogo.commons.mvp.Presenter; -import com.mogo.commons.voice.AIAssist; -import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo; -import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo; import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo; import com.mogo.eagle.core.data.config.FunctionBuildConfig; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener; @@ -23,17 +22,19 @@ import com.mogo.och.bus.callback.SlidePannelHideCallback; import com.mogo.och.bus.fragment.OchBusFragment; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; +import mogo.telematics.pad.MessagePad; +import mogo_msg.MogoReportMsg; + /** * 网约车小巴 * * @author tongchenfei */ -public class OchBusPresenter extends Presenter< OchBusFragment > +public class OchBusPresenter extends Presenter implements CarOperationStatusCallback, RefreshBusStationsCallback, SlidePannelHideCallback , IMoGoAutopilotStatusListener, IOCHBusControllerStatusCallback { @@ -44,16 +45,16 @@ public class OchBusPresenter extends Presenter< OchBusFragment > private List mStationList = new ArrayList<>(); private int mCurrentStation = 0; - public OchBusPresenter( OchBusFragment view ) { - super( view ); + public OchBusPresenter(OchBusFragment view) { + super(view); //2021.11.1 鹰眼架构整合,由IMoGoAutopilotStatusListener逐步替代IMogoAdasOCHCallback接口 CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, this); OchBusOrderModel.getInstance().init(); } @Override - public void onCreate( @NonNull LifecycleOwner owner ) { - super.onCreate( owner ); + public void onCreate(@NonNull LifecycleOwner owner) { + super.onCreate(owner); OchBusOrderModel.getInstance().queryOperationStatus(); OchBusOrderModel.getInstance().queryBusRoutes(); initModelListener(); @@ -66,39 +67,39 @@ public class OchBusPresenter extends Presenter< OchBusFragment > releaseListener(); } - public void initModelListener(){ + public void initModelListener() { OchBusOrderModel.getInstance().setCarOperationStatusCallback(this); OchBusOrderModel.getInstance().setRefreshBusStationsCallback(this); OchBusOrderModel.getInstance().setSlidePannelHideCallback(this); OchBusOrderModel.getInstance().setControllerStatusCallback(this); } - public void releaseListener(){ + public void releaseListener() { OchBusOrderModel.getInstance().setCarOperationStatusCallback(null); OchBusOrderModel.getInstance().setRefreshBusStationsCallback(null); OchBusOrderModel.getInstance().setSlidePannelHideCallback(null); OchBusOrderModel.getInstance().setControllerStatusCallback(null); } - public void queryBusRoutes(){ + public void queryBusRoutes() { OchBusOrderModel.getInstance().queryBusRoutes(); } - public void debugResetStationStatus(){ + public void debugResetStationStatus() { OchBusOrderModel.getInstance().debugResetStationStatus(); } - public void autoDriveToNextStation(boolean isRestart){ + public void autoDriveToNextStation(boolean isRestart) { currentAutopilotStatus = -1; OchBusOrderModel.getInstance().autoDriveToNextStation(isRestart); } - public void restartAutopilot(){ + public void restartAutopilot() { currentAutopilotStatus = -1; OchBusOrderModel.getInstance().restartAutopilot(); } - public void onChangeOperationStatus(){ + public void onChangeOperationStatus() { OchBusOrderModel.getInstance().onChangeOperationStatus(); } @@ -115,9 +116,9 @@ public class OchBusPresenter extends Presenter< OchBusFragment > mStationList.addAll(stationList); mCurrentStation = currentStation; functionDemoModeChange(); - Log.d("OchBusOrderModel ="," mCurrentStation ="+mCurrentStation); - if ( mView != null ) { - mView.refreshBusStations( stationList, currentStation, nextStation ,isArrived); + Log.d("OchBusOrderModel =", " mCurrentStation =" + mCurrentStation); + if (mView != null) { + mView.refreshBusStations(stationList, currentStation, nextStation, isArrived); } } @@ -125,32 +126,27 @@ public class OchBusPresenter extends Presenter< OchBusFragment > // Log.d("OchBusOrderModel ="," functionDemoModeChange ="+mCurrentStation); if (FunctionBuildConfig.isDemoMode && ( - (mCurrentStation > 0 && mCurrentStation < mStationList.size()-1) + (mCurrentStation > 0 && mCurrentStation < mStationList.size() - 1) || ( - (mCurrentStation == 0 || mCurrentStation == mStationList.size() -1) + (mCurrentStation == 0 || mCurrentStation == mStationList.size() - 1) && OchBusOrderModel.getInstance().isGoingToNextStation() ) ) - ){ - mView.onAutopilotStatusChanged( IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING ,false); + ) { + mView.onAutopilotStatusChanged(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING, false); } } @Override public void hideSlidePanel() { - if (mView != null){ + if (mView != null) { mView.hideSlidePanel(); } } @Override - public void onAutopilotArriveAtStation(@Nullable AutopilotStationInfo autopilotStationInfo) { - OchBusOrderModel.getInstance().onArriveAt(autopilotStationInfo); - } - - @Override - public void onAutopilotGuardian(@Nullable AutopilotGuardianStatusInfo autopilotGuardianStatusInfo) { - + public void onAutopilotArriveAtStation(MessagePad.ArrivalNotification arrivalNotification) { + OchBusOrderModel.getInstance().onArriveAt(arrivalNotification); } @Override @@ -162,69 +158,69 @@ public class OchBusPresenter extends Presenter< OchBusFragment > public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autopilotStatusInfo) { if (autopilotStatusInfo == null) return; int state = autopilotStatusInfo.getState(); - Logger.d( TAG, "onStateChange: " + state +"currentAutopilotStatus = "+currentAutopilotStatus); - switch ( state ) { + Logger.d(TAG, "onStateChange: " + state + "currentAutopilotStatus = " + currentAutopilotStatus); + switch (state) { case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE: - if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE){ - if (currentAutopilotStatus == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){//2-->1语音提示 + if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) { + if (currentAutopilotStatus == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {//2-->1语音提示 // AIAssist.getInstance( getContext() ).speakTTSVoice( "已进入人工驾驶模式" ); } currentAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE; // 设置UI【自动驾驶】按钮是否展示 - mView.onAutopilotEnableChange( true ); - if ( OchBusOrderModel.getInstance().isGoingToNextStation() ) { + mView.onAutopilotEnableChange(true); + if (OchBusOrderModel.getInstance().isGoingToNextStation()) { mView.hideSlidePanel(); } if (FunctionBuildConfig.isDemoMode && ( - (mCurrentStation > 0 && mCurrentStation < mStationList.size()-1) + (mCurrentStation > 0 && mCurrentStation < mStationList.size() - 1) || ( - (mCurrentStation == 0 || mCurrentStation == mStationList.size() -1) + (mCurrentStation == 0 || mCurrentStation == mStationList.size() - 1) && OchBusOrderModel.getInstance().isGoingToNextStation() - ) - ) - ){ - Log.d("OchBusOrderModel=","有美化功能"); + ) + ) + ) { + Log.d("OchBusOrderModel=", "有美化功能"); return; } // 改变UI自动驾驶状态 - mView.onAutopilotStatusChanged( currentAutopilotStatus ,isAnimateRunning); + mView.onAutopilotStatusChanged(currentAutopilotStatus, isAnimateRunning); } break; case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING: - runOnUIThread(()->mView.stopAutopilotAnimation()); - if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){ + runOnUIThread(() -> mView.stopAutopilotAnimation()); + if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) { currentAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING; // 改变UI自动驾驶状态 - mView.onAutopilotStatusChanged( currentAutopilotStatus ,isAnimateRunning); + mView.onAutopilotStatusChanged(currentAutopilotStatus, isAnimateRunning); } isAnimateRunning = false; break; case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE: - if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE){ - if (currentAutopilotStatus == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){//2-->0语音提示 + if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) { + if (currentAutopilotStatus == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {//2-->0语音提示 // AIAssist.getInstance( getContext() ).speakTTSVoice( "自动驾驶已停止,请人工接管" ); } currentAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE; if (FunctionBuildConfig.isDemoMode && ( - (mCurrentStation > 0 && mCurrentStation < mStationList.size()-1) + (mCurrentStation > 0 && mCurrentStation < mStationList.size() - 1) || ( - (mCurrentStation == 0 || mCurrentStation == mStationList.size() -1) + (mCurrentStation == 0 || mCurrentStation == mStationList.size() - 1) && OchBusOrderModel.getInstance().isGoingToNextStation() ) ) - ){ - Log.d("OchBusOrderModel=","有美化功能"); + ) { + Log.d("OchBusOrderModel=", "有美化功能"); return; } - mView.onAutopilotEnableChange( false ); - mView.onAutopilotStatusChanged( currentAutopilotStatus ,isAnimateRunning); + mView.onAutopilotEnableChange(false); + mView.onAutopilotStatusChanged(currentAutopilotStatus, isAnimateRunning); } isAnimateRunning = false; break; default: - mView.onAutopilotEnableChange( false ); + mView.onAutopilotEnableChange(false); break; } } @@ -236,7 +232,7 @@ public class OchBusPresenter extends Presenter< OchBusFragment > @Override public void onCarLocationChanged(Location location) { - if (null != location){ + if (null != location) { runOnUIThread(() -> mView.updateSpeedView(location.getSpeed())); } } @@ -244,7 +240,7 @@ public class OchBusPresenter extends Presenter< OchBusFragment > @Override public void startOpenAutopilot() { isAnimateRunning = true; - runOnUIThread(()->mView.startAutopilotAnimation()); + runOnUIThread(() -> mView.startAutopilotAnimation()); // TODO: 2021/8/20 无工控机环境, 手动调起自动驾驶开启返回结果,有工控机环境要删除 // UiThreadHandler.postDelayed(new Runnable() { // @Override @@ -254,12 +250,12 @@ public class OchBusPresenter extends Presenter< OchBusFragment > // },2300); } - private void runOnUIThread( Runnable executor ) { - if ( executor == null ) { + private void runOnUIThread(Runnable executor) { + if (executor == null) { return; } - if ( Looper.myLooper() != Looper.getMainLooper() ) { - UiThreadHandler.post( executor ); + if (Looper.myLooper() != Looper.getMainLooper()) { + UiThreadHandler.post(executor); } else { executor.run(); } @@ -267,11 +263,17 @@ public class OchBusPresenter extends Presenter< OchBusFragment > /** * 测试使用 + * * @param status */ - public void debugAutoPilotStatus(int status){ + public void debugAutoPilotStatus(int status) { AutopilotStatusInfo info = new AutopilotStatusInfo(); info.setState(status); onAutopilotStatusResponse(info); } + + @Override + public void onAutopilotGuardian(MogoReportMsg.MogoReportMessage guardianInfo) { + + } } diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/callback/IOCHTaxiAutopilotPlanningCallback.java b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/callback/IOCHTaxiAutopilotPlanningCallback.java index 2bbd29669f..8b691980db 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/callback/IOCHTaxiAutopilotPlanningCallback.java +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/callback/IOCHTaxiAutopilotPlanningCallback.java @@ -1,13 +1,14 @@ package com.mogo.och.taxi.passenger.callback; -import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo; import java.util.List; +import mogo.telematics.pad.MessagePad; + /** * @author: wangmingjun * @date: 2021/11/1 */ public interface IOCHTaxiAutopilotPlanningCallback { - void routeResult(List models); + void routeResult(List models); } \ No newline at end of file diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/MogoOCHTaxiModelNew.java b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/MogoOCHTaxiModelNew.java index 5f4c847dd1..7ebbb52bbb 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/MogoOCHTaxiModelNew.java +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/MogoOCHTaxiModelNew.java @@ -13,8 +13,6 @@ import com.mogo.commons.debug.DebugConfig; import com.mogo.eagle.core.data.BaseData; import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo; import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters; -import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo; -import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo; import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo; import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo; import com.mogo.eagle.core.data.config.FunctionBuildConfig; @@ -64,9 +62,12 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import mogo.telematics.pad.MessagePad; +import mogo_msg.MogoReportMsg; + /** * Created by pangfan on 2021/8/19 - * + *

* 网约车 - 出租车业务逻辑处理 */ public class MogoOCHTaxiModelNew { @@ -101,10 +102,12 @@ public class MogoOCHTaxiModelNew { private MogoOCHTaxiModelNew() { } + public void setMoGoAutopilotPlanningListener(IOCHTaxiAutopilotPlanningCallback moGoAutopilotPlanningCallback) { this.mAutopilotPlanningCallback = moGoAutopilotPlanningCallback; } + public void setADASStatusCallback(IOCHTaxiADASStatusCallback callback) { this.mADASStatusCallback = callback; } @@ -121,7 +124,7 @@ public class MogoOCHTaxiModelNew { this.mOrderStatusCallback = callback; } - public void init( Context context ) { + public void init(Context context) { mContext = context.getApplicationContext(); initListeners(); @@ -141,7 +144,7 @@ public class MogoOCHTaxiModelNew { } } - public void startOrStopOrderLoop(){ + public void startOrStopOrderLoop() { startOrStopOrderLoop(mOCHCarStatus == 1); } @@ -154,26 +157,26 @@ public class MogoOCHTaxiModelNew { MogoApisHandler.getInstance() .getApis() .getSocketManagerApi(mContext) - .registerLifecycleListener(10010,mSocketLifeCycleLisnter); + .registerLifecycleListener(10010, mSocketLifeCycleLisnter); // 2021.11.1重构自动驾驶 实现接口 IMoGoAutopilotStatusListener 注册监听 替换IMogoAdasOCHCallback接口 CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, mGoAutopilotStatusListener); MogoApisHandler.getInstance() .getApis() .getIntentManagerApi() - .registerIntentListener( ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener ); + .registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener); MogoApisHandler.getInstance() .getApis() .getStatusManagerApi() - .registerStatusChangedListener( TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener ); + .registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener); // 达到起始站围栏监听 MogoApisHandler.getInstance() .getApis() .getRegisterCenterApi() - .registerCarLocationChangedListener( TAG, mCarLocationChangedListener2); + .registerCarLocationChangedListener(TAG, mCarLocationChangedListener2); //2021.11.1 自动驾驶路线规划接口 - CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG,moGoAutopilotPlanningListener); + CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, moGoAutopilotPlanningListener); } private void releaseListeners() { @@ -234,13 +237,14 @@ public class MogoOCHTaxiModelNew { } @Override - public void onFail(int code, String msg) { } + public void onFail(int code, String msg) { + } }); } //更新出车收车状态 public void updateCarStatus() { - if ( mOCHCarStatus == -1){ + if (mOCHCarStatus == -1) { queryCarStatus(); return; } @@ -275,7 +279,7 @@ public class MogoOCHTaxiModelNew { /** * 查询订单状态:进行中/待服务(轮询防止因crash导致应用重启、断网没收到推送等) - * + *

* 注:只有在本地缓存mCurrentOCHOrder为null时(已完成or已取消有明确结果)或id相同且status不同时, * 才更新最新进行中单到本地 */ @@ -383,7 +387,7 @@ public class MogoOCHTaxiModelNew { //更新当前订单状态 public void updateOCHOrderStatus(final OrderStatusEnum orderStatus) { - if ( mCurrentOCHOrder == null ) { + if (mCurrentOCHOrder == null) { return; } final long orderId = mCurrentOCHOrder.orderId; @@ -509,7 +513,7 @@ public class MogoOCHTaxiModelNew { /** * 查询新到预约单 - * + *

* 注:只有在本地缓存mNewBookingOrder为null时(执行完抢单or司机关闭改单),才更新新到待抢单 */ public void queryNewBookingOrder() { @@ -520,7 +524,7 @@ public class MogoOCHTaxiModelNew { if (data != null && data.code == 0 && data.data != null && data.data.orders.size() > 0) { // 本地无新到单,且本次新到单id与上次收到的新单id不同时:显示本次新到单 - if (mNewBookingOrder == null ) { + if (mNewBookingOrder == null) { for (Long orderId : data.data.orders) { if (mPrevOrderId != orderId.longValue()) { queryNewBookingContent(orderId.longValue()); @@ -713,7 +717,7 @@ public class MogoOCHTaxiModelNew { //检测当前订单 public boolean checkCurrentOCHOrder() { - if ( mCurrentOCHOrder != null + if (mCurrentOCHOrder != null && mCurrentOCHOrder.startSiteGcjPoint != null && mCurrentOCHOrder.endSiteGcjPoint != null) { return true; @@ -724,7 +728,7 @@ public class MogoOCHTaxiModelNew { //以当前订单为基础,开启自动驾驶 public void startAutoPilot() { if (!checkCurrentOCHOrder()) { - Logger.e( TAG, "no order or order is empty." ); + Logger.e(TAG, "no order or order is empty."); TipToast.shortTip("当前订单不存在或异常!"); return; } @@ -748,7 +752,7 @@ public class MogoOCHTaxiModelNew { parameters.endLatLon = new AutopilotControlParameters.AutoPilotLonLat(endWgsLat, endWgsLon); CallerAutoPilotManager.INSTANCE.startAutoPilot(parameters); Logger.d(TAG, "start autopilot with parameter: %s", GsonUtil.jsonFromObject(parameters) - +" ,startSiteName="+ mCurrentOCHOrder.startSiteAddr+" ,endSiteName="+mCurrentOCHOrder.endSiteAddr); + + " ,startSiteName=" + mCurrentOCHOrder.startSiteAddr + " ,endSiteName=" + mCurrentOCHOrder.endSiteAddr); if (DebugConfig.isDebug()) { // TipToast.shortTip("Start autopilot!"); } @@ -762,7 +766,7 @@ public class MogoOCHTaxiModelNew { try { CallerAutoPilotManager.INSTANCE.cancelAutoPilot(); Logger.d(TAG, "结束自动驾驶"); - } catch ( Exception e ) { + } catch (Exception e) { e.printStackTrace(); } } @@ -777,7 +781,7 @@ public class MogoOCHTaxiModelNew { double startLat = mCurrentOCHOrder.startSiteGcjPoint.get(1); double distance = CoordinateUtils.calculateLineDistance( startLon, startLat, - location.getLongitude(), location.getLatitude() ); + location.getLongitude(), location.getLatitude()); if (DebugConfig.isDebug() && mCurrentOCHOrder.orderStatus == OrderStatusEnum.OnTheWayToStartStation.getCode()) { // TipToast.shortTip("距离上车点:" + Double.valueOf(distance).intValue()); @@ -788,21 +792,21 @@ public class MogoOCHTaxiModelNew { // mOrderStatusCallback.onCurrentOrderDistToStartChanged((long) distance, 0); // } - if ( distance > OCHTaxiConst.ARRIVE_AT_START_STATION_DISTANCE ) { + if (distance > OCHTaxiConst.ARRIVE_AT_START_STATION_DISTANCE) { distance = CoordinateUtils.calculateLineDistance(startLon, startLat, MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon(), - MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat() ); + MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat()); } - if ( distance <= OCHTaxiConst.ARRIVE_AT_START_STATION_DISTANCE ) { - updateOCHOrderStatus( OrderStatusEnum.ArriveAtStartStation); + if (distance <= OCHTaxiConst.ARRIVE_AT_START_STATION_DISTANCE) { + updateOCHOrderStatus(OrderStatusEnum.ArriveAtStartStation); return; } } // TODO: 2021/9/12 - public void calculateTravelDistance(Location carLocation){ - if (checkCurrentOCHOrder() && mCurrentOCHOrder.endSiteGcjPoint.size()>0) { + public void calculateTravelDistance(Location carLocation) { + if (checkCurrentOCHOrder() && mCurrentOCHOrder.endSiteGcjPoint.size() > 0) { double endLon = mCurrentOCHOrder.endSiteGcjPoint.get(0); double endLat = mCurrentOCHOrder.endSiteGcjPoint.get(1); double distance = CoordinateUtils.calculateLineDistance( @@ -818,10 +822,10 @@ public class MogoOCHTaxiModelNew { //监听网络变化,避免启动机器时无网导致无法更新订单信息 private IMogoIntentListener mNetWorkIntentListener = new IMogoIntentListener() { @Override - public void onIntentReceived( String intentStr, Intent intent ) { - Logger.d( TAG, "onIntentReceived = %s", intentStr ); - if ( ConnectivityManager.CONNECTIVITY_ACTION.equals( intentStr ) ) { - if ( NetworkUtils.isConnected( mContext ) ) { + public void onIntentReceived(String intentStr, Intent intent) { + Logger.d(TAG, "onIntentReceived = %s", intentStr); + if (ConnectivityManager.CONNECTIVITY_ACTION.equals(intentStr)) { + if (NetworkUtils.isConnected(mContext)) { if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) { startOrStopOrderLoop(mOCHCarStatus == 1); queryCarStatus(); @@ -845,20 +849,26 @@ public class MogoOCHTaxiModelNew { private IMogoLifecycleListener mSocketLifeCycleLisnter = new IMogoLifecycleListener() { @Override - public void onConnectFailure() { Logger.e(TAG,"socket onConnectFailure"); } + public void onConnectFailure() { + Logger.e(TAG, "socket onConnectFailure"); + } @Override - public void onConnectSuccess() { Logger.e(TAG,"socket onConnectSuccess"); } + public void onConnectSuccess() { + Logger.e(TAG, "socket onConnectSuccess"); + } @Override - public void onConnectLost() { Logger.e(TAG,"socket onConnectLost"); } + public void onConnectLost() { + Logger.e(TAG, "socket onConnectLost"); + } }; // 自车定位 private IMogoCarLocationChangedListener2 mCarLocationChangedListener2 = new IMogoCarLocationChangedListener2() { @Override - public void onCarLocationChanged2( Location location ) { + public void onCarLocationChanged2(Location location) { IMogoServiceApis apis = MogoApisHandler.getInstance().getApis(); MogoLocation mogoLocation = new MogoLocation(); mogoLocation.setAccuracy(location.getAccuracy()); @@ -920,7 +930,13 @@ public class MogoOCHTaxiModelNew { } updateOCHOrderStatus(OrderStatusEnum.OnTheWayToEndStation); } - private IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener(){ + + private IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener() { + + @Override + public void onAutopilotGuardian(@Nullable MogoReportMsg.MogoReportMessage guardianInfo) { + + } private boolean arriveAtEnd = false; //乘客app专用字段 @@ -928,7 +944,7 @@ public class MogoOCHTaxiModelNew { public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autopilotStatusInfo) { if (autopilotStatusInfo == null) return; int state = autopilotStatusInfo.getState(); - Logger.d( TAG, "state = %s", state ); + Logger.d(TAG, "state = %s", state); if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) { if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotRunning(); if (mCurrentOCHOrder != null @@ -975,12 +991,7 @@ public class MogoOCHTaxiModelNew { } @Override - public void onAutopilotGuardian(@Nullable AutopilotGuardianStatusInfo autopilotGuardianStatusInfo) { - - } - - @Override - public void onAutopilotArriveAtStation(@Nullable AutopilotStationInfo data) { + public void onAutopilotArriveAtStation(MessagePad.ArrivalNotification data) { if (FunctionBuildConfig.isDemoMode && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) { arriveAtEnd = true; @@ -996,19 +1007,20 @@ public class MogoOCHTaxiModelNew { updateOCHOrderStatus(OrderStatusEnum.ArriveAtEndStation); } }; - private IMoGoAutopilotPlanningListener moGoAutopilotPlanningListener = new IMoGoAutopilotPlanningListener(){ + private final IMoGoAutopilotPlanningListener moGoAutopilotPlanningListener = new IMoGoAutopilotPlanningListener() { + + @Override + public void onAutopilotRotting(@Nullable MessagePad.GlobalPathResp globalPathResp) { + if (null != globalPathResp && globalPathResp.getWayPointsList().size() > 0) { + mAutopilotPlanningCallback.routeResult(globalPathResp.getWayPointsList()); + } + } @Override public void onAutopilotTrajectory(ArrayList trajectoryInfos) { } - @Override - public void onAutopilotRotting(AutopilotRouteInfo routeList) { - if (null != routeList && routeList.getModels() != null){ - mAutopilotPlanningCallback.routeResult(routeList.getModels()); - } - } }; /** * END diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/presenter/OCHTaxiPresenter.java b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/presenter/OCHTaxiPresenter.java index 48decd91d5..b5b9acfa0d 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/presenter/OCHTaxiPresenter.java +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/presenter/OCHTaxiPresenter.java @@ -11,7 +11,6 @@ import androidx.lifecycle.LifecycleOwner; import com.mogo.commons.AbsMogoApplication; import com.mogo.commons.mvp.Presenter; -import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener; import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.eagle.core.utilcode.util.UiThreadHandler; @@ -30,6 +29,8 @@ import org.jetbrains.annotations.NotNull; import java.util.List; +import mogo.telematics.pad.MessagePad; + /** * @author congtaowang * @since 2021/1/18 @@ -253,7 +254,7 @@ public class OCHTaxiPresenter extends Presenter implements IOCH } } @Override - public void routeResult(List models) { + public void routeResult(List models) { if (models != null && models.size() > 0) mView.routeResult(models); } } diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/OCHTaxiFragment.java b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/OCHTaxiFragment.java index 800af8c418..a645b3d7f9 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/OCHTaxiFragment.java +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/OCHTaxiFragment.java @@ -10,7 +10,6 @@ import androidx.annotation.RequiresApi; import androidx.fragment.app.FragmentTransaction; import com.mogo.commons.debug.DebugConfig; -import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo; import com.mogo.eagle.core.data.config.FunctionBuildConfig; import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils; import com.mogo.eagle.core.utilcode.mogo.logger.Logger; @@ -26,6 +25,8 @@ import com.mogo.och.taxi.passenger.utils.PinYinUtil; import java.lang.ref.WeakReference; import java.util.List; +import mogo.telematics.pad.MessagePad; + /** * @author congtaowang * @since 2021/1/18 @@ -174,7 +175,7 @@ public class OCHTaxiFragment extends BaseOchTaxiTabFragment routeList) { + public void routeResult(List routeList) { if (routeList == null ) return; // double distance = calculateTravelDistance(mogoLocation,routeList); // if ( MogoOCHTaxiModel.getInstance().checkCurrentOCHOrder() ) { diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/callback/IOCHTaxiAutopilotPlanningCallback.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/callback/IOCHTaxiAutopilotPlanningCallback.java index 36949f59b9..9d5760ca70 100644 --- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/callback/IOCHTaxiAutopilotPlanningCallback.java +++ b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/callback/IOCHTaxiAutopilotPlanningCallback.java @@ -1,13 +1,14 @@ package com.mogo.och.taxi.callback; -import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo; import java.util.List; +import mogo.telematics.pad.MessagePad; + /** * @author: wangmingjun * @date: 2021/11/1 */ public interface IOCHTaxiAutopilotPlanningCallback { - void routeResult(List models); + void routeResult(List models); } \ No newline at end of file diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/MogoOCHTaxiModelNew.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/MogoOCHTaxiModelNew.java index 807eedf07a..b14c4532c4 100644 --- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/MogoOCHTaxiModelNew.java +++ b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/MogoOCHTaxiModelNew.java @@ -68,10 +68,12 @@ import java.util.List; import io.reactivex.exceptions.UndeliverableException; import io.reactivex.functions.Consumer; import io.reactivex.plugins.RxJavaPlugins; +import mogo.telematics.pad.MessagePad; +import mogo_msg.MogoReportMsg; /** * Created by pangfan on 2021/8/19 - * + *

* 网约车 - 出租车业务逻辑处理 */ public class MogoOCHTaxiModelNew { @@ -106,10 +108,12 @@ public class MogoOCHTaxiModelNew { private MogoOCHTaxiModelNew() { } + public void setMoGoAutopilotPlanningListener(IOCHTaxiAutopilotPlanningCallback moGoAutopilotPlanningCallback) { this.mAutopilotPlanningCallback = moGoAutopilotPlanningCallback; } + public void setADASStatusCallback(IOCHTaxiADASStatusCallback callback) { this.mADASStatusCallback = callback; } @@ -126,7 +130,7 @@ public class MogoOCHTaxiModelNew { this.mOrderStatusCallback = callback; } - public void init( Context context ) { + public void init(Context context) { mContext = context.getApplicationContext(); initListeners(); @@ -146,31 +150,31 @@ public class MogoOCHTaxiModelNew { public void accept(Throwable e) { if (e instanceof UndeliverableException) { e = e.getCause(); - Log.d(TAG,"UndeliverableException"); + Log.d(TAG, "UndeliverableException"); } if ((e instanceof IOException)) {// // fine, irrelevant network problem or API that throws on cancellation - Log.d(TAG,"IOException"); + Log.d(TAG, "IOException"); return; } if (e instanceof InterruptedException) { // fine, some blocking code was interrupted by a dispose call - Log.d(TAG,"InterruptedException"); + Log.d(TAG, "InterruptedException"); return; } if ((e instanceof NullPointerException) || (e instanceof IllegalArgumentException)) { // that's likely a bug in the application - Log.d(TAG,"NullPointerException or IllegalArgumentException"); + Log.d(TAG, "NullPointerException or IllegalArgumentException"); Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e); return; } if (e instanceof IllegalStateException) { // that's a bug in RxJava or in a custom operator - Log.d(TAG,"IllegalStateException"); + Log.d(TAG, "IllegalStateException"); Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e); return; } - Log.d(TAG,"Undeliverable exception"); + Log.d(TAG, "Undeliverable exception"); } }); @@ -180,7 +184,7 @@ public class MogoOCHTaxiModelNew { } } - public void startOrStopOrderLoop(){ + public void startOrStopOrderLoop() { if (NetworkUtils.isConnected(mContext)) { startOrStopOrderLoop(mOCHCarStatus == 1); } @@ -195,26 +199,26 @@ public class MogoOCHTaxiModelNew { MogoApisHandler.getInstance() .getApis() .getSocketManagerApi(mContext) - .registerLifecycleListener(10010,mSocketLifeCycleLisnter); + .registerLifecycleListener(10010, mSocketLifeCycleLisnter); // 2021.11.1重构自动驾驶 实现接口 IMoGoAutopilotStatusListener 注册监听 替换IMogoAdasOCHCallback接口 CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, mGoAutopilotStatusListener); MogoApisHandler.getInstance() .getApis() .getIntentManagerApi() - .registerIntentListener( ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener ); + .registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener); MogoApisHandler.getInstance() .getApis() .getStatusManagerApi() - .registerStatusChangedListener( TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener ); + .registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener); // 达到起始站围栏监听 MogoApisHandler.getInstance() .getApis() .getRegisterCenterApi() - .registerCarLocationChangedListener( TAG, mCarLocationChangedListener2); + .registerCarLocationChangedListener(TAG, mCarLocationChangedListener2); //2021.11.1 自动驾驶路线规划接口 - CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG,moGoAutopilotPlanningListener); + CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, moGoAutopilotPlanningListener); } private void releaseListeners() { @@ -275,13 +279,14 @@ public class MogoOCHTaxiModelNew { } @Override - public void onFail(int code, String msg) { } + public void onFail(int code, String msg) { + } }); } //更新出车收车状态 public void updateCarStatus() { - if ( mOCHCarStatus == -1){ + if (mOCHCarStatus == -1) { queryCarStatus(); return; } @@ -316,7 +321,7 @@ public class MogoOCHTaxiModelNew { /** * 查询订单状态:进行中/待服务(轮询防止因crash导致应用重启、断网没收到推送等) - * + *

* 注:只有在本地缓存mCurrentOCHOrder为null时(已完成or已取消有明确结果)或id相同且status不同时, * 才更新最新进行中单到本地 */ @@ -424,7 +429,7 @@ public class MogoOCHTaxiModelNew { //更新当前订单状态 public void updateOCHOrderStatus(final OrderStatusEnum orderStatus) { - if ( mCurrentOCHOrder == null ) { + if (mCurrentOCHOrder == null) { return; } final long orderId = mCurrentOCHOrder.orderId; @@ -550,7 +555,7 @@ public class MogoOCHTaxiModelNew { /** * 查询新到预约单 - * + *

* 注:只有在本地缓存mNewBookingOrder为null时(执行完抢单or司机关闭改单),才更新新到待抢单 */ public void queryNewBookingOrder() { @@ -561,7 +566,7 @@ public class MogoOCHTaxiModelNew { if (data != null && data.code == 0 && data.data != null && data.data.orders.size() > 0) { // 本地无新到单,且本次新到单id与上次收到的新单id不同时:显示本次新到单 - if (mNewBookingOrder == null ) { + if (mNewBookingOrder == null) { for (Long orderId : data.data.orders) { if (mPrevOrderId != orderId.longValue()) { queryNewBookingContent(orderId.longValue()); @@ -765,7 +770,7 @@ public class MogoOCHTaxiModelNew { //检测当前订单 public boolean checkCurrentOCHOrder() { - if ( mCurrentOCHOrder != null + if (mCurrentOCHOrder != null && mCurrentOCHOrder.startSiteGcjPoint != null && mCurrentOCHOrder.endSiteGcjPoint != null) { return true; @@ -776,7 +781,7 @@ public class MogoOCHTaxiModelNew { //以当前订单为基础,开启自动驾驶 public void startAutoPilot() { if (!checkCurrentOCHOrder()) { - Logger.e( TAG, "no order or order is empty." ); + Logger.e(TAG, "no order or order is empty."); TipToast.shortTip("当前订单不存在或异常!"); return; } @@ -800,7 +805,7 @@ public class MogoOCHTaxiModelNew { parameters.endLatLon = new AutopilotControlParameters.AutoPilotLonLat(endWgsLat, endWgsLon); CallerAutoPilotManager.INSTANCE.startAutoPilot(parameters); Logger.d(TAG, "start autopilot with parameter: %s", GsonUtil.jsonFromObject(parameters) - +" ,startSiteName="+ mCurrentOCHOrder.startSiteAddr+" ,endSiteName="+mCurrentOCHOrder.endSiteAddr); + + " ,startSiteName=" + mCurrentOCHOrder.startSiteAddr + " ,endSiteName=" + mCurrentOCHOrder.endSiteAddr); if (DebugConfig.isDebug()) { // TipToast.shortTip("Start autopilot!"); } @@ -814,7 +819,7 @@ public class MogoOCHTaxiModelNew { try { CallerAutoPilotManager.INSTANCE.cancelAutoPilot(); Logger.d(TAG, "结束自动驾驶"); - } catch ( Exception e ) { + } catch (Exception e) { e.printStackTrace(); } } @@ -829,7 +834,7 @@ public class MogoOCHTaxiModelNew { double startLat = mCurrentOCHOrder.startSiteGcjPoint.get(1); double distance = CoordinateUtils.calculateLineDistance( startLon, startLat, - location.getLongitude(), location.getLatitude() ); + location.getLongitude(), location.getLatitude()); if (DebugConfig.isDebug() && mCurrentOCHOrder.orderStatus == OrderStatusEnum.OnTheWayToStartStation.getCode()) { // TipToast.shortTip("距离上车点:" + Double.valueOf(distance).intValue()); @@ -840,21 +845,21 @@ public class MogoOCHTaxiModelNew { // mOrderStatusCallback.onCurrentOrderDistToStartChanged((long) distance, 0); // } - if ( distance > OCHTaxiConst.ARRIVE_AT_START_STATION_DISTANCE ) { + if (distance > OCHTaxiConst.ARRIVE_AT_START_STATION_DISTANCE) { distance = CoordinateUtils.calculateLineDistance(startLon, startLat, MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon(), - MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat() ); + MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat()); } - if ( distance <= OCHTaxiConst.ARRIVE_AT_START_STATION_DISTANCE ) { - updateOCHOrderStatus( OrderStatusEnum.ArriveAtStartStation); + if (distance <= OCHTaxiConst.ARRIVE_AT_START_STATION_DISTANCE) { + updateOCHOrderStatus(OrderStatusEnum.ArriveAtStartStation); return; } } // TODO: 2021/9/12 - public void calculateTravelDistance(Location carLocation){ - if (checkCurrentOCHOrder() && mCurrentOCHOrder.endSiteGcjPoint.size()>0) { + public void calculateTravelDistance(Location carLocation) { + if (checkCurrentOCHOrder() && mCurrentOCHOrder.endSiteGcjPoint.size() > 0) { double endLon = mCurrentOCHOrder.endSiteGcjPoint.get(0); double endLat = mCurrentOCHOrder.endSiteGcjPoint.get(1); double distance = CoordinateUtils.calculateLineDistance( @@ -870,10 +875,10 @@ public class MogoOCHTaxiModelNew { //监听网络变化,避免启动机器时无网导致无法更新订单信息 private IMogoIntentListener mNetWorkIntentListener = new IMogoIntentListener() { @Override - public void onIntentReceived( String intentStr, Intent intent ) { - Logger.d( TAG, "onIntentReceived = %s", intentStr ); - if ( ConnectivityManager.CONNECTIVITY_ACTION.equals( intentStr ) ) { - if ( NetworkUtils.isConnected( mContext ) ) { + public void onIntentReceived(String intentStr, Intent intent) { + Logger.d(TAG, "onIntentReceived = %s", intentStr); + if (ConnectivityManager.CONNECTIVITY_ACTION.equals(intentStr)) { + if (NetworkUtils.isConnected(mContext)) { startOrStopOrderLoop(mOCHCarStatus == 1); queryCarStatus(); } @@ -895,20 +900,26 @@ public class MogoOCHTaxiModelNew { private IMogoLifecycleListener mSocketLifeCycleLisnter = new IMogoLifecycleListener() { @Override - public void onConnectFailure() { Logger.e(TAG,"socket onConnectFailure"); } + public void onConnectFailure() { + Logger.e(TAG, "socket onConnectFailure"); + } @Override - public void onConnectSuccess() { Logger.e(TAG,"socket onConnectSuccess"); } + public void onConnectSuccess() { + Logger.e(TAG, "socket onConnectSuccess"); + } @Override - public void onConnectLost() { Logger.e(TAG,"socket onConnectLost"); } + public void onConnectLost() { + Logger.e(TAG, "socket onConnectLost"); + } }; // 自车定位 private IMogoCarLocationChangedListener2 mCarLocationChangedListener2 = new IMogoCarLocationChangedListener2() { @Override - public void onCarLocationChanged2( Location location ) { + public void onCarLocationChanged2(Location location) { IMogoServiceApis apis = MogoApisHandler.getInstance().getApis(); MogoLocation mogoLocation = new MogoLocation(); mogoLocation.setAccuracy(location.getAccuracy()); @@ -970,13 +981,19 @@ public class MogoOCHTaxiModelNew { } updateOCHOrderStatus(OrderStatusEnum.OnTheWayToEndStation); } - private IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener(){ + + private final IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener() { + + @Override + public void onAutopilotGuardian(@Nullable MogoReportMsg.MogoReportMessage guardianInfo) { + + } @Override public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autopilotStatusInfo) { if (autopilotStatusInfo == null) return; int state = autopilotStatusInfo.getState(); - Logger.d( TAG, "state = %s", state ); + Logger.d(TAG, "state = %s", state); if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) { if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotRunning(); if (mCurrentOCHOrder != null @@ -1018,12 +1035,7 @@ public class MogoOCHTaxiModelNew { } @Override - public void onAutopilotGuardian(@Nullable AutopilotGuardianStatusInfo autopilotGuardianStatusInfo) { - - } - - @Override - public void onAutopilotArriveAtStation(@Nullable AutopilotStationInfo data) { + public void onAutopilotArriveAtStation(MessagePad.ArrivalNotification data) { if (data == null || !checkCurrentOCHOrder() || (getCurOrderStatus() == OrderStatusEnum.ArriveAtEndStation)) { return; @@ -1034,21 +1046,20 @@ public class MogoOCHTaxiModelNew { updateOCHOrderStatus(OrderStatusEnum.ArriveAtEndStation); } }; - private IMoGoAutopilotPlanningListener moGoAutopilotPlanningListener = new IMoGoAutopilotPlanningListener(){ + private final IMoGoAutopilotPlanningListener moGoAutopilotPlanningListener = new IMoGoAutopilotPlanningListener() { + + @Override + public void onAutopilotRotting(MessagePad.GlobalPathResp globalPathResp) { + if (null != globalPathResp && globalPathResp.getWayPointsList().size() > 0) { + mAutopilotPlanningCallback.routeResult(globalPathResp.getWayPointsList()); + } + } @Override public void onAutopilotTrajectory(ArrayList trajectoryInfos) { } - @Override - public void onAutopilotRotting(AutopilotRouteInfo routeList) { - if (null != routeList && routeList.getModels() != null){ - mAutopilotPlanningCallback.routeResult(routeList.getModels()); - } - } }; - /** - * END - */ + } diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/presenter/OCHTaxiPresenter.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/presenter/OCHTaxiPresenter.java index 8a1242200d..122346d703 100644 --- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/presenter/OCHTaxiPresenter.java +++ b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/presenter/OCHTaxiPresenter.java @@ -30,6 +30,8 @@ import org.jetbrains.annotations.NotNull; import java.util.List; +import mogo.telematics.pad.MessagePad; + /** * @author congtaowang * @since 2021/1/18 @@ -252,8 +254,9 @@ public class OCHTaxiPresenter extends Presenter implements IOCH mView.updateLocation(location.getLatitude(),location.getLongitude()); } } + @Override - public void routeResult(List models) { + public void routeResult(List models) { if (models != null && models.size() > 0) mView.routeResult(models); } } diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/BaseOchTaxiTabFragment.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/BaseOchTaxiTabFragment.java index 6542111b9c..0d8bab297d 100644 --- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/BaseOchTaxiTabFragment.java +++ b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/BaseOchTaxiTabFragment.java @@ -3,7 +3,6 @@ package com.mogo.och.taxi.ui; import android.animation.ObjectAnimator; import android.content.Intent; import android.graphics.drawable.AnimationDrawable; -import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.util.Log; @@ -16,7 +15,6 @@ import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; -import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.constraintlayout.widget.Group; import androidx.fragment.app.FragmentTransaction; @@ -27,11 +25,8 @@ import com.mogo.commons.mvp.IView; import com.mogo.commons.mvp.MvpFragment; import com.mogo.commons.mvp.Presenter; import com.mogo.commons.voice.AIAssist; -import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult; import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters; -import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage; import com.mogo.eagle.core.data.config.HmiBuildConfig; -import com.mogo.eagle.core.data.traffic.TrafficData; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener; import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager; @@ -48,7 +43,8 @@ import com.mogo.module.common.constants.DataTypes; import com.mogo.module.common.view.OnPreventFastClickListener; import com.mogo.och.taxi.R; -import java.util.ArrayList; +import mogo.telematics.pad.MessagePad; +import record_cache.RecordPanelOuterClass; /** @@ -71,7 +67,7 @@ public abstract class BaseOchTaxiTabFragment { - Log.d(TAG,"长按显示状态工具栏"); + Log.d(TAG, "长按显示状态工具栏"); Intent intent = new Intent(); intent.putExtra("oper", 52); MogoApisHandler.getInstance().getApis().getIntentManagerApi().invoke("com.mogo.mock", intent); @@ -176,7 +172,7 @@ public abstract class BaseOchTaxiTabFragment { // if (groupTestPanel.getVisibility() == View.VISIBLE) { - groupTestPanel.setVisibility(View.GONE); + groupTestPanel.setVisibility(View.GONE); // } else { // groupTestPanel.setVisibility(View.VISIBLE); // } @@ -234,9 +230,9 @@ public abstract class BaseOchTaxiTabFragment trafficData) { } - - @Override - public void onAutopilotRecordResult(@Nullable AutoPilotRecordResult record) { - if (!HmiBuildConfig.isShowBadCaseView && record != null && record.getType() == 1 && record.getStat() == 100) { - CallerDevaToolsManager.INSTANCE.onReceiveBadCaseRecord(record); + public void onAutopilotRecordResult(@Nullable RecordPanelOuterClass.RecordPanel recordPanel) { + if (!HmiBuildConfig.isShowBadCaseView && recordPanel != null && recordPanel.getType() == 1 && recordPanel.getStat() == 100) { + CallerDevaToolsManager.INSTANCE.onReceiveBadCaseRecord(recordPanel); } } @Override - public void onAutopilotWarnMessage(@Nullable AutopilotWarnMessage autopilotWarnMessage) { } + public void onAutopilotWarnMessage(MessagePad.Warn warn) { + } public void showNotice(String notice) { getActivity().runOnUiThread(() -> { @@ -293,6 +287,7 @@ public abstract class BaseOchTaxiTabFragment { if (isStarting && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING != status) { @@ -321,7 +316,8 @@ public abstract class BaseOchTaxiTabFragment { if (tvOperationStatus == null) return; tvOperationStatus.setVisibility(visible); }); } - public void updateSpeedView(float newSpeed){ + public void updateSpeedView(float newSpeed) { int speed = (int) (Math.abs(newSpeed) * 3.6F); // 倒车时工控机反馈定位信息中speed为负值 mSpeedView.setText(String.valueOf(speed)); } @@ -490,22 +487,22 @@ public abstract class BaseOchTaxiTabFragment routeList) { + public void routeResult(List routeList) { if (routeList == null ) return; // double distance = calculateTravelDistance(mogoLocation,routeList); // if ( MogoOCHTaxiModel.getInstance().checkCurrentOCHOrder() ) { @@ -330,4 +334,9 @@ public class OCHTaxiFragment extends BaseOchTaxiTabFragment trafficData) { + + } } diff --git a/app/src/androidTest/java/com/mogo/functions/test/AutoPilotBadCaseTest.kt b/app/src/androidTest/java/com/mogo/functions/test/AutoPilotBadCaseTest.kt index eeefe099fd..33b6edda37 100644 --- a/app/src/androidTest/java/com/mogo/functions/test/AutoPilotBadCaseTest.kt +++ b/app/src/androidTest/java/com/mogo/functions/test/AutoPilotBadCaseTest.kt @@ -11,6 +11,7 @@ import kotlinx.coroutines.flow.* import org.junit.Before import org.junit.Test import org.junit.runner.RunWith +import record_cache.RecordPanelOuterClass import java.text.SimpleDateFormat import java.util.* import java.util.concurrent.TimeUnit @@ -20,14 +21,15 @@ import kotlin.random.Random @LargeTest class AutoPilotBadCaseTest { - lateinit var launch: ActivityScenario + private lateinit var launch: ActivityScenario @Before fun launch() { launch = ActivityScenario.launch(MainLauncherActivity::class.java) } - @ExperimentalCoroutinesApi @Test + @ExperimentalCoroutinesApi + @Test fun showBadCaseEntrance1(): Unit = runBlocking(Dispatchers.Main) { delay(5000) var index = 0 @@ -36,17 +38,19 @@ class AutoPilotBadCaseTest { .asFlow() .onEach { delay(TimeUnit.SECONDS.toMillis(5)) - CallerDevaToolsManager.onReceiveBadCaseRecord(AutoPilotRecordResult().also { + val builder = RecordPanelOuterClass.RecordPanel.newBuilder() + builder.also { it.diskFree = (100 + index).toLong() - it.duration = 60.0 - it.fileName = "/user/general/record_$index.log" + it.duration = 60.0.toFloat() + it.filename = "/user/general/record_$index.log" it.id = 10 + index - it.key = "yyy_$index" + it.key = index.toLong() it.stat = 100 it.type = 1 it.timestamp = SimpleDateFormat("yyyyMMddHHmmss").format(Date()) index++ - }) + } + CallerDevaToolsManager.onReceiveBadCaseRecord(builder.build()) } .flowOn(Dispatchers.Default) .collect() @@ -54,8 +58,9 @@ class AutoPilotBadCaseTest { } - @ExperimentalCoroutinesApi @Test - fun showBadCaseEntrance2():Unit = runBlocking(Dispatchers.Main) { + @ExperimentalCoroutinesApi + @Test + fun showBadCaseEntrance2(): Unit = runBlocking(Dispatchers.Main) { delay(5000) var index = 0 (1 until 50) @@ -67,24 +72,27 @@ class AutoPilotBadCaseTest { } else { delay(Random(20).nextLong()) } - CallerDevaToolsManager.onReceiveBadCaseRecord(AutoPilotRecordResult().also { + val builder = RecordPanelOuterClass.RecordPanel.newBuilder() + builder.also { it.diskFree = (100 + index).toLong() - it.duration = 60.0 - it.fileName = "/user/general/record_$index.log" + it.duration = 60.0.toFloat() + it.filename = "/user/general/record_$index.log" it.id = 10 + index - it.key = "yyy_$index" + it.key = index.toLong() it.stat = 100 it.type = 1 it.timestamp = SimpleDateFormat("yyyyMMddHHmmss").format(Date()) index++ - }) + } + CallerDevaToolsManager.onReceiveBadCaseRecord(builder.build()) } .flowOn(Dispatchers.Default) .collect() delay(TimeUnit.HOURS.toMillis(2)) } - @ExperimentalCoroutinesApi @Test + @ExperimentalCoroutinesApi + @Test fun showBadCaseEntrance3(): Unit = runBlocking(Dispatchers.Main) { var index = 0 (1 until 50) @@ -92,17 +100,19 @@ class AutoPilotBadCaseTest { .asFlow() .onEach { delay(TimeUnit.SECONDS.toMillis(20)) - CallerDevaToolsManager.onReceiveBadCaseRecord(AutoPilotRecordResult().also { + val builder = RecordPanelOuterClass.RecordPanel.newBuilder() + builder.also { it.diskFree = (100 + index).toLong() - it.duration = 60.0 - it.fileName = "/user/general/record_$index.log" + it.duration = 60.0.toFloat() + it.filename = "/user/general/record_$index.log" it.id = 10 + index - it.key = "yyy_$index" + it.key = index.toLong() it.stat = 100 it.type = 1 it.timestamp = SimpleDateFormat("yyyyMMddHHmmss").format(Date()) index++ - }) + } + CallerDevaToolsManager.onReceiveBadCaseRecord(builder.build()) } .flowOn(Dispatchers.Default) .collect() diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e9f00755d4..209b9e5144 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -13,6 +13,7 @@ android:label="@string/app_shell_name" android:largeHeap="true" android:resizeableActivity="false" + android:usesCleartextTraffic="true" android:supportsRtl="true" android:theme="@style/AppTheme.App" tools:replace="android:label"> diff --git a/app/src/main/java/com/mogo/launcher/MogoApplication.java b/app/src/main/java/com/mogo/launcher/MogoApplication.java index f7700b1668..9f1da4ce1a 100644 --- a/app/src/main/java/com/mogo/launcher/MogoApplication.java +++ b/app/src/main/java/com/mogo/launcher/MogoApplication.java @@ -38,7 +38,7 @@ public class MogoApplication extends MainMoGoApplication { @Override protected void initCloudClientConfig() { - // todo 使用旧Socket链路 true = 旧链路,false = 新链路 + // 使用旧Socket链路 true = 旧链路,false = 新链路 if (DebugConfig.getProductFlavor().equals("fPadLenovoOchTaxi") || DebugConfig.getProductFlavor().equals("fPadLenovoOchBus") || DebugConfig.getProductFlavor().equals("fPadLenovoOchTaxiPassenger") diff --git a/build.gradle b/build.gradle index 091b93c9bf..de22bddef0 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,8 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. apply from: "config.gradle" apply from: "javadoc.gradle" -buildscript { +buildscript { repositories { maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' } diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt index 35922bb084..52172f5177 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt @@ -20,7 +20,6 @@ import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr -import com.mogo.eagle.core.utilcode.util.GsonUtils import com.mogo.eagle.core.utilcode.util.ThreadUtils import com.mogo.eagle.core.utilcode.util.ToastUtils import com.mogo.telematic.MogoProtocolMsg @@ -35,7 +34,6 @@ import com.zhidao.support.adas.high.bean.IPCUpgradeInfo import com.zhidao.support.adas.high.common.Constants import com.zhidao.support.adas.high.common.CupidLogUtils import io.netty.channel.Channel -import java.util.* import java.util.concurrent.TimeUnit @@ -59,17 +57,16 @@ class MoGoAutopilotProvider : mContext = context // 初始化ADAS 域控制器 CupidLogUtils.setEnableLog(false) - CupidLogUtils.setIsWriteLog(false) // TODO 临时方案,根据不同的身份标识,连接不同的工控机IP if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {// 司机 // 注册地图采集功能 CallerMapDataCollectorManager.registerOnMapCollectTaskListener(this) // "192.168.1.102" val options = AdasOptions.Builder() - .setIpcConnectionMode(AdasOptions.IPC_CONNECTION_MODE.FIXATION) - .setIpcFixationIP(AdasManager.getInstance().getIPCFixationIPList(mContext)) - .setClient(false) - .build() + .setIpcConnectionMode(AdasOptions.IPC_CONNECTION_MODE.FIXATION) + .setIpcFixationIP(AdasManager.getInstance().getIPCFixationIPList(mContext)) + .setClient(false) + .build() AdasManager.getInstance().create(options, MoGoAdasMsgConnectStatusListenerImpl()) NSDNettyManager.getInstance().startNSDNettyServerWithSN(context, object : @@ -103,9 +100,9 @@ class MoGoAutopilotProvider : //FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true // "192.168.1.103" val options = AdasOptions - .Builder() - .setClient(true) - .build() + .Builder() + .setClient(true) + .build() AdasManager.getInstance().create(options, MoGoAdasMsgConnectStatusListenerImpl()) NSDNettyManager.getInstance() .searchAndConnectServer(context, MoGoAiCloudClientConfig.getInstance().sn, object : @@ -175,8 +172,9 @@ class MoGoAutopilotProvider : SharedPrefsMgr.getInstance(it).putString(MoGoConfig.AUTOPILOT_IP, autoPilotIp) } // 设置IP地址 - AdasManager.getInstance().adasOptions.setIpcConnectionMode(AdasOptions.IPC_CONNECTION_MODE.ASSIGN) - AdasManager.getInstance().adasOptions.setIpcAssignIP(autoPilotIp) + AdasManager.getInstance().adasOptions.ipcConnectionMode = + AdasOptions.IPC_CONNECTION_MODE.ASSIGN + AdasManager.getInstance().adasOptions.ipcAssignIP = autoPilotIp // 打开通讯连接 AdasManager.getInstance().connect() return "" @@ -201,7 +199,7 @@ class MoGoAutopilotProvider : override fun startAutoPilot(result: AutopilotControlParameters) { if (AdasManager.getInstance().ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTED) { val parameter = AutopilotControlCmdParameter("aiCloudToStartAutopilot", result) - AdasManager.getInstance().aiCloudToAdasData(GsonUtils.toJson(parameter)) +// AdasManager.getInstance().aiCloudToAdasData(GsonUtils.toJson(parameter)) //todo pb : 需要指定来源 } else { Logger.e(TAG, "车机与工控机链接失败,无法开启自动驾驶") } @@ -213,7 +211,7 @@ class MoGoAutopilotProvider : override fun cancelAutoPilot() { if (AdasManager.getInstance().ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTED) { - AdasManager.getInstance().controlAutopilotCarHead() +// AdasManager.getInstance().controlAutopilotCarHead() //todo pb : 需要指定来源 } else { Logger.e(TAG, "车机与工控机链接失败,无法断开自动驾驶") } @@ -221,35 +219,31 @@ class MoGoAutopilotProvider : override fun recordPackage(): Boolean { return AdasManager.getInstance() - .recordPackage(1, (System.currentTimeMillis() / 1000).toInt()) + .startRecordPackage((System.currentTimeMillis() / 1000).toInt(), 1) } override fun recordPackage(type: Int, id: Int): Boolean { - return AdasManager.getInstance().recordPackage(type, id) + return AdasManager.getInstance().startRecordPackage(id, type) } override fun recordPackage(type: Int, id: Int, duration: Int): Boolean { - return AdasManager.getInstance().recordPackage(type, id, duration) + return AdasManager.getInstance().startRecordPackage(id, duration, type) } override fun stopRecord(type: Int, id: Int): Boolean { - return AdasManager.getInstance().stopRecord(type, id) + return AdasManager.getInstance().stopRecordPackage(id, type) } override fun setEnableLog(isEnableLog: Boolean) { CupidLogUtils.setEnableLog(isEnableLog) } - override fun setIsWriteLog(isWriteLog: Boolean) { - CupidLogUtils.setIsWriteLog(isWriteLog) - } - override fun onDestroy() { CallerMapDataCollectorManager.unRegisterOnMapCollectTaskListener(this) } override fun setAutoPilotSpeed(speed: Int): Boolean { - return AdasManager.getInstance().setSpeed(speed) + return AdasManager.getInstance().sendAutopilotSpeedReq(speed.toDouble()) } override fun setIPCShutDown() { @@ -261,21 +255,24 @@ class MoGoAutopilotProvider : } override fun recordCause(key: String?, name: String?, id: String?, reason: String?) { - AdasManager.getInstance().recordCause(key, name, id, reason) + key?.let { + AdasManager.getInstance() + .sendRecordCause(it.toLong(), name ?: "", id ?: "", reason ?: "") + } } /** * 工控机升级确认 */ override fun setIPCUpgradeAffirm() { - AdasManager.getInstance().sendBaseInfo(IPCUpgradeInfo.affirm()); + AdasManager.getInstance().sendBaseInfo(IPCUpgradeInfo.affirm()) } /** * 工控机升级取消 */ override fun setIPCUpgradeCancel() { - AdasManager.getInstance().sendBaseInfo(IPCUpgradeInfo.cancel()); + AdasManager.getInstance().sendBaseInfo(IPCUpgradeInfo.cancel()) } /** @@ -285,22 +282,22 @@ class MoGoAutopilotProvider : */ override fun setDemoMode(isEnable: Boolean) { if (isEnable) { - AdasManager.getInstance().enableDemoMode() + AdasManager.getInstance().sendDemoModeReq(1) } else { - AdasManager.getInstance().disableDemoMode() + AdasManager.getInstance().sendDemoModeReq(0) } } /** - * 办公室调试使用,强制开启自动驾驶,将 status,pilotmode,control_pilotmode,强追设置为 1 + * 办公室调试使用,强制开启自动驾驶,将 status,pilotMode,control_pilotMode,强追设置为 1 * isEnable = true 开启 * isEnable = false 关闭 */ override fun setControlAutopilotCarAuto(isEnable: Boolean) { if (isEnable) { - AdasManager.getInstance().controlAutopilotCarAuto() +// AdasManager.getInstance().sendAutoPilotModeReq() //todo pb : 需要指定来源 } else { - AdasManager.getInstance().controlAutopilotCarHead() +// AdasManager.getInstance().sendAutoPilotModeReq() //todo pb : 需要指定来源 } } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt new file mode 100644 index 0000000000..0883ebd287 --- /dev/null +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt @@ -0,0 +1,310 @@ +package com.mogo.eagle.core.function.autopilot.adapter + +import chassis.VehicleStateOuterClass +import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo +import com.mogo.eagle.core.data.config.FunctionBuildConfig +import com.mogo.eagle.core.data.config.HdMapBuildConfig +import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ARRIVE +import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_GUARDIAN +import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_RECORD +import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ROUTE +import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_STATUS +import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_TRAJECTORY +import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_WARN +import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_CAR_STATE +import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_RECT_DATA +import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_ADAS +import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_WEB_SOCKET_DATA +import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo +import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeArriveAtStation +import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutoPilotStatus +import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotGuardian +import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotSNRequest +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager.invokeAutopilotCarConfigData +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager.invokeAutopilotCarStateData +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager.invokeAutopilotIdentifyDataUpdate +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager.invokeAutopilotRecordResult +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager.invokeAutopilotWarnMessage +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager.invokeAutopilotRotting +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager.invokeAutopilotTrajectory +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager +import com.mogo.eagle.core.function.call.hmi.CallerHmiManager +import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showAdUpgradeStatus +import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showDockerRebootResult +import com.mogo.eagle.core.utilcode.mogo.logger.Logger +import com.mogo.module.common.MogoApisHandler +import com.mogo.module.common.datacenter.SnapshotLocationDataCenter +import com.mogo.module.service.MarkerServiceHandler +import com.zhidao.support.adas.high.AdasManager +import com.zhidao.support.adas.high.OnAdasListener +import com.zhidao.support.adas.high.bean.IPCUpgradeStateInfo +import com.zhidao.support.adas.high.bean.SSHResult +import com.zhidao.support.adas.high.common.ProtocolStatus +import com.zhjt.service.chain.ChainLog +import com.zhjt.service.chain.TracingConstants.Endpoint.Companion.PAD +import mogo.telematics.pad.MessagePad +import mogo.telematics.pad.MessagePad.TrackedObject +import mogo_msg.MogoReportMsg +import record_cache.RecordPanelOuterClass +import java.util.* + +/** + * @author emarrow + * @since 2022/3/11 + * + * + * 适配ADAS 回调监听分发,这里不做业务,只做数据包装及分发处理 + */ +class MoGoAdasListenerImpl : OnAdasListener { + + companion object { + const val TAG = "OnAdasListenerAdapter" + } + + @ChainLog( + linkCode = CHAIN_LINK_ADAS, + endpoint = PAD, + nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_TRAJECTORY, + paramIndexes = [0, 1], + clientPkFileName = "sn" + ) + override fun onTrajectory(header: MessagePad.Header, trajectory: MessagePad.Trajectory?) { + if (HdMapBuildConfig.isMapLoaded) { + val trajectoryInfoArrayList = ArrayList() + if (trajectory != null && trajectory.pointsList.size > 0) { + for (trajectory in trajectory.pointsList) { + val adasTrajectoryInfo = ADASTrajectoryInfo() + adasTrajectoryInfo.lat = trajectory.latitude + adasTrajectoryInfo.lon = trajectory.longitude + adasTrajectoryInfo.acceleration = trajectory.acceleration + adasTrajectoryInfo.accumulatedDis = trajectory.accumulatedDis + adasTrajectoryInfo.time = trajectory.time + adasTrajectoryInfo.velocity = trajectory.velocity + adasTrajectoryInfo.alt = trajectory.altitude + adasTrajectoryInfo.kappa = trajectory.kappa + adasTrajectoryInfo.theta = trajectory.theta + trajectoryInfoArrayList.add(adasTrajectoryInfo) + } + } + invokeAutopilotTrajectory(trajectoryInfoArrayList) + } + } + + @ChainLog( + linkCode = CHAIN_LINK_ADAS, + linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA, + endpoint = PAD, + nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_RECT_DATA, + paramIndexes = [0, 1], + clientPkFileName = "sn" + ) + override fun onTrackedObjects( + header: MessagePad.Header, + trackedObjects: MessagePad.TrackedObjects + ) { + if (HdMapBuildConfig.isMapLoaded) { + invokeAutopilotIdentifyDataUpdate(trackedObjects.objsList as ArrayList?) + } + } + + @ChainLog( + linkCode = CHAIN_LINK_ADAS, + linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA, + endpoint = PAD, + nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_CAR_STATE, + paramIndexes = [0, 1], + clientPkFileName = "sn" + ) + override fun onGnssInfo(header: MessagePad.Header, gnssInfo: MessagePad.GnssInfo?) { + invokeAutopilotCarStateData(gnssInfo) + // 同步给MAP地图 + if (gnssInfo != null) { + MogoApisHandler.getInstance().apis.adasControllerApi.lastLat = gnssInfo.latitude + MogoApisHandler.getInstance().apis.adasControllerApi.lastLon = gnssInfo.longitude + MogoApisHandler.getInstance().apis.adasControllerApi.satelliteTime = + java.lang.Double.valueOf(gnssInfo.satelliteTime).toLong() + if (1 == FunctionBuildConfig.gpsProvider) { + MarkerServiceHandler.getApis().mapServiceApi.mapUIController.syncLocation2Map( + gnssInfo + ) + SnapshotLocationDataCenter.getInstance().syncAdasLocationInfo(gnssInfo) + } + } + } + + override fun onVehicleState( + header: MessagePad.Header, + vehicleState: VehicleStateOuterClass.VehicleState? + ) { + if (vehicleState != null) { + //转向灯数据 + CallerAutopilotVehicleStateListenerManager.invokeAutopilotLightSwitchData(vehicleState.light) + //刹车灯数据 + CallerAutopilotVehicleStateListenerManager.invokeAutopilotBrakeLightData(vehicleState.brakeLightStatus) + } + } + + @ChainLog( + linkCode = CHAIN_LINK_ADAS, + linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA, + endpoint = PAD, + nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_STATUS, + paramIndexes = [0, 1], + clientPkFileName = "sn" + ) + override fun onAutopilotState( + header: MessagePad.Header, + autopilotState: MessagePad.AutopilotState? + ) { + if (autopilotState != null) { + if (HdMapBuildConfig.isMapLoaded) { + // 初始化自动驾驶状态信息 + val autopilotStatusInfo = getAutoPilotStatusInfo() + autopilotStatusInfo.state = autopilotState.state + autopilotStatusInfo.pilotmode = autopilotState.autopilotMode + autopilotStatusInfo.reason = autopilotState.reason + autopilotStatusInfo.camera = autopilotState.camera + autopilotStatusInfo.rtk = autopilotState.rtk + autopilotStatusInfo.radar = autopilotState.radar + autopilotStatusInfo.speed = autopilotState.speed.toFloat() + autopilotStatusInfo.version = AdasManager.getInstance().apVersion + if (autopilotStatusInfo.connectIP == null) { + autopilotStatusInfo.connectIP = AdasManager.getInstance().ipcConnectedIp + } + if (autopilotStatusInfo.dockVersion == null) { +// autopilotStatusInfo.dockVersion = +// AdasManager.getInstance() //todo pb : get docker + } + invokeAutoPilotStatus() + } + } + } + + @ChainLog( + linkCode = CHAIN_LINK_ADAS, + linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA, + endpoint = PAD, + nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_GUARDIAN, + paramIndexes = [0, 1], + clientPkFileName = "sn" + ) + override fun onReportMessage( + header: MessagePad.Header, + mogoReportMessage: MogoReportMsg.MogoReportMessage? + ) { + if (HdMapBuildConfig.isMapLoaded) { + invokeAutopilotGuardian(mogoReportMessage) + } + } + + override fun onBasicInfoReq( + header: MessagePad.Header, + basicInfoReq: MessagePad.BasicInfoReq? + ) { + invokeAutopilotSNRequest() + } + + override fun onCarConfigResp( + header: MessagePad.Header, + carConfigResp: MessagePad.CarConfigResp? + ) { + if (HdMapBuildConfig.isMapLoaded && carConfigResp != null) { + invokeAutopilotCarConfigData(carConfigResp) + } + } + + @ChainLog( + linkCode = CHAIN_LINK_ADAS, + linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA, + endpoint = PAD, + nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_RECORD, + paramIndexes = [0, 1], + clientPkFileName = "sn" + ) + override fun onRecordResult( + header: MessagePad.Header, + recordPanel: RecordPanelOuterClass.RecordPanel? + ) { + if (recordPanel != null) { + invokeAutopilotRecordResult(recordPanel) + } + } + + @ChainLog( + linkCode = CHAIN_LINK_ADAS, + linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA, + endpoint = PAD, + nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ROUTE, + paramIndexes = [0, 1], + clientPkFileName = "sn" + ) + override fun onGlobalPathResp( + header: MessagePad.Header, + globalPathResp: MessagePad.GlobalPathResp? + ) { + if (HdMapBuildConfig.isMapLoaded) { + invokeAutopilotRotting(globalPathResp) + } + } + + @ChainLog( + linkCode = CHAIN_LINK_ADAS, + linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA, + endpoint = PAD, + nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_WARN, + paramIndexes = [0, 1], + clientPkFileName = "sn" + ) + override fun onWarn(header: MessagePad.Header, warn: MessagePad.Warn?) { + invokeAutopilotWarnMessage(warn) + } + + @ChainLog( + linkCode = CHAIN_LINK_ADAS, + linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA, + endpoint = PAD, + nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ARRIVE, + paramIndexes = [0, 1], + clientPkFileName = "sn" + ) + override fun onArrivalNotification( + header: MessagePad.Header, + arrivalNotification: MessagePad.ArrivalNotification? + ) { + if (HdMapBuildConfig.isMapLoaded) { + invokeArriveAtStation(arrivalNotification) + } + } + + override fun onUpgradeStateInfo(info: IPCUpgradeStateInfo) { + if (info != null) { + Logger.d( + TAG, "onUpgradeStateInfo " + + " upgrade mode=" + info.upgradeMode + + " download status=" + info.downloadStatus + + " download progress current=" + info.progress.current + + " download progress total=" + info.progress.total + + " download version=" + info.images + + " upgrade status=" + info.upgradeStatus + ) + showAdUpgradeStatus( + info.upgradeMode, info.downloadStatus, info.progress.current, + info.progress.total, info.images, info.upgradeStatus + ) + } else { + Logger.d(TAG, "onUpgradeStateInfo : upgrade state info is null") + } + } + + override fun onSSHResult(info: SSHResult?) { + if (info != null && "docker restart autocar_default_1" == info.cmd) { + showDockerRebootResult(info.code, info.msg) + } else { + Logger.d(TAG, "onSSHResult : result info is null") + } + } + + override fun onError(status: ProtocolStatus, bytes: ByteArray) { + + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasMsgConnectStatusListenerImpl.kt b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasMsgConnectStatusListenerImpl.kt index b4fa7f381d..38d86dbb23 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasMsgConnectStatusListenerImpl.kt +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasMsgConnectStatusListenerImpl.kt @@ -2,7 +2,6 @@ package com.mogo.eagle.core.function.autopilot.adapter import com.mogo.cloud.passport.MoGoAiCloudClientConfig import com.mogo.commons.debug.DebugConfig -import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener import com.mogo.eagle.core.function.autopilot.network.AdasServiceModel @@ -10,11 +9,11 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.zhidao.support.adas.high.AdasManager import com.zhidao.support.adas.high.OnAdasConnectStatusListener -import com.zhidao.support.adas.high.bean.BasicInfo import com.zhidao.support.adas.high.common.Constants import io.reactivex.Flowable import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.schedulers.Schedulers +import mogo.telematics.pad.MessagePad import java.util.concurrent.TimeUnit /** @@ -38,7 +37,7 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener, Logger.d(TAG, "webSocket 连接成功") // 初始化自动驾驶状态信息 CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectIP = - AdasManager.getInstance().adasConfig.address + AdasManager.getInstance().ipcConnectedIp CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectStatus = true CallerAutoPilotStatusListenerManager.invokeAutoPilotStatus() @@ -50,7 +49,7 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener, } else if (ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.DISCONNECTED) { Logger.d(TAG, "webSocket 连接失败 reason:$reason") CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectIP = - AdasManager.getInstance().adasConfig.address + AdasManager.getInstance().ipcConnectedIp CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectStatus = false CallerAutoPilotStatusListenerManager.invokeAutoPilotStatus() } else if (ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTING) { @@ -70,10 +69,10 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener, syncBasicInfoToAutopilot() } - override fun onAutopilotArriveAtStation(autopilotWayArrive: AutopilotStationInfo?) { - if (autopilotWayArrive != null) { - val lon = autopilotWayArrive.lon - val lat = autopilotWayArrive.lat + override fun onAutopilotArriveAtStation(arrivalNotification: MessagePad.ArrivalNotification?) { + if (arrivalNotification != null && arrivalNotification.endLocation != null) { + val lon = arrivalNotification.endLocation.longitude + val lat = arrivalNotification.endLocation.latitude AdasServiceModel.getInstance().reportSite(lon, lat) } } @@ -90,12 +89,9 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener, */ private fun syncBasicInfoToAutopilot() { Logger.d(TAG, "同步PAD的SN给工控机……") - val info = BasicInfo() - // 设置PAD-SN给工控 - info.setSn(MoGoAiCloudClientConfig.getInstance().sn) - // 设置网络环境 - info.setNetEnvironment(DebugConfig.getNetMode()) - AdasManager.getInstance().setBasicInfo(info) + // 设置PAD-SN给工控,网络环境 + AdasManager.getInstance() + .sendBasicInfoResp(MoGoAiCloudClientConfig.getInstance().sn, DebugConfig.getNetMode()) } /** diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java index 3de8df06cd..abb479a00b 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java @@ -2,27 +2,25 @@ package com.mogo.eagle.core.function.autopilot.adapter; import androidx.annotation.Nullable; -import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult; -import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo; -import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage; import com.mogo.eagle.core.data.config.FunctionBuildConfig; -import com.mogo.eagle.core.data.traffic.TrafficData; -import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener; -import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager; +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener; import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager; +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager; import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.eagle.core.utilcode.util.ThreadUtils; import com.mogo.module.common.drawer.IdentifyDataDrawer; -import com.zhidao.support.adas.high.bean.CarStateInfo; import com.zhidao.support.obu.ami.AmiClientManager; import java.util.ArrayList; +import chassis.Chassis; +import mogo.telematics.pad.MessagePad; +import record_cache.RecordPanelOuterClass; + public class MoGoHandAdasMsgManager implements IMoGoAutopilotIdentifyListener, - IMoGoAutopilotCarStateListener { + IMoGoAutopilotVehicleStateListener { private final String TAG = "AdasEventManager"; @@ -30,7 +28,7 @@ public class MoGoHandAdasMsgManager implements private MoGoHandAdasMsgManager() { CallerAutopilotIdentifyListenerManager.INSTANCE.addListener(TAG, this); - CallerAutopilotCarStatusListenerManager.INSTANCE.addListener(TAG, this); + CallerAutopilotVehicleStateListenerManager.INSTANCE.addListener(TAG, this); } public static MoGoHandAdasMsgManager getInstance() { @@ -44,34 +42,25 @@ public class MoGoHandAdasMsgManager implements return moGoHandAdasMsgManager; } - @Override - public void onAutopilotCarStateData(@Nullable AutopilotCarStateInfo autoPilotCarStateInfo) { - // 获取的自动驾驶车辆信息不是空的时候 - if (autoPilotCarStateInfo != null) { - //can数据转发 - AutopilotCarStateInfo.ValuesBean bean = autoPilotCarStateInfo.getValues(); - - if (bean != null) { - //转向灯状态 0是正常 1是左转 2是右转 - //turnLightOften 是sdk适配的字段,后期建议CarStateInfo和AutopilotCarStateInfo统一成一个 - int turnLight = bean.getTurnLightOften(); - AmiClientManager.getInstance().setTurnLightState(turnLight); - int brakeLight = bean.getBrake_light(); -// Logger.d(TAG, "onCarStateData ---- turnLight = " + turnLight + "---brakeLight = " + brakeLight); - //设置转向灯 - CallerHmiManager.INSTANCE.showTurnLight(turnLight); - //设置刹车信息 - CallerHmiManager.INSTANCE.showBrakeLight(brakeLight); - } else { - Logger.e(TAG, "bean == null "); - } + public void onAutopilotLightSwitchData(Chassis.LightSwitch lightSwitch) { + //can数据转发 转向灯状态 0是正常 1是左转 2是右转 + if (lightSwitch != null) { + int turnLightNum = lightSwitch.getNumber(); + AmiClientManager.getInstance().setTurnLightState(turnLightNum); + //设置转向灯 + CallerHmiManager.INSTANCE.showTurnLight(turnLightNum); } } + @Override + public void onAutopilotBrakeLightData(boolean brakeLight) { + //设置刹车信息 + CallerHmiManager.INSTANCE.showBrakeLight(brakeLight ? 1 : 0); + } @Override - public void onAutopilotIdentifyDataUpdate(@Nullable ArrayList trafficData) { + public void onAutopilotIdentifyDataUpdate(@Nullable ArrayList trafficData) { try { if (FunctionBuildConfig.isDrawIdentifyData) { ThreadUtils.getSinglePool().execute(() -> @@ -86,13 +75,13 @@ public class MoGoHandAdasMsgManager implements } @Override - public void onAutopilotWarnMessage(@Nullable AutopilotWarnMessage autopilotWarnMessage) { + public void onAutopilotWarnMessage(MessagePad.Warn warn) { } - @Override - public void onAutopilotRecordResult(AutoPilotRecordResult result) { + public void onAutopilotRecordResult(RecordPanelOuterClass.RecordPanel recordPanel) { } + } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/DevaToolsProvider.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/DevaToolsProvider.kt index b277007967..cc30471b3c 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/DevaToolsProvider.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/DevaToolsProvider.kt @@ -5,12 +5,12 @@ import android.content.Context import android.view.View import com.alibaba.android.arouter.facade.annotation.Route import com.mogo.eagle.core.data.deva.chain.ChainLogParam -import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult import com.mogo.eagle.core.data.constants.MogoServicePaths import com.mogo.eagle.core.function.api.devatools.IDevaToolsProvider import com.zhjt.mogo_core_function_devatools.badcase.BadCaseManager import com.zhjt.mogo_core_function_devatools.logcatch.MogoLogCatchManager import com.zhjt.mogo_core_function_devatools.trace.TraceManager.Companion.traceManager +import record_cache.RecordPanelOuterClass @Route(path = MogoServicePaths.PATH_DEVA_TOOLS) class DevaToolsProvider : IDevaToolsProvider { @@ -52,7 +52,7 @@ class DevaToolsProvider : IDevaToolsProvider { BadCaseManager.init(view, onShow, onHide) } - override fun onReceiveBadCaseRecord(record: AutoPilotRecordResult) { + override fun onReceiveBadCaseRecord(record: RecordPanelOuterClass.RecordPanel) { BadCaseManager.onReceiveBadCaseRecord(record) } diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/BadCaseManager.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/BadCaseManager.kt index 922bf86078..84802b0795 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/BadCaseManager.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/BadCaseManager.kt @@ -12,7 +12,6 @@ import androidx.lifecycle.LifecycleEventObserver import androidx.lifecycle.LifecycleOwner import androidx.lifecycle.lifecycleScope import com.mogo.cloud.passport.MoGoAiCloudClientConfig -import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult import com.mogo.eagle.core.function.call.hmi.CallerHmiManager import com.mogo.eagle.core.utilcode.kotlin.lifecycleOwner import com.mogo.eagle.core.utilcode.kotlin.onClick @@ -24,6 +23,7 @@ import com.zhjt.mogo_core_function_devatools.badcase.mvp.BadCaseView import com.zhjt.mogo_core_function_devatools.badcase.repository.db.entity.AutoPilotRecord import kotlinx.coroutines.* import kotlinx.coroutines.channels.Channel +import record_cache.RecordPanelOuterClass import java.lang.ref.WeakReference import java.util.concurrent.TimeUnit @@ -164,7 +164,7 @@ internal object BadCaseManager : LifecycleEventObserver { return oldT == 0L || newT == 0L || (newT - oldT >= 0 && (newT - oldT) < CASE_EXPIRE_DURATION) } - fun onReceiveBadCaseRecord(record: AutoPilotRecordResult) { + fun onReceiveBadCaseRecord(record: RecordPanelOuterClass.RecordPanel) { scope?.launch { val newRecord = record.toRecord() withContext(Dispatchers.IO) { @@ -267,15 +267,15 @@ fun T.toggle(show: Boolean) { } } -internal fun AutoPilotRecordResult.toRecord(): AutoPilotRecord = AutoPilotRecord().also { +internal fun RecordPanelOuterClass.RecordPanel.toRecord(): AutoPilotRecord = AutoPilotRecord().also { it.id = this.id it.stat = this.stat - it.key = this.key + it.key = this.key.toString() it.note = this.note it.type = this.type - it.total = this.total - it.fileName = this.fileName - it.duration = this.duration + it.total = this.totalSize + it.fileName = this.filename + it.duration = this.duration.toDouble() it.diskFree = this.diskFree it.consumed = false } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/logcatch/MogoLogCatchManager.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/logcatch/MogoLogCatchManager.kt index 8b97348d10..666439f45c 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/logcatch/MogoLogCatchManager.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/logcatch/MogoLogCatchManager.kt @@ -170,7 +170,6 @@ object MogoLogCatchManager : IMogoOnMessageListener, Handl Logger.init(LogLevel.DEBUG) MoGoAiCloudClient.getInstance().aiCloudClientConfig.isShowDebugLog = true CallerAutoPilotManager.setEnableLog(true) - CallerAutoPilotManager.setIsWriteLog(true) } /** @@ -181,7 +180,6 @@ object MogoLogCatchManager : IMogoOnMessageListener, Handl Logger.init(if (DebugConfig.isDebug()) LogLevel.DEBUG else LogLevel.OFF) MoGoAiCloudClient.getInstance().aiCloudClientConfig.isShowDebugLog = false CallerAutoPilotManager.setEnableLog(false) - CallerAutoPilotManager.setIsWriteLog(false) } override fun onError(errorCount: Int) { diff --git a/core/function-impl/mogo-core-function-dispatch/src/main/java/com/zhjt/dispatch/DispatchAutoPilotManager.java b/core/function-impl/mogo-core-function-dispatch/src/main/java/com/zhjt/dispatch/DispatchAutoPilotManager.java index b34823291a..969c0b33ff 100644 --- a/core/function-impl/mogo-core-function-dispatch/src/main/java/com/zhjt/dispatch/DispatchAutoPilotManager.java +++ b/core/function-impl/mogo-core-function-dispatch/src/main/java/com/zhjt/dispatch/DispatchAutoPilotManager.java @@ -40,6 +40,9 @@ import static com.zhjt.dispatch.model.DispatchServiceModel.DISPATCH_RESULT_AFFIR import static com.zhjt.dispatch.model.DispatchServiceModel.DISPATCH_RESULT_MANUAL_CANCEL; import static com.zhjt.dispatch.model.DispatchServiceModel.DISPATCH_RESULT_TIMER_CANCEL; +import mogo.telematics.pad.MessagePad; +import mogo_msg.MogoReportMsg; + //负责监听自动驾驶状态并进行状态上报,自动驾驶路线上报,接收调度指令展示指令弹窗 public class DispatchAutoPilotManager implements IMogoOnMessageListener , IDispatchRemindClickListener, IMogoCarLocationChangedListener2, @@ -282,11 +285,18 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener list = new ArrayList<>(); + for (MessagePad.Location location : globalPathResp.getWayPointsList()) { + AutopilotRouteInfo.RouteModels routeModels = new AutopilotRouteInfo.RouteModels(); + routeModels.setLat(location.getLatitude()); + routeModels.setLon(location.getLongitude()); + list.add(routeModels); + } + DispatchServiceModel.getInstance().uploadAutopilotRoute(list); } @Override @@ -296,7 +306,7 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener } @OptIn(ExperimentalCoroutinesApi::class) - override fun onAutopilotRecordResult(record: AutoPilotRecordResult?) { + override fun onAutopilotRecordResult(record: RecordPanelOuterClass.RecordPanel) { record ?: return if (HmiBuildConfig.isShowBadCaseView && record.type == 1 && record.stat == 100) { CallerDevaToolsManager.onReceiveBadCaseRecord(record) } if (record.type == 2 && (record.stat == 101 || record.stat == 100)) { - CallerMapDataCollectorManager.finish(record.id, record.stat, "", record.fileName ?: "", record.note ?: "") + CallerMapDataCollectorManager.finish(record.id, record.stat, "", record.filename ?: "", record.note ?: "") } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt index 16c8d50e29..01f0f0e0d5 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt @@ -18,10 +18,7 @@ import com.mogo.eagle.core.data.enums.TrafficTypeEnum import com.mogo.eagle.core.data.map.MogoLocation import com.mogo.eagle.core.data.obu.ObuStatusInfo import com.mogo.eagle.core.data.traffic.TrafficData -import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener -import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener -import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener -import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener +import com.mogo.eagle.core.function.api.autopilot.* import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener import com.mogo.eagle.core.function.api.obu.IMoGoObuStatusListener @@ -53,6 +50,7 @@ import com.mogo.map.uicontroller.VisualAngleMode.MODE_LONG_SIGHT import com.mogo.map.uicontroller.VisualAngleMode.* import com.mogo.module.common.MogoApisHandler import kotlinx.android.synthetic.main.view_debug_setting.view.* +import mogo.telematics.pad.MessagePad import java.util.* /** @@ -62,13 +60,13 @@ import java.util.* * 展示 本机、网络、工控机、OBU等状态信息,支持设置IP,等参数进行调试 */ class DebugSettingView @JvmOverloads constructor( - context: Context, - attrs: AttributeSet? = null, - defStyleAttr: Int = 0 + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 ) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoObuStatusListener, - IMoGoAutopilotStatusListener, IMoGoAutopilotCarStateListener, - IMoGoMapLocationListener, IMoGoAutopilotIdentifyListener, - IMoGoAutopilotPlanningListener { + IMoGoAutopilotStatusListener, IMoGoAutopilotCarStateListener, + IMoGoMapLocationListener, IMoGoAutopilotIdentifyListener, + IMoGoAutopilotPlanningListener, IMoGoAutopilotCarConfigListener { private val TAG = "DebugSettingView" @@ -76,7 +74,7 @@ class DebugSettingView @JvmOverloads constructor( private var logViewAttach = false private var mAutoPilotStatusInfo: AutopilotStatusInfo? = null - private var mAutoPilotCarStateInfo: AutopilotCarStateInfo? = null + private var mGnssInfo: MessagePad.GnssInfo? = null // 感知识别「已知类型」数据个数 private var mIdentifyDataSize = 0 @@ -127,6 +125,8 @@ class DebugSettingView @JvmOverloads constructor( CallerAutopilotIdentifyListenerManager.addListener(TAG, this) // 添加 规划路径相关回调 监听 CallerAutopilotPlanningListenerManager.addListener(TAG, this) + // 添加 工控机基础信息回调 监听 + CallerAutopilotCarConfigListenerManager.addListener(TAG, this) if (logInfoView != null) { logInfoView!!.onEnterForeground() } @@ -251,14 +251,14 @@ class DebugSettingView @JvmOverloads constructor( tvObuInfo.text = CallerObuListenerManager.getObuStatusInfoJsonString() tvAutopilotInfo.text = - CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfoJsonString() + CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfoJsonString() // 绘制应用基本信息 drawAppInfo() // 初始化OBU IP信息 val ipAddress = - SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, "192.168.1.199") + SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, "192.168.1.199") etObuIP.setText(ipAddress) etObuIP.text?.let { etObuIP.setSelection(it.length) } @@ -274,8 +274,8 @@ class DebugSettingView @JvmOverloads constructor( // 初始化工控机 IP信息 val autoPilotIpAddress = - SharedPrefsMgr.getInstance(context) - .getString(MoGoConfig.AUTOPILOT_IP, FunctionBuildConfig.adasConnectIP) + SharedPrefsMgr.getInstance(context) + .getString(MoGoConfig.AUTOPILOT_IP, FunctionBuildConfig.adasConnectIP) etAutopilotIP.setText(autoPilotIpAddress) etAutopilotIP.text?.let { etAutopilotIP.setSelection(it.length) } @@ -296,18 +296,18 @@ class DebugSettingView @JvmOverloads constructor( // 初始化 GSP数据源 数据 rgGpsProvider.check( - when (FunctionBuildConfig.gpsProvider) { - 0 -> { - R.id.rbGpsProviderAndroid - } - 1 -> { - R.id.rbGpsProviderRTK - } - 2 -> { - R.id.rbGpsProviderOBU - } - else -> R.id.rbGpsProviderAndroid + when (FunctionBuildConfig.gpsProvider) { + 0 -> { + R.id.rbGpsProviderAndroid } + 1 -> { + R.id.rbGpsProviderRTK + } + 2 -> { + R.id.rbGpsProviderOBU + } + else -> R.id.rbGpsProviderAndroid + } ) rgGpsProvider.setOnCheckedChangeListener { group, checkedId -> when (checkedId) { @@ -380,10 +380,8 @@ class DebugSettingView @JvmOverloads constructor( tbADASLog.setOnCheckedChangeListener { _, isChecked -> if (isChecked) { CallerAutoPilotManager.setEnableLog(true) - CallerAutoPilotManager.setIsWriteLog(true) } else { CallerAutoPilotManager.setEnableLog(false) - CallerAutoPilotManager.setIsWriteLog(false) } } tbControlView.setOnCheckedChangeListener { _, isChecked -> @@ -395,11 +393,11 @@ class DebugSettingView @JvmOverloads constructor( } tbLogCatch.isChecked = - SharedPrefsMgr.getInstance(context).getBoolean(MoGoConfig.CATCH_LOG, false) + SharedPrefsMgr.getInstance(context).getBoolean(MoGoConfig.CATCH_LOG, false) tbLogCatch.setOnCheckedChangeListener { _, isChecked -> if (isChecked) { var logTimeStr = etLogCatch.text?.toString() - if(logTimeStr.isNullOrEmpty()){ + if (logTimeStr.isNullOrEmpty()) { logTimeStr = "10" } val logCatchTime = logTimeStr.toInt() @@ -414,20 +412,20 @@ class DebugSettingView @JvmOverloads constructor( } } CallerDevaToolsListenerManager.registerDevaToolsLogCatchListener(TAG, - object : IMoGoDevaToolsListener { - override fun onLogCatchClose() { - super.onLogCatchClose() - tbLogCatch.isChecked = false - } + object : IMoGoDevaToolsListener { + override fun onLogCatchClose() { + super.onLogCatchClose() + tbLogCatch.isChecked = false + } - override fun onLogCatch(lineLog: String) { - logInfoView?.let { - if (logViewAttach) { - it.onLogCatch(lineLog) - } + override fun onLogCatch(lineLog: String) { + logInfoView?.let { + if (logViewAttach) { + it.onLogCatch(lineLog) } } - }) + } + }) tbLogDebugView.setOnCheckedChangeListener { _, isChecked -> if (isChecked) { logInfoView = LogInfoView() @@ -486,7 +484,8 @@ class DebugSettingView @JvmOverloads constructor( AppConfigInfo.uniqueDeviceId = DeviceIdUtils.getDeviceId(AbsMogoApplication.getApp()) } if (AppConfigInfo.widevineIDMd5.isNullOrEmpty()) { - AppConfigInfo.widevineIDMd5 = DeviceIdUtils.getWidevineIDWithMd5(AbsMogoApplication.getApp()) + AppConfigInfo.widevineIDMd5 = + DeviceIdUtils.getWidevineIDWithMd5(AbsMogoApplication.getApp()) } AppConfigInfo.mogoSN = MoGoAiCloudClient.getInstance().aiCloudClientConfig.sn AppConfigInfo.mogoToken = MoGoAiCloudClient.getInstance().aiCloudClientConfig.token @@ -495,7 +494,7 @@ class DebugSettingView @JvmOverloads constructor( AppConfigInfo.isConnectNet = NetworkUtils.isConnected(context) AppConfigInfo.isConnectSocket = DebugConfig.isDownloadSnapshot() - when (FunctionBuildConfig.appIdentityMode) { + when (FunctionBuildConfig.appIdentityMode) { 0x00 -> {// 司机端 AppConfigInfo.isDriver = true AppConfigInfo.isConnectedNetty = CallerTelematicManager.getServerStarted() @@ -513,16 +512,16 @@ class DebugSettingView @JvmOverloads constructor( tvAutopilotInfo.text = GsonUtils.toJson(mAutoPilotStatusInfo) tvCarInfo.text = - "GPS时间:${mAutoPilotCarStateInfo?.values?.satelliteTime}\n" + - "自车经纬度:\n${mAutoPilotCarStateInfo?.values?.lon}\n${mAutoPilotCarStateInfo?.values?.lat}\n" + "GPS时间:${mGnssInfo?.satelliteTime}\n" + + "自车经纬度:\n${mGnssInfo?.longitude}\n${mGnssInfo?.latitude}\n" tvIdentifyInfo.text = - "「有效类型」感知数据个数:${mIdentifyDataSize}\n" + - "「未知类型」感知数据个数:${mUnknownIdentifyDataSize}\n" + "「有效类型」感知数据个数:${mIdentifyDataSize}\n" + + "「未知类型」感知数据个数:${mUnknownIdentifyDataSize}\n" tvTrajectoryInfoSize.text = - "引导线点个数:${mTrajectoryInfoSize}" + "引导线点个数:${mTrajectoryInfoSize}" tvRouteInfoSize.text = - "全局路径规划点个数:${mRouteInfoSize}" + "全局路径规划点个数:${mRouteInfoSize}" // 用完之后重制为0,防止节点回掉突然没数据,导致页面显示还是之前的数据情况 mIdentifyDataSize = 0 @@ -551,34 +550,17 @@ class DebugSettingView @JvmOverloads constructor( AppConfigInfo.isConnectAutopilot = autoPilotStatusInfo.connectStatus } - override fun onAutopilotArriveAtStation(autopilotWayArrive: AutopilotStationInfo?) { - + override fun onAutopilotCarStateData(gnssInfo: MessagePad.GnssInfo?) { + mGnssInfo = gnssInfo } - override fun onAutopilotCarStateData(autoPilotCarStateInfo: AutopilotCarStateInfo?) { - //Logger.d(TAG, "autoPilotCarStateInfo:$autoPilotCarStateInfo") - mAutoPilotCarStateInfo = autoPilotCarStateInfo - } - - override fun onAutopilotSNRequest() { - - } - - override fun onAutopilotGuardian(guardianInfo: AutopilotGuardianStatusInfo?) { - - } - - override fun onLocationChanged(location: MogoLocation?) { - //Logger.d(TAG, "location:$location") - } - - override fun onAutopilotIdentifyDataUpdate(trafficData: ArrayList?) { + override fun onAutopilotIdentifyDataUpdate(trafficData: ArrayList?) { // 重制数据 mIdentifyDataSize = 0 mUnknownIdentifyDataSize = 0 // 遍历计数 trafficData?.forEach { - if (it.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI) { + if (it.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI.type) { mUnknownIdentifyDataSize++ } else { mIdentifyDataSize++ @@ -586,19 +568,22 @@ class DebugSettingView @JvmOverloads constructor( } } - override fun onAutopilotWarnMessage(autopilotWarnMessage: AutopilotWarnMessage?) { - - } - - override fun onAutopilotRecordResult(record: AutoPilotRecordResult?) { - - } - override fun onAutopilotTrajectory(trajectoryInfos: ArrayList) { mTrajectoryInfoSize = trajectoryInfos.size } - override fun onAutopilotRotting(routeList: AutopilotRouteInfo?) { - mRouteInfoSize = routeList?.models?.size ?: 0 + override fun onAutopilotRotting(globalPathResp: MessagePad.GlobalPathResp?) { + mRouteInfoSize = globalPathResp?.wayPointsList?.size ?: 0 } + + override fun onAutopilotCarConfig(carConfigResp: MessagePad.CarConfigResp) { + //todo pb : 工控机基础信息回调 详见 message CarConfigResp proto + + } + + + override fun onLocationChanged(location: MogoLocation?) { + + } + } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/AutoPilotAndCheckView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/AutoPilotAndCheckView.kt index 587bac0de2..5c2eafcfff 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/AutoPilotAndCheckView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/AutoPilotAndCheckView.kt @@ -6,7 +6,6 @@ import android.util.AttributeSet import android.view.LayoutInflater import android.view.View import android.widget.FrameLayout -import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo 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 @@ -140,9 +139,22 @@ class AutoPilotAndCheckView @JvmOverloads constructor( * @param downloadVersion 下载版本 * @param upgradeStatus 升级状态 */ - fun showAdUpgradeStatus(upgradeMode: Int,downloadStatus : Int,currentProgress : Int,totalProgress : Int - ,downloadVersion : String,upgradeStatus : Int){ - systemVersionView?.showAdUpgradeStatus(upgradeMode,downloadStatus,currentProgress, totalProgress, downloadVersion, upgradeStatus) + fun showAdUpgradeStatus( + upgradeMode: Int, + downloadStatus: Int, + currentProgress: Int, + totalProgress: Int, + downloadVersion: String, + upgradeStatus: Int + ) { + systemVersionView?.showAdUpgradeStatus( + upgradeMode, + downloadStatus, + currentProgress, + totalProgress, + downloadVersion, + upgradeStatus + ) checkSystemView?.setAdUpgradeStatus(downloadStatus, upgradeStatus) } @@ -160,10 +172,6 @@ class AutoPilotAndCheckView @JvmOverloads constructor( connectStatus = autoPilotStatusInfo.connectStatus } - override fun onAutopilotGuardian(guardianInfo: AutopilotGuardianStatusInfo?) { - - } - interface ClickListener { fun go2CheckPage() fun onClose(v: View) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/AutoPilotStatusView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/AutoPilotStatusView.kt index f7605c169a..a85bad4529 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/AutoPilotStatusView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/AutoPilotStatusView.kt @@ -128,9 +128,4 @@ class AutoPilotStatusView @JvmOverloads constructor( setAutoPilotStatus(autoPilotStatusInfo.state) } - override fun onAutopilotGuardian(guardianInfo: AutopilotGuardianStatusInfo?) { - - } - - } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/SmallMapFragment.java b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/SmallMapFragment.java index ee0780a392..45a6fc9602 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/SmallMapFragment.java +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/SmallMapFragment.java @@ -8,9 +8,6 @@ import android.view.View; import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.commons.mvp.BaseFragment; import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo; -import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo; -import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo; -import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo; import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo; import com.mogo.eagle.core.data.constants.MoGoFragmentPaths; import com.mogo.eagle.core.data.map.MogoLatLng; @@ -22,11 +19,13 @@ import com.mogo.eagle.core.function.map.R; import com.mogo.eagle.core.utilcode.util.UiThreadHandler; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; +import mogo.telematics.pad.MessagePad; +import mogo_msg.MogoReportMsg; + /** * @author donghongyu * @date 2021/5/19 10:50 上午 @@ -137,13 +136,35 @@ public class SmallMapFragment extends BaseFragment } @Override - public void onAutopilotRotting(AutopilotRouteInfo routeList) { - if (routeList.getModels() == null || routeList.getModels().size() == 0) { + public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autoPilotStatusInfo) { + if (autoPilotStatusInfo.getPilotmode() != 1) { + clearPolyline(); + } + } + + @Override + public void onAutopilotArriveAtStation(MessagePad.ArrivalNotification arrivalNotification) { + + } + + @Override + public void onAutopilotSNRequest() { + + } + + @Override + public void onAutopilotGuardian(MogoReportMsg.MogoReportMessage guardianInfo) { + + } + + @Override + public void onAutopilotRotting(MessagePad.GlobalPathResp globalPathResp) { + if (globalPathResp == null || globalPathResp.getWayPointsList().size() == 0) { return; } List latLngList = new ArrayList<>(); - for (AutopilotRouteInfo.RouteModels routeModel : routeList.getModels()) { - latLngList.add(new MogoLatLng(routeModel.getLat(), routeModel.getLon())); + for (MessagePad.Location routeModel : globalPathResp.getWayPointsList()) { + latLngList.add(new MogoLatLng(routeModel.getLatitude(), routeModel.getLongitude())); } Log.e(TAG, "routeResult:" + latLngList.size()); if (latLngList.size() > 0) { @@ -152,27 +173,4 @@ public class SmallMapFragment extends BaseFragment clearPolyline(); } } - - - @Override - public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autoPilotStatusInfo) { - if (autoPilotStatusInfo.getControl_pilotmode() != 1){ - clearPolyline(); - } - } - - @Override - public void onAutopilotArriveAtStation(@Nullable AutopilotStationInfo autopilotWayArrive) { - - } - - @Override - public void onAutopilotGuardian(@Nullable AutopilotGuardianStatusInfo guardianInfo) { - - } - - @Override - public void onAutopilotSNRequest() { - - } } diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt index fdb1cada04..e58af90fe5 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt @@ -155,8 +155,6 @@ class MogoPrivateObuManager private constructor() { data.putOpt("acceleration", info.acceleration_set.lateral) data.putOpt("yawRate", info.acceleration_set.yaw_rate) } - - data.putOpt("gpsProvider", 2) try { data.putOpt("systemTime", System.currentTimeMillis()) } catch (e: Exception) { diff --git a/core/mogo-core-data/build.gradle b/core/mogo-core-data/build.gradle index 8636b97258..8405737a50 100644 --- a/core/mogo-core-data/build.gradle +++ b/core/mogo-core-data/build.gradle @@ -4,7 +4,6 @@ plugins { id 'kotlin-android-extensions' id 'kotlin-kapt' id 'com.alibaba.arouter' - id 'com.google.protobuf' } android { compileSdkVersion rootProject.ext.android.compileSdkVersion @@ -39,30 +38,9 @@ android { java { srcDir 'src/main/java' } - - proto { - srcDir 'src/main/proto' - include '**/*.proto' - } } } - protobuf { - protoc { - artifact = rootProject.ext.dependencies.protoc - } - - generateProtoTasks { - all().each { task -> - task.builtins { - remove java - } - task.builtins { - java {} - } - } - } - } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 @@ -82,12 +60,12 @@ dependencies { implementation rootProject.ext.dependencies.androidxroomruntime implementation rootProject.ext.dependencies.androidxroomktx kapt rootProject.ext.dependencies.androidxroomcompiler - api rootProject.ext.dependencies.protobuf_java - api rootProject.ext.dependencies.protobuf_java_util + if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { implementation rootProject.ext.dependencies.mogo_core_res } else { implementation project(':core:mogo-core-res') + api project(":libraries:mogo-adas-data") } } diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotStatusInfo.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotStatusInfo.kt index 1d453944e7..fa7bc32898 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotStatusInfo.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotStatusInfo.kt @@ -64,9 +64,5 @@ class AutopilotStatusInfo : Serializable { */ var pilotmode = 0 - /** - * 底盘的自动驾驶状态 0非自动驾驶,1自动驾驶 - */ - var control_pilotmode = 0 } \ No newline at end of file diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/deva/chain/ChainConstant.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/deva/chain/ChainConstant.kt index f40cd6538d..5d53fc6b56 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/deva/chain/ChainConstant.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/deva/chain/ChainConstant.kt @@ -13,11 +13,7 @@ class ChainConstant { const val CHAIN_LINK_LOG_ADAS_INIT = "-adasInitStatus" const val CHAIN_LINK_LOG_ADAS_MSG = "-adasWsMsg" - const val CHAIN_ALIAS_CODE_UDP_INIT = "PAD_ADAS_UDP_INIT" - const val CHAIN_ALIAS_CODE_UDP_CONNECT_ADDRESS = "PAD_ADAS_UDP_CONNECT_ADDRESS" - const val CHAIN_ALIAS_CODE_WEB_SOCKET_OPEN = "PAD_ADAS_WEB_SOCKET_OPEN" - const val CHAIN_ALIAS_CODE_WEB_SOCKET_MESSAGE_JSON = "PAD_ADAS_WEB_SOCKET_MESSAGE_JSON" - const val CHAIN_ALIAS_CODE_WEB_SOCKET_MESSAGE_BYTE = "PAD_ADAS_WEB_SOCKET_MESSAGE_BYTE" + const val CHAIN_ALIAS_CODE_ADAS_MESSAGE_RECT_DATA = "PAD_ADAS_MESSAGE_AUTOPILOT_RECT_DATA" const val CHAIN_ALIAS_CODE_ADAS_MESSAGE_CAR_STATE = "PAD_ADAS_MESSAGE_AUTOPILOT_CAR_STATE" const val CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_STATUS = "PAD_ADAS_MESSAGE_AUTOPILOT_STATUS" diff --git a/core/mogo-core-data/src/main/proto/message_pad.proto b/core/mogo-core-data/src/main/proto/message_pad.proto index ae6b05880c..0f21c4ba3a 100644 --- a/core/mogo-core-data/src/main/proto/message_pad.proto +++ b/core/mogo-core-data/src/main/proto/message_pad.proto @@ -174,10 +174,13 @@ message CarConfigReq message CarConfigResp { string dockVersion = 1; - string plateNumber = 2; + string plateNumber = 2; //车牌 string macAddress = 3; ProtocolVersion protocolVersion = 4; //通信协议版本 - double speedLimit = 5; //自动驾驶限速 + double speedLimit = 5; //自动驾驶限速, 单位:m/s + double maxSpeedLimit = 6; //最大自动驾驶限速, 单位:m/s + double minAcceleration = 7; //最小加速度, 单位:m/s² + double maxAcceleration = 8; //最大加速度, 单位:m/s² } // message definition for MsgTypeRecordCause @@ -205,7 +208,7 @@ message RecordData // message definition for MsgTypeSetAutopilotSpeedReq message SetAutopilotSpeedReq { - double speedLimit = 1; //最大车辆速度 m/s + double speedLimit = 1; //最大车辆速度, 单位:m/s } // message definition for MsgTypeGlobalPathReq diff --git a/core/mogo-core-function-api/build.gradle b/core/mogo-core-function-api/build.gradle index 56faa70676..c817f76b33 100644 --- a/core/mogo-core-function-api/build.gradle +++ b/core/mogo-core-function-api/build.gradle @@ -44,7 +44,6 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation rootProject.ext.dependencies.kotlinstdlibjdk7 implementation rootProject.ext.dependencies.arouter - implementation project(path: ':libraries:mogo-adas') kapt rootProject.ext.dependencies.aroutercompiler implementation rootProject.ext.dependencies.coroutinescore implementation rootProject.ext.dependencies.coroutinesandroid diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotCarConfigListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotCarConfigListener.kt new file mode 100644 index 0000000000..255cd1c59f --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotCarConfigListener.kt @@ -0,0 +1,17 @@ +package com.mogo.eagle.core.function.api.autopilot + +import mogo.telematics.pad.MessagePad + +/** + * 工控机基础信息 + */ +interface IMoGoAutopilotCarConfigListener { + + /** + * 工控机基础信息 + * + * @param carConfigResp 包括docker版本,macAddress等基础信息,详见proto + */ + fun onAutopilotCarConfig(carConfigResp: MessagePad.CarConfigResp) + +} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotCarStateListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotCarStateListener.kt index ee2abac64a..e372eed6aa 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotCarStateListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotCarStateListener.kt @@ -1,6 +1,6 @@ package com.mogo.eagle.core.function.api.autopilot -import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo +import mogo.telematics.pad.MessagePad /** *@author xiaoyuzhou @@ -12,7 +12,7 @@ interface IMoGoAutopilotCarStateListener { /** * 车辆状态&定位 数据 * - * @param autoPilotCarStateInfo + * @param gnssInfo */ - fun onAutopilotCarStateData(autoPilotCarStateInfo: AutopilotCarStateInfo?) + fun onAutopilotCarStateData(gnssInfo: MessagePad.GnssInfo?) } \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotIdentifyListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotIdentifyListener.kt index 4a76aa4c9e..9a36db68ea 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotIdentifyListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotIdentifyListener.kt @@ -1,9 +1,7 @@ package com.mogo.eagle.core.function.api.autopilot -import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult -import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage -import com.mogo.eagle.core.data.traffic.TrafficData -import java.util.* +import mogo.telematics.pad.MessagePad +import record_cache.RecordPanelOuterClass /** * @author xiaoyuzhou @@ -17,19 +15,18 @@ interface IMoGoAutopilotIdentifyListener { * * @param trafficData 交通元素信息列表 */ - fun onAutopilotIdentifyDataUpdate(trafficData: ArrayList?) {} + fun onAutopilotIdentifyDataUpdate(trafficData: ArrayList?) {} /** * 报警信息 * - * @param autopilotWarnMessage 预警信息 + * @param warn 预警信息 */ - fun onAutopilotWarnMessage(autopilotWarnMessage: AutopilotWarnMessage?) {} - + fun onAutopilotWarnMessage(warn: MessagePad.Warn?) {} /** * 采集结果回调 */ - fun onAutopilotRecordResult(record: AutoPilotRecordResult?) {} + fun onAutopilotRecordResult(recordPanel: RecordPanelOuterClass.RecordPanel) {} } \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotPlanningListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotPlanningListener.kt index 199045c093..d6a46b1a58 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotPlanningListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotPlanningListener.kt @@ -1,7 +1,7 @@ package com.mogo.eagle.core.function.api.autopilot import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo -import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo +import mogo.telematics.pad.MessagePad import java.util.ArrayList /** @@ -18,7 +18,7 @@ interface IMoGoAutopilotPlanningListener { /** * 2021/6/23 工控机经纬度 绘制时转成高德经纬度 * - * @param routeList 工控机全局规划路径 + * @param globalPathResp 工控机全局规划路径 */ - fun onAutopilotRotting(routeList: AutopilotRouteInfo?) + fun onAutopilotRotting(globalPathResp: MessagePad.GlobalPathResp?) } \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotProvider.kt index 848d80661b..a3fef27670 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotProvider.kt @@ -75,12 +75,6 @@ interface IMoGoAutopilotProvider : IMoGoFunctionServerProvider { */ fun setEnableLog(isEnableLog: Boolean) - /** - * Log 是否写入 - * - * @param isWriteLog true-打开,false-关闭 - */ - fun setIsWriteLog(isWriteLog: Boolean) fun setAutoPilotSpeed(speed: Int): Boolean /** diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotStatusListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotStatusListener.kt index aaf8923fd6..4243a28958 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotStatusListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotStatusListener.kt @@ -1,8 +1,8 @@ package com.mogo.eagle.core.function.api.autopilot -import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo -import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo +import mogo.telematics.pad.MessagePad +import mogo_msg.MogoReportMsg /** * @author xiaoyuzhou @@ -16,24 +16,24 @@ interface IMoGoAutopilotStatusListener { * * @param autoPilotStatusInfo 状态信息 */ - fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo){} + fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {} /** * 自动驾驶到站 * - * @param autopilotWayArrive 所到车站的简单信息 + * @param arrivalNotification 所到车站的简单信息 */ - fun onAutopilotArriveAtStation(autopilotWayArrive: AutopilotStationInfo?){} + fun onAutopilotArriveAtStation(arrivalNotification: MessagePad.ArrivalNotification?) {} /** * 工控机获取SN */ - fun onAutopilotSNRequest(){} + fun onAutopilotSNRequest() {} /** * 工控机监控节点 */ - fun onAutopilotGuardian(guardianInfo: AutopilotGuardianStatusInfo?){} + fun onAutopilotGuardian(guardianInfo: MogoReportMsg.MogoReportMessage?) {} companion object { diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt new file mode 100644 index 0000000000..d14569289f --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt @@ -0,0 +1,21 @@ +package com.mogo.eagle.core.function.api.autopilot + +import chassis.Chassis + +/** + * 车辆底盘 数据 回调监听 + */ +interface IMoGoAutopilotVehicleStateListener { + + /** + * 车辆转向灯 数据 + * @param lightSwitch + */ + fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?) + + /** + * 车辆刹车灯 数据 + * @param brakeLight + */ + fun onAutopilotBrakeLightData(brakeLight: Boolean) +} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/devatools/IDevaToolsProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/devatools/IDevaToolsProvider.kt index 0a2c0185b6..8f9792dcfa 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/devatools/IDevaToolsProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/devatools/IDevaToolsProvider.kt @@ -1,9 +1,9 @@ package com.mogo.eagle.core.function.api.devatools import android.view.View -import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult import com.mogo.eagle.core.data.deva.chain.ChainLogParam import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider +import record_cache.RecordPanelOuterClass /** * 开发套件工具接口 @@ -32,5 +32,5 @@ interface IDevaToolsProvider : IMoGoFunctionServerProvider { /** * 当工控机回调时调用 */ - fun onReceiveBadCaseRecord(record: AutoPilotRecordResult) + fun onReceiveBadCaseRecord(record: RecordPanelOuterClass.RecordPanel) } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotManager.kt index 63df027469..12eb5ca96d 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotManager.kt @@ -77,10 +77,6 @@ object CallerAutoPilotManager { providerApi?.setEnableLog(isEnableLog) } - fun setIsWriteLog(isWriteLog: Boolean) { - providerApi?.setIsWriteLog(isWriteLog) - } - fun setAutoPilotSpeed(speed: Int): Boolean { return providerApi?.setAutoPilotSpeed(speed) ?: false } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt index ca2d1c8abb..e5ddcfb609 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt @@ -1,14 +1,13 @@ package com.mogo.eagle.core.function.call.autopilot import androidx.annotation.Nullable -import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo -import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener import com.mogo.eagle.core.function.call.base.CallerBase -import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.mogo.eagle.core.utilcode.util.GsonUtils import com.mogo.eagle.core.utilcode.util.LogUtils +import mogo.telematics.pad.MessagePad +import mogo_msg.MogoReportMsg import java.util.concurrent.ConcurrentHashMap /** @@ -86,7 +85,6 @@ object CallerAutoPilotStatusListenerManager : CallerBase() { */ @Synchronized fun invokeAutoPilotStatus() { - //LogUtils.dTag(TAG, "$mAutopilotStatusInfo") invokeAutoPilotStatus(mAutopilotStatusInfo) } @@ -108,16 +106,14 @@ object CallerAutoPilotStatusListenerManager : CallerBase() { /** * 自动驾驶站点信息 回调 - * @param autopilotStationInfo 自动驾驶网约车回调数据 + * @param arrivalNotification 自动驾驶网约车回调数据 */ @Synchronized - fun invokeArriveAtStation(autopilotStationInfo: AutopilotStationInfo) { - //LogUtils.dTag(TAG, "$autopilotStationInfo") + fun invokeArriveAtStation(arrivalNotification: MessagePad.ArrivalNotification?) { M_AUTOPILOT_STATUS_LISTENERS.forEach { val tag = it.key val listener = it.value - //LogUtils.dTag(TAG, "tag:$tag listener:$listener") - listener.onAutopilotArriveAtStation(autopilotStationInfo) + listener.onAutopilotArriveAtStation(arrivalNotification) } } @@ -139,12 +135,10 @@ object CallerAutoPilotStatusListenerManager : CallerBase() { * 工控机监控节点 回调 */ @Synchronized - fun invokeAutopilotGuardian(guardianInfo: AutopilotGuardianStatusInfo?) { - //LogUtils.dTag(TAG, "$guardianInfo") + fun invokeAutopilotGuardian(guardianInfo: MogoReportMsg.MogoReportMessage?) { M_AUTOPILOT_STATUS_LISTENERS.forEach { val tag = it.key val listener = it.value - //LogUtils.dTag(TAG, "tag:$tag listener:$listener") listener.onAutopilotGuardian(guardianInfo) } } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarConfigListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarConfigListenerManager.kt new file mode 100644 index 0000000000..e7c71fe95b --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarConfigListenerManager.kt @@ -0,0 +1,73 @@ +package com.mogo.eagle.core.function.call.autopilot + +import androidx.annotation.Nullable +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener +import com.mogo.eagle.core.function.call.base.CallerBase +import com.mogo.eagle.core.utilcode.util.LogUtils +import mogo.telematics.pad.MessagePad +import java.util.concurrent.ConcurrentHashMap + +/** + * 车辆地盘数据 回调监听 + */ +object CallerAutopilotCarConfigListenerManager : CallerBase() { + private val TAG = "CallerAutopilotCarConfigListenerManager" + + // 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 + private val M_AUTOPILOT_CAR_CONFIG_LISTENERS: ConcurrentHashMap = + ConcurrentHashMap() + + /** + * 添加 ADAS车辆状态&定位 监听 + * @param tag 标记,用来注销监听使用 + * @param listener 监听回调 + */ + fun addListener( + @Nullable tag: String, + @Nullable listener: IMoGoAutopilotCarConfigListener + ) { + if (M_AUTOPILOT_CAR_CONFIG_LISTENERS.containsKey(tag)) { + LogUtils.eTag(TAG, "Tag:$tag already exists,please use other tag") + return + } + M_AUTOPILOT_CAR_CONFIG_LISTENERS[tag] = listener + } + + /** + * 删除监听 + * @param tag 标记,用来注销监听使用 + */ + fun removeListener(@Nullable tag: String) { + if (!M_AUTOPILOT_CAR_CONFIG_LISTENERS.containsKey(tag)) { + LogUtils.eTag(TAG, "Tag:$tag not exists") + return + } + M_AUTOPILOT_CAR_CONFIG_LISTENERS.remove(tag) + } + + /** + * 删除自动驾驶按钮选中监听 + * @param listener 要删除的监听对象 + */ + fun removeListener(@Nullable listener: IMoGoAutopilotCarConfigListener) { + M_AUTOPILOT_CAR_CONFIG_LISTENERS.forEach { + if (it.value == listener) { + M_AUTOPILOT_CAR_CONFIG_LISTENERS.remove(it.key) + } + } + } + + /** + * 工控机基础信息回调 + * @param carConfigResp + */ + @Synchronized + fun invokeAutopilotCarConfigData(carConfigResp: MessagePad.CarConfigResp) { + M_AUTOPILOT_CAR_CONFIG_LISTENERS.forEach { + val listener = it.value + listener.onAutopilotCarConfig(carConfigResp) + } + } + + +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarStatusListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarStatusListenerManager.kt index c4df059436..f43cfc0424 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarStatusListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarStatusListenerManager.kt @@ -5,6 +5,7 @@ import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener import com.mogo.eagle.core.function.call.base.CallerBase import com.mogo.eagle.core.utilcode.util.LogUtils +import mogo.telematics.pad.MessagePad import java.util.concurrent.ConcurrentHashMap /** @@ -62,17 +63,14 @@ object CallerAutopilotCarStatusListenerManager : CallerBase() { /** * 车辆状态数据 回调 - * @param autoPilotCarStateInfo + * @param gnssInfo */ @Synchronized - fun invokeAutopilotCarStateData(autoPilotCarStateInfo: AutopilotCarStateInfo?) { - //LogUtils.dTag(TAG, "$autoPilotCarStateInfo") - //Log.w("DHY-location", "${autoPilotCarStateInfo?.values?.lon},${autoPilotCarStateInfo?.values?.lat} CallerAutopilotCarStatusListenerManager-invokeAutopilotCarStateData") + fun invokeAutopilotCarStateData(gnssInfo: MessagePad.GnssInfo?) { M_AUTOPILOT_STATUS_LISTENERS.forEach { val tag = it.key val listener = it.value - //LogUtils.dTag(TAG, "tag:$tag listener:$listener") - listener.onAutopilotCarStateData(autoPilotCarStateInfo) + listener.onAutopilotCarStateData(gnssInfo) } } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotIdentifyListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotIdentifyListenerManager.kt index 1de733bdf8..5869a87000 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotIdentifyListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotIdentifyListenerManager.kt @@ -1,13 +1,12 @@ package com.mogo.eagle.core.function.call.autopilot import androidx.annotation.Nullable -import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage -import com.mogo.eagle.core.data.traffic.TrafficData import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener import com.mogo.eagle.core.function.call.base.CallerBase -import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.mogo.eagle.core.utilcode.util.LogUtils +import mogo.telematics.pad.MessagePad +import record_cache.RecordPanelOuterClass import java.util.concurrent.ConcurrentHashMap /** @@ -66,12 +65,10 @@ object CallerAutopilotIdentifyListenerManager : CallerBase() { * 识别交通元素数据发生更新 回调 */ @Synchronized - fun invokeAutopilotIdentifyDataUpdate(trafficData: ArrayList?) { -// Logger.d(TAG, "$trafficData") + fun invokeAutopilotIdentifyDataUpdate(trafficData: ArrayList?) { M_AUTOPILOT_IDENTIFY_LISTENERS.forEach { val tag = it.key val listener = it.value - // Logger.d(TAG, "tag:$tag listener:$listener") listener.onAutopilotIdentifyDataUpdate(trafficData) } } @@ -80,25 +77,23 @@ object CallerAutopilotIdentifyListenerManager : CallerBase() { * 报警信息 回调 */ @Synchronized - fun invokeAutopilotWarnMessage(autopilotWarnMessage: AutopilotWarnMessage?) { - // Logger.d(TAG, "$autopilotWarnMessage") + fun invokeAutopilotWarnMessage(warn: MessagePad.Warn?) { M_AUTOPILOT_IDENTIFY_LISTENERS.forEach { val tag = it.key val listener = it.value - // Logger.d(TAG, "tag:$tag listener:$listener") - listener.onAutopilotWarnMessage(autopilotWarnMessage) + listener.onAutopilotWarnMessage(warn) } } /** * 采集任务记录回调 */ - fun invokeAutopilotRecordResult(result: AutoPilotRecordResult) { + fun invokeAutopilotRecordResult(recordPanel: RecordPanelOuterClass.RecordPanel) { M_AUTOPILOT_IDENTIFY_LISTENERS.forEach { val tag = it.key val listener = it.value LogUtils.dTag(TAG, "tag:$tag listener:$listener") - listener.onAutopilotRecordResult(result) + listener.onAutopilotRecordResult(recordPanel) } } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotPlanningListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotPlanningListenerManager.kt index e2eb3bfe9e..d57aad7ad1 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotPlanningListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotPlanningListenerManager.kt @@ -2,10 +2,10 @@ package com.mogo.eagle.core.function.call.autopilot import androidx.annotation.Nullable import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo -import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener import com.mogo.eagle.core.function.call.base.CallerBase import com.mogo.eagle.core.utilcode.util.LogUtils +import mogo.telematics.pad.MessagePad import java.util.concurrent.ConcurrentHashMap /** @@ -78,16 +78,14 @@ object CallerAutopilotPlanningListenerManager : CallerBase() { /** * 路径规划 回调 - * @param routeList 自动驾驶网约车回调数据 + * @param globalPathResp 自动驾驶网约车回调数据 */ @Synchronized - fun invokeAutopilotRotting(routeList: AutopilotRouteInfo) { - //LogUtils.dTag(TAG, "$routeList") + fun invokeAutopilotRotting(globalPathResp: MessagePad.GlobalPathResp?) { M_AUTOPILOT_PLANNING_LISTENER.forEach { val tag = it.key val listener = it.value - //LogUtils.dTag(TAG, "tag:$tag listener:$listener") - listener.onAutopilotRotting(routeList) + listener.onAutopilotRotting(globalPathResp) } } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt new file mode 100644 index 0000000000..1266dec504 --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt @@ -0,0 +1,85 @@ +package com.mogo.eagle.core.function.call.autopilot + +import androidx.annotation.Nullable +import chassis.Chassis +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener +import com.mogo.eagle.core.function.call.base.CallerBase +import com.mogo.eagle.core.utilcode.util.LogUtils +import java.util.concurrent.ConcurrentHashMap + +/** + * 车辆地盘数据 回调监听 + */ +object CallerAutopilotVehicleStateListenerManager : CallerBase() { + private val TAG = "CallerAutopilotVehicleStateListenerManager" + + // 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 + private val M_AUTOPILOT_VEHICLE_LISTENERS: ConcurrentHashMap = + ConcurrentHashMap() + + /** + * 添加 ADAS车辆状态&定位 监听 + * @param tag 标记,用来注销监听使用 + * @param listener 监听回调 + */ + fun addListener( + @Nullable tag: String, + @Nullable listener: IMoGoAutopilotVehicleStateListener + ) { + if (M_AUTOPILOT_VEHICLE_LISTENERS.containsKey(tag)) { + LogUtils.eTag(TAG, "Tag:$tag already exists,please use other tag") + return + } + M_AUTOPILOT_VEHICLE_LISTENERS[tag] = listener + } + + /** + * 删除监听 + * @param tag 标记,用来注销监听使用 + */ + fun removeListener(@Nullable tag: String) { + if (!M_AUTOPILOT_VEHICLE_LISTENERS.containsKey(tag)) { + LogUtils.eTag(TAG, "Tag:$tag not exists") + return + } + M_AUTOPILOT_VEHICLE_LISTENERS.remove(tag) + } + + /** + * 删除自动驾驶按钮选中监听 + * @param listener 要删除的监听对象 + */ + fun removeListener(@Nullable listener: IMoGoAutopilotVehicleStateListener) { + M_AUTOPILOT_VEHICLE_LISTENERS.forEach { + if (it.value == listener) { + M_AUTOPILOT_VEHICLE_LISTENERS.remove(it.key) + } + } + } + + /** + * 车辆转向灯数据回调 + * @param lightSwitch + */ + @Synchronized + fun invokeAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?) { + M_AUTOPILOT_VEHICLE_LISTENERS.forEach { + val listener = it.value + listener.onAutopilotLightSwitchData(lightSwitch) + } + } + + /** + * 车辆刹车灯数据回调 + * @param brakeLight + */ + @Synchronized + fun invokeAutopilotBrakeLightData(brakeLight: Boolean) { + M_AUTOPILOT_VEHICLE_LISTENERS.forEach { + val listener = it.value + listener.onAutopilotBrakeLightData(brakeLight) + } + } + + +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsManager.kt index e12b49d1d5..cad6ced1ef 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsManager.kt @@ -6,6 +6,7 @@ import com.mogo.eagle.core.data.constants.MogoServicePaths import com.mogo.eagle.core.data.deva.chain.ChainLogParam import com.mogo.eagle.core.function.api.devatools.IDevaToolsProvider import com.mogo.eagle.core.function.call.base.CallerBase +import record_cache.RecordPanelOuterClass object CallerDevaToolsManager { @@ -61,7 +62,7 @@ object CallerDevaToolsManager { /** * 收到工控机回调时触发 */ - fun onReceiveBadCaseRecord(record: AutoPilotRecordResult) { + fun onReceiveBadCaseRecord(record: RecordPanelOuterClass.RecordPanel) { devaToolsProviderApi?.onReceiveBadCaseRecord(record) } } \ No newline at end of file diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java index eb3575736e..35c0c9734b 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java @@ -78,6 +78,8 @@ import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import mogo.telematics.pad.MessagePad; + public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, LocationListener, @@ -906,32 +908,48 @@ public class AMapViewWrapper implements IMogoMapView, double speed = data.optDouble("speed", -1); long systemTime = data.optLong("systemTime"); long satelliteTime = data.optLong("satelliteTime"); - long receiverDataTime = data.optLong("receiverDataTime"); - long adasSatelliteTime = data.optLong("adasSatelliteTime"); - int gpsProvider = data.optInt("gpsProvider", 1); - // 使用与渠道配置一样的gps提供者提供的数据,app/productFlavors/fPadLenovo.gradle GPS_PROVIDER 0-Android系统,1-工控机,2-OBU - if (gpsProvider == FunctionBuildConfig.gpsProvider) { - if (lon == -1) { - return; - } - RTKAutopilotLocationBean bean = new RTKAutopilotLocationBean(); - bean.setYaw_rate(yawRate); - bean.setHeading(heading); - bean.setAcceleration(acceleration); - bean.setAlt(alt); - bean.setSystemTime(systemTime); - bean.setSatelliteTime(satelliteTime); - bean.setReceiverDataTime(receiverDataTime); - bean.setAdasSatelliteTime(adasSatelliteTime); - bean.setLon(lon); - bean.setGnss_speed(((float) speed)); - bean.setLat(lat); - // 使用外部定位数据修改自车位置 - mMapView.getLocationClient().updateRTKAutoPilotLocation(bean); - CallerLocationUpdaterManager.INSTANCE.updateLocation(bean); - CallerMapDataCollectorManager.INSTANCE.setIsInit(); + if (lon == -1) { + return; } + RTKAutopilotLocationBean bean = new RTKAutopilotLocationBean(); + bean.setYaw_rate(yawRate); + bean.setHeading(heading); + bean.setAcceleration(acceleration); + bean.setAlt(alt); + bean.setSystemTime(systemTime); + bean.setSatelliteTime(satelliteTime); + bean.setLon(lon); + bean.setGnss_speed(((float) speed)); + bean.setLat(lat); + // 使用外部定位数据修改自车位置 + mMapView.getLocationClient().updateRTKAutoPilotLocation(bean); + CallerLocationUpdaterManager.INSTANCE.updateLocation(bean); + CallerMapDataCollectorManager.INSTANCE.setIsInit(); + } + + @Override + public void syncLocation2Map(MessagePad.GnssInfo gnssInfo) { + if (!checkAMapView()) { + return; + } + if (gnssInfo.getLongitude() == -1) { + return; + } + RTKAutopilotLocationBean bean = new RTKAutopilotLocationBean(); + bean.setYaw_rate(gnssInfo.getYawRate()); + bean.setHeading(gnssInfo.getHeading()); + bean.setAcceleration(gnssInfo.getAcceleration()); + bean.setAlt(gnssInfo.getAltitude()); + bean.setSystemTime(Double.valueOf(gnssInfo.getSystemTime()).longValue()); + bean.setSatelliteTime(Double.valueOf(gnssInfo.getSatelliteTime()).longValue()); + bean.setLon(gnssInfo.getLongitude()); + bean.setLat(gnssInfo.getLatitude()); + bean.setGnss_speed(((float) gnssInfo.getGnssSpeed())); + // 使用外部定位数据修改自车位置 + mMapView.getLocationClient().updateRTKAutoPilotLocation(bean); + CallerLocationUpdaterManager.INSTANCE.updateLocation(bean); + CallerMapDataCollectorManager.INSTANCE.setIsInit(); } @Override diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapWrapper.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapWrapper.java index f8aa9e0fcd..4ca798535d 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapWrapper.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapWrapper.java @@ -36,6 +36,8 @@ import com.zhidaoauto.map.sdk.open.view.MapAutoViewHelper; import java.util.ArrayList; import java.util.List; +import mogo.telematics.pad.MessagePad; + /** * @author congtaowang * @since 2019-12-18 @@ -102,12 +104,12 @@ public class AMapWrapper implements IMogoMap { } @Override - public void updateBatchMarkerPositon(ArrayList optionsArrayList) { + public void updateBatchMarkerPosition(ArrayList optionsArrayList) { if (!checkAMap()) { return; } ArrayList markerOptionsArrayList = new ArrayList<>(); - for (TrafficData mogoMarkerOptions : optionsArrayList) { + for (MessagePad.TrackedObject mogoMarkerOptions : optionsArrayList) { MarkerSimpleData markerOptions = ObjectUtils.fromTrafficData(mogoMarkerOptions); if (markerOptions == null) { Logger.e(TAG, "marker参数为空"); diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/uicontroller/AMapUIController.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/uicontroller/AMapUIController.java index cbdeccb959..6910593b40 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/uicontroller/AMapUIController.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/uicontroller/AMapUIController.java @@ -18,6 +18,8 @@ import org.json.JSONObject; import java.util.List; +import mogo.telematics.pad.MessagePad; + /** * @author congtaowang * @since 2019-12-26 @@ -337,6 +339,13 @@ public class AMapUIController implements IMogoMapUIController { } } + @Override + public void syncLocation2Map(MessagePad.GnssInfo gnssInfo) { + if (mClient != null) { + mClient.syncLocation2Map(gnssInfo); + } + } + @Override public void openVrMode(boolean zoomGestureEnable) { if (mClient != null) { diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/utils/ObjectUtils.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/utils/ObjectUtils.java index 5ce882383e..dfa80e4a84 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/utils/ObjectUtils.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/utils/ObjectUtils.java @@ -47,6 +47,8 @@ import com.zhidaoauto.map.sdk.open.query.Tip; import java.util.ArrayList; import java.util.List; +import mogo.telematics.pad.MessagePad; + /** * @author congtaowang * @since 2019-12-18 @@ -116,18 +118,18 @@ public class ObjectUtils { return markerOptions; } - public static MarkerSimpleData fromTrafficData(TrafficData trafficData) { + public static MarkerSimpleData fromTrafficData(MessagePad.TrackedObject trafficData) { if (trafficData == null) { return null; } MarkerSimpleData markerOptions = null; try { markerOptions = new MarkerSimpleData(); - markerOptions.setId(Long.parseLong(trafficData.getUuid())); - markerOptions.setMarkerType(trafficData.getType().getType()); + markerOptions.setId(trafficData.getUuid()); + markerOptions.setMarkerType(trafficData.getType()); markerOptions.setRotateAngle((float) trafficData.getHeading()); - markerOptions.setLat(trafficData.getLat()); - markerOptions.setLon(trafficData.getLon()); + markerOptions.setLat(trafficData.getLatitude()); + markerOptions.setLon(trafficData.getLongitude()); } catch (Exception e) { e.printStackTrace(); } diff --git a/libraries/mogo-adas-data/build.gradle b/libraries/mogo-adas-data/build.gradle new file mode 100644 index 0000000000..3185235483 --- /dev/null +++ b/libraries/mogo-adas-data/build.gradle @@ -0,0 +1,63 @@ +plugins { + id 'com.android.library' + id 'kotlin-android' + id 'com.google.protobuf' +} + +android { + compileSdkVersion rootProject.ext.android.compileSdkVersion + // buildToolsVersion rootProject.ext.android.buildToolsVersion + defaultConfig { + minSdkVersion rootProject.ext.android.minSdkVersion + targetSdkVersion rootProject.ext.android.targetSdkVersion + versionCode Integer.valueOf(VERSION_CODE) + versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION") + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles 'consumer-rules.pro' + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + + sourceSets { + main { + proto { + srcDir 'src/main/proto' + include '**/*.proto' + } + } + } + + protobuf { + protoc { + artifact = rootProject.ext.dependencies.protoc + } + + generateProtoTasks { + all().each { task -> + task.builtins { + remove java + } + task.builtins { + java {} + } + } + } + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + +} + +dependencies { + api rootProject.ext.dependencies.protobuf_java + api rootProject.ext.dependencies.protobuf_java_util +} \ No newline at end of file diff --git a/libraries/mogo-adas-data/gradle.properties b/libraries/mogo-adas-data/gradle.properties new file mode 100644 index 0000000000..cf399afb33 --- /dev/null +++ b/libraries/mogo-adas-data/gradle.properties @@ -0,0 +1,3 @@ +GROUP=com.mogo.adas +POM_ARTIFACT_ID=mogo-adas-data +VERSION_CODE=1 \ No newline at end of file diff --git a/libraries/mogo-adas-data/src/main/AndroidManifest.xml b/libraries/mogo-adas-data/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..db7896fc5e --- /dev/null +++ b/libraries/mogo-adas-data/src/main/AndroidManifest.xml @@ -0,0 +1 @@ + diff --git a/libraries/mogo-adas/build.gradle b/libraries/mogo-adas/build.gradle index 2347e09978..d95ed2967b 100644 --- a/libraries/mogo-adas/build.gradle +++ b/libraries/mogo-adas/build.gradle @@ -11,17 +11,13 @@ android { compileSdkVersion rootProject.ext.android.compileSdkVersion // buildToolsVersion rootProject.ext.android.buildToolsVersion - defaultConfig { minSdkVersion rootProject.ext.android.minSdkVersion targetSdkVersion rootProject.ext.android.targetSdkVersion versionCode Integer.valueOf(VERSION_CODE) - def name = getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION") - versionName name -// buildConfigField "String", "VERSION_NAME", "\"${name}\"" + versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION") + buildConfigField "String", "AP_VERSION", "\"${AP_VERSION}\"" - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles 'consumer-rules.pro' } @@ -84,9 +80,9 @@ dependencies { api "com.zhidao.support.recorder:recorder:1.0.0.3" if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { - implementation rootProject.ext.dependencies.mogo_core_data + } else { - implementation project(':core:mogo-core-data') + implementation project(':libraries:mogo-adas-data') } } diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasChannel.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasChannel.java index 7af126d3a4..d89b431d67 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasChannel.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasChannel.java @@ -1,10 +1,10 @@ package com.zhidao.support.adas.high; -import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_UDP_CONNECT_ADDRESS; -import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_ADAS; -import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_LOG_CONNECT_STATUS; -import static com.zhidao.support.adas.high.common.ActionTypeReceive.ACTION_WS_AUTOPILOT_CONTROL; -import static com.zhidao.support.adas.high.udp.CupidUdpConstract.VIDEO_RENDER_IMAGE_UDP; + +import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_ALIAS_CODE_CONNECT_ADDRESS; +import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_ALIAS_CODE_INIT; +import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_LINK_ADAS; +import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_LINK_LOG_CONNECT_STATUS; import android.text.TextUtils; @@ -170,6 +170,12 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec ipcFixationIPHelper.start(ips); } + @ChainLog(linkCode = CHAIN_LINK_ADAS, + linkChainLog = CHAIN_LINK_LOG_CONNECT_STATUS, + endpoint = TracingConstants.Endpoint.PAD, + nodeAliasCode = CHAIN_ALIAS_CODE_INIT, + paramIndexes = {-1}, + clientPkFileName = "sn") private void initSocket() { mSocket = new FpgaSocket(); mSocket.setWebSocketListener(this); @@ -185,7 +191,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec @ChainLog(linkCode = CHAIN_LINK_ADAS, linkChainLog = CHAIN_LINK_LOG_CONNECT_STATUS, endpoint = TracingConstants.Endpoint.PAD, - nodeAliasCode = CHAIN_ALIAS_CODE_UDP_CONNECT_ADDRESS, + nodeAliasCode = CHAIN_ALIAS_CODE_CONNECT_ADDRESS, paramIndexes = {0}, clientPkFileName = "sn") private void connectSocket(String address, int port) { @@ -194,7 +200,6 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec } } - private void sendIPCCmd(final String cmd) { if (ssh == null) { if (TextUtils.isEmpty(ipcConnectedIp)) { @@ -242,7 +247,6 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec sendIPCCmd("docker restart autocar_default_1"); } - @Override public String getIpcConnectedIp() { return ipcConnectedIp; @@ -253,7 +257,6 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec return ipcConnectedPort; } - /** * 发送ws消息 * @@ -263,13 +266,12 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec return mSocket != null && mSocket.sendDataWebSocket(msg); } - /** * 发送PB数据 * * @param msgType 数据类型 * @param data 数据 - * @return + * @return boolean */ private boolean sendWsMessage(MessagePad.MessageType msgType, byte[] data) { if (mSocket != null && rawPack != null) { @@ -282,9 +284,9 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec } /** - * 处理webSocket text数据 + * 处理webSocket * - * @param text + * @param text text数据 */ private void handlerWSMsg(String text) { try { @@ -306,7 +308,6 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec temp[0] = 0x01; onMultiDeviceListener.onForwardingIPCMessage(temp); } - } /** @@ -423,7 +424,6 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec } } - @Override public void onConnecting() { ipcConnectionStatus = Constants.IPC_CONNECTION_STATUS.CONNECTING; @@ -473,7 +473,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec /** * 根据IP和端口进行连接 * - * @param address + * @param address 连接地址 */ private void onConnectionAddress(String address) { CupidLogUtils.e(TAG, "要连接的工控机地址=" + address); @@ -522,7 +522,6 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec mAdasListener = adasListener; } - @Override public int getIpcConnectionStatus() { return ipcConnectionStatus; @@ -535,12 +534,10 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec // return sendWsMessage(Constants.QUERY_ROUTES); // } - /** * 接管原因 */ - /** * log是否显示 * @@ -550,11 +547,10 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec CupidLogUtils.setEnableLog(isEnableLog); } - /** * 向工控机发送数据 * - * @param info + * @param info 基础信息 */ @Override public void sendBaseInfo(BaseInfo info) { @@ -571,7 +567,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * * @param sn SN * @param environment 1: 研发环境, 2:测试环境, 3:生产环境 4:演示环境 - * @return + * @return boolean */ @Override public boolean sendBasicInfoResp(@NonNull String sn, int environment) { @@ -592,7 +588,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * @param mode 1: enter autopilot mode, 0: quit autopilot mode * @param source 命令来源: 0: pad模拟(模拟时routeInfo传null), 1: AICloud业务 * @param routeInfo 自动驾驶路径信息 - * @return + * @return boolean */ @Override public boolean sendAutoPilotModeReq(int mode, int source, MessagePad.RouteInfo routeInfo) { @@ -609,7 +605,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 设置演示模式 * * @param enable 1: enable, 0: disable - * @return + * @return boolean */ @Override public boolean sendDemoModeReq(int enable) { @@ -623,7 +619,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec /** * 车机基础信息请求 * - * @return + * @return boolean */ @Override public boolean sendCarConfigReq() { @@ -640,13 +636,10 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * @param filename 文件路径 * @param reasonID 接管原因id * @param reason 接管原因 - * @return + * @return boolean */ @Override public boolean sendRecordCause(long key, @NonNull String filename, @NonNull String reasonID, @NonNull String reason) { - if (filename == null) { - filename = ""; - } if (filename == null) { filename = ""; } @@ -687,10 +680,9 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * * @param id 采集id * @param duration 采集时间长 - * @param type 采集类型, 1:badcase, 2: map; 3: rests + * @param type 采集类型, 1:badCase, 2: map; 3: rests * @param isRecord 采集指令, true: 采集, false: 停止采集 - * @param sustain 是否持续采集 - * @return + * @return boolean */ @Override public boolean sendRecordData(int id, int duration, int type, boolean isRecord) { @@ -716,7 +708,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 设置自动驾驶最大速度 * * @param speedLimit 最大车辆速度 m/s - * @return + * @return boolean */ @Override public boolean sendAutopilotSpeedReq(double speedLimit) { @@ -730,7 +722,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec /** * 自动驾驶路径请求 * - * @return + * @return boolean */ @Override public boolean sendGlobalPathReq() { @@ -744,8 +736,8 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 发送红绿灯数据到工控机 * * @param crossID roadID - * @param latitude - * @param longitude + * @param latitude 纬度 + * @param longitude 经度 * @param heading 红绿灯方向 * @param direction 路的航向角 * @param lightId 红绿灯ID diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/IAdasNetCommApi.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/IAdasNetCommApi.java index d0cae404c3..0e9d8db6ab 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/IAdasNetCommApi.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/IAdasNetCommApi.java @@ -58,7 +58,7 @@ public interface IAdasNetCommApi { * * @param sn SN * @param environment 1: 研发环境, 2:测试环境, 3:生产环境 4:演示环境 - * @return + * @return boolean */ boolean sendBasicInfoResp(@NonNull String sn, int environment); @@ -68,7 +68,7 @@ public interface IAdasNetCommApi { * @param mode 1: enter autopilot mode, 0: quit autopilot mode * @param source 命令来源: 0: pad模拟(模拟时routeInfo传null), 1: AICloud业务 * @param routeInfo 自动驾驶路径信息 - * @return + * @return boolean */ boolean sendAutoPilotModeReq(int mode, int source, MessagePad.RouteInfo routeInfo); @@ -76,14 +76,14 @@ public interface IAdasNetCommApi { * 设置演示模式 * * @param enable 1: enable, 0: disable - * @return + * @return boolean */ boolean sendDemoModeReq(int enable); /** * 车机基础信息请求 * - * @return + * @return boolean */ boolean sendCarConfigReq(); @@ -94,7 +94,7 @@ public interface IAdasNetCommApi { * @param filename 文件路径 * @param reasonID 接管原因id * @param reason 接管原因 - * @return + * @return boolean */ boolean sendRecordCause(long key, @NonNull String filename, @NonNull String reasonID, @NonNull String reason); @@ -103,7 +103,7 @@ public interface IAdasNetCommApi { * * @param id * @param type - * @return + * @return boolean */ boolean startRecordPackage(int id, int type); @@ -112,7 +112,7 @@ public interface IAdasNetCommApi { * * @param id * @param type - * @return + * @return boolean */ boolean startRecordPackage(int id, int duration, int type); @@ -121,7 +121,7 @@ public interface IAdasNetCommApi { * * @param id * @param type - * @return + * @return boolean */ boolean stopRecordPackage(int id, int type); @@ -132,8 +132,7 @@ public interface IAdasNetCommApi { * @param duration 采集时间长 * @param type 采集类型, 1:badcase, 2: map; 3: rests * @param isRecord 采集指令, true: 采集, false: 停止采集 - * @param sustain 是否持续采集 - * @return + * @return boolean */ boolean sendRecordData(int id, int duration, int type, boolean isRecord); @@ -141,7 +140,7 @@ public interface IAdasNetCommApi { * 设置自动驾驶最大速度 * * @param speedLimit 最大车辆速度 m/s - * @return + * @return boolean */ boolean sendAutopilotSpeedReq(double speedLimit); @@ -149,8 +148,8 @@ public interface IAdasNetCommApi { * 发送红绿灯数据到工控机 * * @param crossID roadID - * @param latitude - * @param longitude + * @param latitude 纬度 + * @param longitude 经度 * @param heading 红绿灯方向 * @param direction 路的航向角 * @param lightId 红绿灯ID @@ -158,7 +157,7 @@ public interface IAdasNetCommApi { * @param arrowNo 当前车道对应地面要素转向 * @param flashYellow 黄灯总时间 * @param laneDetail 灯态具体信息 - * @return + * @return boolean */ boolean sendTrafficLightData(@NonNull String crossID, double latitude, double longitude, @NonNull String heading, @NonNull String direction, int lightId, int laneNo, @@ -167,7 +166,7 @@ public interface IAdasNetCommApi { /** * 自动驾驶路径请求 * - * @return + * @return boolean */ boolean sendGlobalPathReq(); diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/chain/AdasChain.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/chain/AdasChain.java new file mode 100644 index 0000000000..61ea468b85 --- /dev/null +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/chain/AdasChain.java @@ -0,0 +1,15 @@ +package com.zhidao.support.adas.high.chain; + +public class AdasChain { + + public static final int CHAIN_LINK_ADAS = 1; + + public static final int CHAIN_LINK_LOG_CONNECT_STATUS = 0; + public static final int CHAIN_LINK_LOG_WEB_SOCKET_DATA = 1; + + public static final String CHAIN_ALIAS_CODE_INIT = "PAD_ADAS_INIT"; + public static final String CHAIN_ALIAS_CODE_CONNECT_ADDRESS = "PAD_ADAS_CONNECT_ADDRESS"; + public static final String CHAIN_ALIAS_CODE_WEB_SOCKET_OPEN = "PAD_ADAS_WEB_SOCKET_OPEN"; + public static final String CHAIN_ALIAS_CODE_WEB_SOCKET_MESSAGE_JSON = "PAD_ADAS_WEB_SOCKET_MESSAGE_JSON"; + public static final String CHAIN_ALIAS_CODE_WEB_SOCKET_MESSAGE_BYTE = "PAD_ADAS_WEB_SOCKET_MESSAGE_BYTE"; +} diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/CupidLogUtils.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/CupidLogUtils.java index 22acc920fb..a238fdba15 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/CupidLogUtils.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/CupidLogUtils.java @@ -13,10 +13,6 @@ public class CupidLogUtils { */ // private static boolean mIsEnableLog = BuildConfig.DEBUG; private static boolean mIsEnableLog = true; - /** - * 是否写日志 - */ - private static boolean isWriteLog = true; /** * @param isEnableLog true开启 false关闭 @@ -25,15 +21,6 @@ public class CupidLogUtils { mIsEnableLog = isEnableLog; } - - public static boolean isIsWriteLog() { - return isWriteLog; - } - - public static void setIsWriteLog(boolean isWriteLog) { - CupidLogUtils.isWriteLog = isWriteLog; - } - public static void i(String tag, String msg) { if (!mIsEnableLog) { return; diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/socket/FpgaSocket.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/socket/FpgaSocket.java index c4c8208077..8468d7b437 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/socket/FpgaSocket.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/socket/FpgaSocket.java @@ -1,10 +1,12 @@ package com.zhidao.support.adas.high.socket; -import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_WEB_SOCKET_MESSAGE_BYTE; -import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_WEB_SOCKET_MESSAGE_JSON; -import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_WEB_SOCKET_OPEN; -import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_ADAS; -import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_LOG_CONNECT_STATUS; -import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_DATA; + +import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_ALIAS_CODE_WEB_SOCKET_MESSAGE_BYTE; +import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_ALIAS_CODE_WEB_SOCKET_MESSAGE_JSON; +import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_ALIAS_CODE_WEB_SOCKET_OPEN; +import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_LINK_ADAS; +import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_LINK_LOG_CONNECT_STATUS; +import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_LINK_LOG_WEB_SOCKET_DATA; +import static com.zhidao.support.adas.high.common.Constants.RESOURCE_PATH; import static com.zhidao.support.adas.high.common.Constants.WS_IP_HOST_HEAD; import android.text.TextUtils; @@ -242,7 +244,6 @@ public class FpgaSocket implements IWebSocket { @Override public void onMessage(@NonNull WebSocket webSocket, @NonNull ByteString bytes) { super.onMessage(webSocket, bytes); -// CupidLogUtils.i(TAG, "WebSocket onMessage bytes= " + bytes.hex()); if (AdasChannel.isUseQueue) { WSByteQueueManager.getInstance().addQueueData(bytes); } else { diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/IMogoMap.java b/libraries/mogo-map-api/src/main/java/com/mogo/map/IMogoMap.java index ac9ba1f7e2..dcf235541d 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/IMogoMap.java +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/IMogoMap.java @@ -9,6 +9,8 @@ import com.mogo.map.uicontroller.IMogoMapUIController; import java.util.ArrayList; +import mogo.telematics.pad.MessagePad; + /** * @author congtaowang * @since 2019-12-18 @@ -46,7 +48,7 @@ public interface IMogoMap { * * @param optionsArrayList 锚点集合 */ - void updateBatchMarkerPositon(ArrayList optionsArrayList); + void updateBatchMarkerPosition(ArrayList optionsArrayList); /** * 添加感知使用到的3d模型 diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/marker/IMogoMarkerManager.java b/libraries/mogo-map-api/src/main/java/com/mogo/map/marker/IMogoMarkerManager.java index 280ab0a0c8..678b847af1 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/marker/IMogoMarkerManager.java +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/marker/IMogoMarkerManager.java @@ -9,6 +9,8 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import mogo.telematics.pad.MessagePad; + /** * @author congtaowang * @since 2019-12-25 @@ -39,7 +41,7 @@ public interface IMogoMarkerManager { * 批量更新锚点位置 * @param optionsArrayList 锚点集合 */ - void updateBatchMarkerPosition(ArrayList optionsArrayList); + void updateBatchMarkerPosition(ArrayList optionsArrayList); /** * 添加感知使用到的3d模型 diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java index d137644a86..9b75c847e6 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java @@ -14,6 +14,8 @@ import org.json.JSONObject; import java.util.List; +import mogo.telematics.pad.MessagePad; + /** * @author congtaowang * @since 2019-12-26 @@ -298,6 +300,10 @@ public interface IMogoMapUIController { } + default void syncLocation2Map(MessagePad.GnssInfo gnssInfo) { + + } + /** * 打开鹰眼模式 * diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java index 795024249e..93d357af93 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java @@ -18,6 +18,8 @@ import org.json.JSONObject; import java.util.List; +import mogo.telematics.pad.MessagePad; + /** * @author congtaowang * @since 2019-12-26 @@ -385,6 +387,14 @@ public class MogoMapUIController implements IMogoMapUIController { } } + @Override + public void syncLocation2Map(MessagePad.GnssInfo gnssInfo) { + initDelegate(); + if (mDelegate != null) { + mDelegate.syncLocation2Map(gnssInfo); + } + } + @Override public void destroy() { mDelegate = null; diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMarkerManager.java b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMarkerManager.java index f4e74c371e..45959d5928 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMarkerManager.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMarkerManager.java @@ -3,7 +3,6 @@ package com.mogo.map; import android.content.Context; import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.data.traffic.TrafficData; import com.mogo.map.marker.IMogoMarker; import com.mogo.map.marker.IMogoMarkerManager; import com.mogo.map.marker.MogoMarkerOptions; @@ -13,6 +12,8 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import mogo.telematics.pad.MessagePad; + /** * @author congtaowang * @since 2019-12-20 @@ -68,9 +69,9 @@ public class MogoMarkerManager implements IMogoMarkerManager { } @Override - public void updateBatchMarkerPosition(ArrayList optionsArrayList) { + public void updateBatchMarkerPosition(ArrayList optionsArrayList) { try { - MogoMap.getInstance().getMogoMap().updateBatchMarkerPositon(optionsArrayList); + MogoMap.getInstance().getMogoMap().updateBatchMarkerPosition(optionsArrayList); } catch (Exception e) { e.printStackTrace(); } diff --git a/modules.txt b/modules.txt index 0213d77fe4..a9d71cb233 100644 --- a/modules.txt +++ b/modules.txt @@ -13,6 +13,7 @@ :libraries:map-usbcamera :libraries:map-custom :libraries:mogo-map +:libraries:mogo-adas-data :libraries:mogo-adas :modules:mogo-module-common :test:crashreport diff --git a/modules/mogo-module-common/src/main/AndroidManifest.xml b/modules/mogo-module-common/src/main/AndroidManifest.xml index 416b99cb53..b12147cb72 100644 --- a/modules/mogo-module-common/src/main/AndroidManifest.xml +++ b/modules/mogo-module-common/src/main/AndroidManifest.xml @@ -1,12 +1,4 @@ - + + - - - - - - - - diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/datacenter/SnapshotLocationDataCenter.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/datacenter/SnapshotLocationDataCenter.java index cca8f1a2ce..7729e25c2d 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/datacenter/SnapshotLocationDataCenter.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/datacenter/SnapshotLocationDataCenter.java @@ -2,7 +2,6 @@ package com.mogo.module.common.datacenter; 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.call.autopilot.CallerAutoPilotStatusListenerManager; import com.mogo.module.common.MogoApisHandler; import com.mogo.service.cloud.location.CloudLocationInfo; @@ -12,6 +11,8 @@ import org.json.JSONObject; import java.util.ArrayList; import java.util.List; +import mogo.telematics.pad.MessagePad; + /** * 定位坐标同步数据中心 * 接收来自工控机实际定位数据 @@ -61,13 +62,27 @@ public class SnapshotLocationDataCenter { double lat = data.optDouble("lat", -1); double alt = data.optDouble("alt", -1); double heading = data.optDouble("heading", -1); - double acceleration = data.optDouble("acceleration", -1); - double yawRate = data.optDouble("yawRate", -1); double speed = data.optDouble("speed", -1); long satelliteTime = data.optLong("satelliteTime"); long systemTime = data.optLong("systemTime"); - int gpsProvider = data.optInt("gpsProvider", 1); + realSync(lon, lat, alt, heading, speed, satelliteTime, systemTime); + } + public void syncAdasLocationInfo(MessagePad.GnssInfo gnssInfo) { + //测试面板状态同步 + DebugConfig.setStatus(DebugConfig.sLocation, true); + + double lon = gnssInfo.getLongitude(); + double lat = gnssInfo.getLatitude(); + double alt = gnssInfo.getAltitude(); + double heading = gnssInfo.getHeading(); + double speed = gnssInfo.getGnssSpeed(); + long satelliteTime = Double.valueOf(gnssInfo.getSatelliteTime()).longValue(); + long systemTime = Double.valueOf(gnssInfo.getSystemTime()).longValue(); + realSync(lon, lat, alt, heading, speed, satelliteTime, systemTime); + } + + private void realSync(double lon, double lat, double alt, double heading, double speed, long satelliteTime, long systemTime) { // 使用与渠道配置一样的gps提供者提供的数据,app/productFlavors/fPadLenovo.gradle GPS_PROVIDER 0-Android系统,1-工控机,2-OBU AutopilotStatusInfo autopilotStatusInfo = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo(); autopilotStatusInfo.setLocationLat(lat); @@ -80,22 +95,21 @@ public class SnapshotLocationDataCenter { DebugConfig.setStatusData(DebugConfig.sLat, lat); // 使用与渠道配置一样的gps提供者提供的数据 - if (gpsProvider == FunctionBuildConfig.gpsProvider) { - CloudLocationInfo cloudLocationInfo = new CloudLocationInfo(); - cloudLocationInfo.setAlt(alt); - cloudLocationInfo.setHeading(heading); - cloudLocationInfo.setLat(lat); - cloudLocationInfo.setLon(lon); - cloudLocationInfo.setSpeed(speed); - cloudLocationInfo.setSatelliteTime(satelliteTime); - cloudLocationInfo.setSystemTime(systemTime); - cloudLocationInfo.setTileId(String.valueOf(MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getTileId(lon, lat))); - mMachineCacheList.add(cloudLocationInfo); + CloudLocationInfo cloudLocationInfo = new CloudLocationInfo(); + cloudLocationInfo.setAlt(alt); + cloudLocationInfo.setHeading(heading); + cloudLocationInfo.setLat(lat); + cloudLocationInfo.setLon(lon); + cloudLocationInfo.setSpeed(speed); + cloudLocationInfo.setSatelliteTime(satelliteTime); + cloudLocationInfo.setSystemTime(systemTime); + cloudLocationInfo.setTileId(String.valueOf(MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getTileId(lon, lat))); + //todo list数据暂时无人使用,增加后会导致数据量缓慢增加 +// mMachineCacheList.add(cloudLocationInfo); - mCurLon = cloudLocationInfo.getLon(); - mCurLat = cloudLocationInfo.getLat(); - mSatelliteTime = cloudLocationInfo.getSatelliteTime(); - } + mCurLon = cloudLocationInfo.getLon(); + mCurLat = cloudLocationInfo.getLat(); + mSatelliteTime = cloudLocationInfo.getSatelliteTime(); } public double getCurLon() { diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/BaseDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/BaseDrawer.java index ce3f66ac04..14a5dc455b 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/BaseDrawer.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/BaseDrawer.java @@ -168,11 +168,11 @@ public class BaseDrawer { * @return SNTP时间 */ protected long getCurSatelliteTime() { - String satelliteTime = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getSatelliteTime(); - if (TextUtils.isEmpty(satelliteTime)) { + Long satelliteTime = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getSatelliteTime(); + if (satelliteTime == 0) { return System.currentTimeMillis(); } - return Long.parseLong(satelliteTime); + return satelliteTime; } /** diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/IdentifyDataDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/IdentifyDataDrawer.java index 53a781228f..bab304721f 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/IdentifyDataDrawer.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/IdentifyDataDrawer.java @@ -13,6 +13,8 @@ import com.mogo.module.common.MogoApisHandler; import java.util.ArrayList; import java.util.concurrent.ConcurrentHashMap; +import mogo.telematics.pad.MessagePad; + /** * @author xiaoyuzhou * @date 2021/10/19 10:45 上午 @@ -40,7 +42,7 @@ public class IdentifyDataDrawer { /** * 过滤后的数据集合 */ - private final ArrayList mFilterTrafficData = new ArrayList<>(); + private final ArrayList mFilterTrafficData = new ArrayList<>(); private IdentifyDataDrawer() { mContext = AbsMogoApplication.getApp(); @@ -67,7 +69,7 @@ public class IdentifyDataDrawer { * * @param resultList adas感知融合数据 */ - public void renderAdasRecognizedResult(ArrayList resultList) { + public void renderAdasRecognizedResult(ArrayList resultList) { if (resultList == null || resultList.isEmpty()) { clearOldMarker(); Logger.w(TAG, "感知数据为空无需渲染……"); @@ -82,14 +84,14 @@ public class IdentifyDataDrawer { // 循环将集合中的数据提取记录 - for (TrafficData trafficData : resultList) { + for (MessagePad.TrackedObject trafficData : resultList) { // 过滤掉未知感知数据 if (!FunctionBuildConfig.isDrawUnknownIdentifyData && - trafficData.getType() == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI) { + trafficData.getType() == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI.getType()) { //Logger.w(TAG, "未知感知类型数据,丢弃,不渲染"); continue; } - trafficDataUuidList.add(trafficData.getUuid()); + trafficDataUuidList.add("" + trafficData.getUuid()); } // // 找出上一针数据中已经不在本次数据中存在的数据 // for (String uuid : mMarkersCaches.keySet()) { @@ -118,11 +120,11 @@ public class IdentifyDataDrawer { * * @return 过滤后的数据集合 */ - private ArrayList filterTrafficData(ArrayList trafficData) { + private ArrayList filterTrafficData(ArrayList trafficData) { mFilterTrafficData.clear(); - for (TrafficData data : trafficData) { + for (MessagePad.TrackedObject data : trafficData) { // 过滤掉未知感知数据 - if (data.getType() == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI) { + if (data.getType() == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI.getType()) { //Logger.w(TAG, "未知感知类型数据,丢弃,不渲染"); continue; } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/SnapshotSetDataDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/SnapshotSetDataDrawer.java index 2fc292633c..00e2ba3d72 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/SnapshotSetDataDrawer.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/SnapshotSetDataDrawer.java @@ -23,7 +23,6 @@ import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.R; import com.mogo.module.common.constants.DataTypes; import com.mogo.module.common.utils.Trigonometric; -import com.mogo.service.adas.IMogoADASController; import com.mogo.service.statusmanager.IMogoStatusChangedListener; import com.mogo.service.statusmanager.StatusDescriptor; @@ -90,7 +89,6 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic sendMessage(MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches); removeUselessMarker(mMarkersCaches); mLastPositions.clear(); - AdasRecognizedResultDrawer.getInstance().notifyVrModeChanged(); //清除ADAS old marker data } public boolean isChangeCarModeStatus() { @@ -215,10 +213,6 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic if (mMarkersCaches.isEmpty()) { return; } - IMogoADASController adasControllerApi = MogoApisHandler.getInstance().getApis().getAdasControllerApi(); - if (TextUtils.isEmpty(adasControllerApi.getSatelliteTime())) { - return; - } Iterator iterator = mMarkersCaches.values().iterator(); while (iterator.hasNext()) { IMogoMarker result = iterator.next(); @@ -226,9 +220,9 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic if (proto == null) { // 后续有业务数据在操作,更新数据,不做处理 continue; } - long internal = Long.parseLong(adasControllerApi.getSatelliteTime()) - proto.getSatelliteTime(); + long internal = getCurSatelliteTime() - proto.getSatelliteTime(); Log.d("MogoArrow", "delayRemoveUselessMarker uuid : " + proto.getUuid() - + " localTime : " + adasControllerApi.getSatelliteTime() + + " localTime : " + getCurSatelliteTime() + " originTime : " + proto.getSatelliteTime() + " internal : " + internal); if (internal > 5000) { @@ -242,14 +236,10 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic if (mLastPositions.isEmpty()) { return; } - IMogoADASController adasControllerApi = MogoApisHandler.getInstance().getApis().getAdasControllerApi(); - if (TextUtils.isEmpty(adasControllerApi.getSatelliteTime()) || adasControllerApi.getSatelliteTime().equals("0")) { - return; - } Iterator iterator = mLastPositions.values().iterator(); while (iterator.hasNext()) { SocketDownData.CloudRoadDataProto result = iterator.next(); - long internal = Long.parseLong(adasControllerApi.getSatelliteTime()) - result.getSatelliteTime(); + long internal = getCurSatelliteTime() - result.getSatelliteTime(); if (internal > 3000) { iterator.remove(); } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java index 80e67b7ed2..d302d02119 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java @@ -297,10 +297,6 @@ public class MockIntentHandler implements IntentHandler { MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController() .rtkEnable(false); break; - case 39:// 使用自动驾驶车的定位数据 - MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController() - .syncLocation2Map(null); - break; case 40: double[][] coors = new double[][]{{40.17511749267578, 116.74359130859375}, {40.20258331298828, 116.74071502685547}, @@ -789,9 +785,9 @@ public class MockIntentHandler implements IntentHandler { try { if (FunctionBuildConfig.isDrawIdentifyData) { - ThreadUtils.getSinglePool().execute(() -> - IdentifyDataDrawer.getInstance().renderAdasRecognizedResult(trafficData) - ); +// ThreadUtils.getSinglePool().execute(() -> +// IdentifyDataDrawer.getInstance().renderAdasRecognizedResult(trafficData) +// ); } else { IdentifyDataDrawer.getInstance().clearOldMarker(); } @@ -825,9 +821,9 @@ public class MockIntentHandler implements IntentHandler { try { if (FunctionBuildConfig.isDrawIdentifyData) { - ThreadUtils.getSinglePool().execute(() -> - IdentifyDataDrawer.getInstance().renderAdasRecognizedResult(trafficData) - ); +// ThreadUtils.getSinglePool().execute(() -> +// IdentifyDataDrawer.getInstance().renderAdasRecognizedResult(trafficData) +// ); } else { IdentifyDataDrawer.getInstance().clearOldMarker(); } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/routeoverlay/MogoRouteOverlayManager.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/routeoverlay/MogoRouteOverlayManager.java index 7e33f9f63d..e50568b827 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/routeoverlay/MogoRouteOverlayManager.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/routeoverlay/MogoRouteOverlayManager.java @@ -4,9 +4,6 @@ import android.content.Context; import android.util.Log; import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo; -import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo; -import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo; -import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo; import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo; import com.mogo.eagle.core.data.config.FunctionBuildConfig; import com.mogo.eagle.core.data.map.MogoLatLng; @@ -18,7 +15,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager; import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager; import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.mogo.eagle.core.utilcode.util.GsonUtils; import com.mogo.module.common.utils.DrivingDirectionUtils; import org.jetbrains.annotations.NotNull; @@ -27,6 +23,9 @@ import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; +import mogo.telematics.pad.MessagePad; +import mogo_msg.MogoReportMsg; + public class MogoRouteOverlayManager implements IMoGoAutopilotPlanningListener, IMoGoAutopilotStatusListener, IMoGoMapLocationListener { @@ -102,13 +101,13 @@ public class MogoRouteOverlayManager implements } @Override - public void onAutopilotRotting(AutopilotRouteInfo routeList) { - if (routeList.getModels() == null || routeList.getModels().size() == 0) { + public void onAutopilotRotting(MessagePad.GlobalPathResp globalPathResp) { + if (globalPathResp == null || globalPathResp.getWayPointsList().size() == 0) { return; } List latLngList = new ArrayList<>(); - for (AutopilotRouteInfo.RouteModels routeModel : routeList.getModels()) { - latLngList.add(new MogoLatLng(routeModel.getLat(), routeModel.getLon())); + for (MessagePad.Location routeModel : globalPathResp.getWayPointsList()) { + latLngList.add(new MogoLatLng(routeModel.getLatitude(), routeModel.getLongitude())); } int listSize = latLngList.size(); mEnding = latLngList.get(listSize - 1); @@ -120,7 +119,7 @@ public class MogoRouteOverlayManager implements if (FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData) { return; } - this.STATUS_AUTOPILOT = autoPilotStatusInfo.getControl_pilotmode(); + this.STATUS_AUTOPILOT = autoPilotStatusInfo.getPilotmode(); //Log.d("lianglihui","onAutopilotStatusResponse:"+STATUS_AUTOPILOT); // if (STATUS_AUTOPILOT == 1 ){ // if (mEnding != null){ @@ -128,7 +127,7 @@ public class MogoRouteOverlayManager implements // } // }else { // -// }我 +// } if (STATUS_AUTOPILOT != 1) { RouteOverlayDrawer.getInstance(mContext).clearEndingMarker(); RouteOverlayDrawer.getInstance(mContext).clearMogoRouteOverlay(); @@ -136,20 +135,16 @@ public class MogoRouteOverlayManager implements } @Override - public void onAutopilotArriveAtStation(@Nullable AutopilotStationInfo autopilotWayArrive) { + public void onAutopilotArriveAtStation(MessagePad.ArrivalNotification arrivalNotification) { - if (autopilotWayArrive == null) { + if (arrivalNotification == null) { return; } - Logger.d(TAG, "onArriveAt data : " + autopilotWayArrive.toString()); + Logger.d(TAG, "onArriveAt data : " + arrivalNotification.toString()); // //演示模式下 到达终点将忽略 引导线绘制 选项关闭 // FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false; } - @Override - public void onAutopilotGuardian(@Nullable AutopilotGuardianStatusInfo guardianInfo) { - - } @Override public void onAutopilotSNRequest() { @@ -157,7 +152,7 @@ public class MogoRouteOverlayManager implements } @Override - public void onLocationChanged(@Nullable MogoLocation location) { //todo 拖尾 + public void onLocationChanged(@Nullable MogoLocation location) { // mLocation = location; // if (mTrajectoryList.isEmpty()) { // return; @@ -184,18 +179,18 @@ public class MogoRouteOverlayManager implements mLocation = location; List temp = mTrajectoryList; - if (temp.isEmpty()){ + if (temp.isEmpty()) { return; } // Log.e(TAG, "onLocationChanged: size = "+ mTrajectoryList.size()+" ----- "+mLocation.getLongitude()+"-"+mLocation.getLatitude()); - ArrayList list = new ArrayList(); - for (MogoLatLng latLng:temp) { + ArrayList list = new ArrayList(); + for (MogoLatLng latLng : temp) { // if(!isPointOnCarFront(mLocation,latLng)){ - list.add(latLng); + list.add(latLng); // } } - Log.d(TAG,"TrajectoryData = " + FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData + "---status = " + STATUS_AUTOPILOT + "----size = " + list.size()); - if (FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData || STATUS_AUTOPILOT == 1){ + Log.d(TAG, "TrajectoryData = " + FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData + "---status = " + STATUS_AUTOPILOT + "----size = " + list.size()); + if (FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData || STATUS_AUTOPILOT == 1) { RouteOverlayDrawer.getInstance(mContext).drawTrajectoryList(list); } } @@ -218,4 +213,9 @@ public class MogoRouteOverlayManager implements } } + @Override + public void onAutopilotGuardian(MogoReportMsg.MogoReportMessage guardianInfo) { + + } + } diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoADASController.java b/services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoADASController.java index 4838429a4f..79661e5e81 100644 --- a/services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoADASController.java +++ b/services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoADASController.java @@ -39,13 +39,13 @@ public interface IMogoADASController extends IProvider { /** * 获取由工控机传回的GPS星历时间 * - * @return + * @return Long */ - String getSatelliteTime(); + Long getSatelliteTime(); /** * 设置自车的GPS星历时间 */ - void setSatelliteTime(String satelliteTime); + void setSatelliteTime(Long satelliteTime); } diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java b/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java index 73607cfaf3..2862da2fa0 100644 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java +++ b/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java @@ -14,7 +14,7 @@ public class MogoADASController implements IMogoADASController { private double mLastLon; private double mLastLat; - private String mSatelliteTime; + private Long mSatelliteTime; @Override public double getLastLat() { @@ -37,12 +37,12 @@ public class MogoADASController implements IMogoADASController { } @Override - public String getSatelliteTime() { + public Long getSatelliteTime() { return mSatelliteTime; } @Override - public void setSatelliteTime(String satelliteTime) { + public void setSatelliteTime(Long satelliteTime) { mSatelliteTime = satelliteTime; } diff --git a/settings.gradle b/settings.gradle index c7f0c40ac2..2fe6044a80 100644 --- a/settings.gradle +++ b/settings.gradle @@ -62,13 +62,11 @@ include ':libraries:map-custom' include ':libraries:mogo-map-api' include ':libraries:mogo-map' include ':libraries:mogo-adas' +include ':libraries:mogo-adas-data' // OLD业务模块 include ':modules:mogo-module-common' include ':modules:mogo-module-service' -//include ':modules:mogo-module-carchatting' -//include ':modules:mogo-module-carchattingprovider' -//include ':modules:mogo-module-chat' // 语音 include ':tts:tts-base'