diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
index 3e80c76c4a..f791d7dd12 100644
--- a/.idea/codeStyles/Project.xml
+++ b/.idea/codeStyles/Project.xml
@@ -7,6 +7,9 @@
+
+
+
diff --git a/README.md b/README.md
index 9b28fa66b6..5fd1a290e3 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,19 @@ adb remount
adb shell
// (新的HMI)使用命令行触发 V2X 预警场景
-adb shell am broadcast -a com.v2x.control --ei warningType 2
+// 顶部弹窗场景,控制展示
+adb shell am broadcast -a com.hmi.v2x.notification --ez v2xIsShow true --es tag "20008" --ei v2xType 20008 --es alertContent "测试外部传入数据" --es ttsContent "测试TTS"
+// 关闭顶部弹窗
+adb shell am broadcast -a com.hmi.v2x.notification --ez v2xIsShow false --es tag "20008"
+
+// 控制红绿灯
+adb shell am broadcast -a com.hmi.v2x.trafficlight --ez trafficLightIsShow true --ei trafficLightCheckType 1
+adb shell am broadcast -a com.hmi.v2x.trafficlight --ez trafficLightIsShow false
+
+// 控制红绿灯
+adb shell am broadcast -a com.hmi.v2x.limitingvelocity --ez limitingVelocityIsShow true --ei limitingVelocitySpeed 60
+adb shell am broadcast -a com.hmi.v2x.limitingvelocity --ez limitingVelocityIsShow false
+
// (旧版本)使用命令行触发各种测试场景演示
adb shell am broadcast -a com.v2x.test_panel_control --ei sceneType 1
diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/enum/WarningTypeEnum.kt b/modules/mogo-module-common/src/main/java/com/mogo/module/common/enum/WarningTypeEnum.kt
index fbc1f5fc8d..643e3c9fe4 100644
--- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/enum/WarningTypeEnum.kt
+++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/enum/WarningTypeEnum.kt
@@ -24,23 +24,19 @@ interface WarningTypeEnum {
const val warning_congestion = 20012//前方道路拥堵
const val WARNING_TRAFFIC_SPEED_GUIDE = 20013//绿波通行车速引导
const val WARNING_CAR_PLATE = 20014//车内标牌
-
const val WARNING_VULNERABLE_TRANSPORT_PARTICIPANT = 20015//弱势交通参与者预警
-
-
const val WARNING_ROAD_HAZARDS = 20016//道路危险情况预警
-
const val WARNING_OVER_SPEED = 20017//超速预警
- const val WARNING_ROUNDABOUT = 20019//环岛
- const val WARNING_GIVE_WAY = 20020//减速让行
- const val WARNING_BAN_ASTERN = 20021//禁止倒车
- const val WARNING_TURN_LEFT_SHARP = 20022//左转急弯
- const val WARNING_TURN_RIGHT_SHARP = 20023//左转急弯
- const val WARNING_TRAMCAR = 20024//有轨电车
- const val WARNING_TEST_SECTION = 20025//考试路段
- const val WARNING_ACCIDENT_PRONE_ROAD_SECTION = 20026//事故易发路段
- const val WARNING_HUMP_BRIDGE = 20027//驼峰桥
- const val WARNING_SCHOOL = 20028// 学校
+ const val WARNING_ROUNDABOUT = 20018//环岛
+ const val WARNING_GIVE_WAY = 20019//减速让行
+ const val WARNING_BAN_ASTERN = 20020//禁止倒车
+ const val WARNING_TURN_LEFT_SHARP = 20021//左转急弯
+ const val WARNING_TURN_RIGHT_SHARP = 20022//左转急弯
+ const val WARNING_TRAMCAR = 20023//有轨电车
+ const val WARNING_TEST_SECTION = 20024//考试路段
+ const val WARNING_ACCIDENT_PRONE_ROAD_SECTION = 20025//事故易发路段
+ const val WARNING_HUMP_BRIDGE = 20026//驼峰桥
+ const val WARNING_SCHOOL = 20027// 学校
}
}
\ No newline at end of file
diff --git a/modules/mogo-module-hmi/src/main/AndroidManifest.xml b/modules/mogo-module-hmi/src/main/AndroidManifest.xml
index 234bee657e..98bb120cb0 100644
--- a/modules/mogo-module-hmi/src/main/AndroidManifest.xml
+++ b/modules/mogo-module-hmi/src/main/AndroidManifest.xml
@@ -4,9 +4,25 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/WaringConst.java b/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/WaringConst.java
index 03308b9d9c..9fcef93ae8 100644
--- a/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/WaringConst.java
+++ b/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/WaringConst.java
@@ -7,10 +7,28 @@ package com.mogo.module.hmi;
public class WaringConst {
public static String MODULE_NAME = "MODULE_LEFT_PANEL";
+ // V2X 弹窗预警
+ // 是否展示:true-展示,false-关闭
public static String BROADCAST_V2X_IS_SHOW_EXTRA_KEY = "v2xIsShow";
+ // 预警类型:@WarningTypeEnum
public static String BROADCAST_V2X_TYPE_EXTRA_KEY = "v2xType";
+ // 预警弹窗文字内容
public static String BROADCAST_V2X_ALERT_CONTENT_EXTRA_KEY = "alertContent";
+ // 预警弹窗TTS播报
public static String BROADCAST_V2X_TTS_CONTENT_EXTRA_KEY = "ttsContent";
+ // 弹窗标志,一个弹窗绑定一个标志,不可重复
public static String BROADCAST_V2X_TAG_EXTRA_KEY = "tag";
+ // 交通的灯
+ // 是否展示:true-展示,false-关闭
+ public static String BROADCAST_V2X_TRAFFIC_LIGHT_IS_SHOW__EXTRA_KEY = "trafficLightIsShow";
+ // 选中的交通等类型,red、yellow、green
+ public static String BROADCAST_V2X_TRAFFIC_LIGHT_CHECK_TYPE_EXTRA_KEY = "trafficLightCheckType";
+
+ // 限速标志
+ // 是否展示:true-展示,false-关闭
+ public static String BROADCAST_V2X_LIMITING_VELOCITY_IS_SHOW__EXTRA_KEY = "limitingVelocityIsShow";
+ // 限速的速度
+ public static String BROADCAST_V2X_LIMITING_VELOCITY_SPEED__EXTRA_KEY = "limitingVelocitySpeed";
+
}
diff --git a/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/receiver/V2XLimitingVelocityBroadcastReceiver.kt b/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/receiver/V2XLimitingVelocityBroadcastReceiver.kt
new file mode 100644
index 0000000000..b992e24502
--- /dev/null
+++ b/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/receiver/V2XLimitingVelocityBroadcastReceiver.kt
@@ -0,0 +1,76 @@
+package com.mogo.module.hmi.receiver
+
+import android.content.BroadcastReceiver
+import android.content.Context
+import android.content.Intent
+import com.alibaba.android.arouter.launcher.ARouter
+import com.mogo.module.hmi.WaringConst
+import com.mogo.service.IMogoServiceApis
+import com.mogo.service.MogoServicePaths
+import com.mogo.service.warning.IMoGoWaringProvider
+import com.mogo.utils.logger.Logger
+
+/**
+ * V2X 预警广播接收。用于跨应用,跨进程,内部也可以通过这种方式 控制限速标志
+ *
+ * @author donghongyu
+ */
+class V2XLimitingVelocityBroadcastReceiver : BroadcastReceiver() {
+ private var mContext: Context? = null
+
+ companion object {
+ private const val TAG = "V2XLimitingVelocityBroadcastReceiver"
+ private var mMogoServiceApis: IMogoServiceApis? = null
+ private var mIMoGoWaringProvider: IMoGoWaringProvider? = null
+ }
+
+ override fun onReceive(context: Context, intent: Intent) {
+ try {
+ mMogoServiceApis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS)
+ .navigation(context) as IMogoServiceApis
+ mIMoGoWaringProvider = mMogoServiceApis!!.waringProviderApi
+ mContext = context
+
+ val limitingVelocityIsShow =
+ intent.getBooleanExtra(
+ WaringConst.BROADCAST_V2X_LIMITING_VELOCITY_IS_SHOW__EXTRA_KEY,
+ false
+ )
+ val limitingVelocitySpeed =
+ intent.getIntExtra(
+ WaringConst.BROADCAST_V2X_LIMITING_VELOCITY_SPEED__EXTRA_KEY,
+ 0
+ )
+
+ Logger.d(
+ TAG,
+ "limitingVelocityIsShow:$limitingVelocityIsShow limitingVelocitySpeed:$limitingVelocitySpeed"
+ )
+ if (limitingVelocityIsShow) {
+ // 分发场景
+ dispatchShowWaring(limitingVelocitySpeed)
+ } else {
+ dispatchCloseWaring()
+ }
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
+ }
+
+
+ /**
+ * 展示限速标志
+ *
+ * @param limitingVelocitySpeed 限速速度
+ */
+ private fun dispatchShowWaring(limitingVelocitySpeed: Int) {
+ mIMoGoWaringProvider!!.showLimitingVelocity(limitingVelocitySpeed)
+ }
+
+ /**
+ * 关闭限速标志
+ */
+ private fun dispatchCloseWaring() {
+ mIMoGoWaringProvider!!.disableLimitingVelocity()
+ }
+}
\ No newline at end of file
diff --git a/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/receiver/V2XTrafficLightBroadcastReceiver.kt b/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/receiver/V2XTrafficLightBroadcastReceiver.kt
new file mode 100644
index 0000000000..73ae60570b
--- /dev/null
+++ b/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/receiver/V2XTrafficLightBroadcastReceiver.kt
@@ -0,0 +1,76 @@
+package com.mogo.module.hmi.receiver
+
+import android.content.BroadcastReceiver
+import android.content.Context
+import android.content.Intent
+import com.alibaba.android.arouter.launcher.ARouter
+import com.mogo.module.hmi.WaringConst
+import com.mogo.service.IMogoServiceApis
+import com.mogo.service.MogoServicePaths
+import com.mogo.service.warning.IMoGoWaringProvider
+import com.mogo.utils.logger.Logger
+
+/**
+ * V2X 预警广播接收。用于跨应用,跨进程,内部也可以通过这种方式 触发红绿灯场景
+ *
+ * @author donghongyu
+ */
+class V2XTrafficLightBroadcastReceiver : BroadcastReceiver() {
+ private var mContext: Context? = null
+
+ companion object {
+ private const val TAG = "V2XTrafficLightBroadcastReceiver"
+ private var mMogoServiceApis: IMogoServiceApis? = null
+ private var mIMoGoWaringProvider: IMoGoWaringProvider? = null
+ }
+
+ override fun onReceive(context: Context, intent: Intent) {
+ try {
+ mMogoServiceApis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS)
+ .navigation(context) as IMogoServiceApis
+ mIMoGoWaringProvider = mMogoServiceApis!!.waringProviderApi
+ mContext = context
+
+ val trafficLightIsShow =
+ intent.getBooleanExtra(
+ WaringConst.BROADCAST_V2X_TRAFFIC_LIGHT_IS_SHOW__EXTRA_KEY,
+ false
+ )
+ val trafficLightCheckType =
+ intent.getIntExtra(
+ WaringConst.BROADCAST_V2X_TRAFFIC_LIGHT_CHECK_TYPE_EXTRA_KEY,
+ 0
+ )
+
+ Logger.d(
+ TAG,
+ "trafficLightIsShow:$trafficLightIsShow trafficLightCheckType:$trafficLightCheckType"
+ )
+ if (trafficLightIsShow) {
+ // 分发场景
+ dispatchShowWaring(trafficLightCheckType)
+ } else {
+ dispatchCloseWaring()
+ }
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
+ }
+
+
+ /**
+ * 展示交通灯
+ *
+ * @param trafficLightCheckType 选中的交通的灯 0-都是默认,1-红,2-黄,3-绿
+ */
+ private fun dispatchShowWaring(trafficLightCheckType: Int) {
+ mIMoGoWaringProvider!!.showWarningTrafficLight(trafficLightCheckType)
+ }
+
+ /**
+ * 关闭交通灯
+ */
+ private fun dispatchCloseWaring() {
+ mIMoGoWaringProvider!!.disableWarningTrafficLight()
+ }
+}
\ No newline at end of file
diff --git a/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/receiver/WarningBroadcastReceiver.kt b/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/receiver/V2XWarningBroadcastReceiver.kt
similarity index 90%
rename from modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/receiver/WarningBroadcastReceiver.kt
rename to modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/receiver/V2XWarningBroadcastReceiver.kt
index 49c62b8796..4ee2f44b1f 100644
--- a/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/receiver/WarningBroadcastReceiver.kt
+++ b/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/receiver/V2XWarningBroadcastReceiver.kt
@@ -4,6 +4,7 @@ import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.alibaba.android.arouter.launcher.ARouter
+import com.mogo.module.common.enum.WarningTypeEnum
import com.mogo.module.hmi.WaringConst
import com.mogo.service.IMogoServiceApis
import com.mogo.service.MogoServicePaths
@@ -15,11 +16,11 @@ import com.mogo.utils.logger.Logger
*
* @author donghongyu
*/
-class WarningBroadcastReceiver : BroadcastReceiver() {
+class V2XWarningBroadcastReceiver : BroadcastReceiver() {
private var mContext: Context? = null
companion object {
- private const val TAG = "TestPanelBroadcastReceiver"
+ private const val TAG = "V2XWarningBroadcastReceiver"
private var mMogoServiceApis: IMogoServiceApis? = null
private var mIMoGoWaringProvider: IMoGoWaringProvider? = null
}
@@ -78,6 +79,9 @@ class WarningBroadcastReceiver : BroadcastReceiver() {
ttsContent: String?,
tag: String?
) {
+ if (v2xType == WarningTypeEnum.WARNING_RED_LIGHT) {
+ mIMoGoWaringProvider!!.showLimitingVelocity(1)
+ }
mIMoGoWaringProvider!!.showWarningV2X(
v2xType,
alertContent,
diff --git a/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/ui/MoGoWarningFragment.kt b/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/ui/MoGoWarningFragment.kt
index e2029091f5..66a77ce8f0 100644
--- a/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/ui/MoGoWarningFragment.kt
+++ b/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/ui/MoGoWarningFragment.kt
@@ -13,6 +13,7 @@ import com.mogo.module.hmi.notification.anim.DefaultAnimator
import com.mogo.module.hmi.notification.enums.SidePattern
import com.mogo.module.hmi.ui.widget.ViewV2XNotification
import com.mogo.module.hmi.utils.WarningUtils
+import kotlinx.android.synthetic.main.fragment_warning.*
/**
* @author xiaoyuzhou
@@ -98,19 +99,39 @@ class MoGoWarningFragment : MvpFragment 0) {
+ tvLimitingVelocity.text = "$limitingSpeed"
+ } else {
+ tvLimitingVelocity.text = "0"
+ }
}
+ /**
+ * 控制关闭限速标志及内容
+ */
override fun disableLimitingVelocity() {
-
+ tvLimitingVelocity.visibility = View.GONE
+ tvLimitingVelocity.text = "0"
}
}
\ No newline at end of file
diff --git a/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/ui/widget/ViewTrafficLight.kt b/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/ui/widget/ViewTrafficLight.kt
index c37dc24b87..812b241aa2 100644
--- a/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/ui/widget/ViewTrafficLight.kt
+++ b/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/ui/widget/ViewTrafficLight.kt
@@ -3,6 +3,7 @@ package com.mogo.module.hmi.ui.widget
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
+import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.module.hmi.R
import kotlinx.android.synthetic.main.view_traffic_light_vr.view.*
@@ -21,7 +22,6 @@ class ViewTrafficLight @JvmOverloads constructor(
init {
LayoutInflater.from(context).inflate(R.layout.view_traffic_light_vr, this, true)
-
}
/**
@@ -30,6 +30,7 @@ class ViewTrafficLight @JvmOverloads constructor(
* @param checkLightId 0-都是默认,1-红,2-黄,3-绿
*/
fun showWarningTrafficLight(checkLightId: Int) {
+ clTrafficLight.visibility = View.VISIBLE
when (checkLightId) {
0 -> {
ctvRedTrafficLight.isChecked = false
@@ -54,4 +55,14 @@ class ViewTrafficLight @JvmOverloads constructor(
}
}
+ /**
+ * 关闭红绿灯预警展示,并重制灯态
+ */
+ fun disableWarningTrafficLight() {
+ clTrafficLight.visibility = View.GONE
+ ctvRedTrafficLight.isChecked = false
+ ctvYellowTrafficLight.isChecked = false
+ ctvGreenTrafficLight.isChecked = false
+ }
+
}
\ No newline at end of file
diff --git a/modules/mogo-module-hmi/src/main/res/layout/fragment_warning.xml b/modules/mogo-module-hmi/src/main/res/layout/fragment_warning.xml
index b0e8204200..859a885ff4 100644
--- a/modules/mogo-module-hmi/src/main/res/layout/fragment_warning.xml
+++ b/modules/mogo-module-hmi/src/main/res/layout/fragment_warning.xml
@@ -1,6 +1,7 @@
@@ -24,8 +25,10 @@
android:text="60"
android:textColor="#FFFFFF"
android:textSize="74px"
+ android:visibility="gone"
app:layout_constraintEnd_toEndOf="@+id/viewTrafficLightVr"
- app:layout_constraintTop_toBottomOf="@+id/viewTrafficLightVr" />
+ app:layout_constraintTop_toBottomOf="@+id/viewTrafficLightVr"
+ tools:visibility="visible" />
\ No newline at end of file
diff --git a/modules/mogo-module-hmi/src/main/res/layout/view_traffic_light_vr.xml b/modules/mogo-module-hmi/src/main/res/layout/view_traffic_light_vr.xml
index dd2998cbe1..2708c7df45 100644
--- a/modules/mogo-module-hmi/src/main/res/layout/view_traffic_light_vr.xml
+++ b/modules/mogo-module-hmi/src/main/res/layout/view_traffic_light_vr.xml
@@ -9,7 +9,9 @@
android:paddingStart="18px"
android:paddingTop="10px"
android:paddingEnd="18px"
- android:paddingBottom="10px">
+ android:paddingBottom="10px"
+ android:visibility="gone"
+ tools:visibility="visible">