[Add]DebugSettingView增加动态控制日志输出

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2021-11-19 19:06:42 +08:00
parent 44e6f66396
commit 26d1dfb20a
15 changed files with 166 additions and 61 deletions

View File

@@ -10,6 +10,7 @@ import com.mogo.eagle.core.function.autopilot.server.AsyncDataToAutopilotServer
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.LogUtils
import com.zhidao.support.adas.high.AdasManager
import com.zhidao.support.adas.high.common.CupidLogUtils
/**
* @author xiaoyuzhou
@@ -59,8 +60,17 @@ class MoGoAutopilotProvider :
return AdasManager.getInstance().recordPackage()
}
override fun setEnableLog(isEnableLog: Boolean) {
CupidLogUtils.setEnableLog(isEnableLog)
}
override fun setIsWriteLog(isWriteLog: Boolean) {
CupidLogUtils.setIsWriteLog(isWriteLog)
}
override fun onDestroy() {
}
}

View File

@@ -29,9 +29,11 @@ import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager
import com.mogo.eagle.core.function.call.obu.CallerOBUManager
import com.mogo.eagle.core.function.call.obu.CallerObuListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.logger.LogLevel
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.util.AppUtils
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.LogUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.map.MogoMap
import com.mogo.utils.DeviceIdUtils
@@ -250,6 +252,29 @@ class DebugSettingView @JvmOverloads constructor(
tbChangeCAR_AFTER_40_FRONT_120.setOnClickListener {
CallerHDMapManager.changeMaoViewAngle(10)
}*/
tbSelfLog.setOnCheckedChangeListener { buttonView, isChecked ->
if (isChecked) {
LogUtils.getConfig().isLogSwitch = false
Logger.init(LogLevel.OFF)
com.mogo.utils.logger.Logger.init(com.mogo.utils.logger.LogLevel.OFF)
com.mogo.cloud.utils.logger.Logger.init(com.mogo.cloud.utils.logger.LogLevel.OFF)
} else {
LogUtils.getConfig().isLogSwitch = true
Logger.init(LogLevel.DEBUG)
com.mogo.utils.logger.Logger.init(com.mogo.utils.logger.LogLevel.DEBUG)
com.mogo.cloud.utils.logger.Logger.init(com.mogo.cloud.utils.logger.LogLevel.DEBUG)
}
}
tbADASLog.setOnCheckedChangeListener { buttonView, isChecked ->
if (isChecked) {
CallerAutoPilotManager.setEnableLog(false)
CallerAutoPilotManager.setIsWriteLog(false)
} else {
CallerAutoPilotManager.setEnableLog(true)
CallerAutoPilotManager.setIsWriteLog(true)
}
}
}
/**

View File

@@ -205,7 +205,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:visibility="gone"
app:alignContent="flex_start"
app:alignItems="center"
app:flexDirection="row"
@@ -233,15 +232,6 @@
android:textOn="打开「ADAS」Log"
android:textSize="@dimen/dp_34" />
<ToggleButton
android:id="@+id/tbMapSLog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:gravity="center"
android:textOff="关闭「Map」Log"
android:textOn="打开「Map」Log"
android:textSize="@dimen/dp_34" />
</com.google.android.flexbox.FlexboxLayout>
</LinearLayout>
<!--地图呈现数据源控制-->

View File

@@ -42,4 +42,18 @@ public interface IMoGoAutopilotProvider extends IMoGoFunctionServerProvider {
*/
boolean recordPackage();
/**
* Log 是否显示
*
* @param isEnableLog true-打开,false-关闭
*/
void setEnableLog(boolean isEnableLog);
/**
* Log 是否写入
*
* @param isWriteLog true-打开,false-关闭
*/
void setIsWriteLog(boolean isWriteLog);
}

View File

@@ -4,7 +4,7 @@ import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotProvider
import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.util.LogUtils
/**
*@author xiaoyuzhou
@@ -27,7 +27,7 @@ object CallerAutoPilotManager {
*/
fun startAutoPilot(controlParameters: AutopilotControlParameters?) {
if (controlParameters == null) {
Logger.e(TAG, "自动驾驶控制参数异常,请检查参数信息")
//LogUtils.eTag(TAG, "自动驾驶控制参数异常,请检查参数信息")
return
}
providerApi.startAutoPilot(controlParameters)
@@ -55,5 +55,12 @@ object CallerAutoPilotManager {
providerApi.recordPackage()
}
fun setEnableLog(isEnableLog: Boolean) {
providerApi.setEnableLog(isEnableLog)
}
fun setIsWriteLog(isWriteLog: Boolean) {
providerApi.setIsWriteLog(isWriteLog)
}
}

View File

@@ -8,6 +8,7 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.LogUtils
import java.util.concurrent.ConcurrentHashMap
/**
@@ -49,7 +50,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase() {
@Nullable listener: IMoGoAutopilotStatusListener
) {
if (M_AUTOPILOT_STATUS_LISTENERS.containsKey(tag)) {
Logger.e(TAG, "Tag:$tag already exists,please use other tag")
LogUtils.eTag(TAG, "Tag:$tag already exists,please use other tag")
return
}
M_AUTOPILOT_STATUS_LISTENERS[tag] = listener
@@ -62,7 +63,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase() {
*/
fun removeListener(@Nullable tag: String) {
if (!M_AUTOPILOT_STATUS_LISTENERS.containsKey(tag)) {
Logger.e(TAG, "Tag:$tag not exists")
LogUtils.eTag(TAG, "Tag:$tag not exists")
return
}
M_AUTOPILOT_STATUS_LISTENERS.remove(tag)
@@ -85,7 +86,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase() {
*/
@Synchronized
fun invokeAutoPilotStatus() {
//Logger.d(TAG, "$mAutopilotStatusInfo")
//LogUtils.dTag(TAG, "$mAutopilotStatusInfo")
invokeAutoPilotStatus(mAutopilotStatusInfo)
}
@@ -95,12 +96,12 @@ object CallerAutoPilotStatusListenerManager : CallerBase() {
*/
@Synchronized
fun invokeAutoPilotStatus(autopilotStatusInfo: AutopilotStatusInfo) {
//Logger.d(TAG, "$autopilotStatusInfo")
//LogUtils.dTag(TAG, "$autopilotStatusInfo")
mAutopilotStatusInfo = autopilotStatusInfo
M_AUTOPILOT_STATUS_LISTENERS.forEach {
val tag = it.key
val listener = it.value
//Logger.d(TAG, "tag:$tag listener:$listener")
//LogUtils.dTag(TAG, "tag:$tag listener:$listener")
listener.onAutopilotStatusResponse(mAutopilotStatusInfo)
}
}
@@ -111,11 +112,11 @@ object CallerAutoPilotStatusListenerManager : CallerBase() {
*/
@Synchronized
fun invokeArriveAtStation(autopilotStationInfo: AutopilotStationInfo) {
//Logger.d(TAG, "$autopilotStationInfo")
//LogUtils.dTag(TAG, "$autopilotStationInfo")
M_AUTOPILOT_STATUS_LISTENERS.forEach {
val tag = it.key
val listener = it.value
//Logger.d(TAG, "tag:$tag listener:$listener")
//LogUtils.dTag(TAG, "tag:$tag listener:$listener")
listener.onAutopilotArriveAtStation(autopilotStationInfo)
}
}
@@ -125,11 +126,11 @@ object CallerAutoPilotStatusListenerManager : CallerBase() {
*/
@Synchronized
fun invokeAutopilotSNRequest() {
//Logger.d(TAG, "")
//LogUtils.dTag(TAG, "")
M_AUTOPILOT_STATUS_LISTENERS.forEach {
val tag = it.key
val listener = it.value
//Logger.d(TAG, "tag:$tag listener:$listener")
//LogUtils.dTag(TAG, "tag:$tag listener:$listener")
listener.onAutopilotSNRequest()
}
}
@@ -139,11 +140,11 @@ object CallerAutoPilotStatusListenerManager : CallerBase() {
*/
@Synchronized
fun invokeAutopilotGuardian(guardianInfo: AutopilotGuardianStatusInfo?) {
//Logger.d(TAG, "$guardianInfo")
//LogUtils.dTag(TAG, "$guardianInfo")
M_AUTOPILOT_STATUS_LISTENERS.forEach {
val tag = it.key
val listener = it.value
//Logger.d(TAG, "tag:$tag listener:$listener")
//LogUtils.dTag(TAG, "tag:$tag listener:$listener")
listener.onAutopilotGuardian(guardianInfo)
}
}

View File

@@ -4,7 +4,7 @@ import androidx.annotation.Nullable
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener
import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.util.LogUtils
import java.util.concurrent.ConcurrentHashMap
/**
@@ -30,7 +30,7 @@ object CallerAutopilotCarStatusListenerManager : CallerBase() {
@Nullable listener: IMoGoAutopilotCarStateListener
) {
if (M_AUTOPILOT_STATUS_LISTENERS.containsKey(tag)) {
Logger.e(TAG, "Tag:$tag already exists,please use other tag")
LogUtils.eTag(TAG, "Tag:$tag already exists,please use other tag")
return
}
M_AUTOPILOT_STATUS_LISTENERS[tag] = listener
@@ -42,7 +42,7 @@ object CallerAutopilotCarStatusListenerManager : CallerBase() {
*/
fun removeListener(@Nullable tag: String) {
if (!M_AUTOPILOT_STATUS_LISTENERS.containsKey(tag)) {
Logger.e(TAG, "Tag:$tag not exists")
LogUtils.eTag(TAG, "Tag:$tag not exists")
return
}
M_AUTOPILOT_STATUS_LISTENERS.remove(tag)
@@ -66,11 +66,11 @@ object CallerAutopilotCarStatusListenerManager : CallerBase() {
*/
@Synchronized
fun invokeAutopilotCarStateData(autoPilotCarStateInfo: AutopilotCarStateInfo?) {
//Logger.d(TAG, "$autoPilotCarStateInfo")
//LogUtils.dTag(TAG, "$autoPilotCarStateInfo")
M_AUTOPILOT_STATUS_LISTENERS.forEach {
val tag = it.key
val listener = it.value
//Logger.d(TAG, "tag:$tag listener:$listener")
//LogUtils.dTag(TAG, "tag:$tag listener:$listener")
listener.onAutopilotCarStateData(autoPilotCarStateInfo)
}
}

View File

@@ -5,7 +5,7 @@ import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage
import com.mogo.eagle.core.data.traffic.TrafficData
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.util.LogUtils
import java.util.concurrent.ConcurrentHashMap
/**
@@ -30,7 +30,7 @@ object CallerAutopilotIdentifyListenerManager : CallerBase() {
@Nullable listener: IMoGoAutopilotIdentifyListener
) {
if (M_AUTOPILOT_IDENTIFY_LISTENERS.containsKey(tag)) {
Logger.e(TAG, "Tag:$tag already exists,please use other tag")
LogUtils.eTag(TAG, "Tag:$tag already exists,please use other tag")
return
}
M_AUTOPILOT_IDENTIFY_LISTENERS[tag] = listener
@@ -42,7 +42,7 @@ object CallerAutopilotIdentifyListenerManager : CallerBase() {
*/
fun removeListener(@Nullable tag: String) {
if (!M_AUTOPILOT_IDENTIFY_LISTENERS.containsKey(tag)) {
Logger.e(TAG, "Tag:$tag not exists")
LogUtils.eTag(TAG, "Tag:$tag not exists")
return
}
M_AUTOPILOT_IDENTIFY_LISTENERS.remove(tag)
@@ -65,11 +65,11 @@ object CallerAutopilotIdentifyListenerManager : CallerBase() {
*/
@Synchronized
fun invokeAutopilotIdentifyDataUpdate(trafficData: ArrayList<TrafficData>?) {
//Logger.d(TAG, "$trafficData")
//LogUtils.dTag(TAG, "$trafficData")
M_AUTOPILOT_IDENTIFY_LISTENERS.forEach {
val tag = it.key
val listener = it.value
//Logger.d(TAG, "tag:$tag listener:$listener")
//LogUtils.dTag(TAG, "tag:$tag listener:$listener")
listener.onAutopilotIdentifyDataUpdate(trafficData)
}
}
@@ -79,11 +79,11 @@ object CallerAutopilotIdentifyListenerManager : CallerBase() {
*/
@Synchronized
fun invokeAutopilotWarnMessage(autopilotWarnMessage: AutopilotWarnMessage?) {
//Logger.d(TAG, "$autopilotWarnMessage")
//LogUtils.dTag(TAG, "$autopilotWarnMessage")
M_AUTOPILOT_IDENTIFY_LISTENERS.forEach {
val tag = it.key
val listener = it.value
//Logger.d(TAG, "tag:$tag listener:$listener")
//LogUtils.dTag(TAG, "tag:$tag listener:$listener")
listener.onAutopilotWarnMessage(autopilotWarnMessage)
}
}

View File

@@ -5,7 +5,7 @@ import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener
import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.util.LogUtils
import java.util.concurrent.ConcurrentHashMap
/**
@@ -31,7 +31,7 @@ object CallerAutopilotPlanningListenerManager : CallerBase() {
@Nullable listener: IMoGoAutopilotPlanningListener
) {
if (M_AUTOPILOT_PLANNING_LISTENER.containsKey(tag)) {
Logger.e(TAG, "Tag:$tag already exists,please use other tag")
LogUtils.eTag(TAG, "Tag:$tag already exists,please use other tag")
return
}
M_AUTOPILOT_PLANNING_LISTENER[tag] = listener
@@ -43,7 +43,7 @@ object CallerAutopilotPlanningListenerManager : CallerBase() {
*/
fun removeListener(@Nullable tag: String) {
if (!M_AUTOPILOT_PLANNING_LISTENER.containsKey(tag)) {
Logger.e(TAG, "Tag:$tag not exists")
LogUtils.eTag(TAG, "Tag:$tag not exists")
return
}
M_AUTOPILOT_PLANNING_LISTENER.remove(tag)
@@ -67,11 +67,11 @@ object CallerAutopilotPlanningListenerManager : CallerBase() {
*/
@Synchronized
fun invokeAutopilotTrajectory(trajectoryInfo: ArrayList<ADASTrajectoryInfo>) {
//Logger.d(TAG, "$trajectoryInfo")
//LogUtils.dTag(TAG, "$trajectoryInfo")
M_AUTOPILOT_PLANNING_LISTENER.forEach {
val tag = it.key
val listener = it.value
//Logger.d(TAG, "tag:$tag listener:$listener")
//LogUtils.dTag(TAG, "tag:$tag listener:$listener")
listener.onAutopilotTrajectory(trajectoryInfo)
}
}
@@ -82,11 +82,11 @@ object CallerAutopilotPlanningListenerManager : CallerBase() {
*/
@Synchronized
fun invokeAutopilotRotting(routeList: AutopilotRouteInfo) {
//Logger.d(TAG, "$routeList")
//LogUtils.dTag(TAG, "$routeList")
M_AUTOPILOT_PLANNING_LISTENER.forEach {
val tag = it.key
val listener = it.value
//Logger.d(TAG, "tag:$tag listener:$listener")
//LogUtils.dTag(TAG, "tag:$tag listener:$listener")
listener.onAutopilotRotting(routeList)
}
}

View File

@@ -19,7 +19,8 @@ object CallerHmiListenerManager : CallerBase() {
private var mIsChecked: Boolean = false
// 存储所有注册了监听的对象invokeXXXX进行遍历回调将信息同步
private val mAutoPilotBtnListeners: ConcurrentHashMap<String, IMoGoCheckAutoPilotBtnListener> = ConcurrentHashMap()
private val mAutoPilotBtnListeners: ConcurrentHashMap<String, IMoGoCheckAutoPilotBtnListener> =
ConcurrentHashMap()
/**
@@ -31,6 +32,10 @@ object CallerHmiListenerManager : CallerBase() {
@Nullable tag: String,
@Nullable listener: IMoGoCheckAutoPilotBtnListener
) {
if (mAutoPilotBtnListeners.containsKey(tag)) {
LogUtils.eTag(TAG, "Tag:$tag already exists,please use other tag")
return
}
mAutoPilotBtnListeners[tag] = listener
listener.onCheck(mIsChecked)
}
@@ -40,6 +45,10 @@ object CallerHmiListenerManager : CallerBase() {
* @param tag 标记,用来注销监听使用
*/
fun removeCheckAutoPilotBtnListener(@Nullable tag: String) {
if (!mAutoPilotBtnListeners.containsKey(tag)) {
LogUtils.eTag(TAG, "Tag:$tag not exists")
return
}
mAutoPilotBtnListeners.remove(tag)
}
@@ -48,12 +57,12 @@ object CallerHmiListenerManager : CallerBase() {
* @param isChecked 选中状态
*/
fun invokeCheckAutoPilotBtnListener(isChecked: Boolean) {
LogUtils.dTag(TAG, "isChecked:$isChecked")
//LogUtils.dTag(TAG, "isChecked:$isChecked")
mIsChecked = isChecked
mAutoPilotBtnListeners.forEach {
val tag = it.key
val listener = it.value
LogUtils.dTag(TAG, "tag:$tag listener:$listener")
//LogUtils.dTag(TAG, "tag:$tag listener:$listener")
listener.onCheck(mIsChecked)
}
}

View File

@@ -38,6 +38,10 @@ object CallerMapLocationListenerManager : CallerBase() {
@Nullable tag: String,
@Nullable listener: IMoGoMapLocationListener
) {
if (mMapStyleChangeListeners.containsKey(tag)) {
LogUtils.eTag(TAG, "Tag:$tag already exists,please use other tag")
return
}
mMapStyleChangeListeners[tag] = listener
listener.onLocationChanged(mLocation)
}
@@ -47,6 +51,10 @@ object CallerMapLocationListenerManager : CallerBase() {
* @param tag 标记,用来注销监听使用
*/
fun removeListener(@Nullable tag: String) {
if (!mMapStyleChangeListeners.containsKey(tag)) {
LogUtils.eTag(TAG, "Tag:$tag not exists")
return
}
mMapStyleChangeListeners.remove(tag)
}
@@ -55,6 +63,10 @@ object CallerMapLocationListenerManager : CallerBase() {
* @param listener 要删除的监听对象
*/
fun removeListener(@Nullable listener: IMoGoMapLocationListener) {
if (!mMapStyleChangeListeners.containsValue(listener)) {
LogUtils.eTag(TAG, "Tag:$listener not exists")
return
}
mMapStyleChangeListeners.forEach {
if (it.value == listener) {
mMapStyleChangeListeners.remove(it.key)
@@ -74,12 +86,12 @@ object CallerMapLocationListenerManager : CallerBase() {
* @param location 选中状态
*/
fun invokeMapLocationChangeListener(location: MogoLocation?) {
LogUtils.dTag(TAG, "mapStyleMode:$location")
//LogUtils.dTag(TAG, "mapStyleMode:$location")
mLocation = location
mMapStyleChangeListeners.forEach {
val tag = it.key
val listener = it.value
LogUtils.dTag(TAG, "tag:$tag listener:$listener")
//LogUtils.dTag(TAG, "tag:$tag listener:$listener")
listener.onLocationChanged(location)
}
}

View File

@@ -37,6 +37,10 @@ object CallerMapStyleListenerManager : CallerBase() {
@Nullable tag: String,
@Nullable listener: IMoGoMapStyleChangeListener
) {
if (mMapStyleChangeListeners.containsKey(tag)) {
LogUtils.eTag(TAG, "Tag:$tag already exists,please use other tag")
return
}
mMapStyleChangeListeners[tag] = listener
listener.onMapStyleModeChange(mMapStyleMode)
}
@@ -46,6 +50,10 @@ object CallerMapStyleListenerManager : CallerBase() {
* @param tag 标记,用来注销监听使用
*/
fun removeListener(@Nullable tag: String) {
if (!mMapStyleChangeListeners.containsKey(tag)) {
LogUtils.eTag(TAG, "Tag:$tag not exists")
return
}
mMapStyleChangeListeners.remove(tag)
}
@@ -54,6 +62,10 @@ object CallerMapStyleListenerManager : CallerBase() {
* @param listener 要删除的监听对象
*/
fun removeListener(@Nullable listener: IMoGoMapStyleChangeListener) {
if (!mMapStyleChangeListeners.containsValue(listener)) {
LogUtils.eTag(TAG, "Tag:$listener not exists")
return
}
mMapStyleChangeListeners.forEach {
if (it.value == listener) {
mMapStyleChangeListeners.remove(it.key)
@@ -73,12 +85,12 @@ object CallerMapStyleListenerManager : CallerBase() {
* @param mapStyleMode 选中状态
*/
fun invokeMapStyleChange(mapStyleMode: Int) {
LogUtils.dTag(TAG, "mapStyleMode:$mapStyleMode")
//LogUtils.dTag(TAG, "mapStyleMode:$mapStyleMode")
mMapStyleMode = mapStyleMode
mMapStyleChangeListeners.forEach {
val tag = it.key
val listener = it.value
LogUtils.dTag(TAG, "tag:$tag listener:$listener")
//LogUtils.dTag(TAG, "tag:$tag listener:$listener")
listener.onMapStyleModeChange(mMapStyleMode)
}
}

View File

@@ -20,7 +20,8 @@ object CallerObuListenerManager : CallerBase() {
private var mObuStatusInfo: ObuStatusInfo = ObuStatusInfo()
// 存储所有注册了监听的对象invokeXXXX进行遍历回调将信息同步
private val mObuStatusListeners: ConcurrentHashMap<String, IMoGoObuStatusListener> = ConcurrentHashMap()
private val mObuStatusListeners: ConcurrentHashMap<String, IMoGoObuStatusListener> =
ConcurrentHashMap()
/**
* 查询 OBU状态
@@ -45,6 +46,10 @@ object CallerObuListenerManager : CallerBase() {
@Nullable tag: String,
@Nullable listener: IMoGoObuStatusListener
) {
if (mObuStatusListeners.containsKey(tag)) {
LogUtils.eTag(TAG, "Tag:$tag already exists,please use other tag")
return
}
mObuStatusListeners[tag] = listener
listener.onObuStatusResponse(mObuStatusInfo)
}
@@ -54,6 +59,10 @@ object CallerObuListenerManager : CallerBase() {
* @param tag 标记,用来注销监听使用
*/
fun removeListener(@Nullable tag: String) {
if (!mObuStatusListeners.containsKey(tag)) {
LogUtils.eTag(TAG, "Tag:$tag not exists")
return
}
mObuStatusListeners.remove(tag)
}
@@ -62,6 +71,10 @@ object CallerObuListenerManager : CallerBase() {
* @param listener 要删除的监听对象
*/
fun removeListener(@Nullable listener: IMoGoObuStatusListener) {
if (!mObuStatusListeners.containsValue(listener)) {
LogUtils.eTag(TAG, "Tag:$listener not exists")
return
}
mObuStatusListeners.forEach {
if (it.value == listener) {
mObuStatusListeners.remove(it.key)
@@ -81,12 +94,12 @@ object CallerObuListenerManager : CallerBase() {
* @param obuStatusInfo 选中状态
*/
fun invokeListener(obuStatusInfo: ObuStatusInfo) {
LogUtils.dTag(TAG, "obuStatusInfo:$obuStatusInfo")
//LogUtils.dTag(TAG, "obuStatusInfo:$obuStatusInfo")
mObuStatusInfo = obuStatusInfo
mObuStatusListeners.forEach {
val tag = it.key
val listener = it.value
LogUtils.dTag(TAG, "tag:$tag listener:$listener")
//LogUtils.dTag(TAG, "tag:$tag listener:$listener")
listener.onObuStatusResponse(mObuStatusInfo)
}
}

View File

@@ -3,7 +3,7 @@ package com.mogo.eagle.core.function.call.trafficlight
import androidx.annotation.Nullable
import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.util.LogUtils
import java.util.concurrent.ConcurrentHashMap
object CallTrafficLightListenerManager {
@@ -13,7 +13,7 @@ object CallTrafficLightListenerManager {
private val M_TRAFFIC_LIGHT_LISTENER: ConcurrentHashMap<String, IMoGoTrafficLightListener> =
ConcurrentHashMap()
private var trafficLightResult:TrafficLightResult? = null
private var trafficLightResult: TrafficLightResult? = null
/**
* 添加监听
@@ -24,6 +24,10 @@ object CallTrafficLightListenerManager {
@Nullable tag: String,
@Nullable listener: IMoGoTrafficLightListener
) {
if (M_TRAFFIC_LIGHT_LISTENER.containsKey(tag)) {
LogUtils.eTag(TAG, "Tag:$tag already exists,please use other tag")
return
}
trafficLightResult?.let {
listener.onTrafficLightStatus(it)
}
@@ -35,6 +39,10 @@ object CallTrafficLightListenerManager {
* @param tag 标记,用来注销监听使用
*/
fun unRegisterTrafficLightListener(@Nullable tag: String) {
if (!M_TRAFFIC_LIGHT_LISTENER.containsKey(tag)) {
LogUtils.eTag(TAG, "Tag:$tag not exists")
return
}
M_TRAFFIC_LIGHT_LISTENER.remove(tag)
}
@@ -43,6 +51,10 @@ object CallTrafficLightListenerManager {
* @param listener 要删除的监听对象
*/
fun unRegisterTrafficLightListener(@Nullable listener: IMoGoTrafficLightListener) {
if (!M_TRAFFIC_LIGHT_LISTENER.containsValue(listener)) {
LogUtils.eTag(TAG, "listener:$listener not exists")
return
}
M_TRAFFIC_LIGHT_LISTENER.forEach {
if (it.value == listener) {
M_TRAFFIC_LIGHT_LISTENER.remove(it.key)
@@ -54,13 +66,13 @@ object CallTrafficLightListenerManager {
this.trafficLightResult = trafficLightResult
M_TRAFFIC_LIGHT_LISTENER.forEach {
val tag = it.key
Logger.d(TAG, "invokeTrafficLightStatus tag is : $tag")
//LogUtils.dTag(TAG, "invokeTrafficLightStatus tag is : $tag")
val listener = it.value
listener.onTrafficLightStatus(trafficLightResult)
}
}
fun resetTrafficLightData(){
fun resetTrafficLightData() {
trafficLightResult = null
}

View File

@@ -3,7 +3,6 @@ package com.mogo.module.common.drawer;
import static com.mogo.cloud.socket.entity.SocketDownDataHelper.FROM_ADAS;
import android.text.TextUtils;
import android.util.Log;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.data.map.MogoLatLng;
@@ -12,6 +11,7 @@ import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.constants.DataTypes;
import com.mogo.utils.logger.Logger;
import java.util.ArrayList;
import java.util.Iterator;
@@ -71,7 +71,7 @@ public class IdentifyDataDrawer extends BaseDrawer {
if (!MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
clearOldMarker();
Log.w(TAG, "渲染 adas 识别的数据 当前不是VR模式");
Logger.w(TAG, "渲染 adas 识别的数据 当前不是VR模式");
return;
}
@@ -97,7 +97,7 @@ public class IdentifyDataDrawer extends BaseDrawer {
removeUselessMarker(mMarkersCaches);
removeUselessLastRecord();
int newDiffSetSize = newDiffSet.size();
Log.d(TAG, "原数据量 " + resultList.size() + " 新增marker数量 " + newDiffSetSize);
// Log.d(TAG, "原数据量 " + resultList.size() + " 新增marker数量 " + newDiffSetSize);
// 复用过期 marker
if (newDiffSetSize > 0) {
for (int i = 0; i < newDiffSetSize; i++) {
@@ -114,7 +114,7 @@ public class IdentifyDataDrawer extends BaseDrawer {
sendMessage(MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches);
mMarkersCaches.clear();
mMarkersCaches = newAdasRecognizedMarkersCaches;
Log.d(TAG, "ADAS数据延时绘制 render 接收数据 -> 处理结束 " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)) + "ms");
// Log.d(TAG, "ADAS数据延时绘制 render 接收数据 -> 处理结束 " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)) + "ms");
}
/**
@@ -151,7 +151,7 @@ public class IdentifyDataDrawer extends BaseDrawer {
return;
}
Iterator<TrafficData> iterator = mLastPositions.values().iterator();
Log.d(TAG, "EmArrow removeUselessLastRecord size : " + mLastPositions.size());
// Log.d(TAG, "EmArrow removeUselessLastRecord size : " + mLastPositions.size());
while (iterator.hasNext()) {
TrafficData result = iterator.next();
long internal = result.getSatelliteTime() - getCurSatelliteTime();