add devatools

This commit is contained in:
zhongchao
2021-12-22 19:21:53 +08:00
parent 311e5e0af1
commit a6cd4afc6e
14 changed files with 116 additions and 54 deletions

View File

@@ -184,7 +184,6 @@ dependencies {
implementation 'com.volcengine:apm_insight:1.4.4.cn'
implementation 'com.volcengine:apm_insight_crash:1.4.2'
implementation rootProject.ext.dependencies.mogologlib
compileOnly rootProject.ext.dependencies.adasapi
compileOnly rootProject.ext.dependencies.adasconfigapi

View File

@@ -222,6 +222,7 @@ ext {
//========================= 新架构的 Maven 版本管理 =========================
mogo_core_function_autopilot : "com.mogo.eagle.core.function.impl:autopilot:${MOGO_CORE_FUNCTION_AUTOPILOT_VERSION}",
mogo_core_function_check : "com.mogo.eagle.core.function.impl:check:${MOGO_CORE_FUNCTION_CHECK_VERSION}",
mogo_core_function_devatools : "com.mogo.eagle.core.function.impl:devatools:${MOGO_CORE_FUNCTION_CHECK_VERSION}",
mogo_core_function_hmi : "com.mogo.eagle.core.function.impl:hmi:${MOGO_CORE_FUNCTION_HMI_VERSION}",
mogo_core_function_map : "com.mogo.eagle.core.function.impl:map:${MOGO_CORE_FUNCTION_MAP_VERSION}",
mogo_core_function_main : "com.mogo.eagle.core.function.impl:main:${MOGO_CORE_FUNCTION_MAIN_VERSION}",

View File

@@ -1,13 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.zhjt.mogo_core_function_devatools">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Launcher" />
</manifest>

View File

@@ -4,11 +4,13 @@ import android.annotation.SuppressLint
import android.content.Context
import android.os.Handler
import android.os.Message
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.debug.DebugConfig
import com.mogo.eagle.core.function.call.devatools.CallDevaToolsListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.module.common.MogoApisHandler
import com.mogo.service.cloud.socket.IMogoOnMessageListener
import com.mogo.utils.logger.LogLevel
@@ -23,6 +25,7 @@ import com.zhjt.mogo_core_function_devatools.logcatch.MogoLogCatchConst.Companio
import com.zhjt.mogo_core_function_devatools.logcatch.MogoLogCatchConst.Companion.LOG_PUSH_TYPE
import com.zhjt.mogo_core_function_devatools.logcatch.MogoLogCatchConst.Companion.START_CATCH_LOG
import com.zhjt.mogo_core_function_devatools.logcatch.MogoLogCatchConst.Companion.STOP_CATCH_LOG
import java.io.File
@SuppressLint("StaticFieldLeak")
object MogoLogCatchManager : IMogoOnMessageListener<RemoteLogPushContent>, Handler.Callback,
@@ -45,7 +48,7 @@ object MogoLogCatchManager : IMogoOnMessageListener<RemoteLogPushContent>, Handl
.getSocketManagerApi(AbsMogoApplication.getApp().applicationContext)
.registerOnMessageListener(LOG_PUSH_TYPE, this)
manualContent.duration = 60
manualContent.pkgName = MANUAL_CATCH_PKG_NAME
manualContent.pkgName = context.packageName
}
override fun target(): Class<RemoteLogPushContent> {
@@ -70,7 +73,7 @@ object MogoLogCatchManager : IMogoOnMessageListener<RemoteLogPushContent>, Handl
override fun handleMessage(msg: Message): Boolean {
if (msg.what == MSG_TRY_CLOSE_LOG) {
CallDevaToolsListenerManager.invokeDevaToolsLogCatch()
CallerDevaToolsListenerManager.invokeDevaToolsLogCatchClose()
closeLoggerLevel()
return true
}
@@ -103,7 +106,10 @@ object MogoLogCatchManager : IMogoOnMessageListener<RemoteLogPushContent>, Handl
}
handler.sendEmptyMessageDelayed(MSG_TRY_CLOSE_LOG, delay)
openLoggerLevel()
logInfoManager = LogInfoManagerFactory.createPushLogInfoManager(mContext, content, this)
logInfoManager = LogInfoManagerFactory.createPushLogInfoManager(
mContext,
MoGoAiCloudClientConfig.getInstance().sn + File.separator + TimeUtils.formatYMD(System.currentTimeMillis()),
content, this)
logInfoManager?.start()
}
@@ -142,7 +148,7 @@ object MogoLogCatchManager : IMogoOnMessageListener<RemoteLogPushContent>, Handl
override fun onClose(pkgName: String?) {
ThreadUtils.runOnUiThread {
CallDevaToolsListenerManager.invokeDevaToolsLogCatch()
CallerDevaToolsListenerManager.invokeDevaToolsLogCatchClose()
TipToast.shortTip("日志抓取默认计时结束")
}
}

View File

@@ -18,11 +18,14 @@ import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.data.obu.ObuStatusInfo
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener
import com.mogo.eagle.core.function.api.obu.IMoGoObuStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.map.CallerHDMapManager
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager
@@ -50,11 +53,11 @@ import kotlinx.android.synthetic.main.view_debug_setting.view.*
* 展示 本机、网络、工控机、OBU等状态信息支持设置IP等参数进行调试
*/
class DebugSettingView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoObuStatusListener,
IMoGoAutopilotStatusListener, IMoGoAutopilotCarStateListener, IMoGoMapLocationListener {
IMoGoAutopilotStatusListener, IMoGoAutopilotCarStateListener, IMoGoMapLocationListener {
private val TAG = "DebugSettingView"
@@ -133,7 +136,7 @@ class DebugSettingView @JvmOverloads constructor(
tvObuInfo.text = CallerObuListenerManager.getObuStatusInfoJsonString()
tvAutopilotInfo.text =
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfoJsonString()
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfoJsonString()
// 初始化App 配置信息
val appConfigInfo = AppConfigInfo()
@@ -151,7 +154,7 @@ class DebugSettingView @JvmOverloads constructor(
// 初始化OBU IP信息
val ipAddress =
SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, "192.168.1.199")
SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, "192.168.1.199")
etObuIP.setText(ipAddress)
etObuIP.text?.let { etObuIP.setSelection(it.length) }
@@ -191,18 +194,18 @@ class DebugSettingView @JvmOverloads constructor(
// 初始化 GSP数据源 数据
rgGpsProvider.check(
when (FunctionBuildConfig.gpsProvider) {
0 -> {
R.id.rbGpsProviderAndroid
}
1 -> {
R.id.rbGpsProviderRTK
}
2 -> {
R.id.rbGpsProviderOBU
}
else -> R.id.rbGpsProviderAndroid
when (FunctionBuildConfig.gpsProvider) {
0 -> {
R.id.rbGpsProviderAndroid
}
1 -> {
R.id.rbGpsProviderRTK
}
2 -> {
R.id.rbGpsProviderOBU
}
else -> R.id.rbGpsProviderAndroid
}
)
rgGpsProvider.setOnCheckedChangeListener { group, checkedId ->
when (checkedId) {
@@ -220,14 +223,14 @@ class DebugSettingView @JvmOverloads constructor(
// 初始化 感知数据是否绘制 选择情况
rgIsDrawIdentifyData.check(
when (FunctionBuildConfig.isDrawIdentifyData) {
true -> {
R.id.rbDraw
}
false -> {
R.id.rbDoNotDraw
}
when (FunctionBuildConfig.isDrawIdentifyData) {
true -> {
R.id.rbDraw
}
false -> {
R.id.rbDoNotDraw
}
}
)
rgIsDrawIdentifyData.setOnCheckedChangeListener { group, checkedId ->
when (checkedId) {
@@ -303,6 +306,21 @@ class DebugSettingView @JvmOverloads constructor(
CallerSmpManager.showPanel()
}
}
tbLogCatch.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
CallerDevaToolsManager.startCatchLog()
} else {
CallerDevaToolsManager.stopCatchLog()
}
}
CallerDevaToolsListenerManager.registerDevaToolsLogCatchListener(TAG,
object : IMoGoDevaToolsListener {
override fun onLogCatchClose() {
super.onLogCatchClose()
tbLogCatch.isChecked = false
}
})
}
/**

View File

@@ -242,6 +242,16 @@
android:textOn="打开「ADAS」Log"
android:textSize="@dimen/dp_34" />
<ToggleButton
android:id="@+id/tbLogCatch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:gravity="center"
android:textOff="开始抓取全量日志"
android:textOn="停止抓取全量日志"
android:textSize="@dimen/dp_34" />
</com.google.android.flexbox.FlexboxLayout>
</LinearLayout>
<!--地图呈现数据源控制-->

View File

@@ -299,6 +299,9 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_GAODE_AIMLESS_SHARE, "GaoDeAimlessShare"));
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_MOGO_MONITOR, "MogoMonitor"));
//mogo deva tools
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_DEVA_TOOLS, "IMoGoDevaToolsProvider"));
// 域控制器模块(新)
MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_AUTO_PILOT, "IMoGoAutoPilotProvider"));
// OBU 模块

View File

@@ -121,12 +121,12 @@ class MogoTrafficLightManager : IMogoCarLocationChangedListener2 {
// 检测是否开过路口,开过路口则停止读灯。并重置 trafficLightResult 值为 null
if (trafficLightResult != null && it.isInRange(loc.latitude, loc.longitude)) {
inRange = true
Logger.d(TAG, "进入路口")
// Logger.d(TAG, "进入路口")
CallTrafficLightListenerManager.invokeEnterCrossRoad(true)
return
}
if (inRange) {
Logger.d(TAG, "离开路口")
// Logger.d(TAG, "离开路口")
CallTrafficLightListenerManager.invokeEnterCrossRoad(false)
inRange = false
trafficLightResult = null

View File

@@ -3,8 +3,6 @@ package com.mogo.eagle.core.function.v2x.trafficlight.core
import android.os.Handler
import android.os.Looper
import android.os.Message
import com.mogo.eagle.core.function.v2x.trafficlight.TrafficLightConst
import com.mogo.utils.logger.Logger
class TrafficLightThreadHandler : Handler {

View File

@@ -121,13 +121,6 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
this.result = trafficLightResult
if (!turnLightFirst) {
// 首次判断,变灯
turnLightFirst = true
val controlTime = if (currentResult!!.isGreen()) 45 - currentResult.remain else 45
Logger.d(TAG, "触发变灯 , controlTime : $controlTime")
turnLight(controlTime)
}
lastResult?.let {
//如果上次结果和本次灯态结果变化比较大则已变灯控制HMI展示弹窗
if (abs(currentResult!!.remain - it.remain) > 5) {
@@ -149,6 +142,15 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
}
}
if (!turnLightFirst) {
// 首次判断,变灯
turnLightFirst = true
val controlTime = if (currentResult!!.isGreen()) 45 - currentResult.remain else 45
Logger.d(TAG, "触发变灯 , controlTime : $controlTime")
turnLight(controlTime)
}
//可作为补偿措施,暂不启用
// mLocation?.let {
// if (canGetThroughCross(it, trafficLightResult)) {

View File

@@ -5,7 +5,7 @@ import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
import com.mogo.eagle.core.utilcode.util.LogUtils
import java.util.concurrent.ConcurrentHashMap
object CallDevaToolsListenerManager {
object CallerDevaToolsListenerManager {
private const val TAG = "CallDevaToolsListenerManager"
@@ -56,7 +56,7 @@ object CallDevaToolsListenerManager {
}
}
fun invokeDevaToolsLogCatch() {
fun invokeDevaToolsLogCatchClose() {
M_DEVA_TOOLS_LISTENER.forEach {
val listener = it.value
listener.onLogCatchClose()

View File

@@ -0,0 +1,26 @@
package com.mogo.eagle.core.function.call.devatools
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.eagle.core.data.constants.MogoServicePaths.PATH_DEVA_TOOLS
import com.mogo.eagle.core.function.api.devatools.IDevaToolsProvider
object CallerDevaToolsManager {
private val devaToolsProviderApi: IDevaToolsProvider
get() = ARouter.getInstance().build(PATH_DEVA_TOOLS)
.navigation() as IDevaToolsProvider
/**
* 开始抓取全量日志
*/
fun startCatchLog() {
devaToolsProviderApi.startLogCatch()
}
/**
* 停止抓取全量日志
*/
fun stopCatchLog() {
devaToolsProviderApi.stopLogCatch()
}
}

View File

@@ -55,6 +55,14 @@ public final class TimeUtils {
throw new UnsupportedOperationException("u can't instantiate me...");
}
@SuppressLint("SimpleDateFormat")
public static String formatYMD(long time){
Date date = new Date(time);
String strDateFormat = "yyyy-MM-dd";
SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat);
return sdf.format(date);
}
/**
* Milliseconds to the formatted time string.
* <p>The pattern is {@code yyyy-MM-dd HH:mm:ss}.</p>

View File

@@ -56,11 +56,11 @@ bytex.forbidUseLenientMutationDuringGetArtifact=true
bytex.verifyProguardConfigurationChanged=false
bytex.ASM_API=ASM7
HOOK_LOG_VERSION=1.4.90
HOOK_LOG_VERSION=1.4.94
SERVICE_CHAIN_VERSION=1.0.32
################ 外部依赖引用 ################
# loglib
LOGLIB_VERSION=1.1.4
LOGLIB_VERSION=1.1.6
######## MogoAiCloudSDK Version ########
# 网络请求
MOGO_NETWORK_VERSION=1.3.13