diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java index 5aa78a0a37..708e41b46d 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java @@ -10,29 +10,21 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig; 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.IMoGoAutopilotIdentifyListener; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener; import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager; import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager; -import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager; import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager; import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager; import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils; import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; -import com.mogo.eagle.core.utilcode.util.ThreadUtils; -import com.mogo.module.common.drawer.IdentifyDataDrawer; import org.jetbrains.annotations.NotNull; -import java.util.List; - import chassis.Chassis; import mogo.telematics.pad.MessagePad; -import record_cache.RecordPanelOuterClass; public class MoGoHandAdasMsgManager implements - IMoGoAutopilotIdentifyListener, IMoGoAutopilotVehicleStateListener, IMoGoAutopilotCarConfigListener, IMoGoAutopilotCarStateListener { @@ -43,7 +35,6 @@ public class MoGoHandAdasMsgManager implements private Context mContext; private MoGoHandAdasMsgManager(Context context) { - CallerAutopilotIdentifyListenerManager.INSTANCE.addListener(TAG, this); CallerAutopilotVehicleStateListenerManager.INSTANCE.addListener(TAG, this); CallerAutopilotCarConfigListenerManager.INSTANCE.addListener(TAG, this); CallerAutopilotCarStatusListenerManager.INSTANCE.addListener(TAG, this); @@ -110,25 +101,6 @@ public class MoGoHandAdasMsgManager implements public void onAutopilotBrakeLightData(boolean brakeLight) { } - @Override - public void onAutopilotIdentifyDataUpdate(List trafficData) { - try { - if (FunctionBuildConfig.isDrawIdentifyData) { - ThreadUtils.getSinglePool().execute(() -> - IdentifyDataDrawer.getInstance().renderAdasRecognizedResult(trafficData) - ); - } else { - IdentifyDataDrawer.getInstance().clearOldMarker(); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void onAutopilotWarnMessage(MessagePad.Warn warn) { - - } @Override diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFrameController.java b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFrameController.java index 6fd1dfce85..6f74091c04 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFrameController.java +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFrameController.java @@ -38,7 +38,7 @@ public class MapFrameController implements IMogoMapFrameController { @Override public void init(Context context) { - + MapIdentifySubscriber.Companion.getInstance(); } @Override diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapIdentifySubscriber.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapIdentifySubscriber.kt new file mode 100644 index 0000000000..1c280489aa --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapIdentifySubscriber.kt @@ -0,0 +1,57 @@ +package com.mogo.eagle.core.function.map + +import com.mogo.eagle.core.data.config.FunctionBuildConfig +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener +import com.mogo.eagle.core.function.api.base.IMoGoSubscriber +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager +import com.mogo.eagle.core.utilcode.util.ThreadUtils +import com.mogo.module.common.drawer.IdentifyDataDrawer +import mogo.telematics.pad.MessagePad +import mogo.telematics.pad.MessagePad.TrackedObject + +/** + * 订阅感知数据的订阅者 + * 数据来源:工控机、OBU、云端下发 + * + * @author donghongyu + */ +class MapIdentifySubscriber private constructor() : IMoGoSubscriber, IMoGoAutopilotIdentifyListener { + + private val TAG = "MapIdentifySubscriber" + + init { + onCrate() + } + + companion object { + val instance: MapIdentifySubscriber by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) { + MapIdentifySubscriber() + } + } + + override fun onCrate() { + CallerAutopilotIdentifyListenerManager.addListener(TAG, this) + + } + + override fun onDestroy() { + CallerAutopilotIdentifyListenerManager.removeListener(TAG) + + } + + override fun onAutopilotIdentifyDataUpdate(trafficData: List?) { + try { + if (FunctionBuildConfig.isDrawIdentifyData) { + ThreadUtils.getSinglePool().execute { IdentifyDataDrawer.getInstance().renderAdasRecognizedResult(trafficData) } + } else { + IdentifyDataDrawer.getInstance().clearOldMarker() + } + } catch (e: Exception) { + e.printStackTrace() + } + } + + override fun onAutopilotWarnMessage(warn: MessagePad.Warn?) { + + } +} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/base/IMoGoSubscriber.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/base/IMoGoSubscriber.kt new file mode 100644 index 0000000000..c81fe83315 --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/base/IMoGoSubscriber.kt @@ -0,0 +1,17 @@ +package com.mogo.eagle.core.function.api.base + +/** + * 公共的订阅接口定义 + */ +interface IMoGoSubscriber { + + /** + * 创建 + */ + fun onCrate() + + /** + * 销毁 + */ + fun onDestroy() +} \ No newline at end of file