Merge branch 'dev_robotaxi-d-app-module_2110_220915_2.11.0' into dev_local_2.12.0

This commit is contained in:
wangmingjun
2022-10-18 14:12:17 +08:00
39 changed files with 2149 additions and 586 deletions

View File

@@ -157,6 +157,7 @@ public class BusPassengerModel {
|| data.getResult() == null
|| data.getResult().getSites() == null) {
routesResult = null;
startOrStopCalculateRouteInfo(false);
if (mRouteLineInfoCallback != null){
mRouteLineInfoCallback.showNoTaskView();
}

View File

@@ -105,6 +105,7 @@ public abstract class BusPassengerBaseFragment<V extends IView, P extends Presen
mCurrentArriveStation.setText("----");
mCurrentArriveStationTitle.setText(getResources().getString(R.string.bus_p_cur_station_title_init));
mCurrentArriveTip.setText(getResources().getString(R.string.bus_p_cur_station_arrived_tip));
removeProgressBar();
}else {
mCurrentArriveStation.setText(station);
if (currentIndex == 0){

View File

@@ -228,7 +228,7 @@ public class BusPassengerMapDirectionView
addRouteColorList();
if (mCoordinatesLatLng.size() > 2) {
if (mLinePointsLatLng.size() > 2) {
//设置线段纹理
PolylineOptions polylineOptions = new PolylineOptions();

View File

@@ -148,7 +148,7 @@ public class BusPassengerRouteFragment extends
if (latLngList.size() > 0) {
drawablePolyline(latLngList,haveArrivedIndex);
} else {
clearPolyline();
clearMapView();
}
}
@@ -164,7 +164,7 @@ public class BusPassengerRouteFragment extends
});
}
} else {
clearPolyline();
clearMapView();
}
}
@@ -185,13 +185,13 @@ public class BusPassengerRouteFragment extends
}
}
public void clearPolyline() {
public void clearMapView() {
if (mMapDirectionView != null) {
UiThreadHandler.post(new Runnable() {
@Override
public void run() {
mMapDirectionView.clearPolyline();
mMapDirectionView.clearCoordinatesLatLng();
}
});
}
@@ -230,7 +230,7 @@ public class BusPassengerRouteFragment extends
mNoLineInfoView.setVisibility(View.VISIBLE);
mRouteInfoView.setVisibility(View.GONE);
updateArrivedStation(null,0,true);
clearPolyline();
clearMapView();
clearMapMarkers();
}
}
@@ -240,10 +240,10 @@ public class BusPassengerRouteFragment extends
mNoLineInfoView.setVisibility(View.VISIBLE);
mRouteInfoView.setVisibility(View.GONE);
updateArrivedStation(null,0,true);
clearPolyline();
clearMapView();
clearMapMarkers();
}
emptyTv.setText(getString(R.string.bus_p_no_task));
emptyTv.setText(getString(R.string.bus_p_no_task));
}
public void hideNoTaskView(){
@@ -285,8 +285,7 @@ public class BusPassengerRouteFragment extends
if (currentStationIndex == 0 && isArrived){ //到达始发站且并未出发, 恢复站点marker 清楚路径 清空路径点
SharedPrefsMgr.getInstance(getContext())
.remove(BusPassengerConst.BUS_SP_KEY_ORDER_SUM_DIS);
if (mMapDirectionView != null) mMapDirectionView.clearCoordinatesLatLng();
clearPolyline();
clearMapView();
}
if (stations.size() > 0){

View File

@@ -34,6 +34,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListener
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.hmi.ui.widget.TrafficDataView;
import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.AiRoadMarker;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
@@ -137,18 +138,24 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
public void onClickImpl(View v) {
//切换地图的远近视图
if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isLongSight()) {
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).visibleAllMarkers();
// 2.11.0去掉
// MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).visibleAllMarkers();
AiRoadMarker.INSTANCE.restore();
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
} else if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isMediumSight()) {
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
.inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS, BusConst.TYPE_MARKER_BUS_ORDER);
// 2.11.0去掉
// MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
// .inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS, BusConst.TYPE_MARKER_BUS_ORDER);
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_long);
AiRoadMarker.INSTANCE.clear();
} else {
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).visibleAllMarkers();
// 2.11.0去掉
// MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).visibleAllMarkers();
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
AiRoadMarker.INSTANCE.restore();
}
}
});

View File

@@ -347,10 +347,9 @@ public class BusOrderModel {
startLon, startLat,
location.getLongitude(), location.getLatitude() );
CallerLogger.INSTANCE.d(M_BUS + TAG,"judgeArrivedStation() distance = " + distance
+" to " + upcomingStation.getName());
if ( distance <= BusConst.ARRIVE_AT_END_STATION_DISTANCE ) {
CallerLogger.INSTANCE.d(M_BUS + TAG,"行程日志-judgeArrivedStation() distance = " + distance
+" to " + upcomingStation.getName());
onArriveAt(null); //无自动驾驶到站信息传null
return;
}
@@ -453,7 +452,7 @@ public class BusOrderModel {
@Override
public void onSuccess(BaseData o) {
CallerLogger.INSTANCE.d(M_BUS + TAG, "abortTask success: " + o);
isGoingToNextStation = false;
clearNativeTag();
if (o.code == 0){ // 重置成功
queryBusRoutes();
startOrStopQueryPassengerWriteOff(false);
@@ -468,39 +467,32 @@ public class BusOrderModel {
}
private void clearNativeTag() {
isGoingToNextStation = false;
backgroundCurrentStationIndex = 0;
}
/**
* 离站上报成功后渲染站点
* 服务端返回的OchBusRoutesResult逻辑 离开站为当前站, 到达下一站后才会将下一站置为当前站,
* 车机端展示是离开当前站,下一站设置为当前站, 所以服务端数据回来要做处理,不能直接渲染
*/
private void leaveStationSuccess() {
private void leaveStationSuccess(int leaveIndex) {
//开启自动驾驶 2.10.0: 如果自动驾驶状态下开启, 非自动驾驶状态下不开启,需手动点击自动驾驶按钮开启
isGoingToNextStation = true;
if (CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState()
== IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){
startAutopilot(false);
startAutopilot(false,leaveIndex);
}else {
firstStartAutopilot = 0;
}
if (isGoingToNextStation) {
// 为了避免恢复自动驾驶时重复的接口请求
return;
}
isGoingToNextStation = true;
// AIAssist.getInstance( mContext ).speakTTSVoice( "欢迎乘坐’蘑菇车联‘无人驾驶小巴车,请您坐好,注意乘车安全,行程即将开始" );
}
/**
* 开启自动驾驶
* @param isRestart
*/
private void startAutopilot(boolean isRestart) {
if (backgroundCurrentStationIndex +1 > stationList.size() - 1 || !isGoingToNextStation){
CallerLogger.INSTANCE.e(M_BUS + TAG, "mismatch condition.");
return;
}
private void startAutopilot(boolean isRestart,int leaveIndex) {
if (!FunctionBuildConfig.isDemoMode && !OCHAdasAbilityManager.getInstance().getAutopilotAbilityStatus()){
ToastUtils.showLong(OCHAdasAbilityManager.getInstance().getAutopilotUnAbilityReason() +
@@ -512,20 +504,17 @@ public class BusOrderModel {
triggerStartServiceEvent(isRestart, false);
BusStationBean currentStation = stationList.get( backgroundCurrentStationIndex);
BusStationBean nextStation = stationList.get( backgroundCurrentStationIndex + 1);
AutopilotControlParameters parameters = initAutopilotControlParameters();
AutopilotControlParameters parameters = initAutopilotControlParameters(leaveIndex);
if (null == parameters) {
CallerLogger.INSTANCE.e(M_BUS + TAG, "AutopilotControlParameters is empty.");
CallerLogger.INSTANCE.e(M_BUS + TAG, "行程日志-AutopilotControlParameters is empty.");
return;
}
CallerAutoPilotManager.INSTANCE.startAutoPilot(parameters);
CallerLogger.INSTANCE.d( M_BUS + TAG, "开启自动驾驶====" + GsonUtil.jsonFromObject(parameters)
+" startLatLon="+currentStation.getName()+"endLatLon="+nextStation.getName() +
"isRestart = " + isRestart);
CallerLogger.INSTANCE.d( M_BUS + TAG, "行程日志-开启自动驾驶====" + GsonUtil.jsonFromObject(parameters)
+" startLatLon="+parameters.startName+"endLatLon="+parameters.endName +
"isRestart = " + isRestart);
if (mControllerStatusCallback != null) {
mControllerStatusCallback.startOpenAutopilot();
@@ -603,7 +592,7 @@ public class BusOrderModel {
new IBusServiceCallback<BaseData>() {
@Override
public void onSuccess(BaseData o) {
CallerLogger.INSTANCE.d(M_BUS + TAG,"arriveSiteStation success");
CallerLogger.INSTANCE.d(M_BUS + TAG,"行程日志-arriveSiteStation success");
queryBusRoutes();
ttsTips(String.format(mContext
@@ -643,12 +632,12 @@ public class BusOrderModel {
@Override
public void onSuccess(BaseData o) {
isArrivedStation = false;
CallerLogger.INSTANCE.d( M_BUS + TAG, "自动驾驶开启开往下一站====" );
CallerLogger.INSTANCE.d( M_BUS + TAG, "行程日志-离站成功开往下一站====" );
//需要更改当前站和下一站的状态 然后渲染
startOrStopQueryPassengerWriteOff(false);
leaveStationSuccess();
leaveTTSTips(finalNextStationName);
queryBusRoutes();
leaveStationSuccess(backgroundCurrentStationIndex);
leaveTTSTips(finalNextStationName);
}
@Override
public void onFail(String failMsg) {
@@ -685,9 +674,9 @@ public class BusOrderModel {
public void closeBeautificationMode() {
Logger.d("Route", "BusOrderModel -> closeBeautificationMode ==> isDemoMode:" + FunctionBuildConfig.isDemoMode);
if (FunctionBuildConfig.isDemoMode) {//收车结束美化
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false;
CallerAutoPilotManager.INSTANCE.setIgnoreConditionDraw(false);
CallerAutoPilotManager.INSTANCE.setIPCDemoMode(false);
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false; //是否强制绘制引导线
CallerAutoPilotManager.INSTANCE.setIgnoreConditionDraw(false);// 同步给乘客屏
CallerAutoPilotManager.INSTANCE.setIPCDemoMode(false);//是否自动启动自驾
CallerLogger.INSTANCE.d(M_BUS + TAG, "美化模式-ignore置为false");
}
}
@@ -745,7 +734,8 @@ public class BusOrderModel {
BusStationBean currentStation = stationList.get(backgroundCurrentStationIndex);
CallerLogger.INSTANCE.d( M_BUS + TAG,
"渲染站点信息服务端currentStationIndex="+backgroundCurrentStationIndex
"行程日志-STATION_STATUS_STOPPED-backgroundCurrentStationIndex="
+backgroundCurrentStationIndex
+" isLeaving()="+currentStation.isLeaving());
// 美化是否开始
@@ -755,9 +745,13 @@ public class BusOrderModel {
if (stationList.get(backgroundCurrentStationIndex).isLeaving()){
startBeautificationMode();
CallerLogger.INSTANCE.d(M_BUS + TAG, "美化模式-ignore置为true每次滑动出发");
}else {
}else if (backgroundCurrentStationIndex >0 && backgroundCurrentStationIndex < stationList.size()-1){
//美化模式下 中间站点到站 引导线要一直绘制所以此处不出强制绘制不传false
CallerAutoPilotManager.INSTANCE.setIPCDemoMode(false);
CallerLogger.INSTANCE.d(M_BUS + TAG, "美化模式-ignorefalse到达中间站");
clearStartAutopilotTag();
}else{
closeBeautificationMode();
CallerLogger.INSTANCE.d(M_BUS + TAG, "美化模式-ignorefalse到站");
clearStartAutopilotTag();
}
}
@@ -802,9 +796,9 @@ public class BusOrderModel {
* 在踩刹车、控制方向盘等操作后,会停止自动驾驶,重启自动驾驶的话相当于重新设置自动驾驶目的地
*/
public void restartAutopilot() {
CallerLogger.INSTANCE.d( M_BUS + TAG, "重启自动驾驶===" + isGoingToNextStation );
CallerLogger.INSTANCE.d( M_BUS + TAG, "行程日志-重启自动驾驶===" + isGoingToNextStation );
//只去启动自动驾驶,不再去上报离站
startAutopilot(firstStartAutopilot >= 1);
startAutopilot(firstStartAutopilot >= 1,-1);
}
public boolean isRestartAutopilot(){
@@ -837,8 +831,7 @@ public class BusOrderModel {
public void onSuccess(BaseData o) {
CallerLogger.INSTANCE.d(M_BUS + TAG, "endTask success: " + o);
if (o.code == 0){
isGoingToNextStation = false;
backgroundCurrentStationIndex = 0;
clearNativeTag();
queryBusRoutes();// 重新获取任务
startOrStopQueryPassengerWriteOff(false);
ttsTips(mContext.getString(R.string.bus_end_task_tip));
@@ -858,20 +851,14 @@ public class BusOrderModel {
*/
public void onArriveAt( MessagePad.ArrivalNotification data){
if ( backgroundCurrentStationIndex +1 > stationList.size() - 1 ) {
CallerLogger.INSTANCE.e( M_BUS + TAG, "到站异常,取消后续操作结束" );
CallerLogger.INSTANCE.e( M_BUS + TAG, "行程日志-到站异常,取消后续操作结束" );
return;
}
if (isArrivedStation) return;
isArrivedStation = true;
// if (FunctionBuildConfig.isDemoMode && backgroundCurrentStationIndex <= stationList.size() - 1) {//到达一站结束美化
// closeBeautificationMode();
// CallerLogger.INSTANCE.d(M_BUS + TAG, "美化模式-ignore置为false到最后一站");
// }
CallerLogger.INSTANCE.d( M_BUS + TAG, "到站====currentStationIndex=" + backgroundCurrentStationIndex);
CallerLogger.INSTANCE.d( M_BUS + TAG, "行程日志-到站==backgroundCurrentStationIndex=" + backgroundCurrentStationIndex);
isGoingToNextStation = false;
arriveSiteStation();
@@ -934,7 +921,7 @@ public class BusOrderModel {
*/
private void updateAutopilotControlParameters() {
AutopilotControlParameters parameters = initAutopilotControlParameters();
AutopilotControlParameters parameters = initAutopilotControlParameters(-1);
if (null == parameters){
CallerLogger.INSTANCE.e(M_BUS + TAG, "AutopilotControlParameters is empty.");
return;
@@ -948,14 +935,25 @@ public class BusOrderModel {
CallerAutoPilotStatusListenerManager.INSTANCE.updateAutopilotControlParameters(null);
}
private AutopilotControlParameters initAutopilotControlParameters() {
if (backgroundCurrentStationIndex +1 > stationList.size() - 1 || !isGoingToNextStation){
CallerLogger.INSTANCE.e(M_BUS + TAG, "mismatch condition.");
return null;
}
private AutopilotControlParameters initAutopilotControlParameters(int leaveIndex) {
BusStationBean currentStation = null;
BusStationBean nextStation = null;
BusStationBean currentStation = stationList.get( backgroundCurrentStationIndex);
BusStationBean nextStation = stationList.get( backgroundCurrentStationIndex + 1);
if (leaveIndex < 0){
if (backgroundCurrentStationIndex +1 > stationList.size() - 1 || !isGoingToNextStation){
CallerLogger.INSTANCE.e(M_BUS + TAG, "行程日志-mismatch condition1.");
return null;
}
currentStation = stationList.get( backgroundCurrentStationIndex);
nextStation = stationList.get( backgroundCurrentStationIndex + 1);
}else {
if (leaveIndex +1 > stationList.size() - 1 || !isGoingToNextStation){
CallerLogger.INSTANCE.e(M_BUS + TAG, "行程日志-mismatch condition2.");
return null;
}
currentStation = stationList.get( leaveIndex);
nextStation = stationList.get( leaveIndex + 1);
}
AutopilotControlParameters parameters = new AutopilotControlParameters();
parameters.routeID = busRoutesResult.getLineId();
@@ -977,6 +975,7 @@ public class BusOrderModel {
busRoutesResult.txtFileUrlDPQP, busRoutesResult.txtFileMd5DPQP,
busRoutesResult.contrailSaveTimeDPQP);
}
return parameters;
}
}

View File

@@ -56,7 +56,6 @@ public class BusPresenter extends Presenter<BusFragment>
private int currentAutopilotStatus = -1;
private List<BusStationBean> mStationList = new ArrayList<>();
private int mCurrentStation = 0;
// private boolean isRestartAutopilot = false;
public BusPresenter(BusFragment view) {
super(view);
@@ -147,17 +146,6 @@ public class BusPresenter extends Presenter<BusFragment>
runOnUIThread(() -> mView.clearBusStationsMarkers());
}
private void functionDemoModeChange() {
// CallerLogger.INSTANCE.d(M_BUS + "BusOrderModel ="," functionDemoModeChange ="+mCurrentStation);
if (FunctionBuildConfig.isDemoMode
&& ((mCurrentStation > 0 && mCurrentStation < mStationList.size() - 1)
|| ((mCurrentStation == 0 || mCurrentStation == mStationList.size() - 1)
&& BusOrderModel.getInstance().isGoingToNextStation()))) {
runOnUIThread(() -> mView.onAutopilotStatusChanged(
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING));
}
}
@Override
public void hideSlidePanel() {
if (mView != null) {
@@ -168,6 +156,7 @@ public class BusPresenter extends Presenter<BusFragment>
@Override
public void onAutopilotArriveAtStation(MessagePad.ArrivalNotification arrivalNotification) {
CallerLogger.INSTANCE.e( M_BUS + TAG, "行程日志-onAutopilotArriveAtStation arrive");
BusOrderModel.getInstance().onArriveAt(arrivalNotification);
}
@@ -184,62 +173,51 @@ public class BusPresenter extends Presenter<BusFragment>
switch (state) {
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE:
if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) {
if (currentAutopilotStatus == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {//2-->1语音提示
// AIAssist.getInstance( getContext() ).speakTTSVoice( "已进入人工驾驶模式" );
}
currentAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE;
// 设置UI【自动驾驶】按钮是否展示
runOnUIThread(() -> mView.onAutopilotEnableChange(true));
// if (BusOrderModel.getInstance().isGoingToNextStation()) {
// runOnUIThread(() -> mView.hideSlidePanel());
// }
if (FunctionBuildConfig.isDemoMode
&& (
(mCurrentStation > 0 && mCurrentStation < mStationList.size() - 1)
|| (
(mCurrentStation == 0 || mCurrentStation == mStationList.size() - 1)
&& BusOrderModel.getInstance().isGoingToNextStation()
)
)
) {
CallerLogger.INSTANCE.d(M_BUS + "BusOrderModel=", "有美化功能");
return;
}
// 改变UI自动驾驶状态
runOnUIThread(() -> mView.onAutopilotStatusChanged(currentAutopilotStatus));
}
if (FunctionBuildConfig.isDemoMode
&& (
(mCurrentStation >= 0 && mCurrentStation <= mStationList.size() - 1)
&& BusOrderModel.getInstance().isGoingToNextStation()
)
) {
CallerLogger.INSTANCE.d(M_BUS + "BusOrderModel=", "有美化功能");
return;
}
if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) {
currentAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE;
}
// 改变UI自动驾驶状态
runOnUIThread(() -> mView.onAutopilotStatusChanged(currentAutopilotStatus));
break;
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING:
if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
currentAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING;
// 改变UI自动驾驶状态
runOnUIThread(() -> mView.onAutopilotStatusChanged(currentAutopilotStatus));
BusOrderModel.getInstance().triggerStartServiceEvent(
BusOrderModel.getInstance().isRestartAutopilot(), true);
}
// 改变UI自动驾驶状态
runOnUIThread(() -> mView.onAutopilotStatusChanged(currentAutopilotStatus));
break;
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE:
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)
&& BusOrderModel.getInstance().isGoingToNextStation()
)
)
) {
CallerLogger.INSTANCE.d(M_BUS + "BusOrderModel=", "有美化功能");
return;
}
runOnUIThread(() -> {
mView.onAutopilotStatusChanged(currentAutopilotStatus);
});
if (FunctionBuildConfig.isDemoMode
&& (
(mCurrentStation >= 0 && mCurrentStation <= mStationList.size() - 1)
&& BusOrderModel.getInstance().isGoingToNextStation()
)
) {
CallerLogger.INSTANCE.d(M_BUS + "BusOrderModel=", "有美化功能");
return;
}
if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
currentAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE;
}
runOnUIThread(() -> {
mView.onAutopilotStatusChanged(currentAutopilotStatus);
});
break;
default:
runOnUIThread(() -> mView.onAutopilotEnableChange(false));

View File

@@ -258,15 +258,15 @@ class TaxiLoginDialogFragment : MvpDialogFragment<TaxiLoginDialogFragment?, OchC
mShownByMe.isAccessible = true
mDismissed.setBoolean(this, false)
mShownByMe.setBoolean(this, true)
if (isAdded) { //解决方法就是添加这行代码如果已经添加了就移除掉然后再show就不会出现Fragment already added的错误了。
return
}
val ft: FragmentTransaction = manager.beginTransaction()
ft.add(this, tag)
ft.commitAllowingStateLoss()
} catch (e: Exception) {
Log.e("DialogFragment", "show", e.fillInStackTrace())
}
if (isAdded) { //解决方法就是添加这行代码如果已经添加了就移除掉然后再show就不会出现Fragment already added的错误了。
return
}
val ft: FragmentTransaction = manager.beginTransaction()
ft.add(this, tag)
ft.commitAllowingStateLoss()
}

View File

@@ -2,19 +2,15 @@ package com.mogo.och.common.module.manager;
import android.content.Context;
import androidx.annotation.Nullable;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.zhidao.support.adas.high.AdasManager;
import com.zhidao.support.adas.high.OnAdasListener;
import com.zhidao.support.adas.high.bean.AutopilotAbility;
import com.zhidao.support.adas.high.common.ProtocolStatus;
import chassis.Chassis;
import chassis.VehicleStateOuterClass;
import mogo.telematics.pad.MessagePad;
import mogo_msg.MogoReportMsg;
import perception.TrafficLightOuterClass;
import prediction.Prediction;
import record_cache.RecordPanelOuterClass;
import system_master.SystemStatusInfo;
/**
@@ -22,11 +18,10 @@ import system_master.SystemStatusInfo;
* 工控机状态信息回调(判断是否能否启动自动驾驶的回调)
* 目前定的是3秒回调一次
*/
public class OCHAdasAbilityManager {
public class OCHAdasAbilityManager implements IMoGoAutopilotActionsListener {
private static final String TAG = OCHAdasAbilityManager.class.getSimpleName();
private boolean isAutopilotAbility = true;
private String autopilotAbilityReason = "";
@@ -52,164 +47,48 @@ public class OCHAdasAbilityManager {
private void initListeners() {
//2022.10.9 工控机状态信息回调(判断是否能否启动自动驾驶的回调), 目前定的是3秒回调一次
AdasManager.getInstance().setOnAdasListener(adasListener);
CallerAutopilotActionsListenerManager.INSTANCE.addListener(TAG, this);
}
private void releaseListeners() {
AdasManager.getInstance().setOnAdasListener(null);
CallerAutopilotActionsListenerManager.INSTANCE.removeListener(this);
}
@Override
public void onAutopilotAbility(@Nullable AutopilotAbility ability) {
isAutopilotAbility = true;
autopilotAbilityReason = null;
if (ability.gear == null || ability.gear == Chassis.GearPosition.GEAR_P ||
ability.gear == Chassis.GearPosition.GEAR_R) {
isAutopilotAbility = false;
autopilotAbilityReason = "挡位不正常";
}
if (DebugConfig.getProductFlavor() == "fPadLenovoOchBus" &&
ability.gear == Chassis.GearPosition.GEAR_N){ //bus档位不正常
isAutopilotAbility = false;
autopilotAbilityReason = "挡位不正常";
}
if (isAutopilotAbility)
if (ability.brake > 0) {
isAutopilotAbility = false;
autopilotAbilityReason = "制动踏板被踩下";
}
if (isAutopilotAbility)
if (ability.statusInfo.getSysState() == SystemStatusInfo.SystemState.SYS_STARTING) {
isAutopilotAbility = false;
autopilotAbilityReason = "系统正在启动";
}
if (isAutopilotAbility)
if (ability.statusInfo.getSysState() == SystemStatusInfo.SystemState.SYS_EXITING) {
isAutopilotAbility = false;
autopilotAbilityReason = "系统正在关闭";
}
Logger.d(TAG, "是否可以启动自动驾驶=" + isAutopilotAbility + " 原因=" + autopilotAbilityReason);
}
public void release() {
releaseListeners();
}
private final OnAdasListener adasListener = new OnAdasListener() {
@Override
public void onTrajectory(MessagePad.Header header, MessagePad.Trajectory trajectory) {
}
@Override
public void onTrackedObjects(MessagePad.Header header, MessagePad.TrackedObjects trackedObjects) {
}
@Override
public void onGnssInfo(MessagePad.Header header, MessagePad.GnssInfo gnssInfo) {
}
@Override
public void onVehicleState(MessagePad.Header header, VehicleStateOuterClass.VehicleState vehicleState) {
}
@Override
public void onAutopilotState(MessagePad.Header header, MessagePad.AutopilotState autopilotState) {
}
@Override
public void onReportMessage(MessagePad.Header header, MogoReportMsg.MogoReportMessage mogoReportMessage) {
}
@Override
public void onPerceptionTrafficLight(MessagePad.Header header, TrafficLightOuterClass.TrafficLights trafficLights) {
}
@Override
public void onPredictionObstacleTrajectory(MessagePad.Header header, Prediction.mPredictionObjects predictionObjects) {
}
@Override
public void onPointCloud(byte[] pointCloud) {
}
@Override
public void onPlanningObjects(MessagePad.Header header, MessagePad.PlanningObjects planningObjects) {
}
@Override
public void onBasicInfoReq(MessagePad.Header header, MessagePad.BasicInfoReq basicInfoReq) {
}
@Override
public void onCarConfigResp(MessagePad.Header header, MessagePad.CarConfigResp carConfigResp) {
}
@Override
public void onRecordResult(MessagePad.Header header, RecordPanelOuterClass.RecordPanel recordPanel) {
}
@Override
public void onGlobalPathResp(MessagePad.Header header, MessagePad.GlobalPathResp globalPathResp) {
}
@Override
public void onWarn(MessagePad.Header header, MessagePad.Warn warn) {
}
@Override
public void onArrivalNotification(MessagePad.Header header, MessagePad.ArrivalNotification arrivalNotification) {
}
@Override
public void onStatusQueryResp(MessagePad.Header header, SystemStatusInfo.StatusInfo statusInfo) {
}
@Override
public void onRecordDataConfigResp(MessagePad.Header header, MessagePad.RecordDataConfig config) {
}
@Override
public void onPlanningActionMsg(MessagePad.Header header, MessagePad.PlanningActionMsg planningActionMsg) {
}
@Override
public void onError(ProtocolStatus status, byte[] bytes) {
}
@Override
public void onAutopilotAbility(AutopilotAbility ability) {
isAutopilotAbility = true;
autopilotAbilityReason = null;
if (ability.gear == null || ability.gear == Chassis.GearPosition.GEAR_P || ability.gear == Chassis.GearPosition.GEAR_R) {
isAutopilotAbility = false;
autopilotAbilityReason = "挡位不正常";
}
if (isAutopilotAbility)
if (ability.brake > 0) {
isAutopilotAbility = false;
autopilotAbilityReason = "制动踏板被踩下";
}
if (isAutopilotAbility)
if (ability.statusInfo.getSysState() == SystemStatusInfo.SystemState.SYS_STARTING) {
isAutopilotAbility = false;
autopilotAbilityReason = "系统正在启动";
}
if (isAutopilotAbility)
if (ability.statusInfo.getSysState() == SystemStatusInfo.SystemState.SYS_EXITING) {
isAutopilotAbility = false;
autopilotAbilityReason = "系统正在关闭";
}
// 暂时先拦截及提示以上4种异常情况
// if (isAutopilotAbility)
// if (ability.statusInfo == null) {
// isAutopilotAbility = false;
// autopilotAbilityReason = "系统Topic不正常";
// }
// if (isAutopilotAbility)
// if (ability.statusInfo.getSysState() == SystemStatusInfo.SystemState.SYS_FAULT) {
// isAutopilotAbility = false;
// autopilotAbilityReason = "系统异常";
// }
//
// if (isAutopilotAbility)
// for (SystemStatusInfo.HealthInfo healthInfo : ability.statusInfo.getHealthInfoList()) {
// if (healthInfo.getState() == SystemStatusInfo.HealthState.FAULT) {
// isAutopilotAbility = false;
// autopilotAbilityReason = healthInfo.getName() + " Topic异常";
// break;
// }
// }
Logger.d(TAG, "是否可以启动自动驾驶=" + isAutopilotAbility + " 原因=" + autopilotAbilityReason);
}
};
}

View File

@@ -144,26 +144,29 @@ public class CoordinateCalculateRouteUtil {
if (mRoutePoints.size() > 0){
//基础点
LatLng baseLatLng = mRoutePoints.get(0);
float baseDiffDis = CoordinateUtils.calculateLineDistance(realLon,realLat
,baseLatLng.longitude,baseLatLng.latitude);// lon,lat, prelon, prelat
if (baseLatLng != null){
float baseDiffDis = CoordinateUtils.calculateLineDistance(realLon,realLat
,baseLatLng.longitude,baseLatLng.latitude);// lon,lat, prelon, prelat
for (int i= 1; i < mRoutePoints.size(); i++){
LatLng latLng = mRoutePoints.get(i);
float diff = CoordinateUtils.calculateLineDistance(realLon,realLat
,latLng.longitude,latLng.latitude);
if (baseDiffDis > diff){
for (int i= 1; i < mRoutePoints.size(); i++){
LatLng latLng = mRoutePoints.get(i);
float diff = CoordinateUtils.calculateLineDistance(realLon,realLat
,latLng.longitude,latLng.latitude);
if (baseDiffDis > diff){
// Logger.d(M_TAXI + "calculateRouteSumLength", "点:"+i+"-------先记录点----- ");
baseDiffDis = diff;
currentIndex = i;
baseDiffDis = diff;
currentIndex = i;
}
}
}
// Logger.d(M_TAXI + "calculateRouteSumLength", "点:"+currentIndex+"-------是最近的点------ ");
if (currentIndex == mRoutePoints.size()-1){
latePoints.add(mRoutePoints.get(currentIndex));
}else {
latePoints.addAll(mRoutePoints.subList(currentIndex,mRoutePoints.size()-1));
if (currentIndex == mRoutePoints.size()-1){
latePoints.add(mRoutePoints.get(currentIndex));
}else {
latePoints.addAll(mRoutePoints.subList(currentIndex,mRoutePoints.size()-1));
}
return latePoints;
}
return latePoints;
}
return latePoints;
}
@@ -180,20 +183,22 @@ public class CoordinateCalculateRouteUtil {
if (mRoutePoints.size() > 0){
//基础点
LatLng baseLatLng = mRoutePoints.get(0);
float baseDiffDis = CoordinateUtils.calculateLineDistance(realLon,realLat
,baseLatLng.longitude,baseLatLng.latitude);// lon,lat, prelon, prelat
if (baseLatLng != null){
float baseDiffDis = CoordinateUtils.calculateLineDistance(realLon,realLat
,baseLatLng.longitude,baseLatLng.latitude);// lon,lat, prelon, prelat
for (int i= 1; i < mRoutePoints.size(); i++){
LatLng latLng = mRoutePoints.get(i);
float diff = CoordinateUtils.calculateLineDistance(realLon,realLat
,latLng.longitude,latLng.latitude);
if (baseDiffDis > diff){
for (int i= 1; i < mRoutePoints.size(); i++){
LatLng latLng = mRoutePoints.get(i);
float diff = CoordinateUtils.calculateLineDistance(realLon,realLat
,latLng.longitude,latLng.latitude);
if (baseDiffDis > diff){
// Logger.d(M_TAXI + "calculateRouteSumLength", "点:"+i+"-------先记录点----- ");
baseDiffDis = diff;
currentIndex = i;
baseDiffDis = diff;
currentIndex = i;
}
}
return currentIndex;
}
return currentIndex;
}
return currentIndex;
}

View File

@@ -20,6 +20,7 @@ import com.mogo.eagle.core.function.api.hmi.view.IViewNotification;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.AiRoadMarker;
import com.mogo.eagle.core.utilcode.util.OverlayViewUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.MogoMapUIController;
@@ -132,17 +133,23 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
//视角切换
if (MogoMapUIController.getInstance()
.getCurrentMapVisualAngle().isLongSight()) {
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).visibleAllMarkers();
// 2.11.0 去掉
// MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).visibleAllMarkers();
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
mMapswitchBtn.setImageResource(R.drawable.taxi_p_switch_map_medium);
AiRoadMarker.INSTANCE.restore();
} else if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isMediumSight()) {
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS);
// 2.11.0 去掉
// MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS);
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
mMapswitchBtn.setImageResource(R.drawable.taxi_p_switch_map_long);
AiRoadMarker.INSTANCE.clear();
} else {
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).visibleAllMarkers();
// 2.11.0去掉
// MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).visibleAllMarkers();
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
mMapswitchBtn.setImageResource(R.drawable.taxi_p_switch_map_medium);
AiRoadMarker.INSTANCE.restore();
}
//OverlayLeftViewUtils.INSTANCE.dismissOverlayView();
}

View File

@@ -1162,7 +1162,7 @@ public class TaxiModel {
// 当美化模式演示模式开启时且有订单、且为去往目的地状态维持自动驾驶icon开启状态
return;
}
if (state != mPrevAPStatus && mADASStatusCallback != null){
if (mADASStatusCallback != null){
mADASStatusCallback.onAutopilotEnable();
}
mPrevAPStatus = state;
@@ -1174,7 +1174,7 @@ public class TaxiModel {
// 当美化模式演示模式开启时且有订单、且为去往目的地状态维持自动驾驶icon开启状态
return;
}
if (state != mPrevAPStatus && mADASStatusCallback != null){
if (mADASStatusCallback != null){
mADASStatusCallback.onAutopilotDisable();
}
mPrevAPStatus = state;
@@ -1192,7 +1192,7 @@ public class TaxiModel {
}
return;
}
if (state != mPrevAPStatus && mADASStatusCallback != null){
if (mADASStatusCallback != null){
mADASStatusCallback.onManMachineCoDriving();
}
mPrevAPStatus = state;

View File

@@ -34,6 +34,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListener
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.AiRoadMarker;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
@@ -194,18 +195,24 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
long start = SystemClock.elapsedRealtime();
try {
if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isLongSight()) {
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()) .visibleAllMarkers();
// 2.11.0去掉
// MogoMarkerManager.getInstance(AbsMogoApplication.getApp()) .visibleAllMarkers();
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
mSwitchBtnIcon.setImageResource(R.drawable.taxi_switch_map_medium);
AiRoadMarker.INSTANCE.restore();
} else if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isMediumSight()) {
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
.inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS, TaxiConst.TYPE_MARKER_TAXI_ORDER);
// 2.11.0去掉
// MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
// .inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS, TaxiConst.TYPE_MARKER_TAXI_ORDER);
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
mSwitchBtnIcon.setImageResource(R.drawable.taxi_switch_map_long);
AiRoadMarker.INSTANCE.clear();
} else {
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()) .visibleAllMarkers();
// 2.11.0去掉
// MogoMarkerManager.getInstance(AbsMogoApplication.getApp()) .visibleAllMarkers();
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
mSwitchBtnIcon.setImageResource(R.drawable.taxi_switch_map_medium);
AiRoadMarker.INSTANCE.restore();
}
} finally {

View File

@@ -150,8 +150,12 @@ public class TaxiNaviFragment extends BaseTaxiUIFragment implements AMapNaviView
@Override
public void onDestroy() {
super.onDestroy();
NaviToDestinationModel.getInstance(getContext()).setVoiceIsMute(false);
mAMapNaviView.onDestroy();
if (mAMapNaviView != null){
mAMapNaviView.onDestroy();
}
if (mNaviToStartInfoCallback != null){
mNaviToStartInfoCallback = null;
}

View File

@@ -266,27 +266,31 @@ public class TaxiPersonalDialogFragment extends DialogFragment implements View.O
}
public void onOrdersListPageRefresh(List<OrderQueryRespBean.Result> ordersList){
if (null == ordersList && mNextPage == 0){//无数据
mOrdersRv.setVisibility(View.GONE);
mNoDatas.setVisibility(View.VISIBLE);
return;
}
mOrdersRv.setVisibility(View.VISIBLE);
mNoDatas.setVisibility(View.GONE);
if ((null == ordersList) || (ordersList.size() < mPerPageSize && mNextPage > 0)){//已经没有更多数据,提示无数据
//已经没有更多数据
serverHadNoData = true;
try {
if (null == ordersList && mNextPage == 0){//无数据
mOrdersRv.setVisibility(View.GONE);
mNoDatas.setVisibility(View.VISIBLE);
return;
}
mOrdersRv.setVisibility(View.VISIBLE);
mNoDatas.setVisibility(View.GONE);
if ((null == ordersList) || (ordersList.size() < mPerPageSize && mNextPage > 0)){//已经没有更多数据,提示无数据
//已经没有更多数据
serverHadNoData = true;
orders.addAll(ordersList);
mAdapter.notifyDataSetChanged();
mNextPage = mNextPage +1;
return;
}
serverHadNoData = false;
orders.addAll(ordersList);
mAdapter.notifyDataSetChanged();
if(mAdapter!=null) {
mAdapter.notifyDataSetChanged();
}
mNextPage = mNextPage +1;
return;
}catch (Exception e){
e.fillInStackTrace();
}
serverHadNoData = false;
orders.addAll(ordersList);
if(mAdapter!=null) {
mAdapter.notifyDataSetChanged();
}
mNextPage = mNextPage +1;
}
class OrderAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>{

View File

@@ -153,27 +153,6 @@ class MoGoAutopilotProvider :
}
}, MoGoAiCloudClientConfig.getInstance().sn)
} else {
msgHandler.setListener(object : EventListener {
override fun connectDevice(isSupportMulti: Boolean) {
if (!isInit) {
isInit = true
UiThreadHandler.post {
if (isSupportMulti) {
// 直连工控机
directConnect()
} else {
val options = AdasOptions
.Builder()
.setClient(true)
.build()
AdasManager.getInstance()
.create(options, MoGoAdasMsgConnectStatusListenerImpl())
listenDeviceData()
}
}
}
}
})
NSDNettyManager.getInstance()
.searchAndConnectServer(context, MoGoAiCloudClientConfig.getInstance().sn,
AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode),
@@ -196,6 +175,36 @@ class MoGoAutopilotProvider :
}
})
}
msgHandler.setListener(object : EventListener {
override fun connectDevice(isSupportMulti: Boolean) {
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
if (!isInit) {
isInit = true
// 转发工控机数据给乘客屏
listenDeviceData()
}
} else {
if (!isInit) {
isInit = true
UiThreadHandler.post {
if (isSupportMulti) {
// 直连工控机
directConnect()
} else {
val options = AdasOptions
.Builder()
.setClient(true)
.build()
AdasManager.getInstance()
.create(options, MoGoAdasMsgConnectStatusListenerImpl())
// 接收司机屏发过来的感知、定位等数据
listenDeviceData()
}
}
}
}
}
})
CallerAutopilotCarConfigListenerManager.addListener(TAG, this)
CallerLogger.i("$M_ADAS_IMPL$TAG", "initServer……")
// 同步数据给工控机的服务

View File

@@ -1,7 +1,5 @@
package com.mogo.eagle.core.function.autopilot.adapter
import android.location.Location
import android.util.Log
import chassis.VehicleStateOuterClass
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig
@@ -37,6 +35,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
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.CallerAutoPilotStatusListenerManager.invokeAutopilotStatusRespByQuery
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager.invokeAutopilotAbility
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
@@ -51,7 +50,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.map.navi.MogoCarLocationChangedListenerRegister
import com.zhidao.support.adas.high.AdasManager
import com.zhidao.support.adas.high.OnAdasListener
import com.zhidao.support.adas.high.bean.AutopilotAbility
@@ -444,5 +442,6 @@ class MoGoAdasListenerImpl : OnAdasListener {
* 使用方法查看app_ipc_monitoring/uiMainActivity/onAutopilotAbility
*/
override fun onAutopilotAbility(ability: AutopilotAbility?) {
invokeAutopilotAbility(ability)
}
}

View File

@@ -118,7 +118,10 @@ class TeleMsgHandler : IMsgHandler {
"1" -> true
else -> false
}
Logger.d("Route", "TeleMsgHandler -> handleMsgFromServer ==> isDemoMode:" + FunctionBuildConfig.isDemoMode + ",isIgnore:" + FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData)
Logger.d(
"Route",
"TeleMsgHandler -> handleMsgFromServer ==> isDemoMode:" + FunctionBuildConfig.isDemoMode + ",isIgnore:" + FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData
)
timestamp = currTime
invokeNettyConnResult("乘客屏收到的美化模式isIgnore为${FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData}")
} else {
@@ -139,6 +142,7 @@ class TeleMsgHandler : IMsgHandler {
MogoProtocolMsg.REQ_MAC_ADDRESS -> {
val carConfig = AdasManager.getInstance().carConfig
if (carConfig != null) {
listener?.connectDevice(!carConfig.dockVersion.contains("2.3.0"))
val configArray = carConfig.toByteArray()
NSDNettyManager.getInstance().sendMsgToSpecifiedClient(

View File

@@ -1304,7 +1304,13 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
/**
* 升级app弹框
*/
override fun showUpgradeDialog(name: String, url: String, title: String, content: String, installType: String) {
override fun showUpgradeDialog(
name: String,
url: String,
title: String,
content: String,
installType: String
) {
if (upgradeAppDialog == null) {
upgradeAppDialog = UpgradeAppDialog(requireContext())
}
@@ -1379,6 +1385,7 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
* 工控机监控节点上报
*/
override fun onAutopilotGuardian(guardianInfo: MogoReportMsg.MogoReportMessage?) {
Log.d("EmArrow-1013", "onAutopilotGuardian : $guardianInfo , takeOver : $takeOver")
ThreadUtils.runOnUiThread {
guardianInfo?.let {
if (reportList.size > 49) {
@@ -1404,8 +1411,11 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
EXIT_AUTOPILOT_FOR_LOCATION,
EXIT_AUTOPILOT_FOR_CHASSIS,
EXIT_AUTOPILOT_FOR_DISTANCE -> {
if (FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData
&& getAutoPilotStatusInfo().state != STATUS_AUTOPILOT_RUNNING) {
Log.d(
"EmArrow-1013",
"it code : ${it.code} , state : ${getAutoPilotStatusInfo().state}"
)
if (getAutoPilotStatusInfo().state != STATUS_AUTOPILOT_RUNNING) {
showWarningV2X(
EventTypeEnum.TAKE_OVER_EVENT.poiType,
EventTypeEnum.TAKE_OVER_EVENT.content,
@@ -1413,11 +1423,13 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
EventTypeEnum.TAKE_OVER_EVENT.poiType,
object : IMoGoWarningStatusListener {
override fun onShow() {
Log.d("EmArrow-1013", "onShow")
takeOver = true
clTakeOverView.visibility = View.VISIBLE
}
override fun onDismiss() {
Log.d("EmArrow-1013", "onDismiss")
takeOver = false
clTakeOverView.visibility = View.GONE
}

View File

@@ -40,6 +40,7 @@ import com.mogo.eagle.core.data.obu.ObuStatusInfo
import com.mogo.eagle.core.data.report.ReportEntity
import com.mogo.eagle.core.data.upgrade.UpgradeVersionEntity
import com.mogo.eagle.core.function.api.autopilot.*
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener.Companion
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsFuncConfigListener
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener
@@ -578,8 +579,6 @@ class DebugSettingView @JvmOverloads constructor(
}
FunctionBuildConfig.isDemoMode = isChecked
tbIsDrawAutopilotTrajectoryData.isEnabled = !isChecked
Logger.d("Route", "DebugSettingView -> initView ==> isDemoMode:" + FunctionBuildConfig.isDemoMode + ",isIgnore: $isChecked" )
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = isChecked
if (!FunctionBuildConfig.isDemoMode) {
tbIsDrawAutopilotTrajectoryData.isChecked = false
}

View File

@@ -6,7 +6,6 @@ import android.content.res.TypedArray
import android.graphics.*
import android.util.AttributeSet
import android.util.DisplayMetrics
import android.util.Log
import android.view.View
import android.view.animation.LinearInterpolator
import android.view.animation.OvershootInterpolator
@@ -81,7 +80,6 @@ class CircularProgressView @JvmOverloads constructor(
mRectF = RectF(mRectL.toFloat(), mRectT.toFloat(), (mRectL + mRectLength).toFloat(),
(mRectT + mRectLength).toFloat())
Log.d(TAG, "onMeasure:" + mRectF.toString() + "," + "width:" + measuredWidth.toString() + "," + "PaddingLeft:" + getPaddingLeft().toString())
}
/**
@@ -107,7 +105,6 @@ class CircularProgressView @JvmOverloads constructor(
override fun onDraw(canvas: Canvas?) {
super.onDraw(canvas)
Log.d(TAG, "onDraw")
canvas?.let {
mRectF?.let { it1 -> it.drawArc(it1, 0.0f, 360.0f, false, mBackPaint) }
mRectF?.let { it1 ->
@@ -154,7 +151,6 @@ class CircularProgressView @JvmOverloads constructor(
val animator = ValueAnimator.ofInt(mProgress, progress)
animator.addUpdateListener {
mProgress = it.animatedValue as Int
Log.d(TAG, "setProgress" + mProgress.toString())
invalidate()
}
animator.interpolator = LinearInterpolator()

View File

@@ -7,6 +7,7 @@ import android.widget.*
import com.mogo.commons.*
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.R.drawable
import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.*
import com.mogo.map.*
import com.mogo.map.uicontroller.*
import com.mogo.map.uicontroller.VisualAngleMode.MODE_MEDIUM_SIGHT
@@ -37,16 +38,19 @@ class PerspectiveSwitchView @JvmOverloads constructor(
.visibleAllMarkers()
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null)
textSwitch.setText(R.string.module_map_model_normal)
AiRoadMarker.restore()
} else if (MogoMapUIController.getInstance().currentMapVisualAngle.isMediumSight) {
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
.inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS)
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null)
textSwitch.setText(R.string.module_map_model_faster)
AiRoadMarker.clear()
} else {
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
.visibleAllMarkers()
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null)
textSwitch.setText(R.string.module_map_model_normal)
AiRoadMarker.restore()
}
}
}

View File

@@ -3,7 +3,6 @@ package com.mogo.eagle.core.function.hmi.ui.widget;
import android.content.Context;
import android.graphics.BlurMaskFilter;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.RotateAnimation;
@@ -54,12 +53,10 @@ public class SteeringWheelView extends ConstraintLayout {
public SteeringWheelView(@NonNull Context context) {
super(context);
Log.d(TAG, "1");
}
public SteeringWheelView(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
Log.d(TAG, "2");
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
LayoutInflater.from(context).inflate(R.layout.hmi_steering_wheel_bus, this);
} else {
@@ -94,12 +91,10 @@ public class SteeringWheelView extends ConstraintLayout {
public SteeringWheelView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
Log.d(TAG, "3");
}
public SteeringWheelView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
Log.d(TAG, "4");
}
private final IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener() {
@@ -127,7 +122,6 @@ public class SteeringWheelView extends ConstraintLayout {
int state = autopilotStatusInfo.getState();
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "state = %s", state);
if (autopilotIV != null) {
Log.d(TAG, "autopilotIV != null");
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
// TODO
@@ -151,7 +145,7 @@ public class SteeringWheelView extends ConstraintLayout {
}
}
} else {
Log.d(TAG, "autopilotIV=null");
CallerLogger.INSTANCE.d(TAG, "autopilotIV=null");
}
}
});
@@ -192,7 +186,6 @@ public class SteeringWheelView extends ConstraintLayout {
*/
@Override
public void onAutopilotLightSwitchData(@org.jetbrains.annotations.Nullable Chassis.LightSwitch lightSwitch) {
Log.d(TAG, "车辆转向灯:" + lightSwitch.toString());
}
/**
@@ -201,7 +194,6 @@ public class SteeringWheelView extends ConstraintLayout {
*/
@Override
public void onAutopilotBrakeLightData(boolean brakeLight) {
Log.d(TAG, "刹车灯:" + String.valueOf(brakeLight));
}
/**
@@ -219,7 +211,6 @@ public class SteeringWheelView extends ConstraintLayout {
*/
@Override
public void onAutopilotSteeringData(float steering) {
Log.d(TAG, "steering原始值====" + String.valueOf(steering));
if (Math.abs(steering) < 1) {
steering = 0;
}
@@ -227,7 +218,6 @@ public class SteeringWheelView extends ConstraintLayout {
ThreadUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
Log.d(TAG, "steering忽略小数点后====" + String.valueOf((int) steeringValue));
if (steeringTVL != null && steeringValue > 0) {
steeringTVR.setVisibility(View.INVISIBLE);
steeringTVL.setVisibility(View.VISIBLE);
@@ -237,7 +227,7 @@ public class SteeringWheelView extends ConstraintLayout {
steeringTVR.setVisibility(View.VISIBLE);
steeringTVR.setText(String.valueOf((int) -steeringValue) + "°");
} else {
Log.d(TAG, "onAutopilotSteeringData error");
CallerLogger.INSTANCE.d(TAG, "onAutopilotSteeringData error");
}
animationWithSteeringData(-steeringValue);
if (steeringCircularV != null) {
@@ -260,7 +250,7 @@ public class SteeringWheelView extends ConstraintLayout {
ThreadUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
Log.d(TAG, "乘客屏档位" + gear.toString());
CallerLogger.INSTANCE.d(TAG, "乘客屏档位" + gear.toString());
if (tapPositionView != null) {
tapPositionView.updateWithGear(gear);
}
@@ -288,7 +278,6 @@ public class SteeringWheelView extends ConstraintLayout {
* @param steering
*/
private void animationWithSteeringData(float steering) {
Log.d(TAG, "方向盘转动" + String.valueOf(steering));
rotateAnimation = new RotateAnimation(fromDegrees, steering,
RotateAnimation.RELATIVE_TO_SELF, 0.5f,
RotateAnimation.RELATIVE_TO_SELF, 0.5f);

View File

@@ -2,7 +2,6 @@ package com.mogo.eagle.core.function.hmi.ui.widget
import android.content.Context
import android.util.AttributeSet
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.widget.RelativeLayout
@@ -53,7 +52,6 @@ class V2XWarningView @JvmOverloads constructor(
* @param closeTime 倒计时
*/
fun showWarning(direction: WarningDirectionEnum, closeTime: Long) {
Log.d(TAG, "预警红边:预警方向->$direction 预警倒计时->$closeTime")
UiThreadHandler.post {
// 如果传入的不是关闭显示,则设置倒计时,定时关闭红框警示
if (direction != ALERT_WARNING_NON) {

View File

@@ -26,8 +26,8 @@ import com.kwai.koom.base.MonitorManager;
import com.kwai.koom.nativeoom.leakmonitor.LeakMonitor;
import com.kwai.koom.nativeoom.leakmonitor.LeakMonitorConfig;
import com.kwai.koom.nativeoom.leakmonitor.LeakRecord;
import com.mogo.cloud.commons.BuildConfig;
import com.mogo.commons.context.ContextHolderUtil;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.mvp.BaseFragment;
import com.mogo.commons.mvp.MvpActivity;
import com.mogo.commons.mvp.MvpFragment;
@@ -217,7 +217,7 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
*/
public void startUpInStage2() {
StartupConfig config = null;
if (BuildConfig.DEBUG) {
if (DebugConfig.isDebug()) {
config = new StartupConfig.Builder()
.setLoggerLevel(LoggerLevel.DEBUG)
.setOpenStatistics(true)
@@ -283,8 +283,10 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
// 启动一些基本的服务:定位等
startBaseService();
// 启动Native内存泄漏监测
startLeakMonitor();
if (DebugConfig.isDebug()) {
// 启动Native内存泄漏监测
startLeakMonitor();
}
}
/**
@@ -305,12 +307,10 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
.setMonitorThreshold(16)
.setNativeHeapAllocatedThreshold(0)
.setSelectedSoList(new String[]{"libhdmap", "libmap",
"libAMapSDK_NAVI_v8_0_1", "librouting", "libZegoExpressEngine",
"libUtils", "libcommon", "libcntts", "libduiutils",
"libdatamgr", "libdatascript", "libguidance", "libndsprovider",
"libndssqlite", "libpbjni", "libsearch"
"libAMapSDK_NAVI_v8_0_1", "libZegoExpressEngine",
"libcntts"
})
.setEnableLocalSymbolic(BuildConfig.DEBUG)
.setEnableLocalSymbolic(DebugConfig.isDebug())
.setLeakListener(leaks -> {
StringBuilder stringBuilder = new StringBuilder();
if (!leaks.isEmpty()) {

View File

@@ -4,20 +4,16 @@ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI
import android.content.Context;
import android.os.Process;
import android.util.Log;
import com.bytedance.boost_multidex.BoostMultiDex;
import com.elegant.utils.UiThreadHandler;
import com.kwai.koom.base.DefaultInitTask;
import com.mogo.cloud.socket.SocketBuildConfig;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.data.app.AppConfigInfo;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.constants.MoGoConfig;
import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.eagle.core.function.api.chat.biz.ChatConsts;
import com.mogo.eagle.core.function.autopilot.adapter.MoGoHandAdasMsgManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager;
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
import com.mogo.eagle.core.function.notice.PushUIConstants;
@@ -31,7 +27,6 @@ import com.mogo.map.MapApiPath;
import com.mogo.module.common.MogoModule;
import com.mogo.module.common.MogoModulePaths;
import com.mogo.module.service.ServiceConst;
import com.zhidao.support.adas.high.AdasManager;
import com.zhidao.support.obu.ami.AmiClientManager;
import com.zhjt.mogo_core_function_devatools.monitor.db.CpuInfo;
import com.zhjt.mogo_core_function_devatools.monitor.db.MemInfo;
@@ -62,8 +57,9 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
initLogConfig();
initTipToast();
initModules();
initKoom();
if (DebugConfig.isDebug()) {
initKoom();
}
//查询是否有版本的更新
queryAppUpgrade();
checkMonitorDb();

View File

@@ -35,6 +35,7 @@ import com.amap.api.maps.model.PolylineOptions;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
@@ -54,6 +55,8 @@ import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import mogo.telematics.pad.MessagePad;
/**
* 小地图的方向View
*

View File

@@ -1,93 +1,77 @@
package com.mogo.eagle.core.function.v2x.events
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.os.Handler
import android.os.Looper
import android.content.*
import android.os.*
import android.provider.Settings.System
import android.util.*
import androidx.core.util.Pair
import androidx.localbroadcastmanager.content.LocalBroadcastManager
import androidx.localbroadcastmanager.content.*
import com.mogo.cloud.commons.utils.*
import com.mogo.cloud.passport.IMoGoTokenCallback
import com.mogo.cloud.passport.MoGoAiCloudClient
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.commons.network.ParamsUtil
import com.mogo.cloud.passport.*
import com.mogo.commons.network.*
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_CLOUD_V2N
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_CLOUD_SHOW
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_CLOUD_V2N
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
import com.mogo.eagle.core.data.enums.*
import com.mogo.eagle.core.data.map.*
import com.mogo.eagle.core.data.traffic.TrafficData
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
import com.mogo.eagle.core.data.traffic.*
import com.mogo.eagle.core.function.api.hmi.warning.*
import com.mogo.eagle.core.function.api.map.listener.*
import com.mogo.eagle.core.function.call.hmi.*
import com.mogo.eagle.core.function.call.map.*
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.Default
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.TooClose
import com.mogo.eagle.core.function.v2x.events.alarm.V2XAlarmServer
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi
import com.mogo.eagle.core.function.v2x.events.alarm.*
import com.mogo.eagle.core.function.v2x.events.bridge.*
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi.context
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst.BROADCAST_SCENE_EXTRA_KEY
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst.BROADCAST_SCENE_HANDLER_ACTION
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst.V2X_ACC_OFF_TIME_STR
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst.V2X_STRATEGY_PUSH
import com.mogo.eagle.core.function.v2x.events.entity.net.V2XSeekHelpRes
import com.mogo.eagle.core.function.v2x.events.entity.net.V2XStrategyPushRes
import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusManager
import com.mogo.eagle.core.function.v2x.events.network.V2XRefreshCallback
import com.mogo.eagle.core.function.v2x.events.observer.V2XOptimalRouteObserver
import com.mogo.eagle.core.function.v2x.events.receiver.SceneBroadcastReceiver
import com.mogo.eagle.core.function.v2x.events.scenario.impl.V2XScenarioManager
import com.mogo.eagle.core.function.v2x.events.consts.*
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst.*
import com.mogo.eagle.core.function.v2x.events.entity.net.*
import com.mogo.eagle.core.function.v2x.events.manager.*
import com.mogo.eagle.core.function.v2x.events.network.*
import com.mogo.eagle.core.function.v2x.events.observer.*
import com.mogo.eagle.core.function.v2x.events.receiver.*
import com.mogo.eagle.core.function.v2x.events.scenario.impl.*
import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.*
import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.AiRoadMarker.Marker
import com.mogo.eagle.core.function.v2x.events.scenario.scene.road.*
import com.mogo.eagle.core.function.v2x.events.utils.*
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceManager
import com.mogo.eagle.core.network.utils.GsonUtil
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.function.v2x.events.utils.MapUtils
import com.mogo.eagle.core.function.v2x.events.voice.*
import com.mogo.eagle.core.network.utils.*
import com.mogo.eagle.core.utilcode.mogo.logger.*
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.mogo.storage.*
import com.mogo.eagle.core.utilcode.util.*
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.eagle.core.utilcode.util.Utils
import com.mogo.map.listener.IMogoMapListener
import com.mogo.map.marker.IMogoMarker
import com.mogo.map.marker.IMogoMarkerClickListener
import com.mogo.module.common.ModuleNames
import com.mogo.module.common.drawer.TrafficMarkerDrawer
import com.mogo.map.listener.*
import com.mogo.map.marker.*
import com.mogo.module.common.*
import com.mogo.module.common.drawer.*
import com.mogo.module.common.entity.*
import com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum
import com.mogo.module.common.enums.EventTypeEnum
import com.mogo.module.common.enums.EventTypeHelper
import com.mogo.service.statusmanager.IMogoStatusChangedListener
import com.mogo.service.statusmanager.StatusDescriptor
import com.mogo.module.common.enums.*
import com.mogo.service.statusmanager.*
import com.mogo.service.statusmanager.StatusDescriptor.ACC_STATUS
import com.mogo.service.statusmanager.StatusDescriptor.SEEK_HELPING
import com.mogo.v2x.V2XManager
import com.mogo.v2x.callback.IV2XCallback
import com.mogo.v2x.config.V2XConfig
import com.mogo.v2x.*
import com.mogo.v2x.callback.*
import com.mogo.v2x.config.*
import com.mogo.v2x.data.*
import com.mogo.v2x.event.V2XEvent
import com.shuyu.gsyvideoplayer.GSYVideoManager
import com.shuyu.gsyvideoplayer.cache.CacheFactory
import com.shuyu.gsyvideoplayer.cache.ProxyCacheManager
import com.shuyu.gsyvideoplayer.model.VideoOptionModel
import com.shuyu.gsyvideoplayer.player.IjkPlayerManager
import com.shuyu.gsyvideoplayer.player.PlayerFactory
import com.shuyu.gsyvideoplayer.utils.GSYVideoType
import com.zhjt.service.chain.ChainLog
import com.zhjt.service.chain.TracingConstants
import com.mogo.v2x.event.*
import com.shuyu.gsyvideoplayer.*
import com.shuyu.gsyvideoplayer.cache.*
import com.shuyu.gsyvideoplayer.model.*
import com.shuyu.gsyvideoplayer.player.*
import com.shuyu.gsyvideoplayer.utils.*
import com.zhjt.service.chain.*
import kotlinx.coroutines.*
import kotlinx.coroutines.android.asCoroutineDispatcher
import kotlinx.coroutines.android.*
import roadwork.Road.RW_PB
import tv.danmaku.ijk.media.player.IjkMediaPlayer
import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicBoolean
import tv.danmaku.ijk.media.player.*
import java.util.concurrent.*
import java.util.concurrent.atomic.*
object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallback,
@@ -345,6 +329,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
private fun refreshCarState(location: MogoLocation) {
V2XStatusManager.getInstance().location = location
// V2XAiRoadEventMarker.onLocationChanged(location)
// 只有车速大于 5 的时候进行计算
if (location.speed < 5) return
val v2xPolyline = BridgeApi.v2xPolyline()?.mogoPolyline
@@ -476,6 +461,15 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
private val RW_PB.toRoadMarker: V2XMarkerCardResult
get() = V2XMarkerCardResult().also { l1 ->
this.roadwork?.polygonList?.takeIf { it.isNotEmpty() }?.also { old ->
l1.extras = HashMap<String, List<Pair<Double, Double>>>().also { extra ->
extra["polygon"] = old.map { d ->
Pair(d.lon, d.lat)
}
extra["gps_location"] = listOf(Pair(this.roadwork?.center?.point?.lon ?: 0.0, this.roadwork?.center?.point?.lat ?: 0.0))
}
}
l1.exploreWay = ArrayList<V2XMarkerExploreWay>().also { l2 ->
l2.add(V2XMarkerExploreWay().also { l3 ->
l3.poiType = this.roadwork?.poiType?.toString()
@@ -484,23 +478,22 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
val p = CoordinateUtils.transformWgsToGcj(this.roadwork?.center?.point?.lat ?: 0.0, this.roadwork?.center?.point?.lon ?: 0.0)
l4.lon = p[0]
l4.lat = p[1]
AiRoadMarker.enqueue(Marker(this.roadwork?.center?.point?.lat ?: 0.0, this.roadwork?.center?.point?.lon ?: 0.0, this.roadwork?.center?.road?.bearing?.toDouble() ?: 0.0, this.roadwork?.polygonList?.takeIf { it.isNotEmpty() }?.map { d ->
android.util.Pair(d.lon, d.lat)
}))
l4.angle = this.roadwork?.center?.road?.bearing?.toDouble() ?: 0.0
}
})
}
this.roadwork?.polygonList?.takeIf { it.isNotEmpty() }?.also { old ->
l1.extras = HashMap<String, List<Pair<Double, Double>>>().also { extra ->
extra["polygon"] = old.map { d ->
val p = CoordinateUtils.transformWgsToGcj(d.lat, d.lon)
Pair(p[0], p[1])
}
}
}
}
// private fun buildRoadEntity(e: V2XMarkerExploreWay, extra: Map<String, Any>? = null): V2XRoadEventEntity { // 记录道路事件
// val v2XRoadEventEntity = V2XRoadEventEntity()
// v2XRoadEventEntity.location = e.location.toMarkerLocation() // 探路目前只有上报拥堵
// v2XRoadEventEntity.poiType = EventTypeEnum.AI_ROAD_WORK.poiType
// v2XRoadEventEntity.noveltyInfo = e.toMarkExploreWay(extra)
// v2XRoadEventEntity.expireTime = 20000
// return v2XRoadEventEntity
// }
private fun handleWarningTargetEvent(data: V2XWarningTarget) {
val v2xMessageEntity = V2XMessageEntity<V2XWarningTarget>()
v2xMessageEntity.type = V2XTypeEnum.ALERT_THE_FRONT_WEAKNESS

View File

@@ -79,4 +79,8 @@ public interface IMoGoV2XMarkerManager extends IProvider {
void clearALLPOI();
/**
* 强制清除道路事件POI
*/
void forceClearAlarmPOI();
}

View File

@@ -148,8 +148,9 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
V2XRoadEventEntity v2XRoadEventEntity = new V2XRoadEventEntity();
v2XRoadEventEntity.setLocation(EntityUtilsKt.toMarkerLocation(markerLocation));
// 探路目前只有上报拥堵
v2XRoadEventEntity.setPoiType(markerExploreWay.getPoiType());
String poi = markerExploreWay.getPoiType();
v2XRoadEventEntity.setPoiType(poi);
v2XRoadEventEntity.setNoveltyInfo(EntityUtilsKt.toMarkExploreWay(markerExploreWay,markerCardResult.getExtras()));
v2XRoadEventEntity.setExpireTime(20000);
mV2XRoadEventEntityArrayList.add(v2XRoadEventEntity);
@@ -319,6 +320,13 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
}
}
@Override
public void forceClearAlarmPOI() {
if (mAlarmInfoMarker != null) {
mAlarmInfoMarker.remove();
}
}
@Override
public void init(Context context) {

View File

@@ -3,8 +3,8 @@ package com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad
import android.animation.*
import android.content.*
import android.graphics.*
import android.util.*
import android.view.animation.*
import androidx.core.util.Pair
import androidx.lifecycle.*
import androidx.lifecycle.Lifecycle.Event
import androidx.lifecycle.Lifecycle.Event.ON_CREATE
@@ -14,10 +14,12 @@ import com.mogo.eagle.core.data.map.MapRoadInfo.StopLine
import com.mogo.eagle.core.function.api.map.listener.*
import com.mogo.eagle.core.function.call.map.*
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager.OnRoadListener
import com.mogo.eagle.core.function.v2x.events.scenario.scene.road.*
import com.mogo.eagle.core.utilcode.kotlin.*
import com.mogo.eagle.core.utilcode.mogo.logger.*
import com.mogo.map.*
import com.mogo.map.overlay.*
import com.mogo.module.common.entity.*
import com.mogo.module.common.utils.*
import io.netty.util.internal.*
import java.util.*
@@ -91,7 +93,7 @@ object AiRoadMarker {
Logger.d(TAG, "--- consumer --- 3 ---: isTrigger => $isTrigger")
if (isTrigger) {
marker.set(top)
marker(top)
marker(top, true)
} else {
synchronized(markers) {
markers.remove(top)
@@ -138,7 +140,6 @@ object AiRoadMarker {
private val onLocationListener = object : IMoGoMapLocationListener {
override fun onLocationChanged(location: MogoLocation?, from: Int, isGps: Boolean) {
if (location == null || !isGps) {
return
@@ -170,7 +171,6 @@ object AiRoadMarker {
removeLine()
}
fun enqueue(marker: Marker) {
Logger.d(TAG, "--- enqueue --- 1 ---")
if (markers.contains(marker)) {
@@ -187,7 +187,7 @@ object AiRoadMarker {
}
}
private fun marker(marker: Marker) {
fun marker(marker: Marker, drawMarker: Boolean) {
val location = carLocation.get() ?: return
//施工中心点前方的自车行驶方向上300米距离
val l1 = MogoMap.getInstance().mogoMap.getCenterLineRangeInfo(marker.poi_lon, marker.poi_lat, location.third.toFloat(), 300f)
@@ -239,6 +239,9 @@ object AiRoadMarker {
return
}
removeLine()
if (drawMarker) {
marker.entity?.apply { V2XAiRoadEventMarker.drawMarkers(this) }
}
val evaluator = ArgbEvaluator()
val interceptor = DecelerateInterpolator(1.5f)
val total = points.size
@@ -273,9 +276,38 @@ object AiRoadMarker {
}
}
private fun unMarker(marker: Marker) {
fun unMarker(marker: Marker) {
Logger.d(TAG, "--- unMarker ---")
markers -= marker
removeLine()
V2XAiRoadEventMarker.removeMarkers(null)
}
fun clear() {
hideLine()
// V2XAiRoadEventMarker.removeMarkers(null)
}
fun restore() {
showLine()
val marker = marker.get()
if (marker != null) {
marker(marker, false)
}
}
private fun hideLine() {
val old = line.get()
if (old != null && !old.isDestroyed) {
old.isVisible = false
}
}
private fun showLine() {
val old = line.get()
if (old != null && !old.isDestroyed) {
old.isVisible = true
}
}
private fun isOutOfRange(markerLon: Double, markerLat: Double, carLon: Double, carLat: Double, carAngle: Double): Boolean {
@@ -291,8 +323,9 @@ object AiRoadMarker {
val poi_lat: Double,
val poi_lon: Double,
val poi_angle: Double,
val polygon: List<Pair<Double, Double>>?,
var farthestPoint: Pair<Double, Double>? = null
val polygon: List<androidx.core.util.Pair<Double, Double>>?,
var farthestPoint: androidx.core.util.Pair<Double, Double>? = null,
var entity: V2XRoadEventEntity? = null
) {
override fun equals(other: Any?): Boolean {

View File

@@ -0,0 +1,143 @@
package com.mogo.eagle.core.function.v2x.events.scenario.scene.road
import android.util.*
import com.mogo.cloud.commons.utils.*
import com.mogo.eagle.core.data.map.*
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi.context
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi.v2xMarker
import com.mogo.map.*
import com.mogo.map.R.raw
import com.mogo.map.marker.*
import com.mogo.map.overlay.*
import com.mogo.module.common.entity.*
import com.mogo.module.common.utils.*
import java.util.*
import java.util.concurrent.atomic.*
import kotlin.Pair
object V2XAiRoadEventMarker {
private val current = AtomicReference<Pair<IMogoPolyline?, List<IMogoMarker>?>>()
private val v2xLocation = AtomicReference<MogoLocation>()
private val carLocation = AtomicReference<MogoLocation>()
private val timer = Timer()
private val timerTask by lazy { AtomicReference<TimerTask>() }
private val distance = AtomicInteger(0)
fun drawMarkers(entity: V2XRoadEventEntity): Pair<IMogoPolyline?, List<IMogoMarker>?>? {
removeMarkers(current.get())
timerTask.get()?.cancel()
val extra = entity.noveltyInfo.extras.get("polygon");
if (extra is List<*>) {
val l = extra
if (l.size > 0) {
val polygons: MutableList<androidx.core.util.Pair<Double, Double>> = ArrayList()
for (i in l.indices) {
val o = l[i]!! as? androidx.core.util.Pair<*, *> ?: continue
val p = o
val first = p.first
val second = p.second
if (first == null || second == null) {
continue
}
if (first !is Double || second !is Double) {
continue
}
val xx = CoordinateUtils.transformWgsToGcj(second, first)
polygons.add(androidx.core.util.Pair.create(xx[0], xx[1]))
}
if (polygons.size > 0) {
val markers = ArrayList<IMogoMarker>(polygons.size)
for (i in polygons.indices) {
val p = polygons[i]
val options = MogoMarkerOptions().data(entity).latitude(p.second).longitude(p.first)
options.anchor(0.5f, 0.5f)
options.icon3DRes(raw.sanjiaozhui)
try {
val marker = MogoMarkerManager.getInstance(context()).addMarker("road_pyramid_" + entity.getPoiType(), options)
markers += marker
} catch (t: Throwable) {
t.printStackTrace()
}
}
if (markers.size > 0) {
v2xMarker()?.drawableAlarmPOI(context(), entity, null)
val l2 = entity.noveltyInfo?.location ?: return null
v2xLocation.set(MogoLocation().also { it.longitude = l2.lon; it.latitude = l2.lat; it.bearing = l2.angle.toFloat() })
current.set(Pair(null, markers))
}
}
}
}
return current.get()
}
fun removeMarkers(pair: Pair<IMogoPolyline?, List<IMogoMarker>?>?) {
if (pair != null) {
realRemove(pair)
} else {
val prev = current.get()
if (prev != null) {
realRemove(prev)
val v2xMarker = v2xMarker()
v2xMarker?.also {
it.forceClearAlarmPOI()
}
}
}
}
private fun realRemove(pair: Pair<IMogoPolyline?, List<IMogoMarker>?>) {
val line = pair.first
if (line != null && line.isVisible) {
line.remove()
}
val markers = pair.second
if (markers != null && markers.isNotEmpty()) {
for (m in markers) {
m.remove()
}
}
}
fun onLocationChanged(location: MogoLocation) {
val markerLocation = v2xLocation.get()
carLocation.set(location)
if (markerLocation != null) {
if (isOutOfRange(markerLocation.longitude, markerLocation.latitude, location.longitude, location.latitude, location.bearing.toDouble())) {
v2xLocation.set(null)
this.distance.set(0)
timer.schedule(object : TimerTask() {
override fun run() {
val carLocation = this@V2XAiRoadEventMarker.carLocation.get()
Log.d("XXXXX", "timer do action ---: marker_lon: ${markerLocation.longitude}, marker_lat: ${markerLocation.latitude}, car_lon:${carLocation.longitude}, car_lat: ${carLocation.latitude}")
checkDistanceIsValid(markerLocation.longitude, markerLocation.latitude, carLocation)
}
}.also { this.timerTask.set(it) }, 1000, 1000)
}
}
}
private fun checkDistanceIsValid(x1: Double, y1: Double, location: MogoLocation) {
val distance = DrivingDirectionUtils.distance(x1, y1, location.longitude, location.latitude)
Log.d("XXXXX", "distance: $distance")
if (this.distance.addAndGet(distance.toInt()) >= 100) {
Log.d("XXXXX", "remove marker")
removeMarkers(null)
this.timerTask.get()?.cancel()
}
}
private fun isOutOfRange(markerLon: Double, markerLat: Double, carLon: Double, carLat: Double, carAngle: Double): Boolean {
return !isFrontOfCar(markerLon, markerLat, carLon, carLat, carAngle)
}
private fun isFrontOfCar(markerLon: Double, markerLat: Double, carLon: Double, carLat: Double, carAngle: Double): Boolean {
val degree = DrivingDirectionUtils.getDegreeOfCar2Poi2(carLon, carLat, markerLon, markerLat, carAngle)
return degree < 90
}
}

View File

@@ -1,26 +1,21 @@
package com.mogo.eagle.core.function.v2x.events.scenario.scene.road;
import android.graphics.Color;
import androidx.core.util.Pair;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.function.v2x.R;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XMarkerManager;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XPolylineManager;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager;
import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.AiRoadMarker;
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
import com.mogo.map.MogoMarkerManager;
import com.mogo.map.MogoOverlayManager;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.map.overlay.IMogoOverlayManager;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.map.overlay.MogoPolylineOptions;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.common.enums.EventTypeEnum;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* 道路V2X事件的Marker
@@ -28,11 +23,7 @@ import java.util.List;
public class V2XRoadEventMarker implements IV2XMarker<V2XRoadEventEntity> {
private final List<IMogoMarker> pyramids = new ArrayList<>();
private IMogoPolyline polyline;
private IMogoOverlayManager overlayManager;
private AiRoadMarker.Marker mMarker;
@Override
public void drawPOI(V2XRoadEventEntity entity) {
@@ -42,57 +33,59 @@ public class V2XRoadEventMarker implements IV2XMarker<V2XRoadEventEntity> {
if (marker != null) {
marker.clearAlarmPOI();
if (entity != null) {
marker.drawableAlarmPOI(BridgeApi.INSTANCE.context(), entity, null);
MarkerExploreWay noveltyInfo = entity.getNoveltyInfo();
if (noveltyInfo != null && noveltyInfo.extras != null && noveltyInfo.extras.containsKey("polygon")) {
Object extra = noveltyInfo.extras.get("polygon");
if (pyramids.size() > 0) {
for (IMogoMarker m : pyramids) {
m.remove();
}
pyramids.clear();
if (!Objects.equals(entity.getPoiType(), EventTypeEnum.AI_ROAD_WORK.getPoiType())) {
AiRoadMarker.Marker prev = mMarker;
if (prev != null) {
AiRoadMarker.INSTANCE.unMarker(prev);
mMarker = null;
}
if (polyline != null && polyline.isVisible()) {
polyline.remove();
marker.drawableAlarmPOI(BridgeApi.INSTANCE.context(), entity, null);
} else {
AiRoadMarker.Marker prev = mMarker;
if (prev != null) {
AiRoadMarker.INSTANCE.unMarker(prev);
mMarker = null;
}
if (extra instanceof List) {
List l = (List) extra;
if (l.size() > 0) {
List<Pair<Double, Double>> polygons = new ArrayList<>();
for (int i = 0; i < l.size(); i++) {
Object o = l.get(i);
if (!(o instanceof Pair)) {
continue;
}
Pair p = (Pair) o;
Object first = p.first;
Object second = p.second;
if (first == null || second == null) {
continue;
}
if (!(first instanceof Double) || !(second instanceof Double)) {
continue;
}
polygons.add(Pair.create((Double) first, (Double) second));
}
if (polygons.size() > 0) {
for (int i = 0; i < polygons.size(); i++) {
Pair<Double, Double> p = polygons.get(i);
MogoMarkerOptions options = new MogoMarkerOptions()
.data(entity)
.latitude(p.second)
.longitude(p.first);
options.anchor(0.5f, 0.5f);
options.icon3DRes(R.raw.sanjiaozhui);
try {
pyramids.add(MogoMarkerManager.getInstance(BridgeApi.INSTANCE.context()).addMarker("road_pyramid_" + entity.getPoiType(), options));
} catch (Throwable t) {
t.printStackTrace();
MarkerExploreWay noveltyInfo = entity.getNoveltyInfo();
if (noveltyInfo != null && noveltyInfo.extras != null) {
List<Pair<Double, Double>> polygons = new ArrayList<>();
Pair<Double, Double> gpsLocation = null;
if (noveltyInfo.extras.containsKey("polygon")) {
Object extra = noveltyInfo.extras.get("polygon");
if (extra instanceof List) {
List l = (List) extra;
if (l.size() > 0) {
for (int i = 0; i < l.size(); i++) {
Object o = l.get(i);
if (!(o instanceof Pair)) {
continue;
}
Pair p = (Pair) o;
Object first = p.first;
Object second = p.second;
if (first == null || second == null) {
continue;
}
if (!(first instanceof Double) || !(second instanceof Double)) {
continue;
}
polygons.add(Pair.create((Double) first, (Double) second));
}
}
}
}
if (noveltyInfo.extras.containsKey("gps_location")) {
gpsLocation = (Pair<Double, Double>) ((List)(noveltyInfo.extras.get("gps_location"))).get(0);
}
if (!polygons.isEmpty() && gpsLocation != null) {
MarkerLocation location = noveltyInfo.getLocation();
AiRoadMarker.Marker m = new AiRoadMarker.Marker(gpsLocation.second, gpsLocation.first, location.getAngle(), polygons, null, entity);
mMarker = m;
AiRoadMarker.INSTANCE.marker(m, true);
}
}
}
}
@@ -109,19 +102,6 @@ public class V2XRoadEventMarker implements IV2XMarker<V2XRoadEventEntity> {
if (polyLineManager != null) {
polyLineManager.clearLine();
}
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
if (v2xStatus != null && v2xStatus.isRoadEventPOIShow()) {
if (polyline != null) {
polyline.remove();
}
if (pyramids.size() > 0) {
for (IMogoMarker marker : pyramids) {
marker.remove();
}
pyramids.clear();
}
}
IMoGoV2XMarkerManager v2xMarker = BridgeApi.INSTANCE.v2xMarker();
if (v2xMarker != null) {
// 移除事件POI

View File

@@ -120,7 +120,8 @@ class TrafficLightNetWorkModel {
}
loader {
apiCall {
getNetWorkApi().changeLight(map)
MoGoRetrofitFactory.getInstanceNoCallAdapter("http://dzt-qa-city.zhidaozhixing.com")
.create(TrafficLightApiService::class.java).changeLight(map)
}
}
onSuccess {

View File

@@ -0,0 +1,12 @@
package com.mogo.eagle.core.function.api.autopilot
import com.zhidao.support.adas.high.bean.AutopilotAbility
interface IMoGoAutopilotActionsListener {
/**
* pnc actions 决策 驾驶的意图
*/
fun onAutopilotAbility(ability: AutopilotAbility?)
}

View File

@@ -0,0 +1,60 @@
package com.mogo.eagle.core.function.call.autopilot
import androidx.annotation.Nullable
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener
import com.mogo.eagle.core.function.call.base.CallerBase
import com.zhidao.support.adas.high.bean.AutopilotAbility
import java.util.concurrent.ConcurrentHashMap
object CallerAutopilotActionsListenerManager : CallerBase() {
private val M_AUTOPILOT_ACTIONS_LISTENER: ConcurrentHashMap<String, IMoGoAutopilotActionsListener> =
ConcurrentHashMap()
/**
* 添加监听
* @param tag 标记,用来注销监听使用
* @param listener 监听回调
*/
fun addListener(
@Nullable tag: String,
@Nullable listener: IMoGoAutopilotActionsListener
) {
if (M_AUTOPILOT_ACTIONS_LISTENER.containsKey(tag)) {
return
}
M_AUTOPILOT_ACTIONS_LISTENER[tag] = listener
}
/**
* 删除监听
* @param tag 标记,用来注销监听使用
*/
fun removeListener(@Nullable tag: String) {
if (!M_AUTOPILOT_ACTIONS_LISTENER.containsKey(tag)) {
return
}
M_AUTOPILOT_ACTIONS_LISTENER.remove(tag)
}
/**
* 删除自动驾驶按钮选中监听
* @param listener 要删除的监听对象
*/
fun removeListener(@Nullable listener: IMoGoAutopilotActionsListener) {
M_AUTOPILOT_ACTIONS_LISTENER.forEach {
if (it.value == listener) {
M_AUTOPILOT_ACTIONS_LISTENER.remove(it.key)
}
}
}
@Synchronized
fun invokeAutopilotAbility(ability: AutopilotAbility?) {
M_AUTOPILOT_ACTIONS_LISTENER.forEach {
val listener = it.value
listener.onAutopilotAbility(ability)
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -86,10 +86,12 @@ public class MogoRouteOverlayManager implements
return;
}
synchronized (queue) {
List<MessagePad.TrajectoryPoint> items = queue.peekLast();
if (items != null && !items.isEmpty()) {
Logger.d(TAG, "--- onLocationChanged -- [isDemo1: " + FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData + ",isDemo2:" +FunctionBuildConfig.isDemoMode + ",isGps:" + isGps + ",mode:" + autopilotMode.get() + ",lon:" + location.getLongitude() + ",lat:" + location.getLatitude() + ",angle:" + location.getBearing() + "]");
RouteOverlayDrawer.getInstance().drawTrajectoryList(items, location.getBearing());
if (!queue.isEmpty()) {
List<MessagePad.TrajectoryPoint> items = queue.pollLast();
if (items != null && !items.isEmpty()) {
Logger.d(TAG, "--- onLocationChanged -- [isDemo1: " + FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData + ",isDemo2:" +FunctionBuildConfig.isDemoMode + ",isGps:" + isGps + ",mode:" + autopilotMode.get() + ",lon:" + location.getLongitude() + ",lat:" + location.getLatitude() + ",angle:" + location.getBearing() + "]");
RouteOverlayDrawer.getInstance().drawTrajectoryList(items, location.getBearing());
}
}
}

View File

@@ -63,14 +63,13 @@ public class RouteOverlayDrawer {
}
public void clearMogoRouteOverlay() {
if (mRenderTask != null) {
mRenderHandler.removeCallbacks(mRenderTask);
}
if (mMoGoPolyline != null) {
mMoGoPolyline.remove();
mMoGoPolyline = null;
}
if (mRenderTask != null) {
mRenderHandler.removeCallbacks(mRenderTask);
}
}
private class RenderTask implements Runnable {