[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

@@ -56,8 +56,8 @@ class V2XLimitingVelocityBroadcastReceiver : BroadcastReceiver() {
*
* @param limitingVelocitySpeed 限速速度
*/
private fun dispatchShowWaring(limitingVelocitySpeed: Int) {
CallerHmiManager.showLimitingVelocity(limitingVelocitySpeed)
private fun dispatchShowWaring(limitingVelocitySpeed: Int) { // TODO liyz
CallerHmiManager.showLimitingVelocity(limitingVelocitySpeed, 3)
}
/**

View File

@@ -76,7 +76,7 @@ class V2XWarningBroadcastReceiver : BroadcastReceiver() {
tag: String?
) {
if (EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType == v2xType.toString()) {
CallerHmiManager.showLimitingVelocity(1)
CallerHmiManager.showLimitingVelocity(1, 4)
}
if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) {
Log.d("MsgBox-V2XWarningBR", "alertContent或ttsContent为空!")

View File

@@ -1082,18 +1082,26 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
/**
* 控制展示限速标志及内容
*/
override fun showLimitingVelocity(limitingSpeed: Int) {
override fun showLimitingVelocity(limitingSpeed: Int, limitSpeedSource: Int) {
// 控制 限速UI 展示
if (HmiBuildConfig.isShowLimitingVelocityView) {
if (limitingSpeed > 0) {
mViewLimitingVelocity?.visibility = View.VISIBLE
mViewLimitingVelocity?.updateLimitingSpeed(limitingSpeed)
mViewLimitingVelocity?.updateLimitingSpeed(limitingSpeed, limitSpeedSource)
tvLimitingSource?.visibility = View.VISIBLE
if (limitSpeedSource == 1) {
tvLimitingSource.text = "MAP"
} else if (limitSpeedSource == 2) {
tvLimitingSource.text = "RSU"
}
} else {
mViewLimitingVelocity?.visibility = View.INVISIBLE
mViewLimitingVelocity?.updateLimitingSpeed(0)
mViewLimitingVelocity?.updateLimitingSpeed(0, limitSpeedSource)
tvLimitingSource?.visibility = View.INVISIBLE
}
} else {
disableLimitingVelocity()
tvLimitingSource?.visibility = View.GONE
}
}
@@ -1102,7 +1110,7 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
*/
override fun disableLimitingVelocity() {
mViewLimitingVelocity?.visibility = View.GONE
mViewLimitingVelocity?.updateLimitingSpeed(0)
mViewLimitingVelocity?.updateLimitingSpeed(0, 1)
}
/**

View File

@@ -20,8 +20,8 @@ class LimitingVelocityView @JvmOverloads constructor(
LayoutInflater.from(context).inflate(R.layout.view_limiting_speed_vr, this, true)
}
override fun updateLimitingSpeed(limitingSpeed: Int) {
super.updateLimitingSpeed(limitingSpeed)
override fun updateLimitingSpeed(limitingSpeed: Int, limitSource: Int) {
super.updateLimitingSpeed(limitingSpeed, limitSource)
tvLimitingVelocity.text = "$limitingSpeed"
}
}

View File

@@ -18,6 +18,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
import com.mogo.eagle.core.function.call.bindingcar.CallerBindingCarListenerManager
import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsUpgradeListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showUpgradeDialog
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger

View File

@@ -182,6 +182,20 @@
app:layout_goneMarginTop="40dp"
tools:visibility="gone" />
<!--限速来源-->
<TextView
android:id="@+id/tvLimitingSource"
android:layout_width="120dp"
android:layout_height="35dp"
android:gravity="center"
android:text=""
android:textColor="@color/notice_text_blue"
android:textSize="@dimen/dp_30"
android:layout_marginEnd="40dp"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/viewLimitingVelocity" />
<!--消息盒子司机端选择入口-->
<CheckBox
android:id="@+id/cbMsgBoxDriver"

View File

@@ -3,7 +3,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/tvLimitingVelocity"
@@ -16,7 +17,5 @@
android:textColor="#FFFFFF"
android:textSize="@dimen/dp_60"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ivCameraIcon"
/>
app:layout_constraintTop_toBottomOf="@+id/ivCameraIcon" />
</LinearLayout>

View File

@@ -441,8 +441,8 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
CallerLogger.d("${M_OBU}${TAG}",
"MogoObuDcCombineManager onMogoObuMapMath = ${data.status} --speedMaxLimit = ${Math.round((data.speedMaxLimit*0.02*3.6))} --- data.speedMaxLimit = ${data.speedMaxLimit}")
when (data.status) {
MogoObuConstants.STATUS.ADD -> { // 添加
CallerHmiManager.showLimitingVelocity(Math.round((data.speedMaxLimit*0.02*3.6)).toInt())
MogoObuConstants.STATUS.ADD -> { // 添加 TODO
CallerHmiManager.showLimitingVelocity(Math.round((data.speedMaxLimit*0.02*3.6)).toInt(), 2)
}
MogoObuConstants.STATUS.UPDATE -> { // 更新

View File

@@ -20,6 +20,7 @@ import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.TooC
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.obu.CallerObuListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuTrafficLightListenerManager
import com.mogo.eagle.core.function.call.v2x.CallObuLimitingSpeedListenerManager
import com.mogo.eagle.core.function.obu.mogo.utils.TrafficDataConvertUtilsNew
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
@@ -587,7 +588,7 @@ class MogoPrivateObuNewManager private constructor() {
*/
override fun onMogoObuMapMath(data: MogoObuMapMathData?) {
super.onMogoObuMapMath(data)
if (isShowObuLimitSpeedView) {
// if (isShowObuLimitSpeedView) {
if (data != null) {
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
@@ -598,9 +599,9 @@ class MogoPrivateObuNewManager private constructor() {
MogoObuConstants.STATUS.ADD -> { // 添加
UiThreadHandler.post {
if (data.speedMaxLimit > 0) {
CallerHmiManager.showLimitingVelocity(
Math.round((data.speedMaxLimit * 3.6)).toInt()
)
// CallerHmiManager.showLimitingVelocity(
// Math.round((data.speedMaxLimit * 3.6)).toInt(), 2)
CallObuLimitingSpeedListenerManager.invokeOnObuLimitingSpeedChange(Math.round((data.speedMaxLimit * 3.6)).toInt())
}
}
}
@@ -610,12 +611,13 @@ class MogoPrivateObuNewManager private constructor() {
MogoObuConstants.STATUS.DELETE -> { // 删除
UiThreadHandler.post {
CallerHmiManager.disableLimitingVelocity()
// CallerHmiManager.disableLimitingVelocity()
CallObuLimitingSpeedListenerManager.invokeOnObuLimitingSpeedChange(-1)
}
}
}
}
}
// }
}
}

View File

@@ -8,6 +8,7 @@ import com.mogo.eagle.core.function.api.v2x.IV2XEventProvider
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightManager
import com.mogo.eagle.core.function.v2x.events.V2XEventManager
import com.mogo.eagle.core.function.v2x.speedlimit.SpeedLimitDataManager
import com.mogo.eagle.core.function.v2x.speedlimit.SpeedLimitDispatcher
import com.mogo.eagle.core.function.v2x.trafficlight.core.TrafficLightDispatcher
import com.mogo.eagle.core.function.v2x.vip.VipCarManager
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
@@ -23,6 +24,7 @@ class V2XProvider : IV2XEventProvider {
VipCarManager.INSTANCE.initServer(context)
SpeedLimitDataManager.getInstance().start()
TrafficLightDispatcher.INSTANCE.initServer(context)
SpeedLimitDispatcher.INSTANCE.initLimit(context)
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
//不处理

View File

@@ -54,17 +54,16 @@ public class SpeedLimitDataManager implements IMogoCarLocationChangedListener2 {
@BizConfig(biz = V2I,dependentBizNode = "",bizNode = BIZ_SLW)
private void getSpeedLimit() {
if (!isShowObuLimitSpeedView) {
// if (!isShowObuLimitSpeedView) {
int speedLimit = MogoMapUIController.getInstance().getLimitSpeed(mLocation.getLongitude(), mLocation.getLatitude(), mLocation.getBearing());
UiThreadHandler.post(() -> {
if (speedLimit > 0) {
Log.d("liyz", "SpeedLimitDataManager map getSpeedLimit speedLimit = " + speedLimit);
CallerHmiManager.INSTANCE.showLimitingVelocity(speedLimit);
// CallerHmiManager.INSTANCE.showLimitingVelocity(speedLimit);
CallLimitingVelocityListenerManager.INSTANCE.invokeOnLimitingVelocityChange(speedLimit);
}
});
}
}
// }
}
public void start() {

View File

@@ -0,0 +1,80 @@
package com.mogo.eagle.core.function.v2x.speedlimit
import android.content.Context
import android.os.Handler
import android.util.Log
import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
import com.mogo.eagle.core.function.api.obu.IMoGoObuTrafficLightListener
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
import com.mogo.eagle.core.function.api.v2x.LimitingVelocityListener
import com.mogo.eagle.core.function.api.v2x.ObuLimitingSpeedListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.obu.CallerObuTrafficLightListenerManager
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.call.v2x.CallLimitingVelocityListenerManager
import com.mogo.eagle.core.function.call.v2x.CallObuLimitingSpeedListenerManager
import com.mogo.eagle.core.function.v2x.trafficlight.TrafficLightHMIManager
import perception.TrafficLightOuterClass
import perception.TrafficLightOuterClass.TrafficLight
/**
* @author lixiaopeng
* @description 对多个限速进行调度maprsu ...
* @since: 2023/1/12
*/
class SpeedLimitDispatcher : LimitingVelocityListener, ObuLimitingSpeedListener {
companion object {
const val TAG = "SpeedLimitDispatcher"
val INSTANCE: SpeedLimitDispatcher by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
SpeedLimitDispatcher()
}
}
private var mContext: Context? = null
//是否有AI获取红绿灯灯态
private var hasObuStatus: Boolean = false
fun initLimit(context: Context) {
mContext = context
//注册监听MAP的限速
CallLimitingVelocityListenerManager.addListener(TAG, this)
//注册监听OBU的限速
CallObuLimitingSpeedListenerManager.addListener(TAG, this)
}
/**
* 地图限速数据
*/
override fun onLimitingVelocityChange(limitingVelocity: Int) {
// CallerHmiManager.disableLimitingVelocity()
if (!hasObuStatus) {
CallerHmiManager.showLimitingVelocity(limitingVelocity, 1)
}
}
/**
* obu限速
*/
override fun onObuLimitingSpeedChange(limitingSpeed: Int) {
// CallerHmiManager.disableLimitingVelocity()
if (limitingSpeed > 0) {
hasObuStatus = true
CallerHmiManager.showLimitingVelocity(limitingSpeed, 2)
} else {
hasObuStatus = false
CallerHmiManager.disableLimitingVelocity()
}
}
fun destroy() {
//取消注册监听AI云获取红绿灯状态
CallerTrafficLightListenerManager.unRegisterTrafficLightListener(TAG)
//取消注册监听工控机感知红绿灯
CallerAutopilotIdentifyListenerManager.removeListener(TAG)
}
}