fix bug of sn null problem which influence the fw log and telemetics cloud connect , plus close the v2x log

This commit is contained in:
zhongchao
2022-07-21 15:05:50 +08:00
parent 3d2202a927
commit 27356390fc
7 changed files with 123 additions and 27 deletions

View File

@@ -28,6 +28,7 @@ import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_CL
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_CONNECT_STATUS
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.call.analytics.AnalyticsManager
import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
@@ -38,8 +39,7 @@ import com.mogo.eagle.core.utilcode.util.ThreadPoolService
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.module.common.constants.HostConst
import com.rousetime.android_startup.AndroidStartup
import com.zhjt.mogo_core_function_devatools.env.*
import com.zhjt.mogo_core_function_devatools.env.EnvChangeManager.EnvConfig
import com.zhjt.mogo_core_function_devatools.env.EnvChangeManager
import com.zhjt.service.chain.ChainLog
import com.zhjt.service.chain.TracingConstants.Endpoint.Companion.PAD
@@ -64,7 +64,10 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
override fun waitOnMainThread() = false
override fun dependenciesByName(): List<String> {
return listOf("com.mogo.launcher.stageone.APMStartup", "com.mogo.launcher.stageone.ConfigStartUp")
return listOf(
"com.mogo.launcher.stageone.APMStartup",
"com.mogo.launcher.stageone.ConfigStartUp"
)
}
override fun create(context: Context): Boolean {
@@ -183,6 +186,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
override fun onTokenGot(token: String, sn: String) {
CallerLogger.d(SceneConstant.M_HMI + TAG, "onTokenGot ")
clientConfig.token = token
CallerCloudListenerManager.invokeCloudTokenGot(token)
// 异步初始化NetConfig
asyncInit()
// HttpDns ttl回调 --- socketTTL
@@ -264,8 +268,9 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
private fun startSocketService() {
CallerLogger.d(SceneConstant.M_HMI + TAG, "startSocketService")
val location = CallerMapUIServiceManager.getSingletonLocationClient(AbsMogoApplication.getApp())!!
.lastKnowLocation
val location =
CallerMapUIServiceManager.getSingletonLocationClient(AbsMogoApplication.getApp())!!
.lastKnowLocation
// 关闭长链服务
MogoAiCloudSocketManager.getInstance(context).destroy()
MogoAiCloudSocketManager.getInstance(context)

View File

@@ -1,14 +1,17 @@
package com.mogo.eagle.core.function.autopilot.adapter
import android.annotation.SuppressLint
import android.util.Log
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.commons.debug.DebugConfig
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.cloud.IMoGoCloudListener
import com.mogo.eagle.core.function.autopilot.network.AdasServiceModel
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.cloud.CallerCloudListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_ADAS_IMPL
import com.mogo.eagle.core.utilcode.util.ToastUtils
@@ -26,7 +29,7 @@ import java.util.concurrent.TimeUnit
* ADAS-SDK与工控机连接状态回调
*/
class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
IMoGoAutopilotStatusListener {
IMoGoAutopilotStatusListener, IMoGoCloudListener {
private val TAG = "ConnectStatus"
//自动驾驶状态
@@ -37,8 +40,15 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
private var connectStatus = false
init {
CallerCloudListenerManager.registerCloudListener(TAG, this)
}
override fun onConnectionIPCStatus(ipcConnectionStatus: Int, reason: String?) {
CallerAutoPilotStatusListenerManager.invokeAutoPilotIPCStatusChanged(ipcConnectionStatus, reason)
CallerAutoPilotStatusListenerManager.invokeAutoPilotIPCStatusChanged(
ipcConnectionStatus,
reason
)
if (ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTED) {
CallerLogger.d("$M_ADAS_IMPL$TAG", "webSocket 连接成功")
connectStatus = true
@@ -55,7 +65,7 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
//每次工控机连接成功后,需同步当前设置的美化模式状态
CallerAutoPilotManager.setDemoMode(FunctionBuildConfig.isDemoMode)
//当连接状态是关闭美化模式时,同步给工控机
if(!FunctionBuildConfig.isDemoMode){
if (!FunctionBuildConfig.isDemoMode) {
CallerAutoPilotManager.setIPCDemoMode(FunctionBuildConfig.isDemoMode)
}
//每次工控机连接成功后,需同步当前设置的雨天模式状态
@@ -85,8 +95,9 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
} else if (ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.NOT_FOUND_ADDRESS) {
CallerLogger.d("$M_ADAS_IMPL$TAG", "webSocket 找不到可用IP 传入的IP不可用或固定IP列表中所有IP不可用")
}
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().ipcConnStatus = ipcConnectionStatus
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectStatusDescribe=reason
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().ipcConnStatus =
ipcConnectionStatus
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectStatusDescribe = reason
CallerAutoPilotStatusListenerManager.invokeAutoPilotStatus()
}
@@ -119,7 +130,7 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
/**
* 同步SN信息给工控机
*/
private fun syncBasicInfoToAutopilot() {
private fun syncBasicInfoToAutopilot(sn: String? = null) {
CallerLogger.d("$M_ADAS_IMPL$TAG", "同步PAD的SN给工控机……")
// 设置PAD-SN给工控,网络环境
AdasManager.getInstance()
@@ -142,5 +153,9 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
}
}
override fun tokenGot(sn: String) {
Log.d("arrow-721","tokenGot adas sn : $sn")
syncBasicInfoToAutopilot(sn)
}
}

View File

@@ -1,13 +1,14 @@
package com.zhjt.mogo_core_function_devatools.trace
import android.content.Context
import android.util.Log
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.deva.chain.ChainLogParam
import com.mogo.eagle.core.function.api.cloud.IMoGoCloudListener
import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.LogLevel
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
import com.mogo.eagle.core.utilcode.util.DeviceUtils
import com.mogo.eagle.core.utilcode.util.Utils
@@ -15,7 +16,7 @@ import com.zhidao.loglib.fw.FileWriteManager
import com.zhidao.loglib.fw.FwBuild
import com.zhjt.service.chain.core.ChainTraceStarter
class TraceManager {
class TraceManager : IMoGoCloudListener {
private val traceInfoCache = hashMapOf<Int, ChainLogParam>()
private val fwBuildMap: MutableMap<Int, FwBuild> = HashMap()
@@ -33,24 +34,25 @@ class TraceManager {
// 初始化Trace抓取服务
val pkgName = Utils.getApp().packageName
ChainTraceStarter.start(pkgName, DeviceUtils.getMacAddress(), false)
CallerCloudListenerManager.registerCloudListener(TAG, this)
// Trace过程中进行日志抓取对日志进行配置
fwBuildMap[ChainConstant.CHAIN_LINK_LOG_CONNECT_STATUS] =
FwBuild(true, -1,pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_INIT)
FwBuild(true, -1, pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_INIT)
fwBuildMap[ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_GNSSINFO] =
FwBuild(true, -1,pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_GNSS)
FwBuild(true, -1, pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_GNSS)
fwBuildMap[ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_AUTOPILOT] =
FwBuild(true, -1,pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_AUTO)
FwBuild(true, -1, pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_AUTO)
fwBuildMap[ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_DATA_TRACKED] =
FwBuild(false, 30,pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_DATA_TRACK)
FwBuild(false, 30, pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_DATA_TRACK)
fwBuildMap[ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_TRAJECTORY] =
FwBuild(false, 30,pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_TRAJECTORY)
FwBuild(false, 30, pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_TRAJECTORY)
fwBuildMap[ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_VEHICLE] =
FwBuild(false, 30,pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_VEHICLE)
FwBuild(false, 30, pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_VEHICLE)
fwBuildMap[ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_TRAFFIC_LIGHT] =
FwBuild(false, 30,pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_TRAFFIC_LIGHT)
FwBuild(false, 30, pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_TRAFFIC_LIGHT)
fwBuildMap[ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_PLANNING_OBJECTS] =
FwBuild(false, 30,pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_PLANNING_OBJECTS)
FwBuild(false, 30, pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_PLANNING_OBJECTS)
traceInfoCache[ChainConstant.CHAIN_LINK_LOG_CONNECT_STATUS] =
ChainLogParam(true, "ADAS连接状态")
@@ -79,11 +81,16 @@ class TraceManager {
}
}
fun setTraceLogEnable(enable:Boolean){
override fun tokenGot(sn: String) {
Log.d("arrow-721","tokenGot fwrite sn : $sn")
FileWriteManager.getInstance().updateDeviceId(sn)
}
fun setTraceLogEnable(enable: Boolean) {
FileWriteManager.getInstance().logger = enable
}
fun getTraceLogStatus():Boolean{
fun getTraceLogStatus(): Boolean {
return FileWriteManager.getInstance().logger
}
@@ -93,7 +100,7 @@ class TraceManager {
fun refreshTraceInfo(map: HashMap<Int, ChainLogParam>) {
map.forEach { (type, param) ->
if(type != ChainConstant.CHAIN_LINK_LOG_CONNECT_STATUS){
if (type != ChainConstant.CHAIN_LINK_LOG_CONNECT_STATUS) {
val fwBuild = this.fwBuildMap[type]
fwBuild?.let {
CallerLogger.d("$M_DEVA$TAG", "param : ${param.des} , record : ${param.record}")
@@ -103,4 +110,5 @@ class TraceManager {
}
FileWriteManager.getInstance().operateChainMap(fwBuildMap)
}
}

View File

@@ -104,7 +104,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
V2XManager.init(V2XConfig.Builder().also {
it.aiCloudConfig(MoGoAiCloudClientConfig.getInstance())
it.context(context)
it.loggable(true)
it.loggable(false)
it.distanceForTriggerRefresh(200f) //行驶超过200包含刷新道路周边信息短链请求
it.durationForTriggerRefresh(
60,

View File

@@ -0,0 +1,6 @@
package com.mogo.eagle.core.function.api.cloud
interface IMoGoCloudListener {
fun tokenGot(sn:String)
}

View File

@@ -0,0 +1,62 @@
package com.mogo.eagle.core.function.call.cloud
import androidx.annotation.Nullable
import com.mogo.eagle.core.function.api.cloud.IMoGoCloudListener
import java.util.concurrent.ConcurrentHashMap
object CallerCloudListenerManager {
private val M_CLOUD_LISTENER: ConcurrentHashMap<String, IMoGoCloudListener> =
ConcurrentHashMap()
/**
* 添加监听
* @param tag 标记,用来注销监听使用
* @param listener 监听回调
*/
fun registerCloudListener(
@Nullable tag: String,
@Nullable listener: IMoGoCloudListener
) {
if (M_CLOUD_LISTENER.containsKey(tag)) {
return
}
M_CLOUD_LISTENER[tag] = listener
}
/**
* 删除监听
* @param tag 标记,用来注销监听使用
*/
fun unRegisterCloudListener(@Nullable tag: String) {
if (!M_CLOUD_LISTENER.containsKey(tag)) {
return
}
M_CLOUD_LISTENER.remove(tag)
}
/**
* 删除监听
* @param listener 要删除的监听对象
*/
fun unRegisterCloudListener(@Nullable listener: IMoGoCloudListener) {
if (!M_CLOUD_LISTENER.containsValue(listener)) {
return
}
M_CLOUD_LISTENER.forEach {
if (it.value == listener) {
M_CLOUD_LISTENER.remove(it.key)
}
}
}
/**
* 分发获取到的设备sn
*/
fun invokeCloudTokenGot(sn: String) {
M_CLOUD_LISTENER.forEach {
val listener = it.value
listener.tokenGot(sn)
}
}
}

View File

@@ -60,7 +60,7 @@ HOOK_LOG_VERSION=1.6.1
SERVICE_CHAIN_VERSION=1.1.0
################ 外部依赖引用 ################
# loglib
LOGLIB_VERSION=1.3.3
LOGLIB_VERSION=1.3.5
######## MogoAiCloudSDK Version ########
# 网络请求LOGLIB_VERSION
MOGO_NETWORK_VERSION=1.4.3.7