[dev_arch_opt_3.0]
[Change] [ 1、拆分Obu数据回调接口,等待凤坤pb提交后在统一数据调用 ] Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
package com.mogo.eagle.core.function.call.map
|
||||
|
||||
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
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* 高德地图 位置改变 监听管理
|
||||
* @author dongghongyu
|
||||
* @date 2021/9/30 5:48 下午
|
||||
* 地图 位置改变 监听管理
|
||||
*/
|
||||
object CallerMapLocationListenerManager : CallerBase<Any>() {
|
||||
|
||||
|
||||
@@ -5,18 +5,17 @@ import com.mogo.eagle.core.function.api.obu.IMoGoObuProvider
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
|
||||
/**
|
||||
*@author xiaoyuzhou
|
||||
*@date 2021/10/11 8:30 下午
|
||||
* 自研OBU管理
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/10/11 8:30 下午
|
||||
*/
|
||||
object CallerOBUManager {
|
||||
object CallerObuApiManager {
|
||||
private val providerApi: IMoGoObuProvider
|
||||
get() = CallerBase.getApiInstance(
|
||||
IMoGoObuProvider::class.java,
|
||||
MogoServicePaths.PATH_V2X_OBU_MOGO
|
||||
)
|
||||
|
||||
|
||||
/**
|
||||
* 重新设置OBU链接IP
|
||||
*
|
||||
@@ -29,7 +28,7 @@ object CallerOBUManager {
|
||||
/**
|
||||
* 断开OBU连接
|
||||
*/
|
||||
fun disConnectObu(){
|
||||
fun disConnectObu() {
|
||||
providerApi.disConnect()
|
||||
}
|
||||
|
||||
@@ -37,7 +36,7 @@ object CallerOBUManager {
|
||||
* 获取OBU连接状态
|
||||
* @return boolean 连接状态
|
||||
*/
|
||||
fun isConnected(): Boolean{
|
||||
fun isConnected(): Boolean {
|
||||
return providerApi.isConnected()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.mogo.eagle.core.function.call.obu
|
||||
|
||||
import com.mogo.eagle.core.data.obu.ObuStatusInfo
|
||||
import com.mogo.eagle.core.function.api.obu.IMoGoObuConnectListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
|
||||
/**
|
||||
* OBU 监听管理
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/9/30 5:48 下午
|
||||
*/
|
||||
object CallerObuConnectListenerManager : CallerBase<IMoGoObuConnectListener>() {
|
||||
|
||||
/**
|
||||
* 存储最后一次回调的数据,当有新当位置注册了监听将此数据回调过去,防止有些模块注册顺序问题导致无法获取最新状态
|
||||
*/
|
||||
private var mObuStatusInfo: ObuStatusInfo = ObuStatusInfo()
|
||||
|
||||
/**
|
||||
* 查询 OBU状态
|
||||
*/
|
||||
fun getObuStatusInfo(): ObuStatusInfo {
|
||||
return mObuStatusInfo
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询 OBU状态
|
||||
*/
|
||||
fun getObuStatusInfoJsonString(): String {
|
||||
return GsonUtils.toJson(mObuStatusInfo)
|
||||
}
|
||||
|
||||
override fun doSomeAfterAddListener(tag: String, listener: IMoGoObuConnectListener) {
|
||||
listener.onConnectStatus(mObuStatusInfo)
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发 OBU状态 监听
|
||||
*/
|
||||
fun invokeObuConnectListener() {
|
||||
invokeObuConnectListener(mObuStatusInfo)
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发 OBU状态 监听
|
||||
* @param obuStatusInfo 当前OBU连接状态信息
|
||||
*/
|
||||
fun invokeObuConnectListener(obuStatusInfo: ObuStatusInfo) {
|
||||
mObuStatusInfo = obuStatusInfo
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onConnectStatus(mObuStatusInfo)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
package com.mogo.eagle.core.function.call.obu
|
||||
|
||||
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
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/9/30 5:48 下午
|
||||
* OBU 监听管理
|
||||
*/
|
||||
object CallerObuListenerManager : CallerBase<IMoGoObuStatusListener>() {
|
||||
|
||||
// 存储最后一次回调的数据,当有新当位置注册了监听将此数据回调过去,防止有些模块注册顺序问题导致无法获取最新状态
|
||||
private var mObuStatusInfo: ObuStatusInfo = ObuStatusInfo()
|
||||
|
||||
/**
|
||||
* 查询 OBU状态
|
||||
*/
|
||||
fun getObuStatusInfo(): ObuStatusInfo {
|
||||
return mObuStatusInfo
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询 OBU状态
|
||||
*/
|
||||
fun getObuStatusInfoJsonString(): String {
|
||||
return GsonUtils.toJson(mObuStatusInfo)
|
||||
}
|
||||
|
||||
override fun doSomeAfterAddListener(tag: String, listener: IMoGoObuStatusListener) {
|
||||
listener.onObuStatusResponse(mObuStatusInfo)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 触发 OBU状态 监听
|
||||
*/
|
||||
fun invokeListener() {
|
||||
invokeListener(mObuStatusInfo)
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发 OBU状态 监听
|
||||
* @param obuStatusInfo 选中状态
|
||||
*/
|
||||
fun invokeListener(obuStatusInfo: ObuStatusInfo) {
|
||||
mObuStatusInfo = obuStatusInfo
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onObuStatusResponse(mObuStatusInfo)
|
||||
}
|
||||
}
|
||||
|
||||
fun invokeDelayTime(delayTime: Long) {
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onObuV2iDelayTime(delayTime)
|
||||
}
|
||||
}
|
||||
|
||||
fun invokeTrackerWarningInfo(trafficData: TrafficData){
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.updateTrackerWarningInfo(trafficData)
|
||||
}
|
||||
}
|
||||
|
||||
fun removeTrackerWarningInfo(trafficData: TrafficData){
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.removeTrackerWarningInfo(trafficData)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,20 +2,21 @@ package com.mogo.eagle.core.function.call.obu
|
||||
|
||||
import com.mogo.eagle.core.function.api.obu.IMoGoObuTrafficLightListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
|
||||
/**
|
||||
* OBU 红绿灯数据监听管理
|
||||
*/
|
||||
object CallerObuTrafficLightListenerManager : CallerBase<IMoGoObuTrafficLightListener>() {
|
||||
|
||||
private val M_OBU_TRAFFIC_LIGHT_LISTENER: ConcurrentHashMap<String, IMoGoObuTrafficLightListener> =
|
||||
ConcurrentHashMap()
|
||||
|
||||
var mLight: Int = 0
|
||||
|
||||
override fun doSomeAfterAddListener(tag: String, listener: IMoGoObuTrafficLightListener) {
|
||||
listener.onObuTrafficLight(mLight)
|
||||
}
|
||||
|
||||
fun invokeObuTrafficLight(light: Int) {
|
||||
this.mLight = light
|
||||
M_OBU_TRAFFIC_LIGHT_LISTENER.forEach {
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onObuTrafficLight(light)
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.mogo.eagle.core.function.call.obu
|
||||
|
||||
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
|
||||
|
||||
/**
|
||||
* OBU 监听管理
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/9/30 5:48 下午
|
||||
*/
|
||||
object CallerObuWarningListenerManager : CallerBase<IMoGoObuStatusListener>() {
|
||||
|
||||
fun invokeDelayTime(delayTime: Long) {
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onObuV2iDelayTime(delayTime)
|
||||
}
|
||||
}
|
||||
|
||||
fun invokeTrackerWarningInfo(trafficData: TrafficData) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.updateTrackerWarningInfo(trafficData)
|
||||
}
|
||||
}
|
||||
|
||||
fun removeTrackerWarningInfo(trafficData: TrafficData) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.removeTrackerWarningInfo(trafficData)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mogo.eagle.core.function.call.obu
|
||||
|
||||
import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningMapListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import com.mogo.support.obu.model.MogoObuMapMathData
|
||||
|
||||
/**
|
||||
* OBU 地图匹配结果,车道线、红绿灯、建议最大车速、建议最小车速
|
||||
*/
|
||||
object CallerObuWarningMapListenerManager : CallerBase<IMoGoObuWarningMapListener>() {
|
||||
|
||||
fun invokeObuMapMath(data: MogoObuMapMathData) {
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onMoGoObuMapMath(data)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mogo.eagle.core.function.call.obu
|
||||
|
||||
import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningRsiListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import com.mogo.support.obu.model.MogoObuRsiWarningData
|
||||
|
||||
/**
|
||||
* OBU 交通事件预警
|
||||
*/
|
||||
object CallerObuWarningRsiListenerManager : CallerBase<IMoGoObuWarningRsiListener>() {
|
||||
|
||||
fun invokeObuRsiWarning(data: MogoObuRsiWarningData) {
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onMoGoObuRsiWarning(data)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mogo.eagle.core.function.call.obu
|
||||
|
||||
import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningRsmListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import com.mogo.support.obu.model.MogoObuRsmWarningData
|
||||
|
||||
/**
|
||||
* OBU RSM预警信息,弱势交通参与者预警信息
|
||||
*/
|
||||
object CallerObuWarningRsmListenerManager : CallerBase<IMoGoObuWarningRsmListener>() {
|
||||
|
||||
fun invokeObuRsmWarning(data: MogoObuRsmWarningData) {
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onMoGoObuRsmWarning(data)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mogo.eagle.core.function.call.obu
|
||||
|
||||
import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningRvListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import com.mogo.support.obu.model.MogoObuRvWarningData
|
||||
|
||||
/**
|
||||
* OBU V2V预警信息,车与车间的预警,左右超车、前方车刹车、车辆事故
|
||||
*/
|
||||
object CallerObuWarningRvListenerManager : CallerBase<IMoGoObuWarningRvListener>() {
|
||||
|
||||
fun invokeObuRvWarning(data: MogoObuRvWarningData) {
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onMoGoObuRvWarning(data)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mogo.eagle.core.function.call.obu
|
||||
|
||||
import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningSpatListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import com.mogo.support.obu.model.MogoObuSpatWarningData
|
||||
|
||||
/**
|
||||
* OBU 红绿灯信息
|
||||
*/
|
||||
object CallerObuWarningSpatListenerManager : CallerBase<IMoGoObuWarningSpatListener>() {
|
||||
|
||||
fun invokeObuSpatWarning(data: MogoObuSpatWarningData) {
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onMoGoObuSpatWarning(data)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user