[V2X]本地源码与远程aar版本一致
This commit is contained in:
@@ -57,7 +57,6 @@ dependencies {
|
||||
implementation 'com.zhidao.carmanager:common:1.0.25@aar'
|
||||
implementation 'com.google.android.material:material:1.3.0'
|
||||
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation "com.mogo.cloud:location:${MOGO_LOCATION_VERSION}"
|
||||
implementation "com.mogo.cloud:tanlu:${MOGO_TANLU_VERSION}"
|
||||
|
||||
@@ -12,6 +12,16 @@
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission
|
||||
android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
|
||||
|
||||
<uses-permission
|
||||
android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
|
||||
<uses-permission
|
||||
android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission
|
||||
android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
||||
|
||||
<uses-feature
|
||||
android:glEsVersion="0x00020000"
|
||||
|
||||
@@ -43,6 +43,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
private Button btnRequestCarLive;
|
||||
private Button btnV2XFunctionTest;
|
||||
|
||||
|
||||
private boolean v2xHasBeenInitialized = false;
|
||||
private Button btnNSDNetty;
|
||||
private SurfaceView surfacePreviewView;
|
||||
|
||||
@@ -7,15 +7,11 @@ import androidx.annotation.Nullable;
|
||||
import androidx.multidex.MultiDexApplication;
|
||||
|
||||
import com.auto.zhidao.logsdk.CrashSystem;
|
||||
import com.mogo.cloud.httpdns.MogoHttpDnsClient;
|
||||
import com.mogo.cloud.httpdns.MogoHttpDnsConfig;
|
||||
import com.mogo.cloud.httpdns.bean.HttpDnsSimpleLocation;
|
||||
import com.mogo.cloud.httpdns.listener.IHttpDnsCurrentLocation;
|
||||
import com.mogo.cloud.location.LocationManager;
|
||||
import com.mogo.cloud.passport.IMoGoTokenCallback;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.cloud.util.Devices;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
|
||||
5
app/src/main/res/drawable/divider.xml
Normal file
5
app/src/main/res/drawable/divider.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="#000000"/>
|
||||
</shape>
|
||||
@@ -116,6 +116,7 @@
|
||||
android:id="@+id/btnV2XFunctionTest"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="V2X模块测试"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<Button
|
||||
|
||||
6
app/src/main/res/values/dimens.xml
Normal file
6
app/src/main/res/values/dimens.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<dimen name="dp_100">100dp</dimen>
|
||||
<dimen name="dp_20">20dp</dimen>
|
||||
</resources>
|
||||
@@ -1,5 +1,6 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'org.jetbrains.dokka'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
@@ -38,4 +39,21 @@ dependencies {
|
||||
}
|
||||
}
|
||||
|
||||
dokka {
|
||||
outputFormat = 'javadoc'
|
||||
outputDirectory = "$rootDir/ApiDoc/foudations/v2x"
|
||||
|
||||
configuration {
|
||||
// Do not output deprecated members
|
||||
skipDeprecated = true
|
||||
// Emit warnings about not documented members.
|
||||
reportUndocumented = true
|
||||
// Do not create index pages for empty packages
|
||||
skipEmptyPackages = true
|
||||
noJdkLink = true
|
||||
noStdlibLink = true
|
||||
noAndroidSdkLink = true
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
@@ -3,6 +3,7 @@ package com.mogo.v2x
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import com.mogo.cloud.location.LocationManager
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.cloud.socket.SocketManager
|
||||
import com.mogo.v2x.callback.IV2XCallback
|
||||
import com.mogo.v2x.config.V2XConfig
|
||||
@@ -17,6 +18,7 @@ import com.mogo.v2x.socket.V2XMessageListener_404000
|
||||
import com.mogo.v2x.logger.Logger
|
||||
import com.mogo.v2x.utils.DistanceUtils
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
|
||||
object V2XManager {
|
||||
@@ -31,14 +33,27 @@ object V2XManager {
|
||||
CopyOnWriteArrayList<IV2XCallback>()
|
||||
}
|
||||
|
||||
private val longitude by lazy {
|
||||
private val lastLongitude by lazy {
|
||||
AtomicReference(0.0)
|
||||
}
|
||||
|
||||
private val latitude by lazy {
|
||||
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) {
|
||||
@@ -57,7 +72,7 @@ object V2XManager {
|
||||
|
||||
private val refreshTask = object : Runnable {
|
||||
override fun run() {
|
||||
V2XRefreshModel.querySnapshot(longitude = this@V2XManager.longitude.get(), latitude = this@V2XManager.latitude.get(), refreshCallback)
|
||||
V2XRefreshModel.querySnapshot(longitude = this@V2XManager.realLongitude.get(), latitude = this@V2XManager.realLatitude.get(), refreshCallback)
|
||||
handler.postDelayed(this, config.get().durationForTriggerRefresh)
|
||||
}
|
||||
}
|
||||
@@ -71,26 +86,94 @@ object V2XManager {
|
||||
* @param config 相关配置类
|
||||
*/
|
||||
fun init(config: V2XConfig) {
|
||||
Logger.d(TAG, "-- init --")
|
||||
if (this.config.get() != null) {
|
||||
throw IllegalStateException("V2XManager has been initialized, don't initialize repeatably.")
|
||||
}
|
||||
val aiCloudConfig = config.aiCloudConfig
|
||||
if (aiCloudConfig.sn?.isBlank() == true) {
|
||||
throw IllegalStateException("please ensure sn must not null.")
|
||||
}
|
||||
if (aiCloudConfig.token?.isBlank() == true) {
|
||||
throw IllegalStateException("please ensure token must not null.")
|
||||
}
|
||||
this.config.set(config)
|
||||
Logger.loggable = config.loggable
|
||||
SocketManager.getInstance().init(config.context)
|
||||
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))
|
||||
LocationManager.getInstance().init(config.context)
|
||||
LocationManager.getInstance().start()
|
||||
handler.post(refreshTask)
|
||||
}
|
||||
|
||||
/**
|
||||
* - 开启V2X功能, 此方法调用前,要确保满足以下两个条件:
|
||||
* 1.初始化方法[init]已调用
|
||||
* 2.确保[MoGoAiCloudClientConfig.sn]和[MoGoAiCloudClientConfig.token]两个值存在,如果其中有一个值不存在,不会启动相关功能
|
||||
* - 此函数的功能如下:
|
||||
* 1.建立长链接[SocketManager.init]
|
||||
* 2.位置上报服务[LocationManager.init]和[LocationManager.start]
|
||||
* 3.短链[V2XRefreshModel.querySnapshot]定时轮循,轮循时长取[V2XConfig.durationForTriggerRefresh]
|
||||
*/
|
||||
fun start() {
|
||||
Logger.d(TAG, "-- start --")
|
||||
val config = config.get() ?: throw IllegalStateException("V2XManager has not been initialized, please invoke V2XManager#init(config: X2XConfig) firstly.")
|
||||
if (started.get()) {
|
||||
Logger.d(TAG, "-- has been started --")
|
||||
return
|
||||
}
|
||||
if (config.aiCloudConfig.sn?.isBlank() == true) {
|
||||
Logger.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) {
|
||||
Logger.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)) {
|
||||
Logger.d(TAG, "-- start real --")
|
||||
SocketManager.getInstance().init(config.context)
|
||||
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))
|
||||
|
||||
|
||||
LocationManager.getInstance().init(config.context)
|
||||
LocationManager.getInstance().start()
|
||||
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() {
|
||||
Logger.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)) {
|
||||
Logger.d(TAG, "-- stop real --")
|
||||
SocketManager.getInstance().release()
|
||||
LocationManager.getInstance().stop()
|
||||
handler.removeCallbacks(refreshTask)
|
||||
lastLatitude.set(0.0)
|
||||
lastLongitude.set(0.0)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,6 +181,7 @@ object V2XManager {
|
||||
* @param cb 要添加的回调接口
|
||||
*/
|
||||
fun addCallback(cb: IV2XCallback) {
|
||||
Logger.d(TAG, "-- addCallback --")
|
||||
if (cbs.contains(cb)) {
|
||||
return
|
||||
}
|
||||
@@ -109,6 +193,7 @@ object V2XManager {
|
||||
* @param cb 要移除的回调接口
|
||||
*/
|
||||
fun removeCallback(cb: IV2XCallback) {
|
||||
Logger.d(TAG, "-- removeCallback --")
|
||||
if (!cbs.contains(cb)) {
|
||||
return
|
||||
}
|
||||
@@ -116,33 +201,41 @@ object V2XManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* 当自车位置变量时回调
|
||||
* 当自车位置变量时调用
|
||||
* @param longitude 自车所在精度
|
||||
* @param latitude 自车所在纬度
|
||||
*/
|
||||
fun onLocationChanged(longitude: Double, latitude: Double) {
|
||||
if (this.config.get() == null) {
|
||||
if (config.get() == null) {
|
||||
throw IllegalStateException("V2XManager has not been initialized, please invoke V2XManager#init(config: X2XConfig) firstly.")
|
||||
}
|
||||
if (!started.get()) {
|
||||
return
|
||||
}
|
||||
val oldLon = this.longitude.get()
|
||||
val oldLat = this.latitude.get()
|
||||
Logger.d(TAG, "--- onLocationChanged --[longitude: $longitude, latitude: $latitude]")
|
||||
realLongitude.set(longitude)
|
||||
realLatitude.set(latitude)
|
||||
val oldLon = this.lastLongitude.get()
|
||||
val oldLat = this.lastLatitude.get()
|
||||
var update = false
|
||||
try {
|
||||
if (oldLon == 0.0 || oldLat == 0.0) {
|
||||
Logger.d(TAG, "--- onLocationChanged -- first --[longitude: $longitude, latitude: $latitude]")
|
||||
handler.removeCallbacks(refreshTask)
|
||||
handler.post(refreshTask)
|
||||
update = true
|
||||
return
|
||||
}
|
||||
if (DistanceUtils.calculateLineDistance(oldLon, oldLat, longitude, latitude) >= this.config.get().distanceForTriggerRefresh) {
|
||||
Logger.d(TAG, "--- onLocationChanged -- trigger --[longitude: $longitude, latitude: $latitude]")
|
||||
handler.removeCallbacks(refreshTask)
|
||||
handler.post(refreshTask)
|
||||
update = true
|
||||
}
|
||||
} finally {
|
||||
if (update) {
|
||||
this.latitude.set(latitude)
|
||||
this.longitude.set(longitude)
|
||||
this.lastLatitude.set(latitude)
|
||||
this.lastLongitude.set(longitude)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -153,5 +246,15 @@ object V2XManager {
|
||||
*/
|
||||
fun hasInit() = this.getConfig() != null
|
||||
|
||||
/**
|
||||
* 强制刷新道路事件
|
||||
*/
|
||||
fun forceRefresh() {
|
||||
if (hasInit()) {
|
||||
handler.removeCallbacks(refreshTask)
|
||||
handler.post(refreshTask)
|
||||
}
|
||||
}
|
||||
|
||||
internal fun getConfig() = this.config.get()
|
||||
}
|
||||
@@ -3,13 +3,22 @@ package com.mogo.v2x.callback
|
||||
import com.mogo.v2x.event.V2XEvent
|
||||
|
||||
interface IV2XCallback {
|
||||
|
||||
|
||||
/**
|
||||
* 成功-对应事件
|
||||
* 获取到V2X事件成功回调
|
||||
* @param event
|
||||
* - 参数说明:目前此参数支持以下类型
|
||||
* - [V2XEvent.ForwardsWarning]: 路口碰撞预警、盲区预警等预警事件, 数据实体取自[V2XEvent.ForwardsWarning.data]
|
||||
* - [V2XEvent.Road]: 道路事件, 数据实体取自[V2XEvent.Road.data]
|
||||
* - [V2XEvent.Warning]: 预警目标物事件, 数据实体取自[V2XEvent.Warning.data]
|
||||
* - [V2XEvent.Marker]: 道路标记事件, 数据实体取自[V2XEvent.Marker.data]
|
||||
*/
|
||||
fun onAck(event: V2XEvent)
|
||||
|
||||
/**
|
||||
* 失败
|
||||
* V2X事件获取过程中,出现的异常信息,用于问题排查
|
||||
* @param msg 异常信息
|
||||
*/
|
||||
fun onFail(msg: String)
|
||||
}
|
||||
@@ -12,61 +12,65 @@ import kotlin.IllegalStateException
|
||||
*/
|
||||
class V2XConfig private constructor(builder: Builder) {
|
||||
|
||||
init {
|
||||
builder.aiCloudConfig ?: throw IllegalStateException("aiCloudConfig must not be null.")
|
||||
}
|
||||
|
||||
/**
|
||||
* 网络请求使用的线程池,IO类型
|
||||
*/
|
||||
val executor: Executor by lazy {
|
||||
builder.executor ?: Executors.IO
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否开启日志
|
||||
*/
|
||||
val loggable: Boolean by lazy {
|
||||
builder.loggable
|
||||
}
|
||||
|
||||
/**
|
||||
* 应用上下文
|
||||
* - 应用上下文
|
||||
* - 必选项
|
||||
* - 通过[Builder.context]设置
|
||||
*/
|
||||
val context : Context by lazy {
|
||||
builder.context?.applicationContext ?: throw IllegalStateException("context must not be null.")
|
||||
}
|
||||
|
||||
/**
|
||||
* 公共参数
|
||||
*/
|
||||
val staticParams by lazy {
|
||||
builder.staticParams ?: HashMap<String, Any>()
|
||||
}
|
||||
|
||||
/**
|
||||
* 云平台设置
|
||||
* - 云平台配置参数
|
||||
* - 必选项
|
||||
* - 通过[Builder.aiCloudConfig]设置
|
||||
*/
|
||||
val aiCloudConfig by lazy {
|
||||
builder.aiCloudConfig ?: throw IllegalStateException("aiCloudConfig must not be null.")
|
||||
}
|
||||
|
||||
/**
|
||||
* 应用ID(一般为应用包名)
|
||||
* - 网络请求使用的线程池,IO类型
|
||||
* - 可选项
|
||||
* - 通过[Builder.executor]设置
|
||||
*/
|
||||
val appId by lazy {
|
||||
builder.appId ?: throw IllegalStateException("appId must not be null.")
|
||||
val executor: Executor by lazy {
|
||||
builder.executor ?: Executors.IO
|
||||
}
|
||||
|
||||
/**
|
||||
* 基础Url
|
||||
* - 是否开启日志
|
||||
* - 可选项
|
||||
* - 通过[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
|
||||
@@ -74,39 +78,25 @@ class V2XConfig private constructor(builder: Builder) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 自车行驶超过此长度,会刷新自车周边信息
|
||||
* - 自车行驶超过此长度,会刷新自车周边信息,单位为`米`
|
||||
* - 可选项
|
||||
* - 通过[Builder.distanceForTriggerRefresh]设置
|
||||
*/
|
||||
val distanceForTriggerRefresh: Float by lazy {
|
||||
val distance = builder.distanceForTriggerRefresh
|
||||
if (distance == null || distance <= 0) 200f else distance
|
||||
}
|
||||
|
||||
fun newBuilder() = Builder(this)
|
||||
internal fun newBuilder() = Builder(this)
|
||||
|
||||
class Builder {
|
||||
|
||||
constructor()
|
||||
|
||||
internal constructor(config: V2XConfig) {
|
||||
context = config.context
|
||||
executor = config.executor
|
||||
loggable = config.loggable
|
||||
appId = config.appId
|
||||
baseUrl = config.baseUrl
|
||||
staticParams = config.staticParams
|
||||
aiCloudConfig = config.aiCloudConfig
|
||||
durationForTriggerRefresh = config.durationForTriggerRefresh
|
||||
distanceForTriggerRefresh = config.distanceForTriggerRefresh
|
||||
}
|
||||
|
||||
internal var context: Context? = null
|
||||
|
||||
internal var executor: Executor? = null
|
||||
|
||||
internal var loggable: Boolean = false
|
||||
|
||||
internal var appId: String? = null
|
||||
|
||||
internal var staticParams: Map<String, Any?>? = null
|
||||
|
||||
internal var aiCloudConfig: MoGoAiCloudClientConfig? = null
|
||||
@@ -117,6 +107,18 @@ class V2XConfig private constructor(builder: Builder) {
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
/**
|
||||
* 应用上下文,此参数为必选项,不设置会抛异常
|
||||
@@ -134,7 +136,7 @@ class V2XConfig private constructor(builder: Builder) {
|
||||
fun staticParams(params: Map<String, Any?>) = apply { this.staticParams = params }
|
||||
|
||||
/**
|
||||
* 网络请求线程池,如未设置,会使用内置的
|
||||
* 网络请求线程池,如未设置,会使用内置的线程池[Executors.IO]
|
||||
*/
|
||||
fun executor(executor: Executor): Builder = apply {
|
||||
if (this.executor != null) {
|
||||
@@ -145,21 +147,25 @@ class V2XConfig private constructor(builder: Builder) {
|
||||
|
||||
/**
|
||||
* 刷新周边信息的时间间隔
|
||||
* @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 }
|
||||
|
||||
|
||||
@@ -1,31 +1,120 @@
|
||||
package com.mogo.v2x.data
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import java.io.Serializable
|
||||
|
||||
/**
|
||||
* 路口碰撞预警、盲区预警等通用Bean
|
||||
* 路口碰撞预警、盲区预警等数据实体
|
||||
*/
|
||||
@Keep
|
||||
data class V2XAdvanceWarning (
|
||||
var objectId: String,// 物体唯一标识
|
||||
var objectType: Int,// 物体类型 1-人 2-自行车 3-小轿车 4-摩托车 5-红绿灯 6-bus 8-truck 9-路边摄像头
|
||||
var status: Int,// 1.add 2.update 3.delete
|
||||
var typeId: Int,// 首位大类标识 1预警 2规划 3拥堵 4事故
|
||||
var time: Long,
|
||||
var level: Int,// 预警等级
|
||||
var threatLevel: Int,// 危险等级:0保留,1模型原始颜色,2通知--黄,3警告--红
|
||||
var position: V2XLocation,
|
||||
var heading: Double,
|
||||
var speed: Double,
|
||||
var distance: Double,
|
||||
var roadId: String,// 道路id
|
||||
var laneId: String,// 车道id
|
||||
var laneNum: Int,// 车道号:中心线编号为0, 中心线右侧编号为负数,3车道通行Road的车道编号,0,-1,-2,-3
|
||||
var gdLocusList: List<V2XLocation>,// 线性经纬度轨迹列表(高德)
|
||||
var locusList: List<V2XLocation>// 轨迹列表(Wgs84坐标系)
|
||||
) {
|
||||
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)"
|
||||
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 +1,25 @@
|
||||
package com.mogo.v2x.data
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import java.io.Serializable
|
||||
|
||||
@Keep
|
||||
data class V2XLocation(var lon: Double = 0.0, var lat: Double = 0.0) {
|
||||
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,17 +1,52 @@
|
||||
package com.mogo.v2x.data
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import java.io.Serializable
|
||||
import java.util.*
|
||||
|
||||
@Keep
|
||||
class V2XMarkerCardResult: V2XBaseData() {
|
||||
var dataType // 要查询的类型
|
||||
: List<String>? = null
|
||||
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<V2XMarkerExploreWay>? = null
|
||||
|
||||
/**
|
||||
* 服务端下发消息时间
|
||||
*/
|
||||
var messageTime: Long = 0
|
||||
|
||||
override fun toString(): String {
|
||||
@@ -20,10 +55,25 @@ class V2XMarkerCardResult: V2XBaseData() {
|
||||
}
|
||||
|
||||
@Keep
|
||||
class V2XMarkerCarChat {
|
||||
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 {
|
||||
@@ -32,19 +82,75 @@ class V2XMarkerCarChat {
|
||||
}
|
||||
|
||||
@Keep
|
||||
class V2XMarkerShareMusic {
|
||||
var bookInfo: String? = null
|
||||
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
|
||||
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 {
|
||||
@@ -56,28 +162,105 @@ class V2XMarkerShareMusic {
|
||||
* 新鲜事儿Marker数据
|
||||
*/
|
||||
@Keep
|
||||
class V2XMarkerNoveltyInfo {
|
||||
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 {
|
||||
var content: String? = null
|
||||
var iconUrl: String? = null
|
||||
var imgUrl: String? = null
|
||||
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-三方上报
|
||||
/**
|
||||
* 上报类型:
|
||||
* 1-用户上报
|
||||
* 2-后台上报
|
||||
* 3-三方上报
|
||||
*/
|
||||
var uploadType: String? = null
|
||||
|
||||
override fun toString(): String {
|
||||
@@ -91,27 +274,61 @@ class V2XMarkerNoveltyInfo {
|
||||
}
|
||||
|
||||
@Keep
|
||||
class V2XMarkerOnlineCar {
|
||||
var type //卡片类型
|
||||
: String? = null
|
||||
var location //所在位置
|
||||
: V2XMarkerLocation? = null
|
||||
var focus //isFocus":"0-未关注,1-关注
|
||||
: 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
|
||||
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)"
|
||||
@@ -119,80 +336,158 @@ class V2XMarkerOnlineCar {
|
||||
}
|
||||
|
||||
@Keep
|
||||
class V2XMarkerExploreWay {
|
||||
var infoId: String? = null
|
||||
var type //卡片类型,
|
||||
: String? = null
|
||||
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 //位置信息
|
||||
: V2XMarkerLocation? = null
|
||||
var direction //方位角度
|
||||
= 0
|
||||
var canLive //是否可直播(1为可直播,0不可直播)
|
||||
= false
|
||||
var fileType //是图片还是视频(1视频,0图片)
|
||||
= 0
|
||||
var addr //北京市朝阳区三里屯街道108号
|
||||
: 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 location: V2XMarkerLocation? = 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
|
||||
|
||||
// http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42321443
|
||||
// 1 需要用户判断是否拥堵 进行UGC问答
|
||||
/**
|
||||
* 需要用户判断是否拥堵 进行UGC问答
|
||||
*/
|
||||
var infoCheckNode = 0
|
||||
|
||||
override fun equals(o: Any?): Boolean {
|
||||
if (this === o) return true
|
||||
if (o == null || javaClass != o.javaClass) return false
|
||||
val that = o as V2XMarkerExploreWay
|
||||
return infoId == that.infoId &&
|
||||
type == that.type &&
|
||||
poiType == that.poiType
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
return Objects.hash(infoId, type, poiType)
|
||||
}
|
||||
|
||||
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)"
|
||||
}
|
||||
}
|
||||
|
||||
@Keep
|
||||
class V2XMarkerUserInfo {
|
||||
private var sn: String? = null
|
||||
var userId: Long = 0
|
||||
private var userName //用户昵称
|
||||
: String? = null
|
||||
private var userHead //用户头像
|
||||
: String? = null
|
||||
private var gender //gender": "男|女|无(也可以0|1|2根据实际库存返回即可)
|
||||
: String? = null
|
||||
private var age // 年龄段,可以为空,与车聊聊一致
|
||||
: Int? = null
|
||||
class V2XMarkerUserInfo: Serializable {
|
||||
|
||||
var lastActiveweekAvgscore //末次活跃周驾驶行为平均得分
|
||||
: String? = null
|
||||
var safeLabel //车辆安全标签
|
||||
: String? = null
|
||||
var safeLabelType //1老司机 2安全驾驶 3危险驾驶
|
||||
= 0
|
||||
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)"
|
||||
@@ -200,21 +495,57 @@ class V2XMarkerUserInfo {
|
||||
}
|
||||
|
||||
@Keep
|
||||
class V2XMarkerCarInfo {
|
||||
class V2XMarkerCarInfo: Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = -93L
|
||||
}
|
||||
|
||||
/**
|
||||
* 车品牌Logo资源链接
|
||||
*/
|
||||
var carBrandLogoUrl: String? = null
|
||||
|
||||
/**
|
||||
* 车型名称
|
||||
*/
|
||||
var carTypeName: String? = null
|
||||
var vehicleType = 0
|
||||
|
||||
/**
|
||||
* 车类型:
|
||||
* 0-普通车辆
|
||||
* 1-警车
|
||||
* 2-救护车
|
||||
* 3-失控车
|
||||
* 4-道路救援车
|
||||
*/
|
||||
var vehicleType: Int = 0
|
||||
|
||||
/**
|
||||
* 车辆直播相关信息
|
||||
*/
|
||||
var carLiveInfo: CarLiveInfo? = null
|
||||
|
||||
@Keep
|
||||
class CarLiveInfo {
|
||||
//rtmp视频直播地址rtmp://
|
||||
class CarLiveInfo: Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = -93L
|
||||
}
|
||||
|
||||
/**
|
||||
* rtmp视频直播地址rtmp://
|
||||
*/
|
||||
var videoUrl: String? = null
|
||||
|
||||
//直播频道【直播心跳接口参数】C_1
|
||||
/**
|
||||
* 直播频道【直播心跳接口参数】C_1
|
||||
*/
|
||||
var videoChannel: String? = null
|
||||
|
||||
//直播源sn【直播心跳接口参数】XTCBA90740400625
|
||||
/**
|
||||
* 直播源sn
|
||||
*/
|
||||
var videoSn: String? = null
|
||||
|
||||
override fun toString(): String {
|
||||
@@ -228,11 +559,25 @@ class V2XMarkerCarInfo {
|
||||
}
|
||||
|
||||
@Keep
|
||||
class V2XMarkerCarPois {
|
||||
class V2XMarkerCarPois: Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = -93L
|
||||
}
|
||||
|
||||
/**
|
||||
* 位置信息,返回的值不为空并且长度为2的倍数
|
||||
*/
|
||||
var coordinates: List<*>? = null
|
||||
|
||||
var angle // 车头角度
|
||||
= 0.0
|
||||
/**
|
||||
* 车的朝向角度
|
||||
*/
|
||||
var angle = 0.0
|
||||
|
||||
/**
|
||||
* 地区code
|
||||
*/
|
||||
var adcode: String? = null
|
||||
|
||||
override fun toString(): String {
|
||||
@@ -241,67 +586,130 @@ class V2XMarkerCarPois {
|
||||
}
|
||||
|
||||
@Keep
|
||||
class V2XMarkerDynamicData {
|
||||
//QQ音乐,懒人听书,乐听头条 2 为书籍听书,3 为新闻,1 为qq音乐
|
||||
var type = 0
|
||||
var mediaId //qq音乐id,书的bookId
|
||||
: String? = null
|
||||
class V2XMarkerDynamicData: Serializable {
|
||||
|
||||
//qq音乐url 懒人听书为“”
|
||||
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特有
|
||||
/**
|
||||
* 音乐类别,类似经典 ,流行只有qq特有
|
||||
*/
|
||||
var mediaType: String? = null
|
||||
var maxTime //音频总时长
|
||||
= 0
|
||||
var bookInfo //懒人听书json串
|
||||
: String? = null
|
||||
|
||||
//当前播放时长,可以不加,播放进度单独独立出来
|
||||
/**
|
||||
* 音频总时长
|
||||
*/
|
||||
var maxTime = 0
|
||||
|
||||
/**
|
||||
* 懒人听书json串
|
||||
*/
|
||||
var bookInfo: String? = null
|
||||
|
||||
/**
|
||||
* 当前播放时长,可以不加,播放进度单独独立出来
|
||||
*/
|
||||
var curTime = 0
|
||||
|
||||
//是否是本地音频,只有qq音乐
|
||||
var isLocalMedia //本地
|
||||
= false
|
||||
/**
|
||||
* 是否是本地音频,只有qq音乐
|
||||
*/
|
||||
var isLocalMedia = false
|
||||
|
||||
//播放模式,顺序,单曲循环,随机
|
||||
/**
|
||||
* 播放模式,顺序,单曲循环,随机
|
||||
*/
|
||||
var mediaPlayMode = 0
|
||||
|
||||
//1 播放 2 缓冲 0 暂停/停止 -1 播放错误
|
||||
/**
|
||||
* 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 {
|
||||
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
|
||||
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 {
|
||||
class MarkerOnlineTag: Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = -93L
|
||||
}
|
||||
|
||||
/**
|
||||
* 社交内容
|
||||
*/
|
||||
var content: String? = null
|
||||
var isCheck = false
|
||||
|
||||
/**
|
||||
* 是否选中
|
||||
*/
|
||||
var isCheck: Boolean = false
|
||||
|
||||
override fun toString(): String {
|
||||
return "MarkerOnlineTag(content=$content, isCheck=$isCheck)"
|
||||
@@ -314,9 +722,21 @@ class V2XMarkerHobbyDatum {
|
||||
}
|
||||
|
||||
@Keep
|
||||
class V2XMarkerActivitiesScope {
|
||||
class V2XMarkerActivitiesScope: Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = -93L
|
||||
}
|
||||
|
||||
/**
|
||||
* 活动范围内容
|
||||
*/
|
||||
var content: String? = null
|
||||
var isCheck = false
|
||||
|
||||
/**
|
||||
* 是否选中
|
||||
*/
|
||||
var isCheck: Boolean = false
|
||||
|
||||
override fun toString(): String {
|
||||
return "V2XMarkerActivitiesScope(content=$content, isCheck=$isCheck)"
|
||||
@@ -327,10 +747,30 @@ class V2XMarkerActivitiesScope {
|
||||
* 道路情报,V2X预警,地图道路事件POI,违章停车POI等
|
||||
*/
|
||||
@Keep
|
||||
class MarkerExploreWayItem {
|
||||
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 {
|
||||
@@ -339,15 +779,31 @@ class MarkerExploreWayItem {
|
||||
}
|
||||
|
||||
@Keep
|
||||
class V2XMarkerLocation {
|
||||
var lat //纬度
|
||||
= 0.0
|
||||
var lon //经度
|
||||
= 0.0
|
||||
var angle //车头角度,可以没有
|
||||
= 0.0
|
||||
var address //具体的位置信息
|
||||
: String? = null
|
||||
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)"
|
||||
|
||||
@@ -2,11 +2,23 @@ package com.mogo.v2x.data
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import com.elegant.network.BaseResp
|
||||
import java.io.Serializable
|
||||
|
||||
@Keep
|
||||
class V2XMarkerResponse: BaseResp() {
|
||||
class V2XMarkerResponse: BaseResp(), Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = -93L
|
||||
}
|
||||
|
||||
/**
|
||||
* 响应的数据集
|
||||
*/
|
||||
var result: V2XMarkerCardResult? = null
|
||||
|
||||
/**
|
||||
* TODO 不知道啥含义,可以忽略
|
||||
*/
|
||||
var sign: String? = null
|
||||
|
||||
override fun toString(): String {
|
||||
|
||||
@@ -1,13 +1,21 @@
|
||||
package com.mogo.v2x.data
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import java.io.Serializable
|
||||
|
||||
/**
|
||||
* 最优路线推荐
|
||||
*/
|
||||
@Keep
|
||||
class V2XOptimalRoute {
|
||||
class V2XOptimalRoute: Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = -93L
|
||||
}
|
||||
|
||||
/**
|
||||
* 自车SN
|
||||
*/
|
||||
var sn: String? = null
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,83 +1,146 @@
|
||||
package com.mogo.v2x.data
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import java.io.Serializable
|
||||
|
||||
/**
|
||||
* 预警目标物数据模型
|
||||
*/
|
||||
@Keep
|
||||
class V2XWarningTarget {
|
||||
class V2XWarningTarget: Serializable {
|
||||
|
||||
//事件类型 行人1/自行车2/摩托车4/骑行车辆11
|
||||
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 暂不使用
|
||||
/**
|
||||
* 车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播报
|
||||
private var tts: String? = null
|
||||
/**
|
||||
* 自组字段, tts播报
|
||||
*/
|
||||
var tts: String? = null
|
||||
|
||||
//自车位置
|
||||
/**
|
||||
* 自车位置
|
||||
*/
|
||||
var carLocation: V2XLocation? = null
|
||||
|
||||
override fun toString(): String {
|
||||
|
||||
@@ -7,26 +7,46 @@ sealed class V2XEvent {
|
||||
/**
|
||||
* 长链-路口碰撞预警、盲区预警等通用Bean
|
||||
*/
|
||||
class ForwardsWarning(val type: Int = 404000, val data: V2XAdvanceWarning): V2XEvent()
|
||||
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()
|
||||
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()
|
||||
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()
|
||||
|
||||
class Road(val type: Int = 401012, val data: V2XMarkerCardResult): V2XEvent() {
|
||||
override fun toString(): String {
|
||||
return "Road(type=$type, data=$data)"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 短链-道路标记事件
|
||||
*/
|
||||
class Marker(val data: V2XMarkerResponse): V2XEvent()
|
||||
class Marker(val data: V2XMarkerResponse): V2XEvent() {
|
||||
|
||||
override fun toString(): String {
|
||||
return "Marker(data=$data)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.mogo.v2x.http
|
||||
import com.elegant.network.internal.RetrofitFactory
|
||||
|
||||
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.v2x.V2XManager
|
||||
import com.mogo.v2x.config.V2XConfig
|
||||
import com.mogo.v2x.data.V2XLocation
|
||||
@@ -14,22 +15,28 @@ import com.mogo.v2x.utils.DeviceUtils
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import retrofit2.Retrofit
|
||||
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
|
||||
import retrofit2.converter.gson.GsonConverterFactory
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
|
||||
class V2XRefreshModel {
|
||||
internal class V2XRefreshModel {
|
||||
|
||||
companion object {
|
||||
|
||||
fun querySnapshot(longitude: Double, latitude: Double, callback: IV2XRefreshCallback<V2XMarkerResponse>?): Disposable {
|
||||
fun querySnapshot(
|
||||
longitude: Double,
|
||||
latitude: Double,
|
||||
callback: IV2XRefreshCallback<V2XMarkerResponse>?
|
||||
): Disposable? {
|
||||
val config = V2XManager.getConfig()
|
||||
return RetrofitFactory.getInstance(config.baseUrl)
|
||||
val retrofit = RetrofitFactory.getInstance(config.baseUrl) ?: return null
|
||||
return retrofit
|
||||
.create(V2XApiService::class.java)
|
||||
.querySnapshotAsync(buildParams(longitude, latitude, config))
|
||||
.querySnapshotSync(buildParams(longitude, latitude, config))
|
||||
.subscribeOn(Schedulers.from(config.executor))
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.doOnError {
|
||||
callback?.onFail(it.message)
|
||||
}
|
||||
.subscribe { data ->
|
||||
.subscribe({ data ->
|
||||
if (data == null) {
|
||||
callback?.onFail("returned data is null.")
|
||||
return@subscribe
|
||||
@@ -39,10 +46,16 @@ class V2XRefreshModel {
|
||||
} else {
|
||||
callback?.onSuccess(data)
|
||||
}
|
||||
}
|
||||
}, {
|
||||
callback?.onFail(it.message)
|
||||
})
|
||||
}
|
||||
|
||||
private fun buildParams(longitude: Double, latitude: Double, config: V2XConfig): Map<String, Any> = mutableMapOf<String, Any>().apply {
|
||||
private fun buildParams(
|
||||
longitude: Double,
|
||||
latitude: Double,
|
||||
config: V2XConfig
|
||||
): Map<String, Any> = mutableMapOf<String, Any>().apply {
|
||||
putAll(config.staticParams.let {
|
||||
val handled = mutableMapOf<String, Any>()
|
||||
it.asIterable().forEach { itx ->
|
||||
@@ -60,7 +73,10 @@ class V2XRefreshModel {
|
||||
this["sig"] = SignUtil.createSign(this, "JGjZx6")
|
||||
this["data"] = GsonUtil.jsonFromObject(V2XRefreshEntity().apply {
|
||||
limit = 999
|
||||
location = V2XLocation(longitude, latitude)
|
||||
location = V2XLocation().also {
|
||||
it.lat = latitude
|
||||
it.lon = longitude
|
||||
}
|
||||
radius = 1000
|
||||
dataType.add("CARD_TYPE_ROAD_CONDITION")
|
||||
viewPush = true
|
||||
|
||||
@@ -6,9 +6,9 @@ import retrofit2.http.FieldMap
|
||||
import retrofit2.http.FormUrlEncoded
|
||||
import retrofit2.http.POST
|
||||
|
||||
interface V2XApiService {
|
||||
internal interface V2XApiService {
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("/yycp-launcherSnapshot/launcherSnapshot/querySnapshotAsync")
|
||||
fun querySnapshotAsync(@FieldMap parameters: Map<String, Any>): Maybe<V2XMarkerResponse?>
|
||||
@POST("/yycp-launcherSnapshot/launcherSnapshot/querySnapshotSync")
|
||||
fun querySnapshotSync(@FieldMap parameters: Map<String, @JvmSuppressWildcards Any>): Maybe<V2XMarkerResponse?>
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import com.mogo.v2x.data.V2XLocation
|
||||
* 刷新地图信息接口
|
||||
*/
|
||||
@Keep
|
||||
class V2XRefreshEntity {
|
||||
internal class V2XRefreshEntity {
|
||||
|
||||
@JvmField
|
||||
var dataType: MutableList<String> = mutableListOf() // 要查询的类型
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.mogo.v2x.http.callback
|
||||
/**
|
||||
* 刷新回调
|
||||
*/
|
||||
interface IV2XRefreshCallback<T> {
|
||||
internal interface IV2XRefreshCallback<T> {
|
||||
|
||||
fun onSuccess(result: T)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.mogo.v2x.logger
|
||||
|
||||
import android.util.Log
|
||||
|
||||
object Logger {
|
||||
internal object Logger {
|
||||
|
||||
var loggable: Boolean = false
|
||||
|
||||
|
||||
@@ -3,15 +3,15 @@ package com.mogo.v2x.socket
|
||||
import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener
|
||||
import com.mogo.v2x.V2XManager
|
||||
import com.mogo.v2x.callback.IV2XCallback
|
||||
import com.mogo.v2x.data.V2XAdvanceWarning
|
||||
import com.mogo.v2x.data.V2XOptimalRoute
|
||||
import com.mogo.v2x.event.V2XEvent
|
||||
import com.mogo.v2x.logger.Logger
|
||||
|
||||
internal class V2XMessageListener_402000(val cbs: Iterable<IV2XCallback>?): IMogoCloudSocketOnMessageListener<V2XAdvanceWarning> {
|
||||
internal class V2XMessageListener_402000(val cbs: Iterable<IV2XCallback>?): IMogoCloudSocketOnMessageListener<V2XOptimalRoute> {
|
||||
|
||||
override fun target(msgType: Int): Class<V2XAdvanceWarning> = V2XAdvanceWarning::class.java
|
||||
override fun target(msgType: Int): Class<V2XOptimalRoute> = V2XOptimalRoute::class.java
|
||||
|
||||
override fun onMsgReceived(msgType: Int, data: V2XAdvanceWarning?) {
|
||||
override fun onMsgReceived(msgType: Int, data: V2XOptimalRoute?) {
|
||||
if (msgType != 402000) {
|
||||
return
|
||||
}
|
||||
@@ -21,7 +21,7 @@ internal class V2XMessageListener_402000(val cbs: Iterable<IV2XCallback>?): IMog
|
||||
}
|
||||
Logger.i(V2XManager.TAG, "V2XMessageListener_402000:$data")
|
||||
cbs?.forEach {
|
||||
it.onAck(V2XEvent.ForwardsWarning(data = data))
|
||||
it.onAck(V2XEvent.OptimalRoute(data = data))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,15 +3,15 @@ package com.mogo.v2x.socket
|
||||
import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener
|
||||
import com.mogo.v2x.V2XManager
|
||||
import com.mogo.v2x.callback.IV2XCallback
|
||||
import com.mogo.v2x.data.V2XOptimalRoute
|
||||
import com.mogo.v2x.data.V2XAdvanceWarning
|
||||
import com.mogo.v2x.event.V2XEvent
|
||||
import com.mogo.v2x.logger.Logger
|
||||
|
||||
internal class V2XMessageListener_404000(val cbs: Iterable<IV2XCallback>?): IMogoCloudSocketOnMessageListener<V2XOptimalRoute> {
|
||||
internal class V2XMessageListener_404000(val cbs: Iterable<IV2XCallback>?): IMogoCloudSocketOnMessageListener<V2XAdvanceWarning> {
|
||||
|
||||
override fun target(msgType: Int): Class<V2XOptimalRoute> = V2XOptimalRoute::class.java
|
||||
override fun target(msgType: Int): Class<V2XAdvanceWarning> = V2XAdvanceWarning::class.java
|
||||
|
||||
override fun onMsgReceived(msgType: Int, data: V2XOptimalRoute?) {
|
||||
override fun onMsgReceived(msgType: Int, data: V2XAdvanceWarning?) {
|
||||
if (msgType != 404000) {
|
||||
return
|
||||
}
|
||||
@@ -21,7 +21,7 @@ internal class V2XMessageListener_404000(val cbs: Iterable<IV2XCallback>?): IMog
|
||||
}
|
||||
Logger.i(V2XManager.TAG, "V2XMessageListener_404000:$data")
|
||||
cbs?.forEach {
|
||||
it.onAck(V2XEvent.OptimalRoute(data = data))
|
||||
it.onAck(V2XEvent.ForwardsWarning(data = data))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import android.telephony.cdma.CdmaCellLocation
|
||||
import android.telephony.gsm.GsmCellLocation
|
||||
import java.lang.Exception
|
||||
|
||||
class DeviceUtils {
|
||||
internal class DeviceUtils {
|
||||
|
||||
companion object {
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import kotlin.math.cos
|
||||
import kotlin.math.sin
|
||||
import kotlin.math.sqrt
|
||||
|
||||
class DistanceUtils {
|
||||
internal class DistanceUtils {
|
||||
|
||||
companion object {
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.mogo.test.json;
|
||||
|
||||
|
||||
import com.elegant.network.utils.GsonUtil;
|
||||
import com.mogo.v2x.data.V2XAdvanceWarning;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.JUnit4;
|
||||
|
||||
|
||||
@RunWith(JUnit4.class)
|
||||
public class V2XWarningFromGson {
|
||||
|
||||
@Test
|
||||
public void testV2XWarningFromGson() {
|
||||
String s = "{\"distance\":0.0,\"gdLocusList\":[],\"heading\":0.0,\"laneNum\":0,\"level\":3,\"locusList\":[],\"objectId\":\"70970\",\"objectType\":3,\"position\":{\"lat\":40.19920411,\"lon\":116.7397},\"sn\":\"X2020211029Q24CLWL\",\"speed\":0.0,\"status\":1,\"threatLevel\":3,\"time\":0,\"typeId\":1003}";
|
||||
try {
|
||||
V2XAdvanceWarning warning = GsonUtil.objectFromJson(s, V2XAdvanceWarning.class);
|
||||
System.out.println("warning:" + warning.toString());
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -58,4 +58,4 @@ MOGO_LOCATION_VERSION=1.3.23
|
||||
# 远程通讯模块
|
||||
MOGO_TELEMATIC_VERSION=1.3.23
|
||||
# v2x
|
||||
MOGO_V2X_VERSION=1.3.23
|
||||
MOGO_V2X_VERSION=1.0.1
|
||||
Reference in New Issue
Block a user