Merge remote-tracking branch 'origin/feature/feature_mogo_obu' into feature/feature_mogo_obu

This commit is contained in:
董宏宇
2021-08-18 16:44:20 +08:00
4 changed files with 112 additions and 31 deletions

View File

@@ -18,5 +18,14 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<receiver android:name=".receiver.ObuRsuTestTriggerReceiver">
<intent-filter>
<action android:name="com.obu.test_light_recognized" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
</application>
</manifest>

View File

@@ -19,5 +19,8 @@ public class MogoObuConst {
public static String BROADCAST_OBU_STATES_EXTRA_KEY = "obuStates";
// 场景预警等级2-弹窗3-弹窗+tts+地图绘制
public static String BROADCAST_OBU_LEVEL_EXTRA_KEY = "obuLevel";
//红绿灯标识 0:不可用1红灯2绿灯3黄灯
public static String BROADCAST_LIGHT_LEVEL_EXTRA_KEY = "lightLevel";
}

View File

@@ -175,7 +175,7 @@ class MogoPrivateObuManager private constructor() {
override fun onCvxIvpThreatIndInfo(info: CvxIvpThreatIndInfo?) {
Logger.d(MogoObuConst.TAG_MOGO_OBU, "CvxIvpThreatIndInfo ------> $info")
info?.let {
handlerTrafficLight(info.status, info.ext_info.lights)
handlerTrafficLight(info.status, info.ext_info.lights, info.threat_info.app_id)
}
}
@@ -183,7 +183,7 @@ class MogoPrivateObuManager private constructor() {
override fun onCvxMapSpatInfoIndInfo(info: CvxMapSpatInfoIndInfo?) {
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxMapSpatInfoIndInfo ------> $info")
info?.let {
handlerTrafficLight(info.status, info.ivp_threat_ext.lights)
// handlerTrafficLight(info.status, info.ivp_threat_ext.lights)
}
}
@@ -296,7 +296,10 @@ class MogoPrivateObuManager private constructor() {
/**
* 处理红绿灯
*/
private fun handlerTrafficLight(status: Int, lights: List<Light>) {
private fun handlerTrafficLight(status: Int, lights: List<Light>, appId: Int) {
var alertContent = ""
var ttsContent = ""
when (status) {
// 添加
ObuConstants.STATUS.ADD -> {
@@ -309,6 +312,14 @@ class MogoPrivateObuManager private constructor() {
// 红灯
0x1 -> {
mIMoGoWaringProvider?.showWarningTrafficLight(1)
ttsContent = WarningTypeEnum.getWarningTts(appId)
alertContent = WarningTypeEnum.getWarningContent(appId)
mIMoGoWaringProvider!!.showWarningV2X(
appId,
alertContent,
ttsContent,
appId.toString()
)
}
// 绿灯
0x2 -> {
@@ -321,9 +332,12 @@ class MogoPrivateObuManager private constructor() {
}
}
}
// 删除
ObuConstants.STATUS.DELETE -> {
mIMoGoWaringProvider?.disableWarningTrafficLight()
// 移除顶部弹窗
mIMoGoWaringProvider?.disableWarningV2X(appId.toString())
}
else -> {
}
@@ -405,22 +419,6 @@ class MogoPrivateObuManager private constructor() {
alertContent = WarningTypeEnum.getWarningContent(appId)
}
// 弱势交通参与者碰撞预警,行人/摩托车碰撞预警 TODO
WarningTypeEnum.TYPE_USECASE_ID_VRUCW.useCaseId -> {
}
//限速预警 TODO
WarningTypeEnum.TYPE_USECASE_ID_SLW.useCaseId -> {
ttsContent = WarningTypeEnum.getWarningTts(appId)
alertContent = WarningTypeEnum.getWarningContent(appId)
if (status == ObuConstants.STATUS.ADD) {
mIMoGoWaringProvider!!.showLimitingVelocity(0)
} else if (status == ObuConstants.STATUS.DELETE) {
mIMoGoWaringProvider!!.disableLimitingVelocity()
}
}
// 前方拥堵提醒,前方XXX米道路拥堵请减速慢行 TODO
WarningTypeEnum.TYPE_USECASE_ID_TJW.useCaseId -> {
ttsContent = WarningTypeEnum.getWarningTts(appId)
@@ -428,18 +426,6 @@ class MogoPrivateObuManager private constructor() {
alertContent = WarningTypeEnum.getWarningContent(appId)
}
//闯红灯预警,应该是红灯。其他灯的时候 TODO
WarningTypeEnum.TYPE_USECASE_ID_IVP.useCaseId -> {
ttsContent = WarningTypeEnum.getWarningTts(appId)
alertContent = WarningTypeEnum.getWarningContent(appId)
if (status == ObuConstants.STATUS.ADD) {
mIMoGoWaringProvider!!.showWarningTrafficLight(0)
} else if (status == ObuConstants.STATUS.DELETE) {
mIMoGoWaringProvider!!.disableWarningTrafficLight() //关闭交通灯
}
}
// 这里处理固定的提示信息
else -> {
ttsContent = WarningTypeEnum.getWarningTts(appId)
@@ -483,4 +469,6 @@ class MogoPrivateObuManager private constructor() {
}
}
}
}

View File

@@ -0,0 +1,81 @@
package com.mogo.module.obu.mogo.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.util.Log
import com.mogo.module.obu.mogo.MogoObuConst
import com.mogo.module.obu.mogo.MogoPrivateObuManager
import com.mogo.utils.logger.Logger
import com.zhidao.support.obu.constants.ObuConstants
import com.zhidao.support.obu.model.CvxIvpThreatIndInfo
import com.zhidao.support.obu.model.CvxSlwThreatIndInfo
import com.zhidao.support.obu.model.advance.*
/**
* @author lixiaopeng
* @date 2021/8/18
*
* OBU 测试使用
* 红绿灯
*/
class ObuRsuTestTriggerReceiver : BroadcastReceiver() {
private var mContext: Context? = null
companion object {
private const val TAG = "ObuRsuTestTriggerReceiver"
}
override fun onReceive(context: Context, intent: Intent) {
mContext = context
val obuType = intent.getIntExtra(MogoObuConst.BROADCAST_OBU_TYPE_EXTRA_KEY, 0)
val obuStatus = intent.getIntExtra(MogoObuConst.BROADCAST_OBU_STATES_EXTRA_KEY, 0)
val obuLevel = intent.getIntExtra(MogoObuConst.BROADCAST_OBU_LEVEL_EXTRA_KEY, 3)
val phase = intent.getIntExtra(MogoObuConst.BROADCAST_LIGHT_LEVEL_EXTRA_KEY, 0)
Logger.d(
TAG, "obuStatus:$obuStatus phase:$phase obuType:$obuType obuLevel:$obuLevel"
)
when (obuType) {
ObuConstants.USE_CASE_ID.IVP -> { //构建红绿灯数据
var cvxIvpThreatIndInfo = CvxIvpThreatIndInfo(1, 1, 1L)
val ivpThreat = IvpThreat(1, obuType, null, 1000, obuLevel, 100)
cvxIvpThreatIndInfo.threat_info = ivpThreat
val lightList = listOf<Light>(Light(1, phase, 1000, 100, 100, 1, 100, 1000))
val ivpThreatExt = IvpThreatExt(1, 1000, 1000, 0, 2, lightList)
cvxIvpThreatIndInfo.ext_info = ivpThreatExt
cvxIvpThreatIndInfo.status = obuStatus
cvxIvpThreatIndInfo.link_id = "1"
MogoPrivateObuManager.INSTANCE.getMogoObuListener()
.onCvxIvpThreatIndInfo(cvxIvpThreatIndInfo)
}
ObuConstants.USE_CASE_ID.SLW -> { //限速预警
val cvxSlwThreatIndInfo = CvxSlwThreatIndInfo(1, 1, 1L)
val slwThreatExt = SlwThreatExt(1, 2, 6000, 2000)
cvxSlwThreatIndInfo.ext_info = slwThreatExt
cvxSlwThreatIndInfo.status = obuStatus
MogoPrivateObuManager.INSTANCE.getMogoObuListener().onCvxSlwThreatIndInfo(cvxSlwThreatIndInfo)
}
//弱势交通参与者碰撞预警,行人/摩托车碰撞预警
ObuConstants.USE_CASE_ID.VRUCW -> {
}
}
}
}