diff --git a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/busstation/BusStationEventManager.kt b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/busstation/BusStationEventManager.kt index ea937db60e..d2503a0d34 100644 --- a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/busstation/BusStationEventManager.kt +++ b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/busstation/BusStationEventManager.kt @@ -2,8 +2,8 @@ package com.mogo.eagle.function.biz.v2x.busstation import android.os.Handler import android.os.HandlerThread -import com.mogo.commons.debug.DebugConfig import com.mogo.eagle.core.data.config.FunctionBuildConfig +import com.mogo.eagle.core.data.config.HmiBuildConfig import com.mogo.eagle.core.data.enums.EventTypeEnumNew import com.mogo.eagle.core.data.map.MogoLocation import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener @@ -14,6 +14,7 @@ import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.mogo.eagle.core.utilcode.util.CoordinateUtils import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils +import com.mogo.eagle.core.utilcode.util.UriUtils import com.mogo.map.MogoData import com.mogo.map.entities.BusStation import com.mogo.map.overlay.core.Level @@ -47,9 +48,11 @@ object BusStationEventManager : IMoGoChassisLocationWGS84Listener { // 查询出来的符合条件的公交站点集合 private val busStationNearByQueue = LinkedList>() - // 需要提醒的公交站点 + // 需要提醒的公交站点(待提醒,已提醒) private val busStationListNeedNotified = HashMap() + private val isNotifyRunnableRunning = AtomicBoolean(false) + private val isDriverScreen by lazy { AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode) } @@ -94,12 +97,12 @@ object BusStationEventManager : IMoGoChassisLocationWGS84Listener { val currentLocation = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84() busStationListNeedNotified.values.forEach { - val distance = CoordinateUtils.calculateLineDistance( - currentLocation.longitude, - currentLocation.latitude, - it.getBusStationPoint().longitude, - it.getBusStationPoint().latitude, - ).toInt() +// val distance = CoordinateUtils.calculateLineDistance( +// currentLocation.longitude, +// currentLocation.latitude, +// it.getBusStationPoint().longitude, +// it.getBusStationPoint().latitude, +// ).toInt() val angle = DrivingDirectionUtils.getDegreeOfCar2Poi( currentLocation.longitude, currentLocation.latitude, @@ -107,7 +110,7 @@ object BusStationEventManager : IMoGoChassisLocationWGS84Listener { it.getBusStationPoint().latitude, currentLocation.heading.toInt() ) - if (distance<=5 && angle >= 90) { + if (angle >= 90) { CallerRoadV2NEventWindowListenerManager.dismiss(it.getBusStationId()) busStationListNeedNotified.remove(it.getBusStationId()) Logger.d( @@ -119,36 +122,43 @@ object BusStationEventManager : IMoGoChassisLocationWGS84Listener { } // 开始提醒 - if (busStationListNeedNotified.isNotEmpty()) { + if (busStationListNeedNotified.isNotEmpty() && !isNotifyRunnableRunning.get()) { handler.removeCallbacks(notificationCheckRunnable) handler.post(notificationCheckRunnable) } } catch (e: Exception) { e.printStackTrace() } finally { - handler?.postDelayed(this, 1000L) + handler?.postDelayed(this, 800L) } } } private val notificationCheckRunnable = object : Runnable { override fun run() { + isNotifyRunnableRunning.set(true) if (busStationListNeedNotified.isNotEmpty()) { val list = busStationListNeedNotified.values.toList() .filter { it.notifyTime <= 0 && it.notifyDistance > 0 } .sortedBy { it.notifyDistance } if (list.isNotEmpty()) { list.first().also { - //TODO 调整调用方式 it.notifyTime = System.currentTimeMillis() - CallerRoadV2NEventWindowListenerManager.show( + CallerRoadV2NEventWindowListenerManager.showImage( it.getBusStationId(), it.notifyTime, - EventTypeEnumNew.getUpdateIconRes(""), - "前方${it.notifyDistance}米有公交站,蘑菇提醒您小心右侧行人及来车", + EventTypeEnumNew.getUpdateIconRes(EventTypeEnumNew.TYPE_USECASE_ROAD_BUS_STATION.poiType), + String.format( + EventTypeEnumNew.getAlarmContent(EventTypeEnumNew.TYPE_USECASE_ROAD_BUS_STATION.poiType), + it.notifyDistance + ), isDriverScreen, - "192.168.1.1", - 0.0, 0.0 + UriUtils.res2Uri( + EventTypeEnumNew.getPoiTypeBg( + EventTypeEnumNew.TYPE_USECASE_ROAD_BUS_STATION.poiType, + false + ).toString() + ).toString() ) Logger.d( TAG, @@ -156,10 +166,13 @@ object BusStationEventManager : IMoGoChassisLocationWGS84Listener { ) } if (list.size >= 2) { + isNotifyRunnableRunning.set(true) handler.postDelayed(this, 4000L) + return } } } + isNotifyRunnableRunning.set(false) } } @@ -215,11 +228,7 @@ object BusStationEventManager : IMoGoChassisLocationWGS84Listener { newPoint?.also { farthestLocationList.add(LonLatPoint(it.first, it.second)) } - if (DebugConfig.isDebug()) { - farthestLocationList.last().also { - showHDMarker(it.longitude, it.latitude) - } - } + busStationHDMarkerStrategy() } MogoData.mogoMapData.get()?.also { iMogoData -> val busStationList = iMogoData.getBusStation(farthestLocationList) @@ -250,6 +259,21 @@ object BusStationEventManager : IMoGoChassisLocationWGS84Listener { } } + private var hasShownBorderPointHDMarker = false + private fun busStationHDMarkerStrategy() { + if (HmiBuildConfig.isShowBusStationStrategyBorderPoint) { + farthestLocationList.last().also { + showHDMarker(it.longitude, it.latitude) + } + hasShownBorderPointHDMarker = true + } else { + if (hasShownBorderPointHDMarker) { + removeHDMarker() + hasShownBorderPointHDMarker = false + } + } + } + private fun showHDMarker(lon: Double, lat: Double) { val builder = Point.Options.Builder( "TYPE_MARKER_BUS_STATION", Level.MAP_MARKER @@ -265,4 +289,9 @@ object BusStationEventManager : IMoGoChassisLocationWGS84Listener { overlayManager?.showOrUpdatePoint(builder.build()) } + private fun removeHDMarker() { + val overlayManager = CallerMapUIServiceManager.getOverlayManager() + overlayManager?.removeAllPointsInOwner("TYPE_MARKER_BUS_STATION") + } + } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/pnc/V2NIdentifyDrawer.kt b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/pnc/V2NIdentifyDrawer.kt index f6711926b9..ba976c0f54 100644 --- a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/pnc/V2NIdentifyDrawer.kt +++ b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/pnc/V2NIdentifyDrawer.kt @@ -199,7 +199,7 @@ internal object V2NIdentifyDrawer { } } val alert = sb.toString() - CallerRoadV2NEventWindowListenerManager.show("${itx.longitude}-${itx.latitude}", itx.systemTime.toLong(), EventTypeEnumNew.getUpdateIconRes(poiType), alert, isDriver, itx.cameraIp, itx.longitude, itx.latitude) + CallerRoadV2NEventWindowListenerManager.showLiveVideo("${itx.longitude}-${itx.latitude}", itx.systemTime.toLong(), EventTypeEnumNew.getUpdateIconRes(poiType), alert, isDriver, itx.cameraIp, itx.longitude, itx.latitude) } } //消息埋点 diff --git a/core/function-impl/mogo-core-function-hmi/build.gradle b/core/function-impl/mogo-core-function-hmi/build.gradle index 6df031e493..070ff29182 100644 --- a/core/function-impl/mogo-core-function-hmi/build.gradle +++ b/core/function-impl/mogo-core-function-hmi/build.gradle @@ -81,6 +81,7 @@ dependencies { compileOnly project(':core:function-impl:mogo-core-function-datacenter') implementation project(':foudations:mogo-commons') api project(':core:mogo-core-res') + implementation project(':core:mogo-core-utils') compileOnly project(':core:mogo-core-function-call') } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt index 2f91d7394b..88fca1b0d9 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt @@ -1382,6 +1382,14 @@ internal class DebugSettingView @JvmOverloads constructor( HmiBuildConfig.isShowRouteStrategy = isChecked } + /** + * 通过公交站计算范围边界点 面板控制 + */ + tbBusStationStrategyBorderPoint.isChecked = HmiBuildConfig.isShowBusStationStrategyBorderPoint + tbBusStationStrategyBorderPoint.setOnCheckedChangeListener { _, isChecked -> + HmiBuildConfig.isShowBusStationStrategyBorderPoint = isChecked + } + btnThresholdDefine.setOnClickListener { try { accelerationThresholdNum = etThreshold.text.toString().toDouble() diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/v2n/RoadV2NEventWindowView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/v2n/RoadV2NEventWindowView.kt index 7f2a7a94a5..cd920a213e 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/v2n/RoadV2NEventWindowView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/v2n/RoadV2NEventWindowView.kt @@ -14,19 +14,24 @@ import androidx.lifecycle.lifecycleScope import com.mogo.commons.utils.MogoAnalyticUtils import com.mogo.commons.voice.AIAssist import com.mogo.eagle.core.data.config.FunctionBuildConfig +import com.mogo.eagle.core.data.v2x.RoadV2NEventType import com.mogo.eagle.core.data.v2x.RoadV2NEventWindowBean import com.mogo.eagle.core.function.api.hmi.v2n.IRoadV2NEventWindowListener import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager import com.mogo.eagle.core.function.call.hmi.CallerRoadV2NEventWindowListenerManager import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils +import com.mogo.eagle.core.utilcode.mogo.glide.GlideImageLoader +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.util.DateTimeUtils import com.mogo.eagle.core.utilcode.util.UiThreadHandler import kotlinx.android.synthetic.main.hmi_view_road_v2n_event_window.view.containerEventContent import kotlinx.android.synthetic.main.hmi_view_road_v2n_event_window.view.containerIconHint -import kotlinx.android.synthetic.main.hmi_view_road_v2n_event_window.view.containerLivePlay +import kotlinx.android.synthetic.main.hmi_view_road_v2n_event_window.view.containerImageAndLiveVideo +import kotlinx.android.synthetic.main.hmi_view_road_v2n_event_window.view.contentImageView import kotlinx.android.synthetic.main.hmi_view_road_v2n_event_window.view.ivClose import kotlinx.android.synthetic.main.hmi_view_road_v2n_event_window.view.ivV2XImage +import kotlinx.android.synthetic.main.hmi_view_road_v2n_event_window.view.livePlayView import kotlinx.android.synthetic.main.hmi_view_road_v2n_event_window.view.roundRoadV2NEventContainer import kotlinx.android.synthetic.main.hmi_view_road_v2n_event_window.view.tvV2XHintContent import kotlinx.android.synthetic.main.hmi_view_road_v2n_event_window.view.tvV2XTimeStr @@ -47,7 +52,7 @@ class RoadV2NEventWindowView @JvmOverloads constructor( const val TAG = "RoadV2NEventWindowView" const val ANALYTICS_KEY = "hmi_road_event_window_view" - public fun trackEvent(msg: String) { + fun trackEvent(msg: String) { ProcessLifecycleOwner.get().lifecycleScope.launch(Dispatchers.IO) { val map: MutableMap = HashMap() map["msg"] = msg @@ -69,6 +74,11 @@ class RoadV2NEventWindowView @JvmOverloads constructor( LayoutInflater.from(context).inflate(R.layout.hmi_view_road_v2n_event_window, this, true) } + val dismissRunnable = Runnable { + CallerLogger.i(TAG, "dismissRunnable") + visibility = View.GONE + } + private fun initView() { if (isPassengerScreen) { val layoutParam = @@ -85,17 +95,17 @@ class RoadV2NEventWindowView @JvmOverloads constructor( val padding = AutoSizeUtils.dp2px(context, 37f) roundRoadV2NEventContainer.setPadding(padding, padding, padding, padding) - val containerEventLayoutParams = + val containerIconHintLayoutParams = containerIconHint.layoutParams as ConstraintLayout.LayoutParams - containerEventLayoutParams.width = LayoutParams.MATCH_PARENT - containerEventLayoutParams.height = LayoutParams.WRAP_CONTENT - containerEventLayoutParams.setMargins( + containerIconHintLayoutParams.width = LayoutParams.MATCH_PARENT + containerIconHintLayoutParams.height = LayoutParams.WRAP_CONTENT + containerIconHintLayoutParams.setMargins( AutoSizeUtils.dp2px(context, 50f), AutoSizeUtils.dp2px(context, 40f), AutoSizeUtils.dp2px(context, 50f), 0 ) - containerIconHint.layoutParams = containerEventLayoutParams + containerIconHint.layoutParams = containerIconHintLayoutParams val ivV2XImageLayoutParams = ivV2XImage.layoutParams as RelativeLayout.LayoutParams ivV2XImageLayoutParams.width = AutoSizeUtils.dp2px(context, 69f) @@ -105,22 +115,25 @@ class RoadV2NEventWindowView @JvmOverloads constructor( val tvV2XHintContentLayoutParams = tvV2XHintContent.layoutParams as RelativeLayout.LayoutParams tvV2XHintContentLayoutParams.setMargins( - AutoSizeUtils.dp2px(context, 30f), 0, 0, 0 + AutoSizeUtils.dp2px(context, 30f), 0, + AutoSizeUtils.dp2px(context, 15f), 0 ) tvV2XHintContent.layoutParams = tvV2XHintContentLayoutParams tvV2XHintContent.setTextColor(Color.parseColor("#131415")) - val containerLivePlayLayoutParams = - containerLivePlay.layoutParams as ConstraintLayout.LayoutParams - containerLivePlayLayoutParams.width = AutoSizeUtils.dp2px(context, 498f) - containerLivePlayLayoutParams.height = AutoSizeUtils.dp2px(context, 298f) - containerLivePlayLayoutParams.setMargins( + val containerImageAndLiveVideoLayoutParams = + containerImageAndLiveVideo.layoutParams as ConstraintLayout.LayoutParams + containerImageAndLiveVideoLayoutParams.width = AutoSizeUtils.dp2px(context, 498f) + containerImageAndLiveVideoLayoutParams.height = AutoSizeUtils.dp2px(context, 298f) + containerImageAndLiveVideoLayoutParams.setMargins( AutoSizeUtils.dp2px(context, 51f), AutoSizeUtils.dp2px(context, 30f), AutoSizeUtils.dp2px(context, 51f), 0 ) - containerLivePlay.layoutParams = containerLivePlayLayoutParams + containerImageAndLiveVideo.layoutParams = containerImageAndLiveVideoLayoutParams + + contentImageView.setRadius(AutoSizeUtils.dp2px(context, 36f).toFloat()) val tvV2XTimeStrLayoutParams = tvV2XTimeStr.layoutParams as ConstraintLayout.LayoutParams @@ -169,17 +182,17 @@ class RoadV2NEventWindowView @JvmOverloads constructor( val padding = AutoSizeUtils.dp2px(context, 0f) roundRoadV2NEventContainer.setPadding(padding, padding, padding, padding) - val containerEventLayoutParams = + val containerIconHintLayoutParams = containerIconHint.layoutParams as ConstraintLayout.LayoutParams - containerEventLayoutParams.width = LayoutParams.MATCH_PARENT - containerEventLayoutParams.height = LayoutParams.WRAP_CONTENT - containerEventLayoutParams.setMargins( + containerIconHintLayoutParams.width = LayoutParams.MATCH_PARENT + containerIconHintLayoutParams.height = LayoutParams.WRAP_CONTENT + containerIconHintLayoutParams.setMargins( AutoSizeUtils.dp2px(context, 30f), AutoSizeUtils.dp2px(context, 31f), AutoSizeUtils.dp2px(context, 30f), 0 ) - containerIconHint.layoutParams = containerEventLayoutParams + containerIconHint.layoutParams = containerIconHintLayoutParams val ivV2XImageLayoutParams = ivV2XImage.layoutParams as RelativeLayout.LayoutParams ivV2XImageLayoutParams.width = AutoSizeUtils.dp2px(context, 84f) @@ -191,23 +204,25 @@ class RoadV2NEventWindowView @JvmOverloads constructor( tvV2XHintContentLayoutParams.setMargins( AutoSizeUtils.dp2px(context, 32f), 0, - 0, + AutoSizeUtils.dp2px(context, 15f), 0 ) tvV2XHintContent.layoutParams = tvV2XHintContentLayoutParams tvV2XHintContent.setTextColor(Color.parseColor("#FFFFFF")) - val containerLivePlayLayoutParams = - containerLivePlay.layoutParams as ConstraintLayout.LayoutParams - containerLivePlayLayoutParams.width = AutoSizeUtils.dp2px(context, 540f) - containerLivePlayLayoutParams.height = AutoSizeUtils.dp2px(context, 300f) - containerLivePlayLayoutParams.setMargins( + val containerImageAndLiveVideoLayoutParams = + containerImageAndLiveVideo.layoutParams as ConstraintLayout.LayoutParams + containerImageAndLiveVideoLayoutParams.width = AutoSizeUtils.dp2px(context, 540f) + containerImageAndLiveVideoLayoutParams.height = AutoSizeUtils.dp2px(context, 300f) + containerImageAndLiveVideoLayoutParams.setMargins( AutoSizeUtils.dp2px(context, 30f), AutoSizeUtils.dp2px(context, 30f), AutoSizeUtils.dp2px(context, 30f), 0 ) - containerLivePlay.layoutParams = containerLivePlayLayoutParams + containerImageAndLiveVideo.layoutParams = containerImageAndLiveVideoLayoutParams + + contentImageView.setRadius(AutoSizeUtils.dp2px(context, 12f).toFloat()) val tvV2XTimeStrLayoutParams = tvV2XTimeStr.layoutParams as ConstraintLayout.LayoutParams @@ -256,6 +271,7 @@ class RoadV2NEventWindowView @JvmOverloads constructor( override fun show(dataBean: RoadV2NEventWindowBean) { trackEvent("show --> ${dataBean.toString()}") + UiThreadHandler.removeCallbacks(dismissRunnable) UiThreadHandler.post { currentEventUUID = dataBean.eventId ivV2XImage.setImageDrawable( @@ -271,12 +287,35 @@ class RoadV2NEventWindowView @JvmOverloads constructor( AIAssist.getInstance(context) .speakTTSVoiceWithLevel(dataBean.hintStr, AIAssist.LEVEL0) } - val cityCode = - CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().cityCode - containerLivePlay.startRoadCameraLive(dataBean.eventId, - dataBean.cameraIp, dataBean.lon, dataBean.lat, cityCode - ) + when (dataBean.eventType) { + RoadV2NEventType.TEXT -> { + containerImageAndLiveVideo.visibility = View.GONE + contentImageView.visibility = View.GONE + livePlayView.visibility = View.GONE + } + + RoadV2NEventType.IMAGE -> { + containerImageAndLiveVideo.visibility = View.VISIBLE + contentImageView.visibility = View.VISIBLE + livePlayView.visibility = View.GONE + GlideImageLoader.getInstance() + .displayImage(dataBean.contentImageUrl, contentImageView) + } + + RoadV2NEventType.LIVE_VIDEO -> { + containerImageAndLiveVideo.visibility = View.VISIBLE + contentImageView.visibility = View.GONE + livePlayView.visibility = View.VISIBLE + val cityCode = + CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().cityCode + livePlayView.startRoadCameraLive( + dataBean.eventId, + dataBean.cameraIp, dataBean.lon, dataBean.lat, cityCode + ) + } + } visibility = View.VISIBLE + UiThreadHandler.postDelayed(dismissRunnable, 10 * 1000L) } } @@ -286,8 +325,9 @@ class RoadV2NEventWindowView @JvmOverloads constructor( if (eventId == currentEventUUID) { visibility = View.GONE currentEventUUID = "" - containerLivePlay.stopRoadCameraLive() + livePlayView.stopRoadCameraLive() trackEvent("dismiss --> eventId=${eventId}, 执行dismiss") + UiThreadHandler.removeCallbacks(dismissRunnable) } else { trackEvent("dismiss --> eventId=${eventId}, 跳过dismiss") } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/hmi_view_road_v2n_event_window.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/hmi_view_road_v2n_event_window.xml index 696cd2f07f..f13c149fbe 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/hmi_view_road_v2n_event_window.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/hmi_view_road_v2n_event_window.xml @@ -34,17 +34,19 @@ android:layout_height="@dimen/dp_69" android:layout_alignParentStart="true" android:layout_centerVertical="true" + android:scaleType="fitXY" tools:src="@drawable/v2x_icon_shigong_zhandao" /> - + app:layout_constraintTop_toBottomOf="@id/containerIconHint"> + + + + + + + if (isVrMode) R.drawable.bg_v2x_event_type_red_vr else R.drawable.bg_v2x_event_type_read + TYPE_USECASE_ROAD_BUS_STATION.poiType -> R.drawable.bg_v2x_bus_station else -> { if (isVrMode) R.drawable.bg_v2x_event_type_red_vr else R.drawable.bg_v2x_event_type_read } @@ -729,6 +743,7 @@ enum class EventTypeEnumNew( TYPE_SOCKET_ROAD_SHIGONG.poiType, TYPE_SOCKET_ROAD_JINGZHI.poiType, TYPE_SOCKET_ROAD_SHIGU.poiType, + TYPE_SOCKET_ROAD_WRONG_DIRECTION_CAR.poiType, TYPE_SOCKET_ROAD_CONGESTION.poiType -> true else -> false } @@ -749,6 +764,8 @@ enum class EventTypeEnumNew( TYPE_SOCKET_ROAD_JINGZHI.poiType -> TYPE_SOCKET_ROAD_JINGZHI.tts TYPE_SOCKET_ROAD_SHIGU.poiType -> TYPE_SOCKET_ROAD_SHIGU.tts TYPE_SOCKET_ROAD_CONGESTION.poiType -> TYPE_SOCKET_ROAD_CONGESTION.tts + TYPE_SOCKET_ROAD_WRONG_DIRECTION_CAR.poiType -> TYPE_SOCKET_ROAD_WRONG_DIRECTION_CAR.tts + TYPE_USECASE_ROAD_BUS_STATION.poiType -> TYPE_USECASE_ROAD_BUS_STATION.tts else -> "道路事件" } } @@ -770,6 +787,8 @@ enum class EventTypeEnumNew( TYPE_SOCKET_ROAD_JINGZHI.poiType -> TYPE_SOCKET_ROAD_JINGZHI.content TYPE_SOCKET_ROAD_SHIGU.poiType -> TYPE_SOCKET_ROAD_SHIGU.content TYPE_SOCKET_ROAD_CONGESTION.poiType -> TYPE_SOCKET_ROAD_CONGESTION.content + TYPE_SOCKET_ROAD_WRONG_DIRECTION_CAR.poiType -> TYPE_SOCKET_ROAD_WRONG_DIRECTION_CAR.content + TYPE_USECASE_ROAD_BUS_STATION.poiType -> TYPE_USECASE_ROAD_BUS_STATION.content else -> "道路事件" } } @@ -1131,6 +1150,14 @@ enum class EventTypeEnumNew( TYPE_IPC_DISCONNECT_FOR_MO_FANG.poiType -> { TYPE_IPC_DISCONNECT_FOR_MO_FANG.poiTypeStr } + // 通过公交站 + TYPE_USECASE_ROAD_BUS_STATION.poiType -> { + TYPE_USECASE_ROAD_BUS_STATION.poiTypeStr + } + // 他车逆行 + TYPE_SOCKET_ROAD_WRONG_DIRECTION_CAR.poiType -> { + TYPE_SOCKET_ROAD_WRONG_DIRECTION_CAR.poiTypeStr + } else ->{ "事件通知" } @@ -1157,6 +1184,10 @@ enum class EventTypeEnumNew( TYPE_SOCKET_ROAD_JINGZHI.poiType -> R.drawable.v2x_icon_jingzhi_zhangai TYPE_SOCKET_ROAD_SHIGU.poiType -> if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) R.drawable.icon_shigu_passenger else R.drawable.icon_shigu_driver TYPE_SOCKET_ROAD_CONGESTION.poiType -> R.drawable.v2x_icon_yongdu_vr + // 他车逆行/倒车 + TYPE_SOCKET_ROAD_WRONG_DIRECTION_CAR.poiType -> if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) R.drawable.icon_v2x_wrong_direction_car_passenger else R.drawable.icon_v2x_wrong_direction_car_driver + // 通过公交站 + TYPE_USECASE_ROAD_BUS_STATION.poiType -> if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) R.drawable.icon_v2x_bus_station_passenger else R.drawable.icon_v2x_bus_station_driver //拥堵 FOURS_BLOCK_UP.poiType -> { R.drawable.icon_warning_v2x_congestion @@ -1400,7 +1431,8 @@ enum class EventTypeEnumNew( TYPE_USECASE_ID_ACCIDENT.poiType -> TYPE_USECASE_ID_ACCIDENT.content TYPE_ATTENTION_CONFLUENCE.poiType -> TYPE_ATTENTION_CONFLUENCE.content TYPE_PEDESTRIAN_CROSSING.poiType -> TYPE_PEDESTRIAN_CROSSING.content - + TYPE_SOCKET_ROAD_WRONG_DIRECTION_CAR.poiType -> TYPE_SOCKET_ROAD_WRONG_DIRECTION_CAR.content + TYPE_USECASE_ROAD_BUS_STATION.poiType -> TYPE_USECASE_ROAD_BUS_STATION.content else -> TYPE_ERROR.content } } @@ -1463,7 +1495,8 @@ enum class EventTypeEnumNew( TYPE_USECASE_ID_ACCIDENT.poiType -> TYPE_USECASE_ID_ACCIDENT.tts TYPE_ATTENTION_CONFLUENCE.poiType -> TYPE_ATTENTION_CONFLUENCE.tts TYPE_PEDESTRIAN_CROSSING.poiType -> TYPE_PEDESTRIAN_CROSSING.tts - + TYPE_SOCKET_ROAD_WRONG_DIRECTION_CAR.poiType -> TYPE_SOCKET_ROAD_WRONG_DIRECTION_CAR.tts + TYPE_USECASE_ROAD_BUS_STATION.poiType -> TYPE_USECASE_ROAD_BUS_STATION.tts else -> TYPE_ERROR.tts } } diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/v2x/RoadV2NEventWindowBean.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/v2x/RoadV2NEventWindowBean.kt index a75e96ce20..dd65605242 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/v2x/RoadV2NEventWindowBean.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/v2x/RoadV2NEventWindowBean.kt @@ -4,16 +4,20 @@ package com.mogo.eagle.core.data.v2x * 路侧道路事件 弹框 */ data class RoadV2NEventWindowBean( + var eventType: RoadV2NEventType, //事件弹框类型 var eventId: String, //当前事件弹框 ID, show时生成,用于dismiss时使用 var timestamp: Long = 0, //事件发生事件戳 - var iconResId: Int, //事件icon resource id + var iconResId: Int, //事件icon res id var hintStr: String, //事件提示文案 var isNeedTTS: Boolean = false, //事件文案是否需要同步tts + var contentImageUrl: String, // Image 类型时图片 url var cameraIp: String, // 路侧camera ip,用于请求获取拉流地址 var lon: Double, //事件坐标-经度 var lat: Double, //事件坐标-纬度 ) { override fun toString(): String { - return "RoadV2NEventWindowBean(eventId='$eventId', timestamp=$timestamp, iconResId=$iconResId, hintStr='$hintStr', isNeedTTS=$isNeedTTS, cameraIp='$cameraIp', lon=$lon, lat=$lat)" + return "RoadV2NEventWindowBean(eventType=$eventType, eventId='$eventId', timestamp=$timestamp, iconResId='$iconResId', hintStr='$hintStr', isNeedTTS=$isNeedTTS, contentImageUrl='$contentImageUrl', cameraIp='$cameraIp', lon=$lon, lat=$lat)" } -} \ No newline at end of file +} + +enum class RoadV2NEventType { TEXT, IMAGE, LIVE_VIDEO } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerRoadV2NEventWindowListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerRoadV2NEventWindowListenerManager.kt index df34bdccbd..182f9dcbea 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerRoadV2NEventWindowListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerRoadV2NEventWindowListenerManager.kt @@ -1,5 +1,6 @@ package com.mogo.eagle.core.function.call.hmi +import com.mogo.eagle.core.data.v2x.RoadV2NEventType import com.mogo.eagle.core.data.v2x.RoadV2NEventWindowBean import com.mogo.eagle.core.function.api.hmi.v2n.IRoadV2NEventWindowListener import com.mogo.eagle.core.function.call.base.CallerBase @@ -7,11 +8,82 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger /** * 路侧V2N事件弹框 调用者管理类 + * 支持 text, image, live_video 3种展示样式 */ object CallerRoadV2NEventWindowListenerManager : CallerBase() { const val TAG = "CallerRoadV2NEventWindowListenerManager" + /** + * 通用事件弹框,通过caremaIp, lon , lat请求查询拉流地址 + * @param eventId 调用者设置唯一的事件 ID + * @param timestamp 事件发生的时间 + * @param iconResId 事件icon drawable id + * @param hintStr 事件提示str + * @param isNeedTTS show时是否需要同步tts + */ + fun showText( + eventId: String, + timestamp: Long, + iconResId: Int, + hintStr: String, + isNeedTTS: Boolean + ) { + val data = RoadV2NEventWindowBean( + RoadV2NEventType.TEXT, + eventId, + timestamp, + iconResId, + hintStr, + isNeedTTS, + "", + "", + 0.0, + 0.0 + ) + M_LISTENERS.forEach { + val listener = it.value + listener.show(data) + } + CallerLogger.i(TAG, "show ${data.toString()}, type=${RoadV2NEventType.TEXT}") + } + + /** + * 通用事件弹框,通过caremaIp, lon , lat请求查询拉流地址 + * @param eventId 调用者设置唯一的事件 ID + * @param timestamp 事件发生的时间 + * @param iconResId 事件icon drawable id + * @param hintStr 事件提示str + * @param isNeedTTS show时是否需要同步tts + * @param contentImageUrl 内容部分图片 url + */ + fun showImage( + eventId: String, + timestamp: Long, + iconResId: Int, + hintStr: String, + isNeedTTS: Boolean, + contentImageUrl: String + ) { + val data = RoadV2NEventWindowBean( + RoadV2NEventType.IMAGE, + eventId, + timestamp, + iconResId, + hintStr, + isNeedTTS, + contentImageUrl, + "", + 0.0, + 0.0 + ) + M_LISTENERS.forEach { + val listener = it.value + listener.show(data) + } + CallerLogger.i(TAG, "show ${data.toString()}, type=${RoadV2NEventType.IMAGE}") + } + /** * 通用事件弹框,通过caremaIp, lon , lat请求查询拉流地址 * @param eventId 调用者设置唯一的事件 ID @@ -23,7 +95,7 @@ object CallerRoadV2NEventWindowListenerManager : CallerBase