[dev_arch_opt_3.0]

[Change]
[1、将Call中注册,反注册操作下沉CallerBase]

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2023-01-04 20:00:32 +08:00
parent 9559cfc131
commit 06810f339c
54 changed files with 373 additions and 1454 deletions

View File

@@ -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) {
}

View File

@@ -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状态 监听

View File

@@ -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)
//挂挡档位数据

View File

@@ -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";

View File

@@ -22,7 +22,7 @@ class AsyncDataToAutopilotServer private constructor() : IMoGoTrafficLightListen
}
fun initServer() {
CallerTrafficLightListenerManager.registerTrafficLightListener(TAG, this)
CallerTrafficLightListenerManager.addListener(TAG, this)
}
override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) {

View File

@@ -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<CanStatus>(ctx), IMoGoAutopilotVehicleStateListener, IMoGoAutopilotStatusListener {
internal class CanImpl(ctx: Context):
IFlow<CanStatus>(ctx),
IMoGoAutopilotVehicleStateListener,
IMoGoAutopilotStatusListener,
IMoGoChassisLamplightListener{
companion object {
const val TAG = "CanImpl"

View File

@@ -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) {

View File

@@ -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<String, SceneModule>) {
//模块日志 tag 发生变化,需要更新对应 UI
setLogCheckedChangeListener()
}
override fun upgradeVersionUrls(urls: Map<String, String>?) {
//版本信息更新
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<String, SceneModule>) {
//模块日志 tag 发生变化,需要更新对应 UI
setLogCheckedChangeListener()
}
override fun upgradeVersionUrls(urls: Map<String, String>?) {
//版本信息更新
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()
}
}
}

View File

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

View File

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

View File

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

View File

@@ -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) {

View File

@@ -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)
}

View File

@@ -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)
}
}

View File

@@ -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<VipMessage>, 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<VipMessage>, IMoGoTrafficLightListe
resetConditions()
CallerHmiManager.vipIdentification(false)
CallVipSetListenerManager.invokeVipSetStatus(false)
CallerTrafficLightListenerManager.unRegisterTrafficLightListener(TAG)
CallerTrafficLightListenerManager.unRegisterEnterCrossRoadListener(TAG)
CallerTrafficLightListenerManager.removeListener(TAG)
}
private fun requestVip() {

View File

@@ -8,18 +8,6 @@ import chassis.VehicleStateOuterClass
*/
interface IMoGoAutopilotVehicleStateListener {
/**
* 车辆转向灯 数据
* @param lightSwitch
*/
fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?)
/**
* 车辆刹车灯 数据
* @param brakeLight
*/
fun onAutopilotBrakeLightData(brakeLight: Boolean)
/**
* 车辆方向盘转向角回调
* @param steering 方向盘转向角

View File

@@ -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){}
}

View File

@@ -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<IMoGoAutopilotStatusListener>() {
// 存储最后一次回调的数据,当有新当位置注册了监听将此数据回调过去,防止有些模块注册顺序问题导致无法获取最新状态
@Volatile
private var mAutopilotStatusInfo: AutopilotStatusInfo = AutopilotStatusInfo()
// 存储所有注册了监听的对象invokeXXXX进行遍历回调将信息同步
private val M_AUTOPILOT_STATUS_LISTENERS: ConcurrentHashMap<String, IMoGoAutopilotStatusListener> =
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)
}

View File

@@ -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<String, IMoGoAutopilotActionsListener> =
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<IMoGoAutopilotActionsListener>() {
@Synchronized
fun invokeAutopilotAbility(ability: AutopilotAbility?) {
M_AUTOPILOT_ACTIONS_LISTENER.forEach {
M_LISTENERS.forEach {
val listener = it.value
listener.onAutopilotAbility(ability)
}

View File

@@ -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<IMoGoAutopilotCarConfigListener>() {
private var mCarConfigResp: MessagePad.CarConfigResp?= null
// 存储所有注册了监听的对象invokeXXXX进行遍历回调将信息同步
private val M_AUTOPILOT_CAR_CONFIG_LISTENERS: ConcurrentHashMap<String, IMoGoAutopilotCarConfigListener> =
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)
}

View File

@@ -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<String, IMoGoAutopilotCarStateListener> =
ConcurrentHashMap()
object CallerAutopilotCarStatusListenerManager : CallerBase<IMoGoAutopilotCarStateListener>() {
@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)

View File

@@ -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<String, IMoGoAutopilotIdentifyListener> =
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<IMoGoAutopilotIdentifyListener>() {
/**
* 识别交通元素数据发生更新 回调
*/
@Synchronized
fun invokeAutopilotIdentifyDataUpdate(trafficData: List<MessagePad.TrackedObject>?) {
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<MessagePad.PlanningObject>?){
M_AUTOPILOT_IDENTIFY_LISTENERS.forEach {
fun invokeAutopilotIdentifyPlanningObj(planningObjects: List<MessagePad.PlanningObject>?) {
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)

View File

@@ -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<String, IMoGoAutopilotPlanningActionsListener> =
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<IMoGoAutopilotPlanningActionsListener>() {
/**
* 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)
}
}
}

View File

@@ -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<String, IMoGoAutopilotPlanningListener> =
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<IMoGoAutopilotPlanningListener>() {
/**
* 车前引导线 回调
@@ -61,7 +17,7 @@ object CallerAutopilotPlanningListenerManager : CallerBase() {
*/
@Synchronized
fun invokeAutopilotTrajectory(trajectoryInfo: MutableList<MessagePad.TrajectoryPoint>) {
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)

View File

@@ -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<String, IMoGoAutopilotPointCloudListener> =
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<IMoGoAutopilotPointCloudListener>() {
/**
* 点云数据 回调
*/
@Synchronized
fun invokeAutopilotPointCloudDataUpdate(pointCloud: ByteArray?) {
M_POINT_CLOUD_LISTENERS.forEach {
M_LISTENERS.forEach {
val tag = it.key
val listener = it.value
listener.onAutopilotPointCloudDataUpdate(pointCloud)

View File

@@ -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<String, IMoGoAutopilotRecordListener> =
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<IMoGoAutopilotRecordListener>() {
/**
* 采集任务记录回调
*/
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)
}
}
}

View File

@@ -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<String, IMoGoAutopilotStatisticsListener> =
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<IMoGoAutopilotStatisticsListener>() {
@Synchronized
fun invokeAutopilotStatistics(statistics: AutopilotStatistics?) {
M_AUTOPILOT_STATISTICS_LISTENER.forEach {
M_LISTENERS.forEach {
val listener = it.value
listener.onAutopilotStatistics(statistics)
}

View File

@@ -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<String, IMoGoAutopilotVehicleStateListener> =
ConcurrentHashMap()
object CallerAutopilotVehicleStateListenerManager : CallerBase<IMoGoAutopilotVehicleStateListener>() {
@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)
}

View File

@@ -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<IMoGoChassisLamplightListener>() {
/**
* 车辆转向灯数据回调
* @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)
}
}
}

View File

@@ -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<String, IMoGoStartAutopilotFailedListener> =
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<IMoGoStartAutopilotFailedListener>() {
@Synchronized
fun invokeStartAutopilotFailed(message: MogoReportMsg.MogoReportMessage?) {
M_START_AUTOPILOT_FAILED_LISTENER.forEach {
M_LISTENERS.forEach {
val listener = it.value
listener.onStartAutopilotFailed(message)
}

View File

@@ -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<T : Any> {
public static <T extends IProvider> T getApiInstance(Class<T> 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<String, T> = 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 <T : IProvider?> getApiInstance(clazz: Class<T>?, 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
}
}
}

View File

@@ -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<IMoGoBindingCarListener>() {
private val BINDING_CAR_LISTENER: ConcurrentHashMap<String, IMoGoBindingCarListener> =
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<String>){
BINDING_CAR_LISTENER.forEach {
fun invokeQueryContainersResponse(dockerList: List<String>) {
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()
}

View File

@@ -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<Any>() {
@JvmStatic
val bizProvider: IMoGoFuncBizProvider

View File

@@ -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<Any>() {
private val provider by lazy {
getApiInstance(IMoGoChatProvider::class.java, ChatConsts.CHAT_PROVIDER_PATH)?.chat()

View File

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

View File

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

View File

@@ -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<String, IMoGoDevaToolsListener> =
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<IMoGoDevaToolsListener>() {
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<String, SceneModule>) {
M_DEVA_TOOLS_LISTENER.forEach {
M_LISTENERS.forEach {
val listener = it.value
listener.moduleLogChanged(moduleTag)
}
}
fun invokeDevaToolsUpgradeVersionUrls(urls: Map<String, String>?) {
M_DEVA_TOOLS_LISTENER.forEach {
M_LISTENERS.forEach {
val listener = it.value
listener.upgradeVersionUrls(urls)
}

View File

@@ -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<IMogoDevaToolsUpgradeListener>() {
private val M_DEVA_TOOLS_UPGRADE_LISTENER: ConcurrentHashMap<String, IMogoDevaToolsUpgradeListener> =
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)
}

View File

@@ -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<IMoGoCheckAutoPilotBtnListener>() {
// 存储最后一次回调的数据,当有新当位置注册了监听将此数据回调过去,防止有些模块注册顺序问题导致无法获取最新状态
private var mIsChecked: Boolean = false
// 存储所有注册了监听的对象invokeXXXX进行遍历回调将信息同步
private val mAutoPilotBtnListeners: ConcurrentHashMap<String, IMoGoCheckAutoPilotBtnListener> =
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)

View File

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

View File

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

View File

@@ -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<IMoGoMapDevaProvider>() {
private val mMapDevaListeners: ConcurrentHashMap<String, IMoGoMapDevaProvider> =
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)
}
}
}

View File

@@ -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<Any>() {
// 记录地图最后一次位置
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

View File

@@ -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<IMoGoMapStyleChangeListener>() {
// 记录地图样式
private var mMapStyleMode = 0
// 存储所有注册了监听的对象invokeXXXX进行遍历回调将信息同步
private val mMapStyleChangeListeners: ConcurrentHashMap<String, IMoGoMapStyleChangeListener> =
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)

View File

@@ -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<Any>() {
private val mogoSmallMapProvider: IMogoSmallMapProvider
get() = ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_SMP)
.navigation() as IMogoSmallMapProvider

View File

@@ -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<String, IMsgBoxListener> =
ConcurrentHashMap()
object CallerMsgBoxListenerManager : CallerBase<IMsgBoxListener>() {
// private val key2CategoryMap by lazy {
// ConcurrentHashMap<String, MsgCategory>()
// }
/**
* 添加数据监听
* @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)

View File

@@ -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<IMoGoObuStatusListener>() {
// 存储最后一次回调的数据,当有新当位置注册了监听将此数据回调过去,防止有些模块注册顺序问题导致无法获取最新状态
private var mObuStatusInfo: ObuStatusInfo = ObuStatusInfo()
// 存储所有注册了监听的对象invokeXXXX进行遍历回调将信息同步
private val mObuStatusListeners: ConcurrentHashMap<String, IMoGoObuStatusListener> =
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)
}

View File

@@ -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<IMoGoSkinModeChangeListener>() {
// 存储所有注册了监听的对象invokeXXXX进行遍历回调将信息同步
private val mSkinModeListeners: ConcurrentHashMap<String, IMoGoSkinModeChangeListener> =
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)
}
}
}

View File

@@ -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<String, IMoGoTrafficLightListener> =
ConcurrentHashMap()
object CallerTrafficLightListenerManager : CallerBase<IMoGoTrafficLightListener>() {
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()
}

View File

@@ -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<Any>() {
fun getTrafficLightProvider(): ITrafficLightProvider {
return getApiInstance(

View File

@@ -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<LimitingVelocityListener>() {
private const val TAG = "CallLimitingVelocityListenerManager"
private val M_TRAFFIC_LIGHT_LISTENER: ConcurrentHashMap<String, LimitingVelocityListener> =
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

View File

@@ -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<String, IMoGoVipSetListener> =
ConcurrentHashMap()
object CallVipSetListenerManager : CallerBase<IMoGoVipSetListener>() {
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)