Merge branch 'demo/shunyi_vr_map' of http://gitlab.zhidaoauto.com/ecos/yycp-service/Launcher into demo/shunyi_vr_map
This commit is contained in:
@@ -17,6 +17,7 @@ import com.mogo.service.imageloader.IMogoImageloader;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
import com.mogo.service.launcher.IMogoLauncher;
|
||||
import com.mogo.service.locationinfo.IMogoLocationInfoService;
|
||||
import com.mogo.service.map.IMogoMapFrameController;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoActionManager;
|
||||
import com.mogo.service.module.IMogoAddressManager;
|
||||
@@ -245,42 +246,57 @@ public interface IMogoServiceApis extends IProvider {
|
||||
|
||||
/**
|
||||
* 获取授权服务
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoAuthManager getAuthManagerApi();
|
||||
|
||||
/**
|
||||
* 获取探路服务
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoTanluProvider getTanluApi();
|
||||
|
||||
/**
|
||||
* 获取Monitor相关api
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoMonitorProvider getMogoMonitorApi();
|
||||
|
||||
/**
|
||||
* 获取探路ui服务
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoTanluUiProvider getTanluUiApi();
|
||||
|
||||
/**
|
||||
* 皮肤管理接口
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoSkinSupportInstaller getSkinSupportInstallerApi();
|
||||
|
||||
/**
|
||||
* 获取crashWarnProvider
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoCrashWarnProvider getCrashWarnProvider();
|
||||
|
||||
/**
|
||||
* 在线车辆面板
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoOnlineCarListPanelProvider getOnlineCarPanelApi();
|
||||
|
||||
/**
|
||||
* 地图图层控制接口
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoMapFrameController getMapFrameControllerApi();
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ public class MogoServicePaths {
|
||||
* 授权服务
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String PATH_AGREEMENT = "/agreement/showFragment";
|
||||
public static final String PATH_AGREEMENT = "/agreement/showFragment";
|
||||
|
||||
/**
|
||||
* 日志上传
|
||||
@@ -272,4 +272,9 @@ public class MogoServicePaths {
|
||||
* 在线好友面板
|
||||
*/
|
||||
public static final String PATH_ONLINE_CAR_PANEL = "/onlinecar/panel";
|
||||
|
||||
/**
|
||||
* 自研地图和高德地图切换
|
||||
*/
|
||||
public static final String PATH_MAP_FRAME_CONTROLLER = "/mapframe/controller";
|
||||
}
|
||||
|
||||
@@ -2,6 +2,9 @@ package com.mogo.service.adas;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -72,7 +75,43 @@ public interface IMogoADASController extends IProvider {
|
||||
/**
|
||||
* 给adas传递数据
|
||||
*
|
||||
* @param json
|
||||
* @param result
|
||||
*/
|
||||
void aiCloudToAdasData( String json );
|
||||
void aiCloudToAdasData( RemoteControlAutoPilotParameters result );
|
||||
|
||||
|
||||
/**
|
||||
* 添加adas数据回调接口
|
||||
*
|
||||
* @param callback 回调接口
|
||||
*/
|
||||
void addAdasDataCallback( IMogoAdasDataCallback callback );
|
||||
|
||||
/**
|
||||
* 移除adas数据回调接口
|
||||
*
|
||||
* @param callback 待移除的callback
|
||||
*/
|
||||
void removeAdasDataCallback( IMogoAdasDataCallback callback );
|
||||
|
||||
/**
|
||||
* 添加adas报警数据回调接口
|
||||
*
|
||||
* @param callback 回调接口
|
||||
*/
|
||||
void addAdasWarnMessageCallback( IMogoAdasWarnMessageCallback callback );
|
||||
|
||||
/**
|
||||
* 移除adas报警数据回调接口
|
||||
*
|
||||
* @param callback 待移除的callback
|
||||
*/
|
||||
void removeAdasWarnMessageCallback( IMogoAdasWarnMessageCallback callback );
|
||||
|
||||
/**
|
||||
* 获取 adas 识别列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List< ADASRecognizedResult > getLastADASRecognizedResult();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.mogo.service.adas;
|
||||
|
||||
/**
|
||||
* adas 数据回调接口
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public interface IMogoAdasDataCallback {
|
||||
/**
|
||||
* adas 数据回调
|
||||
* @param msg 具体数据
|
||||
*/
|
||||
void onAdasDataCallback(String msg);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.mogo.service.adas;
|
||||
|
||||
/**
|
||||
* adas 物体识别数据回调接口
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public interface IMogoAdasRecognizedDataCallback {
|
||||
/**
|
||||
* adas 数据回调
|
||||
* @param msg 具体数据
|
||||
*/
|
||||
void onAdasDataCallback( String msg );
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mogo.service.adas;
|
||||
|
||||
import com.mogo.service.adas.entity.ADASWarnMessage;
|
||||
|
||||
/**
|
||||
* adas 数据回调接口
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public interface IMogoAdasWarnMessageCallback {
|
||||
/**
|
||||
* adas 数据回调
|
||||
* @param msg 具体数据
|
||||
*/
|
||||
void onReceiveData( ADASWarnMessage msg );
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.mogo.service.adas;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/25
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
interface MogoADASWarnType {
|
||||
|
||||
/**
|
||||
* 行人报警
|
||||
*/
|
||||
int ADAS_WARNING_PERSON = 16;
|
||||
/**
|
||||
* 前车起步
|
||||
*/
|
||||
int ADAS_WARNING_FRONT_CAR_GO = 17;
|
||||
/**
|
||||
* ldw 类型 左侧车道线
|
||||
*/
|
||||
int ADAS_WARNING_SENCE_LANE_LEFT_LOST = 18;
|
||||
/**
|
||||
* 右侧车道线
|
||||
*/
|
||||
int ADAS_WARNING_SENCE_LANE_RIGHT_LOST = 19;
|
||||
/**
|
||||
* fcw 类型
|
||||
*/
|
||||
int ADAS_WARNING_FRONT_CAR = 20;
|
||||
/**
|
||||
* 摩托车碰撞
|
||||
*/
|
||||
int ADAS_WARNING_MOTORCYCLE = 23;
|
||||
/**
|
||||
* 急刹车
|
||||
*/
|
||||
int ADAS_WARNING_QUICK_BRAKE = 30;
|
||||
/**
|
||||
* 禁止掉头
|
||||
*/
|
||||
int ADAS_WARNING_NOT_U_TURN = 40;
|
||||
/**
|
||||
* 禁止左转
|
||||
*/
|
||||
int ADAS_WARNING_NOT_LEFT_TURN = 41;
|
||||
/**
|
||||
* 禁止右转
|
||||
*/
|
||||
int ADAS_WARNING_NOT_RIGHT_TURN = 42;
|
||||
/**
|
||||
* 禁止鸣喇叭
|
||||
*/
|
||||
int ADAS_WARNING_NOT_VOICE = 43;
|
||||
/**
|
||||
* 禁止通行
|
||||
*/
|
||||
int ADAS_WARNING_DO_NOT_ENTER = 44;
|
||||
/**
|
||||
* 限速
|
||||
*/
|
||||
int ADAS_WARNING_LIMIT_SPEED = 45;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.mogo.service.adas;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/16
|
||||
*
|
||||
* 自动驾驶参数
|
||||
*/
|
||||
class RemoteControlAutoPilotParameters {
|
||||
|
||||
public AutoPilotLonLat startLatLon;
|
||||
public List< AutoPilotLonLat > wayLatLons;
|
||||
public AutoPilotLonLat endLatLon;
|
||||
public float speedLimit;
|
||||
|
||||
public static class AutoPilotLonLat {
|
||||
public double lat;
|
||||
public double lon;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.mogo.service.adas.entity;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/25
|
||||
*
|
||||
* adas 识别物体参数
|
||||
*/
|
||||
class ADASRecognizedResult {
|
||||
|
||||
public int type;
|
||||
public String uuid;
|
||||
public String color;
|
||||
public String cardId;
|
||||
public double lat;
|
||||
public double lon;
|
||||
public double heading;
|
||||
public long systemTime;
|
||||
public long satelliteTime;
|
||||
public double alt;
|
||||
public double speed;
|
||||
public long mortonCode;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.mogo.service.adas.entity;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/25
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class ADASWarnMessage {
|
||||
|
||||
public String content;
|
||||
public String level;
|
||||
|
||||
/**
|
||||
* 警告消息类型
|
||||
* <p>
|
||||
* {@link com.mogo.service.adas.MogoADASWarnType}
|
||||
*/
|
||||
public int type;
|
||||
public String value;
|
||||
}
|
||||
@@ -13,6 +13,49 @@ import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
*/
|
||||
public interface IMogoEntranceButtonController extends IProvider {
|
||||
|
||||
/**
|
||||
* 前车急刹
|
||||
*/
|
||||
public static final int NOTICE_TYPE_SUDDENLY_BREAK = 1001;
|
||||
/**
|
||||
* vip变灯通行
|
||||
*/
|
||||
public static final int NOTICE_TYPE_VIP = 1002;
|
||||
/**
|
||||
* 行人碰撞预警
|
||||
*/
|
||||
public static final int NOTICE_TYPE_PEOPLE_WARN = 1003;
|
||||
/**
|
||||
* 逆向超车
|
||||
*/
|
||||
public static final int NOTICE_TYPE_ILLEGAL_OVERTAKE = 1004;
|
||||
/**
|
||||
* 后方危险车辆提醒
|
||||
*/
|
||||
public static final int NOTICE_TYPE_DANGEROUS_CAR_WARN = 1005;
|
||||
/**
|
||||
* 特殊车辆快速通过
|
||||
*/
|
||||
public static final int NOTICE_TYPE_SPECIAL_CAR_WARN = 1006;
|
||||
/**
|
||||
* 自车求助
|
||||
*/
|
||||
public static final int NOTICE_TYPE_SEEK_HELP = 1007;
|
||||
/**
|
||||
* 交通事故识别
|
||||
*/
|
||||
public static final int NOTICE_TYPE_ACCIDENT_WARN = 1008;
|
||||
|
||||
/**
|
||||
* 障碍物体绕行
|
||||
*/
|
||||
public static final int NOTICE_TYPE_OBSTACLE_WARN = 1009;
|
||||
|
||||
/**
|
||||
* 障碍车辆绕行
|
||||
*/
|
||||
public static final int NOTICE_TYPE_OBSTACLE_CAR_WARN = 1010;
|
||||
|
||||
/**
|
||||
* 获取入口按钮实例
|
||||
*
|
||||
@@ -41,4 +84,30 @@ public interface IMogoEntranceButtonController extends IProvider {
|
||||
* @param view 待移除view
|
||||
*/
|
||||
void removeBottomLayerView(View view);
|
||||
|
||||
/**
|
||||
* 设置vr模式下,左下角提示view
|
||||
* @param view 目前是adas提示和求助
|
||||
*/
|
||||
void showLeftNoticeView(View view);
|
||||
|
||||
/**
|
||||
* 隐藏vr模式下,左下角提示view,需要与{@link #showLeftNoticeView(View)}成对使用
|
||||
* @param view 待隐藏view
|
||||
*/
|
||||
void hideLeftNoticeView(View view);
|
||||
|
||||
/**
|
||||
* 根据noticeType添加左侧提示
|
||||
* @param noticeType {@link #NOTICE_TYPE_SUDDENLY_BREAK}...
|
||||
* @param iconRes 本地 icon res
|
||||
* @param content 提示内容
|
||||
*/
|
||||
void showLeftNoticeByType(int noticeType, int iconRes, String content);
|
||||
|
||||
/**
|
||||
* 移除noticeType,需要与{@link #showLeftNoticeByType(int, int, String)}成对使用
|
||||
* @param noticeType {@link #NOTICE_TYPE_SUDDENLY_BREAK}...
|
||||
*/
|
||||
void hideLeftNoticeByType(int noticeType);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.mogo.service.map;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.map.IDestroyable;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/23
|
||||
*
|
||||
* 地图图层切换:高德地图 <-> 自研地图,过渡期使用
|
||||
*/
|
||||
interface IMogoMapFrameController extends IProvider, IDestroyable {
|
||||
|
||||
void initDelegate( IMogoMapFrameController controller );
|
||||
|
||||
/**
|
||||
* 切换到高德2D
|
||||
*/
|
||||
void changeTo2dMode();
|
||||
|
||||
/**
|
||||
* 切换到自研vr
|
||||
*/
|
||||
void changeToVRMode();
|
||||
}
|
||||
@@ -42,6 +42,7 @@ dependencies {
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.adasapi
|
||||
implementation rootProject.ext.dependencies.adasconfigapi
|
||||
implementation "com.zhidao.support.adas:high:1.1.4.6"
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
api rootProject.ext.dependencies.mogomap
|
||||
implementation rootProject.ext.dependencies.mogomapapi
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.mogo.service.impl.singleton.SingletonsHolder;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
import com.mogo.service.launcher.IMogoLauncher;
|
||||
import com.mogo.service.locationinfo.IMogoLocationInfoService;
|
||||
import com.mogo.service.map.IMogoMapFrameController;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoActionManager;
|
||||
import com.mogo.service.module.IMogoAddressManager;
|
||||
@@ -216,32 +217,37 @@ public class MogoServiceApis implements IMogoServiceApis {
|
||||
|
||||
@Override
|
||||
public IMogoTanluProvider getTanluApi() {
|
||||
return getApiInstance(IMogoTanluProvider.class, MogoServicePaths.PATH_TANLU_API);
|
||||
return getApiInstance( IMogoTanluProvider.class, MogoServicePaths.PATH_TANLU_API );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMonitorProvider getMogoMonitorApi() {
|
||||
return getApiInstance(IMogoMonitorProvider.class,MogoServicePaths.PATH_MOGO_MONITOR);
|
||||
return getApiInstance( IMogoMonitorProvider.class, MogoServicePaths.PATH_MOGO_MONITOR );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoTanluUiProvider getTanluUiApi(){
|
||||
return getApiInstance(IMogoTanluUiProvider.class, MogoServicePaths.PATH_TANLU_UI_API);
|
||||
public IMogoTanluUiProvider getTanluUiApi() {
|
||||
return getApiInstance( IMogoTanluUiProvider.class, MogoServicePaths.PATH_TANLU_UI_API );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoSkinSupportInstaller getSkinSupportInstallerApi() {
|
||||
return getApiInstance( IMogoSkinSupportInstaller.class, SkinSupportInstallerConstants.PATH);
|
||||
return getApiInstance( IMogoSkinSupportInstaller.class, SkinSupportInstallerConstants.PATH );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoCrashWarnProvider getCrashWarnProvider() {
|
||||
return getApiInstance(IMogoCrashWarnProvider.class, MogoServicePaths.PATH_CRASH_WARNING);
|
||||
return getApiInstance( IMogoCrashWarnProvider.class, MogoServicePaths.PATH_CRASH_WARNING );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoOnlineCarListPanelProvider getOnlineCarPanelApi() {
|
||||
return getApiInstance( IMogoOnlineCarListPanelProvider.class, MogoServicePaths.PATH_ONLINE_CAR_PANEL);
|
||||
return getApiInstance( IMogoOnlineCarListPanelProvider.class, MogoServicePaths.PATH_ONLINE_CAR_PANEL );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMapFrameController getMapFrameControllerApi() {
|
||||
return getApiInstance( IMogoMapFrameController.class, MogoServicePaths.PATH_MAP_FRAME_CONTROLLER );
|
||||
}
|
||||
|
||||
private static < T extends IProvider > T getApiInstance( Class< T > clazz, String path ) {
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.mogo.service.impl.adas;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/22
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class AdasControlCommandParameter {
|
||||
|
||||
public String action;
|
||||
public Object result;
|
||||
|
||||
public AdasControlCommandParameter( String action, Object result ) {
|
||||
this.action = action;
|
||||
this.result = result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.mogo.service.impl.adas;
|
||||
|
||||
import com.mogo.commons.utils.MortonCode;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedResult;
|
||||
import com.mogo.service.adas.entity.ADASWarnMessage;
|
||||
import com.zhidao.support.adas.high.bean.RectInfo;
|
||||
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/25
|
||||
*
|
||||
* 对象转换类
|
||||
*/
|
||||
class AdasObjectUtils {
|
||||
|
||||
public static ADASWarnMessage fromAdasObject( WarnMessageInfo info ) {
|
||||
if ( info == null ) {
|
||||
return null;
|
||||
}
|
||||
ADASWarnMessage warnMessage = new ADASWarnMessage();
|
||||
warnMessage.content = info.getContent();
|
||||
warnMessage.level = info.getLevel();
|
||||
try {
|
||||
warnMessage.type = Integer.valueOf( info.getType() );
|
||||
} catch ( NumberFormatException e ) {
|
||||
return null;
|
||||
}
|
||||
warnMessage.value = info.getValue();
|
||||
return warnMessage;
|
||||
}
|
||||
|
||||
public static List< ADASRecognizedResult > fromAdasObject( RectInfo rectInfo ) {
|
||||
if ( rectInfo == null
|
||||
|| rectInfo.getModels() == null
|
||||
|| rectInfo.getModels().isEmpty() ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List< ADASRecognizedResult > recognizedResults = new ArrayList<>();
|
||||
for ( RectInfo.RectBean model : rectInfo.getModels() ) {
|
||||
try {
|
||||
ADASRecognizedResult result = fromAdasObject( model );
|
||||
if ( result != null ) {
|
||||
recognizedResults.add( result );
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return recognizedResults;
|
||||
}
|
||||
|
||||
public static ADASRecognizedResult fromAdasObject( RectInfo.RectBean rectBean ) {
|
||||
if ( rectBean == null ) {
|
||||
return null;
|
||||
}
|
||||
ADASRecognizedResult result = new ADASRecognizedResult();
|
||||
result.uuid = rectBean.getUuid();
|
||||
result.lat = rectBean.getLat();
|
||||
result.lon = rectBean.getLon();
|
||||
result.type = Integer.valueOf( rectBean.getType() );
|
||||
result.heading = rectBean.getHeading();
|
||||
result.systemTime = Long.valueOf( rectBean.getSystemTime() );
|
||||
result.satelliteTime = Long.valueOf( rectBean.getSatelliteTime() );
|
||||
result.alt = rectBean.getAlt();
|
||||
result.color = rectBean.getColor();
|
||||
result.speed = rectBean.getSpeed();
|
||||
result.cardId = rectBean.getCarId();
|
||||
result.mortonCode = MortonCode.encodeMorton( result.lon, result.lat );
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
package com.mogo.service.impl.adas;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
@@ -13,10 +12,16 @@ import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.common.utils.CarSeries;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.adas.IMogoADASController;
|
||||
import com.mogo.service.adas.IMogoAdasDataCallback;
|
||||
import com.mogo.service.adas.IMogoAdasWarnMessageCallback;
|
||||
import com.mogo.service.adas.RemoteControlAutoPilotParameters;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedResult;
|
||||
import com.mogo.service.adas.entity.ADASWarnMessage;
|
||||
import com.mogo.service.impl.singleton.SingletonsHolder;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
import com.zhidao.adasconfig.api.AdasConfigApiController;
|
||||
import com.zhidao.adasconfig.common.config.EnumCarChatIncognitoMode;
|
||||
@@ -24,10 +29,19 @@ import com.zhidao.adasconfig.common.config.EnumCarHeading;
|
||||
import com.zhidao.adasconfig.common.config.EnumSkinStyle;
|
||||
import com.zhidao.autopilot.support.api.AutopilotServiceManage;
|
||||
import com.zhidao.autopilot.support.api.IAutopilotServiceStatusListener;
|
||||
import com.zhidao.autopilot.support.api.IAutopolitDataCallBack;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.bean.RectInfo;
|
||||
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
|
||||
import com.zhidao.support.adas.high.msg.MyMessageFactory;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import static com.mogo.module.common.utils.SPConst.getSpGuide;
|
||||
|
||||
@@ -56,6 +70,80 @@ public class MogoADASController implements IMogoADASController {
|
||||
|
||||
private boolean mIsReleased = true;
|
||||
|
||||
/**
|
||||
* 获取adas前车距离
|
||||
*/
|
||||
private List< IMogoAdasDataCallback > mAdasDataCallbackList = new CopyOnWriteArrayList<>();
|
||||
|
||||
/**
|
||||
* adas 报警数据回调
|
||||
*/
|
||||
private List< IMogoAdasWarnMessageCallback > mMogoAdasWarnMessageCallbackList = new CopyOnWriteArrayList<>();
|
||||
|
||||
|
||||
private RectInfo mLastFrameData;
|
||||
|
||||
private OnAdasListener mOnAdasListener = new OnAdasListenerAdapter() {
|
||||
|
||||
@Override
|
||||
public void onRectData( RectInfo rectInfo ) {
|
||||
// 物体识别返回
|
||||
Logger.d( TAG, "onRectData = %s", rectInfo.toString() );
|
||||
mLastFrameData = rectInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWarnMessage( WarnMessageInfo warnMessageInfo ) {
|
||||
if ( warnMessageInfo == null ) {
|
||||
return;
|
||||
}
|
||||
// 警告消息
|
||||
Logger.d( TAG, "onWarnMessage = %s", warnMessageInfo.toString() );
|
||||
if ( mMogoAdasWarnMessageCallbackList.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
final ADASWarnMessage warnMessage = AdasObjectUtils.fromAdasObject( warnMessageInfo );
|
||||
if ( warnMessage == null ) {
|
||||
return;
|
||||
}
|
||||
UiThreadHandler.post( () -> {
|
||||
Iterator< IMogoAdasWarnMessageCallback > iMogoAdasWarnMessageCallbackIterator = mMogoAdasWarnMessageCallbackList.iterator();
|
||||
while ( iMogoAdasWarnMessageCallbackIterator.hasNext() ) {
|
||||
IMogoAdasWarnMessageCallback callback = iMogoAdasWarnMessageCallbackIterator.next();
|
||||
if ( callback != null ) {
|
||||
callback.onReceiveData( warnMessage );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
};
|
||||
|
||||
private MyMessageFactory mAdasMessageFactory;
|
||||
private IAutopolitDataCallBack mAutoPilotDataCallBack = new IAutopolitDataCallBack() {
|
||||
@Override
|
||||
public void sendMsg( String msg ) {
|
||||
Logger.d( TAG, "收到adas数据回调: " + msg );
|
||||
for ( IMogoAdasDataCallback callback : mAdasDataCallbackList ) {
|
||||
callback.onAdasDataCallback( msg );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cameraEyeDetectResult( String detectResult ) {
|
||||
try {
|
||||
JSONObject jsonObjectWs = new JSONObject( detectResult );
|
||||
String action = jsonObjectWs.optString( "action" );
|
||||
if ( TextUtils.isEmpty( action ) ) {
|
||||
Logger.w( TAG, "--->action is null" );
|
||||
return;
|
||||
}
|
||||
mAdasMessageFactory.createMessage( action ).handlerMsg( GsonUtil.getGson(), mOnAdasListener, detectResult );
|
||||
} catch ( JSONException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void openADAS() {
|
||||
showADAS();
|
||||
@@ -89,7 +177,7 @@ public class MogoADASController implements IMogoADASController {
|
||||
}
|
||||
} );
|
||||
invokeShowADASOperation();
|
||||
|
||||
AutopilotServiceManage.getInstance().registerAutopilotDataListener( mAutoPilotDataCallBack );
|
||||
}
|
||||
|
||||
private void invokeShowADASOperation() {
|
||||
@@ -157,6 +245,7 @@ public class MogoADASController implements IMogoADASController {
|
||||
public void init( Context context ) {
|
||||
AutopilotServiceManage.getInstance().init( context );
|
||||
mIsReleased = false;
|
||||
mAdasMessageFactory = new MyMessageFactory();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -212,25 +301,23 @@ public class MogoADASController implements IMogoADASController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void aiCloudToAdasData( String json ) {
|
||||
public void aiCloudToAdasData( RemoteControlAutoPilotParameters result ) {
|
||||
try {
|
||||
syncControlCmdToADAS( "aiCloudToStartAutopilot", json );
|
||||
syncControlCmdToADAS( "aiCloudToStartAutopilot", result );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "notifyAdas" );
|
||||
Logger.e( TAG, e, "aiCloudToAdasData" );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param action 操作执行
|
||||
* @param json 指令数据
|
||||
* @param action
|
||||
* @param result
|
||||
*/
|
||||
private void syncControlCmdToADAS( String action, String json ) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
private void syncControlCmdToADAS( String action, Object result ) {
|
||||
AdasControlCommandParameter parameter = new AdasControlCommandParameter( action, result );
|
||||
//位置信息 action是aiCloudToStartAutopilot
|
||||
try {
|
||||
jsonObject.put( "action", action );
|
||||
jsonObject.put( "result", json );
|
||||
AutopilotServiceManage.getInstance().aiCloudToAdasData( jsonObject.toString() );
|
||||
AutopilotServiceManage.getInstance().aiCloudToAdasData( GsonUtil.jsonFromObject( parameter ) );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -239,6 +326,50 @@ public class MogoADASController implements IMogoADASController {
|
||||
@Override
|
||||
public void release() {
|
||||
mIsReleased = true;
|
||||
AutopilotServiceManage.getInstance().unRegisterAutopilotDataListener( mAutoPilotDataCallBack );
|
||||
AutopilotServiceManage.getInstance().release();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAdasDataCallback( IMogoAdasDataCallback callback ) {
|
||||
if ( callback == null ) {
|
||||
return;
|
||||
}
|
||||
if ( !mAdasDataCallbackList.contains( callback ) ) {
|
||||
mAdasDataCallbackList.add( callback );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAdasDataCallback( IMogoAdasDataCallback callback ) {
|
||||
if ( callback == null ) {
|
||||
return;
|
||||
}
|
||||
mAdasDataCallbackList.remove( callback );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAdasWarnMessageCallback( IMogoAdasWarnMessageCallback callback ) {
|
||||
if ( callback == null ) {
|
||||
return;
|
||||
}
|
||||
if ( !mMogoAdasWarnMessageCallbackList.contains( callback ) ) {
|
||||
mMogoAdasWarnMessageCallbackList.add( callback );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAdasWarnMessageCallback( IMogoAdasWarnMessageCallback callback ) {
|
||||
if ( callback == null ) {
|
||||
return;
|
||||
}
|
||||
mMogoAdasWarnMessageCallbackList.remove( callback );
|
||||
}
|
||||
|
||||
@Override
|
||||
public List< ADASRecognizedResult > getLastADASRecognizedResult() {
|
||||
RectInfo rectInfo = mLastFrameData;
|
||||
List< ADASRecognizedResult > recognizedResultList = AdasObjectUtils.fromAdasObject( rectInfo );
|
||||
return recognizedResultList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.mogo.service.impl.adas;
|
||||
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotStatus;
|
||||
import com.zhidao.support.adas.high.bean.CarLaneInfo;
|
||||
import com.zhidao.support.adas.high.bean.CarStateInfo;
|
||||
import com.zhidao.support.adas.high.bean.LightStatueInfo;
|
||||
import com.zhidao.support.adas.high.bean.ObstaclesInfo;
|
||||
import com.zhidao.support.adas.high.bean.RectInfo;
|
||||
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/22
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
abstract class OnAdasListenerAdapter implements OnAdasListener {
|
||||
|
||||
@Override
|
||||
public void onWarnMessage( WarnMessageInfo warnMessageInfo ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoSize( int width, int height ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRectData( RectInfo rectInfo ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarStateData( CarStateInfo carStateInfo ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLightStateData( LightStatueInfo lightStatueInfo ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onObstaclesInfo( ObstaclesInfo obstaclesInfo ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLaneInfo( CarLaneInfo carLaneInfo ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void autopilotStatus( AutopilotStatus autopilotStatus ) {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user