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

@@ -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,