From 26d1dfb20ad7956474042863c0b7e9f5c50a9c5f Mon Sep 17 00:00:00 2001 From: donghongyu Date: Fri, 19 Nov 2021 19:06:42 +0800 Subject: [PATCH] =?UTF-8?q?[Add]DebugSettingView=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E6=8E=A7=E5=88=B6=E6=97=A5=E5=BF=97=E8=BE=93?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: donghongyu --- .../autopilot/MoGoAutopilotProvider.kt | 10 ++++++++ .../hmi/ui/setting/DebugSettingView.kt | 25 +++++++++++++++++++ .../main/res/layout/view_debug_setting.xml | 10 -------- .../api/autopilot/IMoGoAutopilotProvider.java | 14 +++++++++++ .../call/autopilot/CallerAutoPilotManager.kt | 11 ++++++-- .../CallerAutoPilotStatusListenerManager.kt | 23 +++++++++-------- ...CallerAutopilotCarStatusListenerManager.kt | 10 ++++---- .../CallerAutopilotIdentifyListenerManager.kt | 14 +++++------ .../CallerAutopilotPlanningListenerManager.kt | 14 +++++------ .../call/hmi/CallerHmiListenerManager.kt | 15 ++++++++--- .../map/CallerMapLocationListenerManager.kt | 16 ++++++++++-- .../call/map/CallerMapStyleListenerManager.kt | 16 ++++++++++-- .../call/obu/CallerObuListenerManager.kt | 19 +++++++++++--- .../CallTrafficLightListenerManager.kt | 20 ++++++++++++--- .../common/drawer/IdentifyDataDrawer.java | 10 ++++---- 15 files changed, 166 insertions(+), 61 deletions(-) diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt index e27cf3236b..cf93a876e3 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt @@ -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() { } + } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt index 1042d98a13..9e8baf8e01 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt @@ -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) + } + } } /** diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml index 67b2cd2cb0..33aff7f3d0 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml @@ -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" /> - diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotProvider.java b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotProvider.java index ad19b07fff..2c33f8e5f1 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotProvider.java +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotProvider.java @@ -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); + } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotManager.kt index b2f37f830f..dd30beef17 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotManager.kt @@ -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) + } } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt index f0049b7dab..33aac6f3e7 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt @@ -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) } } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarStatusListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarStatusListenerManager.kt index cef8278203..79a0f790ff 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarStatusListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarStatusListenerManager.kt @@ -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) } } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotIdentifyListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotIdentifyListenerManager.kt index ba8e481606..fcd34fda26 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotIdentifyListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotIdentifyListenerManager.kt @@ -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?) { - //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) } } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotPlanningListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotPlanningListenerManager.kt index f4cb386e9d..e2eb3bfe9e 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotPlanningListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotPlanningListenerManager.kt @@ -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) { - //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) } } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiListenerManager.kt index 9f89094737..fd9832a15f 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiListenerManager.kt @@ -19,7 +19,8 @@ object CallerHmiListenerManager : CallerBase() { private var mIsChecked: Boolean = false // 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 - private val mAutoPilotBtnListeners: ConcurrentHashMap = ConcurrentHashMap() + private val mAutoPilotBtnListeners: ConcurrentHashMap = + 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) } } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapLocationListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapLocationListenerManager.kt index 6c2608b095..71cab938a2 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapLocationListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapLocationListenerManager.kt @@ -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) } } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapStyleListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapStyleListenerManager.kt index b88d5db3e1..3927d91b77 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapStyleListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapStyleListenerManager.kt @@ -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) } } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuListenerManager.kt index 53efcb29eb..0b53cdcc5a 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuListenerManager.kt @@ -20,7 +20,8 @@ object CallerObuListenerManager : CallerBase() { private var mObuStatusInfo: ObuStatusInfo = ObuStatusInfo() // 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 - private val mObuStatusListeners: ConcurrentHashMap = ConcurrentHashMap() + private val mObuStatusListeners: ConcurrentHashMap = + 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) } } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/trafficlight/CallTrafficLightListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/trafficlight/CallTrafficLightListenerManager.kt index 0f990f6dcd..23fdee3b58 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/trafficlight/CallTrafficLightListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/trafficlight/CallTrafficLightListenerManager.kt @@ -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 = 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 } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/IdentifyDataDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/IdentifyDataDrawer.java index 6becca2485..a383454f72 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/IdentifyDataDrawer.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/IdentifyDataDrawer.java @@ -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 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();