merge dev2_aiSdk_datalink
This commit is contained in:
1
modules/mogo-module-adas/.gitignore
vendored
Normal file
1
modules/mogo-module-adas/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
65
modules/mogo-module-adas/build.gradle
Normal file
65
modules/mogo-module-adas/build.gradle
Normal file
@@ -0,0 +1,65 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'com.alibaba.arouter'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments = [AROUTER_MODULE_NAME: project.getName()]
|
||||
}
|
||||
}
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
|
||||
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
// 现有的ADAS的通讯SDK,需要将里面的东西融合到我们项目中
|
||||
compileOnly rootProject.ext.dependencies.adasapi
|
||||
|
||||
api "com.zhidao.support.adas:high:1.1.9.2"
|
||||
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
api rootProject.ext.dependencies.mogoutils
|
||||
api rootProject.ext.dependencies.mogocommons
|
||||
api rootProject.ext.dependencies.mogoserviceapapi
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
} else {
|
||||
api project(":foudations:mogo-utils")
|
||||
api project(":foudations:mogo-commons")
|
||||
api project(':services:mogo-service-api')
|
||||
implementation project(':modules:mogo-module-common')
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.alibaba.android.arouter.routes;
|
||||
|
||||
import com.alibaba.android.arouter.facade.enums.RouteType;
|
||||
import com.alibaba.android.arouter.facade.model.RouteMeta;
|
||||
import com.alibaba.android.arouter.facade.template.IRouteGroup;
|
||||
import com.mogo.module.adas.AdasProvider;
|
||||
import java.lang.Override;
|
||||
import java.lang.String;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* DO NOT EDIT THIS FILE!!! IT WAS GENERATED BY AROUTER. */
|
||||
public class ARouter$$Group$$adas implements IRouteGroup {
|
||||
@Override
|
||||
public void loadInto(Map<String, RouteMeta> atlas) {
|
||||
atlas.put("/adas/api", RouteMeta.build(RouteType.PROVIDER, AdasProvider.class, "/adas/api", "adas", null, -1, -2147483648));
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.alibaba.android.arouter.routes;
|
||||
|
||||
import com.alibaba.android.arouter.facade.enums.RouteType;
|
||||
import com.alibaba.android.arouter.facade.model.RouteMeta;
|
||||
import com.alibaba.android.arouter.facade.template.IProviderGroup;
|
||||
import com.mogo.module.adas.AdasProvider;
|
||||
import java.lang.Override;
|
||||
import java.lang.String;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* DO NOT EDIT THIS FILE!!! IT WAS GENERATED BY AROUTER. */
|
||||
public class ARouter$$Providers$$mogomoduleadas implements IProviderGroup {
|
||||
@Override
|
||||
public void loadInto(Map<String, RouteMeta> providers) {
|
||||
providers.put("com.mogo.module.adas.AdasProvider", RouteMeta.build(RouteType.PROVIDER, AdasProvider.class, "/adas/api", "adas", null, -1, -2147483648));
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.alibaba.android.arouter.routes;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IRouteGroup;
|
||||
import com.alibaba.android.arouter.facade.template.IRouteRoot;
|
||||
import java.lang.Class;
|
||||
import java.lang.Override;
|
||||
import java.lang.String;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* DO NOT EDIT THIS FILE!!! IT WAS GENERATED BY AROUTER. */
|
||||
public class ARouter$$Root$$mogomoduleadas implements IRouteRoot {
|
||||
@Override
|
||||
public void loadInto(Map<String, Class<? extends IRouteGroup>> routes) {
|
||||
routes.put("adas", ARouter$$Group$$adas.class);
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
/**
|
||||
* Automatically generated file. DO NOT MODIFY
|
||||
*/
|
||||
package com.mogo.module.adas;
|
||||
|
||||
public final class BuildConfig {
|
||||
public static final boolean DEBUG = Boolean.parseBoolean("true");
|
||||
public static final String LIBRARY_PACKAGE_NAME = "com.mogo.module.adas";
|
||||
/**
|
||||
* @deprecated APPLICATION_ID is misleading in libraries. For the library package name use LIBRARY_PACKAGE_NAME
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String APPLICATION_ID = "com.mogo.module.adas";
|
||||
public static final String BUILD_TYPE = "debug";
|
||||
public static final String FLAVOR = "";
|
||||
public static final int VERSION_CODE = 1;
|
||||
public static final String VERSION_NAME = "";
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.module.adas"
|
||||
android:versionCode="1" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="23"
|
||||
android:targetSdkVersion="23" />
|
||||
|
||||
</manifest>
|
||||
@@ -1 +0,0 @@
|
||||
[{"outputType":{"type":"AAPT_FRIENDLY_MERGED_MANIFESTS"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"","enabled":true,"outputFile":"mogo-module-adas-debug.aar","fullName":"debug","baseName":"debug"},"path":"AndroidManifest.xml","properties":{"packageId":"com.mogo.module.adas","split":""}}]
|
||||
@@ -1 +0,0 @@
|
||||
{"jetified-arouter-compiler-1.2.2.jar (com.alibaba:arouter-compiler:1.2.2)":false,"auto-service-1.0-rc2.jar (com.google.auto.service:auto-service:1.0-rc2)":false}
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,2 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/admin/Android/ADAS/Launcher/foudations/httpdns-base/src/main/jniLibs"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/admin/Android/ADAS/Launcher/foudations/httpdns-base/src/debug/jniLibs"/></dataSet></merger>
|
||||
@@ -1,2 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/admin/Android/ADAS/Launcher/foudations/httpdns-base/src/main/shaders"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/admin/Android/ADAS/Launcher/foudations/httpdns-base/src/debug/shaders"/></dataSet></merger>
|
||||
@@ -1,2 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/admin/Android/ADAS/Launcher/foudations/httpdns-base/src/main/assets"/><source path="/Users/admin/Android/ADAS/Launcher/foudations/httpdns-base/build/intermediates/shader_assets/debug/compileDebugShaders/out"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/admin/Android/ADAS/Launcher/foudations/httpdns-base/src/debug/assets"/></dataSet></merger>
|
||||
@@ -1 +0,0 @@
|
||||
#Thu May 27 17:09:38 CST 2021
|
||||
@@ -1,2 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merger version="3"><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="main$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/admin/Android/ADAS/Launcher/foudations/httpdns-base/src/main/res"/><source path="/Users/admin/Android/ADAS/Launcher/foudations/httpdns-base/build/generated/res/rs/debug"/><source path="/Users/admin/Android/ADAS/Launcher/foudations/httpdns-base/build/generated/res/resValues/debug"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="main" generated-set="main$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/admin/Android/ADAS/Launcher/foudations/httpdns-base/src/main/res"/><source path="/Users/admin/Android/ADAS/Launcher/foudations/httpdns-base/build/generated/res/rs/debug"/><source path="/Users/admin/Android/ADAS/Launcher/foudations/httpdns-base/build/generated/res/resValues/debug"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="debug$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/admin/Android/ADAS/Launcher/foudations/httpdns-base/src/debug/res"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="debug" generated-set="debug$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/admin/Android/ADAS/Launcher/foudations/httpdns-base/src/debug/res"/></dataSet><mergedItems/></merger>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.module.adas"
|
||||
android:versionCode="1" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="23"
|
||||
android:targetSdkVersion="23" />
|
||||
|
||||
</manifest>
|
||||
@@ -1,2 +0,0 @@
|
||||
R_DEF: Internal format may change without notice
|
||||
local
|
||||
@@ -1,12 +0,0 @@
|
||||
1<?xml version="1.0" encoding="utf-8"?>
|
||||
2<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
3 package="com.mogo.module.adas"
|
||||
4 android:versionCode="1" >
|
||||
5
|
||||
6 <uses-sdk
|
||||
7 android:minSdkVersion="23"
|
||||
7-->/Users/admin/Android/ADAS/Launcher/modules/mogo-module-adas/src/main/AndroidManifest.xml
|
||||
8 android:targetSdkVersion="23" />
|
||||
8-->/Users/admin/Android/ADAS/Launcher/modules/mogo-module-adas/src/main/AndroidManifest.xml
|
||||
9
|
||||
10</manifest>
|
||||
@@ -1 +0,0 @@
|
||||
[{"outputType":{"type":"MERGED_MANIFESTS"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"","enabled":true,"outputFile":"mogo-module-adas-debug.aar","fullName":"debug","baseName":"debug"},"path":"../../library_manifest/debug/AndroidManifest.xml","properties":{"packageId":"com.mogo.module.adas","split":""}}]
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -1,31 +0,0 @@
|
||||
-- Merging decision tree log ---
|
||||
manifest
|
||||
ADDED from /Users/admin/Android/ADAS/Launcher/modules/mogo-module-adas/src/main/AndroidManifest.xml:2:1-5:12
|
||||
INJECTED from /Users/admin/Android/ADAS/Launcher/modules/mogo-module-adas/src/main/AndroidManifest.xml:2:1-5:12
|
||||
INJECTED from /Users/admin/Android/ADAS/Launcher/modules/mogo-module-adas/src/main/AndroidManifest.xml:2:1-5:12
|
||||
INJECTED from /Users/admin/Android/ADAS/Launcher/modules/mogo-module-adas/src/main/AndroidManifest.xml:2:1-5:12
|
||||
INJECTED from /Users/admin/Android/ADAS/Launcher/modules/mogo-module-adas/src/main/AndroidManifest.xml:2:1-5:12
|
||||
package
|
||||
ADDED from /Users/admin/Android/ADAS/Launcher/modules/mogo-module-adas/src/main/AndroidManifest.xml:3:5-35
|
||||
INJECTED from /Users/admin/Android/ADAS/Launcher/modules/mogo-module-adas/src/main/AndroidManifest.xml
|
||||
INJECTED from /Users/admin/Android/ADAS/Launcher/modules/mogo-module-adas/src/main/AndroidManifest.xml
|
||||
android:versionCode
|
||||
INJECTED from /Users/admin/Android/ADAS/Launcher/modules/mogo-module-adas/src/main/AndroidManifest.xml
|
||||
ADDED from /Users/admin/Android/ADAS/Launcher/modules/mogo-module-adas/src/main/AndroidManifest.xml:2:1-5:12
|
||||
INJECTED from /Users/admin/Android/ADAS/Launcher/modules/mogo-module-adas/src/main/AndroidManifest.xml
|
||||
xmlns:android
|
||||
ADDED from /Users/admin/Android/ADAS/Launcher/modules/mogo-module-adas/src/main/AndroidManifest.xml:2:11-69
|
||||
uses-sdk
|
||||
INJECTED from /Users/admin/Android/ADAS/Launcher/modules/mogo-module-adas/src/main/AndroidManifest.xml reason: use-sdk injection requested
|
||||
INJECTED from /Users/admin/Android/ADAS/Launcher/modules/mogo-module-adas/src/main/AndroidManifest.xml
|
||||
INJECTED from /Users/admin/Android/ADAS/Launcher/modules/mogo-module-adas/src/main/AndroidManifest.xml
|
||||
INJECTED from /Users/admin/Android/ADAS/Launcher/modules/mogo-module-adas/src/main/AndroidManifest.xml
|
||||
INJECTED from /Users/admin/Android/ADAS/Launcher/modules/mogo-module-adas/src/main/AndroidManifest.xml
|
||||
android:targetSdkVersion
|
||||
INJECTED from /Users/admin/Android/ADAS/Launcher/modules/mogo-module-adas/src/main/AndroidManifest.xml
|
||||
ADDED from /Users/admin/Android/ADAS/Launcher/modules/mogo-module-adas/src/main/AndroidManifest.xml
|
||||
INJECTED from /Users/admin/Android/ADAS/Launcher/modules/mogo-module-adas/src/main/AndroidManifest.xml
|
||||
android:minSdkVersion
|
||||
INJECTED from /Users/admin/Android/ADAS/Launcher/modules/mogo-module-adas/src/main/AndroidManifest.xml
|
||||
ADDED from /Users/admin/Android/ADAS/Launcher/modules/mogo-module-adas/src/main/AndroidManifest.xml
|
||||
INJECTED from /Users/admin/Android/ADAS/Launcher/modules/mogo-module-adas/src/main/AndroidManifest.xml
|
||||
0
modules/mogo-module-adas/consumer-rules.pro
Normal file
0
modules/mogo-module-adas/consumer-rules.pro
Normal file
3
modules/mogo-module-adas/gradle.properties
Normal file
3
modules/mogo-module-adas/gradle.properties
Normal file
@@ -0,0 +1,3 @@
|
||||
GROUP=com.mogo.module
|
||||
POM_ARTIFACT_ID=mogo-module-adas
|
||||
VERSION_CODE=1
|
||||
21
modules/mogo-module-adas/proguard-rules.pro
vendored
Normal file
21
modules/mogo-module-adas/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.amap.navi.mogo_module_adas;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("com.amap.navi.mogo_module_adas.test", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
5
modules/mogo-module-adas/src/main/AndroidManifest.xml
Normal file
5
modules/mogo-module-adas/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.module.adas">
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.mogo.module.adas;
|
||||
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotArriveModel;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotStateModel;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLOwnerCarRectModel;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLOwnerCarStateModel;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotStatus;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotWayArrive;
|
||||
import com.zhidao.support.adas.high.bean.CarLaneInfo;
|
||||
import com.zhidao.support.adas.high.bean.CarStateInfo;
|
||||
import com.zhidao.support.adas.high.bean.LightStatueInfo;
|
||||
import com.zhidao.support.adas.high.bean.ObstaclesInfo;
|
||||
import com.zhidao.support.adas.high.bean.RectInfo;
|
||||
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by XuYong on 2021/4/25 16:52
|
||||
*/
|
||||
public abstract class AdasDataListener {
|
||||
|
||||
public void sendMsg( String msg ) {
|
||||
|
||||
}
|
||||
|
||||
public void cameraEyeDetectResult( String detectResult ) {
|
||||
}
|
||||
|
||||
public void selectCarModelUrl( String carStyleUrl ) {
|
||||
}
|
||||
|
||||
public void requestGetCarModelListInfo() {
|
||||
}
|
||||
|
||||
public void clickSettingBack() {
|
||||
}
|
||||
|
||||
public void showToast( String msg ) {
|
||||
|
||||
}
|
||||
|
||||
public void autopilotArrive( AdasAIDLAutopilotArriveModel autopilotArriveModel ) {
|
||||
}
|
||||
|
||||
public void ownerCarStateInfo( String ownerCarStateInfo ) {
|
||||
}
|
||||
|
||||
public void notifyOwnerCarState( AdasAIDLOwnerCarStateModel ownerCarStateModel ) {
|
||||
}
|
||||
|
||||
public void notifyAutopilotState( AdasAIDLAutopilotStateModel autopilotStateModel ) {
|
||||
}
|
||||
|
||||
public void notifyOwnerCarRect( List<AdasAIDLOwnerCarRectModel> ownerCarStateRectList ) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
package com.mogo.module.adas;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotArriveModel;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotStateModel;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.OnAdasMsgConnectStatusListener;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotStatus;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotWayArrive;
|
||||
import com.zhidao.support.adas.high.bean.CarLaneInfo;
|
||||
import com.zhidao.support.adas.high.bean.CarStateInfo;
|
||||
import com.zhidao.support.adas.high.bean.LightStatueInfo;
|
||||
import com.zhidao.support.adas.high.bean.ObstaclesInfo;
|
||||
import com.zhidao.support.adas.high.bean.RectInfo;
|
||||
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
|
||||
import com.zhidao.support.adas.high.common.MsgActionType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by XuYong on 2021/4/25 14:43
|
||||
*/
|
||||
public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusListener {
|
||||
|
||||
private final String TAG = "AdasEventManager";
|
||||
|
||||
private final Gson gson;
|
||||
|
||||
private final ArrayList<AdasDataListener> iAdasEventListeners = new ArrayList<>();
|
||||
private final ArrayList<AdasStatusListener> iAdasStatusListeners = new ArrayList<>();
|
||||
|
||||
public AdasEventManager() {
|
||||
gson = GsonUtil.getGson();
|
||||
}
|
||||
|
||||
public void addEventListener(AdasDataListener listener) {
|
||||
Logger.d(TAG,"添加adas事件监听");
|
||||
if(iAdasEventListeners.contains(listener)){
|
||||
return;
|
||||
}
|
||||
iAdasEventListeners.add(listener);
|
||||
}
|
||||
|
||||
public void removeEventListener(AdasDataListener listener) {
|
||||
Logger.d(TAG,"注销adas事件监听");
|
||||
if (iAdasEventListeners != null) {
|
||||
iAdasEventListeners.remove(listener);
|
||||
}
|
||||
}
|
||||
|
||||
public void addStatusListener(AdasStatusListener listener) {
|
||||
Logger.d(TAG,"添加adas状态事件监听");
|
||||
if(iAdasStatusListeners.contains(listener)){
|
||||
return;
|
||||
}
|
||||
iAdasStatusListeners.add(listener);
|
||||
}
|
||||
|
||||
public void removeStatusListener(AdasStatusListener listener) {
|
||||
Logger.d(TAG,"注销adas状态事件监听");
|
||||
if (iAdasStatusListeners != null) {
|
||||
iAdasStatusListeners.remove(listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWarnMessage(WarnMessageInfo warnMessageInfo) {
|
||||
Logger.d(TAG,"onWarnMessage " + warnMessageInfo);
|
||||
//报警model
|
||||
WarnMessageModel warnMessageModel = null;
|
||||
for (AdasDataListener listener:iAdasEventListeners) {
|
||||
if (listener != null) {
|
||||
if (warnMessageModel == null) {
|
||||
warnMessageModel = new WarnMessageModel();
|
||||
warnMessageModel.setAction(MsgActionType.ACTION_WS_MSG_WARNING_TYPE.getmActionType());
|
||||
}
|
||||
warnMessageModel.setValues(warnMessageInfo);
|
||||
listener.cameraEyeDetectResult(gson.toJson(warnMessageModel));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoSize(int width, int height) {
|
||||
Logger.d(TAG,"onVideoSize");
|
||||
for (AdasDataListener listener:iAdasEventListeners) {
|
||||
if (listener != null) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRectData(RectInfo rectInfo) {
|
||||
Logger.d(TAG,"onRectData " + rectInfo);
|
||||
|
||||
for (AdasDataListener listener:iAdasEventListeners) {
|
||||
if (listener != null) {
|
||||
listener.cameraEyeDetectResult(gson.toJson(rectInfo));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarStateData(CarStateInfo carStateInfo) {
|
||||
Logger.d(TAG,"onCarStateData " + carStateInfo);
|
||||
for (AdasDataListener listener:iAdasEventListeners) {
|
||||
if (listener != null) {
|
||||
listener.ownerCarStateInfo(gson.toJson(carStateInfo));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLightStateData(LightStatueInfo lightStatueInfo) {
|
||||
Logger.d(TAG,"onLightStateData " + lightStatueInfo);
|
||||
for (AdasDataListener listener:iAdasEventListeners) {
|
||||
if (listener != null) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onObstaclesInfo(ObstaclesInfo obstaclesInfo) {
|
||||
Logger.d(TAG,"onObstaclesInfo " + obstaclesInfo);
|
||||
for (AdasDataListener listener:iAdasEventListeners) {
|
||||
if (listener != null) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLaneInfo(CarLaneInfo carLaneInfo) {
|
||||
Logger.d(TAG,"onCarLaneInfo " + carLaneInfo);
|
||||
for (AdasDataListener listener:iAdasEventListeners) {
|
||||
if (listener != null) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void autopilotStatus(AutopilotStatus autopilotStatus) {
|
||||
Logger.d(TAG,"autopilotStatus " + autopilotStatus);
|
||||
AutopilotStatus.ValuesBean autopilotStatusValues = autopilotStatus.getValues();
|
||||
AutopilotStatus.ValuesBean mAutopilotStatus;
|
||||
|
||||
|
||||
if (autopilotStatusValues != null) {
|
||||
AdasAIDLAutopilotStateModel adasAIDLAutopilotStateModel=new AdasAIDLAutopilotStateModel();
|
||||
adasAIDLAutopilotStateModel.setReason(autopilotStatusValues.getReason());
|
||||
mAutopilotStatus = autopilotStatusValues;
|
||||
int state = autopilotStatusValues.getState();
|
||||
float speed = autopilotStatusValues.getSpeed();
|
||||
adasAIDLAutopilotStateModel.setState(state);
|
||||
adasAIDLAutopilotStateModel.setSpeed(speed);
|
||||
|
||||
for (AdasDataListener listener:iAdasEventListeners) {
|
||||
if (listener != null) {
|
||||
listener.notifyAutopilotState(adasAIDLAutopilotStateModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void autopilotArrive(AutopilotWayArrive autopilotWayArrive) {
|
||||
Logger.d(TAG,"autopilotArrive " + autopilotWayArrive);
|
||||
if (autopilotWayArrive != null) {
|
||||
AutopilotWayArrive.ResultBean result = autopilotWayArrive.getResult();
|
||||
if (result != null) {
|
||||
AutopilotWayArrive.ResultBean.EndLatLonBean endLatLon = result.getEndLatLon();
|
||||
if (endLatLon != null) {
|
||||
AdasAIDLAutopilotArriveModel adasAIDLAutopilotArriveModel = new AdasAIDLAutopilotArriveModel();
|
||||
adasAIDLAutopilotArriveModel.setCarType(result.getCarType());
|
||||
adasAIDLAutopilotArriveModel.setLat(endLatLon.getLat());
|
||||
adasAIDLAutopilotArriveModel.setLon(endLatLon.getLon());
|
||||
for (AdasDataListener listener:iAdasEventListeners) {
|
||||
if (listener != null) {
|
||||
listener.autopilotArrive(adasAIDLAutopilotArriveModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRoute(String route) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWebSocketConnectSuccess() {
|
||||
Logger.d(TAG,"webSocket 连接成功");
|
||||
for (AdasStatusListener listener :iAdasStatusListeners) {
|
||||
listener.onServiceConnected();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWebSocketConnectFailed() {
|
||||
Logger.d(TAG,"webSocket 连接失败");
|
||||
for (AdasStatusListener listener :iAdasStatusListeners) {
|
||||
listener.onServiceDisconnected();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.mogo.module.adas;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
|
||||
|
||||
/**
|
||||
* ADAS 模块
|
||||
*
|
||||
* @author
|
||||
* @date 4/21/21 3:39 PM
|
||||
* wiki:http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=52840459
|
||||
*/
|
||||
@Route(path = MogoServicePaths.PATH_ADAS)
|
||||
public class AdasProvider implements IProvider {
|
||||
private static final String TAG = "AdasProvider";
|
||||
private AdasEventManager adasEventManager;
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
Logger.d(TAG, "初始化 AdasProvider 模块");
|
||||
|
||||
adasEventManager = new AdasEventManager();
|
||||
initAdas(context, adasEventManager);
|
||||
}
|
||||
|
||||
private void initAdas(Context context, AdasEventManager adasEventManager) {
|
||||
AdasManager.getInstance().create(context);
|
||||
AdasManager.getInstance().setOnAdasListener(adasEventManager);
|
||||
AdasManager.getInstance().setOnAdasConnectStatusListener(adasEventManager);
|
||||
}
|
||||
|
||||
public void addAdasEventListener(AdasDataListener listener) {
|
||||
adasEventManager.addEventListener(listener);
|
||||
}
|
||||
|
||||
public void removeAdasEventListener(AdasDataListener listener) {
|
||||
adasEventManager.removeEventListener(listener);
|
||||
}
|
||||
|
||||
public void addAdasStatusListener(AdasStatusListener listener) {
|
||||
adasEventManager.addStatusListener(listener);
|
||||
}
|
||||
|
||||
public void removeAdasStatusListener(AdasStatusListener listener) {
|
||||
adasEventManager.removeStatusListener(listener);
|
||||
}
|
||||
|
||||
public void sendWsMessage(String msg) {
|
||||
AdasManager.getInstance().aiCloudToAdasData(msg);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.mogo.module.adas;
|
||||
|
||||
/**
|
||||
* Created by XuYong on 4/28/21 16:19
|
||||
*/
|
||||
public abstract class AdasStatusListener {
|
||||
|
||||
public void onServiceConnected() {
|
||||
|
||||
};
|
||||
public void onServiceDisconnected() {
|
||||
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.mogo.module.adas;
|
||||
|
||||
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
|
||||
|
||||
/**
|
||||
* @author nie yunlong
|
||||
* @des
|
||||
* @date 2020/10/22
|
||||
*/
|
||||
public class WarnMessageModel {
|
||||
|
||||
private String action;
|
||||
|
||||
private WarnMessageInfo values;
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public WarnMessageInfo getValues() {
|
||||
return values;
|
||||
}
|
||||
|
||||
public void setValues(WarnMessageInfo values) {
|
||||
this.values = values;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.mogo.module.adas;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @date 4/21/21 2:52 PM
|
||||
*/
|
||||
public class 占位文件可删除 {
|
||||
/** TODO 本模块提供能力范围
|
||||
* 1、与工控机数据交互,具体能力与 @宋克难 沟通
|
||||
* a、建立车机与工控机的数据通路
|
||||
* b、保证数据通路的稳定性
|
||||
*
|
||||
* 2、暴露API接口共上层业务使用
|
||||
* a、上层业务可主动订阅、取消订阅数据
|
||||
* b、自动驾驶控制下发
|
||||
* b、自动驾驶状态获取
|
||||
* c、自动驾驶规划路径下发
|
||||
* e、ADAS识别报警
|
||||
*
|
||||
* 3、项目中已经使用到的ADAS数据的业务如下,可参考下面业务层使用情况来封装本模块的API
|
||||
* AdasControlCommandParameter
|
||||
* AdasLogWriter
|
||||
* AdasObjectUtils
|
||||
* CarModelInfoNetApiServices
|
||||
* LogWriter
|
||||
* MogoADASController
|
||||
* OnAdasListenerAdapter
|
||||
*/
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.amap.navi.mogo_module_adas;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.module.authorize.authprovider.launcher
|
||||
|
||||
import com.google.gson.Gson
|
||||
import com.mogo.commons.network.Utils.getSn
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.module.authorize.model.BaseResponse
|
||||
import com.mogo.module.authorize.model.IMogoAuthorizeModel
|
||||
import com.mogo.module.authorize.model.bean.UpdateAuthorize
|
||||
@@ -10,7 +10,7 @@ class MogoAuthorizeMainModel : IMogoAuthorizeModel() {
|
||||
|
||||
suspend fun updateAuthorize(agrId: Long, agreementStatus: Int): BaseResponse<Any> {
|
||||
val updateAuthorize = Gson().toJson(UpdateAuthorize(agrId, agreementStatus))
|
||||
val map = mapOf("sn" to getSn(), "data" to updateAuthorize)
|
||||
val map = mapOf("sn" to MoGoAiCloudClientConfig.getInstance().sn, "data" to updateAuthorize)
|
||||
return apiCall { getNetWorkApi().updateAuthorize(map) }
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.module.authorize.model
|
||||
|
||||
import com.google.gson.Gson
|
||||
import com.mogo.commons.network.Utils.getSn
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.module.authorize.model.bean.AgreementData
|
||||
import com.mogo.module.authorize.model.bean.AgreementStatus
|
||||
import com.mogo.module.authorize.model.bean.RequestUserAgreement
|
||||
@@ -14,13 +14,13 @@ open class IMogoAuthorizeModel : BaseRepository() {
|
||||
|
||||
suspend fun invokeAuthorizeContent(agreementType: Int, needContent: Boolean = false): BaseResponse<AgreementData> {
|
||||
val requestUserAgreement = Gson().toJson(RequestUserAgreement(agreementType, needContent))
|
||||
val map = mapOf("sn" to getSn(), "data" to requestUserAgreement)
|
||||
val map = mapOf("sn" to MoGoAiCloudClientConfig.getInstance().sn, "data" to requestUserAgreement)
|
||||
return apiCall { getNetWorkApi().getAuthorizeContent(map) }
|
||||
}
|
||||
|
||||
suspend fun invokeIfNeedAuthorize(agreementType: Int): BaseResponse<AgreementStatus> {
|
||||
val requestUserAgreement = Gson().toJson(RequestUserAgreement(agreementType))
|
||||
val map = mapOf("sn" to getSn(), "data" to requestUserAgreement)
|
||||
val map = mapOf("sn" to MoGoAiCloudClientConfig.getInstance().sn, "data" to requestUserAgreement)
|
||||
return apiCall { getNetWorkApi().checkIfNeedAuthorize(map) }
|
||||
}
|
||||
}
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -1,25 +1,27 @@
|
||||
package com.mogo.module.common.drawer;
|
||||
|
||||
import android.os.Message;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.DataTypes;
|
||||
import com.mogo.module.common.utils.SimpleHandlerThreadPool;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.module.common.utils.Trigonometric;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedResult;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
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,16 +35,21 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
|
||||
private static volatile AdasRecognizedResultDrawer sInstance;
|
||||
|
||||
/**
|
||||
* 上一帧数据的缓存
|
||||
*/
|
||||
protected static Map<String, IMogoMarker> mMarkersCaches = new ConcurrentHashMap<>();
|
||||
|
||||
public AdasRecognizedResultDrawer() {
|
||||
super();
|
||||
}
|
||||
|
||||
private final Map< String, ADASRecognizedResult > mLastPositions = new ConcurrentHashMap<>();
|
||||
private final Map<String, ADASRecognizedResult> mLastPositions = new ConcurrentHashMap<>();
|
||||
|
||||
public static AdasRecognizedResultDrawer getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( AdasRecognizedResultDrawer.class ) {
|
||||
if ( sInstance == null ) {
|
||||
if (sInstance == null) {
|
||||
synchronized (AdasRecognizedResultDrawer.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new AdasRecognizedResultDrawer();
|
||||
}
|
||||
}
|
||||
@@ -59,8 +66,8 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public boolean hasCached( String uniqueKey ) {
|
||||
return mMarkersCaches.containsKey( uniqueKey );
|
||||
public boolean hasCached(String uniqueKey) {
|
||||
return mMarkersCaches.containsKey(uniqueKey);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,203 +75,274 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
*
|
||||
* @param resultList
|
||||
*/
|
||||
public void renderAdasRecognizedResult( List< ADASRecognizedResult > resultList ) {
|
||||
if ( resultList == null || resultList.isEmpty() || !DebugConfig.isUseAdasRecognize() ) {
|
||||
public void renderAdasRecognizedResult(List<ADASRecognizedResult> resultList) {
|
||||
if (resultList == null || resultList.isEmpty() || !DebugConfig.isUseAdasRecognize()) {
|
||||
clearOldMarker();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
if (!MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
clearOldMarker();
|
||||
return;
|
||||
}
|
||||
|
||||
Map< String, IMogoMarker > newAdasRecognizedMarkersCaches = new HashMap<>();
|
||||
List< ADASRecognizedResult > newDiffSet = new ArrayList<>();
|
||||
for ( ADASRecognizedResult recognizedListResult : resultList ) {
|
||||
List<ADASRecognizedResult> allDatumsList = new ArrayList<>();
|
||||
// prepareData(resultList, allDatumsList);
|
||||
|
||||
if ( isUselessValue( recognizedListResult ) ) {
|
||||
Map<String, IMogoMarker> newAdasRecognizedMarkersCaches = new ConcurrentHashMap<>();
|
||||
List<ADASRecognizedResult> newDiffSet = new ArrayList<>();
|
||||
for (ADASRecognizedResult recognizedListResult : resultList) {
|
||||
|
||||
if (isUselessValue(recognizedListResult)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 复用之前存在的 marker
|
||||
String uniqueKey = recognizedListResult.uuid;
|
||||
IMogoMarker marker = mMarkersCaches.remove( uniqueKey );
|
||||
if ( marker != null && !marker.isDestroyed() ) {
|
||||
renderAdasOneFrame( marker, uniqueKey, recognizedListResult, newAdasRecognizedMarkersCaches );
|
||||
IMogoMarker marker = mMarkersCaches.remove(uniqueKey);
|
||||
if (marker != null && !marker.isDestroyed()) {
|
||||
updateCacheMarkerRes(marker, recognizedListResult);
|
||||
renderAdasOneFrame(marker, uniqueKey, recognizedListResult, newAdasRecognizedMarkersCaches);
|
||||
} else {
|
||||
// 新增差集
|
||||
newDiffSet.add( recognizedListResult );
|
||||
// 新增添加进差集
|
||||
newDiffSet.add(recognizedListResult);
|
||||
}
|
||||
}
|
||||
|
||||
removeUselessMarker();
|
||||
removeUselessMarker(mMarkersCaches);
|
||||
removeUselessLastRecord();
|
||||
|
||||
// 能复用的 marker 数量
|
||||
int cachedMarkerSize = mMarkersCaches.size();
|
||||
// 需要新增的 marker 数量
|
||||
int newDiffSetSize = newDiffSet.size();
|
||||
// 能复用的数量
|
||||
int size = cachedMarkerSize >= newDiffSetSize ? newDiffSetSize : cachedMarkerSize;
|
||||
int size = Math.min(cachedMarkerSize, newDiffSetSize);
|
||||
|
||||
// 复用过期 marker
|
||||
if ( newDiffSetSize > 0 ) {
|
||||
Iterator< Map.Entry< String, IMogoMarker > > entryIterator = mMarkersCaches.entrySet().iterator();
|
||||
for ( int i = 0; i < size; i++ ) {
|
||||
ADASRecognizedResult recognizedListResult = newDiffSet.get( i );
|
||||
if (newDiffSetSize > 0) {
|
||||
Iterator<Map.Entry<String, IMogoMarker>> entryIterator = mMarkersCaches.entrySet().iterator();
|
||||
for (int i = 0; i < size; i++) {
|
||||
ADASRecognizedResult recognizedListResult = newDiffSet.get(i);
|
||||
String uniqueKey = recognizedListResult.uuid;
|
||||
Map.Entry< String, IMogoMarker > entry = entryIterator.next();
|
||||
Map.Entry<String, IMogoMarker> entry = entryIterator.next();
|
||||
entryIterator.remove();
|
||||
ADASRecognizedResult old = mLastPositions.remove( entry.getKey() );
|
||||
ADASRecognizedResult old = mLastPositions.remove(entry.getKey());
|
||||
IMogoMarker marker = entry.getValue();
|
||||
if ( marker == null ) {
|
||||
if (marker == null) {
|
||||
Log.d("EmArrow", "存在复用marker为空数据");
|
||||
continue;
|
||||
}
|
||||
|
||||
// 更新资源内容
|
||||
if ( old == null || old.type != recognizedListResult.type ) {
|
||||
String resIdVal = null;
|
||||
int resId = getModelRes( recognizedListResult.type );
|
||||
resIdVal = resId + "";
|
||||
String resName = mMarkerCachesResMd5Values.get( resIdVal );
|
||||
if ( !TextUtils.isEmpty( resName ) ) {
|
||||
if ( !TextUtils.equals( resName, marker.getMarkerResName() ) ) {
|
||||
marker.use3DResource( resName );
|
||||
}
|
||||
} else {
|
||||
resName = marker.use3DResource( resId );
|
||||
mMarkerCachesResMd5Values.put( resIdVal, resName );
|
||||
}
|
||||
// 复用,更新marker 3D资源
|
||||
if (old == null || old.type != recognizedListResult.type) {
|
||||
updateCacheMarkerRes(marker, recognizedListResult);
|
||||
}
|
||||
|
||||
renderAdasOneFrame( marker, uniqueKey, recognizedListResult, newAdasRecognizedMarkersCaches );
|
||||
renderAdasOneFrame(marker, uniqueKey, recognizedListResult, newAdasRecognizedMarkersCaches);
|
||||
}
|
||||
|
||||
// 复用过后还需新增的 marker
|
||||
|
||||
for ( int i = size; i < newDiffSetSize; i++ ) {
|
||||
ADASRecognizedResult recognizedListResult = newDiffSet.get( i );
|
||||
for (int i = size; i < newDiffSetSize; i++) {
|
||||
ADASRecognizedResult recognizedListResult = newDiffSet.get(i);
|
||||
String uniqueKey = recognizedListResult.uuid;
|
||||
IMogoMarker marker = drawAdasRecognizedDataMarker( recognizedListResult );
|
||||
if ( marker == null ) {
|
||||
IMogoMarker marker = drawAdasRecognizedDataMarker(recognizedListResult);
|
||||
if (marker == null) {
|
||||
continue;
|
||||
}
|
||||
renderAdasOneFrame( marker, uniqueKey, recognizedListResult, newAdasRecognizedMarkersCaches );
|
||||
renderAdasOneFrame(marker, uniqueKey, recognizedListResult, newAdasRecognizedMarkersCaches);
|
||||
}
|
||||
}
|
||||
if ( cachedMarkerSize - size > 0 ) {
|
||||
sendMessage( MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches );
|
||||
if (cachedMarkerSize - size > 0) {
|
||||
sendMessage(MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches);
|
||||
}
|
||||
|
||||
sendMessage(MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches);
|
||||
mMarkersCaches = newAdasRecognizedMarkersCaches;
|
||||
}
|
||||
|
||||
private boolean isUselessValue( ADASRecognizedResult recognizedListResult ) {
|
||||
if ( recognizedListResult == null ) {
|
||||
return true;
|
||||
}
|
||||
if ( !isRenderType( recognizedListResult.type ) ) {
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* 对数据补点
|
||||
*
|
||||
* @param in
|
||||
* @param out
|
||||
*/
|
||||
private void prepareData(List<ADASRecognizedResult> in, List<ADASRecognizedResult> out) {
|
||||
// foreCastPoint(in);
|
||||
out.addAll(in);
|
||||
}
|
||||
|
||||
String uniqueKey = recognizedListResult.uuid;
|
||||
if ( TextUtils.isEmpty( uniqueKey ) ) {
|
||||
private final static String FORECAST = "adasForecast";
|
||||
|
||||
/**
|
||||
* 基于工控机识别的数据点速度预测当前位置和距离自车距离
|
||||
*
|
||||
* @param in 数据源
|
||||
*/
|
||||
private void foreCastPoint(List<ADASRecognizedResult> in) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
for (ADASRecognizedResult adasResult : in) {
|
||||
Log.d(FORECAST, "ready to foreCast current uuid : " + adasResult.uuid);
|
||||
long internal = getCurSatelliteTime() - adasResult.satelliteTime;
|
||||
if (internal <= 0) {
|
||||
Log.d(FORECAST, "time internal less than 0 , uuid : " + adasResult.uuid);
|
||||
continue;
|
||||
}
|
||||
long startTime = System.currentTimeMillis();
|
||||
// 预测点
|
||||
Log.d(FORECAST, "time internal : " + internal + " speed : " + adasResult.speed);
|
||||
double foreCastDistance = adasResult.speed * internal / 1000;
|
||||
Log.d(FORECAST, "foreCastDistance : " + foreCastDistance);
|
||||
MogoLatLng mogoLatLng = new MogoLatLng(adasResult.lat, adasResult.lon);
|
||||
MogoLatLng foreCastMogoLatLon = Trigonometric.getNewLocation(mogoLatLng, foreCastDistance, adasResult.heading);
|
||||
|
||||
// 计算与自车距离
|
||||
float distanceFromSelf = CoordinateUtils.calculateLineDistance(getCurCoordinates()[0], getCurCoordinates()[1]
|
||||
, foreCastMogoLatLon.getLon(), foreCastMogoLatLon.getLat());
|
||||
|
||||
long foreCastInternal = System.currentTimeMillis() - startTime;
|
||||
Log.d(FORECAST, "foreCastInternal :" + foreCastInternal); //todo 耗时1~2毫秒 需要测试是否由于补点算法造成
|
||||
|
||||
adasResult.lat = foreCastMogoLatLon.getLat();
|
||||
adasResult.lon = foreCastMogoLatLon.getLon();
|
||||
adasResult.satelliteTime = (getCurSatelliteTime() - foreCastInternal);
|
||||
adasResult.distance = distanceFromSelf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* todo 后面涉及到此类变化的数据均改动
|
||||
*
|
||||
* @param marker
|
||||
* @param recognizedListResult
|
||||
*/
|
||||
private void updateCacheMarkerRes(IMogoMarker marker, ADASRecognizedResult recognizedListResult) {
|
||||
String resIdVal;
|
||||
int resId = getModelRes(recognizedListResult.type);
|
||||
resIdVal = resId + "";
|
||||
String resName = mMarkerCachesResMd5Values.get(resIdVal);
|
||||
if (!TextUtils.isEmpty(resName)) {
|
||||
if (!TextUtils.equals(resName, marker.getMarkerResName())) {
|
||||
marker.use3DResource(resName);
|
||||
}
|
||||
} else {
|
||||
resName = marker.use3DResource(resId);
|
||||
mMarkerCachesResMd5Values.put(resIdVal, resName);
|
||||
}
|
||||
}
|
||||
|
||||
private void removeUselessLastRecord() { // todo 最好重新设计一个数据结构,用于多线程数据过期失效的场景,参见redis数据过期
|
||||
if (mLastPositions.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Iterator<ADASRecognizedResult> iterator = mLastPositions.values().iterator();
|
||||
Log.d("EmArrow", "removeUselessLastRecord size : " + mLastPositions.size());
|
||||
while (iterator.hasNext()) {
|
||||
ADASRecognizedResult result = iterator.next();
|
||||
long internal = result.satelliteTime - getCurSatelliteTime();
|
||||
if (internal > 300) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤无用数据
|
||||
*
|
||||
* @param recognizedListResult {@link ADASRecognizedResult}
|
||||
* @return useless
|
||||
*/
|
||||
private boolean isUselessValue(ADASRecognizedResult recognizedListResult) {
|
||||
if (recognizedListResult == null) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
if (!isRenderType(recognizedListResult.type)) {
|
||||
return true;
|
||||
}
|
||||
String uniqueKey = recognizedListResult.uuid;
|
||||
return TextUtils.isEmpty(uniqueKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制某个物体的一个数据
|
||||
*
|
||||
* @param recognizedListResult
|
||||
* @param newAdasRecognizedMarkersCaches
|
||||
* @param recognizedListResult {@link ADASRecognizedResult}
|
||||
* @param newAdasRecognizedMarkersCaches 缓存集合
|
||||
*/
|
||||
private void renderAdasOneFrame( IMogoMarker marker,
|
||||
String uniqueKey,
|
||||
ADASRecognizedResult recognizedListResult,
|
||||
Map< String, IMogoMarker > newAdasRecognizedMarkersCaches ) {
|
||||
private void renderAdasOneFrame(IMogoMarker marker,
|
||||
String uniqueKey,
|
||||
ADASRecognizedResult recognizedListResult,
|
||||
Map<String, IMogoMarker> newAdasRecognizedMarkersCaches) {
|
||||
|
||||
final long start = System.currentTimeMillis();
|
||||
Log.d("EmArrow", "renderAdasOneFrame uuid : " + uniqueKey + " type : " + recognizedListResult.type);
|
||||
ADASRecognizedResult lastPosition = mLastPositions.remove(uniqueKey);
|
||||
// double lastLon = -1;
|
||||
// double lastLat = -1;
|
||||
// if (lastPosition != null) {
|
||||
// lastLon = lastPosition.lon;
|
||||
// lastLat = lastPosition.lat;
|
||||
// }
|
||||
// double[] matchLonLat = getMatchLonLat(recognizedListResult.uuid, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading, lastLon, lastLat);
|
||||
//
|
||||
// recognizedListResult.lon = matchLonLat[0];
|
||||
// recognizedListResult.lat = matchLonLat[1];
|
||||
|
||||
ADASRecognizedResult lastPosition = mLastPositions.remove( uniqueKey );
|
||||
double lastLon = -1;
|
||||
double lastLat = -1;
|
||||
if ( lastPosition != null ) {
|
||||
lastLon = lastPosition.lon;
|
||||
lastLat = lastPosition.lat;
|
||||
}
|
||||
double[] matchLonLat = getMatchLonLat( recognizedListResult.uuid, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading, lastLon, lastLat );
|
||||
mLastPositions.put(uniqueKey, recognizedListResult);
|
||||
// Log.d( "matchRoad", "cost = %s", System.currentTimeMillis() - start );
|
||||
newAdasRecognizedMarkersCaches.put(uniqueKey, marker);
|
||||
if (lastPosition != null) {
|
||||
long interval = computeAnimDuration(lastPosition.systemTime, recognizedListResult.systemTime, lastPosition.satelliteTime, recognizedListResult.satelliteTime);
|
||||
|
||||
recognizedListResult.lon = matchLonLat[0];
|
||||
recognizedListResult.lat = matchLonLat[1];
|
||||
|
||||
mLastPositions.put( uniqueKey, recognizedListResult );
|
||||
// Logger.d( "matchRoad", "cost = %s", System.currentTimeMillis() - start );
|
||||
|
||||
newAdasRecognizedMarkersCaches.put( uniqueKey, marker );
|
||||
if ( lastPosition != null ) {
|
||||
long interval = computeAnimDuration( lastPosition.systemTime, recognizedListResult.systemTime, lastPosition.satelliteTime, recognizedListResult.satelliteTime );
|
||||
|
||||
final MogoLatLng renderLoc = new MogoLatLng( recognizedListResult.lat, recognizedListResult.lon );
|
||||
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 );
|
||||
} );
|
||||
marker.addDynamicAnchorPosition(renderLoc, (float) recognizedListResult.heading, intervalRef);
|
||||
} else {
|
||||
marker.setRotateAngle( ( ( float ) recognizedListResult.heading ) );
|
||||
marker.setPosition( recognizedListResult.lat, recognizedListResult.lon );
|
||||
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 );
|
||||
if (TextUtils.isEmpty(carColor)) {
|
||||
carColor = getModelRenderColor(recognizedListResult.type, FROM_ADAS, recognizedListResult.speed, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading);
|
||||
}
|
||||
marker.setAnchorColor( carColor );
|
||||
marker.setAnchorColor(carColor);
|
||||
|
||||
if ( shouldShowSpeed( recognizedListResult.type ) ) {
|
||||
Message msg = mRenderThreadHandler.obtainMessage();
|
||||
SpeedData obj = new SpeedData();
|
||||
obj.context = mContext;
|
||||
obj.marker = marker;
|
||||
obj.speed = recognizedListResult.speed;
|
||||
msg.obj = obj;
|
||||
msg.what = MSG_DISPLAY_SPEED;
|
||||
msg.sendToTarget();
|
||||
}
|
||||
// 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 ) {
|
||||
private IMogoMarker drawAdasRecognizedDataMarker(ADASRecognizedResult recognizedListResult) {
|
||||
if (recognizedListResult == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String resIdVal = null;
|
||||
int resId = getModelRes( recognizedListResult.type );
|
||||
resIdVal = resId + "";
|
||||
int resId = getModelRes(recognizedListResult.type);
|
||||
String resIdVal = resId + "";
|
||||
|
||||
String carColor = recognizedListResult.color;
|
||||
if ( TextUtils.isEmpty( carColor ) ) {
|
||||
carColor = getModelRenderColor( recognizedListResult.type, recognizedListResult.speed, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading );
|
||||
if (TextUtils.isEmpty(carColor)) {
|
||||
carColor = getModelRenderColor(recognizedListResult.type, FROM_ADAS, recognizedListResult.speed, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading);
|
||||
}
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.owner( DataTypes.TYPE_MARKER_ADAS )
|
||||
.anchor( 0.5f, 0.5f )
|
||||
.set3DMode( true )
|
||||
.gps( true )
|
||||
.anchorColor( carColor )
|
||||
.controlAngle( true )
|
||||
.resName( mMarkerCachesResMd5Values.get( resIdVal ) )
|
||||
.icon3DRes( resId )
|
||||
.rotate( ( float ) recognizedListResult.heading )
|
||||
.position( new MogoLatLng( recognizedListResult.lat, recognizedListResult.lon ) );
|
||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( mContext ).addMarker( DataTypes.TYPE_MARKER_ADAS, options );
|
||||
cacheMarkerIconResMd5Val( resIdVal, marker );
|
||||
.owner(DataTypes.TYPE_MARKER_ADAS)
|
||||
.anchor(0.5f, 0.5f)
|
||||
.set3DMode(true)
|
||||
.gps(true)
|
||||
.anchorColor(carColor)
|
||||
.controlAngle(true)
|
||||
.resName(mMarkerCachesResMd5Values.get(resIdVal))
|
||||
.icon3DRes(resId)
|
||||
.rotate((float) recognizedListResult.heading)
|
||||
.position(new MogoLatLng(recognizedListResult.lat, recognizedListResult.lon));
|
||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(DataTypes.TYPE_MARKER_ADAS, options);
|
||||
cacheMarkerIconResMd5Val(resIdVal, marker);
|
||||
return marker;
|
||||
}
|
||||
|
||||
@@ -279,12 +357,10 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
* 清除旧的 marker 数据
|
||||
*/
|
||||
public void clearOldMarker() {
|
||||
if ( mMarkersCaches != null ) {
|
||||
if (mMarkersCaches != null) {
|
||||
mMarkersCaches.clear();
|
||||
}
|
||||
if ( mLastPositions != null ) {
|
||||
mLastPositions.clear();
|
||||
}
|
||||
sendMessage( MSG_REMOVE_DIRTY_MARKERS, DataTypes.TYPE_MARKER_ADAS );
|
||||
mLastPositions.clear();
|
||||
sendMessage(MSG_REMOVE_DIRTY_MARKERS, DataTypes.TYPE_MARKER_ADAS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,12 +20,16 @@ import com.mogo.module.common.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
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;
|
||||
|
||||
public
|
||||
@@ -37,35 +41,9 @@ public
|
||||
*/
|
||||
class BaseDrawer {
|
||||
|
||||
/**
|
||||
* 速度显示对象
|
||||
*/
|
||||
public class SpeedData {
|
||||
|
||||
public IMogoMarker marker;
|
||||
public Context context;
|
||||
double speed;
|
||||
|
||||
public void showSpeed() {
|
||||
try {
|
||||
showSelfSpeed(context,
|
||||
marker,
|
||||
speed,
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 移除过期的 marker
|
||||
public static final int MSG_REMOVE_DIRTY_MARKERS = 9990;
|
||||
|
||||
/**
|
||||
* 显示速度
|
||||
*/
|
||||
public static final int MSG_DISPLAY_SPEED = 11;
|
||||
|
||||
/**
|
||||
* 地图刷新频率
|
||||
*/
|
||||
@@ -79,20 +57,26 @@ class BaseDrawer {
|
||||
/**
|
||||
* 地图内部资源md5缓存,便于资源复用
|
||||
*/
|
||||
protected static final Map<String, String> mMarkerCachesResMd5Values = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 上一帧数据的缓存
|
||||
*/
|
||||
protected Map<String, IMogoMarker> mMarkersCaches = new HashMap<>();
|
||||
protected static final ConcurrentHashMap<String, String> mMarkerCachesResMd5Values = new ConcurrentHashMap<>();
|
||||
|
||||
protected final Context mContext;
|
||||
|
||||
protected static Handler mRenderThreadHandler = null;
|
||||
private TextView mSpeedView;
|
||||
|
||||
public BaseDrawer() {
|
||||
mContext = AbsMogoApplication.getApp();
|
||||
initWorkThreadHandler();
|
||||
initView();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
if (mSpeedView == null) {
|
||||
mSpeedView = new TextView(mContext);
|
||||
mSpeedView.setSingleLine(false);
|
||||
mSpeedView.setTextColor(Color.WHITE);
|
||||
mSpeedView.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
|
||||
mSpeedView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||
}
|
||||
}
|
||||
|
||||
private static Handler mWorkThreadHandler;
|
||||
@@ -124,38 +108,12 @@ class BaseDrawer {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if (mRenderThreadHandler == null) {
|
||||
mRenderThreadHandler = new Handler(WorkThreadHandler.newInstance("render-thread-" + new Random().nextLong()).getLooper()) {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
if (msg.what == MSG_DISPLAY_SPEED) {
|
||||
if (msg.obj instanceof SpeedData) {
|
||||
showSpeed((SpeedData) msg.obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示速度
|
||||
*
|
||||
* @param data {@link SpeedData}
|
||||
*/
|
||||
private static void showSpeed(SpeedData data) {
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
data.showSpeed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除无效[为 null 或者 已被销毁]的 marker
|
||||
*/
|
||||
protected void removeUselessMarker() {
|
||||
protected void removeUselessMarker(Map<String, IMogoMarker> mMarkersCaches) {
|
||||
if (mMarkersCaches == null || mMarkersCaches.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@@ -166,6 +124,7 @@ class BaseDrawer {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -195,21 +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
|
||||
&& recognizedType != AdasRecognizedType.classIdUnKnow; //todo unKnow物体不绘制车速
|
||||
return recognizedType != AdasRecognizedType.classIdPerson;
|
||||
// &&recognizedType != AdasRecognizedType.classIdBicycle //todo Bicycle显示
|
||||
// && recognizedType != AdasRecognizedType.classIdMoto //todo moto显示
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -220,10 +178,10 @@ class BaseDrawer {
|
||||
*/
|
||||
public int getModelRes(int type) {
|
||||
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
|
||||
if (recognizedType == AdasRecognizedType.classIdCar
|
||||
|| recognizedType == AdasRecognizedType.classIdTrafficTruck) {
|
||||
if (recognizedType == AdasRecognizedType.classIdCar) {
|
||||
return R.raw.othercar;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdTrafficBus) {
|
||||
} else if (recognizedType == AdasRecognizedType.classIdTrafficBus
|
||||
|| recognizedType == AdasRecognizedType.classIdTrafficTruck) {
|
||||
return R.raw.bus;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdBicycle
|
||||
|| recognizedType == AdasRecognizedType.classIdMoto) {
|
||||
@@ -232,8 +190,8 @@ class BaseDrawer {
|
||||
return R.raw.stopline;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdWarningArrows) {
|
||||
return R.raw.arraw;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdUnKnow) { //todo unKnow物体3D模型
|
||||
return R.raw.othercar;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdUnKnow) {
|
||||
return R.raw.tache;
|
||||
}
|
||||
return R.raw.people;
|
||||
}
|
||||
@@ -246,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) {
|
||||
return Car3DModelColor.Normal.color;
|
||||
}
|
||||
if (recognizedType == AdasRecognizedType.classIdUnKnow){ //todo unKnow颜色绘制
|
||||
return "#FF2894FF";
|
||||
}
|
||||
// 距离策略
|
||||
// 距离策略 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
|
||||
}
|
||||
|
||||
// 他车车速和自车车速对比速度策略
|
||||
@@ -271,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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -286,7 +255,7 @@ class BaseDrawer {
|
||||
*
|
||||
* @return isCurSpeed
|
||||
*/
|
||||
private double getCurSpeed() {
|
||||
protected double getCurSpeed() {
|
||||
double speed = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastSpeed();
|
||||
if (speed <= 0) {
|
||||
speed = SnapshotLocationController.getInstance().getCurSpeed();
|
||||
@@ -297,9 +266,9 @@ class BaseDrawer {
|
||||
/**
|
||||
* 返回当前自车经纬度
|
||||
*
|
||||
* @return
|
||||
* @return 0:lon 1:lat
|
||||
*/
|
||||
private double[] getCurCoordinates() {
|
||||
protected double[] getCurCoordinates() {
|
||||
double[] coordinates = {
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon(),
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(),
|
||||
@@ -311,6 +280,18 @@ class BaseDrawer {
|
||||
return coordinates;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回当前自车SNTP时间
|
||||
*
|
||||
* @return SNTP时间
|
||||
*/
|
||||
protected long getCurSatelliteTime() {
|
||||
String satelliteTime = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getSatelliteTime();
|
||||
if (TextUtils.isEmpty(satelliteTime)) {
|
||||
return System.currentTimeMillis();
|
||||
}
|
||||
return Long.parseLong(satelliteTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 模型颜色
|
||||
@@ -318,27 +299,76 @@ 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private TextView mSpeedView = null;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示车辆速度
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param mogoMarker {@link IMogoMarker}
|
||||
* @param speed 是否显示速度
|
||||
* @param isVrMode 是否是vrMode
|
||||
*/
|
||||
public void showSelfSpeed(Context context, IMogoMarker mogoMarker, double speed, boolean isVrMode) {
|
||||
public void showSelfSpeed(IMogoMarker mogoMarker, double speed, String uuid, int type, boolean isVrMode) {
|
||||
Log.d("EmArrow", "showSelf uuid : " + uuid + " speed : " + speed);
|
||||
if (mogoMarker == null || mogoMarker.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
@@ -347,26 +377,14 @@ class BaseDrawer {
|
||||
return;
|
||||
}
|
||||
int speedIntVal = (int) (speed * 3.6);
|
||||
if (speedIntVal <= 0) {
|
||||
if (speedIntVal <= 0) { //速度为0 隐藏InfoWindow
|
||||
mogoMarker.hideInfoWindow();
|
||||
return;
|
||||
}
|
||||
String speedVal = speedIntVal + "";
|
||||
String infoResName = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getMarkerInfoResName(speedVal);
|
||||
mogoMarker.setInfoWindowOffset(0, 20);
|
||||
if (TextUtils.isEmpty(infoResName)) {
|
||||
if (mSpeedView == null) {
|
||||
mSpeedView = new TextView(context);
|
||||
mSpeedView.setTextColor(Color.WHITE);
|
||||
mSpeedView.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
|
||||
mSpeedView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||
}
|
||||
mSpeedView.setText(speedVal);
|
||||
mogoMarker.updateInfoWindowView(mSpeedView);
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().setMarkerInfoResName(speedVal, mogoMarker.getMarkerInfoResName());
|
||||
} else {
|
||||
mogoMarker.updateInfoWindowView(infoResName);
|
||||
}
|
||||
String text = speedIntVal + "\n" + uuid + "\n" + type;
|
||||
mSpeedView.setText(text);
|
||||
mogoMarker.updateInfoWindowView(mSpeedView);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -395,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()) {
|
||||
@@ -412,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();
|
||||
@@ -432,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;
|
||||
@@ -460,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,
|
||||
@@ -475,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;
|
||||
@@ -506,4 +524,15 @@ class BaseDrawer {
|
||||
|
||||
return new double[]{lon, lat};
|
||||
}
|
||||
|
||||
protected String getDataTypes(int fromType) {
|
||||
switch (fromType) {
|
||||
case FROM_MY_LOCATION:
|
||||
return TYPE_MARKER_CLOUD_DATA;
|
||||
case FROM_ADAS:
|
||||
return TYPE_MARKER_ADAS;
|
||||
default:
|
||||
return TYPE_MARKER_CLOUD_DATA;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
package com.mogo.module.common.drawer;
|
||||
|
||||
import android.os.Message;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
import com.mogo.cloud.socket.entity.SocketDownDataHelper;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
@@ -15,9 +19,8 @@ import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.api.CallChatApi;
|
||||
import com.mogo.module.common.constants.DataTypes;
|
||||
import com.mogo.module.common.utils.SimpleHandlerThreadPool;
|
||||
import com.mogo.realtime.entity.CloudRoadData;
|
||||
import com.mogo.realtime.entity.MogoSnapshotSetData;
|
||||
import com.mogo.module.common.utils.Trigonometric;
|
||||
import com.mogo.service.adas.IMogoADASController;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.ViewUtils;
|
||||
@@ -26,7 +29,6 @@ import com.zhidao.carchattingprovider.ICarsChattingProvider;
|
||||
import com.zhidao.carchattingprovider.MogoDriverInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -50,13 +52,13 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
super();
|
||||
MogoApisHandler.getInstance().getApis()
|
||||
.getStatusManagerApi()
|
||||
.registerStatusChangedListener( TAG, StatusDescriptor.VR_MODE, this );
|
||||
.registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, this);
|
||||
}
|
||||
|
||||
public static SnapshotSetDataDrawer getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( SnapshotSetDataDrawer.class ) {
|
||||
if ( sInstance == null ) {
|
||||
if (sInstance == null) {
|
||||
synchronized (SnapshotSetDataDrawer.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new SnapshotSetDataDrawer();
|
||||
}
|
||||
}
|
||||
@@ -73,24 +75,28 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private final Map< String, CloudRoadData > mLastPositions = new ConcurrentHashMap<>();
|
||||
/**
|
||||
* 上一帧数据的缓存
|
||||
*/
|
||||
protected static Map<String, IMogoMarker> mMarkersCaches = new ConcurrentHashMap<>();
|
||||
|
||||
private final Map<String, SocketDownData.CloudRoadDataProto> mLastPositions = new ConcurrentHashMap<>();
|
||||
|
||||
private boolean mIsVrMode = false;
|
||||
|
||||
/**
|
||||
* 注册StatusDescriptor.VR_MODE类型,VR_MODE状态改变回调
|
||||
*
|
||||
* @param descriptor 状态类型
|
||||
* @param isTrue true - accOn、adas ui show、voice ui show、push ui show、v2x ui show
|
||||
*/
|
||||
@Override
|
||||
public void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) {
|
||||
Logger.d( TAG, "%s - %s", descriptor, isTrue );
|
||||
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
|
||||
Logger.d(TAG, "%s - %s", descriptor, isTrue);
|
||||
mChangeCarModeStatus = true;
|
||||
sendMessage( MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches );
|
||||
mMarkersCaches = new HashMap<>();
|
||||
if ( mLastPositions != null ) {
|
||||
mLastPositions.clear();
|
||||
}
|
||||
sendMessage(MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches);
|
||||
mMarkersCaches = new ConcurrentHashMap<>();
|
||||
mLastPositions.clear();
|
||||
AdasRecognizedResultDrawer.getInstance().notifyVrModeChanged(); //清除ADAS old marker data
|
||||
}
|
||||
|
||||
@@ -102,7 +108,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
return mChangeCarModeStatus;
|
||||
}
|
||||
|
||||
public void setChangeCarModeStatus( boolean mChangeCarModeStatus ) {
|
||||
public void setChangeCarModeStatus(boolean mChangeCarModeStatus) {
|
||||
this.mChangeCarModeStatus = mChangeCarModeStatus;
|
||||
}
|
||||
|
||||
@@ -112,66 +118,65 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
* @param data 自车周边数据
|
||||
* @return 清除结果
|
||||
*/
|
||||
private boolean clear( MogoSnapshotSetData data ) {
|
||||
if ( !MogoApisHandler.getInstance().getApis().getStatusManagerApi().isMainPageLaunched() ) {
|
||||
if ( mMarkersCaches == null ) {
|
||||
private boolean clear(SocketDownData.LauncherSnapshotProto data) {
|
||||
if (!MogoApisHandler.getInstance().getApis().getStatusManagerApi().isMainPageLaunched()) {
|
||||
if (mMarkersCaches == null) {
|
||||
return false;
|
||||
}
|
||||
if ( mMarkersCaches != null ) {
|
||||
mMarkersCaches.clear();
|
||||
}
|
||||
if ( mLastPositions != null ) {
|
||||
mLastPositions.clear();
|
||||
}
|
||||
sendMessage( MSG_REMOVE_DIRTY_MARKERS, DataTypes.TYPE_MARKER_CLOUD_DATA );
|
||||
mMarkersCaches.clear();
|
||||
mLastPositions.clear();
|
||||
sendMessage(MSG_REMOVE_DIRTY_MARKERS, DataTypes.TYPE_MARKER_CLOUD_DATA);
|
||||
return true;
|
||||
}
|
||||
if ( data == null || (
|
||||
( data.getAllList() == null || data.getAllList().isEmpty() ) &&
|
||||
( data.getNearList() == null || data.getNearList().isEmpty() ) ) ) {
|
||||
if ( mMarkersCaches != null ) {
|
||||
if (data == null || (
|
||||
(data.getAllListList() == null || data.getAllListList().isEmpty()) &&
|
||||
(data.getNearListList() == null || data.getNearListList().isEmpty()))) {
|
||||
if (mMarkersCaches != null) {
|
||||
mMarkersCaches.clear();
|
||||
}
|
||||
if ( mLastPositions != null ) {
|
||||
mLastPositions.clear();
|
||||
}
|
||||
sendMessage( MSG_REMOVE_DIRTY_MARKERS, DataTypes.TYPE_MARKER_CLOUD_DATA );
|
||||
mLastPositions.clear();
|
||||
sendMessage(MSG_REMOVE_DIRTY_MARKERS, DataTypes.TYPE_MARKER_CLOUD_DATA);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* mogo 他车、mogo 他车识别的社会车辆、路边单元识别的车辆
|
||||
* 绘制来自云端的 mogo 他车、mogo 他车识别的社会车辆、路边单元识别的车辆
|
||||
*
|
||||
* @param data 自车周边数据
|
||||
*/
|
||||
public void renderSnapshotData( MogoSnapshotSetData data ) {
|
||||
public void renderSnapshotData(SocketDownData.LauncherSnapshotProto data) {
|
||||
|
||||
if ( clear( data ) ) {
|
||||
if (clear(data)) {
|
||||
return;
|
||||
}
|
||||
|
||||
List< CloudRoadData > allDatumsList = new ArrayList<>();
|
||||
prepareData( data.getAllList(), allDatumsList );
|
||||
|
||||
Map< String, IMogoMarker > newMarkersCaches = new HashMap<>( allDatumsList.size() );
|
||||
List< CloudRoadData > newDiffSet = new ArrayList<>();
|
||||
|
||||
for ( CloudRoadData cloudRoadData : allDatumsList ) {
|
||||
if ( isUselessValue( cloudRoadData ) ) {
|
||||
continue;
|
||||
}
|
||||
String uniqueKey = cloudRoadData.getUniqueKey();
|
||||
IMogoMarker marker = mMarkersCaches.remove( uniqueKey );
|
||||
if ( marker != null && !marker.isDestroyed() ) {
|
||||
renderSnapshotOneFrame( marker, uniqueKey, cloudRoadData, newMarkersCaches );
|
||||
} else {
|
||||
newDiffSet.add( cloudRoadData );
|
||||
}
|
||||
if (!MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
return;
|
||||
}
|
||||
|
||||
removeUselessMarker();
|
||||
List<SocketDownData.CloudRoadDataProto> allDatumsList = new ArrayList<>();
|
||||
prepareData(data.getAllListList(), allDatumsList);
|
||||
|
||||
Map<String, IMogoMarker> newMarkersCaches = new ConcurrentHashMap<>(allDatumsList.size());
|
||||
List<SocketDownData.CloudRoadDataProto> newDiffSet = new ArrayList<>();
|
||||
|
||||
for (SocketDownData.CloudRoadDataProto cloudRoadData : allDatumsList) {
|
||||
if (isUselessValue(cloudRoadData)) {
|
||||
continue;
|
||||
}
|
||||
String uniqueKey = cloudRoadData.getUuid();
|
||||
IMogoMarker marker = mMarkersCaches.remove(uniqueKey);
|
||||
if (marker != null && !marker.isDestroyed()) {
|
||||
updateCacheMarkerRes(marker, cloudRoadData);
|
||||
renderSnapshotOneFrame(marker, uniqueKey, cloudRoadData, newMarkersCaches);
|
||||
} else {
|
||||
newDiffSet.add(cloudRoadData);
|
||||
}
|
||||
}
|
||||
removeUselessMarker(mMarkersCaches);
|
||||
removeUselessLastRecord();
|
||||
|
||||
// 能复用的 marker 数量
|
||||
int cachedMarkerSize = mMarkersCaches.size();
|
||||
@@ -181,171 +186,240 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
int size = Math.min(cachedMarkerSize, newDiffSetSize);
|
||||
|
||||
// 复用过期 marker
|
||||
if ( newDiffSetSize > 0 ) {
|
||||
Iterator< Map.Entry< String, IMogoMarker > > entryIterator = mMarkersCaches.entrySet().iterator();
|
||||
for ( int i = 0; i < size; i++ ) {
|
||||
CloudRoadData cloudRoadData = newDiffSet.get( i );
|
||||
String uniqueKey = cloudRoadData.getUniqueKey();
|
||||
Map.Entry< String, IMogoMarker > entry = entryIterator.next();
|
||||
if (newDiffSetSize > 0) {
|
||||
Iterator<Map.Entry<String, IMogoMarker>> entryIterator = mMarkersCaches.entrySet().iterator();
|
||||
for (int i = 0; i < size; i++) {
|
||||
SocketDownData.CloudRoadDataProto cloudRoadData = newDiffSet.get(i);
|
||||
String uniqueKey = cloudRoadData.getUuid();
|
||||
Map.Entry<String, IMogoMarker> entry = entryIterator.next();
|
||||
entryIterator.remove();
|
||||
CloudRoadData old = mLastPositions.remove( entry.getKey() );
|
||||
SocketDownData.CloudRoadDataProto old = mLastPositions.remove(entry.getKey());
|
||||
IMogoMarker marker = entry.getValue();
|
||||
if ( marker == null ) {
|
||||
if (marker == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 更新资源内容
|
||||
if ( old == null || old.getType() != cloudRoadData.getType() ) {
|
||||
String resIdVal;
|
||||
int resId = getModelRes( cloudRoadData.getType() );
|
||||
resIdVal = resId + "";
|
||||
String resName = mMarkerCachesResMd5Values.get( resIdVal );
|
||||
if ( !TextUtils.isEmpty( resName ) ) {
|
||||
if ( !TextUtils.equals( resName, marker.getMarkerResName() ) ) {
|
||||
marker.use3DResource( resName );
|
||||
}
|
||||
} else {
|
||||
resName = marker.use3DResource( resId );
|
||||
mMarkerCachesResMd5Values.put( resIdVal, resName );
|
||||
}
|
||||
if (old == null || old.getType() != cloudRoadData.getType()) {
|
||||
updateCacheMarkerRes(marker, cloudRoadData);
|
||||
}
|
||||
|
||||
renderSnapshotOneFrame( marker, uniqueKey, cloudRoadData, newMarkersCaches );
|
||||
renderSnapshotOneFrame(marker, uniqueKey, cloudRoadData, newMarkersCaches);
|
||||
}
|
||||
|
||||
// 复用过后还需新增的 marker
|
||||
|
||||
for ( int i = size; i < newDiffSetSize; i++ ) {
|
||||
CloudRoadData cloudRoadData = newDiffSet.get( i );
|
||||
String uniqueKey = cloudRoadData.getUniqueKey();
|
||||
IMogoMarker marker = drawSnapshotDataMarker( cloudRoadData );
|
||||
if ( marker == null ) {
|
||||
for (int i = size; i < newDiffSetSize; i++) {
|
||||
SocketDownData.CloudRoadDataProto cloudRoadData = newDiffSet.get(i);
|
||||
String uniqueKey = cloudRoadData.getUuid();
|
||||
IMogoMarker marker = drawSnapshotDataMarker(cloudRoadData);
|
||||
if (marker == null) {
|
||||
continue;
|
||||
}
|
||||
renderSnapshotOneFrame( marker, uniqueKey, cloudRoadData, newMarkersCaches );
|
||||
renderSnapshotOneFrame(marker, uniqueKey, cloudRoadData, newMarkersCaches);
|
||||
}
|
||||
}
|
||||
if ( cachedMarkerSize - size > 0 ) {
|
||||
sendMessage( MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches );
|
||||
if (cachedMarkerSize - size > 0) {
|
||||
sendMessage(MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches);
|
||||
}
|
||||
|
||||
sendMessage( MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches );
|
||||
sendMessage(MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches);
|
||||
mMarkersCaches = newMarkersCaches;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* todo 后面涉及到此类变化的数据均改动
|
||||
*
|
||||
* @param marker {@link IMogoMarker}
|
||||
* @param cloudRoadDataProto {@link SocketDownData.CloudRoadDataProto}
|
||||
*/
|
||||
private void updateCacheMarkerRes(IMogoMarker marker, SocketDownData.CloudRoadDataProto cloudRoadDataProto) {
|
||||
String resIdVal;
|
||||
int resId = getModelRes(cloudRoadDataProto.getType());
|
||||
resIdVal = resId + "";
|
||||
String resName = mMarkerCachesResMd5Values.get(resIdVal);
|
||||
if (!TextUtils.isEmpty(resName)) {
|
||||
if (!TextUtils.equals(resName, marker.getMarkerResName())) {
|
||||
marker.use3DResource(resName);
|
||||
}
|
||||
} else {
|
||||
resName = marker.use3DResource(resId);
|
||||
mMarkerCachesResMd5Values.put(resIdVal, resName);
|
||||
}
|
||||
}
|
||||
|
||||
private void removeUselessLastRecord() { // todo 最好重新设计一个数据结构,用于多线程数据过期失效的场景,参见redis数据过期
|
||||
if (mLastPositions.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
IMogoADASController adasControllerApi = MogoApisHandler.getInstance().getApis().getAdasControllerApi();
|
||||
if (TextUtils.isEmpty(adasControllerApi.getSatelliteTime()) || adasControllerApi.getSatelliteTime().equals("0")) {
|
||||
return;
|
||||
}
|
||||
Iterator<SocketDownData.CloudRoadDataProto> iterator = mLastPositions.values().iterator();
|
||||
Log.d("EmArrow", "removeUselessLastRecord size : " + mLastPositions.size());
|
||||
while (iterator.hasNext()) {
|
||||
SocketDownData.CloudRoadDataProto result = iterator.next();
|
||||
long internal = result.getSatelliteTime() - Long.parseLong(adasControllerApi.getSatelliteTime());
|
||||
if (internal > 300) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断类型、uuid 等
|
||||
*
|
||||
* @param cloudRoadData {@link CloudRoadData}
|
||||
* @param cloudRoadData {@link SocketDownData.CloudRoadDataProto}
|
||||
* @return isUselessValue
|
||||
*/
|
||||
private boolean isUselessValue( CloudRoadData cloudRoadData ) {
|
||||
if ( cloudRoadData == null ) {
|
||||
private boolean isUselessValue(SocketDownData.CloudRoadDataProto cloudRoadData) {
|
||||
if (cloudRoadData == null) {
|
||||
return true;
|
||||
}
|
||||
if ( !isRenderType( cloudRoadData.getType() ) ) {
|
||||
if (!isRenderType(cloudRoadData.getType())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
String uniqueKey = cloudRoadData.getUniqueKey();
|
||||
String uniqueKey = cloudRoadData.getUuid();
|
||||
return TextUtils.isEmpty(uniqueKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制某个物体的一个数据
|
||||
*
|
||||
* @param cloudRoadData {@link CloudRoadData}
|
||||
* @param cloudRoadData {@link SocketDownData.CloudRoadDataProto}
|
||||
* @param newSnapshotCaches 缓存数据
|
||||
*/
|
||||
private void renderSnapshotOneFrame( IMogoMarker marker, String uniqueKey, final CloudRoadData cloudRoadData, Map< String, IMogoMarker > newSnapshotCaches ) {
|
||||
private void renderSnapshotOneFrame(IMogoMarker marker, String uniqueKey, SocketDownData.CloudRoadDataProto cloudRoadData, Map<String, IMogoMarker> newSnapshotCaches) {
|
||||
|
||||
Logger.d(TAG, "renderSnapshotOneFrame");
|
||||
final long start = System.currentTimeMillis();
|
||||
|
||||
CloudRoadData lastPosition = mLastPositions.remove( uniqueKey );
|
||||
SocketDownData.CloudRoadDataProto lastPosition = mLastPositions.remove(uniqueKey);
|
||||
|
||||
double lastLon = -1;
|
||||
double lastLat = -1;
|
||||
if ( lastPosition != null ) {
|
||||
if (lastPosition != null) {
|
||||
lastLon = lastPosition.getWgslon();
|
||||
lastLat = lastPosition.getWgslat();
|
||||
}
|
||||
double[] matchLonLat = getMatchLonLat( cloudRoadData.getUniqueKey(), cloudRoadData.getWgslon(), cloudRoadData.getWgslat(), cloudRoadData.getHeading(), lastLon, lastLat );
|
||||
cloudRoadData.setWgslon( matchLonLat[0] );
|
||||
cloudRoadData.setWgslat( matchLonLat[1] );
|
||||
|
||||
mLastPositions.put( uniqueKey, cloudRoadData );
|
||||
double[] matchLonLat = getMatchLonLat(cloudRoadData.getUuid(), cloudRoadData.getWgslon(), cloudRoadData.getWgslat(), cloudRoadData.getHeading(), lastLon, lastLat);
|
||||
|
||||
newSnapshotCaches.put( uniqueKey, marker );
|
||||
if ( lastPosition != null ) {
|
||||
long interval = computeAnimDuration( lastPosition.getSystemTime(), cloudRoadData.getSystemTime(), lastPosition.getSatelliteTime(), cloudRoadData.getSatelliteTime() );
|
||||
SocketDownData.CloudRoadDataProto.Builder builder = cloudRoadData.toBuilder();
|
||||
builder.setWgslon(matchLonLat[0]);
|
||||
builder.setWgslat(matchLonLat[1]);
|
||||
|
||||
final MogoLatLng point = new MogoLatLng( cloudRoadData.getWgslat(), cloudRoadData.getWgslon() );
|
||||
cloudRoadData = builder.build();
|
||||
|
||||
mLastPositions.put(uniqueKey, cloudRoadData);
|
||||
|
||||
newSnapshotCaches.put(uniqueKey, marker);
|
||||
if (lastPosition != null) {
|
||||
long interval = computeAnimDuration(lastPosition.getSystemTime(), cloudRoadData.getSystemTime(), lastPosition.getSatelliteTime(), cloudRoadData.getSatelliteTime());
|
||||
|
||||
final MogoLatLng point = new MogoLatLng(cloudRoadData.getWgslat(), cloudRoadData.getWgslon());
|
||||
long cost = System.currentTimeMillis() - start;
|
||||
final long intervalRef = interval - cost;
|
||||
|
||||
SimpleHandlerThreadPool.getInstance().postRender( () -> marker.addDynamicAnchorPosition( point, ( float ) cloudRoadData.getHeading(), intervalRef ));
|
||||
marker.addDynamicAnchorPosition(point, (float) cloudRoadData.getHeading(), intervalRef);
|
||||
} else {
|
||||
marker.setRotateAngle( ( ( float ) cloudRoadData.getHeading() ) );
|
||||
marker.setPosition( cloudRoadData.getWgslat(), cloudRoadData.getWgslon() );
|
||||
marker.setRotateAngle(((float) cloudRoadData.getHeading()));
|
||||
marker.setPosition(cloudRoadData.getWgslat(), cloudRoadData.getWgslon());
|
||||
}
|
||||
|
||||
marker.setAnchorColor( getModelRenderColor( cloudRoadData.getType(), cloudRoadData.getSpeed(), cloudRoadData.getWgslon(), cloudRoadData.getWgslat(), cloudRoadData.getHeading() ) );
|
||||
|
||||
if ( shouldShowSpeed( cloudRoadData.getType() ) ) {
|
||||
Message msg = mRenderThreadHandler.obtainMessage();
|
||||
SpeedData obj = new SpeedData();
|
||||
obj.context = mContext;
|
||||
obj.marker = marker;
|
||||
obj.speed = cloudRoadData.getSpeed();
|
||||
msg.obj = obj;
|
||||
msg.what = MSG_DISPLAY_SPEED;
|
||||
msg.sendToTarget();
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤数据
|
||||
* 过滤数据,对数据补点
|
||||
*
|
||||
* @param in 输入集合
|
||||
* @param out 输出集合
|
||||
*/
|
||||
private void prepareData( List< CloudRoadData > in, List< CloudRoadData > out ) {
|
||||
filterData( in );
|
||||
out.addAll( in );
|
||||
private void prepareData(List<SocketDownData.CloudRoadDataProto> in, List<SocketDownData.CloudRoadDataProto> out) {
|
||||
filterData(in);
|
||||
// foreCastPoint(in, out);
|
||||
out.addAll(in);
|
||||
}
|
||||
|
||||
/**
|
||||
* vr 模式下显示合并数据,否则只显示 mogo 车辆上报的数据
|
||||
* 展示融合数据,不包括自车定位数据和adas识别数据
|
||||
*
|
||||
* @param data 道路数据集合
|
||||
*/
|
||||
private void filterData( List< CloudRoadData > data ) {
|
||||
if ( data == null || data.isEmpty() ) {
|
||||
private void filterData(List<SocketDownData.CloudRoadDataProto> data) {
|
||||
if (data == null || data.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
return;
|
||||
}
|
||||
List< CloudRoadData > newList = new ArrayList<>();
|
||||
for ( CloudRoadData cloudRoadData : data ) {
|
||||
if ( cloudRoadData.getFromType() != CloudRoadData.FROM_MY_LOCATION ) {
|
||||
List<SocketDownData.CloudRoadDataProto> newList = new ArrayList<>();
|
||||
for (SocketDownData.CloudRoadDataProto cloudRoadData : data) {
|
||||
if (cloudRoadData.getFromType() != SocketDownDataHelper.FROM_MY_LOCATION) {
|
||||
continue;
|
||||
}
|
||||
newList.add( cloudRoadData );
|
||||
newList.add(cloudRoadData);
|
||||
}
|
||||
data.clear();
|
||||
data.addAll( newList );
|
||||
data.addAll(newList);
|
||||
}
|
||||
|
||||
private final static String FORECAST = "snapshotForecast";
|
||||
|
||||
/**
|
||||
* 基于云平台下发的数据点速度预测当前位置和距离自车距离
|
||||
*
|
||||
* @param 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();
|
||||
Log.d(FORECAST, "ready to foreCast current uuid : " + proto.getUuid());
|
||||
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();
|
||||
// 预测点
|
||||
Log.d(FORECAST, "time internal : " + internal + " speed : " + proto.getSpeed());
|
||||
double foreCastDistance = proto.getSpeed() * internal / 1000;
|
||||
Log.d(FORECAST, "foreCastDistance : " + foreCastDistance);
|
||||
MogoLatLng mogoLatLng = new MogoLatLng(proto.getWgslat(), proto.getWgslon());
|
||||
MogoLatLng foreCastMogoLatLon = Trigonometric.getNewLocation(mogoLatLng, foreCastDistance, proto.getHeading());
|
||||
|
||||
// 计算与自车距离
|
||||
float distanceFromSelf = CoordinateUtils.calculateLineDistance(getCurCoordinates()[0], getCurCoordinates()[1]
|
||||
, foreCastMogoLatLon.getLon(), foreCastMogoLatLon.getLat());
|
||||
|
||||
long foreCastInternal = System.currentTimeMillis() - startTime;
|
||||
Log.d(FORECAST, "foreCastInternal :" + foreCastInternal); //todo 耗时1~2毫秒 需要测试是否由于补点算法造成
|
||||
|
||||
builder.setWgslat(foreCastMogoLatLon.getLat());
|
||||
builder.setWgslon(foreCastMogoLatLon.getLon());
|
||||
builder.setSatelliteTime(getCurSatelliteTime() - foreCastInternal);
|
||||
builder.setDistance(distanceFromSelf);
|
||||
proto = builder.build();
|
||||
out.add(proto);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定点击事件
|
||||
*/
|
||||
public void bindClickListener( IMogoMarker marker ) {
|
||||
if ( marker == null || marker.isDestroyed() ) {
|
||||
public void bindClickListener(IMogoMarker marker) {
|
||||
if (marker == null || marker.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
marker.setOnMarkerClickListener( this );
|
||||
marker.setOnMarkerClickListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -354,45 +428,45 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
* @param data 道路数据
|
||||
* @return {@link IMogoMarker}
|
||||
*/
|
||||
public IMogoMarker drawSnapshotDataMarker( CloudRoadData data ) {
|
||||
if ( data == null ) {
|
||||
public IMogoMarker drawSnapshotDataMarker(SocketDownData.CloudRoadDataProto data) {
|
||||
if (data == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.owner( DataTypes.TYPE_MARKER_CLOUD_DATA )
|
||||
.anchor( 0.5f, 0.5f )
|
||||
.rotate( ( float ) data.getHeading() )
|
||||
.object( data )
|
||||
.gps( true )
|
||||
.controlAngle( true )
|
||||
.position( new MogoLatLng( data.getWgslat(), data.getWgslon() ) );
|
||||
.owner(getDataTypes(data.getFromType()))
|
||||
.anchor(0.5f, 0.5f)
|
||||
.rotate((float) data.getHeading())
|
||||
.object(data)
|
||||
.gps(true)
|
||||
.controlAngle(true)
|
||||
.position(new MogoLatLng(data.getWgslat(), data.getWgslon()));
|
||||
String resIdVal;
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
options.set3DMode( true );
|
||||
options.anchorColor( getModelRenderColor( data.getType(), data.getSpeed(), data.getWgslon(), data.getWgslat(), data.getHeading() ) );
|
||||
int resId = getModelRes( data.getType() );
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
options.set3DMode(true);
|
||||
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 ) );
|
||||
options.icon3DRes( resId );
|
||||
options.resName(mMarkerCachesResMd5Values.get(resIdVal));
|
||||
options.icon3DRes(resId);
|
||||
} else {
|
||||
options.set3DMode( false );
|
||||
View view = inflateView( data );
|
||||
options.icon( view );
|
||||
options.set3DMode(false);
|
||||
View view = inflateView(data);
|
||||
options.icon(view);
|
||||
resIdVal = view.getId() + "";
|
||||
}
|
||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( mContext ).addMarker( DataTypes.TYPE_MARKER_CLOUD_DATA, options );
|
||||
cacheMarkerIconResMd5Val( resIdVal, marker );
|
||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(getDataTypes(data.getFromType()), options);
|
||||
cacheMarkerIconResMd5Val(resIdVal, marker);
|
||||
|
||||
if ( !TextUtils.isEmpty( data.getSn() ) ) {
|
||||
bindClickListener( marker );
|
||||
if (!TextUtils.isEmpty(data.getSn())) {
|
||||
bindClickListener(marker);
|
||||
}
|
||||
|
||||
return marker;
|
||||
}
|
||||
|
||||
public String get3DCacheId( String resIdVal ) {
|
||||
return mMarkerCachesResMd5Values.get( resIdVal );
|
||||
public String get3DCacheId(String resIdVal) {
|
||||
return mMarkerCachesResMd5Values.get(resIdVal);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -401,12 +475,12 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
* @param data 道路数据
|
||||
* @return marker
|
||||
*/
|
||||
public View inflateView( CloudRoadData data ) {
|
||||
View rootView = LayoutInflater.from( AbsMogoApplication.getApp() ).inflate( R.layout.module_commons_layout_car, null );
|
||||
ImageView iv = rootView.findViewById( R.id.module_commons_marker_car_model );
|
||||
int viewIdLike = get2DModel( data );
|
||||
iv.setImageResource( viewIdLike );
|
||||
rootView.setId( viewIdLike );
|
||||
public View inflateView(SocketDownData.CloudRoadDataProto data) {
|
||||
View rootView = LayoutInflater.from(AbsMogoApplication.getApp()).inflate(R.layout.module_commons_layout_car, null);
|
||||
ImageView iv = rootView.findViewById(R.id.module_commons_marker_car_model);
|
||||
int viewIdLike = get2DModel(data);
|
||||
iv.setImageResource(viewIdLike);
|
||||
rootView.setId(viewIdLike);
|
||||
return rootView;
|
||||
}
|
||||
|
||||
@@ -416,71 +490,71 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
* @param data 道路数据
|
||||
* @return 2D贴图id
|
||||
*/
|
||||
private int get2DModel( CloudRoadData data ) {
|
||||
switch ( data.getFromType() ) {
|
||||
case CloudRoadData.FROM_ADAS:
|
||||
case CloudRoadData.FROM_ROAD_UNIT:
|
||||
case CloudRoadData.FROM_MY_LOCATION:
|
||||
private int get2DModel(SocketDownData.CloudRoadDataProto data) {
|
||||
switch (data.getFromType()) {
|
||||
case SocketDownDataHelper.FROM_ADAS:
|
||||
case SocketDownDataHelper.FROM_ROAD_UNIT:
|
||||
case SocketDownDataHelper.FROM_MY_LOCATION:
|
||||
default:
|
||||
return R.drawable.icon_map_marker_car_gray;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMarkerClicked( IMogoMarker marker ) {
|
||||
if ( marker != null && !marker.isDestroyed() ) {
|
||||
if ( marker.getObject() instanceof CloudRoadData ) {
|
||||
showCarCallPanel( ( ( CloudRoadData ) marker.getObject() ) );
|
||||
public boolean onMarkerClicked(IMogoMarker marker) {
|
||||
if (marker != null && !marker.isDestroyed()) {
|
||||
if (marker.getObject() instanceof SocketDownData.CloudRoadDataProto) {
|
||||
showCarCallPanel(((SocketDownData.CloudRoadDataProto) marker.getObject()));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示用户信息米娜版
|
||||
* 展示用户信息面版
|
||||
*
|
||||
* @param data 道路数据
|
||||
*/
|
||||
private void showCarCallPanel( CloudRoadData data ) {
|
||||
private void showCarCallPanel(SocketDownData.CloudRoadDataProto data) {
|
||||
|
||||
MogoDriverInfo driverInfo = new MogoDriverInfo();
|
||||
driverInfo.setLat( data.getLat() );
|
||||
driverInfo.setLon( data.getLon() );
|
||||
driverInfo.setSn( data.getSn() );
|
||||
driverInfo.setLat(data.getLat());
|
||||
driverInfo.setLon(data.getLon());
|
||||
driverInfo.setSn(data.getSn());
|
||||
ICarsChattingProvider carChatting = CallChatApi.getInstance().getApiProvider();
|
||||
|
||||
if ( carChatting != null ) {
|
||||
if (carChatting != null) {
|
||||
try {
|
||||
carChatting.showUserWindow( TAG, driverInfo, mContext );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "showCarCallPanel" );
|
||||
carChatting.showUserWindow(TAG, driverInfo, mContext);
|
||||
} catch (Exception e) {
|
||||
Logger.e(TAG, e, "showCarCallPanel");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void changeIconResourceIfNecessary( CloudRoadData cloudRoadData, IMogoMarker marker ) {
|
||||
if ( isChangeCarModeStatus() ) {
|
||||
setChangeCarModeStatus( false );
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
marker.getMogoMarkerOptions().set3DMode( true );
|
||||
int resId = getModelRes( cloudRoadData.getType() );
|
||||
String resName = get3DCacheId( resId + "" );
|
||||
if ( TextUtils.isEmpty( resName ) ) {
|
||||
marker.use3DResource( resId );
|
||||
cacheMarkerIconResMd5Val( resId + "", marker );
|
||||
public void changeIconResourceIfNecessary(SocketDownData.CloudRoadDataProto cloudRoadData, IMogoMarker marker) {
|
||||
if (isChangeCarModeStatus()) {
|
||||
setChangeCarModeStatus(false);
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
marker.getMogoMarkerOptions().set3DMode(true);
|
||||
int resId = getModelRes(cloudRoadData.getType());
|
||||
String resName = get3DCacheId(resId + "");
|
||||
if (TextUtils.isEmpty(resName)) {
|
||||
marker.use3DResource(resId);
|
||||
cacheMarkerIconResMd5Val(resId + "", marker);
|
||||
} else {
|
||||
marker.use3DResource( resName );
|
||||
marker.use3DResource(resName);
|
||||
}
|
||||
} else {
|
||||
marker.getMogoMarkerOptions().set3DMode( false );
|
||||
View view = inflateView( cloudRoadData );
|
||||
marker.getMogoMarkerOptions().set3DMode(false);
|
||||
View view = inflateView(cloudRoadData);
|
||||
int resId = view.getId();
|
||||
String resName = get3DCacheId( resId + "" );
|
||||
if ( TextUtils.isEmpty( resName ) ) {
|
||||
marker.setIcon( ViewUtils.fromView( view ) );
|
||||
cacheMarkerIconResMd5Val( resId + "", marker );
|
||||
String resName = get3DCacheId(resId + "");
|
||||
if (TextUtils.isEmpty(resName)) {
|
||||
marker.setIcon(ViewUtils.fromView(view));
|
||||
cacheMarkerIconResMd5Val(resId + "", marker);
|
||||
} else {
|
||||
marker.use2DResource( resName );
|
||||
marker.use2DResource(resName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
// 自车求助
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.mogo.module.common.uploadintime;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.realtime.entity.CloudLocationInfo;
|
||||
import com.mogo.service.locationinfo.CloudLocationInfo;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import org.json.JSONObject;
|
||||
@@ -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);
|
||||
|
||||
BIN
modules/mogo-module-common/src/main/res/raw/tache.n3d
Normal file
BIN
modules/mogo-module-common/src/main/res/raw/tache.n3d
Normal file
Binary file not shown.
@@ -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;
|
||||
@@ -919,6 +920,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
}
|
||||
} else if (descriptor == StatusDescriptor.VR_MODE) {
|
||||
try {
|
||||
Log.d("liyz", "vr isTrue = " + isTrue);
|
||||
if (isTrue) {
|
||||
enterVrMode();
|
||||
} else {
|
||||
@@ -1102,8 +1104,36 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
});
|
||||
}
|
||||
|
||||
private boolean mLastStatusIsVr = false;
|
||||
|
||||
@Override
|
||||
public void onMapModeChanged(EnumMapUI ui) {
|
||||
Log.d("liyz", "fragment onMapModeChanged -----> ");
|
||||
// if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_LENOVO ) {
|
||||
// if ( ui == EnumMapUI.Type_VR ) {
|
||||
// Log.d("liyz", "onMapModeChanged mLastStatusIsVr = " + mLastStatusIsVr + "--ui = " +ui);
|
||||
// if ( !mLastStatusIsVr ) {
|
||||
// MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, true );
|
||||
// MapCenterPointStrategy.resetByChangeMode();
|
||||
//// MapMarkerManager.getInstance().redrawMarkerByStyleChanged();
|
||||
// if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_LENOVO ) {
|
||||
// AIAssist.getInstance( getContext() ).speakTTSVoice( "已开启鹰眼模式" );
|
||||
// }
|
||||
// mLastStatusIsVr = true;
|
||||
// }
|
||||
// } else {
|
||||
// if ( mLastStatusIsVr ) {
|
||||
// mLastStatusIsVr = false;
|
||||
// MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, false );
|
||||
// MapCenterPointStrategy.resetByChangeMode();
|
||||
//// MapMarkerManager.getInstance().redrawMarkerByStyleChanged();
|
||||
// if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_LENOVO ) {
|
||||
// AIAssist.getInstance( getContext() ).speakTTSVoice( "已退出鹰眼模式" );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
if (mCameraMode == null) {
|
||||
return;
|
||||
}
|
||||
@@ -1115,6 +1145,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
// } else if( ui == EnumMapUI.NorthUP_2D ){
|
||||
// mMove2CurrentLocation.setImageResource( R.drawable.icon_car_up );
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1331,6 +1362,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
}
|
||||
} else if (v.getId() == R.id.module_ext_enter_vr_mode) {
|
||||
// 进入vr模式
|
||||
Log.d("liyz", "enter --vr--");
|
||||
mMApUIController.changeMapMode(EnumMapUI.Type_VR);
|
||||
} else if (v.getId() == R.id.module_ext_exit_vr_mode) {
|
||||
// 退出vr模式
|
||||
@@ -1373,15 +1405,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);
|
||||
.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);
|
||||
.getMapUIController().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT,null);
|
||||
mSwitchText.setText(R.string.module_map_model_faster);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -7,6 +7,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.network.Utils;
|
||||
@@ -134,7 +135,7 @@ public class EntrancePresenter extends Presenter<EntranceView> implements Weathe
|
||||
|
||||
public void getCommonConfig() {
|
||||
Map<String, Object> params = new ArrayMap<>();
|
||||
params.put("sn", Utils.getSn());
|
||||
params.put("sn", MoGoAiCloudClientConfig.getInstance().getSn());
|
||||
mNetWork.create(GetConfigApiServices.class, HostConst.DATA_SERVICE_HOST)
|
||||
.getConfig(params)
|
||||
.subscribeOn(Schedulers.io())
|
||||
@@ -184,7 +185,7 @@ public class EntrancePresenter extends Presenter<EntranceView> implements Weathe
|
||||
|
||||
public void requestUserInfo() {
|
||||
Map<String, String> params = new ArrayMap<>();
|
||||
params.put("sn", Utils.getSn());
|
||||
params.put("sn", MoGoAiCloudClientConfig.getInstance().getSn());
|
||||
params.put("source", "2");
|
||||
String sign = createSign(params, "JGqZw9");
|
||||
params.put("sig", sign);
|
||||
|
||||
@@ -6,18 +6,18 @@ import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.module.extensions.live.impl.AbsCameraScenario;
|
||||
import com.mogo.realtime.entity.CloudRoadData;
|
||||
import com.mogo.service.windowview.IMogoTopViewStatusListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* 路边摄像头直播控制 V2XPushLiveCarScenario
|
||||
*/
|
||||
public class CameraLiveManager extends AbsCameraScenario<CloudRoadData> implements IMogoTopViewStatusListener {
|
||||
public class CameraLiveManager extends AbsCameraScenario<SocketDownData.CloudRoadDataProto> implements IMogoTopViewStatusListener {
|
||||
private static final String TAG = "CameraLiveManager";
|
||||
private static CameraLiveManager mCameraLiveManager;
|
||||
private boolean isShowWindow;
|
||||
@@ -38,7 +38,7 @@ public class CameraLiveManager extends AbsCameraScenario<CloudRoadData> implemen
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(@Nullable CloudRoadData cloudRoadData) {
|
||||
public void init(@Nullable SocketDownData.CloudRoadDataProto cloudRoadData) {
|
||||
Log.d(TAG, "CameraLiveManager init -----> isShowWindow = " + isShowWindow);
|
||||
if (isShowWindow) {
|
||||
close();
|
||||
|
||||
@@ -9,10 +9,10 @@ import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.module.extensions.live.impl.ICameraWindow;
|
||||
import com.mogo.realtime.entity.CloudRoadData;
|
||||
import com.mogo.service.imageloader.MogoImageView;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -21,7 +21,7 @@ import com.mogo.utils.logger.Logger;
|
||||
* 点击摄像头 marker
|
||||
* vr路边摄像头弹窗 V2XPushLiveCarWindow
|
||||
*/
|
||||
public class PushCameraLiveWindow extends RelativeLayout implements ICameraWindow<CloudRoadData> {
|
||||
public class PushCameraLiveWindow extends RelativeLayout implements ICameraWindow<SocketDownData.CloudRoadDataProto> {
|
||||
private static final String TAG = "PushCameraLiveWindow";
|
||||
private CameraLiveGSYVideoView mLiveGSYVideoView;
|
||||
private MogoImageView mIvReportHead;
|
||||
@@ -65,7 +65,7 @@ public class PushCameraLiveWindow extends RelativeLayout implements ICameraWindo
|
||||
* 展示直播Windows
|
||||
*/
|
||||
@Override
|
||||
public void show(CloudRoadData entity) {
|
||||
public void show(SocketDownData.CloudRoadDataProto entity) {
|
||||
if (entity != null) {
|
||||
Logger.w(TAG, "更新直播信息 show entity = " + entity);
|
||||
if (!TextUtils.isEmpty(entity.getRtmpUrl())) {
|
||||
@@ -76,7 +76,7 @@ public class PushCameraLiveWindow extends RelativeLayout implements ICameraWindo
|
||||
mLiveGSYVideoView.startLive(entity.getRtmpUrl());
|
||||
}
|
||||
|
||||
countDownV2XEvent(entity);
|
||||
countDownV2XEvent();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ public class PushCameraLiveWindow extends RelativeLayout implements ICameraWindo
|
||||
/**
|
||||
* 窗体倒计时
|
||||
*/
|
||||
public void countDownV2XEvent(CloudRoadData data) {
|
||||
public void countDownV2XEvent() {
|
||||
// 倒计时
|
||||
if (runnableV2XEvent == null) {
|
||||
runnableV2XEvent = () -> {
|
||||
|
||||
@@ -2,15 +2,15 @@ package com.mogo.module.extensions.live.impl;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.realtime.entity.CloudRoadData;
|
||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
|
||||
|
||||
public abstract class AbsCameraScenario<T> implements ICameraScenario {
|
||||
protected String TAG = "AbsCameraScenario";
|
||||
private ICameraWindow mV2XWindow;
|
||||
private CloudRoadData mCloudRoadData;
|
||||
private SocketDownData.CloudRoadDataProto mCloudRoadData;
|
||||
|
||||
public abstract void init(@Nullable CloudRoadData cloudRoadData);
|
||||
public abstract void init(@Nullable SocketDownData.CloudRoadDataProto cloudRoadData);
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
@@ -27,11 +27,11 @@ public abstract class AbsCameraScenario<T> implements ICameraScenario {
|
||||
this.mV2XWindow = mV2XWindow;
|
||||
}
|
||||
|
||||
public CloudRoadData getmCloudRoadData() {
|
||||
public SocketDownData.CloudRoadDataProto getmCloudRoadData() {
|
||||
return mCloudRoadData;
|
||||
}
|
||||
|
||||
public void setmCloudRoadData(CloudRoadData mCloudRoadData) {
|
||||
public void setmCloudRoadData(SocketDownData.CloudRoadDataProto mCloudRoadData) {
|
||||
this.mCloudRoadData = mCloudRoadData;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,12 +7,11 @@ import android.content.IntentFilter;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.extensions.navi.VrModeNavInfoView;
|
||||
import com.mogo.realtime.api.MoGoAiCloudRealTime;
|
||||
import com.mogo.realtime.entity.MogoSnapshotSetData;
|
||||
import com.mogo.realtime.socket.IMogoCloudOnMsgListener;
|
||||
import com.mogo.service.adas.IMogoAdasWarnMessageCallback;
|
||||
import com.mogo.service.adas.MogoADASWarnType;
|
||||
@@ -41,7 +40,7 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
|
||||
private static final long STRATEGY_DELAY = 1000L;
|
||||
|
||||
private Context context;
|
||||
private AdasNoticeReceiver adasReceiver = new AdasNoticeReceiver();
|
||||
private final AdasNoticeReceiver adasReceiver = new AdasNoticeReceiver();
|
||||
|
||||
private volatile boolean isVrMode = false;
|
||||
|
||||
@@ -203,7 +202,8 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(MogoSnapshotSetData obj) {
|
||||
public void onMsgReceived(SocketDownData.LauncherSnapshotProto mogoSnapshotSetData) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.graphics.BitmapFactory;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
@@ -16,8 +17,6 @@ import com.mogo.module.extensions.live.CameraLiveManager;
|
||||
import com.mogo.module.extensions.live.CameraWindow3DAdapter;
|
||||
import com.mogo.module.extensions.live.PushDataType;
|
||||
import com.mogo.realtime.api.MoGoAiCloudRealTime;
|
||||
import com.mogo.realtime.entity.CloudRoadData;
|
||||
import com.mogo.realtime.entity.MogoSnapshotSetData;
|
||||
import com.mogo.realtime.socket.IMogoCloudOnMsgListener;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -30,7 +29,7 @@ public class CameraLiveNoticeHelper implements IMogoCloudOnMsgListener {
|
||||
private static final String TAG = "CameraLiveNoticeHelper";
|
||||
private Context mContext;
|
||||
private static IMogoMarker mMogoMarker;
|
||||
private CloudRoadData mCloudRoadData;
|
||||
private SocketDownData.CloudRoadDataProto mCloudRoadData;
|
||||
private volatile boolean isVrMode;
|
||||
private volatile boolean isVrModeMarker;
|
||||
private volatile String mCurrentUuid;
|
||||
@@ -81,7 +80,7 @@ public class CameraLiveNoticeHelper implements IMogoCloudOnMsgListener {
|
||||
*
|
||||
* @param roadData 道路数据
|
||||
*/
|
||||
private void addVrCameraMarker(CloudRoadData roadData) {
|
||||
private void addVrCameraMarker(SocketDownData.CloudRoadDataProto roadData) {
|
||||
Log.e(TAG, "addVrCameraMarker --lat = " + roadData.getLat() + "--lon =" + roadData.getLon() + "--uuid = " + roadData.getUuid() + "---rtmpUrl =" + roadData.getRtmpUrl());
|
||||
if (!TextUtils.isEmpty(roadData.getRtmpUrl())) {
|
||||
removeCameraMarker();
|
||||
@@ -108,7 +107,7 @@ public class CameraLiveNoticeHelper implements IMogoCloudOnMsgListener {
|
||||
*
|
||||
* @param roadData 道路数据
|
||||
*/
|
||||
private void addNormalCameraMarker(CloudRoadData roadData) {
|
||||
private void addNormalCameraMarker(SocketDownData.CloudRoadDataProto roadData) {
|
||||
Log.e(TAG, "addNormalCameraMarker --lat = " + roadData.getLat() + " --lon =" + roadData.getLon() + "--uuid = " + roadData.getUuid() + "---rtmpUrl =" + roadData.getRtmpUrl());
|
||||
if (!TextUtils.isEmpty(roadData.getRtmpUrl())) {
|
||||
removeCameraMarker();
|
||||
@@ -137,7 +136,7 @@ public class CameraLiveNoticeHelper implements IMogoCloudOnMsgListener {
|
||||
}
|
||||
}
|
||||
|
||||
private void renderMarker(MogoSnapshotSetData obj) {
|
||||
private void renderMarker(SocketDownData.LauncherSnapshotProto obj) {
|
||||
if (obj != null) {
|
||||
if (obj.getCamera() != null && !TextUtils.isEmpty(obj.getCamera().getRtmpUrl())) {
|
||||
mCloudRoadData = obj.getCamera();
|
||||
@@ -189,8 +188,8 @@ public class CameraLiveNoticeHelper implements IMogoCloudOnMsgListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(MogoSnapshotSetData mogoSnapshotSetData) {
|
||||
//Logger.d(TAG, "onMsgReceived mogoSnapshotSetData : " + mogoSnapshotSetData);
|
||||
public void onMsgReceived(SocketDownData.LauncherSnapshotProto mogoSnapshotSetData) {
|
||||
renderMarker(mogoSnapshotSetData);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.SystemClock;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.network.Utils;
|
||||
@@ -118,7 +119,7 @@ public class DelayCheckUtil implements Handler.Callback {
|
||||
}
|
||||
Logger.d(TAG, "lastLocation: " + lastLocation);
|
||||
DelayCheckUploadRequest request = new DelayCheckUploadRequest();
|
||||
request.setSn(Utils.getSn());
|
||||
request.setSn(MoGoAiCloudClientConfig.getInstance().getSn());
|
||||
request.setStartTime(requestStartSystemTime);
|
||||
request.setEndTime(requestEndSystem);
|
||||
request.setNetState(NetworkUtils.netStrengthLevel);
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -51,7 +51,6 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
implementation rootProject.ext.dependencies.callchatprovider
|
||||
implementation rootProject.ext.dependencies.androidxrecyclerview
|
||||
annotationProcessor 'com.elegant.spi:compiler:1.0.3'
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
api rootProject.ext.dependencies.mogomap
|
||||
|
||||
@@ -101,7 +101,7 @@ public class MogoServiceProvider implements IMogoModuleProvider {
|
||||
MarkerServiceHandler.init( context );
|
||||
// if ( DebugConfig.isNeedUploadCoordinatesDurationInTime() ) {
|
||||
// }
|
||||
MogoRTKLocation.getInstance().init();
|
||||
// MogoRTKLocation.getInstance().init(); //todo RTK LOCATION Close
|
||||
MogoServices.getInstance().preInit( context );
|
||||
MogoServices.getInstance().init( AbsMogoApplication.getApp() );
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
|
||||
@@ -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 ) {
|
||||
@@ -935,7 +938,9 @@ public class MogoServices implements IMogoMapListener,
|
||||
|
||||
@Override
|
||||
public void onMapModeChanged( EnumMapUI ui ) {
|
||||
Log.d("liyz", "onMapModeChanged ----> ui = " + ui);
|
||||
if ( ui == EnumMapUI.Type_VR ) {
|
||||
Log.d("liyz", "onMapModeChanged mLastStatusIsVr = " + mLastStatusIsVr + "--ui = " +ui);
|
||||
if ( !mLastStatusIsVr ) {
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, true );
|
||||
MapCenterPointStrategy.resetByChangeMode();
|
||||
@@ -960,6 +965,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 {
|
||||
|
||||
@@ -13,6 +13,8 @@ import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
import com.mogo.cloud.socket.entity.SocketDownDataHelper;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
@@ -36,11 +38,9 @@ import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.module.service.status.EnvStatusManager;
|
||||
import com.mogo.module.service.timedelay.TimeDelayUploadManager;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.realtime.entity.CloudRoadData;
|
||||
import com.mogo.realtime.entity.MogoSnapshotSetData;
|
||||
import com.mogo.service.adas.RemoteControlAutoPilotParameters;
|
||||
import com.mogo.service.adas.entity.ADASCarStateInfo;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedResult;
|
||||
import com.mogo.service.entrance.ButtonIndex;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
@@ -543,8 +543,8 @@ public class MockIntentHandler implements IntentHandler {
|
||||
.openVrMode(false);
|
||||
break;
|
||||
case 46:// 模拟 自车周边数据
|
||||
String json = "{\"allList\":[{\"type\":3,\"uuid\":\"10009-5152\",\"lat\":40.1990809296,\"lon\":116.7393252195,\"speed\":0.0,\"heading\":0.0,\"systemTime\":1614329151909,\"vehicleType\":0,\"distance\":576.0,\"fromType\":3,\"isOnline\":0},{\"type\":3,\"uuid\":\"10009-5161\",\"lat\":40.1990827227,\"lon\":116.739325826,\"speed\":0.0,\"heading\":0.0,\"systemTime\":1614329151909,\"vehicleType\":0,\"distance\":576.0,\"fromType\":3,\"isOnline\":0}],\"nearList\":[],\"time\":1614329152238}";
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData(GsonUtil.objectFromJson(json, MogoSnapshotSetData.class));
|
||||
// String json = "{\"allList\":[{\"type\":3,\"uuid\":\"10009-5152\",\"lat\":40.1990809296,\"lon\":116.7393252195,\"speed\":0.0,\"heading\":0.0,\"systemTime\":1614329151909,\"vehicleType\":0,\"distance\":576.0,\"fromType\":3,\"isOnline\":0},{\"type\":3,\"uuid\":\"10009-5161\",\"lat\":40.1990827227,\"lon\":116.739325826,\"speed\":0.0,\"heading\":0.0,\"systemTime\":1614329151909,\"vehicleType\":0,\"distance\":576.0,\"fromType\":3,\"isOnline\":0}],\"nearList\":[],\"time\":1614329152238}";
|
||||
// SnapshotSetDataDrawer.getInstance().renderSnapshotData(GsonUtil.objectFromJson(json, MogoSnapshotSetData.class)); //todo 需要重新模拟一个test数据
|
||||
break;
|
||||
case 47:// 模拟鹰眼模式下绘制车辆周边的数据
|
||||
mTimeTickHandler.sendEmptyMessageDelayed(1, 0L);
|
||||
@@ -647,18 +647,22 @@ public class MockIntentHandler implements IntentHandler {
|
||||
*/
|
||||
private void handleRoadSideMockDataIntent() throws Exception {
|
||||
if (roadSizeBr == null) {
|
||||
roadSizeBr = new BufferedReader(new InputStreamReader(AbsMogoApplication.getApp().getAssets().open("roadSide.txt")));
|
||||
roadSizeBr = new BufferedReader(new InputStreamReader(AbsMogoApplication.getApp().getAssets().open("roadSide.txt"))); //todo 需要重新模拟一个test数据
|
||||
}
|
||||
String carsLine = roadSizeBr.readLine();
|
||||
MogoSnapshotSetData data = new MogoSnapshotSetData();
|
||||
List<CloudRoadData> allList = GsonUtil.arrayFromJson(carsLine, CloudRoadData.class);
|
||||
for (CloudRoadData cloudRoadData : allList) {
|
||||
cloudRoadData.setWgslat(cloudRoadData.getLat());
|
||||
cloudRoadData.setWgslon(cloudRoadData.getLon());
|
||||
cloudRoadData.setFromType(CloudRoadData.FROM_ROAD_UNIT);
|
||||
SocketDownData.LauncherSnapshotProto.Builder data = SocketDownData.LauncherSnapshotProto.newBuilder();
|
||||
List<SocketDownData.CloudRoadDataProto> allList = GsonUtil.arrayFromJson(carsLine, SocketDownData.CloudRoadDataProto.class);
|
||||
if(allList == null || allList.size() == 0){
|
||||
return;
|
||||
}
|
||||
data.setAllList(allList);
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData(data);
|
||||
for (SocketDownData.CloudRoadDataProto cloudRoadData : allList) {
|
||||
cloudRoadData.toBuilder()
|
||||
.setWgslat(cloudRoadData.getLon())
|
||||
.setWgslon(cloudRoadData.getLon())
|
||||
.setFromType(SocketDownDataHelper.FROM_ROAD_UNIT);
|
||||
}
|
||||
data.addAllAllList(allList);
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData(data.build());
|
||||
mLocationMockHandler.sendEmptyMessageDelayed(101, 100L);
|
||||
}
|
||||
|
||||
@@ -861,29 +865,30 @@ public class MockIntentHandler implements IntentHandler {
|
||||
* 模拟快照意图
|
||||
*/
|
||||
private boolean handleMockSnapshotIntent2() throws Exception {
|
||||
if (br4 == null) {
|
||||
br4 = new BufferedReader(new InputStreamReader(AbsMogoApplication.getApp().getAssets().open("snapshot.txt")));
|
||||
}
|
||||
String line = br4.readLine();
|
||||
if (line == null) {
|
||||
throw new Exception("end of file 2.");
|
||||
}
|
||||
MogoSnapshotSetData data = new MogoSnapshotSetData();
|
||||
List<CloudRoadData> allList = new ArrayList<>();
|
||||
CloudRoadData cloudRoadData = GsonUtil.objectFromJson(line, CloudRoadData.class);
|
||||
if (cloudRoadData == null) {
|
||||
return false;
|
||||
}
|
||||
cloudRoadData.setWgslon(cloudRoadData.getLon());
|
||||
cloudRoadData.setWgslat(cloudRoadData.getLat());
|
||||
cloudRoadData.setUuid("1_21");
|
||||
allList.add(cloudRoadData);
|
||||
data.setAllList(allList);
|
||||
|
||||
final long start = System.currentTimeMillis();
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData(data);
|
||||
Log.i("mock-timer-snapshot", "cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
// mLocationMockHandler.sendEmptyMessageDelayed( 21, 100L );
|
||||
// if (br4 == null) {
|
||||
// br4 = new BufferedReader(new InputStreamReader(AbsMogoApplication.getApp().getAssets().open("snapshot.txt"))); todo 需要重新模拟一个test数据
|
||||
// }
|
||||
// String line = br4.readLine();
|
||||
// if (line == null) {
|
||||
// throw new Exception("end of file 2.");
|
||||
// }
|
||||
// SocketDownData.LauncherSnapshotProto.Builder data = SocketDownData.LauncherSnapshotProto.newBuilder();
|
||||
// List<SocketDownData.CloudRoadDataProto> allList = new ArrayList<>();
|
||||
// SocketDownData.CloudRoadDataProto cloudRoadData = GsonUtil.objectFromJson(line, SocketDownData.CloudRoadDataProto.class);
|
||||
// if (cloudRoadData == null) {
|
||||
// return false;
|
||||
// }
|
||||
// SocketDownData.CloudRoadDataProto.Builder builder = cloudRoadData.toBuilder();
|
||||
// builder.setWgslat(cloudRoadData.getLon());
|
||||
// builder.setWgslon(cloudRoadData.getLat());
|
||||
// builder.setUuid("1_21");
|
||||
// allList.add(cloudRoadData);
|
||||
// data.addAllAllList(allList);
|
||||
//
|
||||
// final long start = System.currentTimeMillis();
|
||||
// SnapshotSetDataDrawer.getInstance().renderSnapshotData(data.build());
|
||||
// Log.i("mock-timer-snapshot", "cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
//// mLocationMockHandler.sendEmptyMessageDelayed( 21, 100L );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.network.ParamsProvider;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
@@ -404,7 +405,7 @@ class LauncherCardRefresher {
|
||||
.addType( LauncherCardRefreshType.News.getVal() )
|
||||
.addType( LauncherCardRefreshType.ExplorerWay.getVal() )
|
||||
.addType( LauncherCardRefreshType.Weather.getVal() )
|
||||
.sn( Utils.getSn() )
|
||||
.sn( MoGoAiCloudClientConfig.getInstance().getSn() )
|
||||
.cityCode( location.getCityCode() )
|
||||
.cityName( location.getCityName() )
|
||||
.location( new MogoLatLng( location.getLatitude(), location.getLongitude() ) );
|
||||
|
||||
@@ -10,7 +10,7 @@ import android.os.Bundle;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.realtime.entity.CloudLocationInfo;
|
||||
import com.mogo.service.locationinfo.CloudLocationInfo;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public class MogoRTKLocation {
|
||||
|
||||
@@ -5,15 +5,14 @@ import android.graphics.Rect;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.common.ModuleNames;
|
||||
import com.mogo.module.common.api.CallChatApi;
|
||||
@@ -31,18 +30,15 @@ import com.mogo.module.common.entity.MarkerOnlineCar;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.common.utils.CloudPoiManager;
|
||||
import com.mogo.module.common.utils.Trigonometric;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.service.network.RefreshCallback;
|
||||
import com.mogo.module.service.network.RefreshModel;
|
||||
import com.mogo.module.service.polyline.LimberCollisionPolyline;
|
||||
import com.mogo.realtime.api.MoGoAiCloudRealTime;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.realtime.entity.MogoSnapshotSetData;
|
||||
import com.mogo.realtime.socket.IMogoCloudOnMsgListener;
|
||||
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedResult;
|
||||
import com.mogo.service.module.IMogoBizActionDoneListener;
|
||||
import com.mogo.utils.ResourcesHelper;
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
@@ -57,7 +53,6 @@ import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -139,7 +134,11 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
|
||||
});
|
||||
}
|
||||
// 下发的数据
|
||||
|
||||
/*
|
||||
* 云端下发数据与adas定频传输数据均发送至同一Handler线程处理
|
||||
*/
|
||||
// 云端下发的数据
|
||||
MoGoAiCloudRealTime.registerOnMsgListener(new IMogoCloudOnMsgListener() {
|
||||
@Override
|
||||
public void onMsgSend(long id) {
|
||||
@@ -147,17 +146,22 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(MogoSnapshotSetData mogoSnapshotSetData) {
|
||||
public void onMsgReceived(SocketDownData.LauncherSnapshotProto mogoSnapshotSetData) {
|
||||
DebugConfig.setStatus(DebugConfig.sDownloadSnapshot, true);
|
||||
Message msg = mSnapshotHandler.obtainMessage();
|
||||
msg.obj = mogoSnapshotSetData;
|
||||
msg.sendToTarget();
|
||||
// SnapshotSetDataDrawer.getInstance().renderSnapshotData(mogoSnapshotSetData); //todo 6月4号 提测版本中去掉云端下发数据展示
|
||||
// Message msg = mSnapshotHandler.obtainMessage();
|
||||
// msg.obj = mogoSnapshotSetData;
|
||||
// msg.what = MSG_SNAPSHOT;
|
||||
// msg.sendToTarget();
|
||||
}
|
||||
});
|
||||
|
||||
// adas 每隔一秒传递的数据
|
||||
// adas 每隔一定频率传递过来的数据
|
||||
MarkerServiceHandler.getApis().getAdasControllerApi().addAdasRecognizedDataCallback(resultList -> {
|
||||
// 绘制近景识别到的车辆
|
||||
// Message msg = mSnapshotHandler.obtainMessage();
|
||||
// msg.obj = resultList;
|
||||
// msg.what = MSG_ADAS;
|
||||
// msg.sendToTarget();
|
||||
AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult(resultList);
|
||||
|
||||
//添加自车的定位图标,碰撞只有一个预警,还需要和adas 联调,
|
||||
@@ -176,44 +180,63 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 实时绘制连线
|
||||
*
|
||||
* @param result
|
||||
*/
|
||||
private void drawLimberCollisionPolyline(ADASRecognizedResult result) {
|
||||
if (result != null) {
|
||||
IMogoPolyline polyLine = LimberCollisionPolyline.getInstance().getPolyLine();
|
||||
MogoLatLng startLatLng = new MogoLatLng(result.lat, result.lon);
|
||||
MogoLatLng endLatlng = Trigonometric.getNewLocation(startLatLng, 20, result.heading);
|
||||
Log.d(TAG, "红色区域起始点 = " + startLatLng.lon + "," + startLatLng.lat
|
||||
+ "终点" + endLatlng.lon + "," + endLatlng.lat + "--heading =" + result.heading);
|
||||
if (polyLine != null) {
|
||||
Log.d(TAG, "drawStopLine polyLine != null");
|
||||
polyLine.setPoints(Arrays.asList(startLatLng, endLatlng));
|
||||
} else {
|
||||
List<MogoLatLng> latLngs = new ArrayList<>();
|
||||
latLngs.add(startLatLng);
|
||||
latLngs.add(endLatlng);
|
||||
LimberCollisionPolyline.getInstance().draw((float) result.roadWidth, latLngs);
|
||||
}
|
||||
} else {
|
||||
LimberCollisionPolyline.getInstance().clearLine();
|
||||
}
|
||||
}
|
||||
// /**
|
||||
// * 实时绘制连线
|
||||
// *
|
||||
// * @param result
|
||||
// */
|
||||
// private void drawLimberCollisionPolyline(ADASRecognizedResult result) {
|
||||
// if (result != null) {
|
||||
// IMogoPolyline polyLine = LimberCollisionPolyline.getInstance().getPolyLine();
|
||||
// MogoLatLng startLatLng = new MogoLatLng(result.lat, result.lon);
|
||||
// MogoLatLng endLatlng = Trigonometric.getNewLocation(startLatLng, 20, result.heading);
|
||||
// Log.d(TAG, "红色区域起始点 = " + startLatLng.lon + "," + startLatLng.lat
|
||||
// + "终点" + endLatlng.lon + "," + endLatlng.lat + "--heading =" + result.heading);
|
||||
// if (polyLine != null) {
|
||||
// Log.d(TAG, "drawStopLine polyLine != null");
|
||||
// polyLine.setPoints(Arrays.asList(startLatLng, endLatlng));
|
||||
// } else {
|
||||
// List<MogoLatLng> latLngs = new ArrayList<>();
|
||||
// latLngs.add(startLatLng);
|
||||
// latLngs.add(endLatlng);
|
||||
// LimberCollisionPolyline.getInstance().draw((float) result.roadWidth, latLngs);
|
||||
// }
|
||||
// } else {
|
||||
// LimberCollisionPolyline.getInstance().clearLine();
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
private final Handler mSnapshotHandler = new Handler(WorkThreadHandler.newInstance("snapshot-thread").getLooper()) {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
if (msg.obj instanceof MogoSnapshotSetData) {
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData(((MogoSnapshotSetData) msg.obj));
|
||||
} else if (msg.obj == null) {
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
// private final static int MSG_SNAPSHOT = 1;
|
||||
// private final static int MSG_ADAS = 2;
|
||||
//
|
||||
// /**
|
||||
// * todo 后续从云端和adas侧拿到的数据 需求对数据流进行重新架构以扩展除添加marker外的其他预警类业务
|
||||
// * todo (应需要模块主动注册adas或云端数据回调,在具体模块内添加绘制需求,需要与地图侧确认是否支持并发)
|
||||
// */
|
||||
// private final Handler mSnapshotHandler = new Handler(WorkThreadHandler.newInstance("snapshot-thread").getLooper()) {
|
||||
// @Override
|
||||
// public void handleMessage(Message msg) {
|
||||
// super.handleMessage(msg);
|
||||
// switch (msg.what) {
|
||||
// case MSG_SNAPSHOT:
|
||||
// if (msg.obj instanceof SocketDownData.LauncherSnapshotProto) {
|
||||
// SnapshotSetDataDrawer.getInstance().renderSnapshotData(((SocketDownData.LauncherSnapshotProto) msg.obj));
|
||||
// } else {
|
||||
// SnapshotSetDataDrawer.getInstance().renderSnapshotData(null);
|
||||
// }
|
||||
// break;
|
||||
// case MSG_ADAS:
|
||||
// // 绘制近景识别到的车辆
|
||||
// if (msg.obj instanceof List) {
|
||||
// List<ADASRecognizedResult> recognizedResults = (List<ADASRecognizedResult>) msg.obj;
|
||||
// AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult(recognizedResults);
|
||||
// }
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
|
||||
/**
|
||||
* 地图上的Marker点击回调
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.module.service.network;
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.network.ParamsProvider;
|
||||
@@ -158,7 +159,7 @@ public class RefreshModel {
|
||||
if ( mRefreshApiService != null ) {
|
||||
final Map< String, Object > query = new ParamsProvider.Builder( mContext ).build();
|
||||
final RefreshBody refreshBody = new RefreshBody();
|
||||
refreshBody.sn = Utils.getSn();
|
||||
refreshBody.sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
if ( limit > 0 ) {
|
||||
refreshBody.limit = limit;
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.mogo.module.service.spi;
|
||||
|
||||
import com.elegant.spi.annotations.Service;
|
||||
import com.mogo.module.common.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.realtime.api.IRealTimeProvider;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.realtime.entity.CloudLocationInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service(value = IRealTimeProvider.class)
|
||||
public class SPIRealTimeUpload implements IRealTimeProvider {
|
||||
|
||||
@Override
|
||||
public List<ADASRecognizedResult> getLastADASRecognizedResult() {
|
||||
return MarkerServiceHandler.getADASController().getLastADASRecognizedResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CloudLocationInfo> getLocationMsg() {
|
||||
return SnapshotLocationController.getInstance().getSendLocationData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLocationAccuracy() {
|
||||
return SnapshotLocationController.getInstance().getDataAccuracy();
|
||||
}
|
||||
}
|
||||
@@ -4,12 +4,14 @@ import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
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;
|
||||
@@ -17,9 +19,8 @@ import com.mogo.module.service.network.TimeDelayApiService;
|
||||
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.entity.CloudRoadData;
|
||||
import com.mogo.realtime.entity.MogoSnapshotSetData;
|
||||
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()) {
|
||||
@@ -137,10 +144,10 @@ public class TimeDelayUploadManager implements IMogoOnMessageListener<MockSocket
|
||||
//接收实时数据监听回调,用于给服务端上报时延
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
@Override
|
||||
public void onMsgReceived(MogoSnapshotSetData mogoSnapshotSetData) {
|
||||
public void onMsgReceived(SocketDownData.LauncherSnapshotProto mogoSnapshotSetData) {
|
||||
if (isMockData) {
|
||||
//接口数据上报
|
||||
CloudRoadData result = mogoSnapshotSetData.getAllList()
|
||||
SocketDownData.CloudRoadDataProto result = mogoSnapshotSetData.getAllListList()
|
||||
.stream()
|
||||
.filter(cloudRoadData -> cloudRoadData.getUuid().contains("serialNumber_"))
|
||||
.findAny()
|
||||
@@ -149,12 +156,18 @@ public class TimeDelayUploadManager implements IMogoOnMessageListener<MockSocket
|
||||
Logger.d(TAG, "未找到与之匹配数据");
|
||||
return;
|
||||
}
|
||||
MockSocketSendData mockSocketSendData = new MockSocketSendData(System.currentTimeMillis(), result.getUuid(), result.getSatelliteTime());
|
||||
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", Utils.getSn());
|
||||
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())
|
||||
@@ -171,4 +184,5 @@ public class TimeDelayUploadManager implements IMogoOnMessageListener<MockSocket
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.mogo.module.service.utils;
|
||||
import android.location.Location;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.realtime.entity.CloudLocationInfo;
|
||||
import com.mogo.service.locationinfo.CloudLocationInfo;
|
||||
|
||||
/**
|
||||
* 定位数据类型转换工具
|
||||
|
||||
@@ -4,7 +4,7 @@ import android.os.SystemClock;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.realtime.entity.CloudLocationInfo;
|
||||
import com.mogo.service.locationinfo.CloudLocationInfo;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.util.ArrayMap;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
@@ -456,7 +457,7 @@ public class ShareControl implements IMogoShareManager, Handler.Callback {
|
||||
if (NetworkUtils.isConnected(mContext) && location != null && !location.getAdCode().isEmpty()) {
|
||||
// 有网,且有adcode,直接请求
|
||||
Map<String, String> params = new ArrayMap<>();
|
||||
ShareConfigRequest request = new ShareConfigRequest(Utils.getSn(),
|
||||
ShareConfigRequest request = new ShareConfigRequest(MoGoAiCloudClientConfig.getInstance().getSn(),
|
||||
location.getAdCode());
|
||||
params.put("data", request.toJson());
|
||||
ServiceApisManager.serviceApis.getNetworkApi().create(ShareDevaApiService.class,
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.os.SystemClock
|
||||
import android.util.ArrayMap
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.analytics.AnalyticsUtils
|
||||
import com.mogo.commons.data.BaseData
|
||||
import com.mogo.commons.network.SubscribeImpl
|
||||
@@ -157,7 +158,7 @@ object SeekHelpManager {
|
||||
private fun realSeekHelp(from:String) {
|
||||
Logger.d(TAG, "realSeekHelp")
|
||||
// 请求故障求助接口
|
||||
val seekRequest = SeekRequest(Utils.getSn())
|
||||
val seekRequest = SeekRequest(MoGoAiCloudClientConfig.getInstance().getSn())
|
||||
val param = mutableMapOf("data" to seekRequest.getJson())
|
||||
|
||||
val properties: MutableMap<String, Any> = ArrayMap()
|
||||
@@ -221,7 +222,7 @@ object SeekHelpManager {
|
||||
}
|
||||
|
||||
fun debugCancelSeek() {
|
||||
val seekRequest = SeekRequest(Utils.getSn(), 0)
|
||||
val seekRequest = SeekRequest(MoGoAiCloudClientConfig.getInstance().getSn(), 0)
|
||||
val param = mutableMapOf("data" to seekRequest.getJson())
|
||||
ServiceApisManager.serviceApis.networkApi.create(ShareRtlApiService::class.java, HostConst.REALTIME_LOCATION_HOST).sendHelpSignal(param).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(object : SubscribeImpl<BaseData>(RequestOptions.create(context)) {
|
||||
override fun onSuccess(o: BaseData?) {
|
||||
|
||||
@@ -132,7 +132,7 @@ public class TanluModelData {
|
||||
// }
|
||||
//
|
||||
// Map<String, Object> params = new ParamsProvider.Builder(mContext)
|
||||
// .append("sn", Utils.getSn())
|
||||
// .append("sn", MoGoAiCloudClientConfig.getInstance().getSn())
|
||||
// .append("data", GsonUtil.jsonFromObject(request))
|
||||
// .build();
|
||||
//
|
||||
@@ -194,7 +194,7 @@ public class TanluModelData {
|
||||
// }
|
||||
//
|
||||
// Map<String, Object> params = new ParamsProvider.Builder(mContext)
|
||||
// .append("sn", Utils.getSn())
|
||||
// .append("sn", MoGoAiCloudClientConfig.getInstance().getSn()))
|
||||
// .append("data", GsonUtil.jsonFromObject(request))
|
||||
// .build();
|
||||
// return mShareApiService.queryRoadInfos(params);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.module.share.net;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.network.ParamsProvider;
|
||||
@@ -43,7 +44,7 @@ public class TrafficModelData {
|
||||
|
||||
final ParamsProvider.Builder builder = new ParamsProvider.Builder( getApp().getApplicationContext());
|
||||
Map<String, Object> parameters = builder.build();
|
||||
parameters.put("sn", Utils.getSn());
|
||||
parameters.put("sn", MoGoAiCloudClientConfig.getInstance().getSn());
|
||||
parameters.put("data",GsonUtil.jsonFromObject(uploadTrafficEntity));
|
||||
mTrafficApiService.UploadCongestionInfo(parameters)
|
||||
.subscribeOn(Schedulers.io())
|
||||
|
||||
@@ -248,7 +248,7 @@ class BlockStrategy(private val context: Context, private val apis: IMogoService
|
||||
// val params = ArrayMap<String, Any>()
|
||||
// params["speed"] = average.toInt()
|
||||
// val body = RequestBody.create(MediaType.parse("Content-type:application/json;charset=UTF-8"), GsonUtil.jsonFromObject(params))
|
||||
// apis.networkApi.create(ShareApiService::class.java, HttpConstant.getNetHost()).sendAverageSpeedForBlockStrategy(body, Utils.getSn()).subscribeOn(Schedulers.io()).subscribe(object : SubscribeImpl<AverateSpeedResponse>(RequestOptions.create(context)) {
|
||||
// apis.networkApi.create(ShareApiService::class.java, HttpConstant.getNetHost()).sendAverageSpeedForBlockStrategy(body, MoGoAiCloudClientConfig.getInstance().getSn()).subscribeOn(Schedulers.io()).subscribe(object : SubscribeImpl<AverateSpeedResponse>(RequestOptions.create(context)) {
|
||||
// override fun onSuccess(response: AverateSpeedResponse?) {
|
||||
// super.onSuccess(response)
|
||||
// response?.let {
|
||||
|
||||
@@ -6,8 +6,6 @@ import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -216,7 +214,7 @@ public class SmallMapDirectionView extends RelativeLayout {
|
||||
|
||||
|
||||
setOnClickListener(view -> {
|
||||
if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_LENOVO ) {
|
||||
if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_LENOVO) {
|
||||
MogoApisHandler.getInstance().getApis()
|
||||
.getMapServiceApi()
|
||||
.getMapUIController()
|
||||
|
||||
@@ -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.*{*;}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class V2XEventPanelModuleProvider implements
|
||||
|
||||
@Override
|
||||
public Fragment createFragment(Context context, Bundle data) {
|
||||
Logger.e(MODULE_NAME, "事件模版 createFragment。。。。");
|
||||
Logger.d(MODULE_NAME, "事件模版 createFragment。。。。");
|
||||
V2XServiceManager.init(context);
|
||||
return V2XEventPanelFragment.Companion.getInstance();
|
||||
}
|
||||
@@ -93,7 +93,7 @@ public class V2XEventPanelModuleProvider implements
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
V2XServiceManager.init(context);
|
||||
Logger.e(MODULE_NAME, "事件模版 模块初始化。。。。");
|
||||
Logger.d(MODULE_NAME, "事件模版 模块初始化。。。。");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,6 +14,7 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
@@ -52,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;
|
||||
@@ -130,8 +132,11 @@ public class V2XModuleProvider implements
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
Logger.e(MODULE_NAME, "V2X 模块初始化。。。。");
|
||||
Logger.d(MODULE_NAME, "V2X 模块初始化。。。。");
|
||||
mContext = context;
|
||||
// 关闭腾讯直播日志
|
||||
TXCLog.setLevel(TXCLog.LOG_NONE);
|
||||
TXCLog.setConsoleEnabled(false);
|
||||
|
||||
V2XUtils.init(context);
|
||||
V2XServiceManager.init(context);
|
||||
@@ -149,7 +154,7 @@ public class V2XModuleProvider implements
|
||||
// obu数据转发初始化
|
||||
V2XObuManager.getInstance().init(context);
|
||||
if (V2XServiceManager.getMoGoStatusManager().isTopContainerReady()) {
|
||||
V2XServiceManager.getV2XRefreshModel().queryRoadData(Utils.getSn());
|
||||
V2XServiceManager.getV2XRefreshModel().queryRoadData(MoGoAiCloudClientConfig.getInstance().getSn());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -280,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();
|
||||
@@ -304,8 +309,6 @@ public class V2XModuleProvider implements
|
||||
V2XServiceManager.getV2XMarkerService().startAutoRefresh();
|
||||
// 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随
|
||||
V2XServiceManager.getMapUIController().recoverLockMode();
|
||||
//注册adas数据通道
|
||||
V2XWaringManager.getInstance().registerAdasSocketMessage(mContext);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -334,7 +337,7 @@ public class V2XModuleProvider implements
|
||||
FatigueDrivingUtils.refreshAccOnTime();
|
||||
initCarForHelpStatus();
|
||||
if (V2XServiceManager.getMoGoStatusManager().isTopContainerReady()) {
|
||||
V2XServiceManager.getV2XRefreshModel().queryRoadData(Utils.getSn());
|
||||
V2XServiceManager.getV2XRefreshModel().queryRoadData(MoGoAiCloudClientConfig.getInstance().getSn());
|
||||
}
|
||||
} else {
|
||||
// 记录关机时间
|
||||
@@ -343,9 +346,9 @@ 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(Utils.getSn());
|
||||
V2XServiceManager.getV2XRefreshModel().queryRoadData(MoGoAiCloudClientConfig.getInstance().getSn());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -433,7 +436,7 @@ public class V2XModuleProvider implements
|
||||
|
||||
@Override
|
||||
public void onMapVisualAngleChanged(VisualAngleMode visualAngleMode) {
|
||||
//todo visual 涉及到V2X,V2N业务,视距状态切换回调
|
||||
//todo visual 涉及到V2X,V2N业务,视距状态切换回调 切换到近景如何处理 产品侧需要定义
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -178,9 +178,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());
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -4,9 +4,7 @@ import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.v2x.entity.model.DrawLineInfo;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
|
||||
/**
|
||||
* 绘制可变宽度和渐变的线
|
||||
|
||||
@@ -14,7 +14,6 @@ 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.manager.IMoGoWarnPolylineManager;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user