[2.13.2] 修改限速展示来源和优先级,暂时废弃开关

This commit is contained in:
lixiaopeng
2023-01-13 00:06:57 +08:00
parent 15235dce86
commit 3e3cbb4459
18 changed files with 220 additions and 29 deletions

View File

@@ -248,10 +248,12 @@ object CallerHmiManager : CallerBase() {
* 展示限速预警
*
* @param limitingSpeed 限速速度
* @param limitSpeedSource 限速来源 1:MAP, 2:RSU
*/
@BizConfig(V2I, "", BIZ_SLW)
fun showLimitingVelocity(limitingSpeed: Int) {
waringProviderApi?.showLimitingVelocity(limitingSpeed)
fun showLimitingVelocity(limitingSpeed: Int, limitSpeedSource: Int) {
Log.e("liyz", "showLimitingVelocity limitingSpeed = $limitingSpeed ---limitSpeedSource = $limitSpeedSource")
waringProviderApi?.showLimitingVelocity(limitingSpeed, limitSpeedSource)
}
/**

View File

@@ -0,0 +1,74 @@
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.function.api.v2x.ObuLimitingSpeedListener
import com.mogo.eagle.core.utilcode.util.LogUtils
import java.util.concurrent.ConcurrentHashMap
/**
* 限速信息监听
*/
object CallObuLimitingSpeedListenerManager {
private const val TAG = "CallObuLimitingSpeedListenerManager"
private val M_TRAFFIC_LIGHT_LISTENER: ConcurrentHashMap<String, ObuLimitingSpeedListener> =
ConcurrentHashMap()
private var mObuLimitSpeed = 0
/**
* 添加监听
* @param tag 标记,用来注销监听使用
* @param listener 监听回调
*/
fun addListener(
@Nullable tag: String,
@Nullable listener: ObuLimitingSpeedListener
) {
if (M_TRAFFIC_LIGHT_LISTENER.containsKey(tag)) {
LogUtils.eTag(TAG, "Tag:$tag already exists,please use other tag")
return
}
listener.onObuLimitingSpeedChange(mObuLimitSpeed)
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: ObuLimitingSpeedListener) {
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 invokeOnObuLimitingSpeedChange(limitingSpeed: Int) {
this.mObuLimitSpeed = limitingSpeed
M_TRAFFIC_LIGHT_LISTENER.forEach {
val tag = it.key
val listener = it.value
listener.onObuLimitingSpeedChange(limitingSpeed)
}
}
}