[sonar] trace

This commit is contained in:
zhongchao
2023-11-01 15:23:22 +08:00
parent 1436ddc053
commit 1d74450bf5
31 changed files with 110 additions and 145 deletions

View File

@@ -2,6 +2,7 @@ package com.mogo.eagle.function.biz.dispatch
import android.content.Context
import android.os.Handler
import android.os.Looper
import android.os.Message
import com.mogo.aicloud.services.socket.IMogoOnMessageListener
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager
@@ -9,6 +10,7 @@ import com.mogo.commons.voice.AIAssist
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo
import com.mogo.eagle.core.data.biz.dispatch.DispatchAdasAutoPilotLocReceiverBean
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.map.MogoLatLng
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
@@ -31,11 +33,12 @@ import com.mogo.eagle.function.biz.dispatch.network.DispatchServiceModel.Compani
import com.mogo.eagle.function.biz.dispatch.network.DispatchServiceModel.Companion.DISPATCH_STOP_MANUAL_CANCEL
import com.mogo.eagle.function.biz.dispatch.network.DispatchServiceModel.Companion.DISPATCH_STOP_TIMER_CANCEL
import com.mogo.eagle.function.biz.dispatch.network.DispatchServiceModel.Companion.dispatchServiceModel
import com.mogo.eagle.function.biz.v2x.V2XBizTrace
import com.zhjt.mogo.adas.data.bean.MogoReport
import com.zhjt.service.chain.ChainLog
import mogo.telematics.pad.MessagePad
import mogo_msg.MogoReportMsg
//todo emArrow 添加biz链路日志
//负责监听自动驾驶状态并进行状态上报,自动驾驶路线上报,接收调度指令展示指令弹窗
class DispatchAutoPilotManager private constructor() :
IMogoOnMessageListener<DispatchAdasAutoPilotLocReceiverBean>,
@@ -61,7 +64,7 @@ class DispatchAutoPilotManager private constructor() :
private var isDispatch = false
private var isArriveEnd = false
private val handler: Handler = object : Handler() {
private val handler: Handler = object : Handler(Looper.getMainLooper()) {
override fun handleMessage(msg: Message) {
super.handleMessage(msg)
if (msg.what == MSG_TYPE_SHOW_DIALOG) {
@@ -109,6 +112,12 @@ class DispatchAutoPilotManager private constructor() :
return DispatchAdasAutoPilotLocReceiverBean::class.java
}
@ChainLog(
linkChainLog = ChainConstant.CHAIN_TYPE_V2X,
linkCode = ChainConstant.CHAIN_SOURCE_CLOUD,
nodeAliasCode = ChainConstant.CHAIN_CODE_DISPATCH_RECEIVE,
paramIndexes = [0]
)
override fun onMsgReceived(adasAutoPilotLocReceiverBean: DispatchAdasAutoPilotLocReceiverBean?) {
CallerLogger.i("$M_BIZ$TAG","onMsgReceived 收到云调度长链接, adasAutoPilotLocReceiver:${adasAutoPilotLocReceiverBean?:""}")
if (adasAutoPilotLocReceiverBean != null && adasAutoPilotLocReceiverBean.startLat != 0.0 && adasAutoPilotLocReceiverBean.startLon != 0.0) {
@@ -130,6 +139,12 @@ class DispatchAutoPilotManager private constructor() :
}
}
@ChainLog(
linkChainLog = ChainConstant.CHAIN_TYPE_V2X,
linkCode = ChainConstant.CHAIN_SOURCE_CLOUD,
nodeAliasCode = ChainConstant.CHAIN_CODE_DISPATCH_START,
paramIndexes = [-1]
)
private fun startAutoPilot() {
val currentAutopilot = AutopilotControlParameters()
// currentAutopilot.isSpeakVoice = false
@@ -146,34 +161,42 @@ class DispatchAutoPilotManager private constructor() :
}
}
if(it.trajUrl == null){
V2XBizTrace.onAck(M_BIZ + TAG, "trajUrl-null")
ToastUtils.showShort("trajUrl数据为空")
return
}
if(it.trajMd5 == null){
V2XBizTrace.onAck(M_BIZ + TAG, "trajMd5-null")
ToastUtils.showShort("trajMd5数据为空")
return
}
if(it.stopUrl == null){
V2XBizTrace.onAck(M_BIZ + TAG, "stopUrl-null")
ToastUtils.showShort("stopUrl数据为空")
return
}
if(it.stopMd5 == null){
V2XBizTrace.onAck(M_BIZ + TAG, "stopMd5-null")
ToastUtils.showShort("stopMd5数据为空")
return
}
if(it.vehicleModel == null){
V2XBizTrace.onAck(M_BIZ + TAG, "vehicleModel-null")
ToastUtils.showShort("vehicleModel数据为空")
return
}
if(it.lineName == null){
V2XBizTrace.onAck(M_BIZ + TAG, "lineName-null")
ToastUtils.showShort("lineName数据为空")
return
}
if(it.startLocAddress == null){
V2XBizTrace.onAck(M_BIZ + TAG, "startLocAddress-null")
ToastUtils.showShort("startLocAddress数据为空")
return
}
if(it.endLocAddress == null){
V2XBizTrace.onAck(M_BIZ + TAG, "endLocAddress-null")
ToastUtils.showShort("endLocAddress数据为空")
return
}
@@ -191,7 +214,7 @@ class DispatchAutoPilotManager private constructor() :
currentAutopilot.endLatLon =
AutopilotControlParameters.AutoPilotLonLat(it.endLat, it.endLon)
currentAutopilot.vehicleType = 10
CallerLogger.d(M_BIZ + TAG, "开启自动驾驶====$currentAutopilot")
V2XBizTrace.onAck(M_BIZ + TAG, "开启自动驾驶====$currentAutopilot")
CallerAutoPilotControlManager.startAutoPilot(currentAutopilot)
}
}
@@ -213,6 +236,7 @@ class DispatchAutoPilotManager private constructor() :
* 停止调度确认
*/
fun stopAffirm(){
V2XBizTrace.onAck(M_BIZ + TAG,"stopAffirm")
CallerHmiManager.dismissDispatchDialog()
receiverBean?.taskId?.let{
dispatchServiceModel.dispatchResultUpload(DISPATCH_STOP_AFFIRM, it,
@@ -230,6 +254,7 @@ class DispatchAutoPilotManager private constructor() :
}
fun cancel(manualTrigger: Boolean) {
V2XBizTrace.onAck(M_BIZ + TAG,"cancel")
CallerHmiManager.dismissDispatchDialog()
receiverBean?.taskId?.let {
dispatchServiceModel.dispatchResultUpload(
@@ -241,6 +266,7 @@ class DispatchAutoPilotManager private constructor() :
* 停止调度取消
*/
fun stopCancel(manualTrigger: Boolean){
V2XBizTrace.onAck(M_BIZ + TAG,"stopCancel:$manualTrigger")
CallerHmiManager.dismissDispatchDialog()
receiverBean?.taskId?.let{
dispatchServiceModel.dispatchResultUpload(
@@ -263,9 +289,6 @@ class DispatchAutoPilotManager private constructor() :
if (isArriveEnd) {
return
}
//todo 确认是否要根据停靠时自动驾驶状态,再次开启自动驾驶
// 确保处于调度中并且返回的自动驾驶状态为1才开启自动驾驶
// 上述等待鄂州项目复盘后,产品输出完成方案后再进操作!!!
if (isDispatch) {
startAutoPilot()
}
@@ -324,6 +347,8 @@ class DispatchAutoPilotManager private constructor() :
//语音提示到站
AIAssist.getInstance(mContext).speakTTSVoice("云调度完成,车辆已到达${it.endLocAddress}")
}
}else{
V2XBizTrace.onAck(M_BIZ + TAG, mapOf("ArriveAtStation" to arrivalNotification, "distanceFromSelf" to distanceFromSelf))
}
}

View File

@@ -11,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.V2XBizTrace
import com.mogo.eagle.function.biz.v2x.v2n.utils.V2XEventAnalyticsManager
/**
@@ -53,7 +54,7 @@ object V2xObuEventManager : IMoGoObuSaveMessageListener {
}
}
obuDataMap[type] = System.currentTimeMillis()
CallerLogger.d("${SceneConstant.M_OBU}${TAG}", "onMoGoObuSaveMessage type = $type ---content = $content ---tts = $tts ")
V2XBizTrace.onAck("${SceneConstant.M_OBU}${TAG}", mapOf("type" to type,"content" to content,"tts" to tts))
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,

View File

@@ -1,6 +1,5 @@
package com.mogo.eagle.function.biz.v2x.redlightwarning
import android.util.Log
import com.mogo.eagle.core.data.biz.trafficlight.*
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_IVP
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_IVP_GREEN
@@ -235,9 +234,6 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType),
speed
)
if (content.isEmpty() || tts.isEmpty()) {
Log.d("MsgBox-RedLightWarManaG", "alertContent或ttsContent为空!")
}
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,

View File

@@ -7,6 +7,7 @@ import androidx.annotation.*
import androidx.localbroadcastmanager.content.*
import com.mogo.eagle.core.data.config.*
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_V2X_MSG
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_SOURCE_ADAS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_SOURCE_CLOUD
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_V2X
import com.mogo.eagle.core.data.enums.*
@@ -182,7 +183,7 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IV2XCallback,
@RequiresApi(Build.VERSION_CODES.N)
@ChainLog(
linkChainLog = CHAIN_TYPE_V2X,
linkCode = CHAIN_SOURCE_CLOUD,
linkCode = CHAIN_SOURCE_ADAS,
nodeAliasCode = CHAIN_CODE_V2X_MSG,
paramIndexes = [0]
)
@@ -301,6 +302,7 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IV2XCallback,
val msgBoxBean =
MsgBoxBean(MsgBoxType.V2X, V2XMsg("", "查询到当前全程共${count}个事件", "",CommunicationType.V2N.name))
msgBoxBean.sourceType = DataSourceType.SUMMARY
V2XBizTrace.onAck("$M_V2X$TAG", mapOf("v2xEventsSummary" to msgBoxBean))
CallerMsgBoxManager.saveMsgBox(msgBoxBean)
//消息埋点
V2XEventAnalyticsManager.triggerV2XEvent("summary","查询到当前全程共${count}个事件",

View File

@@ -12,7 +12,9 @@ import com.mogo.eagle.core.data.v2x.V2XEvent
import com.mogo.eagle.core.data.v2x.V2XMarkerResponse
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.eagle.function.biz.v2x.V2XBizTrace
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
@@ -160,6 +162,7 @@ class V2XPoiLoader private constructor() {
val msgBoxBean =
MsgBoxBean(MsgBoxType.V2X, V2XMsg("", "查询到当前全程共${size}个事件", "",CommunicationType.V2N.name))
msgBoxBean.sourceType = DataSourceType.SUMMARY
V2XBizTrace.onAck("${SceneConstant.M_V2X}$TAG", mapOf("v2xEventsSummary" to msgBoxBean))
CallerMsgBoxManager.saveMsgBox(msgBoxBean)
//消息埋点
V2XEventAnalyticsManager.triggerV2XEvent("summary","查询到当前全程共${size}个事件",

View File

@@ -17,7 +17,6 @@ import com.mogo.eagle.core.function.call.hmi.*
import com.mogo.eagle.core.function.call.map.*
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager.saveMsgBox
import com.mogo.eagle.core.utilcode.mogo.*
import com.mogo.eagle.core.utilcode.mogo.logger.*
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.*
@@ -29,11 +28,10 @@ import mogo.v2x.MogoV2X
import mogo.v2x.MogoV2X.RSI_PB
/**
* V2N上车相关事件绘制 //todo emArrow v2x事件触发异常log
* V2N上车相关事件绘制
*/
internal object V2NIdentifyDrawer {
private const val TAG = "V2NIdentifyDataSubscriber"
private const val MSG_WHAT_DRAW_SHIGONE = 0x1010 // 道路施工
@@ -44,6 +42,7 @@ internal object V2NIdentifyDrawer {
if (msg.what == MSG_WHAT_DRAW_SHIGONE || msg.what == MSG_WHAT_DRAW_SHIGU) {
val events = msg.obj as? List<*>
if (events == null || events.isEmpty()) {
V2XBizTrace.onAck(TAG, mapOf("shiGong-shiGu" to ""))
return@Callback true
}
val car = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
@@ -51,6 +50,7 @@ internal object V2NIdentifyDrawer {
DrivingDirectionUtils.getDegreeOfCar2Poi(car.longitude, car.latitude, itx.longitude, itx.latitude, car.heading.toInt()) < 90
}
if (filtered.isEmpty()) {
V2XBizTrace.onAck(TAG, mapOf("shiGong-shiGu-filter" to ""))
return@Callback true
}
filtered.forEach { itx ->
@@ -78,7 +78,7 @@ internal object V2NIdentifyDrawer {
val distance = CoordinateUtils.calculateLineDistance(itx.longitude, itx.latitude, car.longitude, car.latitude)
val alertContent = getAlertContent(poiType, distance.toDouble())
val ttsContent = getTtsContent(poiType, distance.toDouble())
V2XBizTrace.onAck("V2NIdentifyDrawer","绘制poi事件:$poiType")
V2XBizTrace.onAck(TAG,"绘制poi事件:$poiType")
saveMsgBox(MsgBoxBean(V2X, V2XMsg(poiType, alertContent, ttsContent,CommunicationType.V2N.name)))
CallerHmiManager.warningV2X(poiType, alertContent, ttsContent, object : IMoGoWarningStatusListener {
override fun onShow() {
@@ -100,6 +100,7 @@ internal object V2NIdentifyDrawer {
} else if (msg.what == MSG_WHAT_DRAW_YONGDU) {
val events = msg.obj as? List<*>
if (events == null || events.isEmpty()) {
V2XBizTrace.onAck(TAG, mapOf("yongDu" to ""))
return@Callback true
}
val car = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
@@ -109,6 +110,7 @@ internal object V2NIdentifyDrawer {
DrivingDirectionUtils.getDegreeOfCar2Poi(car.longitude, car.latitude, eventLon, eventLat, car.heading.toInt()) < 90
}
if (filtered.isEmpty()) {
V2XBizTrace.onAck(TAG, mapOf("yongDu-filter" to ""))
return@Callback true
}
filtered.forEach { itx ->
@@ -137,6 +139,7 @@ internal object V2NIdentifyDrawer {
val distance = CoordinateUtils.calculateLineDistance(lon, lat, car.longitude, car.latitude)
val alertContent = getAlertContent(poiType, distance.toDouble())
val ttsContent = getTtsContent(poiType, distance.toDouble())
V2XBizTrace.onAck(TAG,"绘制poi事件:$poiType")
saveMsgBox(MsgBoxBean(V2X, V2XMsg(poiType, alertContent, ttsContent,CommunicationType.V2N.name)))
CallerHmiManager.warningV2X(poiType, alertContent, ttsContent, object : IMoGoWarningStatusListener {
override fun onShow() {
@@ -221,7 +224,6 @@ internal object V2NIdentifyDrawer {
override fun onAutopilotV2nCongestionEvent(header: Header, rsi: RSI_PB) {
super.onAutopilotV2nCongestionEvent(header, rsi)
Logger.d(TAG, "--- onAutopilotV2nCongestionEvent -- : rsi: ${ GsonUtils.toJson(rsi) }")
try {
V2XBizTrace.onAck("onAutopilotV2nCongestionEvent", rsi)
} catch (t: Throwable) {

View File

@@ -28,7 +28,7 @@ import java.util.concurrent.atomic.AtomicInteger
import java.util.concurrent.atomic.AtomicReference
/**
* Ai云道路施工事件道路颜色标记类 //todo emArrow v2x事件触发异常log
* Ai云道路施工事件道路颜色标记类
*/
class AiRoadMarker {
@@ -101,7 +101,7 @@ class AiRoadMarker {
300f, call = { result ->
//施工中心点后方的自车行驶方向上300米距离
result?.let {
V2XBizTrace.onAck("$TAG --- marker --- 3 --- l1:", it)
V2XBizTrace.onAck("$TAG -marker-3-l1:", it)
l1 = result
}
countDown.incrementAndGet()
@@ -113,7 +113,7 @@ class AiRoadMarker {
location.heading.toFloat(),
-300f, call = { result ->
result?.let {
V2XBizTrace.onAck("$TAG --- marker --- 3 --- l2:", it)
V2XBizTrace.onAck("$TAG -marker-3-l2:", it)
l2 = result
}
countDown.incrementAndGet()
@@ -136,14 +136,14 @@ class AiRoadMarker {
return@post
}
if (l1 == null || l2 == null) {
V2XBizTrace.onAck("$TAG --- marker --- 3 --- line null return ----", "")
V2XBizTrace.onAck("$TAG -marker-3-line null return ----", "")
return@post
}
if (l1.points.isEmpty() || l2.points.isEmpty()) {
V2XBizTrace.onAck("$TAG --- marker --- 3 --- line points null return ----", "")
V2XBizTrace.onAck("$TAG -marker-3-line points null return ----", "")
return@post
}
V2XBizTrace.onAck("$TAG --- marker --- 4 --- l2:", l2)
V2XBizTrace.onAck("$TAG -marker-4-l2:", l2)
val points = LinkedList<MogoLatLng>()
if (l2.points.isNotEmpty()) {
points.addAll(l2.points.reversed().map {
@@ -152,7 +152,7 @@ class AiRoadMarker {
}
val centerX = marker.poi_lon
val centerY = marker.poi_lat
V2XBizTrace.onAck("$TAG --- marker --- 5 --- marker:", marker)
V2XBizTrace.onAck("$TAG -marker-5-marker:", marker)
val farthestPoint = marker.polygon?.let {
var find: Pair<Double, Double> = Pair(centerX, centerY)
var min = Long.MAX_VALUE
@@ -172,7 +172,7 @@ class AiRoadMarker {
MogoLatLng(find.second, find.first)
} ?: MogoLatLng(centerY, centerX)
marker.farthestPoint = Pair(farthestPoint.lon, farthestPoint.lat)
V2XBizTrace.onAck("$TAG --- marker --- 6 --- marker:", marker)
V2XBizTrace.onAck("$TAG -marker-6-marker:", marker)
if (l1.points.isNotEmpty()) {
for (l in l1.points) {
if (DrivingDirectionUtils.getDegreeOfCar2Poi2(
@@ -204,7 +204,7 @@ class AiRoadMarker {
builder.points(points)
builder.colors(colors)
builder.setVisible(true)
V2XBizTrace.onAck("$TAG --- marker --- 7 --- points:", "${points.size}")
V2XBizTrace.onAck("$TAG -marker-7-points:", "${points.size}")
val line = overlayManager?.showOrUpdateLine(builder.build())
if (line != null) {
this.line.set(line)
@@ -220,9 +220,9 @@ class AiRoadMarker {
private fun removeLine() {
val old = line.get()
V2XBizTrace.onAck("$TAG --- removeRedLine --- 1", "")
V2XBizTrace.onAck("$TAG -removeRedLine-1", "")
if (old != null) {
V2XBizTrace.onAck("$TAG --- removeRedLine --- 2", "")
V2XBizTrace.onAck("$TAG -removeRedLine-2", "")
line.set(null)
old.delegate?.remove()
}
@@ -230,7 +230,7 @@ class AiRoadMarker {
private fun unMarker(marker: Marker) {
v2nDrawHandler.post {
V2XBizTrace.onAck("$TAG --- unMarker ---", "")
V2XBizTrace.onAck("$TAG -unMarker-", "")
this.marker.set(null)
removeLine()
roadMarker.removeMarkers()
@@ -240,7 +240,7 @@ class AiRoadMarker {
}
fun receive() {
V2XBizTrace.onAck("$TAG --- receive --- 1 ---", "")
V2XBizTrace.onAck("$TAG -receive-1-", "")
val poi = this.marker.get()
val car = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
if (poi != null) {
@@ -251,7 +251,7 @@ class AiRoadMarker {
poi.poi_lat
)
V2XBizTrace.onAck(
"$TAG --- receive --- 2 ---",
"$TAG -receive-2-",
"car:[${car.longitude}, ${car.latitude}] -> poi:[${poi.poi_lon}, ${poi.poi_lat}] --> distance:$distance"
)
if (distance < 500) {

View File

@@ -4,7 +4,6 @@ import android.content.Context
import android.os.Handler
import android.os.Looper
import android.os.Message
import android.util.Log
import com.mogo.aicloud.services.socket.IMogoOnMessageListener
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
@@ -269,9 +268,6 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
alertContent: CharSequence,
ttsContent: String,
) {
if (alertContent.toString().isEmpty() || ttsContent.isEmpty()) {
Log.d("MsgBox-VipCarManager", "alertContent或ttsContent为空!")
}
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(MsgBoxType.V2X, V2XMsg(v2xType, alertContent.toString(), ttsContent,CommunicationType.V2N.name))
)