[dev_arch_opt_3.0]移除无用代码

This commit is contained in:
renwj
2023-02-02 20:00:24 +08:00
parent 33c51b7ace
commit 116c7a61bb
13 changed files with 47 additions and 164 deletions

View File

@@ -130,13 +130,6 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IMoGoTokenCallback,
private fun registerListener() {
V2XManager.addCallback(this)
CallerChassisLocationGCJ20ListenerManager.addListener(TAG, this)
mogoMarkersHandler.registerMarkerClickListener(CARD_TYPE_ROAD_CONDITION,
object : IMogoMarkerClickListener {
override fun onMarkerClicked(marker: IMogoMarker?): Boolean {
handleRoadConditionMarkerClick(marker)
return super.onMarkerClicked(marker)
}
})
}
private fun unRegisterListener() {
@@ -145,64 +138,7 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IMoGoTokenCallback,
mogoMarkersHandler.unregisterMarkerClickListener(CARD_TYPE_ROAD_CONDITION)
}
private fun handleRoadConditionMarkerClick(marker: IMogoMarker?) {
//点击的marker的具体数据
val exploreWay = extractFromMarker(marker)
exploreWay?.let {
val item = it.items[0]
val path = item.url
if (path.contains(".mp4")) {
initVideo()
}
val roadEventEntity = V2XRoadEventEntity()
roadEventEntity.noveltyInfo = exploreWay
roadEventEntity.poiType = it.poiType
roadEventEntity.expireTime = 20000 //地理位置
//地理位置
val location = it.location
roadEventEntity.location = location
val v2XMessageEntity: V2XMessageEntity<V2XRoadEventEntity> =
V2XMessageEntity<V2XRoadEventEntity>()
v2XMessageEntity.type = V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING
v2XMessageEntity.isShowState = true
v2XMessageEntity.isOnlyShow = true
v2XMessageEntity.isNeedAddLine = false
v2XMessageEntity.content = roadEventEntity
val intent = Intent(BROADCAST_SCENE_HANDLER_ACTION)
intent.putExtra(BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity)
LocalBroadcastManager.getInstance(context()).sendBroadcast(intent)
//埋点
TrackUtils.trackV2XMarkerClick(2)
}
}
private fun initVideo() {
PlayerFactory.setPlayManager(IjkPlayerManager::class.java)
CacheFactory.setCacheManager(ProxyCacheManager::class.java)
val list = mutableListOf<VideoOptionModel>()
list.add(VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "enable-accurate-seek", 1))
list.add(VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "videotoolbox", 0))
GSYVideoManager.instance().optionModelList = list
GSYVideoType.enableMediaCodec()
GSYVideoType.enableMediaCodecTexture()
}
private fun extractFromMarker(marker: IMogoMarker?): MarkerExploreWay? {
if (marker == null) {
return null
}
if (marker.getObject() is MarkerShowEntity) {
val showEntity = marker.getObject() as MarkerShowEntity
if (showEntity.bindObj is MarkerExploreWay) {
return showEntity.bindObj as MarkerExploreWay
}
}
return null
}
override fun onChassisLocationGCJ02(gnssInfo: MogoLocation?) {
override fun onChassisLocationGCJ02(gnssInfo: GnssInfo?) {
val location = CallerMapLocationListenerManager.getCurrentLocation() ?: return
BridgeApi.location.set(location)
if (V2XManager.hasInit()) {
@@ -229,7 +165,6 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IMoGoTokenCallback,
"$M_V2X$TAG",
"--- trigger show ---:poiType:" + v2XRoadEventEntity.poiType
)
TrackUtils.trackV2xRoadProduceEvent(1)
val v2XMessageEntity = V2XMessageEntity<V2XRoadEventEntity>()
v2XMessageEntity.type = V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING
v2XMessageEntity.content = v2XRoadEventEntity

View File

@@ -13,11 +13,6 @@ import androidx.annotation.Keep;
*/
@Keep
public class MoGoV2XServicePaths {
/**
* V2X 状态管理
*/
@Keep
public static final String PATH_V2X_STATUS_MANAGER = "/v2xStatusManager/api";
/**
* V2X 道路事件POI点
@@ -25,11 +20,6 @@ public class MoGoV2XServicePaths {
@Keep
public static final String PATH_V2X_MARKER_MANAGER = "/v2xMarkerManager/api";
/**
* V2X 道路事件与车辆的连接线
*/
@Keep
public static final String PATH_V2X_POLYLINE_MANAGER = "/v2xPolylineManager/api";
/**
* V2X 道路事件与车辆的连接线

View File

@@ -9,10 +9,6 @@ package com.mogo.eagle.core.function.v2x.events.consts;
*/
public class V2XConst {
/**
* V2X面板名称
*/
public static final String MODULE_NAME = "V2X_UI";
/**
* V2X 场景广播 Action
@@ -28,23 +24,10 @@ public class V2XConst {
public static final String BROADCAST_SCENE_ACTION = "com.v2x.scene_local_broadcast";
/**
* V2X 埋点
*/
public static final String V2X_ROAD_SHOW = "v2x_road_show";
public static final String V2X_ROAD_PRODUCE = "v2x_road_produce";
public static final String LAUNCHER_ICON_CLICK = "Launcher_Icon_Click";
/**
* V2X 地图上发出警告的POI
*/
public static final String V2X_EVENT_ALARM_POI = "V2X_EVENT_ALARM_POI";
/*
*V2X 车路云前方预警-识别物
* */
public static final String V2X_FRONT_WARNING_MARKER = "V2X_FRONT_WARNING_MARKER";
/**
* V2X预警日志tag
*/

View File

@@ -1,36 +0,0 @@
package com.mogo.eagle.core.function.v2x.events.utils;
import com.mogo.commons.analytics.AnalyticsUtils;
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
import java.util.HashMap;
import java.util.Map;
/**
* 统计埋点工具
*/
public class TrackUtils {
/**
* @param type type=1 短距离角度匹配
* type=2 历史轨迹匹配
*/
public static void trackV2xRoadProduceEvent(int type) {
try {
Map<String, Object> properties = new HashMap<>();
properties.put("type", type);
AnalyticsUtils.track(V2XConst.V2X_ROAD_PRODUCE, properties);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void trackV2XMarkerClick(int type) {
try {
Map<String, Object> properties = new HashMap<>();
properties.put("type", type);
AnalyticsUtils.track(V2XConst.LAUNCHER_ICON_CLICK, properties);
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -10,7 +10,7 @@ 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.Logger
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
@@ -86,12 +86,12 @@ object V2XManager {
* @param config 相关配置类
*/
fun init(config: V2XConfig) {
Logger.d(TAG, "-- init --")
V2XLogger.d(TAG, "-- init --")
if (V2XManager.config.get() != null) {
throw IllegalStateException("V2XManager has been initialized, don't initialize repeatably.")
}
V2XManager.config.set(config)
Logger.loggable = config.loggable
V2XLogger.loggable = config.loggable
}
/**
@@ -104,28 +104,28 @@ object V2XManager {
* 3.短链[V2XRefreshModel.querySnapshot]定时轮循,轮循时长取[V2XConfig.durationForTriggerRefresh]
*/
fun start() {
Logger.d(TAG, "-- 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()) {
Logger.d(TAG, "-- has been started --")
V2XLogger.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.")
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) {
Logger.e(TAG, "token is null or blank, please ensure token exists and then invoke V2Manager#start() again.")
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)) {
Logger.d(TAG, "-- start real --")
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))
@@ -160,12 +160,12 @@ object V2XManager {
* 3. 取消短链定时轮循任务
*/
fun stop() {
Logger.d(TAG, "-- 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)) {
Logger.d(TAG, "-- stop real --")
V2XLogger.d(TAG, "-- stop real --")
SocketManager.getInstance().release()
handler.removeCallbacks(refreshTask)
lastLatitude.set(0.0)
@@ -178,7 +178,7 @@ object V2XManager {
* @param cb 要添加的回调接口
*/
fun addCallback(cb: IV2XCallback) {
Logger.d(TAG, "-- addCallback --")
V2XLogger.d(TAG, "-- addCallback --")
if (cbs.contains(cb)) {
return
}
@@ -190,7 +190,7 @@ object V2XManager {
* @param cb 要移除的回调接口
*/
fun removeCallback(cb: IV2XCallback) {
Logger.d(TAG, "-- removeCallback --")
V2XLogger.d(TAG, "-- removeCallback --")
if (!cbs.contains(cb)) {
return
}
@@ -209,7 +209,7 @@ object V2XManager {
if (!started.get()) {
return
}
Logger.d(TAG, "--- onLocationChanged --[longitude: $longitude, latitude: $latitude]")
V2XLogger.d(TAG, "--- onLocationChanged --[longitude: $longitude, latitude: $latitude]")
realLongitude.set(longitude)
realLatitude.set(latitude)
val oldLon = lastLongitude.get()
@@ -217,14 +217,14 @@ object V2XManager {
var update = false
try {
if (oldLon == 0.0 || oldLat == 0.0) {
Logger.d(TAG, "--- onLocationChanged -- first --[longitude: $longitude, latitude: $latitude]")
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) {
Logger.d(TAG, "--- onLocationChanged -- trigger --[longitude: $longitude, latitude: $latitude]")
V2XLogger.d(TAG, "--- onLocationChanged -- trigger --[longitude: $longitude, latitude: $latitude]")
handler.removeCallbacks(refreshTask)
handler.post(refreshTask)
update = true

View File

@@ -436,6 +436,17 @@ class V2XMarkerExploreWay: Serializable {
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)"
}

View File

@@ -2,7 +2,7 @@ package com.mogo.eagle.core.function.v2x.internal.logger
import android.util.Log
internal object Logger {
internal object V2XLogger {
var loggable: Boolean = false

View File

@@ -5,7 +5,7 @@ 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.Logger
import com.mogo.eagle.core.function.v2x.internal.logger.V2XLogger
internal class V2XMessageListener_401012(val cbs: Iterable<IV2XCallback>?): IMogoCloudSocketOnMessageListener<V2XMarkerCardResult> {
@@ -16,10 +16,10 @@ internal class V2XMessageListener_401012(val cbs: Iterable<IV2XCallback>?): IMog
return
}
if (data == null) {
Logger.i(V2XManager.TAG, "V2XMessageListener_401012message is null!")
V2XLogger.i(V2XManager.TAG, "V2XMessageListener_401012message is null!")
return
}
Logger.i(V2XManager.TAG, "V2XMessageListener_401012:$data")
V2XLogger.i(V2XManager.TAG, "V2XMessageListener_401012:$data")
cbs?.forEach {
it.onAck(V2XEvent.Road(data = data))
}

View File

@@ -5,7 +5,7 @@ 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.Logger
import com.mogo.eagle.core.function.v2x.internal.logger.V2XLogger
internal class V2XMessageListener_401018(val cbs: Iterable<IV2XCallback>?): IMogoCloudSocketOnMessageListener<V2XWarningTarget> {
@@ -16,10 +16,10 @@ internal class V2XMessageListener_401018(val cbs: Iterable<IV2XCallback>?): IMog
return
}
if (data == null) {
Logger.i(V2XManager.TAG, "V2XMessageListener_401018message is null!")
V2XLogger.i(V2XManager.TAG, "V2XMessageListener_401018message is null!")
return
}
Logger.i(V2XManager.TAG, "V2XMessageListener_401018:$data")
V2XLogger.i(V2XManager.TAG, "V2XMessageListener_401018:$data")
cbs?.forEach {
it.onAck(V2XEvent.Warning(data = data))
}

View File

@@ -5,7 +5,7 @@ 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.Logger
import com.mogo.eagle.core.function.v2x.internal.logger.V2XLogger
internal class V2XMessageListener_402000(val cbs: Iterable<IV2XCallback>?): IMogoCloudSocketOnMessageListener<V2XOptimalRoute> {
@@ -16,10 +16,10 @@ internal class V2XMessageListener_402000(val cbs: Iterable<IV2XCallback>?): IMog
return
}
if (data == null) {
Logger.i(V2XManager.TAG, "V2XMessageListener_402000message is null!")
V2XLogger.i(V2XManager.TAG, "V2XMessageListener_402000message is null!")
return
}
Logger.i(V2XManager.TAG, "V2XMessageListener_402000:$data")
V2XLogger.i(V2XManager.TAG, "V2XMessageListener_402000:$data")
cbs?.forEach {
it.onAck(V2XEvent.OptimalRoute(data = data))
}

View File

@@ -5,7 +5,7 @@ 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.Logger
import com.mogo.eagle.core.function.v2x.internal.logger.V2XLogger
internal class V2XMessageListener_404000(val cbs: Iterable<IV2XCallback>?): IMogoCloudSocketOnMessageListener<V2XAdvanceWarning> {
@@ -16,10 +16,10 @@ internal class V2XMessageListener_404000(val cbs: Iterable<IV2XCallback>?): IMog
return
}
if (data == null) {
Logger.i(V2XManager.TAG, "V2XMessageListener_404000message is null!")
V2XLogger.i(V2XManager.TAG, "V2XMessageListener_404000message is null!")
return
}
Logger.i(V2XManager.TAG, "V2XMessageListener_404000:$data")
V2XLogger.i(V2XManager.TAG, "V2XMessageListener_404000:$data")
cbs?.forEach {
it.onAck(V2XEvent.ForwardsWarning(data = data))
}

View File

@@ -4,7 +4,7 @@ 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.Logger
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> {
@@ -16,10 +16,10 @@ internal class V2XMessageListener_503000(val cbs: Iterable<IV2XCallback>?): IMog
return
}
if (data == null) {
Logger.i(V2XManager.TAG, "V2XMessageListener_503000message is null!")
V2XLogger.i(V2XManager.TAG, "V2XMessageListener_503000message is null!")
return
}
Logger.i(V2XManager.TAG, "V2XMessageListener_503000:$data")
V2XLogger.i(V2XManager.TAG, "V2XMessageListener_503000:$data")
cbs?.forEach {
it.onAck(RoadAI(data = data))
}

View File

@@ -5,7 +5,7 @@ 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.Logger
import com.mogo.eagle.core.function.v2x.internal.logger.V2XLogger
internal class V2XMessageListener_70001(val cbs: Iterable<IV2XCallback>?): IMogoCloudSocketOnMessageListener<V2XRoadXData> {
@@ -16,10 +16,10 @@ internal class V2XMessageListener_70001(val cbs: Iterable<IV2XCallback>?): IMogo
return
}
if (data == null) {
Logger.i(V2XManager.TAG, "V2XMessageListener_70001message is null!")
V2XLogger.i(V2XManager.TAG, "V2XMessageListener_70001message is null!")
return
}
Logger.i(V2XManager.TAG, "V2XMessageListener_70001:$data")
V2XLogger.i(V2XManager.TAG, "V2XMessageListener_70001:$data")
cbs?.forEach {
it.onAck(V2XEvent.RoadEventX(data = data))
}