添加标牌分类,添加测试数据
This commit is contained in:
@@ -26,6 +26,13 @@
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<receiver android:name="com.mogo.eagle.core.function.obu.mogo.receiver.ObuTestNewObuReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="com.obu.test_newobu" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -71,6 +71,10 @@ class MogoPrivateObuNewManager private constructor() {
|
||||
MogoObuManager.getInstance().connect(options)
|
||||
}
|
||||
|
||||
fun getMogoObuListener(): OnMogoObuListener {
|
||||
return mogoObuListener
|
||||
}
|
||||
|
||||
private val mogoObuListener: OnMogoObuListener = object : OnMogoObuListener() {
|
||||
/**
|
||||
* 连接状态的改变
|
||||
@@ -240,30 +244,39 @@ class MogoPrivateObuNewManager private constructor() {
|
||||
|
||||
when (appId) {
|
||||
// 道路危险情况预警
|
||||
EventTypeEnum.TYPE_USECASE_ID_HLW.poiType,
|
||||
EventTypeEnum.TYPE_USECASE_ID_IVS.poiType //车内标牌
|
||||
EventTypeEnum.TYPE_USECASE_ID_HLW.poiType
|
||||
-> {
|
||||
when (data.warning_Msg[0].eventSerialNum) { //TODO 没有下面分类
|
||||
904 -> { //车辆逆行
|
||||
appId =
|
||||
EventTypeEnum.TYPE_USECASE_ID_ROAD_VEHICLE_RETROGRADE.poiType
|
||||
when (data.warning_Msg[0].eventSerialNum) {
|
||||
MogoObuConstants.RTE.RTI_TYPE_RETRIGRADE -> { //车辆逆行
|
||||
appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_VEHICLE_RETROGRADE.poiType
|
||||
}
|
||||
|
||||
901 -> { //超速行驶
|
||||
MogoObuConstants.RTE.RTI_TYPE_SPEEDING -> { //超速行驶
|
||||
appId = EventTypeEnum.TYPE_USECASE_ID_SLW.poiType
|
||||
}
|
||||
|
||||
103 -> {//车辆故障
|
||||
MogoObuConstants.RTE.RTI_TYPE_BREAKDOWN -> {//车辆故障
|
||||
appId = EventTypeEnum.TYPE_USECASE_ID_BREAKDOWN_WARNING.poiType
|
||||
}
|
||||
|
||||
501 -> { //施工占道 TODO
|
||||
MogoObuConstants.RTE.RTI_TYPE_CONSTRUCTION_RTE -> { //施工占道
|
||||
appId = EventTypeEnum.FOURS_ROAD_WORK.poiType
|
||||
}
|
||||
|
||||
412 -> { //异常停车
|
||||
MogoObuConstants.RTE.RTI_TYPE_PARKING_VIOLATION -> { //异常停车
|
||||
appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_PARKING.poiType
|
||||
}
|
||||
MogoObuConstants.RTE.RTI_TYPE_ROAD_WATER -> { //道路积水
|
||||
appId = EventTypeEnum.FOURS_PONDING.poiType
|
||||
}
|
||||
}
|
||||
alertContent = EventTypeEnum.getWarningContent(appId)
|
||||
ttsContent = EventTypeEnum.getWarningTts(appId)
|
||||
}
|
||||
|
||||
EventTypeEnum.TYPE_USECASE_ID_IVS.poiType //车内标牌
|
||||
-> {
|
||||
when (data.warning_Msg[0].eventSerialNum) { //TODO
|
||||
MogoObuConstants.RTS.RTI_TYPE_SCHOOL -> { //学校
|
||||
appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType
|
||||
}
|
||||
|
||||
}
|
||||
alertContent = EventTypeEnum.getWarningContent(appId)
|
||||
ttsContent = EventTypeEnum.getWarningTts(appId)
|
||||
@@ -290,7 +303,10 @@ class MogoPrivateObuNewManager private constructor() {
|
||||
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
|
||||
"ttsContent = $ttsContent --alertContent = $alertContent"
|
||||
)
|
||||
Log.d(TAG, "appId = $appId ---ttsContent = $ttsContent ---alertContent = $alertContent + --direction = ${direction.direction}" )
|
||||
Log.d(
|
||||
TAG,
|
||||
"appId = $appId ---ttsContent = $ttsContent ---alertContent = $alertContent + --direction = ${direction.direction}"
|
||||
)
|
||||
|
||||
when (status) {
|
||||
// 添加
|
||||
@@ -564,7 +580,8 @@ class MogoPrivateObuNewManager private constructor() {
|
||||
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
|
||||
"appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction"
|
||||
)
|
||||
Log.d(TAG,
|
||||
Log.d(
|
||||
TAG,
|
||||
"appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction"
|
||||
)
|
||||
if (level == 2 || level == 3) {
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.mogo.eagle.core.function.obu.mogo.receiver
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.util.Log
|
||||
import com.mogo.eagle.core.function.obu.mogo.MogoPrivateObuNewManager
|
||||
import com.mogo.support.obu.model.MogoObuRvWarningData
|
||||
import com.mogo.support.obu.model.advance.V2xWarning
|
||||
import com.mogo.support.obu.model.advance.VehBasics
|
||||
import com.mogo.support.obu.model.advance.WarningData
|
||||
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @date 2022/9/8 10:50 上午
|
||||
*
|
||||
* 自研OBU 模拟场景
|
||||
*/
|
||||
class ObuTestNewObuReceiver : BroadcastReceiver() {
|
||||
private var mContext: Context? = null
|
||||
|
||||
companion object {
|
||||
private const val TAG = "ObuTestNewObuReceiver"
|
||||
}
|
||||
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
mContext = context
|
||||
/**
|
||||
* OBU 场景类型
|
||||
* @see com.zhidao.support.obu.constants.ObuConstants.USE_CASE_ID
|
||||
*/
|
||||
val obuType = intent.getIntExtra("type", 0)
|
||||
val obuStatus = intent.getIntExtra("status", 0)
|
||||
val obuLevel = intent.getIntExtra("level", 3)
|
||||
val direction = intent.getIntExtra("direction", 0)
|
||||
Log.d("liyz", "obuType:$obuType obuStatus:$obuStatus obuLevel:$obuLevel")
|
||||
|
||||
val vehBasicsMsg = VehBasics(1)
|
||||
vehBasicsMsg.targetPosition = 0x11
|
||||
|
||||
val warningMsg = V2xWarning(1)
|
||||
|
||||
val warningData1 = WarningData(1, 2)
|
||||
warningData1.warningType = obuType
|
||||
warningData1.warningLevel = obuLevel
|
||||
// val warningData2 = WarningData(1, 3)
|
||||
|
||||
val warningList = listOf(warningData1)
|
||||
warningMsg.warningData = warningList
|
||||
|
||||
val cvxHvInfoIndInfo = MogoObuRvWarningData(0, vehBasicsMsg, warningMsg)
|
||||
|
||||
MogoPrivateObuNewManager.INSTANCE
|
||||
.getMogoObuListener()
|
||||
.onMogoObuRvWarning(cvxHvInfoIndInfo)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user