[3.4.0]增加V2X消息埋点统计

This commit is contained in:
xuxinchao
2023-07-24 21:00:48 +08:00
parent 5000a87d2e
commit 2ce531235c
16 changed files with 207 additions and 25 deletions

View File

@@ -21,6 +21,7 @@ import com.mogo.eagle.function.biz.v2x.trafficlight.core.MogoTrafficLightManager
import com.mogo.eagle.function.biz.v2x.v2n.V2XEventManager
import com.mogo.eagle.function.biz.v2x.v2n.V2XPoiLoader.Companion.v2xPoiLoader
import com.mogo.eagle.function.biz.v2x.v2n.pnc.*
import com.mogo.eagle.function.biz.v2x.v2n.utils.V2XEventAnalyticsManager
import com.mogo.eagle.function.biz.v2x.vip.VipCarManager
@Route(path = MogoServicePaths.PATH_FUNC_BIZ)
@@ -53,6 +54,7 @@ class FuncBizProvider : IMoGoFuncBizProvider {
V2NIdentifyDrawer.init()
// RedLightWarningManager.INSTANCE.listenTrafficLight()
V2XEventAnalyticsManager.init()
}
override fun feedBackNoticeTraffic(infoId: String, sn: String, accept: Int) {
@@ -140,5 +142,6 @@ class FuncBizProvider : IMoGoFuncBizProvider {
V2xObuEventManager.release()
V2NIdentifyDrawer.unInit()
// RedLightWarningManager.INSTANCE.onDestroy()
V2XEventAnalyticsManager.onDestroy()
}
}

View File

@@ -1,6 +1,7 @@
package com.mogo.eagle.function.biz.v2x.obu
import android.content.Context
import com.mogo.eagle.core.data.enums.CommunicationType
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
@@ -10,6 +11,7 @@ import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.obu.CallerObuSaveMessageListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.function.biz.v2x.v2n.utils.V2XEventAnalyticsManager
/**
* 处理obu分发出来在消息盒子展示的消息
@@ -36,7 +38,7 @@ object V2xObuEventManager : IMoGoObuSaveMessageListener {
* @param content 事件内容
* @param tts 事件语音播报 //30秒内同一个事件只出现一次 TODO 临时添加,后面宏宇统一在数据中心处理
*/
override fun onMoGoObuSaveMessage(type: String, content: String, tts: String, sourceType: DataSourceType) {
override fun onMoGoObuSaveMessage(type: String, content: String, tts: String, sourceType: DataSourceType,communicationType: CommunicationType) {
if (content.isNotEmpty()) {
if (obuDataMap.containsKey(type)) {
val oldTime = obuDataMap[type]
@@ -62,6 +64,8 @@ object V2xObuEventManager : IMoGoObuSaveMessageListener {
this.sourceType = sourceType
}
)
//消息埋点
V2XEventAnalyticsManager.triggerV2XEvent(type,content,tts,sourceType,communicationType)
}
}

View File

@@ -300,5 +300,8 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IV2XCallback,
MsgBoxBean(MsgBoxType.V2X, V2XMsg("", "查询到当前全程共${count}个事件", ""))
msgBoxBean.sourceType = DataSourceType.SUMMARY
CallerMsgBoxManager.saveMsgBox(msgBoxBean)
//消息埋点
V2XEventAnalyticsManager.triggerV2XEvent("summary","查询到当前全程共${count}个事件",
"",DataSourceType.AICLOUD,CommunicationType.V2N)
}
}

View File

@@ -3,6 +3,7 @@ package com.mogo.eagle.function.biz.v2x.v2n
import android.os.Handler
import android.os.Looper
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.enums.CommunicationType
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
@@ -16,6 +17,7 @@ import com.mogo.eagle.function.biz.v2x.v2n.network.V2XRefreshModel
import com.mogo.eagle.function.biz.v2x.v2n.network.callback.IV2XCallback
import com.mogo.eagle.function.biz.v2x.v2n.network.callback.IV2XRefreshCallback
import com.mogo.eagle.function.biz.v2x.v2n.utils.DistanceUtils
import com.mogo.eagle.function.biz.v2x.v2n.utils.V2XEventAnalyticsManager
import java.util.concurrent.CopyOnWriteArrayList
import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicReference
@@ -159,6 +161,9 @@ class V2XPoiLoader private constructor() {
MsgBoxBean(MsgBoxType.V2X, V2XMsg("", "查询到当前全程共${size}个事件", ""))
msgBoxBean.sourceType = DataSourceType.SUMMARY
CallerMsgBoxManager.saveMsgBox(msgBoxBean)
//消息埋点
V2XEventAnalyticsManager.triggerV2XEvent("summary","查询到当前全程共${size}个事件",
"",DataSourceType.AICLOUD,CommunicationType.V2N)
}
}
}

View File

@@ -4,6 +4,7 @@ import android.os.*
import androidx.core.util.*
import com.mogo.eagle.core.data.config.*
import com.mogo.eagle.core.data.enums.*
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_TOP
import com.mogo.eagle.core.data.map.entity.*
import com.mogo.eagle.core.data.msgbox.*
@@ -21,6 +22,7 @@ import com.mogo.eagle.core.utilcode.util.*
import com.mogo.eagle.function.biz.v2x.V2XBizTrace
import com.mogo.eagle.function.biz.v2x.v2n.scenario.scene.airoad.*
import com.mogo.eagle.function.biz.v2x.v2n.scenario.scene.airoad.AiRoadMarker.Marker
import com.mogo.eagle.function.biz.v2x.v2n.utils.V2XEventAnalyticsManager
import mogo.telematics.pad.MessagePad.Header
import mogo.telematics.pad.MessagePad.TrackedObject
import mogo.v2x.MogoV2X
@@ -89,6 +91,9 @@ internal object V2NIdentifyDrawer {
CallerVisualAngleManager.changeAngle(Default())
}
}, ALERT_WARNING_TOP, 10000, false)
//消息埋点
V2XEventAnalyticsManager.triggerV2XEvent(poiType, alertContent, ttsContent,
DataSourceType.AICLOUD,CommunicationType.V2N)
}
}.receive()
}
@@ -144,6 +149,9 @@ internal object V2NIdentifyDrawer {
CallerVisualAngleManager.changeAngle(Default())
}
}, ALERT_WARNING_TOP, 10000, false)
//消息埋点
V2XEventAnalyticsManager.triggerV2XEvent(poiType, alertContent, ttsContent,
DataSourceType.AICLOUD,CommunicationType.V2N)
}
}.receive()
}

View File

@@ -1,6 +1,8 @@
package com.mogo.eagle.function.biz.v2x.v2n.scenario.scene.road;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.data.enums.CommunicationType;
import com.mogo.eagle.core.data.enums.DataSourceType;
import com.mogo.eagle.core.data.enums.EventTypeEnumNew;
import com.mogo.eagle.core.data.enums.WarningDirectionEnum;
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay;
@@ -23,6 +25,7 @@ import com.mogo.eagle.function.biz.v2x.v2n.scenario.view.IV2XMarker;
import com.mogo.eagle.core.network.utils.GsonUtil;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.function.biz.v2x.v2n.utils.V2XEventAnalyticsManager;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
@@ -131,6 +134,8 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
CallerHmiManager.INSTANCE.warningV2X(poiType, alarmText,
ttsText, this,WarningDirectionEnum.ALERT_WARNING_TOP,
TimeUnit.SECONDS.toMillis(5), false);
//消息埋点
V2XEventAnalyticsManager.INSTANCE.triggerV2XEvent(poiType,alarmText,ttsText, DataSourceType.AICLOUD, CommunicationType.V2N);
}
}

View File

@@ -8,6 +8,9 @@ import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;
import android.util.Log;
import androidx.annotation.Nullable;
import com.mogo.eagle.core.data.enums.CommunicationType;
import com.mogo.eagle.core.data.enums.DataSourceType;
import com.mogo.eagle.core.data.enums.EventTypeEnumNew;
import com.mogo.eagle.core.data.enums.WarningDirectionEnum;
import com.mogo.eagle.core.data.map.MogoLocation;
@@ -23,6 +26,8 @@ import com.mogo.eagle.function.biz.v2x.v2n.scenario.impl.AbsV2XScenario;
import com.mogo.eagle.function.biz.v2x.v2n.scenario.view.IV2XMarker;
import com.mogo.eagle.core.data.v2x.V2XWarningTarget;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.function.biz.v2x.v2n.utils.V2XEventAnalyticsManager;
import java.math.BigDecimal;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
@@ -82,6 +87,9 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMoGoChas
getAlertContentForFrontWarning(mMarkerEntity), mMarkerEntity.getTts(),
this,getDirection(),
TimeUnit.SECONDS.toMillis(5), false);
//消息埋点
V2XEventAnalyticsManager.INSTANCE.triggerV2XEvent(v2xType,getAlertContentForFrontWarning(mMarkerEntity).toString(),
mMarkerEntity.getTts(), DataSourceType.AICLOUD, CommunicationType.V2N);
}
}
}

View File

@@ -0,0 +1,103 @@
package com.mogo.eagle.function.biz.v2x.v2n.utils
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.commons.utils.MogoAnalyticUtils
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.enums.CommunicationType
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
import com.mogo.eagle.core.function.api.biz.IFuncBizProvider
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.utilcode.util.AppUtils
import com.mogo.eagle.core.utilcode.util.DateTimeUtils
import java.util.concurrent.atomic.AtomicBoolean
/**
* V2消息播报埋点统计
*/
object V2XEventAnalyticsManager: IMoGoChassisLocationWGS84Listener, IFuncBizProvider {
private const val TAG = "V2XEventAnalyticsManager"
private val hasInit by lazy { AtomicBoolean(false) }
private const val EVENT_KEY_V2X_MSG_EVENT = "event_key_v2x_msg_event" //消息盒子播报V2X事件埋点关键字
private const val EVENT_PARAMS_POI_TYPE = "poiType" //事件类型
private const val EVENT_PARAMS_CONTENT ="content" // 事件内容
private const val EVENT_PARAMS_TTS_CONTENT ="ttsContent" // 语音播报内容
private const val EVENT_PARAMS_DISPLAY_TIME ="displayTime" // 展示时间
private const val EVENT_PARAMS_DATA_SOURCE ="dataSource" // 数据来源
private const val EVENT_PARAMS_COMMUNICATION_TYPE ="communicationType" //通信类型
private const val EVENT_PARAMS_PLATE_NUMBER ="plateNumber" // 车牌号
private const val EVENT_PARAMS_CAR_SN ="carSn" // 鹰眼SN
private const val EVENT_PARAMS_EYE_VERSION ="eyeVersion" // 鹰眼版本
private const val EVENT_PARAMS_LONGITUDE ="longitude" // 经度
private const val EVENT_PARAMS_LATITUDE ="latitude" // 纬度
private const val EVENT_PARAMS_HEADING ="heading" // 航向角
private var longitude: Double?=null //经度
private var latitude: Double?=null //纬度
private var heading: Double?=null //航向角
private var oldTime = System.currentTimeMillis()
fun init(){
if (hasInit.compareAndSet(false, true)){
registerListener()
}
}
private fun registerListener(){
// 添加 ADAS车辆状态&定位 监听
CallerChassisLocationWGS84ListenerManager.addListener(TAG, this)
}
private fun unRegisterListener(){
// 移除 ADAS车辆状态&定位 监听
CallerChassisLocationWGS84ListenerManager.removeListener(TAG)
}
override fun onAttrZombieAnalyticsEvent() {
val timeDiff = (System.currentTimeMillis() - oldTime)/1000
if(timeDiff<30){
return
}
oldTime = System.currentTimeMillis()
triggerV2XEvent("ATTR_ZOMBIE","感知数据-僵尸车状态下发","",DataSourceType.TELEMATIC,CommunicationType.V2V)
}
fun triggerV2XEvent(poiType: String,content: String?,ttsContent: String?,
dataSource: DataSourceType,communicationType: CommunicationType){
val msgEventParams = HashMap<String,Any>()
msgEventParams[EVENT_PARAMS_POI_TYPE] = poiType //事件类型
msgEventParams[EVENT_PARAMS_CONTENT] = content?:"" //事件内容
msgEventParams[EVENT_PARAMS_TTS_CONTENT] = ttsContent?:"" //语音播报内容
msgEventParams[EVENT_PARAMS_DISPLAY_TIME] = DateTimeUtils.getTimeText(
System.currentTimeMillis(), DateTimeUtils.yyyy_MM_dd_HH_mm_ss) //展示时间
msgEventParams[EVENT_PARAMS_DATA_SOURCE] = dataSource.name //数据来源
msgEventParams[EVENT_PARAMS_COMMUNICATION_TYPE] = communicationType.name //通信类型
msgEventParams[EVENT_PARAMS_PLATE_NUMBER] = AppConfigInfo.plateNumber //车牌号
msgEventParams[EVENT_PARAMS_CAR_SN] = MoGoAiCloudClientConfig.getInstance().sn //鹰眼SN
msgEventParams[EVENT_PARAMS_EYE_VERSION] = AppUtils.getAppVersionName() //鹰眼版本
msgEventParams[EVENT_PARAMS_LONGITUDE] = "$longitude" //经度
msgEventParams[EVENT_PARAMS_LATITUDE] = "$latitude" //纬度
msgEventParams[EVENT_PARAMS_HEADING] = "$heading" //航向角
MogoAnalyticUtils.track(EVENT_KEY_V2X_MSG_EVENT,msgEventParams)
}
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
gnssInfo.let {
longitude = it.longitude
latitude = it.latitude
heading = it.heading
}
}
fun onDestroy(){
if (hasInit.compareAndSet(true, false)){
unRegisterListener()
}
}
}

View File

@@ -2,11 +2,11 @@ package com.mogo.eagle.core.function.datacenter.obu
import android.content.Context
import com.mogo.eagle.core.data.config.HmiBuildConfig
import com.mogo.eagle.core.data.enums.CommunicationType
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.enums.TrafficLightEnum
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
import com.mogo.eagle.core.data.obu.MogoObuConst
import com.mogo.eagle.core.function.api.datacenter.obu.IMoGoObuWarningMapListener
import com.mogo.eagle.core.function.api.datacenter.obu.IMoGoObuWarningRsiListener
import com.mogo.eagle.core.function.api.datacenter.obu.IMoGoObuWarningRsmListener
@@ -294,11 +294,11 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
}
//大于10m才提示rsi,超速不限制
if (appId == "6666") {
saveObuToDcData(appId, alertContent, ttsContent)
saveObuToDcData(appId, alertContent, ttsContent,CommunicationType.V2I)
showWarning(appId, alertContent, ttsContent, direction)
} else {
if (Math.round(rsiWarningData.warningMsgList[0].distance) > 10) {
saveObuToDcData(appId, alertContent, ttsContent)
saveObuToDcData(appId, alertContent, ttsContent,CommunicationType.V2I)
showWarning(appId, alertContent, ttsContent, direction)
}
}
@@ -306,7 +306,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
MogoObuShowConstants.STATUS.UPDATE -> { // 更新
if(EventTypeEnumNew.TYPE_USECASE_ID_SLW.poiType == appId){
saveObuToDcData(appId, alertContent, ttsContent)
saveObuToDcData(appId, alertContent, ttsContent,CommunicationType.V2I)
showWarning(appId, alertContent, ttsContent, direction)
}
}
@@ -398,7 +398,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
if (alertContent.isEmpty() || ttsContent.isEmpty()) {
return
}
saveObuToDcData(v2xType, alertContent, ttsContent)
saveObuToDcData(v2xType, alertContent, ttsContent,CommunicationType.V2I)
showWarning(v2xType, alertContent, ttsContent, direction, object : IMoGoWarningStatusListener {
override fun onShow() {
@@ -578,7 +578,8 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
saveObuToDcData(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
alertContent,
ttsContent
ttsContent,
CommunicationType.V2I
)
showWarning(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
@@ -620,7 +621,8 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
saveObuToDcData(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
alertContentNew,
ttsContentNew
ttsContentNew,
CommunicationType.V2I
)
showWarning(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
@@ -676,12 +678,13 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
/**
* 保存obu通过工控机传输的数据到消息盒子
*/
private fun saveObuToDcData(type: String, content: String, tts: String) {
private fun saveObuToDcData(type: String, content: String, tts: String,communicationType: CommunicationType) {
CallerObuSaveMessageListenerManager.invokeObuSaveMessage(
type,
content,
tts,
DataSourceType.TELEMATIC
DataSourceType.TELEMATIC,
communicationType
)
}

View File

@@ -577,11 +577,11 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
}
//大于10m才提示rsi。超速不限制
if (appId == "6666") {
saveObuData(appId, alertContent, ttsContent)
saveObuData(appId, alertContent, ttsContent,CommunicationType.V2I)
showWarning(appId, alertContent, ttsContent, direction)
} else {
if (Math.round(data.warningMsgList[0].distance) > 10) {
saveObuData(appId, alertContent, ttsContent)
saveObuData(appId, alertContent, ttsContent,CommunicationType.V2I)
showWarning(appId, alertContent, ttsContent, direction)
}
}
@@ -595,7 +595,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
MogoObuShowConstants.STATUS.UPDATE -> { // 更新
if(EventTypeEnumNew.TYPE_USECASE_ID_SLW.poiType == appId){
saveObuData(appId, alertContent, ttsContent)
saveObuData(appId, alertContent, ttsContent,CommunicationType.V2I)
showWarning(appId, alertContent, ttsContent, direction)
}
}
@@ -701,7 +701,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
if (alertContent.isEmpty() || ttsContent.isEmpty()) {
return
}
saveObuData(v2xType, alertContent, ttsContent)
saveObuData(v2xType, alertContent, ttsContent,CommunicationType.V2I)
showWarning(v2xType, alertContent, ttsContent, direction)
}
@@ -941,7 +941,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
)
if (level == 2 || level == 3) {
//不显示弹框,其它保留
saveObuData(v2xType, alertContent, ttsContent)
saveObuData(v2xType, alertContent, ttsContent,CommunicationType.V2V)
CallerHmiManager.warningV2X(v2xType,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
@@ -1052,7 +1052,8 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
saveObuData(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
alertContent,
ttsContent
ttsContent,
CommunicationType.V2I
)
showWarning(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
@@ -1103,7 +1104,8 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
saveObuData(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
alertContentNew,
ttsContentNew
ttsContentNew,
CommunicationType.V2I
)
showWarning(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
@@ -1159,12 +1161,13 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
/**
* 保存obu直连数据到消息盒子
*/
private fun saveObuData(type: String, content: String, tts: String) {
private fun saveObuData(type: String, content: String, tts: String,communicationType: CommunicationType) {
CallerObuSaveMessageListenerManager.invokeObuSaveMessage(
type,
content,
tts,
DataSourceType.OBU
DataSourceType.OBU,
communicationType
)
}

View File

@@ -3,6 +3,7 @@ package com.mogo.eagle.core.function.business.identify
import android.annotation.SuppressLint
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
import com.mogo.eagle.core.function.call.biz.CallerFuncBizListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import mogo.telematics.pad.MessagePad.*
@@ -71,6 +72,8 @@ object TrackerSourceFilterHelper {
color = "#9BA8BCFF"
}
}
//消息埋点
CallerFuncBizListenerManager.invokeAttrZombieAnalyticsEvent()
}
// pnc预警