From 06810f339c24f6affb5ba3ecf0b4190c56fd03b4 Mon Sep 17 00:00:00 2001 From: donghongyu Date: Wed, 4 Jan 2023 20:00:32 +0800 Subject: [PATCH] =?UTF-8?q?[dev=5Farch=5Fopt=5F3.0]=20[Change]=20[1?= =?UTF-8?q?=E3=80=81=E5=B0=86Call=E4=B8=AD=E6=B3=A8=E5=86=8C=EF=BC=8C?= =?UTF-8?q?=E5=8F=8D=E6=B3=A8=E5=86=8C=E6=93=8D=E4=BD=9C=E4=B8=8B=E6=B2=89?= =?UTF-8?q?CallerBase]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: donghongyu --- .../sweeper/ui/SweeperOperatePanelView.java | 8 -- app/bugly/BuglySymtabLog.txt | 0 app/bugly/BuglyUploadLog.txt | 0 .../push/dispatch/DispatchAutoPilotManager.kt | 4 +- .../autopilot/adapter/MoGoAdasListenerImpl.kt | 9 +- .../adapter/MoGoHandAdasMsgManager.java | 4 +- .../server/AsyncDataToAutopilotServer.kt | 2 +- .../status/flow/can/CanImpl.kt | 27 ++-- .../function/hmi/ui/pnc/PncActionsView.kt | 4 +- .../hmi/ui/setting/DebugSettingView.kt | 121 +++++++++--------- .../hmi/ui/widget/SteeringWheelView.java | 20 +-- .../hmi/ui/widget/SystemVersionView.kt | 4 +- .../hmi/ui/widget/TrafficDataView.java | 21 --- .../function/main/MainMoGoApplication.java | 6 +- .../redlightwarning/RedLightWarningManager.kt | 10 +- .../core/TrafficLightDispatcher.kt | 16 +-- .../core/function/v2x/vip/VipCarManager.kt | 11 +- .../IMoGoAutopilotVehicleStateListener.kt | 12 -- .../IMoGoChassisLamplightListener.kt | 22 ++++ .../CallerAutoPilotStatusListenerManager.kt | 61 ++------- .../CallerAutopilotActionsListenerManager.kt | 47 +------ ...CallerAutopilotCarConfigListenerManager.kt | 54 +------- ...CallerAutopilotCarStatusListenerManager.kt | 51 +------- .../CallerAutopilotIdentifyListenerManager.kt | 58 +-------- ...AutopilotPlanningActionsListenerManager.kt | 48 +------ .../CallerAutopilotPlanningListenerManager.kt | 50 +------- ...allerAutopilotPointCloudListenerManager.kt | 48 +------ .../CallerAutopilotRecordListenerManager.kt | 53 +------- ...allerAutopilotStatisticsListenerManager.kt | 48 +------ ...lerAutopilotVehicleStateListenerManager.kt | 82 ++---------- .../CallerChassisLamplightListenerManager.kt | 34 +++++ ...llerStartAutopilotFailedListenerManager.kt | 47 +------ .../core/function/call/base/CallerBase.kt | 109 ++++++++++++---- .../CallerBindingCarListenerManager.kt | 57 +-------- .../function/call/biz/CallerFuncBizManager.kt | 6 +- .../function/call/chat/CallerChatManager.kt | 2 +- .../call/cloud/CallerCloudListenerManager.kt | 9 +- ...allerDevaToolsFuncConfigListenerManager.kt | 11 +- .../CallerDevaToolsListenerManager.kt | 61 ++------- .../CallerDevaToolsUpgradeListenerManager.kt | 58 +-------- .../call/hmi/CallerHmiListenerManager.kt | 38 +----- .../function/call/hmi/CallerHmiManager.kt | 3 +- .../function/call/map/CallerHDMapManager.kt | 3 +- .../call/map/CallerMapDevaListenerManager.kt | 31 +---- .../map/CallerMapLocationListenerManager.kt | 9 +- .../call/map/CallerMapStyleListenerManager.kt | 50 +------- .../function/call/map/CallerSmpManager.kt | 2 +- .../msgbox/CallerMsgBoxListenerManager.kt | 62 +-------- .../call/obu/CallerObuListenerManager.kt | 55 +------- .../setting/CallerSkinModeListenerManager.kt | 52 +------- .../CallerTrafficLightListenerManager.kt | 121 +----------------- .../trafficlight/CallerTrafficLightManager.kt | 2 +- .../CallLimitingVelocityListenerManager.kt | 54 +------- .../call/vip/CallVipSetListenerManager.kt | 50 +------- 54 files changed, 373 insertions(+), 1454 deletions(-) delete mode 100644 app/bugly/BuglySymtabLog.txt delete mode 100644 app/bugly/BuglyUploadLog.txt create mode 100644 core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisLamplightListener.kt create mode 100644 core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisLamplightListenerManager.kt diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java index c163ce8230..cba08339cf 100644 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java @@ -762,14 +762,6 @@ public class SweeperOperatePanelView extends LinearLayout { public void onAutopilotDataException(long timestamp) { } - @Override - public void onAutopilotLightSwitchData(@Nullable Chassis.LightSwitch lightSwitch) { - } - - @Override - public void onAutopilotBrakeLightData(boolean brakeLight) { - } - @Override public void onAutopilotSteeringData(float steering) { } diff --git a/app/bugly/BuglySymtabLog.txt b/app/bugly/BuglySymtabLog.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/app/bugly/BuglyUploadLog.txt b/app/bugly/BuglyUploadLog.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/push/dispatch/DispatchAutoPilotManager.kt b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/push/dispatch/DispatchAutoPilotManager.kt index f88288de22..6013c78479 100644 --- a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/push/dispatch/DispatchAutoPilotManager.kt +++ b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/push/dispatch/DispatchAutoPilotManager.kt @@ -76,7 +76,7 @@ class DispatchAutoPilotManager private constructor() : MogoAiCloudSocketManager.getInstance(context) .registerOnMessageListener(MSG_SOCKET_TYPE, this) // 添加自动驾驶按钮选中监听 - CallerHmiListenerManager.addCheckAutoPilotBtnListener(TAG, this) + CallerHmiListenerManager.addListener(TAG, this) // 添加 规划路径相关回调 监听 CallerAutopilotPlanningListenerManager.addListener(TAG, this) // 添加 ADAS状态 监听 @@ -86,7 +86,7 @@ class DispatchAutoPilotManager private constructor() : fun release() { // 添加自动驾驶按钮选中监听 - CallerHmiListenerManager.removeCheckAutoPilotBtnListener(TAG) + CallerHmiListenerManager.removeListener(TAG) // 添加 规划路径相关回调 监听 CallerAutopilotPlanningListenerManager.removeListener(TAG) // 添加 ADAS状态 监听 diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt index ec4672eff1..5416410b18 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt @@ -28,7 +28,7 @@ import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LO import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_WEB_SOCKET_TRAFFIC_LIGHT import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_WEB_SOCKET_TRAJECTORY import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_WEB_SOCKET_VEHICLE -import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager +import com.mogo.eagle.core.function.call.autopilot.* import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeArriveAtStation import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutoPilotStatus @@ -38,18 +38,15 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager.invokeAutopilotAbility import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager.invokeAutopilotCarConfigData import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager.invokeAutopilotCarStateData -import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager.invokeAutopilotIdentifyDataUpdate import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager.invokeAutopilotIdentifyPlanningObj import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager.invokeAutopilotWarnMessage import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningActionsListenerManager.invokePNCActions import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager.invokeAutopilotRotting import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager.invokeAutopilotTrajectory -import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPointCloudListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager.invokeAutopilotRecordConfig import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager.invokeAutopilotRecordResult import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotStatisticsListenerManager.invokeAutopilotStatistics -import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerStartAutopilotFailedListenerManager.invokeStartAutopilotFailed import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger @@ -158,9 +155,9 @@ class MoGoAdasListenerImpl : OnAdasListener { if (vehicleState != null) { //转向灯数据 - CallerAutopilotVehicleStateListenerManager.invokeAutopilotLightSwitchData(vehicleState.light) + CallerChassisLamplightListenerManager.invokeAutopilotLightSwitchData(vehicleState.light) //刹车灯数据 - CallerAutopilotVehicleStateListenerManager.invokeAutopilotBrakeLightData(vehicleState.brakeLightStatus) + CallerChassisLamplightListenerManager.invokeAutopilotBrakeLightData(vehicleState.brakeLightStatus) //方向盘转向角数据 CallerAutopilotVehicleStateListenerManager.invokeAutopilotSteeringData(vehicleState.steering) //挂挡档位数据 diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoHandAdasMsgManager.java b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoHandAdasMsgManager.java index 5725f0711d..3329022fff 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoHandAdasMsgManager.java +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoHandAdasMsgManager.java @@ -13,6 +13,7 @@ import com.mogo.eagle.core.data.constants.MoGoConfig; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener; +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener; import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager; import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager; import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager; @@ -31,7 +32,8 @@ import mogo.telematics.pad.MessagePad; public class MoGoHandAdasMsgManager implements IMoGoAutopilotVehicleStateListener, IMoGoAutopilotCarConfigListener, - IMoGoAutopilotCarStateListener { + IMoGoAutopilotCarStateListener, + IMoGoChassisLamplightListener { private final String TAG = "AdasEventManager"; diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/server/AsyncDataToAutopilotServer.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/server/AsyncDataToAutopilotServer.kt index 07a8cec3e7..49a2aa64e6 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/server/AsyncDataToAutopilotServer.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/server/AsyncDataToAutopilotServer.kt @@ -22,7 +22,7 @@ class AsyncDataToAutopilotServer private constructor() : IMoGoTrafficLightListen } fun initServer() { - CallerTrafficLightListenerManager.registerTrafficLightListener(TAG, this) + CallerTrafficLightListenerManager.addListener(TAG, this) } override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) { diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/can/CanImpl.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/can/CanImpl.kt index c8b1ad4876..415a5ca4c0 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/can/CanImpl.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/can/CanImpl.kt @@ -1,21 +1,32 @@ package com.zhjt.mogo_core_function_devatools.status.flow.can -import android.content.* +import android.content.Context import android.util.Log import chassis.Chassis.GearPosition import chassis.Chassis.LightSwitch import chassis.VehicleStateOuterClass -import com.mogo.eagle.core.function.api.autopilot.* -import com.mogo.eagle.core.function.call.autopilot.* -import com.mogo.eagle.core.utilcode.kotlin.* -import com.zhjt.mogo_core_function_devatools.status.flow.IFlow +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener +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.CallerAutopilotVehicleStateListenerManager +import com.mogo.eagle.core.utilcode.kotlin.safeCancel import com.zhjt.mogo_core_function_devatools.status.entity.CanStatus -import kotlinx.coroutines.* +import com.zhjt.mogo_core_function_devatools.status.flow.IFlow +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.Job +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch import mogo_msg.MogoReportMsg.MogoReportMessage import system_master.SystemStatusInfo.StatusInfo -import java.util.concurrent.atomic.* +import java.util.concurrent.atomic.AtomicInteger -internal class CanImpl(ctx: Context): IFlow(ctx), IMoGoAutopilotVehicleStateListener, IMoGoAutopilotStatusListener { +internal class CanImpl(ctx: Context): + IFlow(ctx), + IMoGoAutopilotVehicleStateListener, + IMoGoAutopilotStatusListener, + IMoGoChassisLamplightListener{ companion object { const val TAG = "CanImpl" diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/pnc/PncActionsView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/pnc/PncActionsView.kt index 092b78905e..807eb5d59b 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/pnc/PncActionsView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/pnc/PncActionsView.kt @@ -49,14 +49,14 @@ class PncActionsView @JvmOverloads constructor( super.onAttachedToWindow() CallerAutoPilotStatusListenerManager.addListener(TAG, this) CallerAutopilotPlanningActionsListenerManager.addListener(TAG, this) - CallerTrafficLightListenerManager.registerTrafficLightListener(TAG, this) + CallerTrafficLightListenerManager.addListener(TAG, this) } override fun onDetachedFromWindow() { super.onDetachedFromWindow() CallerAutoPilotStatusListenerManager.removeListener(TAG) CallerAutopilotPlanningActionsListenerManager.removeListener(TAG) - CallerTrafficLightListenerManager.unRegisterTrafficLightListener(TAG) + CallerTrafficLightListenerManager.removeListener(TAG) } override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) { 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 2ef74582ff..c31466bcdc 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 @@ -7,7 +7,6 @@ import android.content.ClipboardManager import android.content.Context import android.graphics.Color import android.os.Build -import android.telecom.Call import android.text.Html import android.util.AttributeSet import android.view.LayoutInflater @@ -48,6 +47,7 @@ import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsFuncConfigListen 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.business.routeoverlay.* import com.mogo.eagle.core.function.call.autopilot.* import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsFuncConfigListenerManager import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager @@ -60,6 +60,7 @@ import com.mogo.eagle.core.function.call.map.CallerSmpManager import com.mogo.eagle.core.function.call.obu.CallerOBUManager import com.mogo.eagle.core.function.call.obu.CallerObuListenerManager import com.mogo.eagle.core.function.call.setting.CallerMoGoUiSettingManager +import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.function.hmi.ui.logcatch.ILogViewListener import com.mogo.eagle.core.function.hmi.ui.logcatch.LogInfoView @@ -71,18 +72,15 @@ import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils 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 +import com.mogo.eagle.core.utilcode.mogo.permissions.BackgrounderPermission import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr import com.mogo.eagle.core.utilcode.mogo.toast.TipToast import com.mogo.eagle.core.utilcode.util.* import com.mogo.map.uicontroller.VisualAngleMode import com.mogo.map.uicontroller.VisualAngleMode.* -import com.mogo.eagle.core.function.business.routeoverlay.* -import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager -import com.mogo.eagle.core.utilcode.mogo.permissions.BackgrounderPermission import com.zhidao.easysocket.utils.L import com.zhjt.mogo_core_function_devatools.env.* import kotlinx.android.synthetic.main.view_debug_setting.view.* -import kotlinx.android.synthetic.main.view_debug_setting.view.tbRouteDynamicEffect import mogo.telematics.pad.MessagePad import mogo_msg.MogoReportMsg import java.text.SimpleDateFormat @@ -100,11 +98,17 @@ class DebugSettingView @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 -) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoObuStatusListener, - IMoGoAutopilotStatusListener, IMoGoAutopilotCarStateListener, - IMoGoMapLocationListener, IMoGoAutopilotIdentifyListener, - IMoGoAutopilotPlanningListener, - IMoGoAutopilotVehicleStateListener, IMoGoDevaToolsFuncConfigListener { +) : ConstraintLayout(context, attrs, defStyleAttr), + IMoGoObuStatusListener, + IMoGoAutopilotStatusListener, + IMoGoAutopilotCarStateListener, + IMoGoMapLocationListener, + IMoGoAutopilotIdentifyListener, + IMoGoAutopilotPlanningListener, + IMoGoAutopilotVehicleStateListener, + IMoGoDevaToolsFuncConfigListener, + IMoGoChassisLamplightListener, + IMoGoDevaToolsListener{ private val TAG = "DebugSettingView" @@ -197,6 +201,8 @@ class DebugSettingView @JvmOverloads constructor( CallerAutopilotPlanningListenerManager.addListener(TAG, this) //添加 车辆底盘数据回调 监听 CallerAutopilotVehicleStateListenerManager.addListener(TAG, this) + //添加 开发套件工具接口 监听 + CallerDevaToolsListenerManager.addListener(TAG, this) //添加 业务配置监听 CallerDevaToolsFuncConfigListenerManager.registerDevaToolsFuncConfigListener( @@ -230,6 +236,8 @@ class DebugSettingView @JvmOverloads constructor( CallerAutopilotPlanningListenerManager.removeListener(TAG) // 移除 车辆底盘数据回调 监听 CallerAutopilotVehicleStateListenerManager.removeListener(TAG) + // 移除 开发套件工具接口 监听 + CallerDevaToolsListenerManager.removeListener(TAG) // 移除 业务配置监听 CallerDevaToolsFuncConfigListenerManager.unRegisterDevaToolsFuncConfigListener( FuncBizConfig.FOUNDATION, TAG) @@ -1385,54 +1393,6 @@ class DebugSettingView @JvmOverloads constructor( CallerDevaToolsManager.stopCatchLog() } } - CallerDevaToolsListenerManager.registerDevaToolsLogCatchListener(TAG, - object : IMoGoDevaToolsListener { - override fun onLogCatchStart() { - super.onLogCatchStart() - tbLogCatch.isChecked = true - } - - override fun onLogCatchClose() { - super.onLogCatchClose() - tbLogCatch.isChecked = false - } - - override fun onLogCatch(lineLog: String) { - logInfoView?.let { - if (logViewAttach) { - it.onLogCatch(lineLog) - } - } - } - - override fun fwThreadClose() { - refreshTraceInfo() - } - - override fun moduleLogChanged(moduleTag: MutableMap) { - //模块日志 tag 发生变化,需要更新对应 UI - setLogCheckedChangeListener() - } - - override fun upgradeVersionUrls(urls: Map?) { - //版本信息更新 - urls?.let { - upgradeVersionList.clear() - it.iterator().forEach { map -> - val name = - if (map.key.contains("{")) map.key.replace("{", "") else map.key - val url = if (map.value.contains("}")) map.value.replace( - "}", - "" - ) else map.value - upgradeVersionList.add(UpgradeVersionEntity(name.trim(), url)) - } - upgradeVersionList.sortByDescending { upgradeVersionEntity -> upgradeVersionEntity.name } - upgradeListAdapter?.setDada(dataFilter(upgradeVersionList)) - upgradeListAdapter?.notifyDataSetChanged() - } - } - }) /** * 展示、关闭日志过滤面板 @@ -2233,5 +2193,50 @@ class DebugSettingView @JvmOverloads constructor( fun showReportListWindow(show: Boolean) } + override fun onLogCatchStart() { + super.onLogCatchStart() + tbLogCatch.isChecked = true + } + + override fun onLogCatchClose() { + super.onLogCatchClose() + tbLogCatch.isChecked = false + } + + override fun onLogCatch(lineLog: String) { + logInfoView?.let { + if (logViewAttach) { + it.onLogCatch(lineLog) + } + } + } + + override fun fwThreadClose() { + refreshTraceInfo() + } + + override fun moduleLogChanged(moduleTag: MutableMap) { + //模块日志 tag 发生变化,需要更新对应 UI + setLogCheckedChangeListener() + } + + override fun upgradeVersionUrls(urls: Map?) { + //版本信息更新 + urls?.let { + upgradeVersionList.clear() + it.iterator().forEach { map -> + val name = + if (map.key.contains("{")) map.key.replace("{", "") else map.key + val url = if (map.value.contains("}")) map.value.replace( + "}", + "" + ) else map.value + upgradeVersionList.add(UpgradeVersionEntity(name.trim(), url)) + } + upgradeVersionList.sortByDescending { upgradeVersionEntity -> upgradeVersionEntity.name } + upgradeListAdapter?.setDada(dataFilter(upgradeVersionList)) + upgradeListAdapter?.notifyDataSetChanged() + } + } } \ 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/widget/SteeringWheelView.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SteeringWheelView.java index fbf8c38268..11c6f71cda 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SteeringWheelView.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SteeringWheelView.java @@ -1,5 +1,7 @@ package com.mogo.eagle.core.function.hmi.ui.widget; +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P; + import android.content.Context; import android.graphics.BlurMaskFilter; import android.util.AttributeSet; @@ -32,8 +34,6 @@ import mogo.telematics.pad.MessagePad; import mogo_msg.MogoReportMsg; import system_master.SystemStatusInfo; -import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P; - /** * @author Jing * @description 方向盘 @@ -185,22 +185,6 @@ public class SteeringWheelView extends ConstraintLayout { } - /** - * 车辆转向灯 - * @param lightSwitch - */ - @Override - public void onAutopilotLightSwitchData(@org.jetbrains.annotations.Nullable Chassis.LightSwitch lightSwitch) { - } - - /** - * 刹车灯 - * @param brakeLight - */ - @Override - public void onAutopilotBrakeLightData(boolean brakeLight) { - } - /** * 车辆加速度 * @param carAcc diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SystemVersionView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SystemVersionView.kt index c30efddd3a..b1b4d59e4a 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SystemVersionView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SystemVersionView.kt @@ -274,7 +274,7 @@ class SystemVersionView @JvmOverloads constructor( return } CallerAutoPilotStatusListenerManager.addListener(TAG, this) - CallerBindingCarListenerManager.registerDevaToolsLogCatchListener(TAG,this) + CallerBindingCarListenerManager.addListener(TAG,this) needQueryContainers = true } @@ -284,7 +284,7 @@ class SystemVersionView @JvmOverloads constructor( return } CallerAutoPilotStatusListenerManager.removeListener(TAG) - CallerBindingCarListenerManager.unRegisterDevaToolsLogCatchListener(TAG) + CallerBindingCarListenerManager.removeListener(TAG) needQueryContainers = false } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.java index afa2fd8782..e069517e3f 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.java @@ -27,7 +27,6 @@ import org.jetbrains.annotations.NotNull; import chassis.Chassis; import chassis.VehicleStateOuterClass; -import mogo.telematics.pad.MessagePad; /** * @author Jing @@ -127,26 +126,6 @@ public class TrafficDataView extends ConstraintLayout { public void onSweeperFutianCleanSystemState(@NonNull VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) { } - /** - * 车辆转向灯 - * @param lightSwitch - */ - @Override - public void onAutopilotLightSwitchData(@org.jetbrains.annotations.Nullable Chassis.LightSwitch lightSwitch) { - if (lightSwitch != null) { - CallerLogger.INSTANCE.d(TAG, "车辆转向灯:" + lightSwitch.toString()); - } - } - - /** - * 刹车灯 - * @param brakeLight - */ - @Override - public void onAutopilotBrakeLightData(boolean brakeLight) { - CallerLogger.INSTANCE.d(TAG, "刹车灯:" + brakeLight); - } - /** * 方向盘转向角 左+右- * @param steering diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java index 5d085a744a..d2093e8196 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java @@ -2,8 +2,8 @@ package com.mogo.eagle.core.function.main; import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI; -import android.app.NotificationManager; import android.annotation.SuppressLint; +import android.app.NotificationManager; import android.content.Context; import android.os.Process; @@ -27,7 +27,6 @@ import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager; import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsUpgradeListenerManager; import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager; -import com.mogo.eagle.core.function.hmi.R; import com.mogo.eagle.core.function.msgbox.db.MsgBoxDb; import com.mogo.eagle.core.function.overview.OverviewDb; import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils; @@ -136,6 +135,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication { }).start(); } + // TODO 李小鹏 这里需要将逻辑抽离出去,单独使用更新服务控制 private void upgradeProgressListener() { final NotificationCompat.Builder builder = new NotificationCompat.Builder(this); // builder.setSmallIcon(R.mipmap.icon1001);//todo emArrow 更换图标,去除地图下载图标的依赖关系 @@ -143,7 +143,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication { builder.setContentText("正在下载"); final NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); - CallerDevaToolsUpgradeListenerManager.INSTANCE.registerDevaToolsUpgradeListener(TAG, new IMogoDevaToolsUpgradeListener() { + CallerDevaToolsUpgradeListenerManager.INSTANCE.addListener(TAG, new IMogoDevaToolsUpgradeListener() { @Override public void onStart(@Nullable String url) { diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt index 4bc32e9a9c..a96da336e2 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt @@ -83,10 +83,9 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, } fun listenTrafficLight() { - CallerTrafficLightListenerManager.registerEnterCrossRoadListener(TAG, this) - CallerTrafficLightListenerManager.registerTrafficLightListener(TAG, this) + CallerTrafficLightListenerManager.addListener(TAG, this) CallerMapLocationListenerManager.addListener(TAG, this, false) - CallVipSetListenerManager.registerVipSetListener(TAG, this) + CallVipSetListenerManager.addListener(TAG, this) } private fun handleRedLightWarning( @@ -269,9 +268,8 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, } fun onDestroy() { - CallerTrafficLightListenerManager.unRegisterTrafficLightListener(TAG) - CallVipSetListenerManager.unRegisterVipSetListener(TAG) - CallerTrafficLightListenerManager.unRegisterEnterCrossRoadListener(TAG) + CallVipSetListenerManager.removeListener(TAG) + CallerTrafficLightListenerManager.removeListener(TAG) CallerMapLocationListenerManager.removeListener(TAG,false) } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/core/TrafficLightDispatcher.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/core/TrafficLightDispatcher.kt index 90c0cad445..74ae42eb90 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/core/TrafficLightDispatcher.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/core/TrafficLightDispatcher.kt @@ -33,12 +33,8 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener , IMoGoTrafficLigh fun initServer(context: Context){ mContext = context - //注册监听AI云获取红绿灯状态 - CallerTrafficLightListenerManager.registerTrafficLightListener(TAG, this) - //注册监听AI云进入路口 - CallerTrafficLightListenerManager.registerEnterCrossRoadListener(TAG, this) - //注册监听红绿灯请求失败 - CallerTrafficLightListenerManager.registerTrafficRequestErrorListener(TAG,this) + //注册监听AI云获取红绿灯状态,注册监听AI云进入路口,注册监听红绿灯请求失败 + CallerTrafficLightListenerManager.addListener(TAG, this) //注册监听工控机感知红绿灯 CallerAutopilotIdentifyListenerManager.addListener(TAG, this) } @@ -122,14 +118,10 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener , IMoGoTrafficLigh fun destroy(){ - //取消注册监听AI云获取红绿灯状态 - CallerTrafficLightListenerManager.unRegisterTrafficLightListener(TAG) + //取消注册监听AI云获取红绿灯状态,取消注册监听红绿灯请求失败,取消注册监听AI云进入路口 + CallerTrafficLightListenerManager.removeListener(TAG) //取消注册监听工控机感知红绿灯 CallerAutopilotIdentifyListenerManager.removeListener(TAG) - //取消注册监听红绿灯请求失败 - CallerTrafficLightListenerManager.unRegisterTrafficRequestErrorListener(TAG) - //取消注册监听AI云进入路口 - CallerTrafficLightListenerManager.unRegisterEnterCrossRoadListener(TAG) } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt index cabeadc624..acd05e9f1a 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt @@ -14,7 +14,10 @@ import com.mogo.eagle.core.data.enums.EventTypeEnum import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.data.msgbox.MsgBoxType import com.mogo.eagle.core.data.msgbox.V2XMsg -import com.mogo.eagle.core.data.trafficlight.* +import com.mogo.eagle.core.data.trafficlight.TrafficLightResult +import com.mogo.eagle.core.data.trafficlight.currentRoadTrafficLight +import com.mogo.eagle.core.data.trafficlight.isGreen +import com.mogo.eagle.core.data.trafficlight.isRed import com.mogo.eagle.core.data.v2x.VipMessage import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener @@ -155,8 +158,7 @@ class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListe ) CallerHmiManager.vipIdentification(true) CallVipSetListenerManager.invokeVipSetStatus(true) - CallerTrafficLightListenerManager.registerTrafficLightListener(TAG, this) - CallerTrafficLightListenerManager.registerEnterCrossRoadListener(TAG, this) + CallerTrafficLightListenerManager.addListener(TAG, this) } private fun cancelVip() { @@ -167,8 +169,7 @@ class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListe resetConditions() CallerHmiManager.vipIdentification(false) CallVipSetListenerManager.invokeVipSetStatus(false) - CallerTrafficLightListenerManager.unRegisterTrafficLightListener(TAG) - CallerTrafficLightListenerManager.unRegisterEnterCrossRoadListener(TAG) + CallerTrafficLightListenerManager.removeListener(TAG) } private fun requestVip() { diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt index bc80cc6fd9..fa92a0ed2e 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt @@ -8,18 +8,6 @@ import chassis.VehicleStateOuterClass */ interface IMoGoAutopilotVehicleStateListener { - /** - * 车辆转向灯 数据 - * @param lightSwitch - */ - fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?) - - /** - * 车辆刹车灯 数据 - * @param brakeLight - */ - fun onAutopilotBrakeLightData(brakeLight: Boolean) - /** * 车辆方向盘转向角回调 * @param steering 方向盘转向角 diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisLamplightListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisLamplightListener.kt new file mode 100644 index 0000000000..8e9ec25a58 --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisLamplightListener.kt @@ -0,0 +1,22 @@ +package com.mogo.eagle.core.function.api.autopilot + +import chassis.Chassis + +/** + * 车辆底盘 灯光数据 回调监听 + */ +interface IMoGoChassisLamplightListener { + + /** + * 车辆转向灯 数据 + * @param lightSwitch + */ + fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?){} + + /** + * 车辆刹车灯 数据 + * @param brakeLight + */ + fun onAutopilotBrakeLightData(brakeLight: Boolean){} + +} \ 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 60056dc1a2..fff9e788b6 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 @@ -1,6 +1,5 @@ package com.mogo.eagle.core.function.call.autopilot -import androidx.annotation.Nullable import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener @@ -8,24 +7,19 @@ import com.mogo.eagle.core.function.call.base.CallerBase import com.mogo.eagle.core.utilcode.util.GsonUtils import mogo.telematics.pad.MessagePad import mogo_msg.MogoReportMsg -import system_master.* -import java.util.concurrent.ConcurrentHashMap +import system_master.SystemStatusInfo /** * @author xiaoyuzhou * @date 2021/9/30 5:48 下午 * 域控制器相关的回调监听 */ -object CallerAutoPilotStatusListenerManager : CallerBase() { +object CallerAutoPilotStatusListenerManager : CallerBase() { // 存储最后一次回调的数据,当有新当位置注册了监听将此数据回调过去,防止有些模块注册顺序问题导致无法获取最新状态 @Volatile private var mAutopilotStatusInfo: AutopilotStatusInfo = AutopilotStatusInfo() - // 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 - private val M_AUTOPILOT_STATUS_LISTENERS: ConcurrentHashMap = - ConcurrentHashMap() - @Volatile private var autoPilotMessageCode: String = "" @@ -83,45 +77,6 @@ object CallerAutoPilotStatusListenerManager : CallerBase() { return mAutopilotStatusInfo.satelliteTime } - /** - * 添加 ADAS状态 监听 - * @param tag 标记,用来注销监听使用 - * @param listener 监听回调 - */ - fun addListener( - @Nullable tag: String, - @Nullable listener: IMoGoAutopilotStatusListener - ) { - if (M_AUTOPILOT_STATUS_LISTENERS.containsKey(tag)) { - return - } - M_AUTOPILOT_STATUS_LISTENERS[tag] = listener - listener.onAutopilotStatusResponse(mAutopilotStatusInfo) - } - - /** - * 删除监听 - * @param tag 标记,用来注销监听使用 - */ - fun removeListener(@Nullable tag: String) { - if (!M_AUTOPILOT_STATUS_LISTENERS.containsKey(tag)) { - return - } - M_AUTOPILOT_STATUS_LISTENERS.remove(tag) - } - - /** - * 删除自动驾驶按钮选中监听 - * @param listener 要删除的监听对象 - */ - fun removeListener(@Nullable listener: IMoGoAutopilotStatusListener) { - M_AUTOPILOT_STATUS_LISTENERS.forEach { - if (it.value == listener) { - M_AUTOPILOT_STATUS_LISTENERS.remove(it.key) - } - } - } - /** * 自动驾驶状态信息回调 */ @@ -137,7 +92,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase() { @Synchronized fun invokeAutoPilotStatus(autopilotStatusInfo: AutopilotStatusInfo) { mAutopilotStatusInfo = autopilotStatusInfo - M_AUTOPILOT_STATUS_LISTENERS.forEach { + M_LISTENERS.forEach { val tag = it.key val listener = it.value listener.onAutopilotStatusResponse(mAutopilotStatusInfo) @@ -150,7 +105,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase() { */ @Synchronized fun invokeArriveAtStation(arrivalNotification: MessagePad.ArrivalNotification?) { - M_AUTOPILOT_STATUS_LISTENERS.forEach { + M_LISTENERS.forEach { val tag = it.key val listener = it.value listener.onAutopilotArriveAtStation(arrivalNotification) @@ -162,7 +117,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase() { */ @Synchronized fun invokeAutopilotSNRequest() { - M_AUTOPILOT_STATUS_LISTENERS.forEach { + M_LISTENERS.forEach { val tag = it.key val listener = it.value listener.onAutopilotSNRequest() @@ -174,7 +129,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase() { */ @Synchronized fun invokeAutopilotGuardian(guardianInfo: MogoReportMsg.MogoReportMessage?) { - M_AUTOPILOT_STATUS_LISTENERS.forEach { + M_LISTENERS.forEach { val listener = it.value autoPilotMessageCode = guardianInfo?.code ?: "" autoPilotMessageContent = guardianInfo?.msg ?: "" @@ -186,7 +141,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase() { * 工控机与车机连接状态回调 */ fun invokeAutoPilotIPCStatusChanged(ipcConnectionStatus: Int, reason: String?) { - M_AUTOPILOT_STATUS_LISTENERS.forEach { + M_LISTENERS.forEach { val listener = it.value listener.onAutopilotIpcConnectStatusChanged(ipcConnectionStatus, reason) } @@ -197,7 +152,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase() { */ fun invokeAutopilotStatusRespByQuery(statusInfo: SystemStatusInfo.StatusInfo?) { statusInfo?.also { - M_AUTOPILOT_STATUS_LISTENERS.forEach { itx -> + M_LISTENERS.forEach { itx -> val listener = itx.value listener.onAutopilotStatusRespByQuery(it) } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotActionsListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotActionsListenerManager.kt index 481f47c417..38c7a83260 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotActionsListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotActionsListenerManager.kt @@ -1,61 +1,18 @@ package com.mogo.eagle.core.function.call.autopilot -import androidx.annotation.Nullable import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener import com.mogo.eagle.core.function.call.base.CallerBase import com.zhidao.support.adas.high.bean.AutopilotAbility -import java.util.concurrent.ConcurrentHashMap /** * pnc actions 决策 驾驶的意图 */ -object CallerAutopilotActionsListenerManager : CallerBase() { - - private val M_AUTOPILOT_ACTIONS_LISTENER: ConcurrentHashMap = - ConcurrentHashMap() - - /** - * 添加监听 - * @param tag 标记,用来注销监听使用 - * @param listener 监听回调 - */ - fun addListener( - @Nullable tag: String, - @Nullable listener: IMoGoAutopilotActionsListener - ) { - if (M_AUTOPILOT_ACTIONS_LISTENER.containsKey(tag)) { - return - } - M_AUTOPILOT_ACTIONS_LISTENER[tag] = listener - } - - /** - * 删除监听 - * @param tag 标记,用来注销监听使用 - */ - fun removeListener(@Nullable tag: String) { - if (!M_AUTOPILOT_ACTIONS_LISTENER.containsKey(tag)) { - return - } - M_AUTOPILOT_ACTIONS_LISTENER.remove(tag) - } - - /** - * 删除自动驾驶按钮选中监听 - * @param listener 要删除的监听对象 - */ - fun removeListener(@Nullable listener: IMoGoAutopilotActionsListener) { - M_AUTOPILOT_ACTIONS_LISTENER.forEach { - if (it.value == listener) { - M_AUTOPILOT_ACTIONS_LISTENER.remove(it.key) - } - } - } +object CallerAutopilotActionsListenerManager : CallerBase() { @Synchronized fun invokeAutopilotAbility(ability: AutopilotAbility?) { - M_AUTOPILOT_ACTIONS_LISTENER.forEach { + M_LISTENERS.forEach { val listener = it.value listener.onAutopilotAbility(ability) } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarConfigListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarConfigListenerManager.kt index b66eebe287..f0a8c39261 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarConfigListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarConfigListenerManager.kt @@ -1,63 +1,15 @@ package com.mogo.eagle.core.function.call.autopilot -import androidx.annotation.Nullable import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener import com.mogo.eagle.core.function.call.base.CallerBase import mogo.telematics.pad.MessagePad -import java.util.concurrent.ConcurrentHashMap /** * 车辆配置信息 回调监听 */ -object CallerAutopilotCarConfigListenerManager : CallerBase() { +object CallerAutopilotCarConfigListenerManager : CallerBase() { - private var mCarConfigResp: MessagePad.CarConfigResp?= null - - // 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 - private val M_AUTOPILOT_CAR_CONFIG_LISTENERS: ConcurrentHashMap = - ConcurrentHashMap() - - /** - * 添加 配置信息 监听 - * @param tag 标记,用来注销监听使用 - * @param listener 监听回调 - */ - fun addListener( - @Nullable tag: String, - @Nullable listener: IMoGoAutopilotCarConfigListener - ) { - if (M_AUTOPILOT_CAR_CONFIG_LISTENERS.containsKey(tag)) { - return - } - M_AUTOPILOT_CAR_CONFIG_LISTENERS[tag] = listener - - mCarConfigResp?.let { - listener.onAutopilotCarConfig(it) - } - } - - /** - * 删除监听 - * @param tag 标记,用来注销监听使用 - */ - fun removeListener(@Nullable tag: String) { - if (!M_AUTOPILOT_CAR_CONFIG_LISTENERS.containsKey(tag)) { - return - } - M_AUTOPILOT_CAR_CONFIG_LISTENERS.remove(tag) - } - - /** - * 删除配置信息监听 - * @param listener 要删除的监听对象 - */ - fun removeListener(@Nullable listener: IMoGoAutopilotCarConfigListener) { - M_AUTOPILOT_CAR_CONFIG_LISTENERS.forEach { - if (it.value == listener) { - M_AUTOPILOT_CAR_CONFIG_LISTENERS.remove(it.key) - } - } - } + private var mCarConfigResp: MessagePad.CarConfigResp? = null /** * 工控机基础信息回调 @@ -66,7 +18,7 @@ object CallerAutopilotCarConfigListenerManager : CallerBase() { @Synchronized fun invokeAutopilotCarConfigData(carConfigResp: MessagePad.CarConfigResp) { mCarConfigResp = carConfigResp - M_AUTOPILOT_CAR_CONFIG_LISTENERS.forEach { + M_LISTENERS.forEach { val listener = it.value listener.onAutopilotCarConfig(carConfigResp) } 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 6429455cbd..a8f1035d67 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 @@ -1,65 +1,20 @@ package com.mogo.eagle.core.function.call.autopilot -import androidx.annotation.Nullable import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener import com.mogo.eagle.core.function.call.base.CallerBase import mogo.telematics.pad.MessagePad -import java.util.concurrent.ConcurrentHashMap /** * @author xiaoyuzhou * @date 2021/9/30 5:48 下午 * 车辆状态&定位 数据 数据 回调监听 */ -object CallerAutopilotCarStatusListenerManager : CallerBase() { - - // 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 - private val M_AUTOPILOT_STATUS_LISTENERS: ConcurrentHashMap = - ConcurrentHashMap() +object CallerAutopilotCarStatusListenerManager : CallerBase() { @Volatile private var gnssInfo: MessagePad.GnssInfo? = null - /** - * 添加 ADAS车辆状态&定位 监听 - * @param tag 标记,用来注销监听使用 - * @param listener 监听回调 - */ - fun addListener( - @Nullable tag: String, - @Nullable listener: IMoGoAutopilotCarStateListener - ) { - if (M_AUTOPILOT_STATUS_LISTENERS.containsKey(tag)) { - return - } - M_AUTOPILOT_STATUS_LISTENERS[tag] = listener - } - - /** - * 删除监听 - * @param tag 标记,用来注销监听使用 - */ - fun removeListener(@Nullable tag: String) { - if (!M_AUTOPILOT_STATUS_LISTENERS.containsKey(tag)) { - return - } - M_AUTOPILOT_STATUS_LISTENERS.remove(tag) - } - - /** - * 删除自动驾驶按钮选中监听 - * @param listener 要删除的监听对象 - */ - fun removeListener(@Nullable listener: IMoGoAutopilotCarStateListener) { - M_AUTOPILOT_STATUS_LISTENERS.forEach { - if (it.value == listener) { - M_AUTOPILOT_STATUS_LISTENERS.remove(it.key) - } - } - } - - - fun getCurrentGnssInfo():MessagePad.GnssInfo? { + fun getCurrentGnssInfo(): MessagePad.GnssInfo? { return gnssInfo } @@ -70,7 +25,7 @@ object CallerAutopilotCarStatusListenerManager : CallerBase() { @Synchronized fun invokeAutopilotCarStateData(gnssInfo: MessagePad.GnssInfo?) { this.gnssInfo = gnssInfo - M_AUTOPILOT_STATUS_LISTENERS.forEach { + M_LISTENERS.forEach { val tag = it.key val listener = it.value listener.onAutopilotCarStateData(gnssInfo) 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 5e606b0fa7..d5dc3bfeaf 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 @@ -1,67 +1,23 @@ package com.mogo.eagle.core.function.call.autopilot -import androidx.annotation.Nullable import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener import com.mogo.eagle.core.function.call.base.CallerBase import mogo.telematics.pad.MessagePad import perception.TrafficLightOuterClass -import java.util.concurrent.ConcurrentHashMap /** * @author xiaoyuzhou * @date 2021/9/30 5:48 下午 * 域控制器感知数据 */ -object CallerAutopilotIdentifyListenerManager : CallerBase() { - - // 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 - private val M_AUTOPILOT_IDENTIFY_LISTENERS: ConcurrentHashMap = - ConcurrentHashMap() - - /** - * 添加 域控制器感知数据 监听 - * @param tag 标记,用来注销监听使用 - * @param listener 监听回调 - */ - fun addListener( - @Nullable tag: String, - @Nullable listener: IMoGoAutopilotIdentifyListener - ) { - if (M_AUTOPILOT_IDENTIFY_LISTENERS.containsKey(tag)) { - return - } - M_AUTOPILOT_IDENTIFY_LISTENERS[tag] = listener - } - - /** - * 删除监听 - * @param tag 标记,用来注销监听使用 - */ - fun removeListener(@Nullable tag: String) { - if (!M_AUTOPILOT_IDENTIFY_LISTENERS.containsKey(tag)) { - return - } - M_AUTOPILOT_IDENTIFY_LISTENERS.remove(tag) - } - - /** - * 删除自动驾驶按钮选中监听 - * @param listener 要删除的监听对象 - */ - fun removeListener(@Nullable listener: IMoGoAutopilotIdentifyListener) { - M_AUTOPILOT_IDENTIFY_LISTENERS.forEach { - if (it.value == listener) { - M_AUTOPILOT_IDENTIFY_LISTENERS.remove(it.key) - } - } - } +object CallerAutopilotIdentifyListenerManager : CallerBase() { /** * 识别交通元素数据发生更新 回调 */ @Synchronized fun invokeAutopilotIdentifyDataUpdate(trafficData: List?) { - M_AUTOPILOT_IDENTIFY_LISTENERS.forEach { + M_LISTENERS.forEach { val tag = it.key val listener = it.value listener.onAutopilotIdentifyDataUpdate(trafficData) @@ -69,8 +25,8 @@ object CallerAutopilotIdentifyListenerManager : CallerBase() { } @Synchronized - fun invokeAutopilotIdentifyPlanningObj(planningObjects: List?){ - M_AUTOPILOT_IDENTIFY_LISTENERS.forEach { + fun invokeAutopilotIdentifyPlanningObj(planningObjects: List?) { + M_LISTENERS.forEach { val tag = it.key val listener = it.value listener.onAutopilotIdentifyPlanningObj(planningObjects) @@ -82,7 +38,7 @@ object CallerAutopilotIdentifyListenerManager : CallerBase() { */ @Synchronized fun invokeAutopilotWarnMessage(warn: MessagePad.Warn?) { - M_AUTOPILOT_IDENTIFY_LISTENERS.forEach { + M_LISTENERS.forEach { val tag = it.key val listener = it.value listener.onAutopilotWarnMessage(warn) @@ -92,8 +48,8 @@ object CallerAutopilotIdentifyListenerManager : CallerBase() { /** * 感知红绿灯 */ - fun invokeAutopilotPerceptionTrafficLight(trafficLights: TrafficLightOuterClass.TrafficLights?){ - M_AUTOPILOT_IDENTIFY_LISTENERS.forEach{ + fun invokeAutopilotPerceptionTrafficLight(trafficLights: TrafficLightOuterClass.TrafficLights?) { + M_LISTENERS.forEach { val tag = it.key val listener = it.value listener.onAutopilotPerceptionTrafficLight(trafficLights) diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotPlanningActionsListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotPlanningActionsListenerManager.kt index 1d9801fc5c..f0f28cc6f1 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotPlanningActionsListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotPlanningActionsListenerManager.kt @@ -1,56 +1,13 @@ package com.mogo.eagle.core.function.call.autopilot -import androidx.annotation.Nullable import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningActionsListener import com.mogo.eagle.core.function.call.base.CallerBase import mogo.telematics.pad.MessagePad -import java.util.concurrent.ConcurrentHashMap /** * PNC 决策行为相关监听 */ -object CallerAutopilotPlanningActionsListenerManager : CallerBase() { - - private val M_AUTOPILOT_PLANNING_ACTIONS_LISTENER: ConcurrentHashMap = - ConcurrentHashMap() - - /** - * 添加监听 - * @param tag 标记,用来注销监听使用 - * @param listener 监听回调 - */ - fun addListener( - @Nullable tag: String, - @Nullable listener: IMoGoAutopilotPlanningActionsListener - ) { - if (M_AUTOPILOT_PLANNING_ACTIONS_LISTENER.containsKey(tag)) { - return - } - M_AUTOPILOT_PLANNING_ACTIONS_LISTENER[tag] = listener - } - - /** - * 删除监听 - * @param tag 标记,用来注销监听使用 - */ - fun removeListener(@Nullable tag: String) { - if (!M_AUTOPILOT_PLANNING_ACTIONS_LISTENER.containsKey(tag)) { - return - } - M_AUTOPILOT_PLANNING_ACTIONS_LISTENER.remove(tag) - } - - /** - * 删除自动驾驶按钮选中监听 - * @param listener 要删除的监听对象 - */ - fun removeListener(@Nullable listener: IMoGoAutopilotPlanningActionsListener) { - M_AUTOPILOT_PLANNING_ACTIONS_LISTENER.forEach { - if (it.value == listener) { - M_AUTOPILOT_PLANNING_ACTIONS_LISTENER.remove(it.key) - } - } - } +object CallerAutopilotPlanningActionsListenerManager : CallerBase() { /** * pnc actions 决策回调 @@ -58,12 +15,11 @@ object CallerAutopilotPlanningActionsListenerManager : CallerBase() { */ @Synchronized fun invokePNCActions(planningActionMsg: MessagePad.PlanningActionMsg) { - M_AUTOPILOT_PLANNING_ACTIONS_LISTENER.forEach { + M_LISTENERS.forEach { val tag = it.key val listener = it.value listener.pncActions(planningActionMsg) } } - } \ No newline at end of file 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 0e998ac52d..212963419a 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 @@ -1,59 +1,15 @@ package com.mogo.eagle.core.function.call.autopilot -import androidx.annotation.Nullable import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener import com.mogo.eagle.core.function.call.base.CallerBase import mogo.telematics.pad.MessagePad -import java.util.concurrent.ConcurrentHashMap /** * @author xiaoyuzhou * @date 2021/9/30 5:48 下午 * 规划路径相关回调 */ -object CallerAutopilotPlanningListenerManager : CallerBase() { - - // 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 - private val M_AUTOPILOT_PLANNING_LISTENER: ConcurrentHashMap = - ConcurrentHashMap() - - /** - * 添加监听 - * @param tag 标记,用来注销监听使用 - * @param listener 监听回调 - */ - fun addListener( - @Nullable tag: String, - @Nullable listener: IMoGoAutopilotPlanningListener - ) { - if (M_AUTOPILOT_PLANNING_LISTENER.containsKey(tag)) { - return - } - M_AUTOPILOT_PLANNING_LISTENER[tag] = listener - } - - /** - * 删除监听 - * @param tag 标记,用来注销监听使用 - */ - fun removeListener(@Nullable tag: String) { - if (!M_AUTOPILOT_PLANNING_LISTENER.containsKey(tag)) { - return - } - M_AUTOPILOT_PLANNING_LISTENER.remove(tag) - } - - /** - * 删除自动驾驶按钮选中监听 - * @param listener 要删除的监听对象 - */ - fun removeListener(@Nullable listener: IMoGoAutopilotPlanningListener) { - M_AUTOPILOT_PLANNING_LISTENER.forEach { - if (it.value == listener) { - M_AUTOPILOT_PLANNING_LISTENER.remove(it.key) - } - } - } +object CallerAutopilotPlanningListenerManager : CallerBase() { /** * 车前引导线 回调 @@ -61,7 +17,7 @@ object CallerAutopilotPlanningListenerManager : CallerBase() { */ @Synchronized fun invokeAutopilotTrajectory(trajectoryInfo: MutableList) { - M_AUTOPILOT_PLANNING_LISTENER.forEach { + M_LISTENERS.forEach { val tag = it.key val listener = it.value listener.onAutopilotTrajectory(trajectoryInfo) @@ -74,7 +30,7 @@ object CallerAutopilotPlanningListenerManager : CallerBase() { */ @Synchronized fun invokeAutopilotRotting(globalPathResp: MessagePad.GlobalPathResp?) { - M_AUTOPILOT_PLANNING_LISTENER.forEach { + M_LISTENERS.forEach { val tag = it.key val listener = it.value listener.onAutopilotRotting(globalPathResp) diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotPointCloudListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotPointCloudListenerManager.kt index 933f5568dd..9e6e6a05dc 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotPointCloudListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotPointCloudListenerManager.kt @@ -1,65 +1,21 @@ package com.mogo.eagle.core.function.call.autopilot -import androidx.annotation.Nullable import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPointCloudListener import com.mogo.eagle.core.function.call.base.CallerBase -import java.util.concurrent.ConcurrentHashMap /** * @author xiaoyuzhou * @date 2021/9/30 5:48 下午 * 点云数据管理 */ -object CallerAutopilotPointCloudListenerManager : CallerBase() { - - // 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 - private val M_POINT_CLOUD_LISTENERS: ConcurrentHashMap = - ConcurrentHashMap() - - /** - * 添加 点云数据 监听 - * @param tag 标记,用来注销监听使用 - * @param listener 监听回调 - */ - fun addListener( - @Nullable tag: String, - @Nullable listener: IMoGoAutopilotPointCloudListener - ) { - if (M_POINT_CLOUD_LISTENERS.containsKey(tag)) { - return - } - M_POINT_CLOUD_LISTENERS[tag] = listener - } - - /** - * 删除监听 - * @param tag 标记,用来注销监听使用 - */ - fun removeListener(@Nullable tag: String) { - if (!M_POINT_CLOUD_LISTENERS.containsKey(tag)) { - return - } - M_POINT_CLOUD_LISTENERS.remove(tag) - } - - /** - * 删除 点云数据 监听 - * @param listener 要删除的监听对象 - */ - fun removeListener(@Nullable listener: IMoGoAutopilotPointCloudListener) { - M_POINT_CLOUD_LISTENERS.forEach { - if (it.value == listener) { - M_POINT_CLOUD_LISTENERS.remove(it.key) - } - } - } +object CallerAutopilotPointCloudListenerManager : CallerBase() { /** * 点云数据 回调 */ @Synchronized fun invokeAutopilotPointCloudDataUpdate(pointCloud: ByteArray?) { - M_POINT_CLOUD_LISTENERS.forEach { + M_LISTENERS.forEach { val tag = it.key val listener = it.value listener.onAutopilotPointCloudDataUpdate(pointCloud) diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotRecordListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotRecordListenerManager.kt index b1280cb09a..5ae8d5a153 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotRecordListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotRecordListenerManager.kt @@ -1,66 +1,22 @@ package com.mogo.eagle.core.function.call.autopilot -import androidx.annotation.Nullable import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener import com.mogo.eagle.core.function.call.base.CallerBase import mogo.telematics.pad.MessagePad import record_cache.RecordPanelOuterClass -import java.util.concurrent.ConcurrentHashMap /** * @author xiaoyuzhou * @date 2021/9/30 5:48 下午 * 采集结果回调管理 */ -object CallerAutopilotRecordListenerManager : CallerBase() { - - // 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 - private val M_AUTOPILOT_RECORD_LISTENERS: ConcurrentHashMap = - ConcurrentHashMap() - - /** - * 添加 域控制器感知数据 监听 - * @param tag 标记,用来注销监听使用 - * @param listener 监听回调 - */ - fun addListener( - @Nullable tag: String, - @Nullable listener: IMoGoAutopilotRecordListener - ) { - if (M_AUTOPILOT_RECORD_LISTENERS.containsKey(tag)) { - return - } - M_AUTOPILOT_RECORD_LISTENERS[tag] = listener - } - - /** - * 删除监听 - * @param tag 标记,用来注销监听使用 - */ - fun removeListener(@Nullable tag: String) { - if (!M_AUTOPILOT_RECORD_LISTENERS.containsKey(tag)) { - return - } - M_AUTOPILOT_RECORD_LISTENERS.remove(tag) - } - - /** - * 删除自动驾驶按钮选中监听 - * @param listener 要删除的监听对象 - */ - fun removeListener(@Nullable listener: IMoGoAutopilotRecordListener) { - M_AUTOPILOT_RECORD_LISTENERS.forEach { - if (it.value == listener) { - M_AUTOPILOT_RECORD_LISTENERS.remove(it.key) - } - } - } +object CallerAutopilotRecordListenerManager : CallerBase() { /** * 采集任务记录回调 */ fun invokeAutopilotRecordResult(recordPanel: RecordPanelOuterClass.RecordPanel) { - M_AUTOPILOT_RECORD_LISTENERS.forEach { + M_LISTENERS.forEach { val tag = it.key val listener = it.value listener.onAutopilotRecordResult(recordPanel) @@ -70,13 +26,12 @@ object CallerAutopilotRecordListenerManager : CallerBase() { /** * 数据采集配置应答 */ - fun invokeAutopilotRecordConfig(config: MessagePad.RecordDataConfig){ - M_AUTOPILOT_RECORD_LISTENERS.forEach{ + fun invokeAutopilotRecordConfig(config: MessagePad.RecordDataConfig) { + M_LISTENERS.forEach { val tag = it.key val listener = it.value listener.onAutopilotRecordConfig(config) } } - } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotStatisticsListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotStatisticsListenerManager.kt index 3e8dd76882..ef6b958436 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotStatisticsListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotStatisticsListenerManager.kt @@ -1,58 +1,14 @@ package com.mogo.eagle.core.function.call.autopilot -import androidx.annotation.Nullable import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatisticsListener import com.mogo.eagle.core.function.call.base.CallerBase import com.zhidao.support.adas.high.bean.AutopilotStatistics -import java.util.concurrent.ConcurrentHashMap - -object CallerAutopilotStatisticsListenerManager : CallerBase() { - - private val M_AUTOPILOT_STATISTICS_LISTENER: ConcurrentHashMap = - ConcurrentHashMap() - - /** - * 添加监听 - * @param tag 标记,用来注销监听使用 - * @param listener 监听回调 - */ - fun addListener( - @Nullable tag: String, - @Nullable listener: IMoGoAutopilotStatisticsListener - ) { - if (M_AUTOPILOT_STATISTICS_LISTENER.containsKey(tag)) { - return - } - M_AUTOPILOT_STATISTICS_LISTENER[tag] = listener - } - - /** - * 删除监听 - * @param tag 标记,用来注销监听使用 - */ - fun removeListener(@Nullable tag: String) { - if (!M_AUTOPILOT_STATISTICS_LISTENER.containsKey(tag)) { - return - } - M_AUTOPILOT_STATISTICS_LISTENER.remove(tag) - } - - /** - * 删除自动驾驶按钮选中监听 - * @param listener 要删除的监听对象 - */ - fun removeListener(@Nullable listener: IMoGoAutopilotStatisticsListener) { - M_AUTOPILOT_STATISTICS_LISTENER.forEach { - if (it.value == listener) { - M_AUTOPILOT_STATISTICS_LISTENER.remove(it.key) - } - } - } +object CallerAutopilotStatisticsListenerManager : CallerBase() { @Synchronized fun invokeAutopilotStatistics(statistics: AutopilotStatistics?) { - M_AUTOPILOT_STATISTICS_LISTENER.forEach { + M_LISTENERS.forEach { val listener = it.value listener.onAutopilotStatistics(statistics) } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt index 7485dec238..6c4c4283d8 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt @@ -1,90 +1,24 @@ package com.mogo.eagle.core.function.call.autopilot -import androidx.annotation.Nullable import chassis.Chassis import chassis.VehicleStateOuterClass import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener import com.mogo.eagle.core.function.call.base.CallerBase -import java.util.concurrent.ConcurrentHashMap /** * 车辆底盘数据 回调监听 */ -object CallerAutopilotVehicleStateListenerManager : CallerBase() { - - // 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 - private val M_AUTOPILOT_VEHICLE_LISTENERS: ConcurrentHashMap = - ConcurrentHashMap() +object CallerAutopilotVehicleStateListenerManager : CallerBase() { @Volatile private var timeStamp: Long = 0L - /** - * 添加 ADAS车辆状态&定位 监听 - * @param tag 标记,用来注销监听使用 - * @param listener 监听回调 - */ - fun addListener( - @Nullable tag: String, - @Nullable listener: IMoGoAutopilotVehicleStateListener - ) { - if (M_AUTOPILOT_VEHICLE_LISTENERS.containsKey(tag)) { - return - } - M_AUTOPILOT_VEHICLE_LISTENERS[tag] = listener - } - - /** - * 删除监听 - * @param tag 标记,用来注销监听使用 - */ - fun removeListener(@Nullable tag: String) { - if (!M_AUTOPILOT_VEHICLE_LISTENERS.containsKey(tag)) { - return - } - M_AUTOPILOT_VEHICLE_LISTENERS.remove(tag) - } - - /** - * 删除自动驾驶按钮选中监听 - * @param listener 要删除的监听对象 - */ - fun removeListener(@Nullable listener: IMoGoAutopilotVehicleStateListener) { - M_AUTOPILOT_VEHICLE_LISTENERS.forEach { - if (it.value == listener) { - M_AUTOPILOT_VEHICLE_LISTENERS.remove(it.key) - } - } - } - - /** - * 车辆转向灯数据回调 - * @param lightSwitch - */ - fun invokeAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?) { - M_AUTOPILOT_VEHICLE_LISTENERS.forEach { - val listener = it.value - listener.onAutopilotLightSwitchData(lightSwitch) - } - } - - /** - * 车辆刹车灯数据回调 - * @param brakeLight - */ - fun invokeAutopilotBrakeLightData(brakeLight: Boolean) { - M_AUTOPILOT_VEHICLE_LISTENERS.forEach { - val listener = it.value - listener.onAutopilotBrakeLightData(brakeLight) - } - } - /** * 车辆方向盘转向角回调 * @param steering 方向盘转向角 */ fun invokeAutopilotSteeringData(steering: Float){ - M_AUTOPILOT_VEHICLE_LISTENERS.forEach{ + M_LISTENERS.forEach{ val listener = it.value listener.onAutopilotSteeringData(steering) } @@ -95,7 +29,7 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() { * @param gear 档位 */ fun invokeAutopilotGearData(gear: Chassis.GearPosition){ - M_AUTOPILOT_VEHICLE_LISTENERS.forEach{ + M_LISTENERS.forEach{ val listener = it.value listener.onAutopilotGearData(gear) } @@ -106,7 +40,7 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() { * acc 加速度 */ fun invokeAutopilotAcc(carAcc: Float){ - M_AUTOPILOT_VEHICLE_LISTENERS.forEach{ + M_LISTENERS.forEach{ val listener = it.value listener.onAutopilotAcc(carAcc) } @@ -116,7 +50,7 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() { * throttle 油门 */ fun invokeAutopilotThrottle(throttle: Float){ - M_AUTOPILOT_VEHICLE_LISTENERS.forEach{ + M_LISTENERS.forEach{ val listener = it.value listener.onAutopilotThrottle(throttle) } @@ -126,7 +60,7 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() { * brake 刹车 */ fun invokeAutopilotBrake(brake: Float){ - M_AUTOPILOT_VEHICLE_LISTENERS.forEach{ + M_LISTENERS.forEach{ val listener = it.value listener.onAutopilotBrake(brake) } @@ -136,7 +70,7 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() { * clean system state 清扫车(福田)清扫控制系统状态 */ fun invokeSweeperFutianCleanSystemState(cleanSystemState: VehicleStateOuterClass.SweeperFuTianCleanSystemState){ - M_AUTOPILOT_VEHICLE_LISTENERS.forEach{ + M_LISTENERS.forEach{ val listener = it.value listener.onSweeperFutianCleanSystemState(cleanSystemState) } @@ -158,7 +92,7 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() { } fun invokeAutopilotDataException(timestamp: Long) { - M_AUTOPILOT_VEHICLE_LISTENERS.forEach{ + M_LISTENERS.forEach{ val listener = it.value listener.onAutopilotDataException(timestamp) } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisLamplightListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisLamplightListenerManager.kt new file mode 100644 index 0000000000..dddbc56fe1 --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisLamplightListenerManager.kt @@ -0,0 +1,34 @@ +package com.mogo.eagle.core.function.call.autopilot + +import chassis.Chassis +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener +import com.mogo.eagle.core.function.call.base.CallerBase + +/** + * 车辆底盘灯光数据 回调监听 + */ +object CallerChassisLamplightListenerManager : CallerBase() { + + /** + * 车辆转向灯数据回调 + * @param lightSwitch + */ + fun invokeAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?) { + M_LISTENERS.forEach { + val listener = it.value + listener.onAutopilotLightSwitchData(lightSwitch) + } + } + + /** + * 车辆刹车灯数据回调 + * @param brakeLight + */ + fun invokeAutopilotBrakeLightData(brakeLight: Boolean) { + M_LISTENERS.forEach { + val listener = it.value + listener.onAutopilotBrakeLightData(brakeLight) + } + } + +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerStartAutopilotFailedListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerStartAutopilotFailedListenerManager.kt index e32f1b973a..040dc0570e 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerStartAutopilotFailedListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerStartAutopilotFailedListenerManager.kt @@ -1,61 +1,18 @@ package com.mogo.eagle.core.function.call.autopilot -import androidx.annotation.Nullable import com.mogo.eagle.core.function.api.autopilot.IMoGoStartAutopilotFailedListener import com.mogo.eagle.core.function.call.base.CallerBase import mogo_msg.MogoReportMsg -import java.util.concurrent.ConcurrentHashMap /** * 启动自动驾驶失败监听 * 注册/取消注册 */ -object CallerStartAutopilotFailedListenerManager : CallerBase() { - - private val M_START_AUTOPILOT_FAILED_LISTENER: ConcurrentHashMap = - ConcurrentHashMap() - - /** - * 添加监听 - * @param tag 标记,用来注销监听使用 - * @param listener 监听回调 - */ - fun addListener( - @Nullable tag: String, - @Nullable listener: IMoGoStartAutopilotFailedListener - ) { - if (M_START_AUTOPILOT_FAILED_LISTENER.containsKey(tag)) { - return - } - M_START_AUTOPILOT_FAILED_LISTENER[tag] = listener - } - - /** - * 删除监听 - * @param tag 标记,用来注销监听使用 - */ - fun removeListener(@Nullable tag: String) { - if (!M_START_AUTOPILOT_FAILED_LISTENER.containsKey(tag)) { - return - } - M_START_AUTOPILOT_FAILED_LISTENER.remove(tag) - } - - /** - * 删除监听 - * @param listener 要删除的监听对象 - */ - fun removeListener(@Nullable listener: IMoGoStartAutopilotFailedListener) { - M_START_AUTOPILOT_FAILED_LISTENER.forEach { - if (it.value == listener) { - M_START_AUTOPILOT_FAILED_LISTENER.remove(it.key) - } - } - } +object CallerStartAutopilotFailedListenerManager : CallerBase() { @Synchronized fun invokeStartAutopilotFailed(message: MogoReportMsg.MogoReportMessage?) { - M_START_AUTOPILOT_FAILED_LISTENER.forEach { + M_LISTENERS.forEach { val listener = it.value listener.onStartAutopilotFailed(message) } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/base/CallerBase.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/base/CallerBase.kt index fb22f18b63..853d2cbb8d 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/base/CallerBase.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/base/CallerBase.kt @@ -1,36 +1,91 @@ -package com.mogo.eagle.core.function.call.base; +package com.mogo.eagle.core.function.call.base -import com.alibaba.android.arouter.facade.template.IProvider; -import com.alibaba.android.arouter.launcher.ARouter; -import com.mogo.eagle.core.function.call.CallerBusManager; -import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; +import com.alibaba.android.arouter.facade.template.IProvider +import com.alibaba.android.arouter.launcher.ARouter +import com.mogo.eagle.core.function.call.CallerBusManager +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d +import java.util.concurrent.ConcurrentHashMap /** * @author xiaoyuzhou - * @date 2021/9/17 4:02 下午 + * @date 2023/01/04 4:02 下午 */ -public class CallerBase { - private static final String TAG = "CallerBase"; +open class CallerBase { - public static T getApiInstance(Class clazz, String path) { - T inst = CallerBusManager.get(clazz); - if (inst == null) { - synchronized (CallerBase.class) { - inst = CallerBusManager.get(clazz); - if (inst != null) { - return inst; - } - T newInst = (T) ARouter.getInstance().build(path).navigation(); - try { - CallerBusManager.registerApi(clazz, newInst); - CallerLogger.INSTANCE.d(TAG, "keep IProvider instance to SingletonHolder: path :" + path); - } catch (Exception e) { - e.printStackTrace(); - } - return newInst; - } + // 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 + val M_LISTENERS: ConcurrentHashMap = ConcurrentHashMap() + + /** + * 添加 监听 + * @param tag 标记,用来注销监听使用 + * @param listener 监听回调 + */ + fun addListener( + tag: String, + listener: T + ) { + if (M_LISTENERS.containsKey(tag)) { + return } - return inst; + M_LISTENERS[tag] = listener + doSomeAfterAddListener(tag, listener) } -} + /** + * 在添加了监听后执行 + */ + open fun doSomeAfterAddListener(tag: String, listener: T) {} + + /** + * 删除监听 + * @param tag 标记,用来注销监听使用 + */ + fun removeListener(tag: String) { + if (!M_LISTENERS.containsKey(tag)) { + return + } + M_LISTENERS.remove(tag) + } + + /** + * 删除监听 + * @param listener 要删除的监听对象 + */ + fun removeListener(listener: T) { + if (!M_LISTENERS.containsValue(listener)) { + return + } + M_LISTENERS.forEach { + if (it.value == listener) { + M_LISTENERS.remove(it.key) + } + } + } + + + companion object { + private const val TAG = "CallerBase" + + @JvmStatic + fun getApiInstance(clazz: Class?, path: String): T { + var inst = CallerBusManager.get(clazz) + if (inst == null) { + synchronized(CallerBase::class.java) { + inst = CallerBusManager.get(clazz) + if (inst != null) { + return inst + } + val newInst = ARouter.getInstance().build(path).navigation() as T + try { + CallerBusManager.registerApi(clazz, newInst) + d(TAG, "keep IProvider instance to SingletonHolder: path :$path") + } catch (e: Exception) { + e.printStackTrace() + } + return newInst + } + } + return inst + } + } +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/bindingcar/CallerBindingCarListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/bindingcar/CallerBindingCarListenerManager.kt index a39d34a90e..6522ba2c3f 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/bindingcar/CallerBindingCarListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/bindingcar/CallerBindingCarListenerManager.kt @@ -1,69 +1,24 @@ package com.mogo.eagle.core.function.call.bindingcar -import androidx.annotation.Nullable import com.mogo.eagle.core.function.api.bindingcar.IMoGoBindingCarListener -import java.util.concurrent.ConcurrentHashMap +import com.mogo.eagle.core.function.call.base.CallerBase /** * @author XuXinChao * @description * @since: 2022/5/18 */ -object CallerBindingCarListenerManager { +object CallerBindingCarListenerManager : CallerBase() { - private val BINDING_CAR_LISTENER: ConcurrentHashMap = - ConcurrentHashMap() - - /** - * 添加监听 - * @param tag 标记,用来注销监听使用 - * @param listener 监听回调 - */ - fun registerDevaToolsLogCatchListener( - @Nullable tag: String, - @Nullable listener: IMoGoBindingCarListener - ) { - if (BINDING_CAR_LISTENER.containsKey(tag)) { - return - } - BINDING_CAR_LISTENER[tag] = listener - } - - /** - * 删除监听 - * @param tag 标记,用来注销监听使用 - */ - fun unRegisterDevaToolsLogCatchListener(@Nullable tag: String) { - if (!BINDING_CAR_LISTENER.containsKey(tag)) { - return - } - BINDING_CAR_LISTENER.remove(tag) - } - - /** - * 删除监听 - * @param listener 要删除的监听对象 - */ - fun unRegisterDevaToolsLogCatchListener(@Nullable listener: IMoGoBindingCarListener) { - if (!BINDING_CAR_LISTENER.containsValue(listener)) { - return - } - BINDING_CAR_LISTENER.forEach { - if (it.value == listener) { - BINDING_CAR_LISTENER.remove(it.key) - } - } - } - - fun invokeQueryContainersResponse(dockerList: List){ - BINDING_CAR_LISTENER.forEach { + fun invokeQueryContainersResponse(dockerList: List) { + M_LISTENERS.forEach { val listener = it.value listener.queryContainersResponse(dockerList) } } - fun invokePushServerConfirm(){ - BINDING_CAR_LISTENER.forEach{ + fun invokePushServerConfirm() { + M_LISTENERS.forEach { val listener = it.value listener.pushServerConfirm() } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/biz/CallerFuncBizManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/biz/CallerFuncBizManager.kt index 0511f0b2c5..ef8a298df5 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/biz/CallerFuncBizManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/biz/CallerFuncBizManager.kt @@ -1,13 +1,13 @@ package com.mogo.eagle.core.function.call.biz -import com.mogo.eagle.core.function.call.base.CallerBase -import com.mogo.eagle.core.function.api.biz.IMoGoFuncBizProvider import com.mogo.eagle.core.data.constants.MogoServicePaths +import com.mogo.eagle.core.function.api.biz.IMoGoFuncBizProvider +import com.mogo.eagle.core.function.call.base.CallerBase /** * @author xiaoyuzhou */ -object CallerFuncBizManager : CallerBase() { +object CallerFuncBizManager : CallerBase() { @JvmStatic val bizProvider: IMoGoFuncBizProvider diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/chat/CallerChatManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/chat/CallerChatManager.kt index 7be20fc841..6f427e1e79 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/chat/CallerChatManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/chat/CallerChatManager.kt @@ -12,7 +12,7 @@ import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import org.jetbrains.annotations.TestOnly -object CallerChatManager: CallerBase() { +object CallerChatManager: CallerBase() { private val provider by lazy { getApiInstance(IMoGoChatProvider::class.java, ChatConsts.CHAT_PROVIDER_PATH)?.chat() diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/cloud/CallerCloudListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/cloud/CallerCloudListenerManager.kt index 5c6208c3d6..ca770c35ca 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/cloud/CallerCloudListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/cloud/CallerCloudListenerManager.kt @@ -1,6 +1,5 @@ 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 @@ -15,8 +14,8 @@ object CallerCloudListenerManager { * @param listener 监听回调 */ fun registerCloudListener( - @Nullable tag: String, - @Nullable listener: IMoGoCloudListener + tag: String, + listener: IMoGoCloudListener ) { if (M_CLOUD_LISTENER.containsKey(tag)) { return @@ -28,7 +27,7 @@ object CallerCloudListenerManager { * 删除监听 * @param tag 标记,用来注销监听使用 */ - fun unRegisterCloudListener(@Nullable tag: String) { + fun unRegisterCloudListener(tag: String) { if (!M_CLOUD_LISTENER.containsKey(tag)) { return } @@ -39,7 +38,7 @@ object CallerCloudListenerManager { * 删除监听 * @param listener 要删除的监听对象 */ - fun unRegisterCloudListener(@Nullable listener: IMoGoCloudListener) { + fun unRegisterCloudListener(listener: IMoGoCloudListener) { if (!M_CLOUD_LISTENER.containsValue(listener)) { return } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsFuncConfigListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsFuncConfigListenerManager.kt index a06e25dc9f..aa9cd48663 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsFuncConfigListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsFuncConfigListenerManager.kt @@ -1,6 +1,5 @@ package com.mogo.eagle.core.function.call.devatools -import androidx.annotation.Nullable import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsFuncConfigListener import com.zhjt.service_biz.SubBiz import java.util.concurrent.ConcurrentHashMap @@ -19,10 +18,10 @@ object CallerDevaToolsFuncConfigListenerManager { * @param listener 监听回调 */ fun registerDevaToolsFuncConfigListener( - @Nullable biz: String, - @Nullable tag: String, + biz: String, + tag: String, onlyViewRegister:Boolean = false, - @Nullable listener: IMoGoDevaToolsFuncConfigListener + listener: IMoGoDevaToolsFuncConfigListener ) { if (M_DEVA_TOOLS_FUNC_CONFIG_LISTENER.containsKey("$biz'_'$tag")) { return @@ -41,7 +40,7 @@ object CallerDevaToolsFuncConfigListenerManager { * 删除监听 * @param tag 标记,用来注销监听使用 */ - fun unRegisterDevaToolsFuncConfigListener(@Nullable biz: String, @Nullable tag: String) { + fun unRegisterDevaToolsFuncConfigListener(biz: String, tag: String) { if (!M_DEVA_TOOLS_FUNC_CONFIG_LISTENER.containsKey("$biz'_'$tag")) { return } @@ -53,7 +52,7 @@ object CallerDevaToolsFuncConfigListenerManager { * 删除监听 * @param listener 要删除的监听对象 */ - fun unRegisterDevaToolsFuncConfigListener(@Nullable listener: IMoGoDevaToolsFuncConfigListener) { + fun unRegisterDevaToolsFuncConfigListener(listener: IMoGoDevaToolsFuncConfigListener) { if (!M_DEVA_TOOLS_FUNC_CONFIG_LISTENER.containsValue(listener)) { return } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsListenerManager.kt index 62998c7272..daf443561f 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsListenerManager.kt @@ -1,93 +1,48 @@ package com.mogo.eagle.core.function.call.devatools -import androidx.annotation.Nullable import com.mogo.eagle.core.data.deva.scene.SceneModule import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener -import java.util.concurrent.ConcurrentHashMap +import com.mogo.eagle.core.function.call.base.CallerBase -object CallerDevaToolsListenerManager { - - private val M_DEVA_TOOLS_LISTENER: ConcurrentHashMap = - ConcurrentHashMap() - - /** - * 添加监听 - * @param tag 标记,用来注销监听使用 - * @param listener 监听回调 - */ - fun registerDevaToolsLogCatchListener( - @Nullable tag: String, - @Nullable listener: IMoGoDevaToolsListener - ) { - if (M_DEVA_TOOLS_LISTENER.containsKey(tag)) { - return - } - M_DEVA_TOOLS_LISTENER[tag] = listener - } - - /** - * 删除监听 - * @param tag 标记,用来注销监听使用 - */ - fun unRegisterDevaToolsLogCatchListener(@Nullable tag: String) { - if (!M_DEVA_TOOLS_LISTENER.containsKey(tag)) { - return - } - M_DEVA_TOOLS_LISTENER.remove(tag) - } - - /** - * 删除监听 - * @param listener 要删除的监听对象 - */ - fun unRegisterDevaToolsLogCatchListener(@Nullable listener: IMoGoDevaToolsListener) { - if (!M_DEVA_TOOLS_LISTENER.containsValue(listener)) { - return - } - M_DEVA_TOOLS_LISTENER.forEach { - if (it.value == listener) { - M_DEVA_TOOLS_LISTENER.remove(it.key) - } - } - } +object CallerDevaToolsListenerManager : CallerBase() { fun invokeDevaToolsLogCatchStart() { - M_DEVA_TOOLS_LISTENER.forEach { + M_LISTENERS.forEach { val listener = it.value listener.onLogCatchStart() } } fun invokeDevaToolsLogCatchClose() { - M_DEVA_TOOLS_LISTENER.forEach { + M_LISTENERS.forEach { val listener = it.value listener.onLogCatchClose() } } fun invokeDevaToolsLogCatchLines(lineLog: String) { - M_DEVA_TOOLS_LISTENER.forEach { + M_LISTENERS.forEach { val listener = it.value listener.onLogCatch(lineLog) } } fun invokeDevaToolsFwThreadClose() { - M_DEVA_TOOLS_LISTENER.forEach { + M_LISTENERS.forEach { val listener = it.value listener.fwThreadClose() } } fun invokeDevaToolsModuleLogChanges(moduleTag: MutableMap) { - M_DEVA_TOOLS_LISTENER.forEach { + M_LISTENERS.forEach { val listener = it.value listener.moduleLogChanged(moduleTag) } } fun invokeDevaToolsUpgradeVersionUrls(urls: Map?) { - M_DEVA_TOOLS_LISTENER.forEach { + M_LISTENERS.forEach { val listener = it.value listener.upgradeVersionUrls(urls) } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsUpgradeListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsUpgradeListenerManager.kt index f4adcce671..4910e95203 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsUpgradeListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsUpgradeListenerManager.kt @@ -1,85 +1,41 @@ package com.mogo.eagle.core.function.call.devatools -import androidx.annotation.Nullable import com.mogo.eagle.core.function.api.devatools.IMogoDevaToolsUpgradeListener -import java.util.concurrent.ConcurrentHashMap +import com.mogo.eagle.core.function.call.base.CallerBase -object CallerDevaToolsUpgradeListenerManager { +object CallerDevaToolsUpgradeListenerManager : CallerBase() { - private val M_DEVA_TOOLS_UPGRADE_LISTENER: ConcurrentHashMap = - ConcurrentHashMap() - - /** - * 添加监听 - * @param tag 标记,用来注销监听使用 - * @param listener 监听回调 - */ - fun registerDevaToolsUpgradeListener( - @Nullable tag: String, - @Nullable listener: IMogoDevaToolsUpgradeListener - ) { - if (M_DEVA_TOOLS_UPGRADE_LISTENER.containsKey(tag)) { - return - } - M_DEVA_TOOLS_UPGRADE_LISTENER[tag] = listener - } - - /** - * 删除监听 - * @param tag 标记,用来注销监听使用 - */ - fun unRegisterDevaToolsUpgradeListener(@Nullable tag: String) { - if (!M_DEVA_TOOLS_UPGRADE_LISTENER.containsKey(tag)) { - return - } - M_DEVA_TOOLS_UPGRADE_LISTENER.remove(tag) - } - - /** - * 删除监听 - * @param listener 要删除的监听对象 - */ - fun unRegisterDevaToolsUpgradeListener(@Nullable listener: IMogoDevaToolsUpgradeListener) { - if (!M_DEVA_TOOLS_UPGRADE_LISTENER.containsValue(listener)) { - return - } - M_DEVA_TOOLS_UPGRADE_LISTENER.forEach { - if (it.value == listener) { - M_DEVA_TOOLS_UPGRADE_LISTENER.remove(it.key) - } - } - } fun invokeUpgradeStart(url: String) { - M_DEVA_TOOLS_UPGRADE_LISTENER.forEach { + M_LISTENERS.forEach { val listener = it.value listener.onStart(url) } } fun invokeUpgradeProgress(url: String, progress: Int) { - M_DEVA_TOOLS_UPGRADE_LISTENER.forEach { + M_LISTENERS.forEach { val listener = it.value listener.onProgress(url, progress) } } fun invokeUpgradePause(url: String) { - M_DEVA_TOOLS_UPGRADE_LISTENER.forEach { + M_LISTENERS.forEach { val listener = it.value listener.onPause(url) } } fun invokeUpgradeFinish(url: String) { - M_DEVA_TOOLS_UPGRADE_LISTENER.forEach { + M_LISTENERS.forEach { val listener = it.value listener.onFinished(url) } } fun invokeUpgradeError(url: String, errorMsg: String) { - M_DEVA_TOOLS_UPGRADE_LISTENER.forEach { + M_LISTENERS.forEach { val listener = it.value listener.onError(url, errorMsg) } 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 5f081b9726..40164cc856 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 @@ -1,59 +1,25 @@ package com.mogo.eagle.core.function.call.hmi -import androidx.annotation.Nullable import com.mogo.eagle.core.function.api.hmi.autopilot.IMoGoCheckAutoPilotBtnListener import com.mogo.eagle.core.function.call.base.CallerBase -import java.util.concurrent.ConcurrentHashMap /** * @author xiaoyuzhou * @date 2021/9/23 10:22 上午 * HMI 视图上的监听管理 */ -object CallerHmiListenerManager : CallerBase() { +object CallerHmiListenerManager : CallerBase() { // 存储最后一次回调的数据,当有新当位置注册了监听将此数据回调过去,防止有些模块注册顺序问题导致无法获取最新状态 private var mIsChecked: Boolean = false - // 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 - private val mAutoPilotBtnListeners: ConcurrentHashMap = - ConcurrentHashMap() - - - /** - * 添加自动驾驶按钮选中监听 - * @param tag 标记,用来注销监听使用 - * @param listener 监听回调 - */ - fun addCheckAutoPilotBtnListener( - @Nullable tag: String, - @Nullable listener: IMoGoCheckAutoPilotBtnListener - ) { - if (mAutoPilotBtnListeners.containsKey(tag)) { - return - } - mAutoPilotBtnListeners[tag] = listener - listener.onCheck(mIsChecked) - } - - /** - * 删除自动驾驶按钮选中监听 - * @param tag 标记,用来注销监听使用 - */ - fun removeCheckAutoPilotBtnListener(@Nullable tag: String) { - if (!mAutoPilotBtnListeners.containsKey(tag)) { - return - } - mAutoPilotBtnListeners.remove(tag) - } - /** * 触发自动驾驶按钮选中监听 * @param isChecked 选中状态 */ fun invokeCheckAutoPilotBtnListener(isChecked: Boolean) { mIsChecked = isChecked - mAutoPilotBtnListeners.forEach { + M_LISTENERS.forEach { val tag = it.key val listener = it.value listener.onCheck(mIsChecked) diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt index 88148f4d8c..e09edd7d8d 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt @@ -19,7 +19,6 @@ import com.mogo.eagle.core.function.api.hmi.view.IViewLimitingVelocity import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight import com.mogo.eagle.core.function.api.hmi.warning.IMoGoHmiProvider import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener -import com.mogo.eagle.core.function.call.base.CallerBase import com.zhjt.service_biz.BizConfig /** @@ -28,7 +27,7 @@ import com.zhjt.service_biz.BizConfig * * HMI 调用者管理,这里对外及其他模块提供功能的调用,用啥写啥,不要过度设计,不允许直接将Provider暴露出去 */ -object CallerHmiManager : CallerBase() { +object CallerHmiManager { private val waringProviderApi get() = ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_HMI) .navigation() as? IMoGoHmiProvider diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerHDMapManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerHDMapManager.kt index 93d6704e03..087e7ec6f1 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerHDMapManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerHDMapManager.kt @@ -6,7 +6,6 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.constants.MoGoFragmentPaths import com.mogo.eagle.core.data.map.CenterLine import com.mogo.eagle.core.function.api.map.hd.IMoGoMapFragmentProvider -import com.mogo.eagle.core.function.call.base.CallerBase import com.zhidao.support.adas.high.AdasManager import com.zhidao.support.adas.high.common.Constants import com.zhidao.support.adas.high.common.MessageType @@ -16,7 +15,7 @@ import com.zhidao.support.adas.high.common.MessageType * @date 2021/9/17 6:15 下午 * 高精度地图控制 */ -object CallerHDMapManager : CallerBase() { +object CallerHDMapManager { private val mapProviderApi: IMoGoMapFragmentProvider get() = ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_MAP) .navigation() as IMoGoMapFragmentProvider diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapDevaListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapDevaListenerManager.kt index ce35fb5b0c..be4be6ad8e 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapDevaListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapDevaListenerManager.kt @@ -1,49 +1,23 @@ package com.mogo.eagle.core.function.call.map -import androidx.annotation.Nullable import com.mogo.eagle.core.function.api.map.deva.IMoGoMapDevaProvider import com.mogo.eagle.core.function.call.base.CallerBase import java.util.concurrent.ConcurrentHashMap -object CallerMapDevaListenerManager : CallerBase() { +object CallerMapDevaListenerManager : CallerBase() { private val mMapDevaListeners: ConcurrentHashMap = ConcurrentHashMap() private var filePath: String? = null - fun addListener( - @Nullable tag: String, - @Nullable listener: IMoGoMapDevaProvider - ) { - if (mMapDevaListeners.containsKey(tag)) { - return - } - mMapDevaListeners[tag] = listener + override fun doSomeAfterAddListener(tag: String, listener: IMoGoMapDevaProvider) { filePath?.let { listener.uploadFile(it) } } - fun removeListener(@Nullable tag: String) { - if (!mMapDevaListeners.containsKey(tag)) { - return - } - mMapDevaListeners.remove(tag) - } - - fun removeListener(@Nullable listener: IMoGoMapDevaProvider) { - if (!mMapDevaListeners.containsValue(listener)) { - return - } - mMapDevaListeners.forEach { - if (it.value == listener) { - mMapDevaListeners.remove(it.key) - } - } - } - fun invokeUploadLogFile(filePath: String) { this.filePath = filePath mMapDevaListeners.forEach { @@ -51,4 +25,5 @@ object CallerMapDevaListenerManager : CallerBase() { listener.uploadFile(filePath) } } + } \ No newline at end of file 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 84f2448a4b..c779e1e802 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 @@ -1,6 +1,5 @@ package com.mogo.eagle.core.function.call.map -import androidx.annotation.Nullable import com.mogo.eagle.core.data.map.MogoLocation import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener import com.mogo.eagle.core.function.call.base.CallerBase @@ -11,7 +10,7 @@ import java.util.concurrent.ConcurrentHashMap * @date 2021/9/30 5:48 下午 * 地图 位置改变 监听管理 */ -object CallerMapLocationListenerManager : CallerBase() { +object CallerMapLocationListenerManager : CallerBase() { // 记录地图最后一次位置 private var mLocation: MogoLocation? = null @@ -48,7 +47,7 @@ object CallerMapLocationListenerManager : CallerBase() { * @param tag 标记,用来注销监听使用 * @param listener 监听回调 */ - fun addListener(@Nullable tag: String, @Nullable listener: IMoGoMapLocationListener, isGps: Boolean) { + fun addListener(tag: String, listener: IMoGoMapLocationListener, isGps: Boolean) { if (!isGps) { if (mMapStyleChangeListeners.containsKey(tag)) { return @@ -69,7 +68,7 @@ object CallerMapLocationListenerManager : CallerBase() { * 删除 地图样式改变 监听 * @param tag 标记,用来注销监听使用 */ - fun removeListener(@Nullable tag: String, isGps: Boolean) { + fun removeListener(tag: String, isGps: Boolean) { if (!isGps) { if (!mMapStyleChangeListeners.containsKey(tag)) { return @@ -88,7 +87,7 @@ object CallerMapLocationListenerManager : CallerBase() { * 删除 地图样式改变 监听 * @param listener 要删除的监听对象 */ - fun removeListener(@Nullable listener: IMoGoMapLocationListener, isGps: Boolean) { + fun removeListener(listener: IMoGoMapLocationListener, isGps: Boolean) { if (!isGps) { if (!mMapStyleChangeListeners.containsValue(listener)) { return 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 96379f9b36..af6f9f502b 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 @@ -1,24 +1,18 @@ package com.mogo.eagle.core.function.call.map -import androidx.annotation.Nullable import com.mogo.eagle.core.function.api.map.listener.IMoGoMapStyleChangeListener import com.mogo.eagle.core.function.call.base.CallerBase -import java.util.concurrent.ConcurrentHashMap /** * @author xiaoyuzhou * @date 2021/9/30 5:48 下午 * 地图 样式改变 监听管理 */ -object CallerMapStyleListenerManager : CallerBase() { +object CallerMapStyleListenerManager : CallerBase() { // 记录地图样式 private var mMapStyleMode = 0 - // 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 - private val mMapStyleChangeListeners: ConcurrentHashMap = - ConcurrentHashMap() - /** * 返回当前的地图皮肤 */ @@ -26,48 +20,10 @@ object CallerMapStyleListenerManager : CallerBase() { return mMapStyleMode } - /** - * 添加 地图样式改变 监听 - * @param tag 标记,用来注销监听使用 - * @param listener 监听回调 - */ - fun addListener( - @Nullable tag: String, - @Nullable listener: IMoGoMapStyleChangeListener - ) { - if (mMapStyleChangeListeners.containsKey(tag)) { - return - } - mMapStyleChangeListeners[tag] = listener + override fun doSomeAfterAddListener(tag: String, listener: IMoGoMapStyleChangeListener) { listener.onMapStyleModeChange(mMapStyleMode) } - /** - * 删除 地图样式改变 监听 - * @param tag 标记,用来注销监听使用 - */ - fun removeListener(@Nullable tag: String) { - if (!mMapStyleChangeListeners.containsKey(tag)) { - return - } - mMapStyleChangeListeners.remove(tag) - } - - /** - * 删除 地图样式改变 监听 - * @param listener 要删除的监听对象 - */ - fun removeListener(@Nullable listener: IMoGoMapStyleChangeListener) { - if (!mMapStyleChangeListeners.containsValue(listener)) { - return - } - mMapStyleChangeListeners.forEach { - if (it.value == listener) { - mMapStyleChangeListeners.remove(it.key) - } - } - } - /** * 触发 地图样式改变 监听 */ @@ -81,7 +37,7 @@ object CallerMapStyleListenerManager : CallerBase() { */ fun invokeMapStyleChange(mapStyleMode: Int) { mMapStyleMode = mapStyleMode - mMapStyleChangeListeners.forEach { + M_LISTENERS.forEach { val tag = it.key val listener = it.value listener.onMapStyleModeChange(mMapStyleMode) diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerSmpManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerSmpManager.kt index b910a61e25..e0281c2f76 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerSmpManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerSmpManager.kt @@ -13,7 +13,7 @@ import com.mogo.eagle.core.utilcode.util.UiThreadHandler * @date 2021/9/17 6:15 下午 * 小地图调用者管理,这里对外及其他模块提供小地图功能的调用,用啥写啥,不要过度设计,不允许直接将Provider暴露出去 */ -object CallerSmpManager : CallerBase() { +object CallerSmpManager : CallerBase() { private val mogoSmallMapProvider: IMogoSmallMapProvider get() = ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_SMP) .navigation() as IMogoSmallMapProvider diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/msgbox/CallerMsgBoxListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/msgbox/CallerMsgBoxListenerManager.kt index 246a7d8c74..3117b859a5 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/msgbox/CallerMsgBoxListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/msgbox/CallerMsgBoxListenerManager.kt @@ -1,84 +1,26 @@ package com.mogo.eagle.core.function.call.msgbox -import androidx.annotation.Nullable import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.data.msgbox.MsgCategory import com.mogo.eagle.core.function.api.msgbox.IMsgBoxListener import com.mogo.eagle.core.function.call.base.CallerBase -import java.util.concurrent.ConcurrentHashMap /** * @author chenfufeng * @date 2022/11/17 * 消息盒子数据监听管理 */ -object CallerMsgBoxListenerManager : CallerBase() { - - private val statusListeners: ConcurrentHashMap = - ConcurrentHashMap() +object CallerMsgBoxListenerManager : CallerBase() { // private val key2CategoryMap by lazy { // ConcurrentHashMap() // } - /** - * 添加数据监听 - * @param tag 标记,用来注销监听使用 - * @param listener 监听回调 - */ - fun addListener( - @Nullable tag: String, - @Nullable listener: IMsgBoxListener - ) { - if (statusListeners.containsKey(tag)) { - return - } - statusListeners[tag] = listener - } - -// fun addListenerByCategory( -// @Nullable tag: String, -// @Nullable category: MsgCategory, -// @Nullable listener: IMsgBoxListener -// ) { -// addListener(tag, listener) -// key2CategoryMap[tag] = category -// } - - /** - * 删除 OBU状态 监听 - * @param tag 标记,用来注销监听使用 - */ - fun removeListener(@Nullable tag: String) { - if (!statusListeners.containsKey(tag)) { - return - } - statusListeners.remove(tag) - } - - /** - * 删除 OBU状态 监听 - * @param listener 要删除的监听对象 - */ - fun removeListener(@Nullable listener: IMsgBoxListener) { - if (!statusListeners.containsValue(listener)) { - return - } - var tag = "" - statusListeners.forEach { - if (it.value == listener) { - tag = it.key - statusListeners.remove(it.key) - } - } -// key2CategoryMap.remove(tag) - } - /** * 触发监听 */ fun invokeListener(category: MsgCategory, msgBox: MsgBoxBean) { - statusListeners.forEach { + M_LISTENERS.forEach { val tag = it.key val listener = it.value listener.onDataChanged(category, msgBox) 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 34a4b63b32..c13c01f3cd 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 @@ -1,27 +1,21 @@ package com.mogo.eagle.core.function.call.obu -import androidx.annotation.Nullable import com.mogo.eagle.core.data.obu.ObuStatusInfo import com.mogo.eagle.core.data.traffic.TrafficData import com.mogo.eagle.core.function.api.obu.IMoGoObuStatusListener import com.mogo.eagle.core.function.call.base.CallerBase import com.mogo.eagle.core.utilcode.util.GsonUtils -import java.util.concurrent.ConcurrentHashMap /** * @author xiaoyuzhou * @date 2021/9/30 5:48 下午 * OBU 监听管理 */ -object CallerObuListenerManager : CallerBase() { +object CallerObuListenerManager : CallerBase() { // 存储最后一次回调的数据,当有新当位置注册了监听将此数据回调过去,防止有些模块注册顺序问题导致无法获取最新状态 private var mObuStatusInfo: ObuStatusInfo = ObuStatusInfo() - // 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 - private val mObuStatusListeners: ConcurrentHashMap = - ConcurrentHashMap() - /** * 查询 OBU状态 */ @@ -36,47 +30,10 @@ object CallerObuListenerManager : CallerBase() { return GsonUtils.toJson(mObuStatusInfo) } - /** - * 添加 OBU状态 监听 - * @param tag 标记,用来注销监听使用 - * @param listener 监听回调 - */ - fun addListener( - @Nullable tag: String, - @Nullable listener: IMoGoObuStatusListener - ) { - if (mObuStatusListeners.containsKey(tag)) { - return - } - mObuStatusListeners[tag] = listener + override fun doSomeAfterAddListener(tag: String, listener: IMoGoObuStatusListener) { listener.onObuStatusResponse(mObuStatusInfo) } - /** - * 删除 OBU状态 监听 - * @param tag 标记,用来注销监听使用 - */ - fun removeListener(@Nullable tag: String) { - if (!mObuStatusListeners.containsKey(tag)) { - return - } - mObuStatusListeners.remove(tag) - } - - /** - * 删除 OBU状态 监听 - * @param listener 要删除的监听对象 - */ - fun removeListener(@Nullable listener: IMoGoObuStatusListener) { - if (!mObuStatusListeners.containsValue(listener)) { - return - } - mObuStatusListeners.forEach { - if (it.value == listener) { - mObuStatusListeners.remove(it.key) - } - } - } /** * 触发 OBU状态 监听 @@ -91,7 +48,7 @@ object CallerObuListenerManager : CallerBase() { */ fun invokeListener(obuStatusInfo: ObuStatusInfo) { mObuStatusInfo = obuStatusInfo - mObuStatusListeners.forEach { + M_LISTENERS.forEach { val tag = it.key val listener = it.value listener.onObuStatusResponse(mObuStatusInfo) @@ -99,7 +56,7 @@ object CallerObuListenerManager : CallerBase() { } fun invokeDelayTime(delayTime: Long) { - mObuStatusListeners.forEach { + M_LISTENERS.forEach { val tag = it.key val listener = it.value listener.onObuV2iDelayTime(delayTime) @@ -107,14 +64,14 @@ object CallerObuListenerManager : CallerBase() { } fun invokeTrackerWarningInfo(trafficData: TrafficData){ - mObuStatusListeners.forEach { + M_LISTENERS.forEach { val listener = it.value listener.updateTrackerWarningInfo(trafficData) } } fun removeTrackerWarningInfo(trafficData: TrafficData){ - mObuStatusListeners.forEach { + M_LISTENERS.forEach { val listener = it.value listener.removeTrackerWarningInfo(trafficData) } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/setting/CallerSkinModeListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/setting/CallerSkinModeListenerManager.kt index ab1b9b0832..02872486bc 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/setting/CallerSkinModeListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/setting/CallerSkinModeListenerManager.kt @@ -1,75 +1,29 @@ package com.mogo.eagle.core.function.call.setting -import androidx.annotation.Nullable import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener import com.mogo.eagle.core.function.call.base.CallerBase -import java.util.concurrent.ConcurrentHashMap /** * @author xiaoyuzhou * @date 2021/9/30 5:48 下午 * 肤色模式 设置监听监听管理 */ -object CallerSkinModeListenerManager : CallerBase() { +object CallerSkinModeListenerManager : CallerBase() { - // 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 - private val mSkinModeListeners: ConcurrentHashMap = - ConcurrentHashMap() - - /** - * 添加 肤色模式 监听 - * @param tag 标记,用来注销监听使用 - * @param listener 监听回调 - */ - fun addListener( - @Nullable tag: String, - @Nullable listener: IMoGoSkinModeChangeListener - ) { - if (mSkinModeListeners.containsKey(tag)) { - return - } - mSkinModeListeners[tag] = listener + override fun doSomeAfterAddListener(tag: String, listener: IMoGoSkinModeChangeListener) { listener.onSkinModeChange(CallerMoGoUiSettingManager.getDayMode()) } - /** - * 删除 肤色模式 监听 - * @param tag 标记,用来注销监听使用 - */ - fun removeListener(@Nullable tag: String) { - if (!mSkinModeListeners.containsKey(tag)) { - return - } - mSkinModeListeners.remove(tag) - } - - /** - * 删除 肤色模式 监听 - * @param listener 要删除的监听对象 - */ - fun removeListener(@Nullable listener: IMoGoSkinModeChangeListener) { - if (!mSkinModeListeners.containsValue(listener)) { - return - } - mSkinModeListeners.forEach { - if (it.value == listener) { - mSkinModeListeners.remove(it.key) - } - } - } - - /** * 触发 肤色模式 监听 * @param skinMode 肤色模式 */ fun invokeListener(skinMode: Int) { - mSkinModeListeners.forEach { + M_LISTENERS.forEach { val tag = it.key val listener = it.value listener.onSkinModeChange(skinMode) } } - } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/trafficlight/CallerTrafficLightListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/trafficlight/CallerTrafficLightListenerManager.kt index eb6563c810..24da759ef4 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/trafficlight/CallerTrafficLightListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/trafficlight/CallerTrafficLightListenerManager.kt @@ -1,131 +1,22 @@ 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 java.util.concurrent.ConcurrentHashMap +import com.mogo.eagle.core.function.call.base.CallerBase -object CallerTrafficLightListenerManager { - - private val M_TRAFFIC_LIGHT_LISTENER: ConcurrentHashMap = - ConcurrentHashMap() +object CallerTrafficLightListenerManager : CallerBase() { private var trafficLightResult: TrafficLightResult? = null - /** - * 添加监听 - * @param tag 标记,用来注销监听使用 - * @param listener 监听回调 - */ - fun registerTrafficLightListener( - @Nullable tag: String, - @Nullable listener: IMoGoTrafficLightListener - ) { - if (M_TRAFFIC_LIGHT_LISTENER.containsKey(tag)) { - return - } + override fun doSomeAfterAddListener(tag: String, listener: IMoGoTrafficLightListener) { trafficLightResult?.let { listener.onTrafficLightStatus(it) } - M_TRAFFIC_LIGHT_LISTENER[tag] = listener - } - - /** - * 删除监听 - * @param tag 标记,用来注销监听使用 - */ - fun unRegisterTrafficLightListener(@Nullable tag: String) { - if (!M_TRAFFIC_LIGHT_LISTENER.containsKey(tag)) { - return - } - M_TRAFFIC_LIGHT_LISTENER.remove(tag) - } - - /** - * 删除监听 - * @param listener 要删除的监听对象 - */ - fun unRegisterTrafficLightListener(@Nullable listener: IMoGoTrafficLightListener) { - if (!M_TRAFFIC_LIGHT_LISTENER.containsValue(listener)) { - return - } - M_TRAFFIC_LIGHT_LISTENER.forEach { - if (it.value == listener) { - M_TRAFFIC_LIGHT_LISTENER.remove(it.key) - } - } - } - - /** - * 添加监听 - * @param tag 标记,用来注销监听使用 - * @param listener 监听回调 - */ - fun registerEnterCrossRoadListener( - @Nullable tag: String, - @Nullable listener: IMoGoTrafficLightListener - ) { - if (M_TRAFFIC_LIGHT_LISTENER.containsKey(tag)) { - return - } - M_TRAFFIC_LIGHT_LISTENER[tag] = listener - } - - /** - * 删除监听 - * @param tag 标记,用来注销监听使用 - */ - fun unRegisterEnterCrossRoadListener(@Nullable tag: String) { - if (!M_TRAFFIC_LIGHT_LISTENER.containsKey(tag)) { - return - } - M_TRAFFIC_LIGHT_LISTENER.remove(tag) - } - - /** - * 添加监听 - * @param tag 标记,用来注销监听使用 - * @param listener 监听回调 - */ - fun registerTrafficRequestErrorListener( - @Nullable tag: String, - @Nullable listener: IMoGoTrafficLightListener - ) { - if (M_TRAFFIC_LIGHT_LISTENER.containsKey(tag)) { - return - } - M_TRAFFIC_LIGHT_LISTENER[tag] = listener - } - - /** - * 删除监听 - * @param tag 标记,用来注销监听使用 - */ - fun unRegisterTrafficRequestErrorListener(@Nullable tag: String) { - if (!M_TRAFFIC_LIGHT_LISTENER.containsKey(tag)) { - return - } - M_TRAFFIC_LIGHT_LISTENER.remove(tag) - } - - /** - * 删除监听 - * @param listener 要删除的监听对象 - */ - fun unRegisterEnterCrossRoadListener(@Nullable listener: IMoGoTrafficLightListener) { - if (!M_TRAFFIC_LIGHT_LISTENER.containsValue(listener)) { - return - } - M_TRAFFIC_LIGHT_LISTENER.forEach { - if (it.value == listener) { - M_TRAFFIC_LIGHT_LISTENER.remove(it.key) - } - } } fun invokeTrafficLightStatus(trafficLightResult: TrafficLightResult) { this.trafficLightResult = trafficLightResult - M_TRAFFIC_LIGHT_LISTENER.forEach { + M_LISTENERS.forEach { val tag = it.key val listener = it.value listener.onTrafficLightStatus(trafficLightResult) @@ -133,14 +24,14 @@ object CallerTrafficLightListenerManager { } fun invokeEnterCrossRoad(enter: Boolean) { - M_TRAFFIC_LIGHT_LISTENER.forEach { + M_LISTENERS.forEach { val listener = it.value listener.onEnterCrossRoad(enter) } } fun invokeTrafficRequestError(){ - M_TRAFFIC_LIGHT_LISTENER.forEach{ + M_LISTENERS.forEach{ val listener = it.value listener.onTrafficRequestError() } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/trafficlight/CallerTrafficLightManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/trafficlight/CallerTrafficLightManager.kt index 0c8f8e649e..dc862a8030 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/trafficlight/CallerTrafficLightManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/trafficlight/CallerTrafficLightManager.kt @@ -4,7 +4,7 @@ import com.mogo.eagle.core.data.constants.MogoServicePaths import com.mogo.eagle.core.function.api.trafficlight.ITrafficLightProvider import com.mogo.eagle.core.function.call.base.CallerBase -object CallerTrafficLightManager : CallerBase() { +object CallerTrafficLightManager : CallerBase() { fun getTrafficLightProvider(): ITrafficLightProvider { return getApiInstance( diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/v2x/CallLimitingVelocityListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/v2x/CallLimitingVelocityListenerManager.kt index b269dd8d74..726288cd2d 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/v2x/CallLimitingVelocityListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/v2x/CallLimitingVelocityListenerManager.kt @@ -1,70 +1,24 @@ package com.mogo.eagle.core.function.call.v2x -import androidx.annotation.Nullable import com.mogo.eagle.core.function.api.v2x.LimitingVelocityListener -import com.mogo.eagle.core.utilcode.util.LogUtils -import java.util.concurrent.ConcurrentHashMap +import com.mogo.eagle.core.function.call.base.CallerBase /** * 限速信息监听 */ -object CallLimitingVelocityListenerManager { +object CallLimitingVelocityListenerManager : CallerBase() { private const val TAG = "CallLimitingVelocityListenerManager" - private val M_TRAFFIC_LIGHT_LISTENER: ConcurrentHashMap = - ConcurrentHashMap() - private var mCurrentLimitingVelocity = 0 - /** - * 添加监听 - * @param tag 标记,用来注销监听使用 - * @param listener 监听回调 - */ - fun addListener( - @Nullable tag: String, - @Nullable listener: LimitingVelocityListener - ) { - if (M_TRAFFIC_LIGHT_LISTENER.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag already exists,please use other tag") - return - } + override fun doSomeAfterAddListener(tag: String, listener: LimitingVelocityListener) { listener.onLimitingVelocityChange(mCurrentLimitingVelocity) - M_TRAFFIC_LIGHT_LISTENER[tag] = listener - } - - /** - * 删除监听 - * @param tag 标记,用来注销监听使用 - */ - fun removeListener(@Nullable tag: String) { - if (!M_TRAFFIC_LIGHT_LISTENER.containsKey(tag)) { - LogUtils.eTag(TAG, "Tag:$tag not exists") - return - } - M_TRAFFIC_LIGHT_LISTENER.remove(tag) - } - - /** - * 删除监听 - * @param listener 要删除的监听对象 - */ - fun removeListener(@Nullable listener: LimitingVelocityListener) { - 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) - } - } } fun invokeOnLimitingVelocityChange(limitingVelocity: Int) { this.mCurrentLimitingVelocity = limitingVelocity - M_TRAFFIC_LIGHT_LISTENER.forEach { + M_LISTENERS.forEach { val tag = it.key //LogUtils.dTag(TAG, "invokeOnLimitingVelocityChange tag is : $tag") val listener = it.value diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/vip/CallVipSetListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/vip/CallVipSetListenerManager.kt index 290738c337..7324bd2ab7 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/vip/CallVipSetListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/vip/CallVipSetListenerManager.kt @@ -1,61 +1,19 @@ package com.mogo.eagle.core.function.call.vip -import androidx.annotation.Nullable import com.mogo.eagle.core.function.api.vip.IMoGoVipSetListener -import java.util.concurrent.ConcurrentHashMap +import com.mogo.eagle.core.function.call.base.CallerBase -object CallVipSetListenerManager { - - private val M_VIP_SET_LISTENER: ConcurrentHashMap = - ConcurrentHashMap() +object CallVipSetListenerManager : CallerBase() { private var vipSet: Boolean = false - /** - * 添加监听 - * @param tag 标记,用来注销监听使用 - * @param listener 监听回调 - */ - fun registerVipSetListener( - @Nullable tag: String, - @Nullable listener: IMoGoVipSetListener - ) { - if (M_VIP_SET_LISTENER.containsKey(tag)) { - return - } + override fun doSomeAfterAddListener(tag: String, listener: IMoGoVipSetListener) { listener.onVipSet(vipSet) - M_VIP_SET_LISTENER[tag] = listener - } - - /** - * 删除监听 - * @param tag 标记,用来注销监听使用 - */ - fun unRegisterVipSetListener(@Nullable tag: String) { - if (!M_VIP_SET_LISTENER.containsKey(tag)) { - return - } - M_VIP_SET_LISTENER.remove(tag) - } - - /** - * 删除监听 - * @param listener 要删除的监听对象 - */ - fun unRegisterVipSetListener(@Nullable listener: IMoGoVipSetListener) { - if (!M_VIP_SET_LISTENER.containsValue(listener)) { - return - } - M_VIP_SET_LISTENER.forEach { - if (it.value == listener) { - M_VIP_SET_LISTENER.remove(it.key) - } - } } fun invokeVipSetStatus(vipStatus: Boolean) { this.vipSet = vipStatus - M_VIP_SET_LISTENER.forEach { + M_LISTENERS.forEach { val tag = it.key val listener = it.value listener.onVipSet(vipStatus)