[dev_arch_opt_3.0]
[Change] [1、将Call中注册,反注册操作下沉CallerBase] Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user