[2.13.0-arch-opt]v2x code style
This commit is contained in:
@@ -22,7 +22,7 @@ import java.util.concurrent.TimeUnit
|
||||
|
||||
object OverViewDataManager {
|
||||
|
||||
const val TAG = "OverViewDataManager"
|
||||
private const val TAG = "OverViewDataManager"
|
||||
|
||||
private val overviewDao by lazy {
|
||||
OverviewDb.getDb(AbsMogoApplication.getApp()).overviewDao()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.eagle.function.biz.v2x.overview.remote
|
||||
|
||||
import com.mogo.eagle.core.data.v2x.V2XEventResult
|
||||
import io.reactivex.Observable
|
||||
import retrofit2.http.GET
|
||||
import retrofit2.http.Query
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.mogo.eagle.function.biz.v2x.overview.remote
|
||||
|
||||
import androidx.annotation.Keep
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.data.v2x.V2XEvent
|
||||
|
||||
|
||||
@Keep
|
||||
data class V2XEventResult (
|
||||
@SerializedName("result")
|
||||
var result: Result?
|
||||
): BaseData()
|
||||
|
||||
@Keep
|
||||
data class Result(
|
||||
@SerializedName("eventList")
|
||||
var v2XEventList: List<V2XEvent>?
|
||||
)
|
||||
@@ -13,7 +13,7 @@ import com.mogo.eagle.core.data.msgbox.V2XMsg
|
||||
import com.mogo.eagle.core.data.trafficlight.*
|
||||
import com.mogo.eagle.core.data.trafficlight.TrafficLightStatusHelper.getCurrentRoadTrafficLight
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
import com.mogo.eagle.core.function.api.v2x.IMoGoTrafficLightListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTrafficLightListener
|
||||
import com.mogo.eagle.core.function.api.v2x.IMoGoVipSetListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
|
||||
@@ -19,7 +19,7 @@ import com.mogo.eagle.core.data.trafficlight.currentRoadTrafficLight
|
||||
import com.mogo.eagle.core.data.trafficlight.isGreen
|
||||
import com.mogo.eagle.core.data.trafficlight.isRed
|
||||
import com.mogo.eagle.core.data.v2x.VipMessage
|
||||
import com.mogo.eagle.core.function.api.v2x.IMoGoTrafficLightListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTrafficLightListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.mogo.eagle.core.function.datacenter.aicloud
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.cloud.socket.SocketManager
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider
|
||||
|
||||
@Route(path = MogoServicePaths.PATH_AI_CLOUD)
|
||||
class AiCloudSocketBizProvider : IMoGoFunctionServerProvider {
|
||||
override val functionName: String
|
||||
get() = "AiCloudSocketBizProvider"
|
||||
|
||||
override fun init(context: Context?) {
|
||||
SocketManager.getInstance().init(AbsMogoApplication.getApp(), 0.0, 0.0)
|
||||
SocketManager.getInstance().registerOnMessageListener(401012, V2XMessageListener401012())
|
||||
SocketManager.getInstance().registerOnMessageListener(401018, V2XMessageListener401018())
|
||||
SocketManager.getInstance().registerOnMessageListener(402000, V2XMessageListener402000())
|
||||
SocketManager.getInstance().registerOnMessageListener(404000, V2XMessageListener404000())
|
||||
//SocketManager.getInstance().registerOnMessageListener(503000, V2XMessageListener503000())
|
||||
SocketManager.getInstance().registerOnMessageListener(70001, V2XMessageListener70001())
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.mogo.eagle.core.function.datacenter.aicloud
|
||||
|
||||
import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener
|
||||
import com.mogo.eagle.core.data.v2x.*
|
||||
import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager
|
||||
import roadwork.Road
|
||||
|
||||
internal class V2XMessageListener70001: IMogoCloudSocketOnMessageListener<V2XRoadXData> {
|
||||
|
||||
override fun target(msgType: Int): Class<V2XRoadXData> = V2XRoadXData::class.java
|
||||
|
||||
override fun onMsgReceived(msgType: Int, data: V2XRoadXData?) {
|
||||
if (msgType != 70001) {
|
||||
return
|
||||
}
|
||||
if (data == null) {
|
||||
return
|
||||
}
|
||||
CallerCloudListenerManager.invokeSocketAck(V2XEvent.RoadEventX(data = data))
|
||||
}
|
||||
}
|
||||
|
||||
internal class V2XMessageListener401012: IMogoCloudSocketOnMessageListener<V2XMarkerCardResult> {
|
||||
|
||||
override fun target(msgType: Int): Class<V2XMarkerCardResult> = V2XMarkerCardResult::class.java
|
||||
|
||||
override fun onMsgReceived(msgType: Int, data: V2XMarkerCardResult?) {
|
||||
if (msgType != 401012) {
|
||||
return
|
||||
}
|
||||
if (data == null) {
|
||||
return
|
||||
}
|
||||
CallerCloudListenerManager.invokeSocketAck(V2XEvent.Road(data = data))
|
||||
}
|
||||
}
|
||||
|
||||
internal class V2XMessageListener401018: IMogoCloudSocketOnMessageListener<V2XWarningTarget> {
|
||||
|
||||
override fun target(msgType: Int): Class<V2XWarningTarget> = V2XWarningTarget::class.java
|
||||
|
||||
override fun onMsgReceived(msgType: Int, data: V2XWarningTarget?) {
|
||||
if (msgType != 401018) {
|
||||
return
|
||||
}
|
||||
if (data == null) {
|
||||
return
|
||||
}
|
||||
CallerCloudListenerManager.invokeSocketAck(V2XEvent.Warning(data = data))
|
||||
}
|
||||
}
|
||||
|
||||
internal class V2XMessageListener402000: IMogoCloudSocketOnMessageListener<V2XOptimalRoute> {
|
||||
|
||||
override fun target(msgType: Int): Class<V2XOptimalRoute> = V2XOptimalRoute::class.java
|
||||
|
||||
override fun onMsgReceived(msgType: Int, data: V2XOptimalRoute?) {
|
||||
if (msgType != 402000) {
|
||||
return
|
||||
}
|
||||
if (data == null) {
|
||||
return
|
||||
}
|
||||
CallerCloudListenerManager.invokeSocketAck(V2XEvent.OptimalRoute(data = data))
|
||||
}
|
||||
}
|
||||
|
||||
internal class V2XMessageListener404000: IMogoCloudSocketOnMessageListener<V2XAdvanceWarning> {
|
||||
|
||||
override fun target(msgType: Int): Class<V2XAdvanceWarning> = V2XAdvanceWarning::class.java
|
||||
|
||||
override fun onMsgReceived(msgType: Int, data: V2XAdvanceWarning?) {
|
||||
if (msgType != 404000) {
|
||||
return
|
||||
}
|
||||
if (data == null) {
|
||||
return
|
||||
}
|
||||
CallerCloudListenerManager.invokeSocketAck(V2XEvent.ForwardsWarning(data = data))
|
||||
}
|
||||
}
|
||||
|
||||
internal class V2XMessageListener503000: IMogoCloudSocketOnMessageListener<Road.RW_PB> {
|
||||
|
||||
override fun target(msgType: Int): Class<Road.RW_PB> = Road.RW_PB::class.java
|
||||
|
||||
override fun onMsgReceived(msgType: Int, data: Road.RW_PB?) {
|
||||
if (msgType != 503000) {
|
||||
return
|
||||
}
|
||||
if (data == null) {
|
||||
return
|
||||
}
|
||||
CallerCloudListenerManager.invokeSocketAck(V2XEvent.RoadAI(data = data))
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.eagle.core.function.datacenter.autopilot.adapter
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.debug.DebugConfig.*
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
@@ -27,12 +28,15 @@ class MoGoAdasMsgConnectStatusListenerImpl :
|
||||
OnAdasConnectStatusListener,
|
||||
IMoGoAutopilotStatusListener,
|
||||
IMoGoCloudListener {
|
||||
private val TAG = "ConnectStatus"
|
||||
|
||||
companion object{
|
||||
private const val TAG = "ConnectStatus"
|
||||
}
|
||||
|
||||
private var connectStatus = false
|
||||
|
||||
init {
|
||||
CallerCloudListenerManager.registerCloudListener(TAG, this)
|
||||
CallerCloudListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onConnectionIPCStatus(ipcConnectionStatus: Int, reason: String?) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.eagle.core.function.datacenter.autopilot.server
|
||||
|
||||
import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
|
||||
import com.mogo.eagle.core.function.api.v2x.IMoGoTrafficLightListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTrafficLightListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.mogo.eagle.core.function.datacenter.v2x
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
import com.mogo.eagle.core.function.api.v2x.ILimitingVelocityListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.union.ILimitingVelocityListener
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
import com.mogo.eagle.core.data.enums.TrafficLightEnum
|
||||
import com.mogo.eagle.core.data.trafficlight.*
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
|
||||
import com.mogo.eagle.core.function.api.v2x.IMoGoTrafficLightListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTrafficLightListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
|
||||
import perception.TrafficLightOuterClass
|
||||
|
||||
@@ -4,7 +4,7 @@ import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths.PATH_MSG_BOX_MODULE
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.function.api.msgbox.IMsgBoxProvider
|
||||
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxProvider
|
||||
import com.mogo.eagle.core.function.msgbox.DataManager.saveAllMessages2Disk
|
||||
|
||||
@Route(path = PATH_MSG_BOX_MODULE)
|
||||
|
||||
@@ -152,6 +152,9 @@ class BindingCarNetWorkManager private constructor() {
|
||||
}
|
||||
|
||||
private fun updateCarVrIconRes(brandId: String?) {
|
||||
if(!DebugConfig.isCarModelChange()){
|
||||
return
|
||||
}
|
||||
if (brandId == null || brandId.isEmpty()) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class TraceManager : IMoGoCloudListener, IMoGoAutopilotCarConfigListener {
|
||||
// 初始化Trace抓取服务
|
||||
val pkgName = Utils.getApp().packageName
|
||||
ChainTraceStarter.start(pkgName, DeviceUtils.getMacAddress(), false)
|
||||
CallerCloudListenerManager.registerCloudListener(TAG, this)
|
||||
CallerCloudListenerManager.addListener(TAG, this)
|
||||
CallerAutopilotCarConfigListenerManager.addListener(TAG, this)
|
||||
|
||||
// Trace过程中进行日志抓取,对日志进行配置
|
||||
|
||||
@@ -23,7 +23,7 @@ class TtsManager : IMoGoCloudListener {
|
||||
fun initTts(context: Context) {
|
||||
val sn = SharedPrefsMgr.getInstance(context).getString("sn")
|
||||
if (sn.isNullOrEmpty()) {
|
||||
CallerCloudListenerManager.registerCloudListener(TraceManager.TAG, this)
|
||||
CallerCloudListenerManager.addListener(TraceManager.TAG, this)
|
||||
}
|
||||
AIAssist.getInstance(context)
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.data.msgbox.MsgCategory
|
||||
import com.mogo.eagle.core.function.api.msgbox.IMsgBoxListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
|
||||
|
||||
@@ -6,7 +6,7 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.function.api.msgbox.IMsgBoxEventListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxEventListener
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import kotlinx.android.synthetic.main.view_driver_msg_box_button.view.*
|
||||
|
||||
@@ -9,8 +9,8 @@ import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.data.msgbox.MsgCategory
|
||||
import com.mogo.eagle.core.function.api.msgbox.IMsgBoxEventListener
|
||||
import com.mogo.eagle.core.function.api.msgbox.IMsgBoxListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxEventListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
|
||||
|
||||
@@ -9,7 +9,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxType
|
||||
import com.mogo.eagle.core.data.msgbox.MsgCategory
|
||||
import com.mogo.eagle.core.function.api.msgbox.IMsgBoxListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
|
||||
@@ -6,18 +6,15 @@ import android.util.AttributeSet
|
||||
import android.view.*
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxType
|
||||
import com.mogo.eagle.core.data.msgbox.MsgCategory
|
||||
import com.mogo.eagle.core.function.api.msgbox.IMsgBoxListener
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.function.hmi.ui.msgbox.adapter.PassengerMsgBoxBubbleAdapter
|
||||
import com.mogo.eagle.core.function.msgbox.MsgBoxConfig
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import kotlinx.android.synthetic.main.layout_passenger_msg_box_bubble.view.*
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.function.api.msgbox.IMsgBoxEventListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxEventListener
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import kotlinx.android.synthetic.main.view_passenger_msg_box_button.view.*
|
||||
|
||||
@@ -7,18 +7,16 @@ import android.view.LayoutInflater
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.recyclerview.widget.DividerItemDecoration
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxType
|
||||
import com.mogo.eagle.core.data.msgbox.MsgCategory
|
||||
import com.mogo.eagle.core.function.api.msgbox.IMsgBoxEventListener
|
||||
import com.mogo.eagle.core.function.api.msgbox.IMsgBoxListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxEventListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.function.hmi.ui.msgbox.adapter.PassengerMsgBoxListAdapter
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ResourceUtils.getDrawable
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import kotlinx.android.synthetic.main.layout_passenger_msg_box_list.view.*
|
||||
|
||||
@@ -4,7 +4,6 @@ import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.util.TypedValue.COMPLEX_UNIT_PX
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.content.res.AppCompatResources
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
@@ -17,7 +16,7 @@ import com.mogo.eagle.core.data.trafficlight.isRed
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningActionsListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener.Companion.STATUS_AUTOPILOT_RUNNING
|
||||
import com.mogo.eagle.core.function.api.v2x.IMoGoTrafficLightListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTrafficLightListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningActionsListenerManager
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
|
||||
@@ -25,8 +24,6 @@ import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.zhjt.service_biz.BizConfig
|
||||
import kotlinx.android.synthetic.main.view_pnc_actions.view.*
|
||||
import me.jessyan.autosize.AutoSize
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
import mogo.telematics.pad.MessagePad
|
||||
|
||||
class PncActionsView @JvmOverloads constructor(
|
||||
@@ -52,16 +49,25 @@ class PncActionsView @JvmOverloads constructor(
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_pnc_actions, this, true)
|
||||
val a = context.obtainStyledAttributes(attrs, R.styleable.PncActionsView, defStyleAttr, 0)
|
||||
bgResources = a.getResourceId(R.styleable.PncActionsView_background_resource, R.drawable.pnc_actions_bg)
|
||||
topMargin = a.getResourceId(R.styleable.PncActionsView_pnc_top_margin,resources.getDimension(R.dimen.dp_30).toInt())
|
||||
txtSize = a.getResourceId(R.styleable.PncActionsView_pnc_size,resources.getDimension(R.dimen.dp_34).toInt())
|
||||
bgResources = a.getResourceId(
|
||||
R.styleable.PncActionsView_background_resource,
|
||||
R.drawable.pnc_actions_bg
|
||||
)
|
||||
topMargin = a.getResourceId(
|
||||
R.styleable.PncActionsView_pnc_top_margin,
|
||||
resources.getDimension(R.dimen.dp_30).toInt()
|
||||
)
|
||||
txtSize = a.getResourceId(
|
||||
R.styleable.PncActionsView_pnc_size,
|
||||
resources.getDimension(R.dimen.dp_34).toInt()
|
||||
)
|
||||
a.recycle()
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
(tvHmiPncActions.layoutParams as MarginLayoutParams).topMargin = topMargin
|
||||
tvHmiPncActions.setTextSize(COMPLEX_UNIT_PX,txtSize.toFloat())
|
||||
tvHmiPncActions.setTextSize(COMPLEX_UNIT_PX, txtSize.toFloat())
|
||||
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
CallerPlanningActionsListenerManager.addListener(TAG, this)
|
||||
@@ -124,6 +130,9 @@ class PncActionsView @JvmOverloads constructor(
|
||||
tvHmiPncActions.text = actions
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.background = null
|
||||
tvHmiPncActions.text = ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,14 +2,13 @@ package com.mogo.eagle.core.function.hmi.ui.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.LimitingVelocityView_TAG
|
||||
import com.mogo.eagle.core.function.api.v2x.ILimitingVelocityListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.union.ILimitingVelocityListener
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
@@ -43,7 +42,6 @@ class LimitingVelocityView constructor(
|
||||
if (limitingVelocity > 0) {
|
||||
visibility = View.VISIBLE
|
||||
tvLimitingVelocity.text = "$limitingVelocity"
|
||||
Log.d("emArrow","limit : ${ DataSourceType.getName(sourceType)}")
|
||||
tvLimitingSource.text = DataSourceType.getName(sourceType)
|
||||
} else {
|
||||
visibility = View.GONE
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
import com.mogo.eagle.core.data.enums.TrafficLightEnum
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.TrafficLightView_TAG
|
||||
import com.mogo.eagle.core.function.api.v2x.IMoGoTrafficLightListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTrafficLightListener
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
|
||||
@@ -8,12 +8,11 @@ import android.widget.FrameLayout
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
import com.mogo.eagle.core.function.api.v2x.ILimitingVelocityListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.union.ILimitingVelocityListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import java.util.*
|
||||
|
||||
class SpeedPanelView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
|
||||
@@ -22,10 +22,10 @@ import com.amap.api.maps.TextureMapView
|
||||
import com.amap.api.maps.model.*
|
||||
import com.mogo.eagle.core.data.map.Infrastructure
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.data.v2x.V2XEvent
|
||||
import com.mogo.eagle.core.data.v2x.V2XEventData
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
|
||||
import com.mogo.eagle.core.function.api.v2x.IFuncBizProvider
|
||||
import com.mogo.eagle.core.function.api.biz.IFuncBizProvider
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.getGlobalPath
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
|
||||
@@ -300,8 +300,8 @@ class OverMapView @JvmOverloads constructor(
|
||||
geoHashInfMap = map
|
||||
}
|
||||
|
||||
override fun onV2XEvents(v2xEvents: List<V2XEvent>?) {
|
||||
showV2XEventMarkers(v2xEvents)
|
||||
override fun onV2XEvents(v2XEventData: List<V2XEventData>?) {
|
||||
showV2XEventMarkers(v2XEventData)
|
||||
}
|
||||
})
|
||||
// 主动查一次全局路径规划的数据
|
||||
@@ -389,11 +389,11 @@ class OverMapView @JvmOverloads constructor(
|
||||
/**
|
||||
* 显示V2X事件的Marker
|
||||
*/
|
||||
private fun showV2XEventMarkers(v2XEvents: List<V2XEvent>?) {
|
||||
if (v2XEvents == null || v2XEvents.isEmpty()) return
|
||||
private fun showV2XEventMarkers(v2XEventData: List<V2XEventData>?) {
|
||||
if (v2XEventData == null || v2XEventData.isEmpty()) return
|
||||
clearV2XMarkers()
|
||||
val markerOptionsList = ArrayList<MarkerOptions>()
|
||||
for (v2xEvent in v2XEvents) {
|
||||
for (v2xEvent in v2XEventData) {
|
||||
val center = v2xEvent.center
|
||||
if (center != null) {
|
||||
val markerOption = MarkerOptions()
|
||||
|
||||
@@ -8,10 +8,7 @@ import com.mogo.eagle.core.function.api.startup.IStartUpProvider
|
||||
import com.mogo.eagle.core.function.startup.stageone.APMStartup
|
||||
import com.mogo.eagle.core.function.startup.stageone.HttpDnsStartUp
|
||||
import com.mogo.eagle.core.function.startup.stageone.ThreadOptStartup
|
||||
import com.mogo.eagle.core.function.startup.stagetwo.AutopilotStartUp
|
||||
import com.mogo.eagle.core.function.startup.stagetwo.DataCenterStartUp
|
||||
import com.mogo.eagle.core.function.startup.stagetwo.ObuStartUp
|
||||
import com.mogo.eagle.core.function.startup.stagetwo.MapBizStartUp
|
||||
import com.mogo.eagle.core.function.startup.stagetwo.*
|
||||
import com.rousetime.android_startup.StartupListener
|
||||
import com.rousetime.android_startup.StartupManager
|
||||
import com.rousetime.android_startup.model.CostTimesModel
|
||||
@@ -20,7 +17,7 @@ import com.rousetime.android_startup.model.StartupConfig
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
|
||||
@Route(path = MogoServicePaths.PATH_STARTUP_PROVIDER)
|
||||
class MogoStartUpProvider: IStartUpProvider {
|
||||
class MogoStartUpProvider : IStartUpProvider {
|
||||
|
||||
private var context: Context? = null
|
||||
|
||||
@@ -39,8 +36,7 @@ class MogoStartUpProvider: IStartUpProvider {
|
||||
}
|
||||
|
||||
override fun initStageOne() {
|
||||
var config: StartupConfig? = null
|
||||
config = if (DebugConfig.isDebug()) {
|
||||
val config = if (DebugConfig.isDebug()) {
|
||||
StartupConfig.Builder()
|
||||
.setLoggerLevel(LoggerLevel.DEBUG)
|
||||
.setOpenStatistics(true)
|
||||
@@ -78,6 +74,7 @@ class MogoStartUpProvider: IStartUpProvider {
|
||||
StartupManager.Builder()
|
||||
.addStartup(DataCenterStartUp())
|
||||
.addStartup(AutopilotStartUp())
|
||||
.addStartup(AiCloudBizStartUp())
|
||||
.addStartup(ObuStartUp())
|
||||
.addStartup(MapBizStartUp())
|
||||
.setConfig(config)
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.mogo.eagle.core.function.startup.stagetwo
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.rousetime.android_startup.AndroidStartup
|
||||
|
||||
class AiCloudBizStartUp : AndroidStartup<Boolean>() {
|
||||
|
||||
override fun create(context: Context): Boolean {
|
||||
ARouter.getInstance().build(MogoServicePaths.PATH_AI_CLOUD).navigation()
|
||||
return true
|
||||
}
|
||||
|
||||
override fun callCreateOnMainThread(): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun waitOnMainThread(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun dependenciesByName(): List<String> {
|
||||
val deps = arrayListOf<String>()
|
||||
deps.add("com.mogo.eagle.core.function.startup.stagetwo.DataCenterStartUp")
|
||||
return deps
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@ plugins {
|
||||
id 'kotlin-android-extensions'
|
||||
id 'kotlin-kapt'
|
||||
id 'com.alibaba.arouter'
|
||||
id 'com.google.protobuf'
|
||||
}
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
@@ -36,19 +35,6 @@ android {
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
protobuf {
|
||||
protoc {
|
||||
artifact = rootProject.ext.dependencies.protoc
|
||||
}
|
||||
generateProtoTasks {
|
||||
all().each { task ->
|
||||
task.builtins {
|
||||
java {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -63,8 +49,6 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.protobuf_java
|
||||
implementation rootProject.ext.dependencies.protobuf_java_util
|
||||
implementation rootProject.ext.dependencies.mogoaicloudtrafficlive
|
||||
|
||||
|
||||
|
||||
@@ -7,16 +7,9 @@ import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.util.Log
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||
import com.mogo.cloud.passport.IMoGoTokenCallback
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.constants.HostConst
|
||||
import com.mogo.commons.module.ServiceConst.CARD_TYPE_ROAD_CONDITION
|
||||
import com.mogo.commons.network.ParamsUtil
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_CLOUD_V2N
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_CLOUD
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_CLOUD_V2N
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
|
||||
import com.mogo.eagle.core.data.enums.EventTypeHelper
|
||||
@@ -28,11 +21,11 @@ import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxType
|
||||
import com.mogo.eagle.core.data.msgbox.V2XMsg
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData
|
||||
import com.mogo.eagle.core.data.v2x.V2XAdvanceWarning
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
|
||||
import com.mogo.eagle.core.function.api.map.angle.*
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
@@ -47,37 +40,30 @@ import com.mogo.eagle.core.function.v2x.events.consts.V2XConst.BROADCAST_SCENE_H
|
||||
import com.mogo.eagle.core.function.v2x.events.receiver.SceneBroadcastReceiver
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.impl.V2XScenarioManager
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.toRoadMarker
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.toV2XRoadEventEntity
|
||||
import com.mogo.eagle.core.function.v2x.internal.V2XManager
|
||||
import com.mogo.eagle.core.function.v2x.internal.callback.IV2XCallback
|
||||
import com.mogo.eagle.core.function.v2x.internal.config.V2XConfig
|
||||
import com.mogo.eagle.core.function.v2x.internal.data.*
|
||||
import com.mogo.eagle.core.function.v2x.internal.event.V2XEvent
|
||||
import com.mogo.eagle.core.function.v2x.road.V2XEventServiceApi
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
import com.mogo.eagle.core.data.v2x.V2XEvent
|
||||
import com.mogo.eagle.core.data.v2x.V2XMarkerCardResult
|
||||
import com.mogo.eagle.core.data.v2x.V2XWarningTarget
|
||||
import com.mogo.eagle.core.function.api.cloud.IMoGoCloudListener
|
||||
import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager
|
||||
import com.mogo.eagle.core.function.v2x.events.V2XPoiLoader.Companion.v2xPoiLoader
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.toV2XRoadEventEntity
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.eagle.core.utilcode.util.Utils
|
||||
import com.mogo.map.marker.MogoMarkersHandler.Companion.mogoMarkersHandler
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
import com.zhjt.service.chain.TracingConstants
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.android.asCoroutineDispatcher
|
||||
import kotlinx.coroutines.cancel
|
||||
import kotlinx.coroutines.launch
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import mogo.telematics.pad.MessagePad
|
||||
|
||||
object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IMoGoTokenCallback, IV2XCallback,
|
||||
IMoGoAutopilotIdentifyListener {
|
||||
object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IV2XCallback,
|
||||
IMoGoAutopilotIdentifyListener, IMoGoCloudListener {
|
||||
|
||||
private const val TAG = "V2XEventManager"
|
||||
|
||||
@@ -87,57 +73,34 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IMoGoTokenCallback,
|
||||
|
||||
private val hasInit by lazy { AtomicBoolean(false) }
|
||||
|
||||
|
||||
var v2xEventDisposable: Disposable? = null
|
||||
|
||||
fun init(context: Context) {
|
||||
BridgeApi.init(context)
|
||||
if (hasInit.compareAndSet(false, true)) {
|
||||
if (!V2XManager.hasInit()) {
|
||||
V2XManager.init(V2XConfig.Builder().also {
|
||||
it.aiCloudConfig(MoGoAiCloudClientConfig.getInstance())
|
||||
it.context(context)
|
||||
it.loggable(false)
|
||||
it.distanceForTriggerRefresh(200f) //行驶超过200(包含)米,刷新道路周边信息(短链请求)
|
||||
it.durationForTriggerRefresh(
|
||||
60,
|
||||
TimeUnit.SECONDS
|
||||
) // 每隔1分钟,根据自车定位,刷新道路周边信息(短链请求)
|
||||
it.executor(ThreadUtils.getIoPool()) //用到的线程池(IO类型)
|
||||
it.staticParams(ParamsUtil.getStaticParams())
|
||||
}.build())
|
||||
V2XManager.start()
|
||||
}
|
||||
registerListener()
|
||||
V2XManager.forceRefresh()
|
||||
MoGoAiCloudClient.getInstance().addTokenCallbacks(this)
|
||||
v2xPoiLoader.startLoopPoi()
|
||||
// 注册广播接收场景弹窗使用的
|
||||
SceneBroadcastReceiver.register(context)
|
||||
}
|
||||
}
|
||||
|
||||
private fun registerListener() {
|
||||
V2XManager.addCallback(this)
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, this)
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, 1,this)
|
||||
v2xPoiLoader.addCallback(this)
|
||||
CallerCloudListenerManager.addListener(TAG,this)
|
||||
CallerAutopilotIdentifyListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
private fun unRegisterListener() {
|
||||
V2XManager.removeCallback(this)
|
||||
CallerChassisLocationGCJ02ListenerManager.removeListener(TAG)
|
||||
v2xPoiLoader.removeCallback(this)
|
||||
CallerCloudListenerManager.removeListener(TAG)
|
||||
CallerAutopilotIdentifyListenerManager.removeListener(TAG)
|
||||
mogoMarkersHandler.unregisterMarkerClickListener(CARD_TYPE_ROAD_CONDITION)
|
||||
}
|
||||
|
||||
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
|
||||
BridgeApi.location.set(mogoLocation)
|
||||
mogoLocation?.let {
|
||||
if (V2XManager.hasInit()) {
|
||||
V2XManager.onLocationChanged(
|
||||
longitude = it.longitude,
|
||||
latitude = mogoLocation.latitude
|
||||
)
|
||||
}
|
||||
v2xPoiLoader.updateCheck(mogoLocation.longitude,mogoLocation.latitude)
|
||||
refreshCarState(mogoLocation)
|
||||
}
|
||||
}
|
||||
@@ -167,12 +130,6 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IMoGoTokenCallback,
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTokenGot(token: String?, sn: String?) {
|
||||
if (V2XManager.hasInit()) {
|
||||
V2XManager.updateSnAndToken(sn, token)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* V2XEvent事件回调
|
||||
*/
|
||||
@@ -202,12 +159,11 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IMoGoTokenCallback,
|
||||
handleWarningTargetEvent(event.data)
|
||||
}
|
||||
is V2XEvent.RoadAI -> {
|
||||
if(FunctionBuildConfig.isV2NFromCar){
|
||||
if (FunctionBuildConfig.isV2NFromCar) {
|
||||
return
|
||||
}
|
||||
handleRoadMarkerEvent(event.data.toRoadMarker())
|
||||
}
|
||||
|
||||
is V2XEvent.RoadEventX -> {
|
||||
handleRoadMarkerEvent(event.data.toRoadMarker())
|
||||
}
|
||||
@@ -220,7 +176,7 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IMoGoTokenCallback,
|
||||
@SuppressLint("NewApi")
|
||||
override fun onAutopilotIdentifyPlanningObj(planningObjects: List<MessagePad.PlanningObject>?) {
|
||||
super.onAutopilotIdentifyPlanningObj(planningObjects)
|
||||
if(!FunctionBuildConfig.isV2NFromCar){
|
||||
if (!FunctionBuildConfig.isV2NFromCar) {
|
||||
return
|
||||
}
|
||||
planningObjects?.let {
|
||||
@@ -277,6 +233,7 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IMoGoTokenCallback,
|
||||
}
|
||||
}
|
||||
|
||||
//todo 可优化,与obu解析类似
|
||||
private fun handleAdvanceWarningEvent(event: V2XEvent.ForwardsWarning) {
|
||||
scope.launch {
|
||||
val message = event.data
|
||||
@@ -422,69 +379,13 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IMoGoTokenCallback,
|
||||
}
|
||||
|
||||
fun queryWholeRoadEvents() {
|
||||
if (v2xEventDisposable != null && !v2xEventDisposable!!.isDisposed) {
|
||||
v2xEventDisposable!!.dispose()
|
||||
}
|
||||
val sn = MoGoAiCloudClientConfig.getInstance().sn
|
||||
val lineId = getLineId()
|
||||
if (lineId > 0) {
|
||||
realQueryV2xEvents(lineId.toString(), sn)
|
||||
} else {
|
||||
UiThreadHandler.postDelayed({
|
||||
realQueryV2xEvents(getLineId().toString(), sn)
|
||||
}, 500)
|
||||
}
|
||||
}
|
||||
|
||||
private fun realQueryV2xEvents(lineId: String, sn: String) {
|
||||
v2xEventDisposable = MoGoRetrofitFactory.getInstance(HostConst.getHost())
|
||||
.create(V2XEventServiceApi::class.java)
|
||||
.queryAllV2XEventsByLineId(lineId, sn)
|
||||
.map {
|
||||
if (it.code == 200 || it.code == 0) {
|
||||
CallerLogger.d(M_V2X + TAG, "请求成功,size为:${it.result?.v2XEventList?.size}")
|
||||
return@map it.result?.v2XEventList
|
||||
} else {
|
||||
CallerLogger.d(M_V2X + TAG, "请求失败,code为:${it.code}")
|
||||
return@map ArrayList()
|
||||
}
|
||||
}
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe {
|
||||
val size = it?.size ?: 0
|
||||
if (size > 0) {
|
||||
val msgBoxBean =
|
||||
MsgBoxBean(MsgBoxType.V2X, V2XMsg("", "查询到当前全程共${size}个事件", ""))
|
||||
msgBoxBean.sourceType = DataSourceType.SUMMARY
|
||||
CallerMsgBoxManager.saveMsgBox(msgBoxBean)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getLineId(): Long {
|
||||
var lineId: Long = -1
|
||||
val parameter = CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo()
|
||||
.autopilotControlParameters
|
||||
if (parameter != null) {
|
||||
if (parameter.autoPilotLine != null) {
|
||||
lineId = parameter.autoPilotLine!!.lineId
|
||||
CallerLogger.d(M_V2X + TAG, "lineId为:$lineId")
|
||||
} else {
|
||||
CallerLogger.d(M_V2X + TAG, "parameter.autoPilotLine为null")
|
||||
}
|
||||
} else {
|
||||
CallerLogger.d(M_V2X + TAG, "parameter为null")
|
||||
}
|
||||
return lineId
|
||||
v2xPoiLoader.queryWholeRoadEvents()
|
||||
}
|
||||
|
||||
override fun onFail(msg: String) {
|
||||
CallerLogger.e("$M_V2X$TAG", "Error: $msg")
|
||||
}
|
||||
|
||||
override fun onError(code: Int, msg: String?) {}
|
||||
|
||||
fun onDestroy() {
|
||||
if (hasInit.compareAndSet(true, false)) {
|
||||
try {
|
||||
@@ -494,6 +395,7 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IMoGoTokenCallback,
|
||||
} finally {
|
||||
unRegisterListener()
|
||||
}
|
||||
v2xPoiLoader.stopLoopPoi()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
package com.mogo.eagle.core.function.v2x.events
|
||||
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxType
|
||||
import com.mogo.eagle.core.data.msgbox.V2XMsg
|
||||
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.function.v2x.internal.callback.IV2XCallback
|
||||
import com.mogo.eagle.core.function.v2x.internal.http.V2XRefreshModel
|
||||
import com.mogo.eagle.core.function.v2x.internal.http.callback.IV2XRefreshCallback
|
||||
import com.mogo.eagle.core.function.v2x.internal.utils.DistanceUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
|
||||
class V2XPoiLoader private constructor() {
|
||||
|
||||
companion object {
|
||||
|
||||
private const val TAG = "V2XPoiLoader"
|
||||
|
||||
val v2xPoiLoader by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
V2XPoiLoader()
|
||||
}
|
||||
}
|
||||
|
||||
private val lastLongitude by lazy { AtomicReference(0.0) }
|
||||
|
||||
private val lastLatitude by lazy { AtomicReference(0.0) }
|
||||
|
||||
private val realLongitude by lazy { AtomicReference(0.0) }
|
||||
|
||||
private val realLatitude by lazy { AtomicReference(0.0) }
|
||||
|
||||
private val handler by lazy {
|
||||
Handler(Looper.getMainLooper())
|
||||
}
|
||||
|
||||
private val cbs by lazy {
|
||||
CopyOnWriteArrayList<IV2XCallback>()
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加相关信息接口回调
|
||||
* @param cb 要添加的回调接口
|
||||
*/
|
||||
fun addCallback(cb: IV2XCallback) {
|
||||
if (cbs.contains(cb)) {
|
||||
return
|
||||
}
|
||||
cbs += cb
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除相关信息接口回调
|
||||
* @param cb 要移除的回调接口
|
||||
*/
|
||||
fun removeCallback(cb: IV2XCallback) {
|
||||
if (!cbs.contains(cb)) {
|
||||
return
|
||||
}
|
||||
cbs.remove(cb)
|
||||
}
|
||||
|
||||
fun updateCheck(longitude: Double, latitude: Double) {
|
||||
realLongitude.set(longitude)
|
||||
realLatitude.set(latitude)
|
||||
val oldLon = lastLongitude.get()
|
||||
val oldLat = lastLatitude.get()
|
||||
var update = false
|
||||
try {
|
||||
if (oldLon == 0.0 || oldLat == 0.0) {
|
||||
handler.removeCallbacks(refreshTask)
|
||||
handler.post(refreshTask)
|
||||
update = true
|
||||
return
|
||||
}
|
||||
if (DistanceUtils.calculateLineDistance(oldLon, oldLat, longitude, latitude) >= 200f) {
|
||||
handler.removeCallbacks(refreshTask)
|
||||
handler.post(refreshTask)
|
||||
update = true
|
||||
}
|
||||
} finally {
|
||||
if (update) {
|
||||
lastLatitude.set(latitude)
|
||||
lastLongitude.set(longitude)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启loop Poi事件
|
||||
*/
|
||||
fun startLoopPoi() {
|
||||
handler.removeCallbacks(refreshTask)
|
||||
handler.post(refreshTask)
|
||||
}
|
||||
|
||||
private val refreshTask = object : Runnable {
|
||||
override fun run() {
|
||||
V2XRefreshModel.querySnapshot(
|
||||
longitude = realLongitude.get(), latitude = realLatitude.get(),
|
||||
refreshCallback
|
||||
)
|
||||
handler.postDelayed(this, TimeUnit.SECONDS.toMillis(60))
|
||||
}
|
||||
}
|
||||
|
||||
fun stopLoopPoi() {
|
||||
handler.removeCallbacks(refreshTask)
|
||||
lastLatitude.set(0.0)
|
||||
lastLongitude.set(0.0)
|
||||
}
|
||||
|
||||
private val refreshCallback = object : IV2XRefreshCallback<V2XMarkerResponse> {
|
||||
|
||||
override fun onSuccess(result: V2XMarkerResponse) {
|
||||
cbs.forEach {
|
||||
it.onAck(V2XEvent.Marker(result))
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFail(msg: String?) {
|
||||
cbs.forEach {
|
||||
it.onFail(msg ?: "")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询全览路径上的事件信息
|
||||
*/
|
||||
fun queryWholeRoadEvents() {
|
||||
V2XRefreshModel.roadEventDispose()
|
||||
val sn = MoGoAiCloudClientConfig.getInstance().sn
|
||||
val lineId = getLineId()
|
||||
if (lineId > 0) {
|
||||
realQueryV2xEvents(lineId.toString(), sn)
|
||||
} else {
|
||||
UiThreadHandler.postDelayed({
|
||||
realQueryV2xEvents(getLineId().toString(), sn)
|
||||
}, 500)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getLineId(): Long {
|
||||
var lineId: Long = -1
|
||||
val parameter = CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo()
|
||||
.autopilotControlParameters
|
||||
if (parameter != null) {
|
||||
if (parameter.autoPilotLine != null) {
|
||||
lineId = parameter.autoPilotLine!!.lineId
|
||||
CallerLogger.d(SceneConstant.M_V2X + TAG, "lineId为:$lineId")
|
||||
} else {
|
||||
CallerLogger.d(SceneConstant.M_V2X + TAG, "parameter.autoPilotLine为null")
|
||||
}
|
||||
} else {
|
||||
CallerLogger.d(SceneConstant.M_V2X + TAG, "parameter为null")
|
||||
}
|
||||
return lineId
|
||||
}
|
||||
|
||||
private fun realQueryV2xEvents(lineId: String, sn: String) {
|
||||
V2XRefreshModel.getRoadEvents(lineId, sn) {
|
||||
val size = it?.size ?: 0
|
||||
if (size > 0) {
|
||||
val msgBoxBean =
|
||||
MsgBoxBean(MsgBoxType.V2X, V2XMsg("", "查询到当前全程共${size}个事件", ""))
|
||||
msgBoxBean.sourceType = DataSourceType.SUMMARY
|
||||
CallerMsgBoxManager.saveMsgBox(msgBoxBean)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.eagle.core.function.v2x.internal.data.V2XMarkerCardResult;
|
||||
import com.mogo.eagle.core.data.v2x.V2XMarkerCardResult;
|
||||
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
|
||||
@@ -19,11 +19,8 @@ import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.MoGoV2XServicePaths;
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XMarkerManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.marker.V2XMarkerAdapter;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.EntityUtilsKt;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.MapUtils;
|
||||
import com.mogo.eagle.core.function.v2x.internal.data.V2XMarkerCardResult;
|
||||
import com.mogo.eagle.core.function.v2x.internal.data.V2XMarkerExploreWay;
|
||||
import com.mogo.eagle.core.function.v2x.internal.data.V2XMarkerLocation;
|
||||
import com.mogo.eagle.core.data.v2x.V2XMarkerCardResult;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
|
||||
import com.mogo.eagle.core.function.v2x.internal.data.V2XWarningTarget;
|
||||
import com.mogo.eagle.core.data.v2x.V2XWarningTarget;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@@ -18,8 +18,8 @@ import com.mogo.eagle.core.function.v2x.events.manager.IMoGoPersonWarnPolylineMa
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoStopPolylineManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoWarnPolylineManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
|
||||
import com.mogo.eagle.core.function.v2x.internal.data.V2XLocation;
|
||||
import com.mogo.eagle.core.function.v2x.internal.data.V2XWarningTarget;
|
||||
import com.mogo.eagle.core.data.v2x.V2XLocation;
|
||||
import com.mogo.eagle.core.data.v2x.V2XWarningTarget;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
|
||||
@@ -5,8 +5,9 @@ import com.mogo.eagle.core.data.enums.EventTypeEnumNew.Companion.isRoadEvent
|
||||
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay
|
||||
import com.mogo.eagle.core.data.map.entity.MarkerLocation
|
||||
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity
|
||||
import com.mogo.eagle.core.data.v2x.V2XMarkerCardResult
|
||||
import com.mogo.eagle.core.data.v2x.V2XRoadXData
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.AiRoadMarker
|
||||
import com.mogo.eagle.core.function.v2x.internal.data.*
|
||||
import com.mogo.eagle.core.utilcode.util.CoordinateTransform
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import roadwork.Road
|
||||
|
||||
@@ -1,257 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.internal
|
||||
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.cloud.socket.SocketManager
|
||||
import com.mogo.eagle.core.function.v2x.internal.callback.IV2XCallback
|
||||
import com.mogo.eagle.core.function.v2x.internal.config.V2XConfig
|
||||
import com.mogo.eagle.core.function.v2x.internal.data.V2XMarkerResponse
|
||||
import com.mogo.eagle.core.function.v2x.internal.event.V2XEvent
|
||||
import com.mogo.eagle.core.function.v2x.internal.http.V2XRefreshModel
|
||||
import com.mogo.eagle.core.function.v2x.internal.http.callback.IV2XRefreshCallback
|
||||
import com.mogo.eagle.core.function.v2x.internal.logger.V2XLogger
|
||||
import com.mogo.eagle.core.function.v2x.internal.socket.*
|
||||
import com.mogo.eagle.core.function.v2x.internal.socket.V2XMessageListener_401012
|
||||
import com.mogo.eagle.core.function.v2x.internal.socket.V2XMessageListener_401018
|
||||
import com.mogo.eagle.core.function.v2x.internal.socket.V2XMessageListener_402000
|
||||
import com.mogo.eagle.core.function.v2x.internal.socket.V2XMessageListener_404000
|
||||
import com.mogo.eagle.core.function.v2x.internal.utils.DistanceUtils
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
|
||||
object V2XManager {
|
||||
|
||||
internal const val TAG = "V2XManager"
|
||||
|
||||
private val config: AtomicReference<V2XConfig> by lazy {
|
||||
AtomicReference<V2XConfig>(null)
|
||||
}
|
||||
|
||||
private val cbs by lazy {
|
||||
CopyOnWriteArrayList<IV2XCallback>()
|
||||
}
|
||||
|
||||
private val lastLongitude by lazy {
|
||||
AtomicReference(0.0)
|
||||
}
|
||||
|
||||
private val lastLatitude by lazy {
|
||||
AtomicReference(0.0)
|
||||
}
|
||||
|
||||
private val realLongitude by lazy { AtomicReference(0.0) }
|
||||
|
||||
private val realLatitude by lazy { AtomicReference(0.0) }
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 标识此参数是否启动
|
||||
*/
|
||||
private val started by lazy {
|
||||
AtomicBoolean(false)
|
||||
}
|
||||
|
||||
private val refreshCallback = object : IV2XRefreshCallback<V2XMarkerResponse> {
|
||||
|
||||
override fun onSuccess(result: V2XMarkerResponse) {
|
||||
cbs.forEach {
|
||||
it.onAck(V2XEvent.Marker(result))
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFail(msg: String?) {
|
||||
cbs.forEach {
|
||||
it.onFail(msg ?: "")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private val refreshTask = object : Runnable {
|
||||
override fun run() {
|
||||
V2XRefreshModel.querySnapshot(longitude = realLongitude.get(), latitude = realLatitude.get(), refreshCallback)
|
||||
handler.postDelayed(this, config.get().durationForTriggerRefresh)
|
||||
}
|
||||
}
|
||||
|
||||
private val handler by lazy {
|
||||
Handler(Looper.getMainLooper())
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据所配置的参数,初始化V2X相关功能(注: 此方法不要重复调用,非首次调用会抛异常)
|
||||
* @param config 相关配置类
|
||||
*/
|
||||
fun init(config: V2XConfig) {
|
||||
V2XLogger.d(TAG, "-- init --")
|
||||
if (V2XManager.config.get() != null) {
|
||||
throw IllegalStateException("V2XManager has been initialized, don't initialize repeatably.")
|
||||
}
|
||||
V2XManager.config.set(config)
|
||||
V2XLogger.loggable = config.loggable
|
||||
}
|
||||
|
||||
/**
|
||||
* - 开启V2X功能, 此方法调用前,要确保满足以下两个条件:
|
||||
* 1.初始化方法[init]已调用
|
||||
* 2.确保[MoGoAiCloudClientConfig.sn]和[MoGoAiCloudClientConfig.token]两个值存在,如果其中有一个值不存在,不会启动相关功能
|
||||
* - 此函数的功能如下:
|
||||
* 1.建立长链接[SocketManager.init]
|
||||
* 2.位置上报服务[LocationManager.init]和[LocationManager.start]
|
||||
* 3.短链[V2XRefreshModel.querySnapshot]定时轮循,轮循时长取[V2XConfig.durationForTriggerRefresh]
|
||||
*/
|
||||
fun start() {
|
||||
V2XLogger.d(TAG, "-- start --")
|
||||
val config = config.get() ?: throw IllegalStateException("V2XManager has not been initialized, please invoke V2XManager#init(config: X2XConfig) firstly.")
|
||||
if (started.get()) {
|
||||
V2XLogger.d(TAG, "-- has been started --")
|
||||
return
|
||||
}
|
||||
if (config.aiCloudConfig.sn?.isBlank() == true) {
|
||||
V2XLogger.e(TAG, "sn is null or blank, please ensure sn exists and then invoke V2XManager#start() again.")
|
||||
cbs.forEach {
|
||||
it.onFail("sn is null or blank, please ensure sn exists and then invoke V2XManager#start() again.")
|
||||
}
|
||||
return
|
||||
}
|
||||
if (config.aiCloudConfig.token?.isBlank() == true) {
|
||||
V2XLogger.e(TAG, "token is null or blank, please ensure token exists and then invoke V2Manager#start() again.")
|
||||
cbs.forEach {
|
||||
it.onFail("token is null or blank, please ensure token exists and then invoke V2Manager#start() again.")
|
||||
}
|
||||
return
|
||||
}
|
||||
if (started.compareAndSet(false, true)) {
|
||||
V2XLogger.d(TAG, "-- start real --")
|
||||
SocketManager.getInstance().init(config.context,0.0,0.0)
|
||||
SocketManager.getInstance().registerOnMessageListener(401012, V2XMessageListener_401012(cbs))
|
||||
SocketManager.getInstance().registerOnMessageListener(401018, V2XMessageListener_401018(cbs))
|
||||
SocketManager.getInstance().registerOnMessageListener(402000, V2XMessageListener_402000(cbs))
|
||||
SocketManager.getInstance().registerOnMessageListener(404000, V2XMessageListener_404000(cbs))
|
||||
//SocketManager.getInstance().registerOnMessageListener(503000, V2XMessageListener_503000(cbs))
|
||||
SocketManager.getInstance().registerOnMessageListener(70001, V2XMessageListener_70001(cbs))
|
||||
handler.post(refreshTask)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param sn 更新后的sn
|
||||
* @param token 更新后的token
|
||||
*/
|
||||
fun updateSnAndToken(sn: String?, token: String?) {
|
||||
val config = config.get() ?: throw IllegalStateException("V2XManager has not been initialized, please invoke V2XManager#init(config: X2XConfig) firstly.")
|
||||
sn ?: return
|
||||
token ?: return
|
||||
if (started.get()) {
|
||||
return
|
||||
}
|
||||
config.aiCloudConfig.sn = sn
|
||||
config.aiCloudConfig.token = token
|
||||
start()
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止V2X功能
|
||||
* 1. 断开长链接[SocketManager.release]
|
||||
* 2. 停止位置上报[LocationManager.stop]
|
||||
* 3. 取消短链定时轮循任务
|
||||
*/
|
||||
fun stop() {
|
||||
V2XLogger.d(TAG, "-- stop --")
|
||||
if (config.get() == null) {
|
||||
throw IllegalStateException("V2XManager has not been initialized, please invoke V2XManager#init(config: X2XConfig) firstly.")
|
||||
}
|
||||
if (started.compareAndSet(true, false)) {
|
||||
V2XLogger.d(TAG, "-- stop real --")
|
||||
SocketManager.getInstance().release()
|
||||
handler.removeCallbacks(refreshTask)
|
||||
lastLatitude.set(0.0)
|
||||
lastLongitude.set(0.0)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加相关信息接口回调
|
||||
* @param cb 要添加的回调接口
|
||||
*/
|
||||
fun addCallback(cb: IV2XCallback) {
|
||||
V2XLogger.d(TAG, "-- addCallback --")
|
||||
if (cbs.contains(cb)) {
|
||||
return
|
||||
}
|
||||
cbs += cb
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除相关信息接口回调
|
||||
* @param cb 要移除的回调接口
|
||||
*/
|
||||
fun removeCallback(cb: IV2XCallback) {
|
||||
V2XLogger.d(TAG, "-- removeCallback --")
|
||||
if (!cbs.contains(cb)) {
|
||||
return
|
||||
}
|
||||
cbs.remove(cb)
|
||||
}
|
||||
|
||||
/**
|
||||
* 当自车位置变量时调用
|
||||
* @param longitude 自车所在精度
|
||||
* @param latitude 自车所在纬度
|
||||
*/
|
||||
fun onLocationChanged(longitude: Double, latitude: Double) {
|
||||
if (config.get() == null) {
|
||||
throw IllegalStateException("V2XManager has not been initialized, please invoke V2XManager#init(config: X2XConfig) firstly.")
|
||||
}
|
||||
if (!started.get()) {
|
||||
return
|
||||
}
|
||||
//V2XLogger.d(TAG, "--- onLocationChanged --[longitude: $longitude, latitude: $latitude]")
|
||||
realLongitude.set(longitude)
|
||||
realLatitude.set(latitude)
|
||||
val oldLon = lastLongitude.get()
|
||||
val oldLat = lastLatitude.get()
|
||||
var update = false
|
||||
try {
|
||||
if (oldLon == 0.0 || oldLat == 0.0) {
|
||||
V2XLogger.d(TAG, "--- onLocationChanged -- first --[longitude: $longitude, latitude: $latitude]")
|
||||
handler.removeCallbacks(refreshTask)
|
||||
handler.post(refreshTask)
|
||||
update = true
|
||||
return
|
||||
}
|
||||
if (DistanceUtils.calculateLineDistance(oldLon, oldLat, longitude, latitude) >= config.get().distanceForTriggerRefresh) {
|
||||
V2XLogger.d(TAG, "--- onLocationChanged -- trigger --[longitude: $longitude, latitude: $latitude]")
|
||||
handler.removeCallbacks(refreshTask)
|
||||
handler.post(refreshTask)
|
||||
update = true
|
||||
}
|
||||
} finally {
|
||||
if (update) {
|
||||
lastLatitude.set(latitude)
|
||||
lastLongitude.set(longitude)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否已经初始化
|
||||
* @return true: 已初始化过 false: 未初始化
|
||||
*/
|
||||
fun hasInit() = getConfig() != null
|
||||
|
||||
/**
|
||||
* 强制刷新道路事件
|
||||
*/
|
||||
fun forceRefresh() {
|
||||
if (hasInit()) {
|
||||
handler.removeCallbacks(refreshTask)
|
||||
handler.post(refreshTask)
|
||||
}
|
||||
}
|
||||
|
||||
internal fun getConfig() = config.get()
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.eagle.core.function.v2x.internal.callback
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.internal.event.V2XEvent
|
||||
import com.mogo.eagle.core.data.v2x.V2XEvent
|
||||
|
||||
interface IV2XCallback {
|
||||
|
||||
|
||||
@@ -1,174 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.internal.config
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.function.v2x.internal.executor.Executors
|
||||
import java.util.concurrent.Executor
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlin.IllegalStateException
|
||||
|
||||
/**
|
||||
* V2X相关配置
|
||||
*/
|
||||
class V2XConfig private constructor(builder: Builder) {
|
||||
|
||||
/**
|
||||
* - 应用上下文
|
||||
* - 必选项
|
||||
* - 通过[Builder.context]设置
|
||||
*/
|
||||
val context : Context by lazy {
|
||||
builder.context?.applicationContext ?: throw IllegalStateException("context must not be null.")
|
||||
}
|
||||
|
||||
/**
|
||||
* - 云平台配置参数
|
||||
* - 必选项
|
||||
* - 通过[Builder.aiCloudConfig]设置
|
||||
*/
|
||||
val aiCloudConfig by lazy {
|
||||
builder.aiCloudConfig ?: throw IllegalStateException("aiCloudConfig must not be null.")
|
||||
}
|
||||
|
||||
/**
|
||||
* - 网络请求使用的线程池,IO类型
|
||||
* - 可选项
|
||||
* - 通过[Builder.executor]设置
|
||||
*/
|
||||
val executor: Executor by lazy {
|
||||
builder.executor ?: Executors.IO
|
||||
}
|
||||
|
||||
/**
|
||||
* - 是否开启日志
|
||||
* - 可选项
|
||||
* - 通过[Builder.loggable]设置,开发阶段可以打开,应用发布后记得关闭
|
||||
*/
|
||||
val loggable: Boolean by lazy {
|
||||
builder.loggable
|
||||
}
|
||||
|
||||
/**
|
||||
* - 公共参数, 默认为空
|
||||
* - 可选项
|
||||
* - 通过[Builder.staticParams]设置
|
||||
*/
|
||||
val staticParams by lazy {
|
||||
builder.staticParams ?: HashMap<String, Any>()
|
||||
}
|
||||
|
||||
/**
|
||||
* - 基础Url, 默认值为`http://dzt-launcherSnapshot.zhidaozhixing.com`
|
||||
* - 可选项
|
||||
* - 通过[Builder.baseUrl]设置
|
||||
*/
|
||||
val baseUrl by lazy {
|
||||
builder.baseUrl ?: "http://dzt-launcherSnapshot.zhidaozhixing.com"
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* - 多长时间请求一次自车周边信息,单位为毫秒,默认值为`6_000`毫秒
|
||||
* - 可选项
|
||||
* - 通过[Builder.durationForTriggerRefresh]设置
|
||||
*/
|
||||
val durationForTriggerRefresh by lazy {
|
||||
val duration = builder.durationForTriggerRefresh
|
||||
if (duration == null || duration <= 0) TimeUnit.SECONDS.toMillis(60) else duration
|
||||
}
|
||||
|
||||
/**
|
||||
* - 自车行驶超过此长度,会刷新自车周边信息,单位为`米`
|
||||
* - 可选项
|
||||
* - 通过[Builder.distanceForTriggerRefresh]设置
|
||||
*/
|
||||
val distanceForTriggerRefresh: Float by lazy {
|
||||
val distance = builder.distanceForTriggerRefresh
|
||||
if (distance == null || distance <= 0) 200f else distance
|
||||
}
|
||||
|
||||
internal fun newBuilder() = Builder(this)
|
||||
|
||||
class Builder {
|
||||
|
||||
internal var context: Context? = null
|
||||
|
||||
internal var executor: Executor? = null
|
||||
|
||||
internal var loggable: Boolean = false
|
||||
|
||||
internal var staticParams: Map<String, Any?>? = null
|
||||
|
||||
internal var aiCloudConfig: MoGoAiCloudClientConfig? = null
|
||||
|
||||
internal var durationForTriggerRefresh: Long? = null
|
||||
|
||||
internal var baseUrl: String? = null
|
||||
|
||||
internal var distanceForTriggerRefresh: Float? = null
|
||||
|
||||
constructor()
|
||||
|
||||
internal constructor(config: V2XConfig) {
|
||||
context = config.context
|
||||
executor = config.executor
|
||||
loggable = config.loggable
|
||||
baseUrl = config.baseUrl
|
||||
staticParams = config.staticParams
|
||||
aiCloudConfig = config.aiCloudConfig
|
||||
durationForTriggerRefresh = config.durationForTriggerRefresh
|
||||
distanceForTriggerRefresh = config.distanceForTriggerRefresh
|
||||
}
|
||||
|
||||
/**
|
||||
* 应用上下文,此参数为必选项,不设置会抛异常
|
||||
*/
|
||||
fun context(context: Context) = apply { this.context = context }
|
||||
|
||||
/**
|
||||
* 是否开启日志
|
||||
*/
|
||||
fun loggable(loggable: Boolean) = apply { this.loggable = loggable }
|
||||
|
||||
/**
|
||||
* 公共参数列表
|
||||
*/
|
||||
fun staticParams(params: Map<String, Any?>) = apply { this.staticParams = params }
|
||||
|
||||
/**
|
||||
* 网络请求线程池,如未设置,会使用内置的线程池[Executors.IO]
|
||||
*/
|
||||
fun executor(executor: Executor): Builder = apply {
|
||||
if (this.executor != null) {
|
||||
throw IllegalArgumentException("io executor has been initialized, don't set repeatedly.")
|
||||
}
|
||||
this.executor = executor
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新周边信息的时间间隔
|
||||
* @param duration 时长
|
||||
* @param unit 时间单位
|
||||
*/
|
||||
fun durationForTriggerRefresh(duration: Long, unit: TimeUnit = TimeUnit.SECONDS) = apply { this.durationForTriggerRefresh = unit.toMillis(duration) }
|
||||
|
||||
/**
|
||||
* @param distance 超过此距离会触发刷新周边道路信息,单位为米
|
||||
*/
|
||||
fun distanceForTriggerRefresh(distance: Float) = apply { this.distanceForTriggerRefresh = distance }
|
||||
|
||||
/**
|
||||
* 云平台配置信息,此参数为必选项,不设置会抛异常
|
||||
* @param config 云平台配置
|
||||
*/
|
||||
fun aiCloudConfig(config: MoGoAiCloudClientConfig) = apply { this.aiCloudConfig = config }
|
||||
|
||||
/**
|
||||
* 云平台baseUrl
|
||||
* @param baseUrl 云平台baseUrl
|
||||
*/
|
||||
fun baseUrl(baseUrl: String) = apply { this.baseUrl = baseUrl }
|
||||
|
||||
fun build() : V2XConfig = V2XConfig(this)
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.internal.data
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import java.io.Serializable
|
||||
|
||||
/**
|
||||
* 路口碰撞预警、盲区预警等数据实体
|
||||
*/
|
||||
@Keep
|
||||
class V2XAdvanceWarning: Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = -446395L
|
||||
}
|
||||
|
||||
/**
|
||||
* 物体唯一标识
|
||||
*/
|
||||
var objectId: String? = null
|
||||
|
||||
/**
|
||||
* 物体类型:
|
||||
* 1-人
|
||||
* 2-自行车
|
||||
* 3-小轿车
|
||||
* 4-摩托车
|
||||
* 5-红绿灯
|
||||
* 6-公交车
|
||||
* 8-卡车
|
||||
* 9-路边摄像头
|
||||
*/
|
||||
var objectType: Int? = -1
|
||||
|
||||
/**
|
||||
* 1-add
|
||||
* 2-update
|
||||
* 3-delete
|
||||
*/
|
||||
var status: Int? = -1
|
||||
|
||||
/**
|
||||
* 大类标识
|
||||
* 1-预警
|
||||
* 2-规划
|
||||
* 3-拥堵
|
||||
* 4-事故
|
||||
*/
|
||||
var typeId: Int? = -1
|
||||
|
||||
/**
|
||||
* 预警下发时间
|
||||
*/
|
||||
var time: Long? = 0
|
||||
|
||||
/**
|
||||
* 预警等级
|
||||
*/
|
||||
var level: Int? = -1
|
||||
|
||||
/**
|
||||
* 危险等级:
|
||||
* 0-保留
|
||||
* 1-模型原始颜色
|
||||
* 2-通知--黄
|
||||
* 3-警告--红
|
||||
*/
|
||||
var threatLevel: Int? = -1
|
||||
|
||||
/**
|
||||
* 目标预警物所在位置
|
||||
*/
|
||||
var position: V2XLocation? = null
|
||||
|
||||
/**
|
||||
* 目标预警物朝向
|
||||
*/
|
||||
var heading: Double? = 0.0
|
||||
|
||||
/**
|
||||
* 目标预警物速度
|
||||
*/
|
||||
var speed: Double? = 0.0
|
||||
|
||||
/**
|
||||
* 目标预警物到自车距离
|
||||
*/
|
||||
var distance: Double? = 0.0
|
||||
|
||||
/**
|
||||
* 道路ID
|
||||
*/
|
||||
var roadId: String? = null
|
||||
|
||||
/**
|
||||
* 车道ID
|
||||
*/
|
||||
var laneId: String? = null
|
||||
|
||||
/**
|
||||
* 车道号:
|
||||
* 中心线编号为0, 中心线右侧编号为负数。
|
||||
* eg: 3车道通行Road的车道编号,0,-1,-2,-3
|
||||
*/
|
||||
var laneNum: Int? = Integer.MIN_VALUE
|
||||
|
||||
/**
|
||||
* 线性经纬度轨迹列表(高德)
|
||||
*/
|
||||
var gdLocusList: List<V2XLocation>? = null
|
||||
|
||||
/**
|
||||
* 轨迹列表(Wgs84坐标系)
|
||||
*/
|
||||
var locusList: List<V2XLocation>? = null
|
||||
|
||||
override fun toString(): String {
|
||||
return "V2XAdvanceWarning(objectId=$objectId, objectType=$objectType, status=$status, typeId=$typeId, time=$time, level=$level, threatLevel=$threatLevel, position=$position, heading=$heading, speed=$speed, distance=$distance, roadId=$roadId, laneId=$laneId, laneNum=$laneNum, gdLocusList=$gdLocusList, locusList=$locusList)"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.internal.data
|
||||
|
||||
open class V2XBaseData {
|
||||
|
||||
@JvmField
|
||||
var code = -1
|
||||
@JvmField
|
||||
var msg: String? = null
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.internal.data
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import java.io.Serializable
|
||||
|
||||
@Keep
|
||||
class V2XLocation: Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = -93L
|
||||
}
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
var lon: Double = 0.0
|
||||
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
var lat: Double = 0.0
|
||||
|
||||
override fun toString(): String {
|
||||
return "V2XLocation(lon=$lon, lat=$lat)"
|
||||
}
|
||||
}
|
||||
@@ -1,825 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.internal.data
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay
|
||||
import com.mogo.eagle.core.data.map.entity.MarkerLocation
|
||||
import java.io.Serializable
|
||||
|
||||
@Keep
|
||||
class V2XMarkerCardResult: V2XBaseData(), Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = -92L
|
||||
}
|
||||
|
||||
/**
|
||||
* 要查询的数据类型
|
||||
* CARD_TYPE_USER_DATA:用户相关数据
|
||||
* CARD_TYPE_ROAD_CONDITION:路况数据
|
||||
* CARD_TYPE_LIVE:正播相关数据
|
||||
*/
|
||||
var dataType: List<String>? = null
|
||||
|
||||
/**
|
||||
* 车聊聊数据集合
|
||||
*/
|
||||
var carChat: List<V2XMarkerCarChat>? = null
|
||||
|
||||
/**
|
||||
* 分享的音乐数据集合
|
||||
*/
|
||||
var shareMusic: List<V2XMarkerShareMusic>? = null
|
||||
|
||||
/**
|
||||
* 新鲜事分享的数据集合
|
||||
*/
|
||||
var noveltyInfo: List<V2XMarkerNoveltyInfo>? = null
|
||||
|
||||
/**
|
||||
* 在线车辆数据集合
|
||||
*/
|
||||
var onlineCar: List<V2XMarkerOnlineCar>? = null
|
||||
|
||||
/**
|
||||
* 探路数据集合
|
||||
*/
|
||||
var exploreWay: List<MarkerExploreWay>? = null
|
||||
|
||||
/**
|
||||
* 服务端下发消息时间
|
||||
*/
|
||||
var messageTime: Long = 0
|
||||
|
||||
override fun toString(): String {
|
||||
return "MarkerCardResult(dataType=$dataType, carChat=$carChat, shareMusic=$shareMusic, noveltyInfo=$noveltyInfo, onlineCar=$onlineCar, exploreWay=$exploreWay, messageTime=$messageTime)"
|
||||
}
|
||||
}
|
||||
|
||||
@Keep
|
||||
class V2XMarkerCarChat: Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = -92L
|
||||
}
|
||||
|
||||
/**
|
||||
* 卡片类型
|
||||
*/
|
||||
var type: String? = null
|
||||
|
||||
/**
|
||||
* 地址信息
|
||||
*/
|
||||
var location: V2XMarkerLocation? = null
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
*/
|
||||
var userInfo: V2XMarkerUserInfo? = null
|
||||
|
||||
override fun toString(): String {
|
||||
return "V2XMarkerCarChat(type=$type, location=$location, userInfo=$userInfo)"
|
||||
}
|
||||
}
|
||||
|
||||
@Keep
|
||||
class V2XMarkerShareMusic: Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = -93L
|
||||
}
|
||||
|
||||
/**
|
||||
* 事件类型
|
||||
*/
|
||||
var type: String? = null
|
||||
|
||||
/**
|
||||
* 音乐专辑信息
|
||||
*/
|
||||
var bookInfo: String? = null
|
||||
|
||||
/**
|
||||
* 歌曲ID
|
||||
*/
|
||||
var id = 0
|
||||
|
||||
/**
|
||||
* 点赞数
|
||||
*/
|
||||
var likeNumber = 0
|
||||
|
||||
/**
|
||||
* 位置信息
|
||||
*/
|
||||
var location: V2XMarkerLocation? = null
|
||||
|
||||
/**
|
||||
* 已弃用
|
||||
*/
|
||||
var mediaId: String? = null
|
||||
|
||||
/**
|
||||
* 歌曲封面-已弃用
|
||||
*/
|
||||
var mediaImg: String? = null
|
||||
|
||||
/**
|
||||
* 歌曲名字
|
||||
*/
|
||||
var mediaName: String? = null
|
||||
|
||||
/**
|
||||
* 歌手名字
|
||||
*/
|
||||
var mediaSinger: String? = null
|
||||
|
||||
/**
|
||||
* 播放地址
|
||||
*/
|
||||
var mediaUrl: String? = null
|
||||
|
||||
/**
|
||||
* 分享文案
|
||||
*/
|
||||
var shareContentText: String? = null
|
||||
|
||||
/**
|
||||
* 分享类型
|
||||
*/
|
||||
var shareType = 0
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
*/
|
||||
var userInfo: V2XMarkerUserInfo? = null
|
||||
|
||||
override fun toString(): String {
|
||||
return "V2XMarkerShareMusic(bookInfo=$bookInfo, id=$id, likeNumber=$likeNumber, location=$location, mediaId=$mediaId, mediaImg=$mediaImg, mediaName=$mediaName, mediaSinger=$mediaSinger, mediaUrl=$mediaUrl, shareContentText=$shareContentText, shareType=$shareType, type=$type, userInfo=$userInfo)"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新鲜事儿Marker数据
|
||||
*/
|
||||
@Keep
|
||||
class V2XMarkerNoveltyInfo: Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = -93L
|
||||
}
|
||||
|
||||
/**
|
||||
* 事件类型
|
||||
*/
|
||||
var type: String? = null
|
||||
|
||||
/**
|
||||
* 车机唯一标识
|
||||
*/
|
||||
var sn: String? = null
|
||||
|
||||
/**
|
||||
* 标记坐标
|
||||
*/
|
||||
var location: V2XMarkerLocation? = null
|
||||
|
||||
/**
|
||||
* POI类型
|
||||
*/
|
||||
var poiType: String? = null
|
||||
|
||||
/**
|
||||
* 新鲜事分享内容
|
||||
*/
|
||||
var contentData: ContentData? = null
|
||||
|
||||
@Keep
|
||||
class ContentData: Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = -93L
|
||||
}
|
||||
|
||||
/**
|
||||
* 信息ID
|
||||
*/
|
||||
var infoId: String? = null
|
||||
|
||||
/**
|
||||
* 分享内容
|
||||
*/
|
||||
var content: String? = null
|
||||
|
||||
/**
|
||||
* 分享内容左上角图标
|
||||
*/
|
||||
var iconUrl: String? = null
|
||||
|
||||
/**
|
||||
* 分享内容图片
|
||||
*/
|
||||
var imgUrl: String? = null
|
||||
|
||||
/**
|
||||
* 点赞数
|
||||
*/
|
||||
var likeNum: Long = 0
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
var title: String? = null
|
||||
|
||||
/**
|
||||
* 加油站油价
|
||||
*/
|
||||
var gasPrices: String? = null
|
||||
|
||||
/**
|
||||
* 是否显示导航
|
||||
*/
|
||||
var isDisplayNavigation = false
|
||||
|
||||
/**
|
||||
* 是否显示好友主页
|
||||
*/
|
||||
var isDesplayHost = false
|
||||
|
||||
/**
|
||||
* 是否是新鲜的
|
||||
*/
|
||||
var isFabulous = false
|
||||
|
||||
/**
|
||||
* 分享类型
|
||||
*/
|
||||
var styleType: String? = null
|
||||
|
||||
/**
|
||||
* 上报类型:
|
||||
* 1-用户上报
|
||||
* 2-后台上报
|
||||
* 3-三方上报
|
||||
*/
|
||||
var uploadType: String? = null
|
||||
|
||||
override fun toString(): String {
|
||||
return "ContentData(content=$content, iconUrl=$iconUrl, imgUrl=$imgUrl, infoId=$infoId, likeNum=$likeNum, title=$title, gasPrices=$gasPrices, isDisplayNavigation=$isDisplayNavigation, isDesplayHost=$isDesplayHost, isFabulous=$isFabulous, styleType=$styleType, uploadType=$uploadType)"
|
||||
}
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "V2XMarkerNoveltyInfo(type=$type, sn=$sn, location=$location, poiType=$poiType, contentData=$contentData)"
|
||||
}
|
||||
}
|
||||
|
||||
@Keep
|
||||
class V2XMarkerOnlineCar: Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = -93L
|
||||
}
|
||||
|
||||
/**
|
||||
* 事件类型
|
||||
*/
|
||||
var type: String? = null
|
||||
|
||||
/**
|
||||
* 车辆位置
|
||||
*/
|
||||
var location: V2XMarkerLocation? = null
|
||||
|
||||
/**
|
||||
* focus:false-未关注,true-关注
|
||||
*/
|
||||
var focus: Boolean? = null
|
||||
|
||||
/**
|
||||
* 用户数据
|
||||
*/
|
||||
var userInfo: V2XMarkerUserInfo? = null
|
||||
|
||||
/**
|
||||
* 车辆数据
|
||||
*/
|
||||
var carInfo: V2XMarkerCarInfo? = null
|
||||
|
||||
/**
|
||||
* 车辆路线
|
||||
*/
|
||||
var pois: List<V2XMarkerCarPois>? = null
|
||||
|
||||
/**
|
||||
* 动态数据
|
||||
*/
|
||||
var dynamicData: V2XMarkerDynamicData? = null
|
||||
|
||||
/**
|
||||
* 爱好数据集合
|
||||
*/
|
||||
var hobbyData: V2XMarkerHobbyDatum? = null
|
||||
|
||||
/**
|
||||
* 活动范围数据集合
|
||||
*/
|
||||
var activitiesScope: List<V2XMarkerActivitiesScope>? = null
|
||||
|
||||
/**
|
||||
* 匹配度
|
||||
*/
|
||||
var compatibility = 0
|
||||
|
||||
override fun toString(): String {
|
||||
return "V2XMarkerOnlineCar(type=$type, location=$location, focus=$focus, userInfo=$userInfo, carInfo=$carInfo, pois=$pois, dynamicData=$dynamicData, hobbyData=$hobbyData, activitiesScope=$activitiesScope, compatibility=$compatibility)"
|
||||
}
|
||||
}
|
||||
|
||||
@Keep
|
||||
class V2XMarkerExploreWay: Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = -93L
|
||||
}
|
||||
|
||||
/**
|
||||
* 事件类型
|
||||
*/
|
||||
var type: String? = null
|
||||
|
||||
/**
|
||||
* 信息ID
|
||||
*/
|
||||
var infoId: String? = null
|
||||
|
||||
/**
|
||||
* POI类型
|
||||
*/
|
||||
var poiType: String? = null
|
||||
|
||||
/**
|
||||
* 车辆唯一标识
|
||||
*/
|
||||
var sn: String? = null
|
||||
|
||||
/**
|
||||
* 位置信息
|
||||
*/
|
||||
var location: MarkerLocation? = null
|
||||
|
||||
/**
|
||||
* 车辆方位
|
||||
*/
|
||||
var direction = 0
|
||||
|
||||
/**
|
||||
* 是否可直播(1为可直播,0不可直播)
|
||||
*/
|
||||
var canLive: String? = "0"
|
||||
|
||||
/**
|
||||
* 是图片还是视频(1视频,0图片)
|
||||
*/
|
||||
var fileType = 0
|
||||
|
||||
/**
|
||||
* 车辆详细地址
|
||||
*/
|
||||
var addr: String? = null
|
||||
|
||||
/**
|
||||
* 事件下发的时间
|
||||
*/
|
||||
var generateTime: Long = 0L
|
||||
|
||||
/**
|
||||
* 城市名称
|
||||
*/
|
||||
var cityName: String? = null
|
||||
|
||||
/**
|
||||
* 距离
|
||||
*/
|
||||
var distance = 0.0
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
*/
|
||||
var userInfo: V2XMarkerUserInfo? = null
|
||||
|
||||
/**
|
||||
* 视频地址和图片地址
|
||||
*/
|
||||
var items: List<MarkerExploreWayItem>? = null
|
||||
|
||||
/**
|
||||
* 上报类型:
|
||||
* 1-用户上报
|
||||
* 2-后台上报
|
||||
* 3-三方上报
|
||||
*/
|
||||
var uploadType: String? = null
|
||||
|
||||
/**
|
||||
* 是否是新鲜的
|
||||
*/
|
||||
var isFabulous = false
|
||||
|
||||
/**
|
||||
* 需要用户判断是否拥堵 进行UGC问答
|
||||
*/
|
||||
var infoCheckNode = 0
|
||||
|
||||
var coordinateType: Int? = null
|
||||
|
||||
/**
|
||||
* polygon字段,用来表示事件围栏
|
||||
*/
|
||||
var polygon: List<V2XLocation>? = null
|
||||
|
||||
|
||||
/**
|
||||
* 事件的高精坐标
|
||||
*/
|
||||
var gpsLocation: V2XLocation? = null
|
||||
|
||||
override fun toString(): String {
|
||||
return "V2XMarkerExploreWay(infoId=$infoId, type=$type, poiType=$poiType, sn=$sn, location=$location, direction=$direction, canLive=$canLive, fileType=$fileType, addr=$addr, generateTime=$generateTime, cityName=$cityName, distance=$distance, userInfo=$userInfo, items=$items, uploadType=$uploadType, isFabulous=$isFabulous, infoCheckNode=$infoCheckNode, coordinateType=$coordinateType)"
|
||||
}
|
||||
}
|
||||
|
||||
@Keep
|
||||
class V2XMarkerUserInfo: Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = -93L
|
||||
}
|
||||
|
||||
/**
|
||||
* 自车车机唯一标识
|
||||
*/
|
||||
var sn: String? = null
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
var userId: Long = 0
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
var userName: String? = null
|
||||
|
||||
/**
|
||||
* 用户头像
|
||||
*/
|
||||
var userHead: String? = null
|
||||
|
||||
/**
|
||||
* gender": "男|女|无(也可以0|1|2根据实际库存返回即可)
|
||||
*/
|
||||
var gender: String? = null
|
||||
|
||||
/**
|
||||
* 年龄段,可以为空,与车聊聊一致
|
||||
*/
|
||||
var age: Int? = null
|
||||
|
||||
/**
|
||||
* 末次活跃周驾驶行为平均得分
|
||||
*/
|
||||
var lastActiveweekAvgscore: String? = null
|
||||
|
||||
/**
|
||||
* 车辆安全标签
|
||||
*/
|
||||
var safeLabel: String? = null
|
||||
|
||||
/**
|
||||
* 1-老司机
|
||||
* 2-安全驾驶
|
||||
* 3-危险驾驶
|
||||
*/
|
||||
var safeLabelType = 0
|
||||
|
||||
override fun toString(): String {
|
||||
return "V2XMarkerUserInfo(sn=$sn, userId=$userId, userName=$userName, userHead=$userHead, gender=$gender, age=$age, lastActiveweekAvgscore=$lastActiveweekAvgscore, safeLabel=$safeLabel, safeLabelType=$safeLabelType)"
|
||||
}
|
||||
}
|
||||
|
||||
@Keep
|
||||
class V2XMarkerCarInfo: Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = -93L
|
||||
}
|
||||
|
||||
/**
|
||||
* 车品牌Logo资源链接
|
||||
*/
|
||||
var carBrandLogoUrl: String? = null
|
||||
|
||||
/**
|
||||
* 车型名称
|
||||
*/
|
||||
var carTypeName: String? = null
|
||||
|
||||
/**
|
||||
* 车类型:
|
||||
* 0-普通车辆
|
||||
* 1-警车
|
||||
* 2-救护车
|
||||
* 3-失控车
|
||||
* 4-道路救援车
|
||||
*/
|
||||
var vehicleType: Int = 0
|
||||
|
||||
/**
|
||||
* 车辆直播相关信息
|
||||
*/
|
||||
var carLiveInfo: CarLiveInfo? = null
|
||||
|
||||
@Keep
|
||||
class CarLiveInfo: Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = -93L
|
||||
}
|
||||
|
||||
/**
|
||||
* rtmp视频直播地址rtmp://
|
||||
*/
|
||||
var videoUrl: String? = null
|
||||
|
||||
/**
|
||||
* 直播频道【直播心跳接口参数】C_1
|
||||
*/
|
||||
var videoChannel: String? = null
|
||||
|
||||
/**
|
||||
* 直播源sn
|
||||
*/
|
||||
var videoSn: String? = null
|
||||
|
||||
override fun toString(): String {
|
||||
return "CarLiveInfo(videoUrl=$videoUrl, videoChannel=$videoChannel, videoSn=$videoSn)"
|
||||
}
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "V2XMarkerCarInfo(carBrandLogoUrl=$carBrandLogoUrl, carTypeName=$carTypeName, vehicleType=$vehicleType, carLiveInfo=$carLiveInfo)"
|
||||
}
|
||||
}
|
||||
|
||||
@Keep
|
||||
class V2XMarkerCarPois: Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = -93L
|
||||
}
|
||||
|
||||
/**
|
||||
* 位置信息,返回的值不为空并且长度为2的倍数
|
||||
*/
|
||||
var coordinates: List<*>? = null
|
||||
|
||||
/**
|
||||
* 车的朝向角度
|
||||
*/
|
||||
var angle = 0.0
|
||||
|
||||
/**
|
||||
* 地区code
|
||||
*/
|
||||
var adcode: String? = null
|
||||
|
||||
override fun toString(): String {
|
||||
return "V2XMarkerCarPois(coordinates=$coordinates, angle=$angle, adcode=$adcode)"
|
||||
}
|
||||
}
|
||||
|
||||
@Keep
|
||||
class V2XMarkerDynamicData: Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = -93L
|
||||
}
|
||||
|
||||
/**
|
||||
* QQ音乐,懒人听书,乐听头条 2 为书籍听书,3 为新闻,1 为qq音乐
|
||||
*/
|
||||
var type = 0
|
||||
|
||||
/**
|
||||
* qq音乐id,书的bookId
|
||||
*/
|
||||
var mediaId: String? = null
|
||||
|
||||
/**
|
||||
* qq音乐url 懒人听书为“”
|
||||
*/
|
||||
var mediaUrl: String? = null
|
||||
|
||||
/**
|
||||
* 歌曲名 ,当前播放书名,新闻标题内容
|
||||
*/
|
||||
var mediaName: String? = null
|
||||
|
||||
/**
|
||||
* 演唱歌手,当前章节,新闻来源
|
||||
*/
|
||||
var mediaSinger: String? = null
|
||||
|
||||
/**
|
||||
* 歌曲封面,书籍封面,新闻预览图
|
||||
*/
|
||||
var mediaImg: String? = null
|
||||
|
||||
/**
|
||||
* 音乐类别,类似经典 ,流行只有qq特有
|
||||
*/
|
||||
var mediaType: String? = null
|
||||
|
||||
/**
|
||||
* 音频总时长
|
||||
*/
|
||||
var maxTime = 0
|
||||
|
||||
/**
|
||||
* 懒人听书json串
|
||||
*/
|
||||
var bookInfo: String? = null
|
||||
|
||||
/**
|
||||
* 当前播放时长,可以不加,播放进度单独独立出来
|
||||
*/
|
||||
var curTime = 0
|
||||
|
||||
/**
|
||||
* 是否是本地音频,只有qq音乐
|
||||
*/
|
||||
var isLocalMedia = false
|
||||
|
||||
/**
|
||||
* 播放模式,顺序,单曲循环,随机
|
||||
*/
|
||||
var mediaPlayMode = 0
|
||||
|
||||
/**
|
||||
* 1 播放 2 缓冲 0 暂停/停止 -1 播放错误
|
||||
*/
|
||||
var playState = 0
|
||||
|
||||
override fun toString(): String {
|
||||
return "V2XMarkerDynamicData(type=$type, mediaId=$mediaId, mediaUrl=$mediaUrl, mediaName=$mediaName, mediaSinger=$mediaSinger, mediaImg=$mediaImg, mediaType=$mediaType, maxTime=$maxTime, bookInfo=$bookInfo, curTime=$curTime, isLocalMedia=$isLocalMedia, mediaPlayMode=$mediaPlayMode, playState=$playState)"
|
||||
}
|
||||
}
|
||||
|
||||
@Keep
|
||||
class V2XMarkerHobbyDatum: Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = -93L
|
||||
}
|
||||
|
||||
/**
|
||||
* 最喜欢的两位歌手
|
||||
*/
|
||||
var singerTop2: List<MarkerOnlineTag>? = null
|
||||
|
||||
/**
|
||||
* 最喜欢的两种音乐类型
|
||||
*/
|
||||
var songTypeTop2: List<MarkerOnlineTag>? = null
|
||||
|
||||
/**
|
||||
* 最喜欢的资讯类型
|
||||
*/
|
||||
var newsType: List<MarkerOnlineTag>? = null
|
||||
|
||||
/**
|
||||
* 最喜欢听的两本书
|
||||
*/
|
||||
var listenBookTop2: List<MarkerOnlineTag>? = null
|
||||
|
||||
/**
|
||||
* 是否喜爱社交
|
||||
*/
|
||||
var ifSociety: List<MarkerOnlineTag>? = null
|
||||
|
||||
@Keep
|
||||
class MarkerOnlineTag: Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = -93L
|
||||
}
|
||||
|
||||
/**
|
||||
* 社交内容
|
||||
*/
|
||||
var content: String? = null
|
||||
|
||||
/**
|
||||
* 是否选中
|
||||
*/
|
||||
var isCheck: Boolean = false
|
||||
|
||||
override fun toString(): String {
|
||||
return "MarkerOnlineTag(content=$content, isCheck=$isCheck)"
|
||||
}
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "V2XMarkerHobbyDatum(singerTop2=$singerTop2, songTypeTop2=$songTypeTop2, newsType=$newsType, listenBookTop2=$listenBookTop2, ifSociety=$ifSociety)"
|
||||
}
|
||||
}
|
||||
|
||||
@Keep
|
||||
class V2XMarkerActivitiesScope: Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = -93L
|
||||
}
|
||||
|
||||
/**
|
||||
* 活动范围内容
|
||||
*/
|
||||
var content: String? = null
|
||||
|
||||
/**
|
||||
* 是否选中
|
||||
*/
|
||||
var isCheck: Boolean = false
|
||||
|
||||
override fun toString(): String {
|
||||
return "V2XMarkerActivitiesScope(content=$content, isCheck=$isCheck)"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 道路情报,V2X预警,地图道路事件POI,违章停车POI等
|
||||
*/
|
||||
@Keep
|
||||
class MarkerExploreWayItem: Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = -93L
|
||||
}
|
||||
|
||||
/**
|
||||
* 缩略图
|
||||
*/
|
||||
var thumbnail: String? = null
|
||||
|
||||
/**
|
||||
* 正式图
|
||||
*/
|
||||
var url: String? = null
|
||||
|
||||
/**
|
||||
* 描述字段
|
||||
*/
|
||||
var content: String? = null
|
||||
|
||||
/**
|
||||
* 违章停车人数
|
||||
*/
|
||||
var illegalCount = 0.0
|
||||
|
||||
override fun toString(): String {
|
||||
return "MarkerExploreWayItem(thumbnail=$thumbnail, url=$url, content=$content, illegalCount=$illegalCount)"
|
||||
}
|
||||
}
|
||||
|
||||
@Keep
|
||||
class V2XMarkerLocation: Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = -93L
|
||||
}
|
||||
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
var lat: Double = 0.0
|
||||
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
var lon: Double = 0.0
|
||||
|
||||
/**
|
||||
* 车头角度,可以没有
|
||||
*/
|
||||
var angle: Double = 0.0
|
||||
|
||||
/**
|
||||
* 具体的位置信息
|
||||
*/
|
||||
var address: String? = null
|
||||
|
||||
override fun toString(): String {
|
||||
return "V2XMarkerLocation(lat=$lat, lon=$lon, angle=$angle, address=$address)"
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.internal.data
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import com.elegant.network.BaseResp
|
||||
import com.mogo.eagle.core.function.v2x.internal.data.V2XMarkerCardResult
|
||||
import java.io.Serializable
|
||||
|
||||
@Keep
|
||||
class V2XMarkerResponse: BaseResp(), Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = -93L
|
||||
}
|
||||
|
||||
/**
|
||||
* 响应的数据集
|
||||
*/
|
||||
var result: V2XMarkerCardResult? = null
|
||||
|
||||
/**
|
||||
* TODO 不知道啥含义,可以忽略
|
||||
*/
|
||||
var sign: String? = null
|
||||
|
||||
override fun toString(): String {
|
||||
return "V2XMarkerResponse(result=$result, sign=$sign)"
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.internal.data
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import com.mogo.eagle.core.function.v2x.internal.data.V2XLocation
|
||||
import java.io.Serializable
|
||||
|
||||
/**
|
||||
* 最优路线推荐
|
||||
*/
|
||||
@Keep
|
||||
class V2XOptimalRoute: Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = -93L
|
||||
}
|
||||
|
||||
/**
|
||||
* 自车SN
|
||||
*/
|
||||
var sn: String? = null
|
||||
|
||||
/**
|
||||
* 道路ID
|
||||
*/
|
||||
var road_id: String? = null
|
||||
|
||||
/**
|
||||
* 车道ID-2D路段
|
||||
*/
|
||||
var current_lane_id: String? = null
|
||||
|
||||
/**
|
||||
* 车道号:中心线编号为0, 中心线右侧编号为负数,3车道通行Road的车道编号,0,-1,-2,-3
|
||||
*/
|
||||
var current_lane_num = 0
|
||||
|
||||
/**
|
||||
* 最优车道平均速度
|
||||
*/
|
||||
var most_speed = 0.0
|
||||
|
||||
/**
|
||||
* 车道号:中心线编号为0, 中心线右侧编号为负数,3车道通行Road的车道编号,0,-1,-2,-3
|
||||
*/
|
||||
var most_lane_num = 0
|
||||
|
||||
/**
|
||||
* Wgs84坐标系,线性经纬度轨迹列表
|
||||
*/
|
||||
var locus_list: List<V2XLocation>? = null
|
||||
|
||||
/**
|
||||
* 高德坐标系Gcj,线性经纬度轨迹列表
|
||||
*/
|
||||
var gd_locus_list: List<V2XLocation>? = null
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.internal.data
|
||||
|
||||
import androidx.annotation.Keep
|
||||
|
||||
|
||||
@Keep
|
||||
data class V2XRoadXData(
|
||||
val poiType: String? = null,
|
||||
val center: Point? = null,
|
||||
val centerRoad: CenterRoad? = null,
|
||||
val congestionLanes: List<Congestion>? = null,
|
||||
val coordinateType: Int? = -1,
|
||||
val id: String? = null,
|
||||
val index: String? = null,
|
||||
val obstacles: List<Obstacle>? = null,
|
||||
val polygon: List<Point>? = null,
|
||||
val type: Int? = 0,
|
||||
val detectTime: Long? = 0L,
|
||||
val crossId: String? = null
|
||||
)
|
||||
|
||||
@Keep
|
||||
data class CenterRoad(
|
||||
val bearing: Double? = 0.0,
|
||||
val laneNo: Int? = null,
|
||||
val roadId: String? = null,
|
||||
val roadName: String? = null,
|
||||
val tileId: Int? = 0,
|
||||
val heading: String? = null
|
||||
)
|
||||
|
||||
@Keep
|
||||
data class Congestion(
|
||||
val laneId: Int? = null,
|
||||
val level: Int? = null
|
||||
)
|
||||
|
||||
@Keep
|
||||
data class Obstacle(
|
||||
val boundBox: List<PointX>? = null,
|
||||
val center: Point? = null,
|
||||
val id: Int? = null,
|
||||
val polygon: List<Point>? = null,
|
||||
val score: Double? = null,
|
||||
val type: Int? = null
|
||||
)
|
||||
|
||||
|
||||
@Keep
|
||||
data class Point(
|
||||
val lon: Double? = null,
|
||||
val lat: Double? = null
|
||||
)
|
||||
|
||||
@Keep
|
||||
data class PointX(
|
||||
val x: Double? = null,
|
||||
val y: Double? = null
|
||||
)
|
||||
@@ -1,176 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.internal.data
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import com.mogo.eagle.core.function.v2x.internal.data.V2XLocation
|
||||
import java.io.Serializable
|
||||
|
||||
/**
|
||||
* 预警目标物数据模型
|
||||
*/
|
||||
@Keep
|
||||
class V2XWarningTarget: Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = -93L
|
||||
}
|
||||
|
||||
/**
|
||||
* 事件类型
|
||||
* 行人-1
|
||||
* 自行车-2
|
||||
* 摩托车-4
|
||||
* 骑行车辆-11
|
||||
*/
|
||||
var type = 0
|
||||
|
||||
/**
|
||||
* 目标物纬度
|
||||
*/
|
||||
var lat = 0.0
|
||||
|
||||
/**
|
||||
* 目标物经度
|
||||
*/
|
||||
var lon = 0.0
|
||||
|
||||
/**
|
||||
* 目标物颜色
|
||||
*/
|
||||
var targetColor: String? = null
|
||||
|
||||
/**
|
||||
* 目标物距自车距离
|
||||
*/
|
||||
var distance = 0.0
|
||||
|
||||
/**
|
||||
* 预测碰撞点位置-纬度
|
||||
*/
|
||||
var collisionLat = 0.0
|
||||
|
||||
/**
|
||||
* 预测碰撞点位置-经度
|
||||
*/
|
||||
var collisionLon = 0.0
|
||||
|
||||
/**
|
||||
* 目标物行驶朝向
|
||||
*/
|
||||
var angle = 0.0
|
||||
|
||||
/**
|
||||
* 目标物方位
|
||||
* 方位:前 后 左 右
|
||||
*/
|
||||
var direction = 0
|
||||
|
||||
/**
|
||||
* 目标物速度
|
||||
*/
|
||||
var speed = 0f
|
||||
|
||||
/**
|
||||
* 停止线经纬度
|
||||
*/
|
||||
var stopLines: List<V2XLocation>? = null
|
||||
|
||||
/**
|
||||
* 自车到停止线距离
|
||||
*/
|
||||
var stopLineDistance = 0.0
|
||||
|
||||
/**
|
||||
* 道路唯一标识
|
||||
*/
|
||||
var roadId: String? = null
|
||||
|
||||
/**
|
||||
* 车道唯一标识
|
||||
*/
|
||||
var laneId: String? = null
|
||||
|
||||
/**
|
||||
* 识别物体唯一标识
|
||||
*/
|
||||
var uuid: String? = null
|
||||
|
||||
/**
|
||||
* 红绿灯颜色
|
||||
*/
|
||||
var color: String? = null
|
||||
|
||||
/**
|
||||
* 车ID 暂不使用
|
||||
*/
|
||||
var carId: String? = null
|
||||
|
||||
/**
|
||||
* 预警文案
|
||||
*/
|
||||
var warningContent: String? = null
|
||||
|
||||
/**
|
||||
* 车头朝向
|
||||
*/
|
||||
var heading = 0.0
|
||||
|
||||
/**
|
||||
* 系统时间 暂时没用
|
||||
*/
|
||||
var systemTime: Long = 0
|
||||
|
||||
/**
|
||||
* 定位卫星时间 暂时没用
|
||||
*/
|
||||
var satelliteTime: Long = 0
|
||||
|
||||
/**
|
||||
* 预警蒙层等展示时长
|
||||
*/
|
||||
var showTime: Long = 0
|
||||
|
||||
/**
|
||||
* 设计划线宽度与道路同宽
|
||||
*/
|
||||
var roadwidth = 0f
|
||||
|
||||
/**
|
||||
* 自组字段, tts播报
|
||||
*/
|
||||
var tts: String? = null
|
||||
|
||||
/**
|
||||
* 自车位置
|
||||
*/
|
||||
var carLocation: V2XLocation? = null
|
||||
|
||||
override fun toString(): String {
|
||||
return "V2XWarningEntity{" +
|
||||
"type=" + type +
|
||||
", lat=" + lat +
|
||||
", lon=" + lon +
|
||||
", targetColor='" + targetColor + '\'' +
|
||||
", distance=" + distance +
|
||||
", collisionLat=" + collisionLat +
|
||||
", collisionLon=" + collisionLon +
|
||||
", angle=" + angle +
|
||||
", direction=" + direction +
|
||||
", speed=" + speed +
|
||||
", stopLines=" + stopLines +
|
||||
", stopLineDistance=" + stopLineDistance +
|
||||
", roadId='" + roadId + '\'' +
|
||||
", laneId='" + laneId + '\'' +
|
||||
", uuid='" + uuid + '\'' +
|
||||
", color='" + color + '\'' +
|
||||
", carId='" + carId + '\'' +
|
||||
", warningContent='" + warningContent + '\'' +
|
||||
", heading=" + heading +
|
||||
", systemTime=" + systemTime +
|
||||
", satelliteTime=" + satelliteTime +
|
||||
", showTime=" + showTime +
|
||||
", roadwidth=" + roadwidth +
|
||||
", tts='" + tts + '\'' +
|
||||
", carLocation=" + carLocation +
|
||||
'}'
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.internal.event
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.internal.data.*
|
||||
import roadwork.Road.RW_PB
|
||||
|
||||
sealed class V2XEvent {
|
||||
|
||||
/**
|
||||
* 长链-路口碰撞预警、盲区预警等通用Bean
|
||||
*/
|
||||
class ForwardsWarning(val type: Int = 404000, val data: V2XAdvanceWarning): V2XEvent() {
|
||||
override fun toString(): String {
|
||||
return "ForwardsWarning(type=$type, data=$data)"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 长链-最优推荐线种
|
||||
*/
|
||||
class OptimalRoute(val type: Int = 402000, val data: V2XOptimalRoute): V2XEvent() {
|
||||
override fun toString(): String {
|
||||
return "OptimalRoute(type=$type, data=$data)"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 长链-预警目标物
|
||||
*/
|
||||
class Warning(val type: Int = 401018, val data: V2XWarningTarget): V2XEvent() {
|
||||
override fun toString(): String {
|
||||
return "Warning(type=$type, data=$data)"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 长链-道路事件
|
||||
*/
|
||||
class Road(val type: Int = 401012, val data: V2XMarkerCardResult): V2XEvent() {
|
||||
override fun toString(): String {
|
||||
return "Road(type=$type, data=$data)"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 长链-道路事件云识别
|
||||
*/
|
||||
class RoadAI(val type: Int = 503000, val data: RW_PB): V2XEvent() {
|
||||
|
||||
override fun toString(): String {
|
||||
return "RoadAI(type=$type, data=$data)"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 短链-道路标记事件
|
||||
*/
|
||||
class Marker(val data: V2XMarkerResponse): V2XEvent() {
|
||||
|
||||
override fun toString(): String {
|
||||
return "Marker(data=$data)"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 长链-道路事件扩展数据结构
|
||||
*/
|
||||
class RoadEventX(val type: Int = 70001, val data: V2XRoadXData): V2XEvent() {
|
||||
|
||||
override fun toString(): String {
|
||||
return "RoadEventX(type=$type, data=$data)"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.internal.executor
|
||||
|
||||
import java.util.concurrent.*
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
|
||||
|
||||
internal object Executors {
|
||||
|
||||
private val group: ThreadGroup by lazy {
|
||||
ThreadGroup("v2x-group")
|
||||
}
|
||||
|
||||
private val CPU_CORE_COUNT by lazy {
|
||||
Runtime.getRuntime().availableProcessors()
|
||||
}
|
||||
|
||||
private val DEFAULT_CORE_COUNT by lazy {
|
||||
(max(2, min(CPU_CORE_COUNT - 1, 6)) * 3) + 1
|
||||
}
|
||||
|
||||
private const val DEFAULT_MAX_COUNT_4_IO = 128
|
||||
|
||||
val IO by lazy {
|
||||
val idGenerator = AtomicLong(0)
|
||||
ThreadPoolExecutor(
|
||||
DEFAULT_CORE_COUNT, DEFAULT_MAX_COUNT_4_IO, 30, TimeUnit.SECONDS, LinkedBlockingDeque()
|
||||
) { r ->
|
||||
Thread(group, r).apply {
|
||||
name = "io-thread-${idGenerator.getAndIncrement()}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,14 +4,25 @@ import com.elegant.network.utils.GsonUtil
|
||||
import com.elegant.network.utils.SignUtil
|
||||
import com.elegant.utils.CommonUtils
|
||||
import com.mogo.cloud.network.RetrofitFactory
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.constants.HostConst
|
||||
import com.mogo.eagle.core.function.v2x.internal.V2XManager
|
||||
import com.mogo.eagle.core.function.v2x.internal.config.V2XConfig
|
||||
import com.mogo.eagle.core.function.v2x.internal.data.V2XLocation
|
||||
import com.mogo.eagle.core.function.v2x.internal.data.V2XMarkerResponse
|
||||
import com.mogo.commons.network.ParamsUtil
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxType
|
||||
import com.mogo.eagle.core.data.msgbox.V2XMsg
|
||||
import com.mogo.eagle.core.data.v2x.V2XEventData
|
||||
import com.mogo.eagle.core.data.v2x.V2XLocation
|
||||
import com.mogo.eagle.core.data.v2x.V2XMarkerResponse
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
|
||||
import com.mogo.eagle.core.function.v2x.events.V2XPoiLoader
|
||||
import com.mogo.eagle.core.function.v2x.internal.http.api.V2XApiService
|
||||
import com.mogo.eagle.core.function.v2x.internal.http.body.V2XRefreshEntity
|
||||
import com.mogo.eagle.core.function.v2x.internal.http.callback.IV2XRefreshCallback
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.DeviceUtils
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.Disposable
|
||||
@@ -21,17 +32,18 @@ internal class V2XRefreshModel {
|
||||
|
||||
companion object {
|
||||
|
||||
private const val TAG = "V2XRefreshModel"
|
||||
|
||||
fun querySnapshot(
|
||||
longitude: Double,
|
||||
latitude: Double,
|
||||
callback: IV2XRefreshCallback<V2XMarkerResponse>?
|
||||
): Disposable? {
|
||||
val config = V2XManager.getConfig()
|
||||
val retrofit = RetrofitFactory.getInstance(HostConst.getEagleHost()) ?: return null
|
||||
return retrofit
|
||||
.create(V2XApiService::class.java)
|
||||
.querySnapshotSync(buildParams(longitude, latitude, config))
|
||||
.subscribeOn(Schedulers.from(config.executor))
|
||||
.querySnapshotSync(buildParams(longitude, latitude))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({ data ->
|
||||
if (data == null) {
|
||||
@@ -51,9 +63,8 @@ internal class V2XRefreshModel {
|
||||
private fun buildParams(
|
||||
longitude: Double,
|
||||
latitude: Double,
|
||||
config: V2XConfig
|
||||
): Map<String, Any> = mutableMapOf<String, Any>().apply {
|
||||
putAll(config.staticParams.let {
|
||||
putAll(ParamsUtil.getStaticParams().let {
|
||||
val handled = mutableMapOf<String, Any>()
|
||||
it.asIterable().forEach { itx ->
|
||||
val value = itx.value
|
||||
@@ -63,10 +74,10 @@ internal class V2XRefreshModel {
|
||||
}
|
||||
handled
|
||||
})
|
||||
this["netType"] = CommonUtils.getNetworkType(config.context)
|
||||
this["netType"] = CommonUtils.getNetworkType(AbsMogoApplication.getApp())
|
||||
this["cellId"] = DeviceUtils.getCellId() ?: ""
|
||||
this["sn"] = config.aiCloudConfig.sn
|
||||
this["ticket"] = config.aiCloudConfig.token
|
||||
this["sn"] = MoGoAiCloudClientConfig.getInstance().sn
|
||||
this["ticket"] = MoGoAiCloudClientConfig.getInstance().token
|
||||
this["sig"] = SignUtil.createSign(this, "JGjZx6")
|
||||
this["data"] = GsonUtil.jsonFromObject(V2XRefreshEntity().apply {
|
||||
limit = 999
|
||||
@@ -79,6 +90,34 @@ internal class V2XRefreshModel {
|
||||
viewPush = true
|
||||
})
|
||||
}
|
||||
|
||||
private var v2xEventDisposable: Disposable? = null
|
||||
|
||||
fun roadEventDispose(){
|
||||
if (v2xEventDisposable != null && !v2xEventDisposable!!.isDisposed) {
|
||||
v2xEventDisposable!!.dispose()
|
||||
}
|
||||
}
|
||||
|
||||
fun getRoadEvents(lineId: String, sn: String, onSuccess:((List<V2XEventData>?) -> Unit)){
|
||||
v2xEventDisposable = MoGoRetrofitFactory.getInstance(HostConst.getHost())
|
||||
.create(V2XApiService::class.java)
|
||||
.queryAllV2XEventsByLineId(lineId, sn)
|
||||
.map {
|
||||
if (it.code == 200 || it.code == 0) {
|
||||
CallerLogger.d(SceneConstant.M_V2X + TAG, "请求成功,size为:${it.result?.v2XEventList?.size}")
|
||||
return@map it.result?.v2XEventList
|
||||
} else {
|
||||
CallerLogger.d(SceneConstant.M_V2X + TAG, "请求失败,code为:${it.code}")
|
||||
return@map ArrayList()
|
||||
}
|
||||
}
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe {
|
||||
onSuccess.invoke(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
package com.mogo.eagle.core.function.v2x.internal.http.api
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.internal.data.V2XMarkerResponse
|
||||
import com.mogo.eagle.core.data.v2x.V2XEventResult
|
||||
import com.mogo.eagle.core.data.v2x.V2XMarkerResponse
|
||||
import io.reactivex.Maybe
|
||||
import retrofit2.http.FieldMap
|
||||
import retrofit2.http.FormUrlEncoded
|
||||
import retrofit2.http.POST
|
||||
import io.reactivex.Observable
|
||||
import retrofit2.http.*
|
||||
|
||||
internal interface V2XApiService {
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("eagle-eye-dns/yycp-launcherSnapshot/launcherSnapshot/querySnapshotSync")
|
||||
fun querySnapshotSync(@FieldMap parameters: Map<String, @JvmSuppressWildcards Any>): Maybe<V2XMarkerResponse?>
|
||||
|
||||
@GET("/eagleEye-mis/config/queryV2NInformation")
|
||||
fun queryAllV2XEventsByLineId(@Query("lineId") lineId: String, @Query("sn") sn: String): Observable<V2XEventResult>
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.eagle.core.function.v2x.internal.http.body
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import com.mogo.eagle.core.function.v2x.internal.data.V2XLocation
|
||||
import com.mogo.eagle.core.data.v2x.V2XLocation
|
||||
|
||||
/**
|
||||
* 刷新地图信息接口
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.internal.logger
|
||||
|
||||
import android.util.Log
|
||||
|
||||
internal object V2XLogger {
|
||||
|
||||
var loggable: Boolean = false
|
||||
|
||||
fun v(tag: String, msg: String) = if (loggable) Log.v(tag, msg) else 0
|
||||
|
||||
fun d(tag: String, msg: String) = if (loggable) Log.d(tag, msg) else 0
|
||||
|
||||
fun i(tag: String, msg: String) = if (loggable) Log.i(tag, msg) else 0
|
||||
|
||||
fun w(tag: String, msg: String) = if (loggable) Log.w(tag, msg) else 0
|
||||
|
||||
fun e(tag: String, msg: String, t: Throwable? = null) = if (loggable) {
|
||||
if (t == null) {
|
||||
Log.e(tag, msg)
|
||||
} else {
|
||||
Log.e(tag, msg, t)
|
||||
}
|
||||
} else 0
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.internal.socket
|
||||
|
||||
import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener
|
||||
import com.mogo.eagle.core.function.v2x.internal.V2XManager
|
||||
import com.mogo.eagle.core.function.v2x.internal.callback.IV2XCallback
|
||||
import com.mogo.eagle.core.function.v2x.internal.data.V2XMarkerCardResult
|
||||
import com.mogo.eagle.core.function.v2x.internal.event.V2XEvent
|
||||
import com.mogo.eagle.core.function.v2x.internal.logger.V2XLogger
|
||||
|
||||
internal class V2XMessageListener_401012(val cbs: Iterable<IV2XCallback>?): IMogoCloudSocketOnMessageListener<V2XMarkerCardResult> {
|
||||
|
||||
override fun target(msgType: Int): Class<V2XMarkerCardResult> = V2XMarkerCardResult::class.java
|
||||
|
||||
override fun onMsgReceived(msgType: Int, data: V2XMarkerCardResult?) {
|
||||
if (msgType != 401012) {
|
||||
return
|
||||
}
|
||||
if (data == null) {
|
||||
V2XLogger.i(V2XManager.TAG, "V2XMessageListener_401012:message is null!")
|
||||
return
|
||||
}
|
||||
V2XLogger.i(V2XManager.TAG, "V2XMessageListener_401012:$data")
|
||||
cbs?.forEach {
|
||||
it.onAck(V2XEvent.Road(data = data))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.internal.socket
|
||||
|
||||
import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener
|
||||
import com.mogo.eagle.core.function.v2x.internal.V2XManager
|
||||
import com.mogo.eagle.core.function.v2x.internal.callback.IV2XCallback
|
||||
import com.mogo.eagle.core.function.v2x.internal.event.V2XEvent
|
||||
import com.mogo.eagle.core.function.v2x.internal.data.V2XWarningTarget
|
||||
import com.mogo.eagle.core.function.v2x.internal.logger.V2XLogger
|
||||
|
||||
internal class V2XMessageListener_401018(val cbs: Iterable<IV2XCallback>?): IMogoCloudSocketOnMessageListener<V2XWarningTarget> {
|
||||
|
||||
override fun target(msgType: Int): Class<V2XWarningTarget> = V2XWarningTarget::class.java
|
||||
|
||||
override fun onMsgReceived(msgType: Int, data: V2XWarningTarget?) {
|
||||
if (msgType != 401018) {
|
||||
return
|
||||
}
|
||||
if (data == null) {
|
||||
V2XLogger.i(V2XManager.TAG, "V2XMessageListener_401018:message is null!")
|
||||
return
|
||||
}
|
||||
V2XLogger.i(V2XManager.TAG, "V2XMessageListener_401018:$data")
|
||||
cbs?.forEach {
|
||||
it.onAck(V2XEvent.Warning(data = data))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.internal.socket
|
||||
|
||||
import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener
|
||||
import com.mogo.eagle.core.function.v2x.internal.V2XManager
|
||||
import com.mogo.eagle.core.function.v2x.internal.callback.IV2XCallback
|
||||
import com.mogo.eagle.core.function.v2x.internal.data.V2XOptimalRoute
|
||||
import com.mogo.eagle.core.function.v2x.internal.event.V2XEvent
|
||||
import com.mogo.eagle.core.function.v2x.internal.logger.V2XLogger
|
||||
|
||||
internal class V2XMessageListener_402000(val cbs: Iterable<IV2XCallback>?): IMogoCloudSocketOnMessageListener<V2XOptimalRoute> {
|
||||
|
||||
override fun target(msgType: Int): Class<V2XOptimalRoute> = V2XOptimalRoute::class.java
|
||||
|
||||
override fun onMsgReceived(msgType: Int, data: V2XOptimalRoute?) {
|
||||
if (msgType != 402000) {
|
||||
return
|
||||
}
|
||||
if (data == null) {
|
||||
V2XLogger.i(V2XManager.TAG, "V2XMessageListener_402000:message is null!")
|
||||
return
|
||||
}
|
||||
V2XLogger.i(V2XManager.TAG, "V2XMessageListener_402000:$data")
|
||||
cbs?.forEach {
|
||||
it.onAck(V2XEvent.OptimalRoute(data = data))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.internal.socket
|
||||
|
||||
import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener
|
||||
import com.mogo.eagle.core.function.v2x.internal.V2XManager
|
||||
import com.mogo.eagle.core.function.v2x.internal.callback.IV2XCallback
|
||||
import com.mogo.eagle.core.function.v2x.internal.data.V2XAdvanceWarning
|
||||
import com.mogo.eagle.core.function.v2x.internal.event.V2XEvent
|
||||
import com.mogo.eagle.core.function.v2x.internal.logger.V2XLogger
|
||||
|
||||
internal class V2XMessageListener_404000(val cbs: Iterable<IV2XCallback>?): IMogoCloudSocketOnMessageListener<V2XAdvanceWarning> {
|
||||
|
||||
override fun target(msgType: Int): Class<V2XAdvanceWarning> = V2XAdvanceWarning::class.java
|
||||
|
||||
override fun onMsgReceived(msgType: Int, data: V2XAdvanceWarning?) {
|
||||
if (msgType != 404000) {
|
||||
return
|
||||
}
|
||||
if (data == null) {
|
||||
V2XLogger.i(V2XManager.TAG, "V2XMessageListener_404000:message is null!")
|
||||
return
|
||||
}
|
||||
V2XLogger.i(V2XManager.TAG, "V2XMessageListener_404000:$data")
|
||||
cbs?.forEach {
|
||||
it.onAck(V2XEvent.ForwardsWarning(data = data))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.internal.socket
|
||||
|
||||
import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener
|
||||
import com.mogo.eagle.core.function.v2x.internal.V2XManager
|
||||
import com.mogo.eagle.core.function.v2x.internal.callback.IV2XCallback
|
||||
import com.mogo.eagle.core.function.v2x.internal.event.V2XEvent.RoadAI
|
||||
import com.mogo.eagle.core.function.v2x.internal.logger.V2XLogger
|
||||
import roadwork.Road.RW_PB
|
||||
|
||||
internal class V2XMessageListener_503000(val cbs: Iterable<IV2XCallback>?): IMogoCloudSocketOnMessageListener<RW_PB> {
|
||||
|
||||
override fun target(msgType: Int): Class<RW_PB> = RW_PB::class.java
|
||||
|
||||
override fun onMsgReceived(msgType: Int, data: RW_PB?) {
|
||||
if (msgType != 503000) {
|
||||
return
|
||||
}
|
||||
if (data == null) {
|
||||
V2XLogger.i(V2XManager.TAG, "V2XMessageListener_503000:message is null!")
|
||||
return
|
||||
}
|
||||
V2XLogger.i(V2XManager.TAG, "V2XMessageListener_503000:$data")
|
||||
cbs?.forEach {
|
||||
it.onAck(RoadAI(data = data))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.internal.socket
|
||||
|
||||
import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener
|
||||
import com.mogo.eagle.core.function.v2x.internal.V2XManager
|
||||
import com.mogo.eagle.core.function.v2x.internal.callback.IV2XCallback
|
||||
import com.mogo.eagle.core.function.v2x.internal.data.V2XRoadXData
|
||||
import com.mogo.eagle.core.function.v2x.internal.event.V2XEvent
|
||||
import com.mogo.eagle.core.function.v2x.internal.logger.V2XLogger
|
||||
|
||||
internal class V2XMessageListener_70001(val cbs: Iterable<IV2XCallback>?): IMogoCloudSocketOnMessageListener<V2XRoadXData> {
|
||||
|
||||
override fun target(msgType: Int): Class<V2XRoadXData> = V2XRoadXData::class.java
|
||||
|
||||
override fun onMsgReceived(msgType: Int, data: V2XRoadXData?) {
|
||||
if (msgType != 70001) {
|
||||
return
|
||||
}
|
||||
if (data == null) {
|
||||
V2XLogger.i(V2XManager.TAG, "V2XMessageListener_70001:message is null!")
|
||||
return
|
||||
}
|
||||
V2XLogger.i(V2XManager.TAG, "V2XMessageListener_70001:$data")
|
||||
cbs?.forEach {
|
||||
it.onAck(V2XEvent.RoadEventX(data = data))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.road
|
||||
|
||||
import androidx.annotation.Keep
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
|
||||
|
||||
@Keep
|
||||
data class V2XEventResult (
|
||||
@SerializedName("result")
|
||||
var result: Result?
|
||||
): BaseData()
|
||||
|
||||
@Keep
|
||||
data class Result(
|
||||
@SerializedName("eventList")
|
||||
var v2XEventList: List<V2XEvent>?
|
||||
)
|
||||
|
||||
@Keep
|
||||
data class V2XEvent(
|
||||
@SerializedName("receiveTime")
|
||||
var receiveTime: Long,
|
||||
|
||||
@SerializedName("detectTime")
|
||||
var detectTime: Long,
|
||||
|
||||
@SerializedName("id")
|
||||
var id: String?,
|
||||
|
||||
@SerializedName("center")
|
||||
var center: Center?,
|
||||
|
||||
@SerializedName("centerRoad")
|
||||
var centerRoad: CenterRoad?,
|
||||
|
||||
@SerializedName("radius")
|
||||
var radius: Double,
|
||||
|
||||
@SerializedName("poiType")
|
||||
var poiType: String?,
|
||||
|
||||
@SerializedName("coordinateType")
|
||||
var coordinateType:Int? = null
|
||||
)
|
||||
|
||||
@Keep
|
||||
data class Center(
|
||||
@SerializedName("lat")
|
||||
var lat: Double,
|
||||
|
||||
@SerializedName("lon")
|
||||
var lon: Double
|
||||
)
|
||||
|
||||
@Keep
|
||||
data class CenterRoad(
|
||||
@SerializedName("bearing")
|
||||
var bearing: Double,
|
||||
|
||||
@SerializedName("laneNo")
|
||||
var laneNo: Long,
|
||||
|
||||
@SerializedName("roadId")
|
||||
var roadId: String?,
|
||||
|
||||
@SerializedName("roadName")
|
||||
var roadName: String?,
|
||||
|
||||
@SerializedName("tileId")
|
||||
var tileId: Long
|
||||
)
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.road
|
||||
|
||||
import io.reactivex.Observable
|
||||
import retrofit2.http.GET
|
||||
import retrofit2.http.Query
|
||||
|
||||
interface V2XEventServiceApi {
|
||||
|
||||
@GET("/eagleEye-mis/config/queryV2NInformation")
|
||||
fun queryAllV2XEventsByLineId(@Query("lineId") lineId: String, @Query("sn") sn: String): Observable<V2XEventResult>
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
syntax = "proto2";
|
||||
|
||||
package roadwork;
|
||||
|
||||
message RW_PB {
|
||||
required Roadwork_PB roadwork =1;
|
||||
optional Header header = 2;
|
||||
}
|
||||
|
||||
message Roadwork_PB{
|
||||
optional string id = 1; // 对应id
|
||||
required int32 score = 2; // 置信度
|
||||
required int64 detect_time = 3; // 发送时间
|
||||
required int32 poi_type = 4; // poi 类型
|
||||
optional int32 type = 5; // 事件类型
|
||||
required Center_PB center = 6; // 中心点坐标
|
||||
repeated GPSPoint_PB polygon = 7; // 多边形范围
|
||||
repeated Road_PB road = 8; // 车道集合信息
|
||||
}
|
||||
|
||||
message GPSPoint_PB {
|
||||
required double lat = 1; // 纬度
|
||||
required double lon = 2; // 经度
|
||||
optional double hgt = 3; // 高程
|
||||
}
|
||||
|
||||
message Road_PB{
|
||||
required string road_id = 1; // 路段id
|
||||
required string lane_no = 2; // 车道号
|
||||
required string tile_id = 3; // 瓦片id
|
||||
required int32 bearing = 4; // 方向角,正北是0度 顺时针
|
||||
}
|
||||
|
||||
message Center_PB{
|
||||
required Road_PB road = 1; // 道路信息
|
||||
required GPSPoint_PB point = 2; // 坐标
|
||||
}
|
||||
|
||||
// header
|
||||
|
||||
message Time {
|
||||
optional uint32 sec = 1; // 秒
|
||||
optional uint32 nsec = 2; // 纳秒
|
||||
}
|
||||
|
||||
message Header {
|
||||
// Sequence number for each message. Each module maintains its own counter for
|
||||
// sequence_num, always starting from 1 on boot.
|
||||
optional uint32 seq = 1;
|
||||
|
||||
// Message publishing time in seconds.
|
||||
optional Time stamp = 2;
|
||||
|
||||
// frame id
|
||||
optional string frame_id = 3;
|
||||
|
||||
// Module name.
|
||||
optional string module_name = 4;
|
||||
}
|
||||
Reference in New Issue
Block a user