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:
@@ -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