Merge branch 'dev/dev_eagle_architecture_upgrade' into dev/dev_eagle_wuhan_sikua_obu

This commit is contained in:
董宏宇
2021-09-17 16:40:28 +08:00
14 changed files with 86 additions and 172 deletions

View File

@@ -47,6 +47,7 @@ dependencies {
} else {
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-utils')
implementation project(':core:mogo-core-function-api')
implementation project(':core:function-impl:mogo-core-function-hmi')
}

View File

@@ -0,0 +1,27 @@
package com.mogo.eagle.core.function.call;
import com.alibaba.android.arouter.facade.template.IProvider;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author xiaoyuzhou
* @date 2021/9/17 4:10 下午
*/
public class CallerBusManager {
private static final String TAG = "CallerBusManager";
private static final Map<Class, Object> sSingletons = new ConcurrentHashMap<>();
public static <T> T get(Class<T> clazz) {
return (T) sSingletons.get(clazz);
}
public static <T extends IProvider> void registerApi(Class<? extends IProvider> api, T impl) throws Exception {
if (api == null || impl == null) {
return;
}
sSingletons.put(api, impl);
}
}

View File

@@ -0,0 +1,36 @@
package com.mogo.eagle.core.function.call.base;
import com.alibaba.android.arouter.facade.template.IProvider;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.eagle.core.function.call.CallerBusManager;
import com.mogo.eagle.core.utilcode.util.LogUtils;
/**
* @author xiaoyuzhou
* @date 2021/9/17 4:02 下午
*/
public class CallerBase {
private static final String TAG = "CallerBase";
public static <T extends IProvider> T getApiInstance(Class<T> clazz, String path) {
T inst = CallerBusManager.get(clazz);
if (inst == null) {
synchronized (CallerBase.class) {
inst = CallerBusManager.get(clazz);
if (inst != null) {
return inst;
}
T newInst = (T) ARouter.getInstance().build(path).navigation();
try {
CallerBusManager.registerApi(clazz, newInst);
LogUtils.dTag(TAG, "keep IProvider instance to SingletonHolder: path = %s", path);
} catch (Exception e) {
e.printStackTrace();
}
return newInst;
}
}
return inst;
}
}

View File

@@ -0,0 +1,16 @@
package com.mogo.eagle.core.function.call.hmi;
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider;
import com.mogo.eagle.core.function.call.base.CallerBase;
import com.mogo.service.MogoServicePaths;
/**
* @author xiaoyuzhou
* @date 2021/9/17 3:59 下午
*/
public class CallerHmiManager extends CallerBase {
public static IMoGoWaringProvider getWaringProviderApi() {
return getApiInstance(IMoGoWaringProvider.class, MogoServicePaths.PATH_V2X_WARNING);
}
}

View File

@@ -54,6 +54,7 @@ dependencies {
api project(":foudations:mogo-aicloud-services-sdk")
api project(":tts:tts-base")
implementation project(":skin:mogo-skin-support")
implementation project(':core:mogo-core-utils')
}
api 'org.greenrobot:eventbus:3.1.1'
}

View File

@@ -24,6 +24,7 @@ import com.mogo.commons.network.Constants;
import com.mogo.commons.network.ParamsUtil;
import com.mogo.commons.network.X509TrustManagerImpl;
import com.mogo.commons.storage.SpStorage;
import com.mogo.eagle.core.utilcode.util.Utils;
import com.mogo.utils.ThreadPoolService;
import com.mogo.utils.TipDrawable;
import com.mogo.utils.TipToast;
@@ -68,6 +69,7 @@ public abstract class AbsMogoApplication extends Application {
aMapNaviView.onCreate(null);
sApp = this;
initARouter();
Utils.init(this);
if ( shouldInit() ) {
init();
}

View File

@@ -1 +0,0 @@
/build

View File

@@ -1,79 +0,0 @@
#### 说明
这里承载 OBU、ADAS、云端下发、软件自处理预警的展示
#### HMI 模块能力接口总控
```kotlin
// 模块能力接口总控
private var mMogoServiceApis: IMogoServiceApis? = null
private var mIMoGoWaringProvider: IMoGoWaringProvider? = null
mMogoServiceApis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS)
.navigation(context) as IMogoServiceApis
// 获取预警模块的接口
mIMoGoWaringProvider = mMogoServiceApis!!.waringProviderApi
```
##### 顶部弹窗预警
```kotlin
/**
* 触发弹窗
*
* @param v2xType V2X类型 @EventTypeEnum
* @param alertContent 提醒文本
* @param ttsContent tts语音播报消息
* @param tag tag绑定弹窗的标志
*/
mIMoGoWaringProvider!!.showWarningV2X(
v2xType,
alertContent,
ttsContent,
tag
)
/**
* 关闭指定tag的弹窗
*
* @param tag tag绑定弹窗的标志
*/
mIMoGoWaringProvider!!.disableWarningV2X(
tag
)
```
##### 红绿灯控件
```kotlin
/**
* 展示交通灯
*
* @param trafficLightCheckType 选中的交通的灯 0-都是默认1-红2-黄3-绿
*/
mIMoGoWaringProvider!!.showWarningTrafficLight(trafficLightCheckType)
/**
* 关闭交通灯
*/
mIMoGoWaringProvider!!.disableWarningTrafficLight()
```
##### 限速控件
```kotlin
/**
* 展示限速标志
*
* @param limitingVelocitySpeed 限速速度
*/
mIMoGoWaringProvider!!.showLimitingVelocity(limitingVelocitySpeed)
/**
* 关闭限速标志
*/
mIMoGoWaringProvider!!.disableLimitingVelocity()
```

View File

@@ -1,67 +0,0 @@
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-android-extensions'
id 'kotlin-kapt'
id 'com.alibaba.arouter'
}
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode Integer.valueOf(VERSION_CODE)
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
//ARouter apt 参数
kapt {
useBuildCache = false
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
implementation rootProject.ext.dependencies.androidxccorektx
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.androidxconstraintlayout
implementation rootProject.ext.dependencies.arouter
implementation rootProject.ext.dependencies.rxandroid
kapt rootProject.ext.dependencies.aroutercompiler
if (Boolean.valueOf(RELEASE)) {
api rootProject.ext.dependencies.mogoserviceapi
implementation rootProject.ext.dependencies.modulecommon
implementation rootProject.ext.dependencies.moduledata
} else {
api project(':services:mogo-service-api')
implementation project(':modules:mogo-module-common')
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-res')
}
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -1,3 +0,0 @@
GROUP=com.mogo.module
POM_ARTIFACT_ID=module-hmi
VERSION_CODE=1

View File

@@ -1,21 +0,0 @@
# 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

View File

@@ -60,6 +60,7 @@ dependencies {
api project(':services:mogo-service-api')
implementation project(':modules:mogo-module-common')
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-function-call')
}
implementation rootProject.ext.dependencies.mogoobu

View File

@@ -13,6 +13,7 @@ import com.mogo.service.MogoServicePaths
import com.mogo.service.map.IMogoMapService
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider
import com.mogo.eagle.core.function.api.hmi.warning.WarningStatusListener
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.utils.logger.Logger
import com.mogo.utils.storage.SharedPrefsMgr
import com.zhidao.support.obu.MogoObuManager
@@ -46,7 +47,7 @@ class MogoPrivateObuManager private constructor() {
.navigation(context) as IMogoServiceApis
mContext = context
// 获取预警模块的接口
mIMoGoWaringProvider = mMogoServiceApis!!.waringProviderApi
mIMoGoWaringProvider = CallerHmiManager.getWaringProviderApi()
mIMogoMapService = mMogoServiceApis!!.mapServiceApi
//自研obu