Merge branch 'dev/dev_eagle_architecture_upgrade' into dev/dev_eagle_wuhan_sikua_obu

# Conflicts:
#	core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt
#	libraries/map-custom/src/main/java/com/mogo/map/impl/custom/CustomMapApiBuilder.java
#	modules/mogo-module-common/src/main/java/com/mogo/module/common/enums/WarningTypeEnum.kt
#	modules/mogo-module-hmi/build.gradle
#	modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/notification/WarningFloat.kt
#	modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/notification/WarningNotificationConfig.kt
#	modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/ui/MoGoWarningContract.kt
#	modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/ui/MoGoWarningFragment.kt
#	modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/ui/widget/V2XWarningView.kt
#	modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/warning/MoGoWarningProvider.java
#	modules/mogo-module-obu-mogo/build.gradle
#	modules/mogo-module-obu-mogo/src/main/java/com/mogo/module/obu/mogo/MogoPrivateObuManager.kt
#	services/mogo-service-api/build.gradle
#	settings.gradle
This commit is contained in:
董宏宇
2021-09-16 19:13:24 +08:00
1264 changed files with 4947 additions and 28650 deletions

8
.idea/gradle.xml generated
View File

@@ -7,7 +7,6 @@
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="11" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
@@ -17,6 +16,12 @@
<option value="$PROJECT_DIR$/OCH/mogo-och-noop" />
<option value="$PROJECT_DIR$/OCH/mogo-och-taxi" />
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/core" />
<option value="$PROJECT_DIR$/core/function-impl" />
<option value="$PROJECT_DIR$/core/function-impl/mogo-core-function-hmi" />
<option value="$PROJECT_DIR$/core/mogo-core-data" />
<option value="$PROJECT_DIR$/core/mogo-core-function-api" />
<option value="$PROJECT_DIR$/core/mogo-core-function-call" />
<option value="$PROJECT_DIR$/foudations" />
<option value="$PROJECT_DIR$/foudations/mogo-aicloud-services-sdk" />
<option value="$PROJECT_DIR$/foudations/mogo-commons" />
@@ -34,6 +39,7 @@
<option value="$PROJECT_DIR$/modules/mogo-module-apps" />
<option value="$PROJECT_DIR$/modules/mogo-module-authorize" />
<option value="$PROJECT_DIR$/modules/mogo-module-back" />
<option value="$PROJECT_DIR$/modules/mogo-module-check" />
<option value="$PROJECT_DIR$/modules/mogo-module-common" />
<option value="$PROJECT_DIR$/modules/mogo-module-data" />
<option value="$PROJECT_DIR$/modules/mogo-module-extensions" />

12
.idea/runConfigurations.xml generated Normal file
View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>

View File

@@ -9,6 +9,10 @@ adb root
adb remount
adb shell
adb 过滤日志
adb -s 192.168.1.37:5555 logcat -v time > /tmp/padlog/0915obu.txt
adb -s 192.168.1.37:5555 logcat -v time | grep "com.mogo.launcher.f"
// (新的HMI)使用命令行触发 V2X 预警场景
// 顶部弹窗场景,控制展示
adb shell am broadcast -a com.hmi.v2x.notification --ez v2xIsShow true --es tag "200011" --ei v2xType 20011 --es alertContent "测试外部传入数据" --es ttsContent "测试TTS"

View File

@@ -2,6 +2,10 @@
## 加载模块
### 模块加载顺序(必须按照这个顺序)
因为模块之间有状态依赖关系例如Http-DNS是否初始化完成是否进入VR模式、定位服务是否可用、地图是否加载完成
## 初始化部分服务
## 定义 flavor

View File

@@ -27,8 +27,6 @@ project.android.productFlavors {
buildConfigField 'boolean', 'IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY', 'false'
// 是否基于地图
buildConfigField 'boolean', 'IS_MAP_BASED', 'true'
// 是否加载引导模块
buildConfigField 'boolean', 'IS_NEED_LOAD_GUIDE_MODULE', 'true'
// 分享时是否隐藏 adas
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'false'
// 是否需要实时上报坐标

View File

@@ -27,8 +27,6 @@ project.android.productFlavors {
buildConfigField 'boolean', 'IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY', 'false'
// 是否基于地图
buildConfigField 'boolean', 'IS_MAP_BASED', 'true'
// 是否加载引导模块
buildConfigField 'boolean', 'IS_NEED_LOAD_GUIDE_MODULE', 'true'
// 分享时是否隐藏 adas
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'false'
// 是否需要实时上报坐标

View File

@@ -27,8 +27,6 @@ project.android.productFlavors {
buildConfigField 'boolean', 'IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY', 'false'
// 是否基于地图
buildConfigField 'boolean', 'IS_MAP_BASED', 'true'
// 是否加载引导模块
buildConfigField 'boolean', 'IS_NEED_LOAD_GUIDE_MODULE', 'true'
// 分享时是否隐藏 adas
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'false'
// 是否需要实时上报坐标

View File

@@ -27,8 +27,6 @@ project.android.productFlavors {
buildConfigField 'boolean', 'IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY', 'false'
// 是否基于地图
buildConfigField 'boolean', 'IS_MAP_BASED', 'true'
// 是否加载引导模块
buildConfigField 'boolean', 'IS_NEED_LOAD_GUIDE_MODULE', 'false'
// 分享时是否隐藏 adas
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'false'
// 是否需要实时上报坐标
@@ -38,6 +36,8 @@ project.android.productFlavors {
// 是否需要悬浮窗权限申请
buildConfigField 'boolean', 'IS_NEED_REQUEST_FLOAT_PERMISSION', 'true'
// GPS数据提供源 0-Android系统1-工控机2-OBU
buildConfigField 'int', 'GPS_PROVIDER', "2"
buildConfigField 'int', 'GPS_PROVIDER', "1"
// 默认进入的地图模式
buildConfigField 'int', 'MAP_STYLE_MODE', "1"
}
}

View File

@@ -27,8 +27,6 @@ project.android.productFlavors {
buildConfigField 'boolean', 'IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY', 'false'
// 是否基于地图
buildConfigField 'boolean', 'IS_MAP_BASED', 'true'
// 是否加载引导模块
buildConfigField 'boolean', 'IS_NEED_LOAD_GUIDE_MODULE', 'false'
// 分享时是否隐藏 adas
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'false'
// 是否需要实时上报坐标

View File

@@ -28,8 +28,6 @@ project.android.productFlavors {
buildConfigField 'boolean', 'IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY', 'false'
// 是否基于地图
buildConfigField 'boolean', 'IS_MAP_BASED', 'true'
// 是否加载引导模块
buildConfigField 'boolean', 'IS_NEED_LOAD_GUIDE_MODULE', 'false'
// 分享时是否隐藏 adas
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'false'
// 是否需要实时上报坐标

View File

@@ -27,8 +27,6 @@ project.android.productFlavors {
buildConfigField 'boolean', 'IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY', 'false'
// 是否基于地图
buildConfigField 'boolean', 'IS_MAP_BASED', 'true'
// 是否加载引导模块
buildConfigField 'boolean', 'IS_NEED_LOAD_GUIDE_MODULE', 'false'
// 分享时是否隐藏 adas
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'false'
// 是否需要实时上报坐标

View File

@@ -27,8 +27,6 @@ project.android.productFlavors {
buildConfigField 'boolean', 'IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY', 'false'
// 是否基于地图
buildConfigField 'boolean', 'IS_MAP_BASED', 'true'
// 是否加载引导模块
buildConfigField 'boolean', 'IS_NEED_LOAD_GUIDE_MODULE', 'false'
// 分享时是否隐藏 adas
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'false'
// 是否需要实时上报坐标

View File

@@ -102,7 +102,6 @@ public class MogoApplication extends AbsMogoApplication {
DebugConfig.setScheduleCalculateNotHomeCompanyDistanceForPush(BuildConfig.IS_SUPPORT_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH);
DebugConfig.setSupportLauncherCardRefreshStrategy(BuildConfig.IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY);
DebugConfig.setMapBased(BuildConfig.IS_MAP_BASED);
DebugConfig.setNeedLoadGuideModule(BuildConfig.IS_NEED_LOAD_GUIDE_MODULE);
DebugConfig.setNeedHideAdasWhenShare(BuildConfig.IS_NEED_HIDE_ADAS_WHEN_SHARE);
DebugConfig.setNeedUploadCoordinatesInTime(BuildConfig.IS_NEED_UPLOAD_COORDINATES_IN_TIME);
DebugConfig.setUseAdasRtkLocationInfo(BuildConfig.IS_USE_ADAS_RTK_LOCATION_INFO);
@@ -289,10 +288,12 @@ public class MogoApplication extends AbsMogoApplication {
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_STRATEGY_SHARE, "StrategyShare"));
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_GAODE_AIMLESS_SHARE, "GaoDeAimlessShare"));
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_MOGO_MONITOR, "MogoMonitor"));
// 自动驾驶系统检测模块
MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_CHECK, "CheckProvider"));
// 推送模块
MogoModulePaths.addModule(new MogoModule(PushUIConstants.PATH, PushUIConstants.NAME));
// 碰撞报警模块
MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_CRASH_WARNING, "CrashWarning"));
// OBU 模块
MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_V2X_OBU_MOGO, "IMoGoObuProvider"));
// widgets 模块
@@ -303,7 +304,7 @@ public class MogoApplication extends AbsMogoApplication {
MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_ADAS, "AdasProvider"));
// 前方碰撞预警
MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_V2X_FRONT_CRASH_WARNING, "IV2XManagerProvider"));
// 全局语音唤醒
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_GLOBAL_UNWAKE, "GlobalUnwake"));
if (!DebugConfig.isLauncher()) {

View File

@@ -103,12 +103,12 @@ ext {
mogoservice : "com.mogo.service:mogo-service:${MOGO_SERVICE_VERSION}",
mogoserviceapi : "com.mogo.service:mogo-service-api:${MOGO_SERVICE_API_VERSION}",
moduleapps : "com.mogo.module:module-apps:${MOGO_MODULE_APPS_VERSION}",
mogoconnection : "com.mogo.connection:mogo-connection:${MOGO_CONNECTION_VERSION}",
moduleextensions : "com.mogo.module:module-extensions:${MOGO_MODULE_EXTENSIONS_VERSION}",
callchat : "com.mogo.module.carchatout:module-carchatting:${CARCHATTING_VERSION}",
callchatprovider : "com.mogo.module.carchatout:module-carchatting-provider:${CARCHATTINGPROVIDER_VERSION}",
guideshow : "com.mogo.module:module-guide:${MOGO_MODULE_GUIDESHOW_VERSION}",
mogomodulecheck : "com.mogo.module:mogo-module-check:${MOGO_MODULE_CHECK_VERSION}",
// V2X
moduleV2x : "com.mogo.module:module-v2x:${MOGO_MODULE_V2X_VERSION}",
moduleSmallMap : "com.mogo.module:module-small-map:${MOGO_MODULE_SMP_VERSION}",

10
core/README.md Normal file
View File

@@ -0,0 +1,10 @@
## 模块说明
本模块用来编写鹰眼核型功能
mogo-core-data定义基础业务所需要的数据结构
mogo-core-function-api定义基础业务功能的接口
mogo-core-function-impl定义基础业务功能的接口的功能具体实现
mogo-core-function-call-api定义基础业务暴露给外部调用的接口
mogo-core-function-call-impl定义基础业务暴露给外部调用的接口调用实现

View File

@@ -1,9 +1,10 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.alibaba.arouter'
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
// buildToolsVersion rootProject.ext.android.buildToolsVersion
@@ -13,14 +14,16 @@ android {
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'
//ARouter apt
kapt {
useBuildCache = false
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}
buildTypes {
@@ -31,27 +34,20 @@ android {
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation rootProject.ext.dependencies.androidxccorektx
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.androidxconstraintlayout
implementation rootProject.ext.dependencies.arouter
kapt rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.rxjava
implementation rootProject.ext.dependencies.rxandroid
if (Boolean.valueOf(RELEASE)) {
compileOnly rootProject.ext.dependencies.modulecommon
} else {
compileOnly project(':modules:mogo-module-common')
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-function-api')
}
}

View File

@@ -0,0 +1,3 @@
GROUP=com.mogo.eagle.core
POM_ARTIFACT_ID=function-impl
VERSION_CODE=1

View 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.eagle.core.function.hmi">
</manifest>

View File

@@ -0,0 +1 @@
### 这里存放数据相关的class

View File

@@ -0,0 +1,49 @@
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
// 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")
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
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -0,0 +1,3 @@
GROUP=com.mogo.eagle.core
POM_ARTIFACT_ID=data
VERSION_CODE=1

View File

@@ -18,4 +18,4 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-renamesourcefileattribute SourceFile

View 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.mogo.module.data">
</manifest>

View File

@@ -0,0 +1,51 @@
package com.mogo.eagle.core.data.enums
/**
*@author xiaoyuzhou
*@date 2021/9/10 8:48 下午
*/
enum class WarningDirectionEnum(
var direction: Int,
var desc: String,
) {
ALERT_WARNING_NON(
0,
"关闭红色边框预警"
),
ALERT_WARNING_TOP(
1,
"正前方"
),
ALERT_WARNING_RIGHT(
2,
"正右边"
),
ALERT_WARNING_BOTTOM(
3,
"正后方"
),
ALERT_WARNING_LEFT(
4,
"正左方"
),
ALERT_WARNING_TOP_RIGHT(
5,
"右前方"
),
ALERT_WARNING_BOTTOM_RIGHT(
6,
"右后方"
),
ALERT_WARNING_BOTTOM_LEFT(
7,
"左后方"
),
ALERT_WARNING_TOP_LEFT(
8,
"左前方"
),
ALERT_WARNING_ALL(
9,
"周边"
)
}

View File

@@ -0,0 +1,44 @@
package com.mogo.eagle.core.data.model
/**
*@author xiaoyuzhou
*@date 2021/9/14 3:51 下午
*/
class V2XThreatIndInfo {
// /**
// * RV temperary vehicle ID
// */
// private val vehicle_id: String? = null
// /**
// * V2V threat status 0: update 1: add 2: delete
// * range(0..2)
// * [com.zhidao.support.obu.constants.ObuConstants.STATUS]
// */
// private val status = 0
//
// /**
// * RV threat information 目前判断RV方向使用的是 ext_info 中的 target_classification 变量
// */
// private val threat_info: V2vThreat? = null
//
// /**
// * 目前判断RV方向使用的是 ext_info 中的 target_classification 变量
// * The extension information of V2V threat
// */
// private val ext_info: V2vThreatExt? = null
//
// /**
// * RV basic information
// */
// private val basic_info: MovingObjectInfo? = null
// /**
// * Wgs84坐标系线性经纬度轨迹列表
// */
// private val locus_list: List<com.mogo.map.MogoLatLng>? = null
//
// /**
// * 高德坐标系Gcj线性经纬度轨迹列表
// */
// private val gd_locus_list: List<com.mogo.map.MogoLatLng>? = null
}

View File

@@ -0,0 +1,12 @@
### 模块说明
本模块定义业务层具备那些功能不提供具体业务实现所有具体业务实现均在mogo-core-function-impl模块中
adas--域控制器相关
chat--车聊聊相关
check--车辆检测相关
dispatch--车辆调度相关
hmi--UI这里承载的是所有鹰眼的UI展示
map--地图相关
notice--公告
obu--OBU预警逻辑相关
tts--语音播报&语音交互相关
v2x--车机端预警逻辑相关

View File

@@ -1,5 +1,10 @@
apply plugin: 'com.android.library'
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
// buildToolsVersion rootProject.ext.android.buildToolsVersion
@@ -12,11 +17,14 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
//ARouter apt
kapt {
useBuildCache = false
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
}
buildTypes {
@@ -35,15 +43,14 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.androidxconstraintlayout
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
implementation rootProject.ext.dependencies.arouter
annotationProcessor rootProject.ext.dependencies.aroutercompiler
kapt rootProject.ext.dependencies.aroutercompiler
if (Boolean.valueOf(RELEASE)) {
api rootProject.ext.dependencies.modulemain
} else {
api project(":modules:mogo-module-main")
implementation project(':core:mogo-core-data')
}
}

View File

@@ -0,0 +1,3 @@
GROUP=com.mogo.eagle.core
POM_ARTIFACT_ID=function-api
VERSION_CODE=1

View File

@@ -18,6 +18,4 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-keep class com.zhidao.mogo.module.splash.BydConst
#-renamesourcefileattribute SourceFile

View 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.eagle.core.function.api">
</manifest>

View File

@@ -0,0 +1,36 @@
package com.mogo.eagle.core.function.api.base
import android.content.Context
import android.os.Bundle
import android.util.Log
import androidx.fragment.app.Fragment
import com.alibaba.android.arouter.facade.template.IProvider
/**
* @author xiaoyuzhou
* @date 2021/9/16 4:40 下午
* 功能提供者基础
*/
interface IMoGoFunctionProvider : IProvider {
/**
* 创建图层如果功能需要在HMI单独创建新的图层才需要实现
*
* @param context 上下文
* @return 图层Fragment
*/
fun createCoverage(context: Context?, data: Bundle?): Fragment?
/**
* 功能模块唯一标识
*
* @return 功能模块名称
*/
val functionName: String
/**
* 功能销毁回调
*/
fun onDestroy() {
Log.d("IMoGoFunctionProvider", "onDestroy")
}
}

View File

@@ -1,13 +1,13 @@
package com.mogo.service.warning
package com.mogo.eagle.core.function.api.hmi.warning
import com.mogo.module.data.enums.WarningDirectionEnum
import com.mogo.service.module.IMogoModuleProvider
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider
/**
* @author xiaoyuzhou
* @date 2021/8/2 7:36 下午
*/
interface IMoGoWaringProvider : IMogoModuleProvider {
interface IMoGoWaringProvider : IMoGoFunctionProvider {
/**
* 展示VR下V2X预警
*
@@ -21,7 +21,7 @@ interface IMoGoWaringProvider : IMogoModuleProvider {
alertContent: String?,
ttsContent: String?,
tag: String?,
listener:WarningStatusListener?
listener: WarningStatusListener?
)
/**

View File

@@ -0,0 +1,10 @@
package com.mogo.eagle.core.function.api.hmi.warning
/**
* @author xiaoyuzhou
* @date 2021/9/13 4:41 下午
*/
interface WarningStatusListener {
fun onShow() {}
fun onDismiss() {}
}

View File

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

View File

@@ -1,9 +1,10 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.alibaba.arouter'
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
// buildToolsVersion rootProject.ext.android.buildToolsVersion
@@ -13,14 +14,16 @@ android {
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'
//ARouter apt
kapt {
useBuildCache = false
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}
buildTypes {
@@ -31,27 +34,21 @@ android {
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation rootProject.ext.dependencies.androidxccorektx
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.androidxconstraintlayout
implementation rootProject.ext.dependencies.arouter
kapt rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.rxjava
implementation rootProject.ext.dependencies.rxandroid
if (Boolean.valueOf(RELEASE)) {
compileOnly rootProject.ext.dependencies.modulecommon
} else {
compileOnly project(':modules:mogo-module-common')
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-function-api')
implementation project(':core:function-impl:mogo-core-function-hmi')
}
}

View File

@@ -0,0 +1,3 @@
GROUP=com.mogo.eagle.core
POM_ARTIFACT_ID=function-call-api
VERSION_CODE=1

View File

@@ -18,7 +18,4 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-----ModuleSplash-----
-keep class com.zhidao.mogo.module.splash.SplashConst.*{*;}
#-renamesourcefileattribute SourceFile

View 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.eagle.core.function.call.api">
</manifest>

View File

@@ -362,7 +362,7 @@ public class DebugConfig {
DebugConfig.isMapBased = isMapBased;
}
private static boolean isNeedLoadGuideModule = true;
private static boolean isNeedLoadGuideModule = false;
public static void setNeedLoadGuideModule(boolean isNeedLoadGuideModule) {
DebugConfig.isNeedLoadGuideModule = isNeedLoadGuideModule;

View File

@@ -1,2 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.utils" />
package="com.mogo.utils" >
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>

View File

@@ -4,11 +4,14 @@ import android.Manifest;
import android.annotation.TargetApi;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.wifi.WifiManager;
import android.os.BatteryManager;
import android.os.Build;
import android.provider.Settings;
import android.telephony.TelephonyManager;
@@ -19,6 +22,7 @@ import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
@@ -29,6 +33,7 @@ import java.net.NetworkInterface;
import java.net.SocketException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.text.DecimalFormat;
import java.util.Enumeration;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -39,20 +44,20 @@ public class CommonUtils {
private static String mCPUSerial = null;
private static boolean isMacSerialNoObtained = false;
private static boolean isCPUSerialNoObtained = false;
private static final Pattern VERSION_NAME_PATTERN = Pattern.compile( "(\\d+\\.\\d+\\.\\d+)\\-*.*" );
private static final Pattern VERSION_NAME_PATTERN = Pattern.compile("(\\d+\\.\\d+\\.\\d+)\\-*.*");
public static String getAndroidID( Context context ) {
if ( context == null ) {
public static String getAndroidID(Context context) {
if (context == null) {
return "";
}
return Settings.Secure.getString( context.getContentResolver(), "android_id" );
return Settings.Secure.getString(context.getContentResolver(), "android_id");
}
public static String getCPUSerialno() {
if ( !TextUtils.isEmpty( mCPUSerial ) ) {
if (!TextUtils.isEmpty(mCPUSerial)) {
return mCPUSerial;
} else if ( isCPUSerialNoObtained ) {
} else if (isCPUSerialNoObtained) {
mCPUSerial = "";
return mCPUSerial;
} else {
@@ -62,35 +67,35 @@ public class CommonUtils {
LineNumberReader input = null;
try {
isCPUSerialNoObtained = true;
Process ex = Runtime.getRuntime().exec( "cat /proc/cpuinfo" );
if ( ex == null ) {
Process ex = Runtime.getRuntime().exec("cat /proc/cpuinfo");
if (ex == null) {
return null;
}
ir = new InputStreamReader( ex.getInputStream() );
input = new LineNumberReader( ir );
ir = new InputStreamReader(ex.getInputStream());
input = new LineNumberReader(ir);
while ( null != str ) {
while (null != str) {
str = input.readLine();
if ( str != null ) {
if (str != null) {
mCPUSerial = str.trim();
break;
}
}
} catch ( IOException var4 ) {
} catch (IOException var4) {
var4.printStackTrace();
} finally {
if ( ir != null ) {
if (ir != null) {
try {
ir.close();
} catch ( IOException e ) {
} catch (IOException e) {
e.printStackTrace();
}
}
if ( input != null ) {
if (input != null) {
try {
input.close();
} catch ( IOException e ) {
} catch (IOException e) {
e.printStackTrace();
}
}
@@ -100,20 +105,20 @@ public class CommonUtils {
}
}
public static int getVersionCode( Context context ) {
public static int getVersionCode(Context context) {
if ( context == null ) {
if (context == null) {
return 1;
}
String pkgName = context.getPackageName();
try {
PackageInfo e = context.getPackageManager().getPackageInfo( pkgName, 0 );
if ( e != null ) {
PackageInfo e = context.getPackageManager().getPackageInfo(pkgName, 0);
if (e != null) {
return e.versionCode;
}
} catch ( Exception var2 ) {
} catch (Exception var2) {
var2.printStackTrace();
}
@@ -122,9 +127,9 @@ public class CommonUtils {
public static String getMacSerialno() {
if ( !TextUtils.isEmpty( mMacSerial ) ) {
if (!TextUtils.isEmpty(mMacSerial)) {
return mMacSerial;
} else if ( isMacSerialNoObtained ) {
} else if (isMacSerialNoObtained) {
mMacSerial = "";
return mMacSerial;
} else {
@@ -134,35 +139,35 @@ public class CommonUtils {
LineNumberReader input = null;
try {
isMacSerialNoObtained = true;
Process ex = Runtime.getRuntime().exec( "cat /sys/class/net/wlan0/address" );
if ( ex == null ) {
Process ex = Runtime.getRuntime().exec("cat /sys/class/net/wlan0/address");
if (ex == null) {
return null;
}
ir = new InputStreamReader( ex.getInputStream() );
input = new LineNumberReader( ir );
ir = new InputStreamReader(ex.getInputStream());
input = new LineNumberReader(ir);
while ( null != str ) {
while (null != str) {
str = input.readLine();
if ( str != null ) {
if (str != null) {
mMacSerial = str.trim();
break;
}
}
} catch ( IOException var4 ) {
} catch (IOException var4) {
var4.printStackTrace();
} finally {
if ( ir != null ) {
if (ir != null) {
try {
ir.close();
} catch ( IOException e ) {
} catch (IOException e) {
e.printStackTrace();
}
}
if ( input != null ) {
if (input != null) {
try {
input.close();
} catch ( IOException e ) {
} catch (IOException e) {
e.printStackTrace();
}
}
@@ -177,27 +182,27 @@ public class CommonUtils {
*
* @return
*/
public static String getNetworkType( Context context ) {
public static String getNetworkType(Context context) {
String name = "UNKNOWN";
try {
ConnectivityManager connMgr = ( ConnectivityManager ) context.getSystemService( Context.CONNECTIVITY_SERVICE );
ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
if ( networkInfo != null ) {
if ( ConnectivityManager.TYPE_WIFI == networkInfo.getType() ) {
if (networkInfo != null) {
if (ConnectivityManager.TYPE_WIFI == networkInfo.getType()) {
return "WIFI";
}
}
TelephonyManager tm = ( TelephonyManager ) context.getSystemService( Context.TELEPHONY_SERVICE );
if ( tm == null ) {
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
if (tm == null) {
return name;
}
int type = tm.getNetworkType();
switch ( type ) {
switch (type) {
case TelephonyManager.NETWORK_TYPE_GPRS:
case TelephonyManager.NETWORK_TYPE_EDGE:
case TelephonyManager.NETWORK_TYPE_CDMA:
@@ -219,6 +224,8 @@ public class CommonUtils {
case TelephonyManager.NETWORK_TYPE_LTE:
name = "4G";
break;
// case TelephonyManager.NETWORK_TYPE_NR:
// name = "5G";
case TelephonyManager.NETWORK_TYPE_UNKNOWN:
name = "UNKNOWN";
break;
@@ -226,7 +233,7 @@ public class CommonUtils {
name = "UNKNOWN";
break;
}
} catch ( Exception e ) {
} catch (Exception e) {
}
return name;
@@ -237,14 +244,14 @@ public class CommonUtils {
*
* @return
*/
public static String getIMEI( Context context ) {
public static String getIMEI(Context context) {
try {
TelephonyManager telephonyManager = ( TelephonyManager ) context.getSystemService( Context.TELEPHONY_SERVICE );
if ( telephonyManager != null &&
ContextCompat.checkSelfPermission( context, Manifest.permission.READ_PHONE_STATE ) == PackageManager.PERMISSION_GRANTED ) {
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
if (telephonyManager != null &&
ContextCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) {
return telephonyManager.getDeviceId();
}
} catch ( Exception e ) {
} catch (Exception e) {
}
return "";
@@ -255,35 +262,35 @@ public class CommonUtils {
*
* @return
*/
public static String getIMSI( Context context ) {
public static String getIMSI(Context context) {
try {
TelephonyManager telephonyManager = ( TelephonyManager ) context.getSystemService( Context.TELEPHONY_SERVICE );
if ( telephonyManager != null &&
ActivityCompat.checkSelfPermission( context, Manifest.permission.READ_PHONE_STATE ) == PackageManager.PERMISSION_GRANTED ) {
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
if (telephonyManager != null &&
ActivityCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) {
return telephonyManager.getSubscriberId();
}
} catch ( Exception e ) {
} catch (Exception e) {
}
return "";
}
public static String checkSimState( Context context ) {
public static String checkSimState(Context context) {
String mString = "";
if ( context == null ) {
if (context == null) {
return mString;
}
TelephonyManager telephonyManager = ( TelephonyManager ) context.getSystemService( Context.TELEPHONY_SERVICE );
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
int simState = 0;
if ( telephonyManager != null ) {
if (telephonyManager != null) {
simState = telephonyManager.getSimState();
}
switch ( simState ) {
switch (simState) {
case TelephonyManager.SIM_STATE_ABSENT:
mString = "无卡";
@@ -323,14 +330,14 @@ public class CommonUtils {
/**
* 获取路由器Mac
*/
public static String getRouterMac( Context context ) {
public static String getRouterMac(Context context) {
if ( context == null ) {
if (context == null) {
return "";
}
WifiManager wifi = ( WifiManager ) context.getApplicationContext().getSystemService( Context.WIFI_SERVICE );
if ( wifi != null && wifi.getConnectionInfo() != null ) {
WifiManager wifi = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
if (wifi != null && wifi.getConnectionInfo() != null) {
return wifi.getConnectionInfo().getBSSID();
}
return "";
@@ -339,50 +346,50 @@ public class CommonUtils {
/**
* 获取wifi名字
*/
public static String getWifiName( Context context ) {
if ( context == null ) {
public static String getWifiName(Context context) {
if (context == null) {
return "";
}
WifiManager wifi = ( WifiManager ) context.getApplicationContext().getSystemService( Context.WIFI_SERVICE );
if ( wifi != null && wifi.getConnectionInfo() != null ) {
WifiManager wifi = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
if (wifi != null && wifi.getConnectionInfo() != null) {
return wifi.getConnectionInfo().getSSID();
}
return "";
}
public static String getMobileIP( Context ctx ) {
public static String getMobileIP(Context ctx) {
if ( ctx == null ) {
if (ctx == null) {
return "";
}
ConnectivityManager mConnectivityManager = ( ConnectivityManager ) ctx.getSystemService( Context.CONNECTIVITY_SERVICE );// 获取系统的连接服务
ConnectivityManager mConnectivityManager = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE);// 获取系统的连接服务
// 实例化mActiveNetInfo对象
NetworkInfo mActiveNetInfo = null;// 获取网络连接的信息
if ( mConnectivityManager != null ) {
if (mConnectivityManager != null) {
mActiveNetInfo = mConnectivityManager.getActiveNetworkInfo();
}
if ( mActiveNetInfo == null ) {
if (mActiveNetInfo == null) {
return "";
} else {
return getIp( mActiveNetInfo );
return getIp(mActiveNetInfo);
}
}
// 显示IP信息
private static String getIp( NetworkInfo mActiveNetInfo ) {
private static String getIp(NetworkInfo mActiveNetInfo) {
if ( mActiveNetInfo == null ) {
if (mActiveNetInfo == null) {
return "";
}
// 如果是WIFI网络
if ( mActiveNetInfo.getType() == ConnectivityManager.TYPE_WIFI ) {
if (mActiveNetInfo.getType() == ConnectivityManager.TYPE_WIFI) {
return getLocalIPAddress();
}
// 如果是手机网络
else if ( mActiveNetInfo.getType() == ConnectivityManager.TYPE_MOBILE ) {
else if (mActiveNetInfo.getType() == ConnectivityManager.TYPE_MOBILE) {
return getLocalIPAddress();
} else {
return "";
@@ -393,16 +400,16 @@ public class CommonUtils {
// 获取本地IP函数
private static String getLocalIPAddress() {
try {
Enumeration< NetworkInterface > mEnumeration = NetworkInterface.getNetworkInterfaces();
if ( mEnumeration != null ) {
while ( mEnumeration.hasMoreElements() ) {
Enumeration<NetworkInterface> mEnumeration = NetworkInterface.getNetworkInterfaces();
if (mEnumeration != null) {
while (mEnumeration.hasMoreElements()) {
NetworkInterface intf = mEnumeration.nextElement();
if ( intf != null && intf.getInetAddresses() != null ) {
Enumeration< InetAddress > enumIPAddr = intf.getInetAddresses();
while ( enumIPAddr.hasMoreElements() ) {
if (intf != null && intf.getInetAddresses() != null) {
Enumeration<InetAddress> enumIPAddr = intf.getInetAddresses();
while (enumIPAddr.hasMoreElements()) {
InetAddress inetAddress = enumIPAddr.nextElement();
// 如果不是回环地址
if ( inetAddress != null && !inetAddress.isLoopbackAddress() ) {
if (inetAddress != null && !inetAddress.isLoopbackAddress()) {
// 直接返回本地IP地址
return inetAddress.getHostAddress();
}
@@ -410,124 +417,124 @@ public class CommonUtils {
}
}
}
} catch ( SocketException ex ) {
} catch (SocketException ex) {
ex.printStackTrace();
}
return "";
}
public static String getVersionName( Context context ) {
return getVersionName( context, true );
public static String getVersionName(Context context) {
return getVersionName(context, true);
}
public static String getVersionName( Context context, boolean fullVersionName ) {
public static String getVersionName(Context context, boolean fullVersionName) {
String appVersion = "";
try {
String packageName = context.getApplicationInfo().packageName;
appVersion = context.getPackageManager().getPackageInfo( packageName, 0 ).versionName;
if ( !fullVersionName && appVersion != null && appVersion.length() > 0 ) {
Matcher matcher = VERSION_NAME_PATTERN.matcher( appVersion );
if ( matcher.matches() ) {
appVersion = matcher.group( 1 );
appVersion = context.getPackageManager().getPackageInfo(packageName, 0).versionName;
if (!fullVersionName && appVersion != null && appVersion.length() > 0) {
Matcher matcher = VERSION_NAME_PATTERN.matcher(appVersion);
if (matcher.matches()) {
appVersion = matcher.group(1);
}
}
} catch ( Exception e ) {
} catch (Exception e) {
e.printStackTrace();
}
return appVersion;
}
public static String getAppName( Context context ) {
if ( context == null ) {
public static String getAppName(Context context) {
if (context == null) {
return "";
}
PackageManager pm = context.getPackageManager();
return context.getApplicationInfo().loadLabel( pm ).toString();
return context.getApplicationInfo().loadLabel(pm).toString();
}
public static String getModel() {
String temp = Build.MODEL;
return TextUtils.isEmpty( temp ) ? "" : temp;
return TextUtils.isEmpty(temp) ? "" : temp;
}
@TargetApi( Build.VERSION_CODES.JELLY_BEAN )
public static long getLeftMemory( Context context ) {
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public static long getLeftMemory(Context context) {
if ( context == null ) {
if (context == null) {
return -1;
}
if ( Build.VERSION.SDK_INT >= 16 ) {
ActivityManager mActivityManager = ( ActivityManager ) context.getSystemService( Context.ACTIVITY_SERVICE );
if (Build.VERSION.SDK_INT >= 16) {
ActivityManager mActivityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
mActivityManager.getMemoryInfo( mi );
return ( mi.totalMem - mi.availMem ) / 1000;
mActivityManager.getMemoryInfo(mi);
return (mi.totalMem - mi.availMem) / 1000;
}
return -1;
}
public static String encode( String string ) {
public static String encode(String string) {
try {
return URLEncoder.encode( string, "UTF-8" );
} catch ( UnsupportedEncodingException e ) {
return URLEncoder.encode(string, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return "";
}
}
public static String decode( String string ) {
public static String decode(String string) {
try {
return URLDecoder.decode( string, "UTF-8" );
} catch ( UnsupportedEncodingException e ) {
return URLDecoder.decode(string, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return "";
}
}
public static String getProcessName( Context context, int pid ) {
public static String getProcessName(Context context, int pid) {
try {
ActivityManager manager = ( ActivityManager ) context.getSystemService( Context.ACTIVITY_SERVICE );
for ( ActivityManager.RunningAppProcessInfo processInfo : manager.getRunningAppProcesses() ) {
if ( processInfo.pid == pid ) {
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
for (ActivityManager.RunningAppProcessInfo processInfo : manager.getRunningAppProcesses()) {
if (processInfo.pid == pid) {
return processInfo.processName;
}
}
} catch ( Exception e ) {
} catch (Exception e) {
}
return "";
}
public static int getStatusBarHeight( Context context ) {
public static int getStatusBarHeight(Context context) {
if ( context == null ) {
if (context == null) {
return 0;
}
int statusBarHeight = 0;
try {
Class c = Class.forName( "com.android.internal.R$dimen" );
Class c = Class.forName("com.android.internal.R$dimen");
Object obj = c.newInstance();
Field field = c.getField( "status_bar_height" );
int x = Integer.parseInt( field.get( obj ).toString() );
statusBarHeight = context.getResources().getDimensionPixelSize( x );
} catch ( Exception e ) {
Field field = c.getField("status_bar_height");
int x = Integer.parseInt(field.get(obj).toString());
statusBarHeight = context.getResources().getDimensionPixelSize(x);
} catch (Exception e) {
}
if ( statusBarHeight > 0 ) {
if (statusBarHeight > 0) {
return statusBarHeight;
}
try {
int resourceId = context.getResources().getIdentifier( "status_bar_height", "dimen", "android" );
if ( resourceId > 0 ) {
statusBarHeight = context.getResources().getDimensionPixelSize( resourceId );
int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
statusBarHeight = context.getResources().getDimensionPixelSize(resourceId);
}
} catch ( Exception e ) {
} catch (Exception e) {
}
@@ -541,13 +548,13 @@ public class CommonUtils {
* @param packageName 包名,如果为空,将获取 context 本身的版本名称
* @return
*/
public static String getVersionName( @NonNull Context context, @Nullable String packageName ) {
public static String getVersionName(@NonNull Context context, @Nullable String packageName) {
try {
packageName = TextUtils.isEmpty( packageName ) ? context.getPackageName() : packageName;
packageName = TextUtils.isEmpty(packageName) ? context.getPackageName() : packageName;
PackageManager packageManager = context.getPackageManager();
PackageInfo packInfo = packageManager.getPackageInfo( packageName, 0 );
PackageInfo packInfo = packageManager.getPackageInfo(packageName, 0);
return packInfo.versionName;
} catch ( Exception e ) {
} catch (Exception e) {
return "";
}
}
@@ -559,15 +566,124 @@ public class CommonUtils {
* @param packageName 包名,如果为空,将获取 context 本身的版本号
* @return
*/
public static int getVersionCode( @NonNull Context context, @Nullable String packageName ) {
public static int getVersionCode(@NonNull Context context, @Nullable String packageName) {
try {
packageName = TextUtils.isEmpty( packageName ) ? context.getPackageName() : packageName;
packageName = TextUtils.isEmpty(packageName) ? context.getPackageName() : packageName;
PackageManager packageManager = context.getPackageManager();
PackageInfo packInfo = packageManager.getPackageInfo( packageName, 0 );
PackageInfo packInfo = packageManager.getPackageInfo(packageName, 0);
return packInfo.versionCode;
} catch ( Exception e ) {
} catch (Exception e) {
return 0;
}
}
/**
* cpu
*/
public static double getCPU(String packageName) {
double Cpu = 0;
try {
Runtime runtime = Runtime.getRuntime();
Process proc = runtime.exec("adb shell top -n 1| grep " + packageName);
try {
if (proc.waitFor() != 0) {
System.err.println("exit value = " + proc.exitValue());
}
BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
StringBuffer stringBuffer = new StringBuffer();
String line = null;
while ((line = in.readLine()) != null) {
stringBuffer.append(line + " ");
}
String str1 = stringBuffer.toString();
String str3 = str1.substring(str1.indexOf(packageName) - 43, str1.indexOf(packageName)).trim();
String cpu = str3.substring(0, 2);
cpu = cpu.trim();
Cpu = Double.parseDouble(cpu);
} catch (InterruptedException e) {
System.err.println(e);
} finally {
try {
proc.destroy();
} catch (Exception e2) {
}
}
} catch (Exception StringIndexOutOfBoundsException) {
System.out.println("请检查设备是否连接");
}
return Cpu;
}
/**
* 电量
*/
public static float getBattery(Context context) {
IntentFilter filter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
Intent batteryStatus = context.registerReceiver(null, filter);
//当前剩余电量
int level = batteryStatus.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);
//电量最大值
int scale = batteryStatus.getIntExtra(BatteryManager.EXTRA_SCALE, -1);
//电量百分比
float batteryPct = level / (float) scale;
return batteryPct;
}
/**
* 内存占比
*
* @param packageName 包名
* @return
*/
public static double getMemory(String packageName) {
double Heap = 0;
try {
Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec("adb shell dumpsys meminfo " + packageName);
try {
if (process.waitFor() != 0) {
System.err.println("exit value = " + process.exitValue());
}
BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
StringBuffer stringBuffer = new StringBuffer();
String line = null;
while ((line = in.readLine()) != null) {
stringBuffer.append(line + " ");
}
String str1 = stringBuffer.toString();
String str2 = str1.substring(str1.indexOf("Objects") - 60, str1.indexOf("Objects"));
String str3 = str2.substring(0, 10);
str3 = str3.trim();
Heap = Double.parseDouble(str3) / 1024;
DecimalFormat df = new DecimalFormat("#.000");
String memory = df.format(Heap);
Heap = Double.parseDouble(memory);
} catch (InterruptedException e) {
System.err.println(e);
} finally {
try {
process.destroy();
} catch (Exception e2) {
}
}
} catch (Exception StringIndexOutOfBoundsException) {
System.out.print("请检查设备是否连接");
}
return Heap;
}
}

View File

@@ -0,0 +1,134 @@
package com.mogo.utils.network.utils;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.telephony.PhoneStateListener;
import android.telephony.SignalStrength;
import android.telephony.TelephonyManager;
import android.util.Log;
import com.mogo.utils.CommonUtils;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/**
* @author liujing
* @description 网络状态监听
* @since: 7/29/21
*/
public class NetworkStatusUtil {
private static PhoneStatListener phoneStatListener;
private static int mSignalStrength;
private static SignalStrength signal;
private static NetWorkStatus netWorkStatus1 = new NetWorkStatus();
/**
* 监听网络强度
*/
public static NetWorkStatus networkState(Context context) {
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo info = connectivityManager.getActiveNetworkInfo();
String netWorkStatus = CommonUtils.getNetworkType(context);
netWorkStatus1.status = netWorkStatus;
if (info != null && info.isAvailable()) {
netWorkStatus1.status = netWorkStatus;
switch (info.getType()) {
case ConnectivityManager.TYPE_WIFI:
//wifi
WifiManager manager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
WifiInfo connectionInfo = manager.getConnectionInfo();
mSignalStrength = connectionInfo.getRssi();
if (mSignalStrength > -90) {
Log.e("CheckActivity", "getNetWorkInfo: 信号强度强");
} else {
Log.e("CheckActivity", "getNetWorkInfo: 信号强度弱");
}
netWorkStatus1.mSignalStrength = mSignalStrength;
return netWorkStatus1;
case ConnectivityManager.TYPE_MOBILE:
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
if (telephonyManager == null) {
telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
}
if (phoneStatListener == null) {
phoneStatListener = new PhoneStatListener();
}
telephonyManager.listen(phoneStatListener, PhoneStatListener.LISTEN_SIGNAL_STRENGTHS);
//移动网络,可以通过TelephonyManager来获取具体细化的网络类型
if (netWorkStatus != "UNKNOWN") {
try {
if (signal == null) {
Log.e("CheckActivity", "getNetWorkInfo: signal为空");
break;
}
Method method = signal.getClass().getMethod("getDbm");
mSignalStrength = (int) method.invoke(signal);
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
} else {
if (signal == null) {
break;
}
mSignalStrength = signal.getGsmSignalStrength();
}
netWorkStatus1.mSignalStrength = mSignalStrength;
return netWorkStatus1;
}
} else {
return netWorkStatus1;
}
return netWorkStatus1;
}
/**
* 监听非WiFi网络信号强度变化
*/
static class PhoneStatListener extends PhoneStateListener {
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
//获取信号强度变化
super.onSignalStrengthsChanged(signalStrength);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
mSignalStrength = signalStrength.getLevel();
return;
}
mSignalStrength = signalStrength.getGsmSignalStrength();
}
}
static public class NetWorkStatus implements Serializable {
String status;
int mSignalStrength;
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public int getSignalStrength() {
return mSignalStrength;
}
public void setSignalStrength(int signalStrength) {
mSignalStrength = signalStrength;
}
}
}

View File

@@ -62,6 +62,7 @@ MOGO_SERVICE_VERSION=2.0.58
MOGO_SERVICE_API_VERSION=2.0.58
MOGO_CONNECTION_VERSION=2.0.58
MOGO_MODULE_APPS_VERSION=2.0.58
MOGO_MODULE_CHECK_VERSION=2.0.12
MOGO_MODULE_NAVI_VERSION=2.0.58
MOGO_MODULE_SHARE_VERSION=2.0.58
MOGO_MODULE_COMMON_VERSION=2.0.58

View File

@@ -357,9 +357,7 @@ public class AMapViewWrapper implements IMogoMapView,
// setUIMode(ui);
// break;
case Type_VR:
if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_LENOVO) {
mMapView.getMapAutoViewHelper().setScaleVRMode(true);
}
mMapView.getMapAutoViewHelper().setScaleVRMode(true);
mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_VR);
return;
// case Type_Light:

View File

@@ -94,15 +94,19 @@ class CustomMapApiBuilder implements IMogoMapApiBuilder {
@Override
public IMogoMapView getMapView( Context context ) {
Log.d(TAG,"setDebugMode==true");
NavAutoApi.INSTANCE.init( context, MapParams.Companion.init()
.setDebugMode( false )
// .setDataFileSource(1) //todo 1-使用本地地图数据0-使用在线地图数据
MapParams mapParams = MapParams.Companion.init();
mapParams.setDebugMode( false )
// .setDataFileSource(1) //todo 1-使用本地地图数据0-使用在线地图数据
.setCoordinateType( MapParams.COORDINATETYPE_GCJ02 )
.setPerspectiveMode( MapParams.MAP_PERSPECTIVE_2D )
// .setZoom( 20 )
// .setPointToCenter( 0.734375f, 0.5f )
// .setZoom( 20 )
// .setPointToCenter( 0.734375f, 0.5f )
.setPointToCenter( 0.5f, 0.5f ) //todo 2D模式下需要注意ADAS部分遮挡
.setStyleMode( MapParams.MAP_STYLE_VR ), NavParams.Companion.init() );
.setStyleMode( MapParams.MAP_STYLE_VR );
NavAutoApi.INSTANCE.init( context, mapParams, NavParams.Companion.init());
MapAutoView mapAutoView = new MapAutoView(context);
IMogoMapView mapView = new AMapViewWrapper(mapAutoView);
return mapView;

View File

@@ -0,0 +1,10 @@
package com.mogo.map.check;
/**
* @author liujing
* @description 监听指标发生变化, 通知首页检测入口处预警图标重新渲染
* @since: 8/26/21
*/
public interface IMogoCheckListener {
void updateMonitoringStatus(boolean hasError);
}

View File

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

View File

@@ -1,26 +0,0 @@
package com.zhidao.mogo.module.main.independent;
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.zhidao.mogo.module.main.independent.test", appContext.getPackageName());
}
}

View File

@@ -1,47 +0,0 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.zhidao.mogo.module.main.independent">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<application>
<activity
android:name=".MainIndependentActivity"
android:clearTaskOnLaunch="true"
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize"
android:enabled="true"
android:launchMode="singleTask"
android:resizeableActivity="false"
android:resumeWhilePausing="true"
android:screenOrientation="landscape"
android:stateNotNeeded="true"
android:hardwareAccelerated="true"
android:theme="@style/Main"
android:windowSoftInputMode="adjustPan|stateHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<data
android:host="launcher"
android:path="/main/switch2"
android:scheme="mogo" />
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<intent-filter>
<data
android:host="launcher"
android:path="/main/share"
android:scheme="mogo" />
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@@ -1,101 +0,0 @@
package com.zhidao.mogo.module.main.independent;
import android.Manifest;
import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.util.Log;
import android.view.View;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import com.mogo.module.common.map.CustomNaviInterrupter;
import com.mogo.module.main.MainActivity;
import com.mogo.utils.TipToast;
import com.mogo.utils.UiThreadHandler;
/**
* 针对独立应用形式,做单独定制
*
* @author tongchenfei
*/
public class MainIndependentActivity extends MainActivity {
private boolean isFirst = false;
@Override
protected void onCreate( @Nullable Bundle savedInstanceState ) {
super.onCreate( savedInstanceState );
// 独立app需要在onCreate里面增加处理scheme的情况
mPresenter.handleSchemeIntent( getIntent(), false );
}
@Override
protected void initViews() {
super.initViews();
// 控制层
FrameLayout.LayoutParams entranceParams = ( ( FrameLayout.LayoutParams ) mEntrance.getLayoutParams() );
entranceParams.leftMargin = getResources().getDimensionPixelSize( R.dimen.module_main_entrance_fragment_container_marginLeft );
mEntrance.setLayoutParams( entranceParams );
// 事件面板
FrameLayout.LayoutParams eventPanelParams = ( ( FrameLayout.LayoutParams ) mEventPanel.getLayoutParams() );
eventPanelParams.leftMargin = getResources().getDimensionPixelSize( R.dimen.module_main_entrance_fragment_container_marginLeft );
mEventPanel.setLayoutParams( eventPanelParams );
// 事件面板
FrameLayout.LayoutParams historyMessagePanelParams = ( ( FrameLayout.LayoutParams ) mEventPanel.getLayoutParams() );
historyMessagePanelParams.leftMargin = getResources().getDimensionPixelSize( R.dimen.module_main_entrance_fragment_container_marginLeft );
mHistoryMessagePanel.setLayoutParams( historyMessagePanelParams );
mLeftShadowFrame.setVisibility(View.INVISIBLE);
mApps.setVisibility( View.GONE );
}
@Override
protected void onResume() {
super.onResume();
if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.N){
fixInMultiWindowMode();
}
}
@TargetApi( Build.VERSION_CODES.N )
private void fixInMultiWindowMode(){
if ( isInMultiWindowMode() ) {
TipToast.shortTip( R.string.module_main_un_support_multi_window_mode );
}
}
@Override
protected void onPause() {
super.onPause();
}
@Override
protected boolean doWhenBackPressed() {
return exitCustomNaviIfNecessary();
}
private boolean exitCustomNaviIfNecessary() {
if ( CustomNaviInterrupter.getInstance().interrupt() ) {
return false;
}
if (mServiceApis.getMapServiceApi().getNavi(this).isNaviing()) {
mServiceApis.getMapServiceApi().getNavi( this ).stopNavi();
return true;
}
return false;
}
}

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="module_main_entrance_fragment_container_marginLeft">358px</dimen>
<dimen name="module_main_header_fragment_container_marginLeft">366px</dimen>
</resources>

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="module_main_entrance_fragment_container_marginLeft">358px</dimen>
<dimen name="module_main_header_fragment_container_marginLeft">366px</dimen>
</resources>

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="module_main_entrance_fragment_container_marginLeft">635px</dimen>
<dimen name="module_main_header_fragment_container_marginLeft">366px</dimen>
</resources>

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="module_main_entrance_fragment_container_marginLeft">358px</dimen>
<dimen name="module_main_header_fragment_container_marginLeft">366px</dimen>
</resources>

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="module_main_un_support_multi_window_mode">应用不支持分屏</string>
</resources>

View File

@@ -1,17 +0,0 @@
package com.zhidao.mogo.module.main.independent;
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);
}
}

View File

@@ -13,7 +13,7 @@
android:clearTaskOnLaunch="true"
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize"
android:enabled="true"
android:launchMode="singleTask"
android:launchMode="singleTop"
android:resizeableActivity="false"
android:resumeWhilePausing="true"
android:screenOrientation="landscape"

View File

@@ -1,30 +0,0 @@
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
*/
}

1
modules/mogo-module-check/.gitignore vendored Normal file
View File

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

View File

@@ -0,0 +1,37 @@
# 状态检测模块
硬件检测范围
主激光雷达
侧激光雷达-2个
ADAS长焦摄像头-前
ADAS广角摄像头-前
ADAS标准摄像头-前
ADAS广角摄像头-后
RTK设备
OUB设备
PAD
路由器
自动驾驶软件检测范围 节点
车控节点
轨迹地图加载节点
轨迹规划节点
定位转化节点
融合节点
yolov5节点包含红绿灯检测
激光雷达渲染节点
摄像头驱动节点
gnss定位驱动节点
中激光驱动节点
左激光解码节点
左激光驱动节点
右激光解码节点
右激光驱动节点
监控节点
通讯交互节点
轨迹录制节点
can车辆控制节点
鹰眼
版本更新
自动驾驶版本
鹰眼版本

View File

@@ -1,30 +1,25 @@
apply plugin: 'com.android.library'
apply plugin: 'com.alibaba.arouter'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.alibaba.arouter'
apply plugin: 'kotlin-kapt'
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() )
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
}
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}
buildTypes {
release {
minifyEnabled false
@@ -41,30 +36,38 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
implementation rootProject.ext.dependencies.androidxccorektx
implementation rootProject.ext.dependencies.coroutinescore
implementation rootProject.ext.dependencies.coroutinesandroid
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.androidxrecyclerview
implementation rootProject.ext.dependencies.androidxconstraintlayout
implementation rootProject.ext.dependencies.androidxviewpager2
implementation rootProject.ext.dependencies.arouter
kapt rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.indicator
implementation rootProject.ext.dependencies.callchatprovider
implementation rootProject.ext.dependencies.coroutinesandroid
implementation rootProject.ext.dependencies.coroutinescore
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
implementation 'com.google.android.material:material:1.2.1'
implementation project(':modules:mogo-module-common')
implementation project(path: ':modules:mogo-module-service')
annotationProcessor rootProject.ext.dependencies.aroutercompiler
if (Boolean.valueOf(RELEASE)) {
implementation rootProject.ext.dependencies.mogoutils
implementation rootProject.ext.dependencies.mogocommons
implementation rootProject.ext.dependencies.mogoserviceapi
implementation rootProject.ext.dependencies.mogomoduleauth
implementation rootProject.ext.dependencies.modulecommon
api rootProject.ext.dependencies.mogomap
api rootProject.ext.dependencies.mogomapapi
api rootProject.ext.dependencies.mogoutils
api rootProject.ext.dependencies.mogocommons
api rootProject.ext.dependencies.mogoserviceapi
} else {
implementation project(":foudations:mogo-utils")
implementation project(":foudations:mogo-commons")
implementation project(':services:mogo-service-api')
implementation project(':modules:mogo-module-authorize')
implementation project(":modules:mogo-module-common")
api project(":libraries:mogo-map")
api project(":libraries:mogo-map-api")
api project(":foudations:mogo-utils")
api project(":foudations:mogo-commons")
api project(':services:mogo-service-api')
}
implementation 'com.tencent.bugly:crashreport_upgrade:latest.release'
//latest.release指代最新Bugly SDK版本号2.1.9
implementation 'com.tencent.bugly:nativecrashreport:latest.release'
//latest.release指代最新Bugly NDK版本号3.0
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -1,3 +1,3 @@
GROUP=com.mogo.module
POM_ARTIFACT_ID=module-guide
POM_ARTIFACT_ID=module-check
VERSION_CODE=1

View File

@@ -18,18 +18,4 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-----MediaModule-----
-dontwarn com.mogo.module.media.**
-keep class com.mogo.module.media.listener.** { *; }
-keep class com.mogo.module.media.model.** { *; }
-keep class com.mogo.module.media.view.** { *; }
-keep class com.mogo.module.media.widget.** { *; }
-keep class com.mogo.module.media.api.** { *; }
-keep class com.mogo.module.media.constants.** { *; }
-keep class com.mogo.module.media.presenter.** { *; }
-keep class com.mogo.module.media.receiver.** { *; }
-keep class com.mogo.module.media.utils.OnBitmapToLocalListener
-keep class com.mogo.module.media.utils.OnCompressListener
-keep class com.mogo.module.media.MediaConstants
#-renamesourcefileattribute SourceFile

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.module.check">
<application>
<activity
android:name=".view.CheckActivity"
android:launchMode="singleTask"
android:screenOrientation="landscape" />
</application>
</manifest>

View File

@@ -0,0 +1,92 @@
package com.mogo.module.check;
import android.content.Context;
import android.util.Log;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.map.check.IMogoCheckListener;
import com.mogo.module.check.view.CheckActivity;
import com.mogo.service.check.ICheckProvider;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.v2x.IV2XWarningListener;
import com.mogo.utils.logger.Logger;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
/**
* 鹰眼系统、自动驾驶系统 检测模块
*
* @date 4/21/21 3:39 PM
* 需求地址
* wikihttp://wiki.zhidaohulian.com/pages/viewpage.action?pageId=58204952
*/
@Route(path = MogoServicePaths.PATH_CHECK)
public class VehicleMonitoringManager implements ICheckProvider {
private static final String TAG = "VehicleMonitoringManager";
private Context mContext;
private final Map<String, CopyOnWriteArrayList> mListeners = new ConcurrentHashMap<>();
@Override
public void init(Context context) {
Logger.d(TAG, "初始化 CheckProvider 模块");
mContext = context;
}
@Override
public void registerVehicleMonitoringListener(String module, IMogoCheckListener listener) {
if (listener == null || module == null) {
Log.d(TAG, "listener == null || intent == null");
return;
}
if (!mListeners.containsKey(module)) {
Log.d(TAG, "intent==" + module + "listener" + listener);
mListeners.put(module, new CopyOnWriteArrayList<>());
}
mListeners.get(module).add(listener);
}
@Override
public void unregisterListener(String module, IMogoCheckListener listener) {
if (mListeners.containsKey(module)) {
mListeners.get(module).remove(listener);
}
}
@Override
public void startCheckActivity(Context context) {
if (context != null) {
CheckActivity.start(context);
}
}
@Override
public void showCheckDialog(Context context) {
if (context != null) {
CheckActivity.showDialog(context);
}
}
@Override
public boolean checkMonitor(Context context) {
if (context != null) {
return CheckActivity.checkMonitor();
}
return false;
}
@Override
public void updateMonitoringStatus(String module, boolean hasError) {
List<IMogoCheckListener> listeners = mListeners.get(module);
if (listeners != null && !listeners.isEmpty()) {
for (IMogoCheckListener listener : listeners) {
if (listener != null) {
listener.updateMonitoringStatus(hasError);
}
}
}
}
}

View File

@@ -0,0 +1,19 @@
package com.mogo.module.check.api;
/**
* @author liujing
* @description 描述
* @since: 8/6/21
*/
public interface ICheckListener {
/**
* 工控机->鹰眼定位数据延时
*/
void getAutoLocationTimeCallbackDelayed(long time);
/**
* 工控机->鹰眼识别数据延时
*/
void getAutoDataCallbackDelayed(long time);
}

View File

@@ -0,0 +1,23 @@
package com.mogo.module.check.api;
/**
* @author xiaoyuzhou
* @date 2021/7/5 2:54 下午
* <p>
* 软件环境检测
* -----> 自动驾驶版本
* -----> 鹰眼版本
*/
public interface SoftCheckApi {
/**
* 检测「自动驾驶」版本
*/
void checkAutoPilotSoftVersion();
/**
* 检测「鹰眼」版本
*/
void checkEagleEyeSoftVersion();
}

View File

@@ -0,0 +1,135 @@
package com.mogo.module.check.model;
import com.tencent.bugly.proguard.A;
import java.io.Serializable;
import java.util.ArrayList;
/**
* @author liujing
* @description 描述
* @since: 7/28/21
*/
public class CheckItemInfo implements Serializable {
//view类型
private int style;
//view顶端标题
private String viewTitle;
//icon 下第一行title 自动驾驶软件\鹰眼系统
private String title;
private String value;
private ArrayList itemList;
//是否存在异常
private boolean usual;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public ArrayList getItemList() {
return itemList;
}
public void setItemList(ArrayList itemList) {
this.itemList = itemList;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public boolean isUsual() {
return usual;
}
public void setUsual(boolean usual) {
this.usual = usual;
}
public int getStyle() {
return style;
}
public void setStyle(int style) {
this.style = style;
}
public String getViewTitle() {
return viewTitle;
}
public void setViewTitle(String viewTitle) {
this.viewTitle = viewTitle;
}
@Override
public String toString() {
return "CheckItemInfo{" +
"style=" + style +
", viewTitle='" + viewTitle + '\'' +
", title='" + title + '\'' +
", value='" + value + '\'' +
", itemList=" + itemList +
", usual=" + usual +
'}';
}
public static class DetailItem implements Serializable {
private boolean usual;
private String title;
private String value;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public boolean isUsual() {
return usual;
}
public void setUsual(boolean usual) {
this.usual = usual;
}
@Override
public String toString() {
return "DetailItem{" +
"usual=" + usual +
", title='" + title + '\'' +
", value='" + value + '\'' +
'}';
}
}
public interface CheckAdapterStyleEnum {
int ITEM_TYPE_CHECK_TITLE = 0;
int ITEM_TYPE_CHECK_LIST = 1;
int ITEM_TYPE_CHECK_IMAGE = 2;
}
}

View File

@@ -0,0 +1,10 @@
package com.mogo.module.check.net;
/**
* @author liujing
* @description 描述
* @since: 8/13/21
*/
public class CheckApiServiceFactory {
}

View File

@@ -0,0 +1,17 @@
package com.mogo.module.check.net;
import android.database.Observable;
import java.util.Map;
import retrofit2.http.FieldMap;
import retrofit2.http.POST;
/**
* @author liujing
* @description 描述
* @since: 8/13/21
*/
public interface CheckApiServices {
@POST("/yycp-vehicle-management-service/monitor/reciveInfo")
Observable<CheckResultData> uploadCheckDetail(@FieldMap Map<String, String> param);
}

View File

@@ -0,0 +1,11 @@
package com.mogo.module.check.net;
import com.mogo.commons.data.BaseData;
/**
* @author liujing
* @description 描述
* @since: 8/13/21
*/
public class CheckResultData extends BaseData {
}

View File

@@ -0,0 +1,581 @@
package com.mogo.module.check.view;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Rect;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;
import com.mogo.commons.voice.AIAssist;
import com.mogo.map.check.IMogoCheckListener;
import com.mogo.module.check.R;
import com.mogo.module.check.model.CheckItemInfo;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.view.ImageViewClipBounds;
import com.mogo.module.common.view.SpacesItemDecoration;
import com.mogo.module.service.receiver.MogoReceiver;
import com.mogo.utils.CommonUtils;
import com.mogo.utils.network.utils.NetworkStatusUtil;
import com.tencent.bugly.beta.Beta;
import com.tencent.bugly.beta.UpgradeInfo;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
/**
* @author liujing
* @description 车辆监控页面
* @since: 7/27/21
*/
public class CheckActivity extends AppCompatActivity {
private static final String TAG = "CheckActivity";
private RecyclerView mRecyclerView;
private static ArrayList dataArrayList = new ArrayList();
private static Context context;
private static NetworkStatusUtil.NetWorkStatus sNetWorkStatus;
private ImageView mImageView;
private static String packageName = "com.mogo.launcher.f";
//车模
private ImageView scanBottomCarImage;
//扫描束
private ImageView scanLineImage;
//车辆模型顶部色值加深车模
private ImageViewClipBounds scanTopImageView;
//车模顶部小部件图片
private ImageViewClipBounds tipsImageView;
//动画组
private AnimatorSet setAnimation = null;
private ValueAnimator mValueAnimator;
private float movement = 1162f;
//进度条
private ProgressBar mProgressBar;
private final static long DURATION_TIME = 3000;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_check);
initView();
}
/**
* 列表View初始化
*/
public void initView() {
setAnimation = new AnimatorSet();
mImageView = findViewById(R.id.btnBack);
scanBottomCarImage = findViewById(R.id.scan_car_image);
scanLineImage = findViewById(R.id.scan_line_image);
scanTopImageView = findViewById(R.id.scan_car_top_image);
tipsImageView = findViewById(R.id.scan_car_tips);
mProgressBar = findViewById(R.id.check_progress);
context = mImageView.getContext();
packageName = getPackageName(context);
mImageView.setOnClickListener(v -> {
finish();
});
//检测动画
animation();
//版本检测 和系统检查放在第二期
// versionCheckResult();
// //系统检测
// systemCheckResult();
//软件检测
software();
//硬件检测
hardware();
//根据以上4个结果插入第一个元素(自动驾驶车辆是否存在风险)
topListTitle();
mRecyclerView = findViewById(R.id.check_list);
mRecyclerView.setAdapter(new CheckAdapter(context, dataArrayList));
CheckLinearLayout linearLayoutManager =
new CheckLinearLayout(this, CheckLinearLayout.VERTICAL, false);
mRecyclerView.addItemDecoration(new SpacesItemDecoration((int) getResources().getDimension(R.dimen.check_item_space_vr)));
mRecyclerView.setLayoutManager(linearLayoutManager);
}
/**
* 自动驾驶状态下指标监测
*/
public static boolean checkMonitor() {
dataArrayList.clear();
Log.d(TAG, "checkMonitor");
//版本检测
// versionCheckResult();
// //系统检测
// systemCheckResult();
//软件检测
software();
//硬件检测
hardware();
//根据以上4个结果插入第一个元素(自动驾驶车辆是否存在风险)
topListTitle();
MogoApisHandler.getInstance().getApis().getCheckProvider().updateMonitoringStatus(MogoReceiver.ACTION_CHECK_VEHICLE_MONITORING,false);
return true;
}
/**
* 自动驾驶是否存在风险
*/
private static void topListTitle() {
ArrayList list = new ArrayList(1);
CheckItemInfo info = new CheckItemInfo();
info.setUsual(false);
info.setTitle("自动驾驶车辆存在风险");
info.setStyle(CheckItemInfo.CheckAdapterStyleEnum.ITEM_TYPE_CHECK_TITLE);
list.add(info);
dataArrayList.add(0, list);
}
/**
* @param context
* @return 当前应用的版本名称
*/
public static synchronized String getPackageName(Context context) {
try {
PackageManager packageManager = context.getPackageManager();
PackageInfo packageInfo = packageManager.getPackageInfo(
context.getPackageName(), 0);
Log.d(TAG, "包名:" + packageInfo.packageName);
return packageInfo.packageName;
} catch (Exception e) {
e.printStackTrace();
}
return "com.mogo.launcher.f";
}
/**
* **************************************************************************************检测动画
*/
public void animation() {
ObjectAnimator animatorX = ObjectAnimator.ofFloat(scanLineImage, "translationX", scanBottomCarImage.getWidth(), 0);
ObjectAnimator animatorAl = ObjectAnimator.ofFloat(scanLineImage, "alpha", 0, 1);
setAnimation.playTogether(animatorX, animatorAl);
setAnimation.setDuration(800);
setAnimation.start();
setAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
if (scanTopImageView != null) {
movement = (float) scanTopImageView.getWidth();
scanLineImage.setVisibility(View.VISIBLE);
scanTopImageView.setVisibility(View.VISIBLE);
tipsImageView.setVisibility(View.VISIBLE);
}
if (scanLineImage != null) {
scanLineImage
.animate()
.translationX(movement)
.setDuration(DURATION_TIME)
.setListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
animatorScanCarBorder(true, scanTopImageView.getWidth());
}
@Override
public void onAnimationEnd(Animator animation) {
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
}).start();
}
}
});
}
/**
* 扫描动画:实现扫描束位移+顶部深色车模及检测元件的显示
*/
public void animatorScanCarBorder(boolean show, int weight) {
if (show) {
mValueAnimator = ValueAnimator.ofInt(0, weight);
} else {
}
mValueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
Rect rect = new Rect(0, 0, (int) mValueAnimator.getAnimatedValue(), scanTopImageView.getHeight());
setProgressBarRefresh((int) mValueAnimator.getAnimatedValue());
scanTopImageView.setClip(rect);
tipsImageView.setClip(rect);
}
});
mValueAnimator.setDuration(DURATION_TIME);
mValueAnimator.start();
}
/**
* 进度条状态刷新
*/
public void setProgressBarRefresh(int animateValue) {
if (mProgressBar != null) {
double scale = new BigDecimal((float) animateValue / scanBottomCarImage.getWidth())
.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
if (mProgressBar.getProgress() < 100) {
mProgressBar.setProgress((int) scale);
} else {
findViewById(R.id.animationLayout).setVisibility(View.GONE);
}
}
}
/**
* **************************************************************************************版本检测
*/
public static void versionCheckResult() {
ArrayList arrayVer = new ArrayList();
//adas 检测指标
//鹰眼当前版本
String verCodeStr = CommonUtils.getVersionName(context, true);
Log.d(TAG, "版本检测结果:鹰眼" + verCodeStr);
//测试数据
CheckItemInfo itemInfo = new CheckItemInfo();
itemInfo.setViewTitle("版本检测:");
itemInfo.setTitle("自动驾驶升级到\n 版本3.1.2.7");
if ("不是最新版本" != null) {
itemInfo.setUsual(false);
itemInfo.setValue("版本升级");
} else {
itemInfo.setUsual(true);
itemInfo.setValue("最新版本 无风险");
}
arrayVer.add(itemInfo);
CheckItemInfo yingyan = new CheckItemInfo();
UpgradeInfo upgradeInfo = Beta.getUpgradeInfo();
if (upgradeInfo == null) {
yingyan.setUsual(true);
yingyan.setTitle(" 鹰眼 \n版本" + verCodeStr);
yingyan.setValue("最新版本 无风险");
} else {
yingyan.setUsual(false);
yingyan.setTitle(" 鹰眼升级到 \n版本" + upgradeInfo.versionName);
yingyan.setValue("版本升级");
}
arrayVer.add(yingyan);
dataArrayList.add(arrayVer);
}
/**
* **************************************************************************************系统检测
*/
public static void systemCheckResult() {
ArrayList arrSys = new ArrayList();
//网络
netStatus();
//电量
float battery = CommonUtils.getBattery(context);
//cpu占比
double cpu = CommonUtils.getCPU(packageName);
//内存占比
double memory = CommonUtils.getMemory(packageName);
//风险状态
CheckItemInfo itemInfo = new CheckItemInfo();
itemInfo.setViewTitle("系统检测:");
itemInfo.setTitle("自动驾驶系统");
itemInfo.setUsual(false);
itemInfo.setValue("存在风险");
ArrayList list = new ArrayList();
//详细指标值
CheckItemInfo.DetailItem item = new CheckItemInfo.DetailItem();
item.setTitle("工控机链接状态");
item.setValue("断开");
list.add(item);
arrSys.add(itemInfo);
//鹰眼测试数据
CheckItemInfo yingyan = new CheckItemInfo();
yingyan.setTitle("鹰眼软件");
yingyan.setUsual(false);
yingyan.setValue("无风险");
CheckItemInfo.DetailItem netItem = new CheckItemInfo.DetailItem();
netItem.setTitle("网络状态");
netItem.setValue(String.valueOf(sNetWorkStatus.getSignalStrength()));
list.add(netItem);
CheckItemInfo.DetailItem batteryItem = new CheckItemInfo.DetailItem();
batteryItem.setTitle("电池状态");
batteryItem.setValue(String.valueOf(battery));
list.add(batteryItem);
CheckItemInfo.DetailItem cpuItem = new CheckItemInfo.DetailItem();
cpuItem.setTitle("CPU占比");
cpuItem.setValue(String.valueOf(cpu));
list.add(cpuItem);
CheckItemInfo.DetailItem memoryItem = new CheckItemInfo.DetailItem();
memoryItem.setTitle("内存占比");
memoryItem.setValue(String.valueOf(memory));
list.add(memoryItem);
yingyan.setItemList(list);
arrSys.add(yingyan);
dataArrayList.add(arrSys);
}
/**
* 网络
*/
public static NetworkStatusUtil.NetWorkStatus netStatus() {
//网络类型
sNetWorkStatus = NetworkStatusUtil.networkState(context);
//网络强度
if (sNetWorkStatus != null && sNetWorkStatus.getStatus() != null && sNetWorkStatus.getStatus() != "UNKNOWN") {
Log.d(TAG, "网络类型:" + sNetWorkStatus.getStatus() + "网络强度:" + sNetWorkStatus.getSignalStrength());
if (sNetWorkStatus.getSignalStrength() <= -90) {
AIAssist.getInstance(context).speakTTSVoice("网络信号差");
}
} else {
Log.d(TAG, "网络未连接");
AIAssist.getInstance(context).speakTTSVoice("网络未连接");
}
return sNetWorkStatus;
}
/**
* **************************************************************************************软件测试
* 自动驾驶侧:
* 1、车控节点
* <p>
* 2、轨迹地图加载节点
* <p>
* 3、轨迹规划节点
* <p>
* 4、定位转化节点
* <p>
* 5、融合节点
* <p>
* 6、yolov5节点包含红绿灯检测
* <p>
* 7、激光雷达渲染节点
* <p>
* 8、摄像头驱动节点
* <p>
* 9、gnss定位驱动节点
* <p>
* 10、中激光驱动节点
* <p>
* 11、左激光解码节点
* <p>
* 12、左激光驱动节点
* <p>
* 13、右激光解码节点
* <p>
* 14、右激光驱动节点
* <p>
* 15、监控节点
* <p>
* 16、通讯交互节点
* <p>
* 17、轨迹录制节点
* <p>
* 18、can车辆控制节点
* <p>
* 数据上报频率 什么数据的上报频率
* <p>
* 时延 工控机->云 工控机->鹰眼 什么数据的时延
*/
public static void software() {
ArrayList arrSoftware = new ArrayList();
CheckItemInfo itemInfo = new CheckItemInfo();
itemInfo.setViewTitle("软件检测:");
itemInfo.setTitle("自动驾驶系统");
itemInfo.setUsual(true);
itemInfo.setValue("无风险");
arrSoftware.add(itemInfo);
CheckItemInfo itemY = new CheckItemInfo();
itemY.setTitle("鹰眼软件");
itemY.setUsual(true);
itemY.setValue("无风险");
arrSoftware.add(itemY);
dataArrayList.add(arrSoftware);
time();
}
/**
* 时延
* 需要产品确认哪些指标? 定位+周边识别?
*/
public static long time() {
final long start = System.nanoTime();
long adasDataTime = TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start));
Log.i("ADAS数据延时", "接收数据 -> 发出 cost :" + adasDataTime + "ms");
return adasDataTime;
}
/**
* **************************************************************************************硬件测试
* 1、主激光雷达
* <p>
* 2、侧激光雷达-2个
* <p>
* 3、ADAS长焦摄像头-前
* <p>
* 4、ADAS广角摄像头-前
* <p>
* 5、ADAS标准摄像头-前
* <p>
* 6、ADAS广角摄像头-后
* <p>
* 7、RTK设备
* <p>
* 8、OBU设备
* <p>
* 9、路由器
*/
public static void hardware() {
ArrayList arrHardware = new ArrayList();
CheckItemInfo itemInfo = new CheckItemInfo();
itemInfo.setViewTitle("硬件检测:");
itemInfo.setTitle("自动驾驶系统");
itemInfo.setUsual(false);
ArrayList detailItem = new ArrayList();
CheckItemInfo.DetailItem padItem = new CheckItemInfo.DetailItem();
padItem.setTitle("Pad");
padItem.setValue("异常");
detailItem.add(padItem);
CheckItemInfo.DetailItem cameraTop = new CheckItemInfo.DetailItem();
cameraTop.setTitle("摄像头_top");
cameraTop.setValue("正常");
detailItem.add(cameraTop);
CheckItemInfo.DetailItem cameraMiddle = new CheckItemInfo.DetailItem();
cameraMiddle.setTitle("摄像头_Middle");
cameraMiddle.setValue("正常");
detailItem.add(cameraMiddle);
CheckItemInfo.DetailItem cameraBottom = new CheckItemInfo.DetailItem();
cameraBottom.setTitle("摄像头_Bottom");
cameraBottom.setValue("正常");
detailItem.add(cameraBottom);
CheckItemInfo.DetailItem zhuJiGuang = new CheckItemInfo.DetailItem();
zhuJiGuang.setTitle("主机光雷达");
zhuJiGuang.setValue("异常");
detailItem.add(zhuJiGuang);
CheckItemInfo.DetailItem jiGuangLeft = new CheckItemInfo.DetailItem();
jiGuangLeft.setTitle("左侧激光雷达");
jiGuangLeft.setValue("异常");
detailItem.add(jiGuangLeft);
CheckItemInfo.DetailItem jiGuangRight = new CheckItemInfo.DetailItem();
jiGuangRight.setTitle("右侧激光雷达");
jiGuangRight.setValue("正常");
detailItem.add(jiGuangRight);
CheckItemInfo.DetailItem changjiao = new CheckItemInfo.DetailItem();
changjiao.setTitle("ADAS长焦摄像头");
changjiao.setValue("正常");
detailItem.add(changjiao);
CheckItemInfo.DetailItem guangJiaoFront = new CheckItemInfo.DetailItem();
guangJiaoFront.setTitle("ADAS广焦摄像头-前");
guangJiaoFront.setValue("正常");
detailItem.add(guangJiaoFront);
CheckItemInfo.DetailItem custom = new CheckItemInfo.DetailItem();
custom.setTitle("ADAS标准摄像头");
custom.setValue("正常");
detailItem.add(custom);
CheckItemInfo.DetailItem guangJiaoBe = new CheckItemInfo.DetailItem();
guangJiaoBe.setTitle("ADAS广焦摄像头-后");
guangJiaoBe.setValue("正常");
detailItem.add(guangJiaoBe);
CheckItemInfo.DetailItem rtk = new CheckItemInfo.DetailItem();
rtk.setTitle("RTK设备");
rtk.setValue("正常");
detailItem.add(rtk);
CheckItemInfo.DetailItem obu = new CheckItemInfo.DetailItem();
obu.setTitle("OUB设备");
obu.setValue("正常");
detailItem.add(obu);
CheckItemInfo.DetailItem luyou = new CheckItemInfo.DetailItem();
luyou.setTitle("路由器");
luyou.setValue("正常");
detailItem.add(luyou);
itemInfo.setItemList(detailItem);
arrHardware.add(itemInfo);
dataArrayList.add(arrHardware);
}
/**
* 检测指标上报
*/
public void publishCheckDetail() {
// MogoApisHandler.getInstance().getApis().getNetworkApi().create(CheckApiServices.class,
// HostConst.DEVA_HOST).uploadCheckDetail().
}
public static void start(Context context) {
Intent starter = new Intent(context, CheckActivity.class);
context.startActivity(starter);
}
/**
* 指标异常弹框
*/
public static void showDialog(Context context) {
CheckDialog dialog = new CheckDialog(context, true);
dialog.show();
}
@Override
protected void onDestroy() {
super.onDestroy();
dataArrayList.clear();
}
@Override
protected void onPause() {
super.onPause();
}
}

View File

@@ -0,0 +1,241 @@
package com.mogo.module.check.view;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.mogo.module.check.R;
import com.mogo.module.check.model.CheckItemInfo;
import com.mogo.module.common.MogoApisHandler;
import com.tencent.bugly.proguard.A;
import java.util.ArrayList;
/**
* @author liujing
* @description 检测界面单元格
* @since: 7/27/21
*/
public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private static final String TAG = "CheckActivity";
LayoutInflater mLayoutInflater;
ArrayList dataArrayList;
private Context mContext;
public CheckAdapter(@NonNull Context context, @NonNull ArrayList checkArray) {
mContext = context;
mLayoutInflater = LayoutInflater.from(context);
dataArrayList = checkArray;
Log.d(TAG, dataArrayList.toString());
}
@Override
public int getItemViewType(int position) {
if (position == 0) {
return CheckItemInfo.CheckAdapterStyleEnum.ITEM_TYPE_CHECK_TITLE;
} else if (position == 1) {
return CheckItemInfo.CheckAdapterStyleEnum.ITEM_TYPE_CHECK_LIST;
}
return CheckItemInfo.CheckAdapterStyleEnum.ITEM_TYPE_CHECK_IMAGE;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
if (viewType == CheckItemInfo.CheckAdapterStyleEnum.ITEM_TYPE_CHECK_TITLE) {
View v = mLayoutInflater.inflate(R.layout.check_titel, parent,
false);
CheckTitleViewHolder holder = new CheckTitleViewHolder(v);
return holder;
}
if (viewType == CheckItemInfo.CheckAdapterStyleEnum.ITEM_TYPE_CHECK_IMAGE) {
View v = mLayoutInflater.inflate(R.layout.check_hardware, parent,
false);
CheckImage holder = new CheckImage(v);
return holder;
}
View v = mLayoutInflater.inflate(R.layout.check_list, parent,
false);
CheckListViewHolder holder = new CheckListViewHolder(v);
return holder;
}
/**
* 顶部view列表
*/
class CheckTitleViewHolder extends RecyclerView.ViewHolder {
private ImageView errorImage;
private TextView mTextView;
public CheckTitleViewHolder(@NonNull View itemView) {
super(itemView);
errorImage = itemView.findViewById(R.id.error_tip_image);
mTextView = itemView.findViewById(R.id.error_title);
}
}
/**
* 版本->软件检测
*/
class CheckListViewHolder extends RecyclerView.ViewHolder {
private TextView viewTitle;
private TextView iconAutoTitle;
private TextView autoRiskState;
private TextView iconyingTitle;
private TextView yingRiskState;
public CheckListViewHolder(@NonNull View itemView) {
super(itemView);
viewTitle = itemView.findViewById(R.id.list_item_title);
//自动驾驶
iconAutoTitle = itemView.findViewById(R.id.icon_auto_title);
autoRiskState = itemView.findViewById(R.id.auto_risk_state);
//鹰眼应用
iconyingTitle = itemView.findViewById(R.id.icon_ying_title);
yingRiskState = itemView.findViewById(R.id.ying_risk_state);
itemView.setLongClickable(true);
itemView.setOnLongClickListener(v -> {
Log.d(TAG, "长按显示状态工具栏");
Intent intent = new Intent();
intent.putExtra("oper", 52);
return true;
});
}
}
/**
* 硬件检测
*/
class CheckImage extends RecyclerView.ViewHolder {
private ImageView pad;
private ImageView jiaoJiGuangTop;
private TextView jiaoJiGuangTopText;
private ImageView jiaoJiGuangBottom;
private TextView jiaoJiGuangBottomText;
private ImageView zhuJiGuang;
private ImageView rtk;
private ImageView cameraTop;
private ImageView cameraMiddle;
private ImageView cameraBottom;
private ImageView cameraBehind;
private ImageView luyouqi;
private ImageView obu;
public CheckImage(@NonNull View itemView) {
super(itemView);
pad = itemView.findViewById(R.id.pad);
jiaoJiGuangTop = itemView.findViewById(R.id.jiaoJiGuangTop);
jiaoJiGuangTopText = itemView.findViewById(R.id.jiaoJiGuangTop_txt);
jiaoJiGuangBottom = itemView.findViewById(R.id.jiaoJiGuangBottom);
jiaoJiGuangBottomText = itemView.findViewById(R.id.jiaoJiGuangBottom_txt);
zhuJiGuang = itemView.findViewById(R.id.zhujiguang);
rtk = itemView.findViewById(R.id.rtk);
cameraTop = itemView.findViewById(R.id.top);
cameraMiddle = itemView.findViewById(R.id.middle);
cameraBottom = itemView.findViewById(R.id.bottom);
cameraBehind = itemView.findViewById(R.id.camera_begind);
luyouqi = itemView.findViewById(R.id.luyouqi);
obu = itemView.findViewById(R.id.obu);
}
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
try {
Object list = dataArrayList.get(position);
if (position == 0) {
if (list instanceof ArrayList && ((ArrayList) list).size() > 0) {
CheckItemInfo item = (CheckItemInfo) ((ArrayList) list).get(0);
((CheckTitleViewHolder) holder).mTextView.setText(item.getTitle());
if (item.isUsual() == true) {
((CheckTitleViewHolder) holder).errorImage.setImageResource(R.drawable.check_right);
} else {
((CheckTitleViewHolder) holder).errorImage.setImageResource(R.drawable.check_wrong);
}
}
} else if (position == dataArrayList.size() - 1) {
((CheckListViewHolder) holder).viewTitle.setText("硬件检测:");
if (list instanceof ArrayList) {
refreshHardware(holder, (ArrayList) list);
}
} else {
if (list instanceof ArrayList && ((ArrayList) list).size() > 1) {
CheckItemInfo item = (CheckItemInfo) ((ArrayList) list).get(0);
((CheckListViewHolder) holder).viewTitle.setText(item.getViewTitle());
//自动驾驶 状态展示
((CheckListViewHolder) holder).iconAutoTitle.setText(item.getTitle());
((CheckListViewHolder) holder).autoRiskState.setText(item.getValue());
if (item.isUsual() == true) {
((CheckListViewHolder) holder).autoRiskState.setTextColor(mContext.getResources().getColor(R.color.check_little_btn_green));
} else {
((CheckListViewHolder) holder).autoRiskState.setTextColor(mContext.getResources().getColor(R.color.check_tip_error_color));
}
if (position == 1) {
if (item.isUsual() == false) {
((CheckListViewHolder) holder).autoRiskState.setTextColor(mContext.getResources().getColor(R.color.modules_commons_toast_text_color));
((CheckListViewHolder) holder).autoRiskState.setBackground(mContext.getResources().getDrawable(R.drawable.check_detail));
((CheckListViewHolder) holder).autoRiskState.setOnClickListener(v -> {
Log.d(TAG, "点击自动驾驶升级");
});
} else {
((CheckListViewHolder) holder).autoRiskState.setTextColor(mContext.getResources().getColor(R.color.check_little_btn_green));
}
}
//鹰眼 状态展示
CheckItemInfo itemForYing = (CheckItemInfo) ((ArrayList) list).get(1);
((CheckListViewHolder) holder).iconyingTitle.setText(itemForYing.getTitle());
((CheckListViewHolder) holder).yingRiskState.setText(itemForYing.getValue());
if (itemForYing.isUsual() == true) {
((CheckListViewHolder) holder).yingRiskState.setTextColor(mContext.getResources().getColor(R.color.check_little_btn_green));
} else {
((CheckListViewHolder) holder).yingRiskState.setTextColor(mContext.getResources().getColor(R.color.check_tip_error_color));
}
if (position == 1) {
if (itemForYing.isUsual() == false) {
((CheckListViewHolder) holder).yingRiskState.setTextColor(mContext.getResources().getColor(R.color.modules_commons_toast_text_color));
((CheckListViewHolder) holder).yingRiskState.setBackground(mContext.getResources().getDrawable(R.drawable.check_detail));
((CheckListViewHolder) holder).yingRiskState.setOnClickListener(v -> {
Log.d(TAG, "点击鹰眼升级");
});
} else {
((CheckListViewHolder) holder).yingRiskState.setTextColor(mContext.getResources().getColor(R.color.check_little_btn_green));
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 硬件检测指标
*
* @param list
*/
public void refreshHardware(@NonNull RecyclerView.ViewHolder holder, ArrayList list) {
if (list.size() > 0) {
CheckItemInfo info = (CheckItemInfo) list.get(0);
}
}
@Override
public int getItemCount() {
return dataArrayList.size();
}
}

View File

@@ -0,0 +1,59 @@
package com.mogo.module.check.view;
import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import com.mogo.module.check.R;
import com.mogo.module.common.dialog.BaseFloatDialog;
/**
* @author liujing
* @description 车辆监控弹框提示
* @since: 7/30/21
*/
public class CheckDialog extends BaseFloatDialog {
private ImageView cancel;
private boolean showWarning;
public CheckDialog(@NonNull Context context, boolean hasError) {
super(context);
showWarning = hasError;
initView();
}
public CheckDialog(@NonNull Context context, int themeResId) {
super(context, themeResId);
}
public void initView() {
setContentView(R.layout.check_dialog);
cancel = findViewById(R.id.cancel_button);
cancel.setOnClickListener(v -> {
cancel();
});
//根据条件显示体检页面/风险提示
if (showWarning == true) {
findViewById(R.id.error_view).setVisibility(View.VISIBLE);
findViewById(R.id.check_view).setVisibility(View.INVISIBLE);
} else {
findViewById(R.id.error_view).setVisibility(View.INVISIBLE);
findViewById(R.id.check_view).setVisibility(View.VISIBLE);
}
}
public void cancel() {
super.dismiss();
}
@Override
public void dismiss() {
}
}

View File

@@ -0,0 +1,36 @@
package com.mogo.module.check.view;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
/**
* @author liujing
* @description 描述
* @since: 7/27/21
*/
class CheckLinearLayout extends LinearLayoutManager {
public CheckLinearLayout(Context context) {
super(context);
}
public CheckLinearLayout(Context context, int orientation, boolean reverseLayout) {
super(context, orientation, reverseLayout);
}
public CheckLinearLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
@Override
public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
try {
super.onLayoutChildren(recycler, state);
} catch (IndexOutOfBoundsException e) {
Log.d("CheckLinearLayout", "崩溃信息--" + e.toString());
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#bf000000" />
</shape>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#4192FF"/>
<corners android:radius="55px"/>
</shape>

View File

@@ -1,11 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="6px" />
<gradient
android:angle="180"
android:endColor="#ff3371f1"
android:startColor="#ff30a8f6"
android:type="linear"
android:useLevel="true" />
</shape>
android:endColor="#2B6EFF"
android:startColor="#3DCCFF" />
</shape>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#2B6EFF"/>
<corners android:radius="55px"/>
</shape>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#1E3282"/>
<corners android:radius="30px"/>
</shape>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="@dimen/dp_30" />
<gradient
android:angle="180"
android:endColor="@color/check_list_item_back"
android:startColor="@color/check_list_item_back"
android:type="linear" />
</shape>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size
android:width="@dimen/check_little_btn_width"
android:height="@dimen/check_little_btn_width" />
//填充
<solid android:color="@color/check_little_btn_solid" />
//描边
<stroke
android:width="2px"
android:color="@color/check_little_btn" />
</shape>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size
android:width="@dimen/check_little_btn_width"
android:height="@dimen/check_little_btn_width" />
//填充
<solid android:color="@color/check_little_btn_solid_green" />
//描边
<stroke
android:width="2px"
android:color="@color/check_little_btn_green" />
</shape>

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<corners android:radius="@dimen/dp_33" />
<solid android:color="#0B1030" />
</shape>
</item>
<item android:id="@android:id/progress">
<scale android:scaleWidth="100%">
<shape>
<corners android:radius="@dimen/dp_33" />
<solid android:color="#3DCCFF" />
<gradient
android:angle="180"
android:endColor="#2B6EFF"
android:startColor="#3DCCFF" />
</shape>
</scale>
</item>
<item android:id="@android:id/secondaryProgress">
<scale android:scaleWidth="100%">
<shape>
<corners android:radius="@dimen/dp_33" />
<solid android:color="#0B1030" />
</shape>
</scale>
</item>
</layer-list>

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 362 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 KiB

Some files were not shown because too many files have changed in this diff Show More