完成了预警红边的迁移HMI

调用方式为
//显示警告红边
mIMoGoWaringProvider!!.showWarning(direction)

Signed-off-by: chenfufeng <chenfufeng@zhidaoauto.com>
This commit is contained in:
董宏宇
2021-09-10 22:02:24 +08:00
committed by chenfufeng
parent 17780054d4
commit cd1e2cfcf6
8 changed files with 108 additions and 164 deletions

67
.idea/misc.xml generated
View File

@@ -13,39 +13,11 @@
<map>
<entry key="../../../../../../layout/custom_preview.xml" value="0.390625" />
<entry key="../../../../../layout/custom_preview.xml" value="0.19947916666666668" />
<entry key="../../../../layout/custom_preview.xml" value="0.14635416666666667" />
<entry key="OCH/mogo-och/src/main/res/layout/module_mogo_och_base_fragment.xml" value="0.1953125" />
<entry key="modules/mogo-module-authorize/src/main/res/layout/module_authorize_fragment.xml" value="0.273046875" />
<entry key="modules/mogo-module-common/src/main/res-warning/drawable/bg_waring_limiting_velocity.xml" value="0.109375" />
<entry key="modules/mogo-module-common/src/main/res-warning/drawable/bg_waring_traffic_light_vr.xml" value="0.109375" />
<entry key="modules/mogo-module-common/src/main/res-warning/drawable/bg_warning_bg.xml" value="0.109375" />
<entry key="modules/mogo-module-common/src/main/res/drawable/bg_v2x_event_type_blue.xml" value="0.1390625" />
<entry key="modules/mogo-module-common/src/main/res/drawable/bg_v2x_event_type_red_vr.xml" value="0.2421875" />
<entry key="modules/mogo-module-extensions/src/main/res/layout/camera_item_v2x_live_video.xml" value="0.28854166666666664" />
<entry key="modules/mogo-module-extensions/src/main/res/layout/camera_push_live_video.xml" value="0.27447916666666666" />
<entry key="modules/mogo-module-extensions/src/main/res/layout/camera_view_video_layout_normal.xml" value="0.27447916666666666" />
<entry key="modules/mogo-module-extensions/src/main/res/layout/include_debug_panel.xml" value="0.28854166666666664" />
<entry key="modules/mogo-module-extensions/src/main/res/layout/merge_vertical_traffic_light_in_vr.xml" value="0.27447916666666666" />
<entry key="modules/mogo-module-extensions/src/main/res/layout/module_ext_include_seeking_help_notice.xml" value="0.28854166666666664" />
<entry key="modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_crash_threshold_set.xml" value="0.11979166666666667" />
<entry key="modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml" value="0.2953125" />
<entry key="modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance_no_map.xml" value="0.28854166666666664" />
<entry key="modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_extensions.xml" value="0.28854166666666664" />
<entry key="modules/mogo-module-extensions/src/main/res/layout/module_map_layout_navi_info_panel.xml" value="0.28854166666666664" />
<entry key="modules/mogo-module-guide/src/main/res/layout/module_guide_fragment.xml" value="0.28854166666666664" />
<entry key="modules/mogo-module-guide/src/main/res/layout/module_guide_item_stage_five.xml" value="0.28854166666666664" />
<entry key="modules/mogo-module-hmi/src/main/res/layout/fragment_warning.xml" value="1.0" />
<entry key="modules/mogo-module-hmi/src/main/res/layout/fragment_warning.xml" value="0.34427083333333336" />
<entry key="modules/mogo-module-hmi/src/main/res/layout/module_hmi_warning_v2x.xml" value="0.246875" />
<entry key="modules/mogo-module-hmi/src/main/res/layout/notification_v2x_msg_vr.xml" value="0.3453125" />
<entry key="modules/mogo-module-hmi/src/main/res/layout/view_traffic_light_vr.xml" value="1.25" />
<entry key="modules/mogo-module-left-panel/src/main/res/layout/module_left_panel_simple_speed.xml" value="0.28854166666666664" />
<entry key="modules/mogo-module-main/src/main/res/drawable-xhdpi/module_main_warning_bkg_bottom.xml" value="0.359375" />
<entry key="modules/mogo-module-main/src/main/res/drawable-xhdpi/module_main_warning_bkg_left.xml" value="0.359375" />
<entry key="modules/mogo-module-main/src/main/res/drawable-xhdpi/module_main_warning_bkg_right.xml" value="0.359375" />
<entry key="modules/mogo-module-main/src/main/res/drawable-xhdpi/module_main_warning_bkg_top.xml" value="0.33" />
<entry key="modules/mogo-module-hmi/src/main/res/layout/view_traffic_light_vr.xml" value="0.25" />
<entry key="modules/mogo-module-main/src/main/res/layout/module_main_activity_main.xml" value="0.3125" />
<entry key="modules/mogo-module-main/src/main/res/layout/module_main_activity_main_no_map.xml" value="0.33645833333333336" />
<entry key="modules/mogo-module-map/src/main/res/layout/module_map_fragment_map.xml" value="0.17864583333333334" />
<entry key="modules/mogo-module-search/src/main/res/layout/fragment_navi_setting.xml" value="0.315625" />
<entry key="modules/mogo-module-service/src/main/res/drawable/bg_adas_dispatch.xml" value="0.184" />
<entry key="modules/mogo-module-service/src/main/res/drawable/bg_adas_dispatch_affirm.xml" value="0.19166666666666668" />
<entry key="modules/mogo-module-service/src/main/res/drawable/bg_map_marker_blue_info.xml" value="0.184" />
@@ -56,41 +28,10 @@
<entry key="modules/mogo-module-service/src/main/res/layout/module_dialog_adas_dispatch_cars.xml" value="0.5546876453218006" />
<entry key="modules/mogo-module-service/src/main/res/layout/module_dialog_adas_dispatch_remind.xml" value="0.35734252929687504" />
<entry key="modules/mogo-module-service/src/main/res/layout/module_services_fragment_online_car_panel.xml" value="0.28919677734374993" />
<entry key="modules/mogo-module-share/src/main/res/layout/launcher_dialog_share.xml" value="0.25416666666666665" />
<entry key="modules/mogo-module-smp/src/main/res/layout/module_small_map_view.xml" value="0.3338541666666667" />
<entry key="modules/mogo-module-v2x/src/main/res/drawable/bg_live_video.xml" value="0.1" />
<entry key="modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_cancel_help.xml" value="0.2421875" />
<entry key="modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_surrounding_item.xml" value="0.1" />
<entry key="modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_surrounding_item_bottom.xml" value="0.1" />
<entry key="modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_blue.xml" value="0.1390625" />
<entry key="modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_orange.xml" value="0.1359375" />
<entry key="modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_orange_vr.xml" value="0.1359375" />
<entry key="modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_read.xml" value="0.2421875" />
<entry key="modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_red_vr.xml" value="0.2421875" />
<entry key="modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_surrounding_road_type.xml" value="0.1" />
<entry key="modules/mogo-module-v2x/src/main/res/drawable/bgg_v2x_event_eva.xml" value="0.1" />
<entry key="modules/mogo-module-v2x/src/main/res/drawable/selector_zan_btn.xml" value="0.1" />
<entry key="modules/mogo-module-v2x/src/main/res/drawable/v2x_cover_bg.xml" value="0.1" />
<entry key="modules/mogo-module-v2x/src/main/res/drawable/v2x_event_type_title_bg.xml" value="0.1" />
<entry key="modules/mogo-module-v2x/src/main/res/drawable/v2x_fault_help_bg.xml" value="0.1" />
<entry key="modules/mogo-module-v2x/src/main/res/drawable/v2x_fault_help_title_bg.xml" value="0.1" />
<entry key="modules/mogo-module-v2x/src/main/res/drawable/v2x_feedback_bg.xml" value="0.1" />
<entry key="modules/mogo-module-v2x/src/main/res/drawable/v2x_gas_station_title_bg.xml" value="0.1" />
<entry key="modules/mogo-module-v2x/src/main/res/drawable/v2x_help_btn_cancel_bg.xml" value="0.1" />
<entry key="modules/mogo-module-v2x/src/main/res/drawable/v2x_help_btn_ok_bg.xml" value="0.1" />
<entry key="modules/mogo-module-v2x/src/main/res/drawable/v2x_help_info_speed_bg.xml" value="0.1" />
<entry key="modules/mogo-module-v2x/src/main/res/drawable/v2x_help_info_title_bg.xml" value="0.1" />
<entry key="modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail_stub_live.xml" value="0.1" />
<entry key="modules/mogo-module-v2x/src/main/res/layout/item_v2x_fatigue_driving_vr.xml" value="0.1" />
<entry key="modules/mogo-module-v2x/src/main/res/layout/view_marker_event_car_vr.xml" value="0.1" />
<entry key="modules/mogo-module-v2x/src/main/res/layout/window_prejected_road_event_detail.xml" value="0.1" />
<entry key="modules/mogo-module-v2x/src/main/res/layout/window_simple_obu_event_detail.xml" value="0.1" />
<entry key="modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml" value="0.1" />
<entry key="modules/mogo-module-widgets/src/main/res/layout/module_widgets_app_entrance.xml" value="0.2838541666666667" />
</map>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
</project>

View File

@@ -99,6 +99,7 @@ ext {
modulemainindependent : "com.mogo.module:module-main-independent:${MOGO_MODULE_MAIN_INDEPENDENT_VERSION}",
modulemap : "com.mogo.module:module-map:${MOGO_MODULE_MAP_VERSION}",
moduleservice : "com.mogo.module:module-service:${MOGO_MODULE_SERVICE_VERSION}",
moduledata : "com.mogo.module:module-data:${MOGO_MODULE_DATA_VERSION}",
mogoservice : "com.mogo.service:mogo-service:${MOGO_SERVICE_VERSION}",
mogoserviceapi : "com.mogo.service:mogo-service-api:${MOGO_SERVICE_API_VERSION}",
moduleapps : "com.mogo.module:module-apps:${MOGO_MODULE_APPS_VERSION}",

View File

@@ -68,6 +68,7 @@ MOGO_MODULE_COMMON_VERSION=2.0.58
MOGO_MODULE_MAIN_VERSION=2.0.58
MOGO_MODULE_MAP_VERSION=2.0.58
MOGO_MODULE_SERVICE_VERSION=2.0.58
MOGO_MODULE_DATA_VERSION=2.0.58
MOGO_MODULE_EXTENSIONS_VERSION=2.0.58
MOGO_MODULE_SEARCH_VERSION=2.0.58
MOGO_MODULE_BACK_VERSION=2.0.58

View File

@@ -190,44 +190,44 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
mWarningLeft.setVisibility(View.GONE);
mWarningRight.setVisibility(View.GONE);
mWarningBottom.setVisibility(View.GONE);
// startCountDownWithView(mWarningTop);
startCountDownWithView(mWarningTop);
break;
case ALERT_THE_FRONT_CRASH_WARNING_LEFT:
mWarningLeft.setVisibility(View.VISIBLE);
mWarningTop.setVisibility(View.GONE);
mWarningRight.setVisibility(View.GONE);
mWarningBottom.setVisibility(View.GONE);
// startCountDownWithView(mWarningLeft);
startCountDownWithView(mWarningLeft);
break;
case ALERT_THE_FRONT_CRASH_WARNING_RIGHT:
mWarningRight.setVisibility(View.VISIBLE);
mWarningTop.setVisibility(View.GONE);
mWarningLeft.setVisibility(View.GONE);
mWarningBottom.setVisibility(View.GONE);
// startCountDownWithView(mWarningRight);
startCountDownWithView(mWarningRight);
break;
case ALERT_THE_FRONT_CRASH_WARNING_BOTTOM:
mWarningBottom.setVisibility(View.VISIBLE);
mWarningRight.setVisibility(View.GONE);
mWarningTop.setVisibility(View.GONE);
mWarningLeft.setVisibility(View.GONE);
// startCountDownWithView(mWarningBottom);
startCountDownWithView(mWarningBottom);
break;
case ALERT_THE_FRONT_CRASH_WARNING_BOTTOM_LEFT:
mWarningBottom.setVisibility(View.VISIBLE);
mWarningRight.setVisibility(View.GONE);
mWarningTop.setVisibility(View.GONE);
mWarningLeft.setVisibility(View.VISIBLE);
// startCountDownWithView(mWarningBottom);
// startCountDownWithView(mWarningLeft);
startCountDownWithView(mWarningBottom);
startCountDownWithView(mWarningLeft);
break;
case ALERT_THE_FRONT_CRASH_WARNING_BOTTOM_RIGHT:
mWarningBottom.setVisibility(View.VISIBLE);
mWarningRight.setVisibility(View.VISIBLE);
mWarningTop.setVisibility(View.GONE);
mWarningLeft.setVisibility(View.GONE);
// startCountDownWithView(mWarningBottom);
// startCountDownWithView(mWarningRight);
startCountDownWithView(mWarningBottom);
startCountDownWithView(mWarningRight);
break;
default:
break;

View File

@@ -1,3 +1,4 @@
:modules:mogo-module-data
:foudations:mogo-utils
:skin:mogo-skin-support
:tts:tts-base

View File

@@ -54,10 +54,12 @@ dependencies {
api rootProject.ext.dependencies.mogoutils
api rootProject.ext.dependencies.mogoserviceapi
implementation rootProject.ext.dependencies.modulecommon
implementation rootProject.ext.dependencies.moduledata
} else {
api project(":foudations:mogo-utils")
api project(':services:mogo-service-api')
implementation project(':modules:mogo-module-common')
implementation project(':modules:mogo-module-data')
}
implementation rootProject.ext.dependencies.mogoobu

View File

@@ -7,6 +7,7 @@ import com.mogo.commons.voice.AIAssist
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter
import com.mogo.module.common.drawer.TrafficMarkerDrawer
import com.mogo.module.common.enums.EventTypeEnum
import com.mogo.module.data.enums.WarningDirectionEnum
import com.mogo.module.obu.mogo.utils.TrafficDataConvertUtils
import com.mogo.service.IMogoServiceApis
import com.mogo.service.MogoServicePaths
@@ -164,8 +165,8 @@ class MogoPrivateObuManager private constructor() {
val status = info.status
val level = info.threat_info.threat_level
val direction =
getOtherObjDirection(if (info.ext_info != null) info.ext_info.pos_classification else 7)
when (info.threat_info.app_id.toString()) {
getMessageDirection(if (info.ext_info != null) info.ext_info.pos_classification else -1)
when (appId) {
// 道路危险情况预警
EventTypeEnum.TYPE_USECASE_ID_HLW.poiType -> {
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxRtiThreatIndInfo appId = ${info.threat_info.app_id} --status = $status --level = $level -- handleDirection = $direction --rtiType = ${info.ext_info.rti_type}")
@@ -174,11 +175,15 @@ class MogoPrivateObuManager private constructor() {
0x2 -> {
// 特殊处理左、右方向的
when (direction) {
3 -> {
WarningDirectionEnum.ALERT_WARNING_LEFT,
WarningDirectionEnum.ALERT_WARNING_TOP_LEFT,
WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT -> {
appId =
EventTypeEnum.TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP.poiType
}
4 -> {
WarningDirectionEnum.ALERT_WARNING_RIGHT,
WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT,
WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT -> {
appId =
EventTypeEnum.TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP.poiType
}
@@ -242,9 +247,7 @@ class MogoPrivateObuManager private constructor() {
// 添加
ObuConstants.STATUS.ADD -> {
//显示警告红边
mMogoServiceApis!!.v2XListenerManager.warningChangedForListenerWithDirection(
direction, "ACTION_V2X_FRONT_WARNING"
)
mIMoGoWaringProvider!!.showWarning(direction)
//显示弹框,语音提示
mIMoGoWaringProvider!!.showWarningV2X(
appId.toInt(),
@@ -259,10 +262,8 @@ class MogoPrivateObuManager private constructor() {
}
// 删除
ObuConstants.STATUS.DELETE -> {
//关闭警告红边
mMogoServiceApis!!.v2XListenerManager.warningChangedForListenerWithDirection(
0, "ACTION_V2X_FRONT_WARNING"
)
// 关闭警告红边
mIMoGoWaringProvider!!.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
// 移除顶部弹窗
mIMoGoWaringProvider?.disableWarningV2X(appId)
// 更新数据
@@ -275,9 +276,7 @@ class MogoPrivateObuManager private constructor() {
// 更新
else -> {
//显示警告红边
mMogoServiceApis!!.v2XListenerManager.warningChangedForListenerWithDirection(
direction, "ACTION_V2X_FRONT_WARNING"
)
mIMoGoWaringProvider!!.showWarning(direction)
// 更新数据
TrafficDataConvertUtils.cvxRtiThreatIndInfo2TrafficData(info)?.let {
TrafficMarkerDrawer.updateITrafficInfo(it)
@@ -322,6 +321,17 @@ class MogoPrivateObuManager private constructor() {
MogoObuConst.TAG_MOGO_OBU,
"onCvxPtcInfoIndInfo ---status---> ${info.status}"
)
var v2xType = ""
if (info.ptc_type == 1) { //摩托车
v2xType = EventTypeEnum.TYPE_USECASE_ID_VRUCW_MOTORBIKE.poiType
} else if (info.ptc_type == 2) { //行人
v2xType = EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.poiType
}
val ttsContent = EventTypeEnum.getWarningTts(v2xType)
val alertContent = EventTypeEnum.getWarningContent(v2xType)
val direction =
getMessageDirection(if (info.ext_info != null) info.ext_info.target_classification else -1)
when (info.status) {
// 添加
ObuConstants.STATUS.ADD -> {
@@ -329,21 +339,8 @@ class MogoPrivateObuManager private constructor() {
TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(info)?.let {
TrafficMarkerDrawer.updateITrafficInfo(it)
}
var v2xType = ""
if (info.ptc_type == 1) { //摩托车
v2xType = EventTypeEnum.TYPE_USECASE_ID_VRUCW_MOTORBIKE.poiType
} else if (info.ptc_type == 2) { //行人
v2xType = EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.poiType
}
val ttsContent = EventTypeEnum.getWarningTts(v2xType)
val alertContent = EventTypeEnum.getWarningContent(v2xType)
val direction = 1
//getOtherObjDirection(if (info.ext_info != null) info.ext_info.target_classification else 7)
//显示警告红边
mMogoServiceApis!!.v2XListenerManager.warningChangedForListenerWithDirection(
direction, "ACTION_V2X_FRONT_WARNING"
)
mIMoGoWaringProvider!!.showWarning(direction)
mIMoGoWaringProvider!!.showWarningV2X(
v2xType.toInt(),
alertContent,
@@ -353,10 +350,8 @@ class MogoPrivateObuManager private constructor() {
}
// 删除
ObuConstants.STATUS.DELETE -> {
//关闭警告红边
mMogoServiceApis!!.v2XListenerManager.warningChangedForListenerWithDirection(
0, "ACTION_V2X_FRONT_WARNING"
)
// 关闭警告红边
mIMoGoWaringProvider!!.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
// 更新数据
TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(info)?.let {
// 事件结束,还原交通参与者颜色
@@ -367,12 +362,8 @@ class MogoPrivateObuManager private constructor() {
}
// 更新
else -> {
val direction = 1
//显示警告红边
mMogoServiceApis!!.v2XListenerManager.warningChangedForListenerWithDirection(
direction,
"ACTION_V2X_FRONT_WARNING"
)
// 显示警告红边
mIMoGoWaringProvider!!.showWarning(direction)
// 更新数据
TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(info)?.let {
TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
@@ -437,51 +428,43 @@ class MogoPrivateObuManager private constructor() {
/**
* 获取消息的方位 车辆相关
*/
private fun getMessageDirection(targetClassification: Int): Int {
private fun getMessageDirection(targetClassification: Int): WarningDirectionEnum {
Logger.d(MogoObuConst.TAG_MOGO_OBU, "预警红边:预警方向->$targetClassification")
return when (targetClassification) {
ObuConstants.TARGET_CLASSIFICATION.TC_ONCOMING_IN_LANE,
ObuConstants.TARGET_CLASSIFICATION.TC_AHEAD_IN_LANE -> 1 //正前方
ObuConstants.TARGET_CLASSIFICATION.TC_AHEAD_IN_LANE,
0x04 -> WarningDirectionEnum.ALERT_WARNING_TOP //正前方
ObuConstants.TARGET_CLASSIFICATION.TC_BEHIND_IN_LANE -> 2 //正
0x03 -> WarningDirectionEnum.ALERT_WARNING_RIGHT //正
ObuConstants.TARGET_CLASSIFICATION.TC_BEHIND_IN_LANE,
0x05 -> WarningDirectionEnum.ALERT_WARNING_BOTTOM //正后方
0x02 -> WarningDirectionEnum.ALERT_WARNING_RIGHT //正左方
ObuConstants.TARGET_CLASSIFICATION.TC_AHEAD_LEFT,
ObuConstants.TARGET_CLASSIFICATION.TC_AHEAD_FAR_LEFT,
ObuConstants.TARGET_CLASSIFICATION.TC_ONCOMING_LEFT,
ObuConstants.TARGET_CLASSIFICATION.TC_ONCOMING_FAR_LEFT,
ObuConstants.TARGET_CLASSIFICATION.TC_INTERSECTION_LEFT -> 3 //左前方
ObuConstants.TARGET_CLASSIFICATION.TC_INTERSECTION_LEFT -> WarningDirectionEnum.ALERT_WARNING_TOP_LEFT //左前方
ObuConstants.TARGET_CLASSIFICATION.TC_ONCOMING_FAR_RIGHT,
ObuConstants.TARGET_CLASSIFICATION.TC_AHEAD_FAR_RIGHT,
ObuConstants.TARGET_CLASSIFICATION.TC_AHEAD_RIGHT,
ObuConstants.TARGET_CLASSIFICATION.TC_INTERSECTION_RIGHT,
ObuConstants.TARGET_CLASSIFICATION.TC_ONCOMING_RIGHT -> 4 //右前方
ObuConstants.TARGET_CLASSIFICATION.TC_ONCOMING_RIGHT -> WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT //右前方
ObuConstants.TARGET_CLASSIFICATION.TC_BEHIND_LEFT,
ObuConstants.TARGET_CLASSIFICATION.TC_BEHIND_FAR_LEFT -> 5 //左后方 弹框目前后方分为左后,右后,正后方
ObuConstants.TARGET_CLASSIFICATION.TC_BEHIND_FAR_LEFT -> WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT //左后方
ObuConstants.TARGET_CLASSIFICATION.TC_BEHIND_RIGHT,
ObuConstants.TARGET_CLASSIFICATION.TC_BEHIND_FAR_RIGHT -> 6 //右后方
ObuConstants.TARGET_CLASSIFICATION.TC_BEHIND_FAR_RIGHT -> WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT //右后方
ObuConstants.TARGET_CLASSIFICATION.TC_UNCLASSIFIED -> -1 //未知
else -> 0
ObuConstants.TARGET_CLASSIFICATION.TC_UNCLASSIFIED -> WarningDirectionEnum.ALERT_WARNING_NON //未知
else -> WarningDirectionEnum.ALERT_WARNING_ALL
}
}
/**
* 获取道路其他 的方位
*/
private fun getOtherObjDirection(posClassification: Int): Int {
return when (posClassification) {
0x01 -> 0 //事件中
0x02 -> 3 //左侧
0x03 -> 4 //右侧
0x04 -> 1 //前方
0x05 -> 2 //后方
else -> 7
}
}
fun release() {
MogoObuManager.getInstance().unregisterListener()
}
@@ -532,10 +515,7 @@ class MogoPrivateObuManager private constructor() {
// 红灯
0x1 -> {
//显示警告红边
mMogoServiceApis!!.v2XListenerManager.warningChangedForListenerWithDirection(
1,
"ACTION_V2X_FRONT_WARNING"
)
mIMoGoWaringProvider?.showWarning(WarningDirectionEnum.ALERT_WARNING_ALL)
mIMoGoWaringProvider?.showWarningTrafficLight(1)
mIMoGoWaringProvider?.changeCountdownRed(currentLight.count_down.toInt())
ttsContent = EventTypeEnum.getWarningTts(appId.toString())
@@ -599,7 +579,7 @@ class MogoPrivateObuManager private constructor() {
*/
private fun handleSdkObu(
appId: Int,
direction: Int,
direction: WarningDirectionEnum,
status: Int,
level: Int,
info: CvxV2vThreatIndInfo
@@ -614,12 +594,20 @@ class MogoPrivateObuManager private constructor() {
when (appId.toString()) {
// 变道预警,注意左后车辆/注意右后车辆
EventTypeEnum.TYPE_USECASE_ID_LCW.poiType -> {
alertContent = EventTypeEnum.getWarningContent(appId.toString())
ttsContent = EventTypeEnum.getWarningTts(appId.toString())
if (direction == 5) {
alertContent = EventTypeEnum.getWarningContent(appId)
ttsContent = EventTypeEnum.getWarningTts(appId)
if (
direction == WarningDirectionEnum.ALERT_WARNING_LEFT ||
direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT ||
direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT
) {
ttsContent = String.format(ttsContent, "")
alertContent = String.format(alertContent, "")
} else if (direction == 6) {
} else if (
direction == WarningDirectionEnum.ALERT_WARNING_RIGHT ||
direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT ||
direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT
) {
ttsContent = String.format(ttsContent, "")
alertContent = String.format(alertContent, "")
}
@@ -644,11 +632,19 @@ class MogoPrivateObuManager private constructor() {
//左转辅助
EventTypeEnum.TYPE_USECASE_ID_LTA.poiType -> {
alertContent = EventTypeEnum.getWarningContent(appId.toString())
ttsContent = EventTypeEnum.getWarningTts(appId.toString())
if (direction == 5) {
alertContent = EventTypeEnum.getWarningContent(appId)
ttsContent = EventTypeEnum.getWarningTts(appId)
if (
direction == WarningDirectionEnum.ALERT_WARNING_LEFT ||
direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT ||
direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT
) {
ttsContent = String.format(ttsContent, "")
} else if (direction == 6) {
} else if (
direction == WarningDirectionEnum.ALERT_WARNING_RIGHT ||
direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT ||
direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT
) {
ttsContent = String.format(ttsContent, "")
}
}
@@ -672,12 +668,20 @@ class MogoPrivateObuManager private constructor() {
//盲区预警
EventTypeEnum.TYPE_USECASE_ID_BSW.poiType -> {
ttsContent = EventTypeEnum.getWarningTts(appId.toString())
alertContent = EventTypeEnum.getWarningContent(appId.toString())
if (direction == 5) { //左后
ttsContent = EventTypeEnum.getWarningTts(appId)
alertContent = EventTypeEnum.getWarningContent(appId)
if (
direction == WarningDirectionEnum.ALERT_WARNING_LEFT ||
direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT ||
direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT
) { //左后
ttsContent = String.format(ttsContent, "")
alertContent = String.format(alertContent, "")
} else if (direction == 6) { //右后
} else if (
direction == WarningDirectionEnum.ALERT_WARNING_RIGHT ||
direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT ||
direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT
) { //右后
ttsContent = String.format(ttsContent, "")
alertContent = String.format(alertContent, "")
}
@@ -693,17 +697,14 @@ class MogoPrivateObuManager private constructor() {
when (status) {
// 添加, add的时候可能级别是2
ObuConstants.STATUS.ADD -> {
//显示警告红边
mMogoServiceApis!!.v2XListenerManager.warningChangedForListenerWithDirection(
direction,
"ACTION_V2X_FRONT_WARNING"
)
//显示弹框,语音提示
Log.d(
MogoObuConst.TAG_MOGO_OBU,
"appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction"
)
mIMoGoWaringProvider!!.showWarningV2X(
//显示警告红边
mIMoGoWaringProvider?.showWarning(direction)
//显示弹框,语音提示
mIMoGoWaringProvider?.showWarningV2X(
appId,
alertContent,
if (level == 3) ttsContent else "",
@@ -720,10 +721,8 @@ class MogoPrivateObuManager private constructor() {
// 删除
ObuConstants.STATUS.DELETE -> {
isStrikeTts = false
//关闭警告红边
mMogoServiceApis!!.v2XListenerManager.warningChangedForListenerWithDirection(
0, "ACTION_V2X_FRONT_WARNING"
)
// 关闭警告红边
mIMoGoWaringProvider!!.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
// 移除顶部弹窗
mIMoGoWaringProvider?.disableWarningV2X(appId.toString())
//更新周边车辆进行预警颜色变换,车辆实时移动和变色
@@ -735,9 +734,7 @@ class MogoPrivateObuManager private constructor() {
// 更新
else -> {
//显示警告红边
mMogoServiceApis!!.v2XListenerManager.warningChangedForListenerWithDirection(
direction, "ACTION_V2X_FRONT_WARNING"
)
mIMoGoWaringProvider?.showWarning(direction)
if (!isStrikeTts) {
AIAssist.getInstance(mContext).speakTTSVoice(ttsContent)
isStrikeTts = true

View File

@@ -64,3 +64,4 @@ include ':OCH:mogo-och-noop'
include ':OCH:mogo-och'
include ':modules:mogo-module-obu-mogo'
include ':modules:mogo-module-hmi'
include ':modules:mogo-module-data'