Merge branch 'dev_arch_opt_3.0' into dev_robosweeper-d_app-module_221230_1.1.0

# Conflicts:
#	OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java
#	OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/SweeperFragment.java
#	OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/presenter/SweeperPresenter.java
#	OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java
#	app_ipc_monitoring/src/main/java/com/zhidao/adas/client/DataDistribution.java
#	app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/MainActivity.java
#	app_mogo_magic_ring/src/main/java/com/zhidao/adas/magic/ui/MainActivity.java
#	core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java
#	core/function-impl/mogo-core-function-bindingcar/src/main/java/com/mogo/eagle/core/function/bindingcar/BindingcarProvider.java
#	core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt
#	core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/can/CanImpl.kt
#	core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt
#	core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SteeringWheelView.java
#	core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.java
#	core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt
#	core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt
#	libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java
#	libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/MyMessageFactory.java
#	libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/VehicleStateMessage.java
This commit is contained in:
donghongyu
2023-01-17 18:09:06 +08:00
1903 changed files with 34839 additions and 33745 deletions

View File

@@ -55,16 +55,14 @@ dependencies {
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogo_core_data
implementation rootProject.ext.dependencies.mogo_core_utils
implementation rootProject.ext.dependencies.mogo_core_function_api
implementation rootProject.ext.dependencies.mogoserviceapi
implementation rootProject.ext.dependencies.mogocommons
} else {
implementation project(':libraries:mogo-adas')
api project(':libraries:mogo-map-api')
implementation project(':foudations:mogo-commons')
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-utils')
implementation project(':core:mogo-core-function-api')
implementation project(':services:mogo-service-api')
implementation project(':foudations:mogo-commons')
api project(':core:mogo-core-function-api')
}
}

View File

@@ -6,7 +6,6 @@ import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_EAGLE_START_AUTOPILOT
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_ADAS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_WEB_SOCKET_AUTOPILOT

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,28 +7,22 @@ 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 = ""
@Volatile
private var autoPilotMessageContent: String = ""
@@ -83,45 +76,10 @@ 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
override fun doSomeAfterAddListener(tag: String, listener: IMoGoAutopilotStatusListener) {
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 +95,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 +108,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 +120,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 +132,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 +144,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 +155,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,58 +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
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)
}
}
}
/**
* pnc actions 决策 驾驶的意图
*/
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,64 +1,21 @@
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
private var mCarConfigResp: MessagePad.CarConfigResp? = null
override fun doSomeAfterAddListener(tag: String, listener: IMoGoAutopilotCarConfigListener) {
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)
}
}
}
/**
* 工控机基础信息回调
* @param carConfigResp
@@ -66,7 +23,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,81 +0,0 @@
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()
@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? {
return gnssInfo
}
/**
* 车辆状态数据 回调
* @param gnssInfo
*/
@Synchronized
fun invokeAutopilotCarStateData(gnssInfo: MessagePad.GnssInfo?) {
this.gnssInfo = gnssInfo
M_AUTOPILOT_STATUS_LISTENERS.forEach {
val tag = it.key
val listener = it.value
listener.onAutopilotCarStateData(gnssInfo)
}
}
}

View File

@@ -1,76 +1,35 @@
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)
}
}
/**
* planning识别感知预警物体
*/
@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 +41,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 +51,9 @@ object CallerAutopilotIdentifyListenerManager : CallerBase() {
/**
* 感知红绿灯
*/
fun invokeAutopilotPerceptionTrafficLight(trafficLights: TrafficLightOuterClass.TrafficLights?){
M_AUTOPILOT_IDENTIFY_LISTENERS.forEach{
@Synchronized
fun invokeAutopilotPerceptionTrafficLight(trafficLights: TrafficLightOuterClass.TrafficLights?) {
M_LISTENERS.forEach {
val tag = it.key
val listener = it.value
listener.onAutopilotPerceptionTrafficLight(trafficLights)

View File

@@ -1,69 +0,0 @@
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)
}
}
}
/**
* pnc actions 决策回调
* @param planningActionMsg 具体决策
*/
@Synchronized
fun invokePNCActions(planningActionMsg: MessagePad.PlanningActionMsg) {
M_AUTOPILOT_PLANNING_ACTIONS_LISTENER.forEach {
val tag = it.key
val listener = it.value
listener.pncActions(planningActionMsg)
}
}
}

View File

@@ -1,85 +0,0 @@
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)
}
}
}
/**
* 车前引导线 回调
* @param trajectoryInfo 自动驾驶状态信息
*/
@Synchronized
fun invokeAutopilotTrajectory(trajectoryInfo: MutableList<MessagePad.TrajectoryPoint>) {
M_AUTOPILOT_PLANNING_LISTENER.forEach {
val tag = it.key
val listener = it.value
listener.onAutopilotTrajectory(trajectoryInfo)
}
}
/**
* 路径规划 回调
* @param globalPathResp 自动驾驶网约车回调数据
*/
@Synchronized
fun invokeAutopilotRotting(globalPathResp: MessagePad.GlobalPathResp?) {
M_AUTOPILOT_PLANNING_LISTENER.forEach {
val tag = it.key
val listener = it.value
listener.onAutopilotRotting(globalPathResp)
}
}
}

View File

@@ -1,67 +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 mogo.telematics.pad.MessagePad
import rule_segement.MogoPointCloudOuterClass
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,146 +1,39 @@
package com.mogo.eagle.core.function.call.autopilot
import androidx.annotation.Nullable
import chassis.Chassis
import chassis.ChassisStatesOuterClass
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener
import com.mogo.eagle.core.function.call.base.CallerBase
import planning.RoboSweeperTaskIndexOuterClass
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
fun invokeAutopilotTime(time: Long) {
this.timeStamp = time
}
/**
* 删除监听
* @param tag 标记,用来注销监听使用
* 获取工控机的时间, 单位是秒
*/
fun removeListener(@Nullable tag: String) {
if (!M_AUTOPILOT_VEHICLE_LISTENERS.containsKey(tag)) {
return
}
M_AUTOPILOT_VEHICLE_LISTENERS.remove(tag)
fun getAutopilotTimeStamp(): Long {
return this.timeStamp
}
/**
* 删除自动驾驶按钮选中监听
* @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 {
fun invokeAutopilotDataException(timestamp: Long) {
M_LISTENERS.forEach{
val listener = it.value
listener.onAutopilotLightSwitchData(lightSwitch)
listener.onAutopilotDataException(timestamp)
}
}
/**
* 车辆刹车灯数据回调
* @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 {
val listener = it.value
listener.onAutopilotSteeringData(steering)
}
}
/**
* 车辆挂挡档位
* @param gear 档位
*/
fun invokeAutopilotGearData(gear: Chassis.GearPosition) {
M_AUTOPILOT_VEHICLE_LISTENERS.forEach {
val listener = it.value
listener.onAutopilotGearData(gear)
}
}
/**
* 车辆加速度
* acc 加速度
*/
fun invokeAutopilotAcc(carAcc: Float) {
M_AUTOPILOT_VEHICLE_LISTENERS.forEach {
val listener = it.value
listener.onAutopilotAcc(carAcc)
}
}
/**
* throttle 油门
*/
fun invokeAutopilotThrottle(throttle: Float) {
M_AUTOPILOT_VEHICLE_LISTENERS.forEach {
val listener = it.value
listener.onAutopilotThrottle(throttle)
}
}
/**
* brake 刹车
*/
fun invokeAutopilotBrake(brake: Float) {
M_AUTOPILOT_VEHICLE_LISTENERS.forEach {
val listener = it.value
listener.onAutopilotBrake(brake)
}
}
/**
* 电池管理状态
*/
fun invokeBMSSystemStates(bmsSystemStates: ChassisStatesOuterClass.BMSSystemStates) {
M_AUTOPILOT_VEHICLE_LISTENERS.forEach {
val listener = it.value
listener.onBMSSystemStates(bmsSystemStates)
}
}
/**
* clean system state 清扫车(福田)清扫控制系统状态
*/
@@ -160,25 +53,4 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() {
listener.onSweeperFutianTaskIndexData(roboSweeperTaskIndex)
}
}
/**
* 工控机时间回调
*/
fun invokeAutopilotTime(time: Long) {
this.timeStamp = time
}
/**
* 获取工控机的时间, 单位是秒
*/
fun getAutopilotTimeStamp(): Long {
return this.timeStamp
}
fun invokeAutopilotDataException(timestamp: Long) {
M_AUTOPILOT_VEHICLE_LISTENERS.forEach {
val listener = it.value
listener.onAutopilotDataException(timestamp)
}
}
}

View File

@@ -0,0 +1,21 @@
package com.mogo.eagle.core.function.call.autopilot
import chassis.ChassisStatesOuterClass
import com.mogo.eagle.core.function.api.autopilot.IMoGoBatteryManagementSystemListener
import com.mogo.eagle.core.function.call.base.CallerBase
/**
* 电池管理系统 包含 电量剩余百分比 电压 电流等
*/
object CallerBatteryManagementSystemListenerManager : CallerBase<IMoGoBatteryManagementSystemListener>() {
/**
* 电池管理系统
*/
fun invokeBatteryManagementSystemStates(states: ChassisStatesOuterClass.BMSSystemStates) {
M_LISTENERS.forEach {
val listener = it.value
listener.onBatteryManagementSystemStates(states)
}
}
}

View File

@@ -0,0 +1,22 @@
package com.mogo.eagle.core.function.call.autopilot
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisAccStateListener
import com.mogo.eagle.core.function.call.base.CallerBase
/**
* 车辆加速度 回调监听
*/
object CallerChassisAccStateListenerManager : CallerBase<IMoGoChassisAccStateListener>() {
/**
* 车辆加速度
* acc 加速度
*/
fun invokeAutopilotAcc(carAcc: Float) {
M_LISTENERS.forEach {
val listener = it.value
listener.onAutopilotAcc(carAcc)
}
}
}

View File

@@ -0,0 +1,21 @@
package com.mogo.eagle.core.function.call.autopilot
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisBrakeStateListener
import com.mogo.eagle.core.function.call.base.CallerBase
/**
* 车辆挂挡档位 回调监听
*/
object CallerChassisBrakeStateListenerManager : CallerBase<IMoGoChassisBrakeStateListener>() {
/**
* brake 刹车
*/
fun invokeAutopilotBrake(brake: Float){
M_LISTENERS.forEach{
val listener = it.value
listener.onAutopilotBrake(brake)
}
}
}

View File

@@ -0,0 +1,22 @@
package com.mogo.eagle.core.function.call.autopilot
import chassis.Chassis
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGearStateListener
import com.mogo.eagle.core.function.call.base.CallerBase
/**
* 车辆挂挡档位 回调监听
*/
object CallerChassisGearStateListenerManager : CallerBase<IMoGoChassisGearStateListener>() {
/**
* 车辆挂挡档位
* @param gear 档位
*/
fun invokeAutopilotGearData(gear: Chassis.GearPosition) {
M_LISTENERS.forEach {
val listener = it.value
listener.onAutopilotGearData(gear)
}
}
}

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

@@ -0,0 +1,51 @@
package com.mogo.eagle.core.function.call.autopilot
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.util.CoordinateTransform
import mogo.telematics.pad.MessagePad
/**
* @author xiaoyuzhou
* @date 2021/9/30 5:48 下午
* 车辆定位 WGS84 坐标系-高精度坐标系 数据 回调监听
*/
object CallerChassisLocationGCJ20ListenerManager : CallerBase<IMoGoChassisLocationGCJ02Listener>() {
val TAG = "CallerChassisLocationGCJ20ListenerManager"
@Volatile
private var mGnssInfo: MessagePad.GnssInfo? = null
fun getChassisLocationGCJ02(): MessagePad.GnssInfo? {
return mGnssInfo
}
/**
* 车辆定位 WGS84 坐标系-高精度坐标系 数据
* @param gnssInfo
*/
@Synchronized
fun invokeChassisLocationGCJ02(gnssInfo: MessagePad.GnssInfo?) {
gnssInfo?.let {
// 转换 WGS84-->GCJ02 坐标
val gcj20Location = CoordinateTransform.WGS84ToGCJ02(gnssInfo.longitude, gnssInfo.latitude)
val gnssBuilder = gnssInfo.toBuilder()
gnssBuilder.longitude = gcj20Location[0]
gnssBuilder.latitude = gcj20Location[1]
this.mGnssInfo = gnssBuilder.build()
M_LISTENERS.forEach {
val tag = it.key
val listener = it.value
listener.onChassisLocationGCJ02(this.mGnssInfo)
}
} ?: let {
Logger.e(TAG, "定位数据为Null")
}
}
}

View File

@@ -0,0 +1,35 @@
package com.mogo.eagle.core.function.call.autopilot
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
import com.mogo.eagle.core.function.call.base.CallerBase
import mogo.telematics.pad.MessagePad
/**
* @author xiaoyuzhou
* @date 2021/9/30 5:48 下午
* 车辆定位 WGS84 坐标系-高精度坐标系 数据 回调监听
*/
object CallerChassisLocationWGS84ListenerManager : CallerBase<IMoGoChassisLocationWGS84Listener>() {
@Volatile
private var gnssInfo: MessagePad.GnssInfo? = null
fun getChassisLocationWGS84(): MessagePad.GnssInfo? {
return gnssInfo
}
/**
* 车辆定位 WGS84 坐标系-高精度坐标系 数据
* @param gnssInfo
*/
@Synchronized
fun invokeChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo?) {
this.gnssInfo = gnssInfo
M_LISTENERS.forEach {
val tag = it.key
val listener = it.value
listener.onChassisLocationWGS84(gnssInfo)
}
}
}

View File

@@ -0,0 +1,21 @@
package com.mogo.eagle.core.function.call.autopilot
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisSteeringStateListener
import com.mogo.eagle.core.function.call.base.CallerBase
/**
* 车辆方向盘转向角 回调监听
*/
object CallerChassisSteeringStateListenerManager : CallerBase<IMoGoChassisSteeringStateListener>() {
/**
* 车辆方向盘转向角回调
* @param steering 方向盘转向角
*/
fun invokeAutopilotSteeringData(steering: Float){
M_LISTENERS.forEach{
val listener = it.value
listener.onAutopilotSteeringData(steering)
}
}
}

View File

@@ -0,0 +1,20 @@
package com.mogo.eagle.core.function.call.autopilot
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisThrottleStateListener
import com.mogo.eagle.core.function.call.base.CallerBase
/**
* throttle 油门 回调监听
*/
object CallerChassisThrottleStateListenerManager : CallerBase<IMoGoChassisThrottleStateListener>() {
/**
* throttle 油门
*/
fun invokeAutopilotThrottle(throttle: Float) {
M_LISTENERS.forEach {
val listener = it.value
listener.onAutopilotThrottle(throttle)
}
}
}

View File

@@ -0,0 +1,25 @@
package com.mogo.eagle.core.function.call.autopilot
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningActionsListener
import com.mogo.eagle.core.function.call.base.CallerBase
import mogo.telematics.pad.MessagePad
/**
* PNC 决策行为相关监听
*/
object CallerPlanningActionsListenerManager : CallerBase<IMoGoAutopilotPlanningActionsListener>() {
/**
* pnc actions 决策回调
* @param planningActionMsg 具体决策
*/
@Synchronized
fun invokePNCActions(planningActionMsg: MessagePad.PlanningActionMsg) {
M_LISTENERS.forEach {
val tag = it.key
val listener = it.value
listener.pncActions(planningActionMsg)
}
}
}

View File

@@ -0,0 +1,27 @@
package com.mogo.eagle.core.function.call.autopilot
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
import com.mogo.eagle.core.function.call.base.CallerBase
import mogo.telematics.pad.MessagePad
/**
* @author xiaoyuzhou
* @date 2023/1/5 5:48 下午
* 工控机引导线数据
*/
object CallerPlanningRottingListenerManager : CallerBase<IMoGoPlanningRottingListener>() {
/**
* 路径规划 回调
* @param globalPathResp 自动驾驶网约车回调数据
*/
@Synchronized
fun invokeAutopilotRotting(globalPathResp: MessagePad.GlobalPathResp?) {
M_LISTENERS.forEach {
val tag = it.key
val listener = it.value
listener.onAutopilotRotting(globalPathResp)
}
}
}

View File

@@ -0,0 +1,27 @@
package com.mogo.eagle.core.function.call.autopilot
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningTrajectoryListener
import com.mogo.eagle.core.function.call.base.CallerBase
import mogo.telematics.pad.MessagePad
/**
* @author xiaoyuzhou
* @date 2023/1/ 5:48 下午
* 工控机引导线数据
*/
object CallerPlanningTrajectoryListenerManager : CallerBase<IMoGoPlanningTrajectoryListener>() {
/**
* 车前引导线 回调
* @param trajectoryInfo 自动驾驶状态信息
*/
@Synchronized
fun invokeAutopilotTrajectory(trajectoryInfo: MutableList<MessagePad.TrajectoryPoint>) {
M_LISTENERS.forEach {
val tag = it.key
val listener = it.value
listener.onAutopilotTrajectory(trajectoryInfo)
}
}
}

View File

@@ -0,0 +1,22 @@
package com.mogo.eagle.core.function.call.autopilot
import chassis.ChassisStatesOuterClass
import chassis.VehicleStateOuterClass
import com.mogo.eagle.core.function.api.autopilot.IMoGoRoboBusJinlvM1StatesListener
import com.mogo.eagle.core.function.call.base.CallerBase
/**
* 金旅M1
*/
object CallerRoboBusJinlvM1StatesListenerManager : CallerBase<IMoGoRoboBusJinlvM1StatesListener>() {
/**
* 电池管理系统
*/
fun invokeRoboBusJinlvM1States(states: VehicleStateOuterClass.RoboBusJinlvM1State) {
M_LISTENERS.forEach {
val listener = it.value
listener.onRoboBusJinlvM1States(states)
}
}
}

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

@@ -0,0 +1,22 @@
package com.mogo.eagle.core.function.call.autopilot
import chassis.ChassisStatesOuterClass
import chassis.VehicleStateOuterClass
import com.mogo.eagle.core.function.api.autopilot.IMoGoSweeperFutianCleanSystemListener
import com.mogo.eagle.core.function.call.base.CallerBase
/**
* 清扫车(福田)清扫控制系统状态
*/
object CallerSweeperFutianCleanSystemListenerManager : CallerBase<IMoGoSweeperFutianCleanSystemListener>() {
/**
* clean system state 清扫车(福田)清扫控制系统状态
*/
fun invokeSweeperFutianCleanSystemState(cleanSystemState: ChassisStatesOuterClass.SweeperFuTianTaskSystemStates) {
M_LISTENERS.forEach {
val listener = it.value
listener.onSweeperFutianCleanSystemState(cleanSystemState)
}
}
}

View File

@@ -1,36 +0,0 @@
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;
/**
* @author xiaoyuzhou
* @date 2021/9/17 4:02 下午
*/
public class CallerBase {
private static final String TAG = "CallerBase";
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;
}
}
return inst;
}
}

View File

@@ -0,0 +1,91 @@
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.d
import java.util.concurrent.ConcurrentHashMap
/**
* @author xiaoyuzhou
* @date 2023/01/04 4:02 下午
*/
open class CallerBase<T : Any> {
// 存储所有注册了监听的对象invokeXXXX进行遍历回调将信息同步
val M_LISTENERS: ConcurrentHashMap<String, T> = ConcurrentHashMap()
/**
* 添加 监听
* @param tag 标记,用来注销监听使用
* @param listener 监听回调
*/
fun addListener(
tag: String,
listener: T
) {
if (M_LISTENERS.containsKey(tag)) {
return
}
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,72 +0,0 @@
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
/**
* @author XuXinChao
* @description
* @since: 2022/5/18
*/
object CallerBindingCarListenerManager {
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 {
val listener = it.value
listener.queryContainersResponse(dockerList)
}
}
fun invokePushServerConfirm(){
BINDING_CAR_LISTENER.forEach{
val listener = it.value
listener.pushServerConfirm()
}
}
}

View File

@@ -1,16 +0,0 @@
package com.mogo.eagle.core.function.call.bindingcar;
import com.mogo.eagle.core.function.api.bindingcar.IMoGoBindingcarProvider;
import com.mogo.eagle.core.function.call.base.CallerBase;
import static com.mogo.eagle.core.data.constants.MogoServicePaths.PATH_BINDING_CAR;
/**
* @author lixiaopeng
*/
public class CallerBindingcarManager extends CallerBase {
public static IMoGoBindingcarProvider getBindingcarProvider() {
return getApiInstance(IMoGoBindingcarProvider.class, PATH_BINDING_CAR);
}
}

View File

@@ -0,0 +1,16 @@
package com.mogo.eagle.core.function.call.biz
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<Any>() {
@JvmStatic
val bizProvider: IMoGoFuncBizProvider
get() = getApiInstance(IMoGoFuncBizProvider::class.java, MogoServicePaths.PATH_FUNC_BIZ)
}

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,62 +0,0 @@
package com.mogo.eagle.core.function.call.check;
import android.content.Context;
import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.eagle.core.function.api.check.ICheckProvider;
import com.mogo.eagle.core.function.api.check.IMogoCheckListener;
import com.mogo.eagle.core.function.call.base.CallerBase;
/**
* @author xiaoyuzhou
* @date 2021/9/17 8:26 下午
* <p>
* HMI 调用者管理这里对外及其他模块提供功能的调用用啥写啥不要过度设计不允许直接将Provider暴露出去
*/
public class CallerCheckManager extends CallerBase {
private static ICheckProvider getCheckProvider() {
return getApiInstance(ICheckProvider.class, MogoServicePaths.PATH_CHECK);
}
/**
* 注册车辆监控变化监听
*
* @param module 监听模块
* @param listener 回调监听对象
*/
public static void registerVehicleMonitoringListener(String module, IMogoCheckListener listener) {
getCheckProvider().registerVehicleMonitoringListener(module, listener);
}
/**
* 注销车辆监控变化监听
*
* @param module
*/
public static void unregisterListener(String module) {
getCheckProvider().unregisterListener(module);
}
/**
* 启动检测模块
*/
public static void startCheckActivity(Context context) {
getCheckProvider().startCheckActivity(context);
}
/**
* 根据监测指标修改主页检测按钮
*/
public static void updateMonitoringStatus(String module, Integer state) {
getCheckProvider().updateMonitoringStatus(module, state);
}
/**
* 指标监测
*/
public static void checkMonitor(Context context) {
getCheckProvider().checkMonitor(context);
}
}

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,95 +1,57 @@
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 {
fun invokeQueryContainersResponse(dockerList: List<String>) {
M_LISTENERS.forEach {
val listener = it.value
listener.upgradeVersionUrls(urls)
listener.queryContainersResponse(dockerList)
}
}
fun invokePushServerConfirm() {
M_LISTENERS.forEach {
val listener = it.value
listener.pushServerConfirm()
}
}

View File

@@ -2,8 +2,10 @@ package com.mogo.eagle.core.function.call.devatools
import android.app.Activity
import android.content.Context
import android.view.*
import com.mogo.eagle.core.data.config.*
import android.view.View
import android.view.ViewGroup
import com.mogo.eagle.core.data.bindingcar.ModifyBindingcarInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.data.deva.chain.ChainLogParam
import com.mogo.eagle.core.data.deva.scene.SceneModule
@@ -11,8 +13,7 @@ import com.mogo.eagle.core.data.deva.scene.SceneTAG
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.function.api.devatools.IDevaToolsProvider
import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.eagle.core.utilcode.mogo.*
import record_cache.RecordPanelOuterClass
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
object CallerDevaToolsManager {
@@ -134,20 +135,11 @@ object CallerDevaToolsManager {
devaToolsProviderApi?.showFeedbackWindow(ctx)
}
/**
* 获取升级版本Urls
*/
fun getUpgradeVersionUrls(versionName: String) {
devaToolsProviderApi?.getUpgradeVersionUrls(versionName)
}
/**
* 下载指定包
*/
fun downLoadPackage(downloadKey: String, downloadUrl: String) {
devaToolsProviderApi?.downLoadPackage(downloadKey, downloadUrl)
// Log.d("Update", "downloadKey = $downloadKey --- downloadUrl = $downloadUrl")
// devaToolsProviderApi?.downLoadPackage("IntelligentPilot_v2.9.0.1002_20220725_[fPadLenovoOchBus-launcher-qa]_debug.apk", "https://scm-1255510688.cos.ap-beijing.myqcloud.com/test/com.mogo.launcher.f/2.9.0.1002/IntelligentPilot_v2.9.0.1002_20220725_[fPadLenovoOchBus-launcher-qa]_debug.apk")
}
/**
@@ -179,4 +171,24 @@ object CallerDevaToolsManager {
fun syncConfig(){
devaToolsProviderApi?.syncConfig()
}
fun modifyCarInfo(callBack: (ModifyBindingcarInfo) -> Unit){
devaToolsProviderApi?.modifyCarInfo(callBack)
}
fun getBindingCarInfo(macAddress: String, widevineIDWithMd5: String){
devaToolsProviderApi?.getBindingCarInfo(macAddress, widevineIDWithMd5)
}
fun upgradeConfirm(images: List<String>, padSn: String, releaseId: String){
devaToolsProviderApi?.upgradeConfirm(images, padSn, releaseId)
}
fun queryContainers(padSn: String, dockerVersion: String){
devaToolsProviderApi?.queryContainers(padSn, dockerVersion)
}
fun queryAppUpgrade(){
devaToolsProviderApi?.queryAppUpgrade()
}
}

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,29 @@
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
override fun doSomeAfterAddListener(tag: String, listener: IMoGoCheckAutoPilotBtnListener) {
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

@@ -7,11 +7,9 @@ import com.mogo.eagle.core.data.bindingcar.IPCUpgradeStateInfo
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_SLW
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.V2I
import com.mogo.eagle.core.data.dispatch.DispatchAdasAutoPilotLocReceiverBean
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
import com.mogo.eagle.core.data.map.Infrastructure
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.notice.NoticeNormalData
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData
import com.mogo.eagle.core.data.report.ReportEntity
@@ -19,10 +17,8 @@ import com.mogo.eagle.core.function.api.hmi.IMoGoHmiViewProxy.IViewNotificationP
import com.mogo.eagle.core.function.api.hmi.view.IOchBusView
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.IMoGoWaringProvider
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.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager.saveMsgBox
import com.zhjt.service_biz.BizConfig
/**
@@ -31,15 +27,15 @@ 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? IMoGoWaringProvider
.navigation() as? IMoGoHmiProvider
/**
* 浓雾预警
*/
fun displayEffects(){
fun displayEffects() {
waringProviderApi?.displayEffects()
}
@@ -485,14 +481,14 @@ object CallerHmiManager : CallerBase() {
/**
* 设置司机端消息盒子是否展示
*/
fun updateDriverMsgBoxTipView(show: Boolean = false){
fun updateDriverMsgBoxTipView(show: Boolean = false) {
waringProviderApi?.updateDriverMsgBoxTipView(show)
}
/**
* 设置乘客端消息盒子是否展示
*/
fun updatePassengerMsgBoxTipView(show: Boolean = false){
fun updatePassengerMsgBoxTipView(show: Boolean = false) {
waringProviderApi?.updatePassengerMsgBoxTipView(show)
}
@@ -510,6 +506,18 @@ object CallerHmiManager : CallerBase() {
waringProviderApi?.updateMfStatus(tag, status)
}
/**
* 调度弹窗展示
*/
fun showDispatchDialog(msgData: DispatchAdasAutoPilotLocReceiverBean) {
waringProviderApi?.showDispatchDialog(msgData)
}
/**
* 隐藏调度弹窗
*/
fun dismissDispatchDialog(){
waringProviderApi?.dismissDispatchDialog()
}
}

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,10 +15,10 @@ 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;
.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

@@ -5,10 +5,10 @@ import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.function.api.map.IMogoMapService
import com.mogo.eagle.core.function.api.map.marker.IMogoMarkerService
import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.map.listener.IMogoHosListenerRegister
import com.mogo.map.location.IMogoGDLocationClient
import com.mogo.map.location.IMogoLocationClient
import com.mogo.map.marker.IMogoMarkerManager
import com.mogo.map.search.geo.IMogoGeoSearch
import com.mogo.map.overlay.IMogoOverlayManager
import com.mogo.map.uicontroller.IMogoMapUIController
object CallerMapUIServiceManager {
@@ -23,18 +23,11 @@ object CallerMapUIServiceManager {
return serviceProvider?.mapUIController
}
fun getHostListenerRegister(): IMogoHosListenerRegister? {
return serviceProvider?.hostListenerRegister
}
//todo 改造module-map中监听location定位回调调用至地图更新解除map-api对caller的依赖关系
fun getSingletonLocationClient(context: Context): IMogoLocationClient? {
return serviceProvider?.getSingletonLocationClient(context)
}
fun getGeoSearch(context: Context): IMogoGeoSearch? {
return serviceProvider?.getGeoSearch(context)
}
fun getMarkerManager(context: Context): IMogoMarkerManager? {
return serviceProvider?.getMarkerManager(context)
}
@@ -42,4 +35,12 @@ object CallerMapUIServiceManager {
fun getMarkerService(): IMogoMarkerService? {
return serviceProvider?.markerService
}
fun getOverlayManager(context: Context): IMogoOverlayManager?{
return serviceProvider?.getOverlayManager(context)
}
fun getGDLocationServer(context: Context):IMogoGDLocationClient?{
return serviceProvider?.getGDLocationServer(context)
}
}

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,29 +0,0 @@
package com.mogo.eagle.core.function.call.monitor
import com.mogo.eagle.core.data.camera.CameraEntity
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.function.api.monitoring.IMoGoMonitoringProvider
import com.mogo.eagle.core.function.call.base.CallerBase
object CallerMonitorManager {
private val providerApi: IMoGoMonitoringProvider
get() = CallerBase.getApiInstance(
IMoGoMonitoringProvider::class.java,
MogoServicePaths.PATH_AI_MONITORING)
fun getCameraList(): List<CameraEntity>? {
return providerApi.cameraList
}
fun openCameraStream(cameraIp: String) {
providerApi.openCameraStream(cameraIp)
}
fun openCameraStream(cameraIp: String, success: (String) -> Unit, error: (Throwable) -> Unit) {
providerApi.openCameraStream(cameraIp, success, error)
}
fun disposeCameraStream() {
providerApi.disposeCameraStream()
}
}

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,16 +0,0 @@
package com.mogo.eagle.core.function.call.notice;
import com.mogo.eagle.core.function.api.notice.IMoGoNoticeProvider;
import com.mogo.eagle.core.function.call.base.CallerBase;
import static com.mogo.eagle.core.data.constants.MogoServicePaths.PATH_AI_NOTICE;
/**
* @author xiaoyuzhou
*/
public class CallerNoticeManager extends CallerBase {
public static IMoGoNoticeProvider getNoticeProvider() {
return getApiInstance(IMoGoNoticeProvider.class, PATH_AI_NOTICE);
}
}

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)