diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/AndroidManifest.xml b/core/function-impl/mogo-core-function-obu-mogo/src/main/AndroidManifest.xml index ee523e6bfd..dc0250ec9b 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/AndroidManifest.xml +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/AndroidManifest.xml @@ -26,6 +26,13 @@ + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuNewManager.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuNewManager.kt index b2866f7877..198d8b81c9 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuNewManager.kt +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuNewManager.kt @@ -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) { diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/receiver/ObuTestNewObuReceiver.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/receiver/ObuTestNewObuReceiver.kt new file mode 100644 index 0000000000..b77c0b0b86 --- /dev/null +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/receiver/ObuTestNewObuReceiver.kt @@ -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) + + } + +} \ No newline at end of file diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/enums/EventTypeEnum.kt b/modules/mogo-module-common/src/main/java/com/mogo/module/common/enums/EventTypeEnum.kt index 6b078f216f..1abcb2d95d 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/enums/EventTypeEnum.kt +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/enums/EventTypeEnum.kt @@ -269,7 +269,7 @@ enum class EventTypeEnum( //6种智行杯的场景需添加 TYPE_USECASE_ID_ROAD_VEHICLE_RETROGRADE( - 904.toString(), + MogoObuConstants.RTE.RTI_TYPE_RETRIGRADE.toString(), "注意逆行车辆", poiTypeSrcVr = R.drawable.icon_warning_v2x_school, content = "注意逆行车辆", @@ -277,7 +277,7 @@ enum class EventTypeEnum( ), TYPE_USECASE_ID_SLW( - 901.toString(), + MogoObuConstants.RTE.RTI_TYPE_SPEEDING.toString(), "注意超速车辆", poiTypeSrcVr = R.drawable.icon_warning_v2x_over_speed, content = "注意超速车辆", @@ -285,7 +285,7 @@ enum class EventTypeEnum( ), TYPE_USECASE_ID_BREAKDOWN_WARNING( - 103.toString(), + MogoObuConstants.RTE.RTI_TYPE_BREAKDOWN.toString(), "注意故障车辆", poiTypeSrcVr = R.drawable.icon_warning_v2x_collision_warning, content = "注意故障车辆", @@ -293,7 +293,7 @@ enum class EventTypeEnum( ), TYPE_USECASE_ID_ROAD_PARKING( - 412.toString(), + MogoObuConstants.RTE.RTI_TYPE_PARKING_VIOLATION.toString(), "注意异常停车", poiTypeSrcVr = R.drawable.icon_warning_v2x_no_parking, content = "注意异常停车",