merge och

This commit is contained in:
suyong
2021-06-10 18:59:11 +08:00
87 changed files with 879 additions and 1156 deletions

View File

@@ -25,6 +25,7 @@
6. d8xx: D系列(2+32) - independent
7. d82x: D系列(1+16) - independent
8. byd: 比亚迪应用市场 - independent
9. PadLenovo: 联想pad适配 - launcher
### env 维度

View File

@@ -4,6 +4,9 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'android-aspectjx'
Properties properties = new Properties();
properties.load(project.rootProject.file("gradle.properties").newDataInputStream())
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
defaultConfig {
@@ -43,6 +46,9 @@ android {
zipAlignEnabled false
shrinkResources false
signingConfig signingConfigs.release
manifestPlaceholders =[
MAP_SDK_VERSION : properties.getProperty("MAP_SDK_VERSION")
]
}
release {
minifyEnabled false
@@ -105,9 +111,12 @@ android {
buildConfigField 'String', 'SOCKET_APP_ID', '\"com.mogo.launcher\"'
// 是否支持目的地导航策略
buildConfigField 'boolean', 'IS_SUPPORT_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH', 'false'
}
// f系列-网约车-出租车
fochtaxi {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
// 应用包名
applicationId rootProject.ext.android.fLauncherApplicationId
dimension "product"
@@ -137,6 +146,8 @@ android {
}
// f系列-网约车-小巴车
fochbus {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
// 应用包名
applicationId rootProject.ext.android.fLauncherApplicationId
dimension "product"
@@ -166,6 +177,8 @@ android {
}
// f系列-分体机全系列,未细分
f8xx {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
// 应用包名
applicationId rootProject.ext.android.fLauncherApplicationId
dimension "product"
@@ -195,6 +208,8 @@ android {
}
// f系列-分体机
f80x {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
// 应用包名
applicationId rootProject.ext.android.fLauncherApplicationId
dimension "product"
@@ -224,12 +239,8 @@ android {
}
// 衡阳-联想Pad
fPadLenovo {
android{
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersionPadLenovo
targetSdkVersion rootProject.ext.android.targetSdkVersionPadLenovo
}
}
minSdkVersion rootProject.ext.android.minSdkVersionPadLenovo
targetSdkVersion rootProject.ext.android.targetSdkVersionPadLenovo
// 应用包名
applicationId rootProject.ext.android.fLauncherApplicationId
dimension "product"
@@ -259,12 +270,8 @@ android {
}
// f系列-网约车-出租车
fPadLenovoOchTaxi {
android{
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersionPadLenovo
targetSdkVersion rootProject.ext.android.targetSdkVersionPadLenovo
}
}
minSdkVersion rootProject.ext.android.minSdkVersionPadLenovo
targetSdkVersion rootProject.ext.android.targetSdkVersionPadLenovo
// 应用包名
applicationId rootProject.ext.android.fLauncherApplicationId
dimension "product"
@@ -294,12 +301,8 @@ android {
}
// f系列-网约车-小巴车
fPadLenovoOchBus {
android{
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersionPadLenovo
targetSdkVersion rootProject.ext.android.targetSdkVersionPadLenovo
}
}
minSdkVersion rootProject.ext.android.minSdkVersionPadLenovo
targetSdkVersion rootProject.ext.android.targetSdkVersionPadLenovo
// 应用包名
applicationId rootProject.ext.android.fLauncherApplicationId
dimension "product"
@@ -358,6 +361,8 @@ android {
}
// f系列-分体机-高德
f8Amap {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
// 应用包名
applicationId rootProject.ext.android.fLauncherApplicationId
dimension "product"
@@ -387,6 +392,8 @@ android {
}
// e系列采用Launcher方案
e8xx {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
// 应用包名
applicationId rootProject.ext.android.launcherApplicationId
dimension "product"
@@ -416,6 +423,8 @@ android {
}
// 同上
em4 {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
// 应用包名
applicationId rootProject.ext.android.launcherApplicationId
dimension "product"
@@ -445,6 +454,8 @@ android {
}
// e系列-2+32对标D系列2+32采用独立app的形式
em3 {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
// 应用包名
applicationId rootProject.ext.android.independentApplicationId
dimension "product"
@@ -474,6 +485,8 @@ android {
}
// e系列-1+16对标D系列1+16采用独立app形式
em1 {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
// 应用包名
applicationId rootProject.ext.android.independentApplicationId
dimension "product"
@@ -503,6 +516,8 @@ android {
}
// e系列-1+16对标D系列1+16采用独立app形式
em2 {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
// 应用包名
applicationId rootProject.ext.android.independentApplicationId
dimension "product"
@@ -532,6 +547,8 @@ android {
}
// d系列
d8xx {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
// 应用包名
applicationId rootProject.ext.android.independentApplicationId
dimension "product"
@@ -561,6 +578,8 @@ android {
}
// d系列 2 + 32
d80x {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
// 应用包名
applicationId rootProject.ext.android.independentApplicationId
dimension "product"
@@ -590,6 +609,8 @@ android {
}
// d系列 1+16 版本
d82x {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
// 应用包名
applicationId rootProject.ext.android.independentApplicationId
dimension "product"
@@ -619,6 +640,8 @@ android {
}
// 比亚迪
bydauto {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
// 应用包名
applicationId rootProject.ext.android.bydautoIndependentApplicationId
dimension "product"

View File

@@ -32,13 +32,13 @@ project.dependencies {
em4Implementation project(':foudations:mogo-aicloud-services-apk')
e8xxImplementation project(':foudations:mogo-aicloud-services-apk')
f8xxImplementation project(':foudations:mogo-aicloud-services-apk')
fPadLenovoImplementation project(':foudations:mogo-aicloud-services-apk')
fPadLenovoImplementation project(':foudations:mogo-aicloud-services-sdk')
f80xImplementation project(':foudations:mogo-aicloud-services-apk')
f8AmapImplementation project(':foudations:mogo-aicloud-services-apk')
em3Implementation project(':foudations:mogo-aicloud-services-apk')
fochtaxiImplementation project(':foudations:mogo-aicloud-services-apk')
fochbusImplementation project(':foudations:mogo-aicloud-services-apk')
fPadLenovoOchTaxiImplementation project(':foudations:mogo-aicloud-services-apk')
fPadLenovoOchBusImplementation project(':foudations:mogo-aicloud-services-apk')
fPadLenovoOchTaxiImplementation project(':foudations:mogo-aicloud-services-sdk')
fPadLenovoOchBusImplementation project(':foudations:mogo-aicloud-services-sdk')
}
}

View File

@@ -29,6 +29,10 @@
<meta-data
android:name="com.amap.api.v2.apikey"
android:value="${AMAP_API_VALUE}" />
<meta-data
android:name="MAP_SDK_VERSION"
android:value="${MAP_SDK_VERSION}" />
<!--保活用-->
<service
android:name="com.zhidao.boot.persistent.lib.PersistentAliveService"

View File

@@ -40,6 +40,7 @@ import com.mogo.utils.logger.LogLevel;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.storage.SharedPrefsMgr;
import com.squareup.leakcanary.LeakCanary;
import com.squareup.leakcanary.RefWatcher;
import com.zhidao.boot.persistent.lib.PersistentManager;
import com.zhidao.mogo.module.left.panel.LeftPanelConst;
@@ -54,7 +55,7 @@ public class MogoApplication extends AbsMogoApplication {
private static final String TAG = "MogoApplication";
private long start;
private volatile static RefWatcher refWatcher;
@Override
public void onCreate() {
initDebugConfig();
@@ -69,6 +70,8 @@ public class MogoApplication extends AbsMogoApplication {
//设置debug模式日志不上传
crashSystem.setDebug(BuildConfig.DEBUG);
Logger.init(BuildConfig.DEBUG ? LogLevel.DEBUG : LogLevel.OFF);
initMogoHttpDns();
initModules();
}
@Override
@@ -189,7 +192,7 @@ public class MogoApplication extends AbsMogoApplication {
.getApis().getMapServiceApi()
.getSingletonLocationClient(getApp())
.getLastKnowLocation();
Logger.i(TAG, "刷新DNS" + mogoLocation);
//Logger.i(TAG, "刷新DNS" + mogoLocation);
if (mogoLocation != null) {
return new HttpDnsSimpleLocation(
mogoLocation.getCityCode(),
@@ -205,11 +208,8 @@ public class MogoApplication extends AbsMogoApplication {
new IMoGoTokenCallback() {
@Override
public void onTokenGot(String token, String sn) {
// 初始化鹰眼HttpDns服务
initMogoHttpDns();
// 鉴权成功后开启socket长链服务
prepareSocketAndLocationServices();
initModules();
}
@Override
@@ -233,6 +233,7 @@ public class MogoApplication extends AbsMogoApplication {
}
private void initModules(){
Logger.d(TAG,"initModules");
if (DebugConfig.isNeedLoadGuideModule()) {
MogoModulePaths.addModule(new MogoModule(MogoModulePaths.PATH_GUIDE, MogoModulePaths.PATH_GUIDE));
}
@@ -245,9 +246,9 @@ public class MogoApplication extends AbsMogoApplication {
MogoModulePaths.addModule(new MogoModule(ServiceConst.PATH_TTS_CONFIG, ServiceConst.PATH_TTS_CONFIG));
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_WIDGETS, MogoServicePaths.PATH_WIDGETS));
// if (DebugConfig.isMapBased()) {
// MogoModulePaths.addModule(new MogoModule(CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME)); //todo 需要更新版本
// }
if (DebugConfig.isMapBased()) {
MogoModulePaths.addModule(new MogoModule(CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME));
}
MogoModulePaths.addBaseModule(new MogoModule(ShareConstants.TAG, ShareConstants.MODEL_NAME));
MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_TANLU_API, "TanluApi"));
@@ -281,7 +282,9 @@ public class MogoApplication extends AbsMogoApplication {
startService(intent);
}
LeakCanary.install(this);
if (refWatcher != null){
refWatcher = LeakCanary.install(this);
}
// 初始化 bugly 升级
ARouter.getInstance().navigation(UpgradeReportProvider.class);

View File

@@ -97,6 +97,8 @@ ext {
mapcustom : "com.mogo.map:map-custom:${MAP_CUSTOM_VERSION}",
mogomap : "com.mogo.map:mogo-map:${MOGO_MAP_VERSION}",
mogomapapi : "com.mogo.map:mogo-map-api:${MOGO_MAP_API_VERSION}",
mogocustommap : "com.zhidaoauto.machine:map:${MAP_SDK_VERSION}",
modulecommon : "com.mogo.module:module-common:${MOGO_MODULE_COMMON_VERSION}",
modulemain : "com.mogo.module:module-main:${MOGO_MODULE_MAIN_VERSION}",
modulemainlauncher : "com.mogo.module:module-main-launcher:${MOGO_MODULE_MAIN_LAUNCHER_VERSION}",
@@ -169,6 +171,7 @@ ext {
// obu sdk
obusdk : "com.zhidao.enterprise.smartv2x:smartv2x:1.0.0.3",
mebulaobu : 'com.zhidao.support.nebulaobu:nebulaobu:1.0.0.3',
// 左侧面板
moduleleftpanel : "com.mogo.module:module-left-panel:${MOGO_MODULE_LEFT_PANEL_VERSION}",
// 左侧面板空实现

View File

@@ -38,6 +38,8 @@ dependencies {
implementation project(":foudations:mogo-commons")
implementation project(":services:mogo-service-api")
}
annotationProcessor 'com.elegant.spi:compiler:1.0.3'
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -1,6 +1,8 @@
package com.mogo.commons.mvp;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.MotionEvent;
@@ -46,6 +48,24 @@ public abstract class MvpActivity< V extends IView, P extends Presenter< V > >
protected void onResume() {
super.onResume();
hideBottomUIMenu();
startVoicePad();
}
/**
* 在Pad上拉起语音
*/
private void startVoicePad() {
try {
if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_LENOVO) {
Intent intent = new Intent();
intent.setComponent(new ComponentName("com.zhidao.speech.voice.pad",
"com.zhidao.speech.MainActivity"));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
} catch (Exception e) {
e.printStackTrace();
}
}
//隐藏导航栏

View File

@@ -68,9 +68,6 @@ public class Utils {
if ( DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE ) {
return DeviceIdUtils.getDeviceId(AbsMogoApplication.getApp());
}
if(DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_LENOVO){
return MoGoAiCloudClientConfig.getInstance().getSn();
}
return getSystemProperties( GSM_SERIAL );
}

View File

@@ -148,7 +148,7 @@ MOGO_OCH_TAXI_VERSION=1.0.0
######## 外部依赖引用
# 车聊聊
CARCHATTING_VERSION=2.2.326
CARCHATTING_VERSION=2.2.327
# 车聊聊接口
CARCHATTINGPROVIDER_VERSION=1.1.11
# websocket
@@ -158,21 +158,21 @@ LOGLIB_VERSION = 1.0.4
######## MogoAiCloudSDK Version
# 网络请求
MOGO_NETWORK_VERSION=1.1.10
MOGO_NETWORK_VERSION=1.1.15
# 鉴权
MOGO_PASSPORT_VERSION=1.1.10
MOGO_PASSPORT_VERSION=1.1.15
# 常链接
MOGO_SOCKET_VERSION=1.1.10
MOGO_SOCKET_VERSION=1.1.15
# 数据采集
MOGO_REALTIME_VERSION=1.1.10
MOGO_REALTIME_VERSION=1.1.15
# 探路,道路事件发布,获取
MOGO_TANLU_VERSION=1.1.10
MOGO_TANLU_VERSION=1.1.15
# 直播推流
MOGO_LIVE_VERSION=1.1.10
MOGO_LIVE_VERSION=1.1.15
# 直播拉流
MOGO_TRAFFICLIVE_VERSION=1.1.10
MOGO_TRAFFICLIVE_VERSION=1.1.15
#ADAS HIGHT
MOGO_ADASHIGH_VERSION = '1.1.3'
MOGO_ADASHIGH_VERSION=1.1.3
######## Foundation MogoAiCloud Module
# mogoAiCloud apk services
@@ -187,3 +187,4 @@ applicationId=com.mogo.launcer
applicationName=IntelligentPilot
versionCode=80007
versionName=8.0.7
MAP_SDK_VERSION=1.0.0-vr-8.5.47

View File

@@ -304,9 +304,9 @@ public class AMapUIController implements IMogoMapUIController {
}
@Override
public void changeBearing( float bearing ) {
if ( mClient != null ) {
mClient.changeBearing( bearing );
public void changeBearing(float bearing) {
if (mClient != null) {
mClient.changeBearing(bearing);
}
}

View File

@@ -66,8 +66,8 @@ dependencies {
implementation project(':libraries:mogo-map-api')
implementation project(':foudations:mogo-commons')
}
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.5.35'
implementation rootProject.ext.dependencies.mogocustommap
// implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.5.47'
// implementation 'com.zhidaoauto.machine:map:1.0.0-vr-test-3.4'
}

View File

@@ -59,4 +59,26 @@ mapAutoView.getMapAutoViewHelper()?.setNearViewAnglePositionLonLatPoint(112.5
解决崩溃问题
8.5.33
更新顺义衡阳数
更新顺义衡阳数
8.5.34
高精数据放到redis
8.5.35
修改绿化带显示问题
暂时对sdk去掉混淆方便crash定位
解决bugly #304037 问题
8.5.38
修改崩溃bug
更换最新的摄像头和红绿灯
8.5.40
修改崩溃bug
更新路牌数据
修改近视角切换
8.5.47
修改绿化带相关
修改crash bug
更新衡阳数据

View File

@@ -95,7 +95,8 @@ class CustomMapApiBuilder implements IMogoMapApiBuilder {
public IMogoMapView getMapView( Context context ) {
Log.d(TAG,"setDebugMode==true");
NavAutoApi.INSTANCE.init( context, MapParams.Companion.init()
.setDebugMode( false )
.setDebugMode( true )
.setDataFileSource(1) //todo 使用本地地图数据
.setCoordinateType( MapParams.COORDINATETYPE_GCJ02 )
.setPerspectiveMode( MapParams.MAP_PERSPECTIVE_2D )
.setZoom( 20 )

View File

@@ -14,6 +14,7 @@ import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.map.uicontroller.MapCameraPosition;
import com.mogo.map.uicontroller.MapControlResult;
import com.mogo.map.uicontroller.VisualAngleMode;
import com.mogo.utils.logger.Logger;
import com.zhidaoauto.map.sdk.open.MapAutoApi;
import org.json.JSONObject;

View File

@@ -35,7 +35,9 @@ public abstract class MogoBaseMapView extends FrameLayout implements ILifeCycle
private void init( Context context ) {
addMapView( context );
MogoMap.getInstance().init( getContext(), mMapView.getMap() );
if (mMapView != null){
MogoMap.getInstance().init( getContext(), mMapView.getMap() );
}
}
protected abstract void addMapView( Context context );

View File

@@ -1,5 +1,6 @@
package com.mogo.map.listener;
import android.util.Log;
import android.view.MotionEvent;
import com.mogo.map.MogoLatLng;

View File

@@ -5,7 +5,8 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<application>
<activity
android:name=".MainLauncherActivity"

View File

@@ -1,24 +1,15 @@
package com.zhidao.mogo.module.main.launcher;
import android.Manifest;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Process;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.debug.DebugConfig;
@@ -31,21 +22,20 @@ import com.mogo.och.IMogoOCH;
import com.mogo.service.intent.IMogoIntentListener;
import com.mogo.service.map.IMogoSmallMapProvider;
import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.service.v2x.IV2XListener;
import com.mogo.service.v2x.IV2XWarningListener;
import com.mogo.utils.logger.Logger;
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_BOTTOM;
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_LEFT;
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_RIGHT;
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_TOP;
import static com.mogo.utils.ProcessUtils.getPackageName;
/**
* 针对作为Launcher的情况做个性化操作
*
* @author tongchenfei
*/
public class MainLauncherActivity extends MainActivity implements IMogoIntentListener, IV2XListener {
public class MainLauncherActivity extends MainActivity implements IMogoIntentListener, IV2XWarningListener {
private static final String TAG = "MainLauncherActivity";
protected boolean mIsHomeKeyDown = false;
private static Handler handlerV2XEvent = new Handler();

View File

@@ -45,7 +45,7 @@ dependencies {
// 现有的ADAS的通讯SDK需要将里面的东西融合到我们项目中
compileOnly rootProject.ext.dependencies.adasapi
api "com.zhidao.support.adas:high:1.1.9.1"
api "com.zhidao.support.adas:high:1.1.9.2"
annotationProcessor rootProject.ext.dependencies.aroutercompiler
if (Boolean.valueOf(RELEASE)) {

View File

@@ -8,13 +8,19 @@ public
* 描述
*/
class DataTypes {
/**
* adas识别数据
* 识别感知和云端感知数据全部标记为Marker融合数据
*/
public static final String TYPE_MARKER_MERGE = "TYPE_MARKER_MERGE";
/**
* adas识别数据Mock用
*/
public static final String TYPE_MARKER_ADAS = "TYPE_MARKER_ADAS";
/**
* 云端下发数据
* 云端下发数据Mock用
*/
public static final String TYPE_MARKER_CLOUD_DATA = "TYPE_MARKER_CLOUD_DATA";

View File

@@ -2,6 +2,7 @@ package com.mogo.module.common.dialog;
import android.app.Dialog;
import android.content.Context;
import android.os.Build;
import android.view.WindowManager;
import androidx.annotation.NonNull;
@@ -32,7 +33,11 @@ public class BaseFloatDialog extends Dialog {
}
private void addFlag() {
getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ) {
getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY);
} else {
getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
}
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION
| WindowManager.LayoutParams.FLAG_LOCAL_FOCUS_MODE);

View File

@@ -20,6 +20,8 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import static com.mogo.cloud.socket.entity.SocketDownDataHelper.FROM_ADAS;
public
/**
* @author congtaowang
@@ -33,6 +35,11 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
private static volatile AdasRecognizedResultDrawer sInstance;
/**
* 上一帧数据的缓存
*/
protected static Map<String, IMogoMarker> mMarkersCaches = new ConcurrentHashMap<>();
public AdasRecognizedResultDrawer() {
super();
}
@@ -102,7 +109,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
}
}
removeUselessMarker();
removeUselessMarker(mMarkersCaches);
removeUselessLastRecord();
// 能复用的 marker 数量
@@ -232,7 +239,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
while (iterator.hasNext()) {
ADASRecognizedResult result = iterator.next();
long internal = result.satelliteTime - getCurSatelliteTime();
if (internal > 1000) {
if (internal > 300) {
iterator.remove();
}
}
@@ -256,10 +263,10 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
}
/**
* 绘制某个物体的一个数据 todo 缓存问题
* 绘制某个物体的一个数据
*
* @param recognizedListResult {@link ADASRecognizedResult}
* @param newAdasRecognizedMarkersCaches
* @param newAdasRecognizedMarkersCaches 缓存集合
*/
private void renderAdasOneFrame(IMogoMarker marker,
String uniqueKey,
@@ -268,7 +275,8 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
final long start = System.currentTimeMillis();
Log.d("EmArrow", "renderAdasOneFrame uuid : " + uniqueKey + " type : " + recognizedListResult.type);
ADASRecognizedResult lastPosition = mLastPositions.remove(uniqueKey); //todo 缓存数据太多
Log.d("EmArrow", "renderAdasOneFrame Process.myPid : " + android.os.Process.myPid());
ADASRecognizedResult lastPosition = mLastPositions.remove(uniqueKey);
// double lastLon = -1;
// double lastLat = -1;
// if (lastPosition != null) {
@@ -289,29 +297,27 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
final MogoLatLng renderLoc = new MogoLatLng(recognizedListResult.lat, recognizedListResult.lon);
long cost = System.currentTimeMillis() - start;
final long intervalRef = interval - cost;
// SimpleHandlerThreadPool.getInstance().postRender(() -> {
marker.addDynamicAnchorPosition(renderLoc, (float) recognizedListResult.heading, intervalRef);
// });
} else {
marker.setRotateAngle(((float) recognizedListResult.heading));
marker.setPosition(recognizedListResult.lat, recognizedListResult.lon);
}
String carColor = recognizedListResult.color;
if (TextUtils.isEmpty(carColor)) {
carColor = getModelRenderColor(recognizedListResult.type, recognizedListResult.speed, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading);
carColor = getModelRenderColor(recognizedListResult.type, FROM_ADAS, recognizedListResult.speed, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading);
}
marker.setAnchorColor(carColor);
if (shouldShowSpeed(recognizedListResult.type)) {
showSelfSpeed(marker, recognizedListResult.speed, recognizedListResult.uuid, recognizedListResult.type, MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode());
}
// if (shouldShowSpeed(recognizedListResult.type)) {
// showSelfSpeed(marker, recognizedListResult.speed, recognizedListResult.uuid, recognizedListResult.type, MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode());
// } //todo 6月4号演示关闭
}
/**
* 绘制 marker
*
* @param recognizedListResult
* @return
* @param recognizedListResult {@link ADASRecognizedResult}
* @return {@link IMogoMarker}
*/
private IMogoMarker drawAdasRecognizedDataMarker(ADASRecognizedResult recognizedListResult) {
if (recognizedListResult == null) {
@@ -323,7 +329,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
String carColor = recognizedListResult.color;
if (TextUtils.isEmpty(carColor)) {
carColor = getModelRenderColor(recognizedListResult.type, recognizedListResult.speed, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading);
carColor = getModelRenderColor(recognizedListResult.type, FROM_ADAS, recognizedListResult.speed, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading);
}
MogoMarkerOptions options = new MogoMarkerOptions()
.owner(DataTypes.TYPE_MARKER_ADAS)
@@ -355,9 +361,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
if (mMarkersCaches != null) {
mMarkersCaches.clear();
}
if (mLastPositions != null) {
mLastPositions.clear();
}
mLastPositions.clear();
sendMessage(MSG_REMOVE_DIRTY_MARKERS, DataTypes.TYPE_MARKER_ADAS);
}
}

View File

@@ -27,6 +27,7 @@ import java.util.concurrent.ConcurrentHashMap;
import static com.mogo.cloud.socket.entity.SocketDownDataHelper.FROM_ADAS;
import static com.mogo.cloud.socket.entity.SocketDownDataHelper.FROM_MY_LOCATION;
import static com.mogo.cloud.socket.entity.SocketDownDataHelper.FROM_ROAD_UNIT;
import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_ADAS;
import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_DATA;
import static java.lang.Math.PI;
@@ -58,11 +59,6 @@ class BaseDrawer {
*/
protected static final ConcurrentHashMap<String, String> mMarkerCachesResMd5Values = new ConcurrentHashMap<>();
/**
* 上一帧数据的缓存
*/
protected static Map<String, IMogoMarker> mMarkersCaches = new ConcurrentHashMap<>();
protected final Context mContext;
private TextView mSpeedView;
@@ -117,7 +113,7 @@ class BaseDrawer {
/**
* 清除无效[为 null 或者 已被销毁]的 marker
*/
protected void removeUselessMarker() {
protected void removeUselessMarker(Map<String, IMogoMarker> mMarkersCaches) {
if (mMarkersCaches == null || mMarkersCaches.isEmpty()) {
return;
}
@@ -158,20 +154,20 @@ class BaseDrawer {
|| recognizedType == AdasRecognizedType.classIdPerson
|| recognizedType == AdasRecognizedType.classIdTrafficBus
|| recognizedType == AdasRecognizedType.classIdTrafficTruck
|| recognizedType == AdasRecognizedType.classIdUnKnow; //todo unKnow物体绘制
|| recognizedType == AdasRecognizedType.classIdUnKnow;
}
/**
* 是否展示车速
* 是否展示车速UUID以及类型
*
* @param type {@link AdasRecognizedType}
* @return showSpeed
*/
public boolean shouldShowSpeed(int type) {
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
return recognizedType != AdasRecognizedType.classIdBicycle
&& recognizedType != AdasRecognizedType.classIdMoto
&& recognizedType != AdasRecognizedType.classIdPerson;
return recognizedType != AdasRecognizedType.classIdPerson;
// &&recognizedType != AdasRecognizedType.classIdBicycle //todo Bicycle显示
// && recognizedType != AdasRecognizedType.classIdMoto //todo moto显示
}
/**
@@ -182,10 +178,10 @@ class BaseDrawer {
*/
public int getModelRes(int type) {
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
if (recognizedType == AdasRecognizedType.classIdCar
if (recognizedType == AdasRecognizedType.classIdCar) {
return R.raw.othercar;
} else if (recognizedType == AdasRecognizedType.classIdTrafficBus
|| recognizedType == AdasRecognizedType.classIdTrafficTruck) {
return R.raw.othercar; //todo otherCar be replacing tache for now to test,remember to fix
} else if (recognizedType == AdasRecognizedType.classIdTrafficBus) {
return R.raw.bus;
} else if (recognizedType == AdasRecognizedType.classIdBicycle
|| recognizedType == AdasRecognizedType.classIdMoto) {
@@ -194,7 +190,7 @@ class BaseDrawer {
return R.raw.stopline;
} else if (recognizedType == AdasRecognizedType.classIdWarningArrows) {
return R.raw.arraw;
} else if (recognizedType == AdasRecognizedType.classIdUnKnow) { //todo unKnow物体3D模型
} else if (recognizedType == AdasRecognizedType.classIdUnKnow) {
return R.raw.tache;
}
return R.raw.people;
@@ -208,22 +204,21 @@ class BaseDrawer {
* @param lat 纬度
* @return 实际车辆颜色
*/
protected String getModelRenderColor(int type, double speed, double lon, double lat, double angle) {
protected String getModelRenderColor(int type, int fromType, double speed, double lon, double lat, double angle) {
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
if (recognizedType == AdasRecognizedType.classIdTrafficBus) {
return "#D8D8D8FF";
}
if (recognizedType == AdasRecognizedType.classIdUnKnow) { //todo unKnow颜色绘制
if (recognizedType == AdasRecognizedType.classIdUnKnow) {
return Car3DModelColor.Normal.color;
}
// 距离策略
// 距离策略 todo 此处两种策略是临时方案
double[] coordinates = getCurCoordinates();
double distance = CoordinateUtils.calculateLineDistance(lon, lat, coordinates[0], coordinates[1]) * 100;
if (distance < 50) {
return Car3DModelColor.Dangerous.color;
} else if (distance < 100 && distance >= 50) {
return Car3DModelColor.Warming.color;
if (distance < 15) {
return Car3DModelColor.Dangerous.color; // todo 方案1
// return Car3DTestModelColor.getTestModelColor(fromType, Waring_Dangerous); // todo 方案2
} else if (distance < 50 && distance >= 15) {
return Car3DModelColor.Warming.color; // todo 方案1
// return Car3DTestModelColor.getTestModelColor(fromType, Waring_Close); // todo 方案2
}
// 他车车速和自车车速对比速度策略
@@ -233,14 +228,26 @@ class BaseDrawer {
if (curSpeed > 0 && speed > curSpeed) {
double rate = ((speed - curSpeed) / curSpeed) * 100;
if (rate >= 50) {
return Car3DModelColor.Dangerous.color;
return Car3DModelColor.Dangerous.color; // todo 方案1
// return Car3DTestModelColor.getTestModelColor(fromType, Waring_Dangerous); // todo 方案2
} else if (rate > 10 && rate < 50) {
return Car3DModelColor.Warming.color;
return Car3DModelColor.Warming.color; // todo 方案1
// return Car3DTestModelColor.getTestModelColor(fromType, Waring_Close); // todo 方案2
}
}
// 默认颜色
// 默认颜色 // todo 方案1
// switch (fromType) {
// case FROM_ADAS:
// return Car3DModelColor.Normal_Visual.color;
// case FROM_ROAD_UNIT:
// return Car3DModelColor.Normal_Cloud.color;
// default:
// return Car3DModelColor.Normal.color;
// }
return Car3DModelColor.Normal.color;
// todo 方案2
// return Car3DTestModelColor.getTestModelColor(fromType, Waring_Normal);
}
/**
@@ -276,7 +283,7 @@ class BaseDrawer {
/**
* 返回当前自车SNTP时间
*
* @return
* @return SNTP时间
*/
protected long getCurSatelliteTime() {
String satelliteTime = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getSatelliteTime();
@@ -292,14 +299,65 @@ class BaseDrawer {
public enum Car3DModelColor {
Normal("#D8D8D8FF"),
Warming("#FFD53EFF"),
Dangerous("#FF3C45FF");
Normal_Visual("#D8CFF8BD"),
Normal_Cloud("#D8F83F94"),
Warming("#FFD53EFF"),
Warming_Visual("#FFC192F1"),
Warming_Cloud("#FFEF09AD"),
Dangerous("#FF3C45FF"),
Dangerous_Visual("#FF91B7F1"),
Dangerous_Cloud("#FF260FEC");
private int fromType;
private final String color;
Car3DModelColor(String color) {
this.color = color;
}
}
public static final int Waring_Normal = 0;
public static final int Waring_Close = 1;
public static final int Waring_Dangerous = 2;
/**
* 模型颜色
*/
public enum Car3DTestModelColor {
Normal_Type(FROM_MY_LOCATION, Waring_Normal, "#D8D8D8FF"),
Normal_Type_Visual(FROM_ADAS, Waring_Normal, "#D8CFF8BD"),
Normal_Type_Cloud(FROM_ROAD_UNIT, Waring_Normal, "#D8F83F94"),
Warming_Type(FROM_MY_LOCATION, Waring_Close, "#FFD53EFF"),
Warming_Type_Visual(FROM_ADAS, Waring_Close, "#FFC192F1"),
Warming_Type_Cloud(FROM_ROAD_UNIT, Waring_Close, "#FFEF09AD"),
Dangerous_Type(FROM_MY_LOCATION, Waring_Dangerous, "#FF3C45FF"),
Dangerous_Type_Visual(FROM_ADAS, Waring_Dangerous, "#FF91B7F1"),
Dangerous_Type_Cloud(FROM_ROAD_UNIT, Waring_Dangerous, "#FF260FEC");
private final int fromType;
private final int waringType;
private final String color;
Car3DTestModelColor(int fromType, int waringType, String color) {
this.fromType = fromType;
this.waringType = waringType;
this.color = color;
}
public static String getTestModelColor(int fromType, int waringType) {
for (Car3DTestModelColor value : Car3DTestModelColor.values()) {
if (value.fromType == fromType && value.waringType == waringType) {
return value.color;
}
}
return Normal_Type.color;
}
}
/**
@@ -355,8 +413,8 @@ class BaseDrawer {
/**
* 缓存绘制 marker 的 id 和 marker 资源缓存的 md5 的关系
*
* @param id
* @param marker
* @param id 缓存资源ID
* @param marker {@link IMogoMarker}
*/
protected static void cacheMarkerIconResMd5Val(String id, IMogoMarker marker) {
if (marker == null || marker.isDestroyed()) {
@@ -372,11 +430,11 @@ class BaseDrawer {
/**
* 道路匹配到车道中心点
*
* @param lon
* @param lat
* @param angle
* @param isRtk
* @return
* @param lon 经度
* @param lat 纬度
* @param angle 方向角
* @param isRtk 是否是RTK
* @return 匹配经纬度值
*/
public double[] matchRoad(String id, double lon, double lat, double angle, boolean isRtk) {
final long start = System.currentTimeMillis();
@@ -392,20 +450,20 @@ class BaseDrawer {
/**
* 清理缓存路段数据
*
* @param id
* @param id 缓存数据Key
*/
public static void clearRoadCacheById(String id) {
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().clearRoadCacheById(id);
}
/**
* 使用系统时间或卫星时间计算出动画的运动时间
* 使用系统时间或卫星时间计算出动画的运动时间最小值45防止两个点距离过近设置的最小动画执行时间
*
* @param lastSystemTime
* @param curSystemTime
* @param lastSatelliteTime
* @param curSatelliteTime
* @return
* @param lastSystemTime 上一个点系统时间,误差值
* @param curSystemTime 当前点系统时间,误差值
* @param lastSatelliteTime 上一个点SNTP时间精确值
* @param curSatelliteTime 当前点SNTP时间精确值
* @return 动画运动时间
*/
public long computeAnimDuration(long lastSystemTime, long curSystemTime, long lastSatelliteTime, long curSatelliteTime) {
long systemTimeInterval = curSystemTime - lastSystemTime;
@@ -420,13 +478,13 @@ class BaseDrawer {
/**
* 根据位置信息、车头朝向计算道路吸附
*
* @param id
* @param lon
* @param lat
* @param heading
* @param lastLon
* @param lastLat
* @return
* @param id UUID
* @param lon 经度
* @param lat 纬度
* @param heading 方向角
* @param lastLon 上一个点经度
* @param lastLat 上一个点纬度
* @return 匹配经纬度
*/
protected double[] getMatchLonLat(String id, double lon, double lat, double heading, double lastLon, double lastLat) {
double[] matchedPoint = matchRoad(id, lon,
@@ -435,7 +493,7 @@ class BaseDrawer {
true
);
boolean match = false;
boolean match;
if (matchedPoint != null) {
// Logger.d( TAG, "matchPoint %s distance = %s",lineCounter, matchedPoint[2] );
match = matchedPoint[2] < 1 && matchedPoint[2] > 0;

View File

@@ -75,6 +75,11 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
return sInstance;
}
/**
* 上一帧数据的缓存
*/
protected static Map<String, IMogoMarker> mMarkersCaches = new ConcurrentHashMap<>();
private final Map<String, SocketDownData.CloudRoadDataProto> mLastPositions = new ConcurrentHashMap<>();
private boolean mIsVrMode = false;
@@ -170,7 +175,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
newDiffSet.add(cloudRoadData);
}
}
removeUselessMarker();
removeUselessMarker(mMarkersCaches);
removeUselessLastRecord();
// 能复用的 marker 数量
@@ -225,8 +230,8 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
/**
* todo 后面涉及到此类变化的数据均改动
*
* @param marker
* @param cloudRoadDataProto
* @param marker {@link IMogoMarker}
* @param cloudRoadDataProto {@link SocketDownData.CloudRoadDataProto}
*/
private void updateCacheMarkerRes(IMogoMarker marker, SocketDownData.CloudRoadDataProto cloudRoadDataProto) {
String resIdVal;
@@ -244,7 +249,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
}
private void removeUselessLastRecord() { // todo 最好重新设计一个数据结构用于多线程数据过期失效的场景参见redis数据过期
if (mLastPositions == null || mLastPositions.isEmpty()) {
if (mLastPositions.isEmpty()) {
return;
}
IMogoADASController adasControllerApi = MogoApisHandler.getInstance().getApis().getAdasControllerApi();
@@ -256,7 +261,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
while (iterator.hasNext()) {
SocketDownData.CloudRoadDataProto result = iterator.next();
long internal = result.getSatelliteTime() - Long.parseLong(adasControllerApi.getSatelliteTime());
if (internal > 1000) {
if (internal > 300) {
iterator.remove();
}
}
@@ -288,6 +293,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
*/
private void renderSnapshotOneFrame(IMogoMarker marker, String uniqueKey, SocketDownData.CloudRoadDataProto cloudRoadData, Map<String, IMogoMarker> newSnapshotCaches) {
Logger.d(TAG, "renderSnapshotOneFrame");
final long start = System.currentTimeMillis();
SocketDownData.CloudRoadDataProto lastPosition = mLastPositions.remove(uniqueKey);
@@ -305,7 +311,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
builder.setWgslon(matchLonLat[0]);
builder.setWgslat(matchLonLat[1]);
cloudRoadData = builder.build(); //todo 验证值是否改变
cloudRoadData = builder.build();
mLastPositions.put(uniqueKey, cloudRoadData);
@@ -321,7 +327,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
marker.setRotateAngle(((float) cloudRoadData.getHeading()));
marker.setPosition(cloudRoadData.getWgslat(), cloudRoadData.getWgslon());
}
marker.setAnchorColor(getModelRenderColor(cloudRoadData.getType(), cloudRoadData.getSpeed(), cloudRoadData.getWgslon(), cloudRoadData.getWgslat(), cloudRoadData.getHeading()));
marker.setAnchorColor(getModelRenderColor(cloudRoadData.getType(), cloudRoadData.getFromType(), cloudRoadData.getSpeed(), cloudRoadData.getWgslon(), cloudRoadData.getWgslat(), cloudRoadData.getHeading()));
if (shouldShowSpeed(cloudRoadData.getType())) {
showSelfSpeed(marker, cloudRoadData.getSpeed(), cloudRoadData.getUuid(), cloudRoadData.getType(), MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode());
}
@@ -335,7 +341,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
*/
private void prepareData(List<SocketDownData.CloudRoadDataProto> in, List<SocketDownData.CloudRoadDataProto> out) {
filterData(in);
foreCastPoint(in);
// foreCastPoint(in, out);
out.addAll(in);
}
@@ -370,7 +376,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
*
* @param in 数据源
*/
private void foreCastPoint(List<SocketDownData.CloudRoadDataProto> in) {
private void foreCastPoint(List<SocketDownData.CloudRoadDataProto> in, List<SocketDownData.CloudRoadDataProto> out) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
for (SocketDownData.CloudRoadDataProto proto : in) {
SocketDownData.CloudRoadDataProto.Builder builder = proto.toBuilder();
@@ -378,6 +384,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
long internal = getCurSatelliteTime() - builder.getSatelliteTime();
if (internal <= 0) {
Log.d(FORECAST, "time internal less than 0 , uuid : " + proto.getUuid());
out.add(proto);
continue;
}
long startTime = System.currentTimeMillis();
@@ -399,6 +406,8 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
builder.setWgslon(foreCastMogoLatLon.getLon());
builder.setSatelliteTime(getCurSatelliteTime() - foreCastInternal);
builder.setDistance(distanceFromSelf);
proto = builder.build();
out.add(proto);
}
}
}
@@ -435,7 +444,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
String resIdVal;
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
options.set3DMode(true);
options.anchorColor(getModelRenderColor(data.getType(), data.getSpeed(), data.getWgslon(), data.getWgslat(), data.getHeading()));
options.anchorColor(getModelRenderColor(data.getType(), data.getFromType(), data.getSpeed(), data.getWgslon(), data.getWgslat(), data.getHeading()));
int resId = getModelRes(data.getType());
resIdVal = resId + "";
options.resName(mMarkerCachesResMd5Values.get(resIdVal));
@@ -502,7 +511,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
}
/**
* 展示用户信息米娜
* 展示用户信息
*
* @param data 道路数据
*/

View File

@@ -145,14 +145,16 @@ public class V2XMessageEntity<T> implements Serializable {
int ALERT_RECOMMEND_ROUTE = 1_011;
// 基于预判目的地违章高发停车场推荐
int ALERT_RECOMMEND_PARKING = 1_012;
// 前方碰撞预警
int ALERT_THE_FRONT_CRASH_WARNING_TOP = 1_0013;
// 前方碰撞预警
int ALERT_THE_FRONT_CRASH_WARNING_LEFT = 1_0014;
// 右前方碰撞预警
int ALERT_THE_FRONT_CRASH_WARNING_RIGHT = 1_0015;
// 弱势交通参与者401018
int ALERT_THE_FRONT_WEAKNESS = 40_1018;
// 前方行人碰撞预警
int ALERT_THE_FRONT_CRASH_WARNING_TOP = 1;
// 后方碰撞预警
int ALERT_THE_FRONT_CRASH_WARNING_BOTTOM = 1_0016;
int ALERT_THE_FRONT_CRASH_WARNING_BOTTOM = 2;
// 左前方碰撞预警
int ALERT_THE_FRONT_CRASH_WARNING_LEFT = 3;
// 右前方碰撞预警
int ALERT_THE_FRONT_CRASH_WARNING_RIGHT = 4;
// 推送VR消息展示
int ALERT_PUSH_VR_SHOW = 2_000;
// 自车求助

View File

@@ -68,18 +68,15 @@ public class V2XWarningEntity implements Serializable {
public void setTts(int type) {
switch (type) {
case 0:
case 1:
case 11:
this.tts = "注意行人";
break;
case 1:
case 2:
this.tts = "注意自行车";
break;
case 2:
this.tts = "注意摩托车";
break;
case 3:
case 4:
this.tts = "注意前方车辆";
this.tts = "注意摩托车";
break;
default:
break;
@@ -213,10 +210,11 @@ public class V2XWarningEntity implements Serializable {
public String getTts() {
if (tts == null) {
if (warningContent == null) {
setTts(type);
return tts;
}
return tts;
return warningContent;
}
public double getStopLineDistance() {

View File

@@ -271,7 +271,7 @@ public class MapCenterPointStrategy {
return;
}
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
Logger.w( TAG, "vr 模式下忽略该设置" );
//Logger.w( TAG, "vr 模式下忽略该设置" );
return;
}
Map< Integer, Map< String, MapCenterPoint > > strategies = sCommonStrategies;

View File

@@ -81,7 +81,7 @@ public class SnapshotLocationController {
//测试面板状态同步
DebugConfig.setStatus(DebugConfig.sLocation, true);
Logger.d(TAG, "同步到rtk数据");
// Logger.d(TAG, "同步到rtk数据");
double lon = data.optDouble("lon", -1);
double lat = data.optDouble("lat", -1);
double alt = data.optDouble("alt", -1);

View File

@@ -6,4 +6,10 @@
<dimen name="module_v2n_tip_text_width">106px</dimen>
<dimen name="module_v2n_tip_text_margin_right">52px</dimen>
<dimen name="module_v2n_image_margin_left">37px</dimen>
<dimen name="module_v2x_brake_tip_width">435px</dimen>
<dimen name="module_v2x_brake_tip_height">186px</dimen>
<dimen name="module_v2x_brake_image_width">133px</dimen>
<dimen name="module_v2x_brake_image_margin_left">37px</dimen>
<dimen name="module_v2x_brake_image_margin_right">27px</dimen>
</resources>

View File

@@ -1128,6 +1128,10 @@
<dimen name="module_v2n_tip_text_width">100px</dimen>
<dimen name="module_v2n_tip_text_margin_right">28px</dimen>
<dimen name="module_v2n_image_margin_left">28px</dimen>
<dimen name="module_v2x_brake_tip_width">320px</dimen>
<dimen name="module_v2x_brake_tip_height">140px</dimen>
<dimen name="module_v2x_brake_image_margin_left">28px</dimen>
<dimen name="module_v2x_brake_image_margin_right">20px</dimen>
<dimen name="module_v2x_brake_image_width">100px</dimen>
</resources>

View File

@@ -59,6 +59,8 @@ dependencies {
api rootProject.ext.dependencies.mogoserviceapi
implementation rootProject.ext.dependencies.modulecommon
implementation rootProject.ext.dependencies.moduleshare
implementation rootProject.ext.dependencies.moduleservice
// implementation rootProject.ext.dependencies.moduleventpanel
// implementation rootProject.ext.dependencies.mogomoduleauth
} else {
@@ -69,6 +71,7 @@ dependencies {
api project(':services:mogo-service-api')
implementation project(':modules:mogo-module-common')
implementation project(':modules:mogo-module-share')
implementation project(':modules:mogo-module-service')
// implementation project(':modules:mogo-module-event-panel')
// implementation project(':modules:mogo-module-authorize')
}

View File

@@ -8,6 +8,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.Log;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.MotionEvent;
@@ -47,7 +48,6 @@ import com.mogo.map.navi.MogoTraffic;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.map.uicontroller.VisualAngleMode;
import com.mogo.module.common.ModuleNames;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.dialog.WMDialog;
import com.mogo.module.common.glide.SkinAbleBitmapTarget;
@@ -100,6 +100,7 @@ import java.util.Random;
import static com.mogo.module.common.utils.SPConst.getSPGuideRecord;
import static com.mogo.module.common.utils.SPConst.getSpGuide;
import static com.mogo.module.extensions.ExtensionsModuleConst.TYPE_ENTRANCE;
import static com.mogo.module.service.receiver.MogoReceiver.ACTION_V2X_REMOVE_TIP_WINDOW;
import static com.mogo.module.share.constant.ShareConstants.KEY_CLICK_SHARE_BUTTON;
import static com.mogo.module.share.constant.ShareConstants.KEY_CLICK_SHARE_TIME;
import static com.mogo.module.share.constant.ShareConstants.KEY_SERVER_SHOW_DAY_COUNT;
@@ -211,7 +212,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
private TextView tvGreen;
/**
* 内部变量标识是否在vrMode用于方法执行过滤避免重复或异常调用
*/
@@ -381,7 +381,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mSwitchMapModeLayout.setOnClickListener(clickListener);
mSwitchText = (TextView) findViewById(R.id.module_switch_model_text);
if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_LENOVO ) {
if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_LENOVO) {
enterVrMode();
}
}
@@ -411,12 +411,10 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
MogoApisHandler.getInstance().getApis().getRegisterCenterApi()
.registerCarLocationChangedListener(TAG, this);
// MogoApisHandler.getInstance().getApis().getRegisterCenterApi().registerMogoLocationListener(TAG, this);
localIsVrMode = true;
flSpeed.setVisibility(View.VISIBLE);
mSwitchMapModeLayout.setVisibility(View.VISIBLE);
// clTrafficLight.setVisibility(View.VISIBLE);
mApis.getV2XListenerManager().changeTipWindowStatusForListener(ACTION_V2X_REMOVE_TIP_WINDOW);
}
}
@@ -725,8 +723,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
TopViewNoLinkageAnimHelper.getInstance().setIMogoMapUIController(mMApUIController);
// 进入vr模式不可缩放地图
if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_LENOVO ) {
UiThreadHandler.postDelayed(this::stepIntoVrMode, 3_500L );
if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_LENOVO) {
UiThreadHandler.postDelayed(this::stepIntoVrMode, 3_500L);
}
mClickShareVoiceStrings =
@@ -740,8 +738,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
/**
* 进入鹰眼模式,设置手势缩放地图失效
*/
private void stepIntoVrMode(){
Logger.d( TAG, "进入vr模式" );
private void stepIntoVrMode() {
Logger.d(TAG, "进入vr模式");
MogoApisHandler.getInstance()
.getApis()
.getMapServiceApi()
@@ -1102,6 +1100,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
});
}
private boolean mLastStatusIsVr = false;
@Override
public void onMapModeChanged(EnumMapUI ui) {
if (mCameraMode == null) {
@@ -1115,6 +1115,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
// } else if( ui == EnumMapUI.NorthUP_2D ){
// mMove2CurrentLocation.setImageResource( R.drawable.icon_car_up );
// }
}
@Override
@@ -1373,13 +1374,14 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
if (MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getCurrentMapVisualAngle().isLongSight()) {
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(AbsMogoApplication.getApp()).visibleAllMarkers();
MogoApisHandler.getInstance().getApis().getMapServiceApi()
.getMapUIController().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT,null);
.getMapUIController().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
mSwitchText.setText(R.string.module_map_model_normal);
} else if (MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getCurrentMapVisualAngle().isMediumSight()) {
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(AbsMogoApplication.getApp()).inVisibleAllMarkers();
MogoApisHandler.getInstance().getApis().getMapServiceApi()
.getMapUIController().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT,null);
.getMapUIController().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
mSwitchText.setText(R.string.module_map_model_faster);
}
}
}
};

View File

@@ -133,15 +133,6 @@ public class TopViewManager implements IMogoTopViewManager {
}
}
@Override
public boolean isViewNoLinkageAdded(View view) {
try {
return TopViewNoLinkageAnimHelper.getInstance().isViewAdded(view);
} catch( Exception e ){
return false;
}
}
@Override
public void removeAllViewInVrMode() {
try {

View File

@@ -34,7 +34,6 @@ public class TopViewNoLinkageAnimHelper {
private TopView topContainerNoLinkage;
private volatile boolean isTopViewOut = true;
private final List<View> viewCaches = new ArrayList<>();
private final Map<View, IMogoTopViewStatusListener> statusListenerMap = new ArrayMap<>();
private View currentAnimatingView = null;
@@ -61,10 +60,6 @@ public class TopViewNoLinkageAnimHelper {
}
public void init(ConstraintLayout rootView) {
init(rootView, null);
}
public void init(ConstraintLayout rootView, OnTopViewAnimSimpleListener listener) {
topMotionLayout = rootView;
topContainerNoLinkage = rootView.findViewById(R.id.module_entrance_id_top_container_no_linkage);
@@ -85,96 +80,29 @@ public class TopViewNoLinkageAnimHelper {
if (params == null) {
throw new IllegalArgumentException("method addTopView params LayoutParams is null");
}
if (!viewCaches.contains(view)) {
// 判断此view是否已经增加到了顶部view如果增加过就不增加了
view.setTranslationY(0);
statusListenerMap.put(view, statusListener);
Logger.d(TAG, "开始执行");
isTopViewOut = false;
if (topContainerNoLinkage.getChildCount() > 0) {
// 顶部view已经有了内容新增内容无需整体布局变化只是新增布局加个动画
viewCaches.add(view);
// 生硬的删掉之前的view
int lastCount = topContainerNoLinkage.getChildCount();
Logger.d(TAG, "进入动画lastCount: " + lastCount);
for (int i = 0; i < lastCount; i++) {
View lastView = topContainerNoLinkage.getChildAt(i);
if (statusListenerMap.get(lastView) != null) {
statusListenerMap.get(lastView).beforeViewRemoveAnim(lastView);
}
viewCaches.remove(lastView);
if (statusListenerMap.get(lastView) != null) {
statusListenerMap.remove(lastView).onViewRemoved(lastView);
}
}
Logger.d(TAG, "生硬的删掉了之前的view: " + viewCaches.size());
topContainerNoLinkage.removeAllViews();
// 同时设置一下隐藏状态
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setTopViewShow(ExtensionsModuleConst.TYPE_ENTRANCE, false);
// 判断此view是否已经增加到了顶部view如果增加过就不增加了
view.setTranslationY(0);
statusListenerMap.put(view, statusListener);
Logger.d(TAG, "开始执行");
isTopViewOut = false;
// 如果高度变化,生硬的变化一下高度
Logger.d(TAG, "container.height: " + topContainerNoLinkage.getHeight());
if (topContainerNoLinkage.getHeight() != params.height) {
LayoutParams p = topContainerNoLinkage.getLayoutParams();
p.height = params.height;
topContainerNoLinkage.setLayoutParams(p);
topContainerNoLinkage.setTranslationY(params.height);
Logger.d(TAG, "改变container的高度===");
}
view.setTranslationY(-(params.height));
topContainerNoLinkage.addView(view, params);
Logger.d(TAG, "顶部view已经有布局了增加新增view滑入动画: " + view.getTranslationY() + " height:" +
" " + view.getHeight() + " paramsHeight: " + params.height);
if (statusListenerMap.get(view) != null) {
statusListenerMap.get(view).beforeViewAddAnim(view);
}
view.animate().translationY(0).setDuration(500).setListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
IMogoTopViewStatusListener listener = statusListenerMap.get(view);
if (listener != null) {
listener.onViewAdded(view);
}
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
}).start();
} else {
// 顶部view还没有内容需要整体下移
currentAnimatingView = view;
viewCaches.add(view);
topContainerNoLinkage.addView(view, params);
Logger.d(TAG, "整体进入==== view.visibility: " + view.getVisibility() + " view" +
".position: (" + view.getX() + ", " + view.getY() + ") params.width: " + params.width + " params.height: " + params.height);
if (statusListenerMap.get(view) != null) {
statusListenerMap.get(view).beforeViewAddAnim(view);
}
topContainerNoLinkage.setChildAddedListener(child -> {
topContainerNoLinkage.setChildAddedListener(null);
NoMapTopViewShaderHelper.getInstance().showShader();
topContainerNoLinkage.animate().translationY(child.getHeight()).setListener(mainAnimListener).start();
int scene = Scene.AIMLESS_WITH_ROAD_EVENT;
Logger.d(TAG, "show top setMapCenterPointByScene: " + scene);
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, scene);
});
}
// 顶部view还没有内容需要整体下移
currentAnimatingView = view;
topContainerNoLinkage.addView(view, params);
Logger.d(TAG, "整体进入==== view.visibility: " + view.getVisibility() + " view" +
".position: (" + view.getX() + ", " + view.getY() + ") params.width: " + params.width + " params.height: " + params.height);
if (statusListenerMap.get(view) != null) {
statusListenerMap.get(view).beforeViewAddAnim(view);
}
topContainerNoLinkage.setChildAddedListener(child -> {
topContainerNoLinkage.setChildAddedListener(null);
NoMapTopViewShaderHelper.getInstance().showShader();
topContainerNoLinkage.animate().translationY(child.getHeight()).setListener(mainAnimListener).start();
int scene = Scene.AIMLESS_WITH_ROAD_EVENT;
Logger.d(TAG, "show top setMapCenterPointByScene: " + scene);
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, scene);
});
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setTopViewShow(ExtensionsModuleConst.TYPE_ENTRANCE, true);
@@ -188,6 +116,8 @@ public class TopViewNoLinkageAnimHelper {
* 退出最新的也就是最上面的view
*/
private void startLatestTopOutAnim() {
Logger.d(TAG, "startLatestTopOutAnim=====");
if (topContainerNoLinkage.getChildCount() > 0) {
startTopOutAnim(topContainerNoLinkage.getChildAt(topContainerNoLinkage.getChildCount() - 1));
}
@@ -198,7 +128,7 @@ public class TopViewNoLinkageAnimHelper {
return;
}
Logger.d(TAG, "startTopOutAnim=====");
if (!isTopViewOut && viewCaches.contains(view)) {
if (!isTopViewOut) {
// 顶部view仅剩一个view需要整体上移
if (statusListenerMap.get(view) != null) {
statusListenerMap.get(view).beforeViewRemoveAnim(view);
@@ -217,24 +147,12 @@ public class TopViewNoLinkageAnimHelper {
return (int) topMotionLayout.getContext().getResources().getDimensionPixelSize(resId);
}
interface OnTopViewAnimSimpleListener {
void onAnimStart();
void onAnimEnd();
}
public boolean isViewAdded(View view) {
return viewCaches.contains(view);
}
public void removeAllView() {
Logger.d(TAG, "remove all view");
isTopViewOut = true;
int lastCount = topContainerNoLinkage.getChildCount();
for (int i = 0; i < lastCount; i++) {
View child = topContainerNoLinkage.getChildAt(i);
viewCaches.remove(child);
IMogoTopViewStatusListener listener = statusListenerMap.remove(child);
if (listener != null) {
listener.beforeViewRemoveAnim(child);
@@ -268,13 +186,12 @@ public class TopViewNoLinkageAnimHelper {
@Override
public void onAnimationEnd(Animator animation) {
Logger.d(TAG, "onMainAnimEnd: " + currentAnimatingView);
Logger.d(TAG, "isTopViewOut: " + isTopViewOut);
IMogoTopViewStatusListener listener;
if (isTopViewOut) {
int lastCount = topContainerNoLinkage.getChildCount();
for (int i = 0; i < lastCount; i++) {
View child = topContainerNoLinkage.getChildAt(i);
viewCaches.remove(child);
listener = statusListenerMap.remove(child);
if (listener != null) {
listener.onViewRemoved(child);

View File

@@ -245,8 +245,7 @@
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/module_ext_id_north"

View File

@@ -1,6 +1,7 @@
package com.mogo.module.main;
import android.location.Location;
import android.util.Log;
import android.view.MotionEvent;
import com.mogo.map.MogoLatLng;

View File

@@ -14,6 +14,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.mogo.commons.voice.AIAssist;
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
import com.mogo.map.search.inputtips.MogoTip;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.navi.R;
import com.mogo.module.navi.bean.EntityConvertUtils;
import com.mogo.module.navi.bean.SearchPoi;
@@ -424,6 +425,9 @@ public class SearchFragment extends BaseSearchFragment
SearchApisHolder.getSearchManager().goHome();
break;
case NAVI_SETTING_CMD:
if(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()){
return;
}
goSetting();
break;
case PARK_CMD:

View File

@@ -10,6 +10,7 @@ import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.view.MotionEvent;
import com.mogo.commons.debug.DebugConfig;
@@ -47,6 +48,7 @@ import com.mogo.module.service.refresh.AutoRefreshStrategy;
import com.mogo.module.service.refresh.CustomRefreshStrategy;
import com.mogo.module.service.refresh.RefreshObject;
import com.mogo.module.service.strategy.CarIconDisplayStrategy;
import com.mogo.module.service.timedelay.TimeDelayUploadManager;
import com.mogo.module.service.ttsConfig.TtsConfigModleData;
import com.mogo.realtime.api.MoGoAiCloudRealTime;
import com.mogo.service.adas.IMogoADASController;
@@ -391,6 +393,7 @@ public class MogoServices implements IMogoMapListener,
if ( DebugConfig.isNeedUploadCoordinatesDurationInTime() ) {
MoGoAiCloudRealTime.startRealTime( mContext, DebugConfig.getSocketAppId() );
}
TimeDelayUploadManager.getInstance().init(context);
}
public void initLocationServiceProcess( Context context ) {
@@ -960,6 +963,11 @@ public class MogoServices implements IMogoMapListener,
@Override
public void onAdasCarDataCallback( ADASCarStateInfo stateInfo ) {
if(TimeDelayUploadManager.getInstance().isMock()){ //模拟数据时,不更新由工控机传输的自车位置
return;
}
if ( stateInfo != null && stateInfo.getValues() != null ) {
JSONObject data = new JSONObject();
try {

View File

@@ -148,7 +148,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
@Override
public void onMsgReceived(SocketDownData.LauncherSnapshotProto mogoSnapshotSetData) {
DebugConfig.setStatus(DebugConfig.sDownloadSnapshot, true);
// SnapshotSetDataDrawer.getInstance().renderSnapshotData(mogoSnapshotSetData); //todo 6月4号 提测版本中去掉云端下发数据展示
SnapshotSetDataDrawer.getInstance().renderSnapshotData(mogoSnapshotSetData);
// Message msg = mSnapshotHandler.obtainMessage();
// msg.obj = mogoSnapshotSetData;
// msg.what = MSG_SNAPSHOT;

View File

@@ -64,7 +64,9 @@ public class MogoReceiver extends BroadcastReceiver {
public static final String ACTION_TXZ_BLOCK_SEARCH = "com.zhidao.roadcondition.roadinfo";
//车路云—场景预警
public static final String ACTION_V2X_FRONT_WARNING = "ACTION_V2X_FRONT_WARNING";
public static final String ACTION_V2X_FRONT_WARNING = "ACTION_V2X_FRONT_WARNING";
//v2x预警弹框清除
public static final String ACTION_V2X_REMOVE_TIP_WINDOW = "ACTION_V2X_REMOVE_TIP_WINDOW";
private IMogoIntentManager mMogoIntentManager;

View File

@@ -4,6 +4,7 @@ import android.content.Context;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import androidx.annotation.RequiresApi;
@@ -11,7 +12,6 @@ import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.cloud.socket.entity.SocketDownData;
import com.mogo.commons.data.BaseData;
import com.mogo.commons.network.SubscribeImpl;
import com.mogo.commons.network.Utils;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.uploadintime.SnapshotLocationController;
import com.mogo.module.service.MarkerServiceHandler;
@@ -20,6 +20,7 @@ import com.mogo.module.service.network.bean.MockSocketReceiverData;
import com.mogo.module.service.network.bean.MockSocketSendData;
import com.mogo.realtime.api.MoGoAiCloudRealTime;
import com.mogo.realtime.socket.IMogoCloudOnMsgListener;
import com.mogo.service.adas.IMogoADASController;
import com.mogo.service.connection.IMogoOnMessageListener;
import com.mogo.utils.WorkThreadHandler;
import com.mogo.utils.logger.Logger;
@@ -53,6 +54,7 @@ public class TimeDelayUploadManager implements IMogoOnMessageListener<MockSocket
private long mRecordSatelliteTime; //todo 后续多点模拟用
private TimeDelayApiService timeDelayApiService;
private IMogoADASController adasControllerApi;
private TimeDelayUploadManager() {
@@ -69,11 +71,16 @@ public class TimeDelayUploadManager implements IMogoOnMessageListener<MockSocket
return timeDelayUploadManager;
}
public boolean isMock() {
return isMockData;
}
public void init(Context mContext) {
MogoApisHandler.getInstance()
.getApis()
.getSocketManagerApi(mContext).registerOnMessageListener(MSG_SOCKET_TYPE, this);
MoGoAiCloudRealTime.registerOnMsgListener(this);
adasControllerApi = MogoApisHandler.getInstance().getApis().getAdasControllerApi();
}
private final Handler mockHandler = new Handler(WorkThreadHandler.newInstance("mock-algorithm-work-thread").getLooper()) {
@@ -139,6 +146,7 @@ public class TimeDelayUploadManager implements IMogoOnMessageListener<MockSocket
@Override
public void onMsgReceived(SocketDownData.LauncherSnapshotProto mogoSnapshotSetData) {
if (isMockData) {
Logger.d(TAG,"收到下发数据 mogoSnapshotSetData : " + mogoSnapshotSetData.toString());
//接口数据上报
SocketDownData.CloudRoadDataProto result = mogoSnapshotSetData.getAllListList()
.stream()
@@ -149,12 +157,19 @@ public class TimeDelayUploadManager implements IMogoOnMessageListener<MockSocket
Logger.d(TAG, "未找到与之匹配数据");
return;
}
MockSocketSendData mockSocketSendData = new MockSocketSendData(System.currentTimeMillis(), result.getUuid(), result.getSatelliteTime());
Logger.d(TAG,"找到匹配数据 result : " + result.toString());
long satelliteTime;
if (TextUtils.isEmpty(adasControllerApi.getSatelliteTime())) {
satelliteTime = System.currentTimeMillis();
} else {
satelliteTime = Long.parseLong(adasControllerApi.getSatelliteTime());
}
MockSocketSendData mockSocketSendData = new MockSocketSendData(satelliteTime, result.getUuid(), result.getSatelliteTime());
Map<String, Object> map = new HashMap<>();
map.put("sn", MoGoAiCloudClientConfig.getInstance().getSn());
map.put("data", GsonUtil.jsonFromObject(mockSocketSendData));
Logger.d(TAG, "mockSocketSendData : " + GsonUtil.jsonFromObject(mockSocketSendData));
Logger.d(TAG, "data uuid : " + result.getUuid() + " duration : " + (System.currentTimeMillis() - result.getSatelliteTime()));
Logger.d(TAG, "data uuid : " + result.getUuid() + " duration : " + (satelliteTime - result.getSatelliteTime()));
timeDelayApiService.uploadDelayData(map)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())

View File

@@ -2,8 +2,8 @@ package com.mogo.module.small.map;
import android.content.Context;
import android.graphics.BitmapFactory;
import android.location.Location;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.widget.RelativeLayout;
@@ -14,15 +14,18 @@ import com.amap.api.maps.AMap;
import com.amap.api.maps.CameraUpdate;
import com.amap.api.maps.CameraUpdateFactory;
import com.amap.api.maps.UiSettings;
import com.amap.api.maps.model.CustomMapStyleOptions;
import com.amap.api.navi.AMapNavi;
import com.amap.api.navi.AMapNaviView;
import com.amap.api.navi.AMapNaviViewOptions;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.map.MogoLatLng;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.view.RoundLayout;
import com.mogo.utils.FileUtils;
import java.io.IOException;
import com.mogo.module.small.map.utils.MapAssetStyleUtils;
import com.mogo.utils.logger.Logger;
/**
* 小地图的方向View
@@ -30,13 +33,17 @@ import java.io.IOException;
* @author donghongyu
* @date 12/14/20 4:40 PM
*/
public class SmallMapDirectionView extends RelativeLayout {
private String styleFilePath = "/mnt/sdcard/amap/small_map_style.data";
public class SmallMapDirectionView extends RelativeLayout implements IMogoCarLocationChangedListener2 {
/**
* 小地图名称
*/
public static final String MODULE_NAME = "SmallMap";
private RoundLayout rlSmallMapBorder;
private AMapNaviView mAMapNaviView;
private AMap mAMap;
private AMapNavi mAMapNavi;
private int zoomLevel = 15;
private boolean mapIsLoaded = false;
public SmallMapDirectionView(Context context) {
this(context, null);
@@ -62,15 +69,63 @@ public class SmallMapDirectionView extends RelativeLayout {
rlSmallMapBorder = findViewById(R.id.rlSmallMapBorder);
rlSmallMapBorder.addView(mAMapNaviView);
initAMapView();
// 注册定位监听
SmpServiceManager.getMogoRegisterCenter()
.registerCarLocationChangedListener(MODULE_NAME, this);
setOnClickListener(view -> {
if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_LENOVO) {
MogoApisHandler.getInstance().getApis()
.getMapServiceApi()
.getMapUIController()
.changeMapMode(
MogoApisHandler.getInstance()
.getApis()
.getAdasControllerApi()
.getCurrentSkinMode()
);
}
});
}
private void initAMapView() {
// 车头朝上
mAMapNaviView.setNaviMode(AMapNaviView.CAR_UP_MODE);
// 设置电子眼所在路线的可见性
mAMapNaviView.setRouteOverlayVisible(false);
AMap aMap = mAMapNaviView.getMap();
mAMap = mAMapNaviView.getMap();
// 关闭地图文字标注
aMap.showMapText(false);
mAMap.showMapText(false);
// 设置导航地图模式aMap是地图控制器对象。
mAMap.setMapType(AMap.MAP_TYPE_NIGHT);
// 关闭显示实时路况图层aMap是地图控制器对象。
mAMap.setTrafficEnabled(false);
mAMapNavi = AMapNavi.getInstance(getContext());
mAMapNavi.setIsUseExtraGPSData(false);
new Thread(() -> {
try {
Thread.sleep(1000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
mAMap.setCustomMapStyle(
new CustomMapStyleOptions()
.setEnable(true)
.setStyleData(MapAssetStyleUtils.getAssetsStyle(getContext()))
.setStyleExtraData(MapAssetStyleUtils.getAssetsExtraStyle(getContext()))
);
//设置希望展示的地图缩放级别
CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel);
mAMap.moveCamera(cameraUpdate);
}).start();
// 设置地图的样式
UiSettings uiSettings = aMap.getUiSettings();
UiSettings uiSettings = mAMap.getUiSettings();
uiSettings.setZoomControlsEnabled(false);// 地图缩放级别的交换按钮
uiSettings.setAllGesturesEnabled(false);// 所有手势
uiSettings.setMyLocationButtonEnabled(false); // 显示默认的定位按钮
@@ -137,95 +192,9 @@ public class SmallMapDirectionView extends RelativeLayout {
// 2D模式
options.setTilt(0);
// 黑夜模式
//options.setNaviNight(true);
// 自定义地图样式
options.setCustomMapStylePath(styleFilePath);
options.setNaviNight(true);
mAMapNaviView.setViewOptions(options);
}
//设置希望展示的地图缩放级别
CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel);
aMap.moveCamera(cameraUpdate);
try {
// 判断是否有样式文件存在
FileUtils.copy(
context.getAssets().open("small_map_style.data"),
styleFilePath,
new FileUtils.FileCopyListener() {
@Override
public void onStart() {
Log.w("FileCopyListener", "onStart=");
}
@Override
public void onFail(Exception e) {
Log.w("FileCopyListener", "onFail=");
e.printStackTrace();
}
@Override
public void onProcess(int process) {
Log.w("FileCopyListener", "onProcess=" + process);
}
@Override
public void onFinish(String toPath) {
Log.w("FileCopyListener", "onFinish toPath=" + toPath);
// 高德地图有bug所以需要多次调用设置皮肤才能成功
if (options != null) {
options.setCustomMapStylePath(styleFilePath);
mAMapNaviView.setViewOptions(options);
}
//设置希望展示的地图缩放级别
CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel);
aMap.moveCamera(cameraUpdate);
}
}
);
} catch (IOException e) {
e.printStackTrace();
}
new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(1000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
// 高德地图有bug所以需要多次调用设置皮肤才能成功
if (options != null) {
options.setCustomMapStylePath(styleFilePath);
mAMapNaviView.setViewOptions(options);
}
//设置希望展示的地图缩放级别
CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel);
aMap.moveCamera(cameraUpdate);
}
}).start();
setOnClickListener(view -> {
if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_LENOVO) {
MogoApisHandler.getInstance().getApis()
.getMapServiceApi()
.getMapUIController()
.changeMapMode(
MogoApisHandler.getInstance()
.getApis()
.getAdasControllerApi()
.getCurrentSkinMode()
);
}
});
}
@@ -233,4 +202,17 @@ public class SmallMapDirectionView extends RelativeLayout {
public boolean onInterceptTouchEvent(MotionEvent ev) {
return true;
}
@Override
public void onCarLocationChanged2(Location latLng) {
Logger.d(MODULE_NAME, "onCarLocationChanged2 latLng:" + latLng);
if (mAMapNavi != null) {
mAMapNavi.setExtraGPSData(2, latLng);
}
}
@Override
public void onCarLocationChanged(MogoLatLng latLng) {
Logger.d(MODULE_NAME, "onCarLocationChanged latLng:" + latLng);
}
}

View File

@@ -0,0 +1,45 @@
package com.mogo.module.small.map;
import android.content.Context;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.module.IMogoRegisterCenter;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020-01-2114:01
* desc : V2X 服务
* version: 1.0
*/
public class SmpServiceManager {
private static final String TAG = "V2XServiceManager";
private static boolean isInit;
private static Context mContext;
private static IMogoServiceApis mMogoServiceApis;
private static IMogoRegisterCenter mMogoRegisterCenter;
private SmpServiceManager() {
}
public static void init(final Context context) {
if (!isInit) {
isInit = true;
mContext = context;
mMogoServiceApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context);
mMogoRegisterCenter = mMogoServiceApis.getRegisterCenterApi();
}
}
public static Context getContext() {
return mContext;
}
public static IMogoRegisterCenter getMogoRegisterCenter() {
return mMogoRegisterCenter;
}
}

View File

@@ -94,6 +94,8 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation project(':modules:mogo-module-obu')
implementation rootProject.ext.dependencies.mebulaobu
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -6,7 +6,6 @@
-keep class com.mogo.module.v2x.marker.*{*;}
-keep class com.mogo.module.v2x.utils.SpanUtils.Align
-keep class com.mogo.module.v2x.utils.TimeConstants.Unit
-keep class com.mogo.module.v2x.scenario.scene.test.V2XTestConsoleWindow{*;}
-keep class com.mogo.module.v2x.utils.SpanUtils.SerializableSpannableStringBuilder{*;}
-keep class com.mogo.module.v2x.utils.V2XUtils{*;}
-keep class com.mogo.module.v2x.view.*{*;}

View File

@@ -53,6 +53,7 @@ import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import com.mogo.utils.storage.SharedPrefsMgr;
import com.tencent.liteav.basic.log.TXCLog;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
import static com.mogo.module.v2x.VideoInitKt.initVideo;
@@ -133,6 +134,9 @@ public class V2XModuleProvider implements
public void init(Context context) {
Logger.d(MODULE_NAME, "V2X 模块初始化。。。。");
mContext = context;
// 关闭腾讯直播日志
TXCLog.setLevel(TXCLog.LOG_NONE);
TXCLog.setConsoleEnabled(false);
V2XUtils.init(context);
V2XServiceManager.init(context);
@@ -281,23 +285,23 @@ public class V2XModuleProvider implements
V2XServiceManager
.getMogoRegisterCenter()
.registerMogoMarkerClickListener(V2XConst.MODULE_NAME, new IMogoMarkerClickListener() {
@Override
public boolean onMarkerClicked(IMogoMarker marker) {
try {
MarkerExploreWay markerExploreWay =
(MarkerExploreWay) ((MarkerShowEntity) marker.getObject()).getBindObj();
Logger.d(V2XConst.MODULE_NAME,
"V2X===违章停车:onMarkerClicked=" + markerExploreWay);
@Override
public boolean onMarkerClicked(IMogoMarker marker) {
try {
MarkerExploreWay markerExploreWay =
(MarkerExploreWay) ((MarkerShowEntity) marker.getObject()).getBindObj();
Logger.d(V2XConst.MODULE_NAME,
"V2X===违章停车:onMarkerClicked=" + markerExploreWay);
//直接展示弹窗
V2XIllegalParkWindow parkScenario = new V2XIllegalParkWindow();
parkScenario.show(markerExploreWay, false);
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
});
//直接展示弹窗
V2XIllegalParkWindow parkScenario = new V2XIllegalParkWindow();
parkScenario.show(markerExploreWay, false);
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
});
// 注册V2X场景Socket
V2XServiceManager.getV2XSocketManager().registerSocketMessage();
@@ -305,8 +309,6 @@ public class V2XModuleProvider implements
V2XServiceManager.getV2XMarkerService().startAutoRefresh();
// 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随
V2XServiceManager.getMapUIController().recoverLockMode();
//注册adas数据通道
V2XWaringManager.getInstance().registerAdasSocketMessage(mContext);
}
/**
@@ -344,7 +346,7 @@ public class V2XModuleProvider implements
}
} else if (descriptor == StatusDescriptor.SEEK_HELPING) {
refreshMeSeekHelp(isTrue);
}else if (descriptor == StatusDescriptor.TOP_CONTAINER_READY) {
} else if (descriptor == StatusDescriptor.TOP_CONTAINER_READY) {
if (isTrue) {
V2XServiceManager.getV2XRefreshModel().queryRoadData(MoGoAiCloudClientConfig.getInstance().getSn());
}

View File

@@ -8,11 +8,13 @@ import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import android.util.ArrayMap;
import android.util.Log;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.voice.AIAssist;
import com.mogo.map.location.MogoLocation;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.entity.V2XMessageEntity;
@@ -24,7 +26,9 @@ import com.mogo.module.v2x.utils.ADASUtils;
import com.mogo.module.v2x.utils.DrivingDirectionUtils;
import com.mogo.module.v2x.utils.ObuConfig;
import com.mogo.module.v2x.utils.TestOnLineCarUtils;
import com.mogo.module.v2x.utils.ToastUtils;
import com.mogo.service.entrance.IMogoEntranceButtonController;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.logger.Logger;
import com.zhidao.mogo.module.obu.ObuConstant;
import com.zhidao.mogo.module.obu.ObuManager;
@@ -32,10 +36,16 @@ import com.zhidao.mogo.module.obu.obu.IObuCallback;
import com.zhidao.mogo.module.obu.obu.bean.MogoObuEventInfo;
import com.zhidao.mogo.module.obu.obu.bean.MogoObuLocationInfo;
import com.zhidao.mogo.module.obu.obu.bean.MogoObuTrafficLightInfo;
import com.zhidao.support.nebulaobu.NebulaObuClient;
import com.zhidao.support.nebulaobu.OnObuListener;
import com.zhidao.support.nebulaobu.model.ActiveSafetyInfo;
import com.zhidao.support.nebulaobu.model.ObuInfo;
import com.zhidao.support.nebulaobu.model.ObuInfoMore;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.List;
import java.util.Map;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
@@ -76,14 +86,77 @@ public class V2XObuManager implements IObuCallback, Handler.Callback {
public void init(Context context) {
Logger.d(MODULE_NAME, "obuManager初始化--");
//之前内部对接的obu
obuManager = new ObuManager();
obuManager.init(context);
obuManager.registerObuDataChangedListener(this);
//使用adas部门obu sdk (星云)
NebulaObuClient.getInstance().init(context);
NebulaObuClient.getInstance().registerObu(100);
NebulaObuClient.getInstance().registerObuListener(listener);
IntentFilter filter = new IntentFilter("com.mogo.launcher.v2x.action.EXCHANGE_OBU_TYPE");
context.registerReceiver(obuTypeExchangeReceiver, filter);
}
public void release() {
NebulaObuClient.getInstance().unregisterObu();
NebulaObuClient.getInstance().unregisterObuListener();
}
/**
* 星云obu数据监听
*/
private OnObuListener listener = new OnObuListener() {
@Override
public void onRegister() {
}
@Override
public void onConnectFail(boolean isNeedReconnect) {
Logger.d("liyz", "onConnectFail ------> ");
}
@Override
public void onUnregister() {
}
@Override
public void onObuInfo(ObuInfo info) {
Logger.d("liyz", "onObuInfo ------> " + info.toString());
}
@Override
public void onWarningInfo(List<ActiveSafetyInfo> infoList) {
if (infoList != null) {
if (infoList.size() > 0) { //一般只有一个
ActiveSafetyInfo info = infoList.get(0);
Logger.d("liyz", "onWarningInfo type ------> " + info.getWarningtype() + "--size = " + infoList.size());
if (info.getWarningtype() == 3) {
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
handleSdkObu();
}
}
}
}
}
};
private void handleSdkObu() {
V2XMessageEntity<V2XObuEventEntity> messageEntity = new V2XMessageEntity<>();
messageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_OBU_EVENT);
// 前车紧急制动预警
V2XObuEventEntity urgencyEvent = new V2XObuEventEntity();
urgencyEvent.setType(ObuConstant.TYPE_URGENCY_COLLISION_WARNING);
urgencyEvent.setDesc(V2XObuEventScenario.URGENCY_COLLISION_WARN_TEXT);
messageEntity.setContent(urgencyEvent);
V2XObuEventScenario.getInstance().init(messageEntity);
}
/**
* 用来处理30秒内不重复播报的情况
*/
@@ -178,9 +251,9 @@ public class V2XObuManager implements IObuCallback, Handler.Callback {
@Override
public void onEventInfoCallback(MogoObuEventInfo info) {
Logger.d("V2X_OBU_EVENT", "carEventInfo==" + info);
//Logger.d("V2X_OBU_EVENT", "carEventInfo==" + info);
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
Logger.d("V2X_OBU_EVENT", "vr模式下不展示obu事件");
//Logger.d("V2X_OBU_EVENT", "vr模式下不展示obu事件");
return;
}
Long last = intervalMap.get(info.getTypeCode());

View File

@@ -10,7 +10,7 @@ import com.mogo.module.v2x.listener.V2XMessageListener_401010;
import com.mogo.module.v2x.listener.V2XMessageListener_401011;
import com.mogo.module.v2x.listener.V2XMessageListener_401012;
import com.mogo.module.v2x.listener.V2XMessageListener_402000;
import com.mogo.module.v2x.listener.V2XMessageListener_402001;
import com.mogo.module.v2x.listener.V2XMessageListener_401018;
import com.mogo.utils.logger.Logger;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
@@ -35,7 +35,7 @@ public class V2XSocketManager {
private V2XMessageListener_401009 v2XMessageListener_401009;
private V2XMessageListener_401010 v2XMessageListener_401010;
private V2XMessageListener_402000 mV2XMessageListener_402000;
private V2XMessageListener_402001 mV2XMessageListener402001;
private V2XMessageListener_401018 mV2XMessageListener401018;
private V2XSocketManager() {
}
@@ -251,8 +251,8 @@ public class V2XSocketManager {
* * 弱势交通参与者
*/
public void registerWarningMsg() {
mV2XMessageListener402001 = new V2XMessageListener_402001();
V2XServiceManager.getMoGoSocketManager().registerOnMessageListener(402001, mV2XMessageListener402001);
mV2XMessageListener401018 = new V2XMessageListener_401018();
V2XServiceManager.getMoGoSocketManager().registerOnMessageListener(401018, mV2XMessageListener401018);
}

View File

@@ -1,132 +0,0 @@
package com.mogo.module.v2x;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.module.v2x.listener.V2XMessageListener_402001;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
/**
* desc : V2X报警事件管理这里进行报警事件的分发处理包括了adas数据
*/
public class V2XWaringManager {
private Context mContext;
private static V2XWaringManager mV2XWaringManager;
//TODO 需要修改
private V2XMessageListener_402001 mV2XMessageListener402001;
private V2XWaringManager() {
}
/**
* 获取操作实体
*/
public static synchronized V2XWaringManager getInstance() {
synchronized (V2XWaringManager.class) {
if (mV2XWaringManager == null) {
mV2XWaringManager = new V2XWaringManager();
}
}
return mV2XWaringManager;
}
/**
* 注册长链接消息处理
*/
public void registerAdasSocketMessage(Context context) {
Logger.d(V2XConst.LOG_NAME_WARN, "开始注册Socket通道....");
mContext = context;
//根据云端,绘制自车和交点,以及行人或二轮车与交点的绘制
registerWarnListener();
// handleAdasData();
}
/**
* 测试数据
*/
private void testData(String adasResult) {
try {
int id = R.raw.scenario_warning_event_data_right;
switch (adasResult) {
case "left":
id = R.raw.scenario_warning_event_data_left;
break;
case "pedestrians":
id = R.raw.scenario_warning_event_data_pedestrians;
break;
default:
}
InputStream inputStream = V2XUtils.getApp()
.getResources()
.openRawResource(id);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int len = -1;
byte[] buffer = new byte[1024];
while ((len = inputStream.read(buffer)) != -1) {
baos.write(buffer, 0, len);
}
inputStream.close();
// 加载数据源
V2XWarningEntity warningEntity = GsonUtil.objectFromJson(baos.toString(), V2XWarningEntity.class);
// V2XServiceManager.getMoGoV2XCloundDataManager().analysisV2XCloundDataEvent(warningEntity);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 反注册消息通道,不再进行接受
*/
public void unregisterAdasSocketMessage() {
Logger.w(V2XConst.LOG_NAME_WARN, "反注册Socket通道....");
if (mV2XMessageListener402001 != null) {
V2XServiceManager
.getMoGoSocketManager()
.unregisterOnMessageListener(401018, mV2XMessageListener402001);
}
}
/**
* 道路预警 弱势群体事件,行人 TODO type
*/
private void registerWarnListener() {
mV2XMessageListener402001 = new V2XMessageListener_402001();
V2XServiceManager
.getMoGoSocketManager()
.registerOnMessageListener(
401018,
mV2XMessageListener402001);
}
public V2XMessageListener_402001 getV2XMessageListener() {
return mV2XMessageListener402001;
}
/**
* 处理adas返回的数据
*/
public void handleAdasData(Intent intent) {
Log.d(V2XConst.LOG_NAME_WARN, "V2XWaringManager ---- handleAdasData ");
String adasResult = (String) intent.getSerializableExtra(V2XConst.BROADCAST_ADAS_EXTRA_KEY);
//测试数据
testData(adasResult);
}
}

View File

@@ -55,23 +55,23 @@ public class V2XEarlyWarningServer {
// 封路、施工、拥堵、拥堵 才会有UGC提示
if (EventTypeUtils.isNeedRoadEventUgc(v2XRoadEventEntity.getPoiType())) {
Logger.w(MODULE_NAME,
"V2X预警--UGC检测" +
"\n事件详情" + roadInfoId +
"\n事件详情" + EventTypeUtils.getPoiTypeStr(v2XRoadEventEntity.getPoiType()) +
"\n车头方向 " + carBearing +
"\n车与事件夹角" + eventAngle +
"\n已经UGC的事件" + GsonUtil.jsonFromObject(alertMessageId)
);
// Logger.w(MODULE_NAME,
// "V2X预警--UGC检测" +
// "\n事件详情" + roadInfoId +
// "\n事件详情" + EventTypeUtils.getPoiTypeStr(v2XRoadEventEntity.getPoiType()) +
// "\n车头方向 " + carBearing +
// "\n车与事件夹角" + eventAngle +
// "\n已经UGC的事件" + GsonUtil.jsonFromObject(alertMessageId)
// );
// 判断是否预警过了
if (!alertMessageId.contains(roadInfoId)) {
// 判断车辆行驶角度是否与事件相反,相反的话表示已经行驶过去了
if (80 <= eventAngle) {
Logger.w(MODULE_NAME + "_" + TAG, "V2X预警UGC--事件与车头角度夹角过大:" +
"\n角度" + eventAngle + "" +
"\n事件详情" + roadInfoId +
"\n库存事件" + V2XAlarmServer.mAlertRoadEventList.size()
);
// Logger.w(MODULE_NAME + "_" + TAG, "V2X预警UGC--事件与车头角度夹角过大:" +
// "\n角度" + eventAngle + " 度" +
// "\n事件详情" + roadInfoId +
// "\n库存事件" + V2XAlarmServer.mAlertRoadEventList.size()
// );
// 记录已经 UGC 提醒过的数据
alertMessageId.add(roadInfoId);

View File

@@ -14,27 +14,26 @@ import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.service.connection.IMogoOnMessageListener;
/**
* desc: 下发的云端预警数据
* desc: 车路云预警-弱势交通参与者
*/
public class V2XMessageListener_402001 implements IMogoOnMessageListener<V2XOptimalRouteDataRes> {
public class V2XMessageListener_401018 implements IMogoOnMessageListener<V2XWarningEntity> {
@Override
public Class<V2XOptimalRouteDataRes> target() {
return V2XOptimalRouteDataRes.class;
public Class<V2XWarningEntity> target() {
return V2XWarningEntity.class;
}
@Override
public void onMsgReceived(V2XOptimalRouteDataRes info) {
Log.d(V2XConst.LOG_NAME_WARN, "V2XWarnMessageListener onMsgReceived ---11---> ");
//Logger.d(MODULE_NAME, "V2XMessageListener_401011==V2X地图气泡数据刷新\n" + GsonUtil.jsonFromObject(response));
public void onMsgReceived(V2XWarningEntity info) {
Log.d(V2XConst.MODULE_NAME, "V2XWarnMessageListener onMsgReceived ---11---> ");
V2XUtils.runOnBackgroundThread(() -> {
// 解析不同的Marker类型然后对应的进行绘制
if (info != null) {
// 解析存储道路事件 liyz
Log.d(V2XConst.LOG_NAME_WARN, "V2XWarnMessageListener onMsgReceived --22--> ");
V2XMessageEntity<V2XOptimalRouteDataRes> v2xMessageEntity = new V2XMessageEntity<>();
// 解析存储道路事件
Log.d(V2XConst.MODULE_NAME, "V2XWarnMessageListener onMsgReceived --22--> ");
V2XMessageEntity<V2XWarningEntity> v2xMessageEntity = new V2XMessageEntity<>();
// 控制类型
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_VR_SHOW);
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_WEAKNESS);
// 设置数据
v2xMessageEntity.setContent(info);
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
@@ -42,7 +41,5 @@ public class V2XMessageListener_402001 implements IMogoOnMessageListener<V2XOpti
LocalBroadcastManager.getInstance(V2XUtils.getApp()).sendBroadcast(intent);
}
});
}
}

View File

@@ -5,10 +5,8 @@ import android.content.Intent;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.entity.net.V2XOptimalRouteDataRes;
import com.mogo.module.v2x.utils.TestOnLineCarUtils;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.service.connection.IMogoOnMessageListener;
import com.mogo.utils.logger.Logger;

View File

@@ -139,7 +139,6 @@ public class TestPanelBroadcastReceiver extends BroadcastReceiver {
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, messageEntity);
LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
mContext.sendBroadcast(intent);
} else if (sceneType == 13) {//车路云场景预警-左侧
V2XMessageEntity messageEntity = TestOnLineCarUtils.getV2XScenarioPushFrontWarningEventData("left");
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);

View File

@@ -1,19 +1,23 @@
package com.mogo.module.v2x.scenario.impl;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.Nullable;
import com.mogo.commons.voice.AIAssist;
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
import com.mogo.commons.voice.VoicePreemptType;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.service.receiver.MogoReceiver;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.scenario.IV2XScenario;
import com.mogo.module.v2x.scenario.view.IV2XButton;
import com.mogo.module.v2x.scenario.view.IV2XMarker;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.service.v2x.IV2XWindowManagerListener;
import com.mogo.utils.logger.Logger;
/**
@@ -55,7 +59,7 @@ public abstract class AbsV2XScenario<T> implements IV2XScenario {
@Override
public void speakTTSVoice(@Nullable String msg, IMogoVoiceCmdCallBack callBack) {
if (!TextUtils.isEmpty(msg)) {
Logger.d(V2XConst.MODULE_NAME, "调用TTS播放语音" + msg);
Logger.d(TAG, "调用TTS播放语音" + msg);
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice(msg, VoicePreemptType.PREEMPT_TYPE_IMMEADIATELY, callBack);
}
}
@@ -99,4 +103,5 @@ public abstract class AbsV2XScenario<T> implements IV2XScenario {
}
return mV2XMessageEntity.equals(v2XMessageEntity);
}
}

View File

@@ -26,6 +26,7 @@ import com.mogo.module.v2x.scenario.scene.warning.V2XFrontWarningScenario;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.utils.TipToast;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_PARKING;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
@@ -109,12 +110,9 @@ public class V2XScenarioManager implements IV2XScenarioManager {
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_VR_SHOW:
mV2XScenario = new V2XOptimalRouteVREventScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_TOP:
case V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_LEFT:
case V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_RIGHT:
case V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_BOTTOM:
mV2XScenario = new V2XFrontWarningScenario();
case V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_WEAKNESS:
if (V2XServiceManager.getMoGoStatusManager().isVrMode()) {
mV2XScenario = new V2XFrontWarningScenario();
} else {
mV2XScenario = null;
}
@@ -148,7 +146,7 @@ public class V2XScenarioManager implements IV2XScenarioManager {
private void sceneChange() {
if (MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().
getCurrentMapVisualAngle() != VisualAngleMode.MODE_MEDIUM_SIGHT) {
V2XServiceManager.getMapService().getMapUIController().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT,null);
V2XServiceManager.getMapService().getMapUIController().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
}
}

View File

@@ -2,15 +2,20 @@ package com.mogo.module.v2x.scenario.scene;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.RelativeLayout;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.service.receiver.MogoReceiver;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.service.v2x.IV2XWindowManagerListener;
import com.mogo.utils.logger.Logger;
/**
* @author donghongyu
* @date 12/11/20 10:35 AM
*/
public class V2XBasWindow extends RelativeLayout {
public class V2XBasWindow extends RelativeLayout implements IV2XWindowManagerListener {
private final String TAG = "V2XBasWindow";
public V2XBasWindow(Context context) {
@@ -28,6 +33,7 @@ public class V2XBasWindow extends RelativeLayout {
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
MogoApisHandler.getInstance().getApis().getV2XListenerManager().registerIntentListener(MogoReceiver.ACTION_V2X_FRONT_WARNING, this);
Logger.w(TAG, "onAttachedToWindow……");
}
@@ -43,6 +49,14 @@ public class V2XBasWindow extends RelativeLayout {
*/
protected void release() {
Logger.w(TAG, "release……");
}
@Override
public void removeTipWindowByListener() {
Log.d(TAG, "removeAllTipWindow");
V2XServiceManager
.getMogoTopViewManager()
.removeView(this);
}
}

View File

@@ -33,10 +33,6 @@ public class V2XPushLiveCarScenario extends AbsV2XScenario<V2XPushMessageEntity>
public void init(@Nullable V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity) {
if (!isSameScenario(v2XMessageEntity)
&& V2XServiceManager.getMoGoStatusManager().isMainPageOnResume()) {
boolean isWindowShow = V2XServiceManager.getMoGoV2XStatusManager().isLeftLiveVideoShow();
if (isWindowShow) {
close();
}
setV2XMessageEntity(v2XMessageEntity);
if (v2XMessageEntity != null &&
(v2XMessageEntity.getContent().getVideoSn() != null ||

View File

@@ -19,6 +19,7 @@ import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.scenario.impl.V2XScenarioManager;
import com.mogo.module.v2x.utils.ToastUtils;
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
import com.mogo.module.v2x.voice.V2XVoiceManager;
@@ -101,8 +102,6 @@ public class V2XVoiceCallLiveBiz implements IMogoMarkerClickListener {
}
//拉近地图视角为近景
V2XServiceManager.getMapService().getMapUIController().changeMapVisualAngle(VisualAngleMode.MODE_CLOSE_SIGHT, marker.getPosition());
//移动地图中心点至marker位置
V2XServiceManager.getMapService().getMapUIController().moveToCenter(marker.getPosition(), true);
String assInfo = marker.getMarkerAssInfo();
Log.d(REGISTER_LIFECYCLE_TAG, "onStaticMarkerClicked marker assInfo : " + assInfo);
if (TextUtils.isEmpty(assInfo) || !assInfo.contains(MAP_STATIC_TRAFFIC)) {
@@ -145,9 +144,8 @@ public class V2XVoiceCallLiveBiz implements IMogoMarkerClickListener {
public void getFrontCarLive() {
LiveStreamManagerImpl.getInstance(AbsMogoApplication.getApp(),
MoGoAiCloudClientConfig.getInstance().getThirdPartyDeviceId());
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity = buildCallLiveParams(null, null);
V2XVoiceCallLiveScenario mV2XVoiceCallLiveScenario = new V2XVoiceCallLiveScenario();
mV2XVoiceCallLiveScenario.init(v2XMessageEntity);
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity = buildCallLiveParams(null, null, V2XMessageEntity.V2XTypeEnum.ALERT_VOICE_CALL_FOR_LIVECAR_SHOW);
V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity);
}
/**
@@ -159,9 +157,8 @@ public class V2XVoiceCallLiveBiz implements IMogoMarkerClickListener {
@Override
public void liveUrlResult(String liveUrl) {
if (!TextUtils.isEmpty(liveUrl)) {
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity = buildCallLiveParams(null, liveUrl);
V2XPushLiveCarScenario pushLiveCarScenario = new V2XPushLiveCarScenario();
pushLiveCarScenario.init(v2XMessageEntity);
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity = buildCallLiveParams(null, liveUrl, V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_LIVE_CAR_WARNING);
V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity);
} else {
Logger.d(MODULE_NAME, "getOpenRoadCameraLive 路口实况直播地址为空");
ToastUtils.showShort(R.string.v2x_front_live_url_null);
@@ -186,9 +183,8 @@ public class V2XVoiceCallLiveBiz implements IMogoMarkerClickListener {
@Override
public void liveUrlResult(String liveUrl) {
if (!TextUtils.isEmpty(liveUrl)) {
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity = buildCallLiveParams(null, liveUrl);
V2XPushLiveCarScenario pushLiveCarScenario = new V2XPushLiveCarScenario();
pushLiveCarScenario.init(v2XMessageEntity);
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity = buildCallLiveParams(null, liveUrl, V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_LIVE_CAR_WARNING);
V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity);
} else {
Logger.d(MODULE_NAME, "getOpenRoadCameraLive 路口实况直播地址为空");
ToastUtils.showShort(R.string.v2x_specific_live_url_null);
@@ -210,14 +206,14 @@ public class V2XVoiceCallLiveBiz implements IMogoMarkerClickListener {
* @param liveUrl 直播Url
* @return {@link V2XMessageEntity<V2XPushMessageEntity>}
*/
private V2XMessageEntity<V2XPushMessageEntity> buildCallLiveParams(String sn, String liveUrl) {
private V2XMessageEntity<V2XPushMessageEntity> buildCallLiveParams(String sn, String liveUrl, int type) {
V2XPushMessageEntity v2XPushMessageEntity = new V2XPushMessageEntity();
v2XPushMessageEntity.setVideoSn(sn);
v2XPushMessageEntity.setVideoUrl(liveUrl);
v2XPushMessageEntity.setShowWindow(true);
v2XPushMessageEntity.setExpireTime(1000 * 30);
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity = new V2XMessageEntity<>();
v2XMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_VOICE_CALL_FOR_LIVECAR_SHOW);
v2XMessageEntity.setType(type);
v2XMessageEntity.setContent(v2XPushMessageEntity);
v2XMessageEntity.setShowState(true);
return v2XMessageEntity;

View File

@@ -25,6 +25,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
public class V2XVoiceCallLiveScenario extends AbsV2XScenario<V2XPushMessageEntity> implements IMogoTopViewStatusListener {
public V2XVoiceCallLiveScenario() {
Logger.d(V2XConst.MODULE_NAME, "V2XVoiceCallLiveScenario new()" );
setV2XWindow(new V2XVoiceCallLiveCarWindow());
}

View File

@@ -5,6 +5,7 @@ import android.graphics.Color;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.voice.AIAssist;
@@ -20,6 +21,7 @@ import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario;
import com.mogo.module.v2x.utils.DrivingDirectionUtils;
import com.mogo.module.v2x.utils.ToastUtils;
import com.mogo.utils.logger.Logger;
import com.zhidao.mogo.module.obu.ObuConstant;
import com.zhidao.mogo.module.obu.obu.bean.MogoObuEventInfo;
@@ -40,7 +42,8 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
*/
public class V2XObuEventScenario extends AbsV2XScenario<V2XObuEventEntity> implements Handler.Callback {
public static final String URGENCY_COLLISION_WARN_TEXT = "前车急刹,注意保持安全距离!";
public static final String URGENCY_COLLISION_WARN_TEXT_ONE = "前车急刹,注意保持安全距离!";
public static final String URGENCY_COLLISION_WARN_TEXT = "前车急刹";
private static final int MSG_CLOSE_OBU_WINDOW = 1001;
private static final int DEFAULT_EXPIRE_TIME = 20_000;
@@ -118,7 +121,7 @@ public class V2XObuEventScenario extends AbsV2XScenario<V2XObuEventEntity> imple
*/
@Override
public void show() {
AIAssist.getInstance(V2XServiceManager.getContext()).speakTTSVoice(getV2XMessageEntity().getContent().getDesc());
AIAssist.getInstance(V2XServiceManager.getContext()).speakTTSVoice(URGENCY_COLLISION_WARN_TEXT_ONE);
showWindow();
if (handler.hasMessages(MSG_CLOSE_OBU_WINDOW)) {
handler.removeMessages(MSG_CLOSE_OBU_WINDOW);

View File

@@ -17,6 +17,7 @@ import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.utils.ToastUtils;
import com.mogo.service.windowview.IMogoTopViewStatusListener;
import com.mogo.utils.logger.Logger;
import com.zhidao.mogo.module.obu.ObuConstant;
@@ -47,7 +48,7 @@ public class V2XObuEventWindow extends FrameLayout implements IV2XWindow<V2XObuE
private void initView(Context context){
Logger.d(MODULE_NAME,"初始化obu场景view");
LayoutInflater.from(context).inflate(R.layout.window_simple_obu_event_detail, this);
LayoutInflater.from(context).inflate(R.layout.window_simple_obu_event_detail_vr, this);
ivTypeIcon = findViewById(R.id.ivObuTypeIcon);
tvType = findViewById(R.id.tvObuType);
tvDesc = findViewById(R.id.tvObuDesc);
@@ -65,6 +66,7 @@ public class V2XObuEventWindow extends FrameLayout implements IV2XWindow<V2XObuE
@Override
public void show(V2XObuEventEntity entity) {
Logger.d(MODULE_NAME, "ObuEventWindow show " + entity);
Logger.d("liyz", "ObuEventWindow show " + entity + "--type = " + entity.getType());
switch (entity.getType()) {
case ObuConstant
.TYPE_OPTIMAL_SPEED_ADVISORY:
@@ -75,8 +77,8 @@ public class V2XObuEventWindow extends FrameLayout implements IV2XWindow<V2XObuE
tvType.setBackgroundResource(R.drawable.bg_v2x_event_type_green);
break;
case ObuConstant.TYPE_URGENCY_COLLISION_WARNING:
// 前车急刹预警
ivTypeIcon.setImageResource(R.drawable.v2x_icon_obu_urgency_collision);
// 前车急刹预警 v2x_icon_obu_urgency_collision
ivTypeIcon.setImageResource(R.drawable.v2x_icon_ahead_car_brake);
tvDesc.setText(entity.getDesc());
tvType.setText("前车急刹");
tvType.setBackgroundResource(R.drawable.bg_v2x_event_type_read);

View File

@@ -1,415 +0,0 @@
package com.mogo.module.v2x.scenario.scene.test;
import android.content.Context;
import android.content.Intent;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.LinearLayout;
import android.widget.ToggleButton;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.google.android.flexbox.FlexboxLayout;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.alarm.V2XAlarmServer;
import com.mogo.module.v2x.entity.net.V2XOptimalRouteDataRes;
import com.mogo.module.v2x.entity.net.V2XSpecialCarRes;
import com.mogo.module.v2x.scenario.scene.livecar.V2XVoiceCallLiveBiz;
import com.mogo.module.v2x.utils.TestOnLineCarUtils;
import com.mogo.module.v2x.utils.V2XSQLiteUtils;
import com.mogo.utils.TipToast;
import com.zhidao.carchattingprovider.MogoDriverInfo;
import java.util.List;
import static android.text.style.TtsSpan.GENDER_MALE;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020/4/24 11:34 AM
* desc : 用来测试的控制台 Window
* version: 1.0
*/
@Deprecated
public class V2XTestConsoleWindow extends ConstraintLayout {
private static V2XTestConsoleWindow mV2XTestConsoleWindow;
private LinearLayout mFlTestPanel;
private FlexboxLayout flTestPanelShunNormal;
private FlexboxLayout flTestPanelShunYi;
private FlexboxLayout flTestPanelVR;
private Button mBtnTriggerOpen;
private Button mBtnTriggerRoadEvent;
private Button mBtnClearRoadEvent;
private Button mBtnTriggerPushEvent;
private Button mBtnTriggerWarningEvent;
private Button mBtnTriggerPushLiveCarEvent;
private Button mBtnTriggerAnimationEvent;
private Button mBtnbtnFrontCarLiveEvent;
private Button mBtnbtnXINGLiveEvent;
private Button mBtnTriggerFatigueDrivingEvent;
private Button mBtnTriggerSeekHelpEvent;
private Button mBtnTriggerParkEvent;
private Button mBtnTriggerCallUserInfo;
private Button mBtnTriggerEventUgc;
private Button mBtnTriggerTrafficSearch;
private Button mBtnTriggerRecommendRouteEvent;
private ToggleButton nBtnTriggerVR;
private Button mBtnAdasDataWarn;
private Button btnTriggerRearVIPCarTip,
btnTriggerVehicleBrakes,
btnTriggerRearDangerousVehicles,
btnTriggerReverseVehicleRoutePrediction,
btnTriggerVIPLightChange,
btnTriggerObstacleDetour,
btnTriggerPedestrianWarning,
btnTriggerCongestedRouteRecommendation,
btnTriggerDoubleFlash;
public static V2XTestConsoleWindow getInstance(Context context, int showType) {
if (mV2XTestConsoleWindow == null) {
synchronized (V2XTestConsoleWindow.class) {
if (mV2XTestConsoleWindow == null) {
mV2XTestConsoleWindow = new V2XTestConsoleWindow(context, showType);
}
}
}
return mV2XTestConsoleWindow;
}
public V2XTestConsoleWindow(Context context, int showType) {
super(context);
initView(context, showType);
}
public V2XTestConsoleWindow(Context context) {
this(context, null);
}
public V2XTestConsoleWindow(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public V2XTestConsoleWindow(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initView(context, 0);
}
private void initView(Context context, int showType) {
LayoutInflater.from(context).inflate(R.layout.window_test_console, this);
mFlTestPanel = findViewById(R.id.flTestPanel);
flTestPanelShunNormal = findViewById(R.id.flTestPanelShunNormal);
flTestPanelShunYi = findViewById(R.id.flTestPanelShunYi);
flTestPanelVR = findViewById(R.id.flTestPanelVR);
mBtnTriggerOpen = findViewById(R.id.btnTriggerOpen);
mBtnTriggerWarningEvent = findViewById(R.id.btnTriggerWarningEvent);
mBtnClearRoadEvent = findViewById(R.id.btnClearRoadEvent);
mBtnTriggerRoadEvent = findViewById(R.id.btnTriggerRoadEvent);
mBtnTriggerPushEvent = findViewById(R.id.btnTriggerPushEvent);
mBtnTriggerPushLiveCarEvent = findViewById(R.id.btnTriggerPushLiveCarEvent);
mBtnTriggerAnimationEvent = findViewById(R.id.btnTriggerAnimationEvent);
mBtnbtnFrontCarLiveEvent = findViewById(R.id.btnFrontCarLiveEvent);
mBtnbtnXINGLiveEvent = findViewById(R.id.btnXINGLiveEvent);
mBtnTriggerFatigueDrivingEvent = findViewById(R.id.btnTriggerFatigueDrivingEvent);
mBtnTriggerSeekHelpEvent = findViewById(R.id.btnTriggerSeekHelpEvent);
mBtnTriggerParkEvent = findViewById(R.id.btnTriggerParkEvent);
mBtnTriggerEventUgc = findViewById(R.id.btnTriggerEventUgc);
mBtnTriggerCallUserInfo = findViewById(R.id.btnTriggerCallUserInfo);
mBtnTriggerTrafficSearch = findViewById(R.id.btnTriggerTrafficSearch);
mBtnTriggerRecommendRouteEvent = findViewById(R.id.btnTriggerRecommendRouteEvent);
nBtnTriggerVR = findViewById(R.id.btnTriggerVR);
mBtnAdasDataWarn = findViewById(R.id.btnAdasDataWarn);
switch (showType) {
case 0:
flTestPanelShunNormal.setVisibility(View.VISIBLE);
flTestPanelShunYi.setVisibility(View.VISIBLE);
break;
case 1:
flTestPanelShunNormal.setVisibility(View.VISIBLE);
break;
case 2:
flTestPanelShunYi.setVisibility(View.VISIBLE);
break;
}
nBtnTriggerVR.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
V2XServiceManager.getMoGoStatusManager().setVrMode("nBtnTriggerVR", isChecked);
}
});
btnTriggerRearVIPCarTip = findViewById(R.id.btnTriggerRearVIPCarTip);
btnTriggerVehicleBrakes = findViewById(R.id.btnTriggerVehicleBrakes);
btnTriggerRearDangerousVehicles = findViewById(R.id.btnTriggerRearDangerousVehicles);
btnTriggerReverseVehicleRoutePrediction = findViewById(R.id.btnTriggerReverseVehicleRoutePrediction);
btnTriggerVIPLightChange = findViewById(R.id.btnTriggerVIPLightChange);
btnTriggerObstacleDetour = findViewById(R.id.btnTriggerObstacleDetour);
btnTriggerPedestrianWarning = findViewById(R.id.btnTriggerPedestrianWarning);
btnTriggerCongestedRouteRecommendation = findViewById(R.id.btnTriggerCongestedRouteRecommendation);
btnTriggerDoubleFlash = findViewById(R.id.btnTriggerDoubleFlash);
switch (showType) {
case 0:
flTestPanelShunNormal.setVisibility(View.VISIBLE);
flTestPanelShunYi.setVisibility(View.VISIBLE);
flTestPanelVR.setVisibility(View.VISIBLE);
break;
case 1:
flTestPanelShunNormal.setVisibility(View.VISIBLE);
break;
case 2:
flTestPanelShunYi.setVisibility(View.VISIBLE);
break;
case 3:
flTestPanelVR.setVisibility(View.VISIBLE);
break;
}
mBtnTriggerCallUserInfo.setOnClickListener(v -> {
MogoDriverInfo mogoDriverInfo = new MogoDriverInfo();
mogoDriverInfo.setAge(24);
mogoDriverInfo.setGender(GENDER_MALE);
mogoDriverInfo.setSn("12345678");
mogoDriverInfo.setUserName("测试");
mogoDriverInfo.setUserHead("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1600872867592&di=994e371880ca6ae2814f553e0d0e4139&imgtype=0&src=http%3A%2F%2Fp3.ssl.cdn.btime.com%2Ft014c5d8a1e5cef12ba.jpg%3Fsize%3D506x543");
if (V2XServiceManager.getCarsChattingProvider() != null) {
V2XServiceManager.getCarsChattingProvider().showUserWindow("CAR_CALL_USER_TO_" + V2XConst.MODULE_NAME, mogoDriverInfo, context);
}
});
mBtnTriggerOpen.setOnClickListener(v ->
V2XServiceManager
.getIMogoWindowManager()
.removeView(V2XTestConsoleWindow.getInstance(context, showType))
);
mBtnClearRoadEvent.setOnClickListener(v -> {
V2XAlarmServer.mAlertRoadEventList.clear();
V2XSQLiteUtils.clearScenarioHistoryData();
TipToast.tip("缓存已清除");
});
mBtnTriggerRoadEvent.setOnClickListener(v -> {
V2XMessageEntity<V2XRoadEventEntity> v2XMessageEntity =
TestOnLineCarUtils.getV2XScenarioRoadEventData();
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
// 存储本地,出行动态作展示
saveLocalStory(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING,
v2XMessageEntity.getContent().getNoveltyInfo());
});
//车路云—场景预警-V1.0 碰撞预警
// mBtnTriggerWarningEvent.setOnClickListener(v -> {
// V2XMessageEntity<V2XWarningEntity> v2XMessageEntity =
// TestOnLineCarUtils.getV2XScenarioPushFrontWarningEventData("right");
//
// Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
// intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
// LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
// });
mBtnTriggerPushEvent.setOnClickListener(v -> {
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity =
TestOnLineCarUtils.getV2XScenarioPushEventData();
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
});
mBtnTriggerPushLiveCarEvent.setOnClickListener(v -> {
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity =
TestOnLineCarUtils.getV2XScenarioPushLiveEventData();
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
});
mBtnTriggerAnimationEvent.setOnClickListener(v -> {
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity =
TestOnLineCarUtils.getV2XScenarioAnimationEventData();
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
});
mBtnbtnFrontCarLiveEvent.setOnClickListener(v -> {
V2XVoiceCallLiveBiz.getInstance().getFrontCarLive();
});
mBtnbtnXINGLiveEvent.setOnClickListener(v -> {
V2XVoiceCallLiveBiz.getInstance().getOpenRoadCameraLive();
});
mBtnTriggerFatigueDrivingEvent.setOnClickListener(v -> {
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity =
TestOnLineCarUtils.getV2XScenarioFatigueDrivingData();
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
});
mBtnTriggerSeekHelpEvent.setOnClickListener(v -> {
V2XMessageEntity<List<V2XSpecialCarRes.V2XMarkerEntity>> v2XMessageEntity =
TestOnLineCarUtils.getV2XScenarioSeekHelpData();
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
});
mBtnTriggerEventUgc.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
V2XMessageEntity<V2XRoadEventEntity> v2XMessageEntity =
TestOnLineCarUtils.getV2XScenarioRoadEventUGCData();
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
}
});
mBtnTriggerParkEvent.setOnClickListener(v -> {
Log.d("触发违章停车事件", "00");
V2XMessageEntity<List<MarkerExploreWay>> v2XMessageEntity =
TestOnLineCarUtils.getV2XIllegalParkData();
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
});
mBtnAdasDataWarn.setOnClickListener(v -> {
Intent intent = new Intent(V2XConst.BROADCAST_ADAS_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_ADAS_EXTRA_KEY, "right");
getContext().sendBroadcast(intent);
});
mBtnTriggerTrafficSearch.setOnClickListener(v -> V2XServiceManager.getIMogoTrafficUploadProvider().verifyCurrentTrafficStatus());
mBtnTriggerRecommendRouteEvent.setOnClickListener(view -> {
// V2XServiceManager.getV2XRefreshModel().queryRoadData("ZD802C1938L10797");
V2XServiceManager.getV2XRefreshModel().queryRoadData("ZD802B1932L00622");
});
/*
*后方VIP车辆提示
* */
btnTriggerRearVIPCarTip.setOnClickListener(v -> {
});
/*
*前车急刹
* */
btnTriggerVehicleBrakes.setOnClickListener(v -> {
});
/*
*后方危险车辆预警
* */
btnTriggerRearDangerousVehicles.setOnClickListener(v -> {
});
/*
* 逆向车辆路线预判
* */
btnTriggerReverseVehicleRoutePrediction.setOnClickListener(v -> {
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity =
TestOnLineCarUtils.getV2XScenarionVRReverseCarData();
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
});
/*
*VIP变灯通行
* */
btnTriggerVIPLightChange.setOnClickListener(v -> {
});
/*
*车路云场景预警-左侧
* */
btnTriggerObstacleDetour.setOnClickListener(v -> {
Intent intent = new Intent(V2XConst.BROADCAST_ADAS_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_ADAS_EXTRA_KEY, "left");
getContext().sendBroadcast(intent);
});
/*
*行人预警,行人路线预测 车路云预警-前方行人
* */
btnTriggerPedestrianWarning.setOnClickListener(v -> {
Intent intent = new Intent(V2XConst.BROADCAST_ADAS_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_ADAS_EXTRA_KEY, "pedestrians");
getContext().sendBroadcast(intent);
});
/*
*拥堵路线推荐
* */
btnTriggerCongestedRouteRecommendation.setOnClickListener(v -> {
V2XMessageEntity<V2XOptimalRouteDataRes> v2XMessageEntity =
TestOnLineCarUtils.getV2XOptimalRoute();
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
});
/*
*双闪车辆,自动绕行
* */
btnTriggerDoubleFlash.setOnClickListener(v -> {
});
}
/**
* 存储本地数据
*
* @param v2XRoadEventEntity 要存储的场景
*/
public void saveLocalStory(int scenarioType, MarkerExploreWay v2XRoadEventEntity) {
try {
V2XSQLiteUtils.saveLocalStory(scenarioType, v2XRoadEventEntity, v2XRoadEventEntity.hashCode());
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -1,7 +1,5 @@
package com.mogo.module.v2x.scenario.scene.warning;
import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.util.Log;
import android.view.View;
@@ -9,34 +7,17 @@ import android.view.ViewGroup;
import androidx.annotation.Nullable;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.map.MogoLatLng;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPoiTypeEnum;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.MogoServices;
import com.mogo.module.service.receiver.MogoReceiver;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.entity.net.V2XSpecialCarRes;
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario;
import com.mogo.module.v2x.utils.ADASUtils;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.impl.MogoServiceApis;
import com.mogo.service.impl.v2x.V2XManager;
import com.mogo.service.v2x.IV2XListener;
import com.mogo.service.v2x.IV2XProvider;
import com.mogo.service.windowview.IMogoTopViewStatusListener;
import java.util.List;
/**
* @author liujing
* @description 车路云—场景预警-V1.0 前车/行人/摩托车/盲区碰撞预警

View File

@@ -8,30 +8,22 @@ import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.map.MogoLatLng;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.drawer.MarkerDrawer;
import com.mogo.module.common.drawer.V2XWarnDataDrawer;
import com.mogo.module.common.drawer.marker.EmptyMarkerView;
import com.mogo.module.common.drawer.marker.IMarkerView;
import com.mogo.module.common.drawer.marker.MapMarkerAdapter;
import com.mogo.module.common.drawer.marker.SimpleWindow3DAdapter;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.module.common.utils.Trigonometric;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.receiver.MogoReceiver;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.entity.model.DrawLineInfo;
import com.mogo.module.v2x.listener.V2XLocationListener;
import com.mogo.module.v2x.marker.OptimalSpeedMarkerView;
import com.mogo.module.v2x.marker.V2XFrontTargetMarkerView;
import com.mogo.module.v2x.scenario.view.IV2XMarker;
import com.mogo.module.v2x.utils.LocationUtils;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.ViewUtils;
import com.mogo.utils.WorkThreadHandler;
@@ -44,7 +36,6 @@ import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_STOP_
import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_WARN_DATA;
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_TOP;
import static com.mogo.module.v2x.V2XConst.V2X_FRONT_WARNING_MARKER;
import static com.mogo.module.v2x.V2XConst.V2X_OPTIMAL_SPEED_MARKER;
import static com.mogo.module.v2x.V2XServiceManager.getContext;
/**
@@ -93,7 +84,7 @@ public class V2XWarningMarker implements IV2XMarker {
isSelfLineClear = false;
isFirstLocation = false;
V2XServiceManager.getMarkerManager().removeMarkers(WARNING_ARROWS);
if (mCloundWarningInfo.getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP) { //前方 TODO
if (fillPoints.size() > 0) { //存在停止线的情况 TODO
middleLocationInStopLine = getMiddleLocationInStopLine();
//如果是正前方类型,红色绘制区域从停止线向前绘制50米
MogoLatLng warningLocation = Trigonometric.getNewLocation(middleLocationInStopLine, 50, mCloundWarningInfo.getAngle());
@@ -117,14 +108,13 @@ public class V2XWarningMarker implements IV2XMarker {
isSelfLineClear = true;
}, showTime);
} else { //左侧或者右侧
} else { //无停止线
WorkThreadHandler.getInstance().postDelayed(() -> {
//绘制识别物与交汇点连线,并且更新连线数据
drawOtherObjectLine(mCloundWarningInfo);
//二轮车和行人的渲染和移动
V2XServiceManager.getMarkerManager().removeMarkers(TYPE_MARKER_CLOUD_WARN_DATA);
V2XWarnDataDrawer.getInstance().renderWarnData(mCloundWarningInfo);
//车辆静止的时候
drawSelfCarLine(carLocation.lon, carLocation.lat, bearing);

View File

@@ -69,13 +69,14 @@ public class V2XWarningWindow extends V2XBasWindow implements IV2XWindow {
public void show(Object entity) {
if (entity != null) {
mV2XWarningEntity = (V2XWarningEntity) entity;
//行人0/自行车1/摩托车2/小汽车3/公交车4
//1行人/2自行车/4摩托车
switch (mV2XWarningEntity.getType()) {
case 0:
case 1:
case 11:
typeImage.setImageResource(R.drawable.v2x_road_front_p_warning);
break;
case 1:
case 2:
case 4:
typeImage.setImageResource(R.drawable.v2x_road_front_m_warning);
break;
default:

View File

@@ -26,7 +26,7 @@ public class EventTypeUtils {
// 先获取网络配置的poi对应的名称
PoiWrapper wrapper = CloudPoiManager.getInstance().getWrapperByPoiType(poiType);
if (wrapper != null) {
Logger.d("EventTypeUtils", "从配置表中拿到了相关数据: " + wrapper.getTitle());
//Logger.d("EventTypeUtils", "从配置表中拿到了相关数据: " + wrapper.getTitle());
return wrapper.getTitle();
}
// 如果获取不到,那么就用本地默认的

View File

@@ -189,7 +189,7 @@ public class TestOnLineCarUtils {
// 加载数据源
V2XWarningEntity warningEntity = GsonUtil.objectFromJson(baos.toString(), V2XWarningEntity.class);
V2XMessageEntity messageEntity = new V2XMessageEntity();
messageEntity.setType(warningEntity.getDirection());
messageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_WEAKNESS);
messageEntity.setContent(warningEntity);
return messageEntity;
} catch (Exception e) {

View File

@@ -12,6 +12,7 @@ import android.widget.TextView;
import androidx.annotation.Nullable;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.module.v2x.R;
/**
@@ -39,6 +40,12 @@ public class V2XEventPanelHistoryCountView extends LinearLayout {
mLlEventMore = (RelativeLayout) findViewById(R.id.llEventMore);
mBtnShowOrHidePanels = (ImageView) findViewById(R.id.btnShowOrHidePanels);
mTvEventCount = (TextView) findViewById(R.id.tvEventCount);
if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_LENOVO) {
mLlEventMore.setVisibility(VISIBLE);
} else {
mLlEventMore.setVisibility(GONE);
}
}
public void changeMsgCount(int count) {

View File

@@ -95,6 +95,7 @@ public class V2XLiveGSYVideoView extends RoundLayout implements IMogoSkinCompatS
txLivePlayConfig.setConnectRetryCount(30);
mLivePlayer.setConfig(txLivePlayConfig);
mLivePlayer.enableHardwareDecode(true);
mLoading = findViewById(R.id.loading);
@@ -144,10 +145,10 @@ public class V2XLiveGSYVideoView extends RoundLayout implements IMogoSkinCompatS
mLivePlayer.setPlayListener(new ITXLivePlayListener() {
@Override
public void onPlayEvent(int event, Bundle bundle) {
Logger.w(MODULE_NAME,
"直播信息= " + GsonUtil.jsonFromObject(carLiveInfo) +
"\n播放器onPlayEvent==" + event +
"\nbundle===" + bundle);
// Logger.i(MODULE_NAME,
// "直播信息= " + GsonUtil.jsonFromObject(carLiveInfo) +
// "\n播放器onPlayEvent==" + event +
// "\nbundle===" + bundle);
if (event == TXLiveConstants.PLAY_EVT_PLAY_LOADING) {
mLoading.setVisibility(VISIBLE);
mClLoadError.setVisibility(GONE);
@@ -170,7 +171,7 @@ public class V2XLiveGSYVideoView extends RoundLayout implements IMogoSkinCompatS
@Override
public void onNetStatus(Bundle bundle) {
Logger.w(MODULE_NAME, "播放器onNetStatus===bundle===" + bundle);
// Logger.i(MODULE_NAME, "播放器onNetStatus===bundle===" + bundle);
}
});
}
@@ -184,7 +185,7 @@ public class V2XLiveGSYVideoView extends RoundLayout implements IMogoSkinCompatS
public void stopLive(MarkerCarInfo.CarLiveInfo carLiveInfo) {
try {
Logger.w(MODULE_NAME, "心跳:关闭直播...");
//Logger.i(MODULE_NAME, "心跳:关闭直播...");
// 暂停
mLivePlayer.pause();
// true 代表清除最后一帧画面

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@@ -29,7 +29,7 @@
android:paddingRight="@dimen/dp_10"
android:paddingBottom="@dimen/dp_3"
android:text="前车急刹"
android:textColor="@color/white"
android:textColor="@color/v2x_white"
android:textSize="@dimen/dp_24"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toRightOf="@+id/ivObuTypeIcon"

View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="@dimen/module_v2x_brake_tip_width"
android:layout_height="@dimen/module_v2x_brake_tip_height"
android:layout_marginTop="@dimen/dp_20"
android:layout_gravity="center_horizontal"
android:background="@drawable/v2x_front_warning_bg">
<ImageView
android:id="@+id/ivObuTypeIcon"
android:layout_width="@dimen/module_v2x_brake_image_width"
android:layout_height="@dimen/module_v2x_brake_image_width"
android:layout_marginStart="@dimen/module_v2x_brake_image_margin_left"
android:src="@drawable/v2x_icon_ahead_car_brake"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvObuType"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_20"
android:background="@drawable/bg_v2x_event_type_read"
android:gravity="center"
android:paddingLeft="@dimen/dp_10"
android:paddingTop="@dimen/dp_3"
android:paddingRight="@dimen/dp_10"
android:paddingBottom="@dimen/dp_3"
android:text="前车急刹"
android:textColor="@color/v2x_white"
android:textSize="@dimen/dp_24"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/tvObuDesc"
app:layout_constraintLeft_toRightOf="@+id/ivObuTypeIcon"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed" />
<TextView
android:id="@+id/tvObuDesc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/module_v2x_brake_image_margin_right"
android:layout_marginTop="@dimen/dp_10"
android:text="前车急刹"
android:textColor="@color/v2x_white"
android:textSize="@dimen/dp_32"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@+id/tvObuType"
app:layout_constraintTop_toBottomOf="@+id/tvObuType" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,23 +1,16 @@
{
"type": 1,
"type": 2,
"lat": 26.879024,
"lon": 112.568783,
"distance": 2,
"collisionLat": 26.8791769,
"collisionLon": 112.56896496,
"stopLines": [
{
"lat": 26.88008312,
"lon": 112.57147295
},
{
"lat": 26.88008302,
"lon": 112.57147295
}
],
"from": 1,
"angle": 220,
"direction": 10014,
"direction": 3,
"speed": 11.108121,
"targetColor": "#FF4040",
"stopLineDistance": 60,

View File

@@ -1,5 +1,5 @@
{
"type": 0,
"type": 1,
"lat": 26.87912015,
"lon": 112.56885373,
"distance": 2,
@@ -18,7 +18,7 @@
],
"from": 1,
"angle": 240,
"direction": 10013,
"direction": 1,
"speed": 11.108121,
"targetColor": "#FF4040",
"stopLineDistance": 60,

View File

@@ -1,23 +1,15 @@
{
"type": 2,
"type": 4,
"lat": 26.879339,
"lon": 112.568933,
"distance": 2,
"collisionLat": 26.8791769,
"collisionLon": 112.56896496,
"stopLines": [
{
"lat": 26.88241239,
"lon": 112.5631241
},
{
"lat": 26.88241239,
"lon": 112.5631241
}
],
"from": 1,
"angle": 260,
"direction": 10015,
"direction": 4,
"speed": 11.108121,
"targetColor": "#FF4040",
"stopLineDistance": 60,

View File

@@ -1,7 +1,5 @@
package com.mogo.service.v2x;
import android.content.Intent;
import com.alibaba.android.arouter.facade.template.IProvider;
/**
@@ -10,9 +8,11 @@ import com.alibaba.android.arouter.facade.template.IProvider;
* @since: 2021/3/24
*/
public interface IV2XProvider extends IProvider {
public void registerIntentListener(String intent, IV2XListener listener);
public void registerIntentListener(String intent, Object listener);
public void unregisterIntentListener(String intent, IV2XListener listener);
public void unregisterIntentListener(String intent, IV2XWarningListener listener);
public void warningChangedForListenerWithDirection(int direction, String command);
public void changeTipWindowStatusForListener(String command);
}

View File

@@ -5,6 +5,7 @@ package com.mogo.service.v2x;
* @description 描述
* @since: 2021/3/24
*/
public interface IV2XListener {
public interface IV2XWarningListener {
//车路云预警后红色蒙层根据方位进行展示
void warningChangedWithDirection(int direction);
}

View File

@@ -0,0 +1,11 @@
package com.mogo.service.v2x;
/**
* @author liujing
* @description 描述
* @since: 2021/6/4
*/
public interface IV2XWindowManagerListener {
//移除v2x的所有道路事件及预警弹框
void removeTipWindowByListener();
}

View File

@@ -118,13 +118,6 @@ public interface IMogoTopViewManager extends IProvider {
*/
boolean isViewAdded(View view);
/**
* 这个view是否已经被添加进了顶部布局
* @param view 待查询的view
* @return true-已经添加 false-未添加
*/
boolean isViewNoLinkageAdded(View view);
/**
* 在vr模式下隐藏所有topview除了vr模式下的导航信息
*/

View File

@@ -16,7 +16,6 @@ import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.network.SubscribeImpl;
import com.mogo.commons.network.Utils;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.module.adas.AdasDataListener;
import com.mogo.module.adas.AdasProvider;
@@ -50,7 +49,6 @@ import com.zhidao.adasconfig.common.config.EnumCarChatIncognitoMode;
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.IAutopolitDataCallBack;
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotArriveModel;
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotStateModel;
import com.zhidao.autopilotservice.model.AdasAIDLOwnerCarRectModel;
@@ -127,12 +125,12 @@ public class MogoADASController implements IMogoADASController {
*/
private final Handler mAdasRecognizedRecHandler = new Handler(WorkThreadHandler.newInstance("AdasRecognizedRecThread").getLooper()) {
@Override
public void handleMessage( Message msg ) {
super.handleMessage( msg );
if ( msg.obj instanceof List ) {
mAdasDataListener.notifyOwnerCarRect( ( List< AdasAIDLOwnerCarRectModel > ) msg.obj );
} else if(msg.obj == null ){
mAdasDataListener.notifyOwnerCarRect( null );
public void handleMessage(Message msg) {
super.handleMessage(msg);
if (msg.obj instanceof List) {
mAdasDataListener.notifyOwnerCarRect((List<AdasAIDLOwnerCarRectModel>) msg.obj);
} else if (msg.obj == null) {
mAdasDataListener.notifyOwnerCarRect(null);
}
}
};
@@ -187,7 +185,14 @@ public class MogoADASController implements IMogoADASController {
model.setYt(bean.getYt());
model.setDistance_x(bean.getDistance_x());
model.setDistance_y(bean.getDistance_y());
model.setType(bean.getType());
String type;
if (TextUtils.isEmpty(bean.getType())) {
type = "100";
Logger.d(TAG, " === ADAS 返回结果出现 type 为 null情况 ====");
} else {
type = bean.getType();
}
model.setType(type);
model.setLat(bean.getLat());
model.setLon(bean.getLon());
model.setHeading(bean.getHeading());
@@ -204,8 +209,8 @@ public class MogoADASController implements IMogoADASController {
data.add(model);
Log.d("ADAS数据延时", "uuid : " + bean.getUuid() + "systemTime : " + System.currentTimeMillis() + " GPS time" + Long.parseLong(bean.getSystemTime())
+ " timeDelay : " + (System.currentTimeMillis() - Long.parseLong(bean.getSystemTime())));
Log.d("ADAS数据延时", "uuid : " + bean.getUuid() + " type : " + bean.getType() + "systemTime : " + System.currentTimeMillis() + " GPS time" + Long.parseLong(bean.getSystemTime())
+ " timeDelay : " + (System.currentTimeMillis() - Long.parseLong(bean.getSystemTime())));
// Log.d("ADAS原始数据", "uuid : " + bean.getUuid() + " type : " + bean.getType());
Logger.d(TAG, "识别距离x = %s, y = %s", model.getDistance_x(), model.getDistance_y());
@@ -323,15 +328,15 @@ public class MogoADASController implements IMogoADASController {
if (SingletonsHolder.get(IMogoStatusManager.class).isVrMode()) {
return;
}
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
init( AbsMogoApplication.getApp() );
Logger.d(TAG, Log.getStackTraceString(new Throwable()));
init(AbsMogoApplication.getApp());
adasProvider.addAdasStatusListener(new AdasStatusListener() {
@Override
public void onServiceConnected() {
super.onServiceConnected();
Logger.d( TAG, "adas statuslistener connected & send sn");
BasicInfo info=new BasicInfo();
info.setSn(MoGoAiCloudClientConfig.getInstance().getSn()+"xavier");
info.setSn(MoGoAiCloudClientConfig.getInstance().getSn());
AdasManager.getInstance().setBasicInfo(info);
invokeShowADASOperation();
@@ -341,18 +346,18 @@ public class MogoADASController implements IMogoADASController {
@Override
public void onServiceDisconnected() {
Logger.d( TAG, "adas statuslistener disconnected");
Logger.d(TAG, "adas statuslistener disconnected");
super.onServiceDisconnected();
}
});
invokeShowADASOperation();
if ( mAdasDataListener == null ) {
if (mAdasDataListener == null) {
mAdasDataListener = new AdasDataListener() {
@Override
public void sendMsg( String msg ) {
Logger.d( TAG, "adas AdasDataListener sendmsg " + msg);
for ( IMogoAdasDataCallback callback : mAdasDataCallbackList ) {
public void sendMsg(String msg) {
Logger.d(TAG, "adas AdasDataListener sendmsg " + msg);
for (IMogoAdasDataCallback callback : mAdasDataCallbackList) {
try {
callback.onAdasDataCallback(msg);
} catch (Exception e) {
@@ -362,8 +367,8 @@ public class MogoADASController implements IMogoADASController {
}
@Override
public void cameraEyeDetectResult( String detectResult ) {
Logger.d( TAG, "detectResult " + detectResult);
public void cameraEyeDetectResult(String detectResult) {
Logger.d(TAG, "detectResult " + detectResult);
try {
JSONObject jsonObjectWs = new JSONObject(detectResult);
String action = jsonObjectWs.optString("action");
@@ -389,9 +394,9 @@ public class MogoADASController implements IMogoADASController {
@Override
public void requestGetCarModelListInfo() {
Logger.d( TAG, "requestGetCarModelListInfo ");
if ( DebugConfig.isMapBased() ) {
Logger.d( TAG, "requestGetCarModelListInfo" );
Logger.d(TAG, "requestGetCarModelListInfo ");
if (DebugConfig.isMapBased()) {
Logger.d(TAG, "requestGetCarModelListInfo");
// 向adas发送车模list
String carModelList = SharedPrefsMgr.getInstance(context).getString("CAR_MODEL_LIST", "");
if (carModelList != null && !carModelList.isEmpty()) {
@@ -418,9 +423,9 @@ public class MogoADASController implements IMogoADASController {
}
@Override
public void autopilotArrive( AdasAIDLAutopilotArriveModel autopilotArriveModel ) {
Logger.d( TAG, "autopilotArriveModel " + autopilotArriveModel);
if ( autopilotArriveModel == null ) {
public void autopilotArrive(AdasAIDLAutopilotArriveModel autopilotArriveModel) {
Logger.d(TAG, "autopilotArriveModel " + autopilotArriveModel);
if (autopilotArriveModel == null) {
return;
}
if (mAdasOCHCallback != null) {
@@ -433,16 +438,16 @@ public class MogoADASController implements IMogoADASController {
}
@Override
public void ownerCarStateInfo( String ownerCarStateInfo ) {
Logger.d( TAG, "ownerCarStateInfo " + ownerCarStateInfo);
public void ownerCarStateInfo(String ownerCarStateInfo) {
Logger.d(TAG, "ownerCarStateInfo " + ownerCarStateInfo);
Message message = mAdasLocationRecHandler.obtainMessage();
message.obj = ownerCarStateInfo;
message.sendToTarget();
}
@Override
public void notifyOwnerCarState( AdasAIDLOwnerCarStateModel ownerCarStateModel ) {
Logger.d( TAG, "AdasAIDLOwnerCarStateModel " + ownerCarStateModel);
public void notifyOwnerCarState(AdasAIDLOwnerCarStateModel ownerCarStateModel) {
Logger.d(TAG, "AdasAIDLOwnerCarStateModel " + ownerCarStateModel);
ADASCarStateInfo stateInf = new ADASCarStateInfo();
stateInf.setAction("state");
ADASCarStateInfo.ValuesBean bean = new ADASCarStateInfo.ValuesBean();
@@ -895,7 +900,7 @@ public class MogoADASController implements IMogoADASController {
}
@Override
public void mockAdasRecognized( String json ) {
mAdasDataListener.cameraEyeDetectResult( json );
public void mockAdasRecognized(String json) {
mAdasDataListener.cameraEyeDetectResult(json);
}
}

View File

@@ -73,7 +73,7 @@ public class IntentManager implements IMogoIntentManager {
@Override
public void invoke( String command, Intent intent ) {
List< IMogoIntentListener > listeners = mListeners.get( command );
CopyOnWriteArrayList< IMogoIntentListener > listeners = mListeners.get( command );
if ( listeners != null && !listeners.isEmpty() ) {
Iterator< IMogoIntentListener > iterator = listeners.iterator();
while ( iterator.hasNext() ) {

View File

@@ -49,7 +49,7 @@ class MogoLocationInfoService implements IMogoLocationInfoService {
public void init( Context context ) {
try {
Class< ? > clazz = Class.forName( "com.mogo.base.services.locationinfo.MogoLocationInfoServices" );
Class< ? > clazz = Class.forName( "com.mogo.aicloud.services.locationinfo.MogoLocationInfoServices" );
Method getInstanceMethod = clazz.getMethod( "getInstance" );
getInstanceMethod.setAccessible( true );
mDelegate = ( IMogoLocationInfoService ) getInstanceMethod.invoke( null );

View File

@@ -1,17 +1,14 @@
package com.mogo.service.impl.v2x;
import android.content.Context;
import android.content.Intent;
import android.nfc.Tag;
import android.util.Log;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.intent.IMogoIntentListener;
import com.mogo.service.v2x.IV2XListener;
import com.mogo.service.v2x.IV2XWarningListener;
import com.mogo.service.v2x.IV2XProvider;
import com.mogo.service.v2x.IV2XWindowManagerListener;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -24,10 +21,10 @@ import java.util.concurrent.CopyOnWriteArrayList;
*/
@Route(path = MogoServicePaths.PATH_V2X_FRONT_CRASH_WARNING)
public class V2XManager implements IV2XProvider {
private final Map<String, CopyOnWriteArrayList<IV2XListener>> mListeners = new ConcurrentHashMap<>();
private final Map<String, CopyOnWriteArrayList> mListeners = new ConcurrentHashMap<>();
@Override
public void registerIntentListener(String intent, IV2XListener listener) {
public void registerIntentListener(String intent, Object listener) {
if (listener == null || intent == null) {
Log.d("V2XManager", "listener == null || intent == null");
return;
@@ -40,7 +37,7 @@ public class V2XManager implements IV2XProvider {
}
@Override
public void unregisterIntentListener(String intent, IV2XListener listener) {
public void unregisterIntentListener(String intent, IV2XWarningListener listener) {
if (mListeners.containsKey(intent)) {
mListeners.get(intent).remove(listener);
}
@@ -48,9 +45,9 @@ public class V2XManager implements IV2XProvider {
@Override
public void warningChangedForListenerWithDirection(int direction, String command) {
List<IV2XListener> listeners = mListeners.get(command);
List<IV2XWarningListener> listeners = mListeners.get(command);
if (listeners != null && !listeners.isEmpty()) {
for (IV2XListener listener : listeners) {
for (IV2XWarningListener listener : listeners) {
if (listener != null) {
listener.warningChangedWithDirection(direction);
}
@@ -58,6 +55,18 @@ public class V2XManager implements IV2XProvider {
}
}
@Override
public void changeTipWindowStatusForListener(String command) {
List<IV2XWindowManagerListener> listeners = mListeners.get(command);
if (listeners != null && !listeners.isEmpty()) {
for (IV2XWindowManagerListener listener : listeners) {
if (listener != null) {
listener.removeTipWindowByListener();
}
}
}
}
@Override
public void init(Context context) {

View File

@@ -1,11 +1,14 @@
package com.mogo.test.crashreport.bugly;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.network.Utils;
import com.mogo.test.crashreport.CrashReportConstants;
import com.mogo.test.crashreport.ITestCrashReportProvider;
import com.mogo.utils.logger.Logger;
@@ -28,7 +31,7 @@ class BuglyCrashReportProvider implements ITestCrashReportProvider {
private static final String TAG = "BuglyCrashReportProvider";
@Override
public void init( Context context ) {
public void init(final Context context ) {
Logger.d(TAG, "init");
String packageName = context.getPackageName();
String processName = getProcessName( android.os.Process.myPid() );
@@ -36,6 +39,17 @@ class BuglyCrashReportProvider implements ITestCrashReportProvider {
strategy.setUploadProcess( processName == null || processName.equals( packageName ) );
CrashReport.initCrashReport( context, "f3f8b0b2f1", true, strategy );
CrashReport.putUserData( context, "serial", MoGoAiCloudClientConfig.getInstance().getSn() );
try {
ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(),PackageManager.GET_META_DATA);
Bundle bundle = applicationInfo.metaData;
if (bundle != null){
String sdkVersion = bundle.getString("MAP_SDK_VERSION");
Log.e("lianglihui", "init: "+sdkVersion);
CrashReport.putUserData( context, "MAP_SDK_VERSION",bundle.getString("MAP_SDK_VERSION") );
}
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
}
/**