[6.5.0] tmp

This commit is contained in:
EmArrow
2024-06-17 16:22:36 +08:00
parent dbf223c997
commit f1ff3baf52
11 changed files with 240 additions and 51 deletions

View File

@@ -20,6 +20,7 @@ import com.mogo.eagle.function.biz.v2x.trafficlight.core.TrafficLightThreadHandl
import com.mogo.eagle.function.biz.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_STOP_SEARCH_CROSS_ROAD
import com.mogo.eagle.function.biz.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_STOP_SEARCH_TRAFFIC_LIGHT
import com.mogo.eagle.function.biz.v2x.trafficlight.network.TrafficLightNetWorkModel
import com.zhidaoauto.map.data.road.RoadCross
class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener,
CallerMapRoadListenerManager.OnRoadListener {
@@ -121,8 +122,8 @@ class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener,
mThreadHandler?.sendEmptyMessageDelayed(MSG_WHAT_LOOP_SEARCH_CROSS_ROAD, 5_000L)
}
override fun onRoadChange(cross: Boolean) {
super.onRoadChange(cross)
override fun onRoadChange(cross: Boolean,roadCross: RoadCross?) {
super.onRoadChange(cross,roadCross)
if(!cross){
outOfCrossRange()
}

View File

@@ -10,6 +10,7 @@ import com.mogo.eagle.core.function.business.MapPointCloudSubscriber
import com.mogo.eagle.core.function.business.SpeedLimitDataManager
import com.mogo.eagle.core.function.business.ai.AiCloudIdentifyDataManager.Companion.aiCloudIdentifyDataManager
import com.mogo.eagle.core.function.business.identify.MapIdentifySubscriber
import com.mogo.eagle.core.function.business.roadcross.RoadCrossCameraManager
import com.mogo.eagle.core.function.business.routeoverlay.MogoRouteOverlayManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
import com.mogo.eagle.core.utilcode.util.DeviceUtils
@@ -26,6 +27,7 @@ class MapBizProvider :IMoGoFunctionServerProvider, IMogoRoma {
MapIdentifySubscriber.instance
MogoRouteOverlayManager.getInstance().init()
MapPointCloudSubscriber.instance
RoadCrossCameraManager.instance.init()
SpeedLimitDataManager.getInstance().start()
if(DeviceUtils.isLenovoModel() || DeviceUtils.isEB5Model()){ //todo 新增稳定设备类型需要添加目的避免在nuc设备上使用此类功能
aiCloudIdentifyDataManager.initServer(AbsMogoApplication.getApp())

View File

@@ -0,0 +1,74 @@
package com.mogo.eagle.core.function.business.roadcross
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.function.business.roadcross.net.NDERoadCameraNetWorkModel
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager
import com.zhidaoauto.map.data.road.RoadCross
import com.zhidaoauto.map.data.road.StopLine
import com.zhjt.service.chain.ChainLog
import kotlin.properties.Delegates
class RoadCrossCameraManager : CallerMapRoadListenerManager.OnRoadListener {
companion object {
private const val TAG = "RoadCrossCameraManager"
val instance: RoadCrossCameraManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
RoadCrossCameraManager()
}
}
@Volatile
private var isCameraRequest = false
private val ndeRoadCameraNetWorkModel = NDERoadCameraNetWorkModel()
fun init() {
CallerMapRoadListenerManager.registerRoadListener(TAG, this)
}
private var distance: Double by Delegates.observable(0.0) { _, _, newV ->
if (!isCameraRequest && newV < 100) {
isCameraRequest = true
val roadCross = CallerMapRoadListenerManager.getCrossInfo()
if (roadCross != null) {
ndeRoadCameraNetWorkModel.getRoadCrossInfo(roadCross.cross_id_end)
} else {
val loc = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
roadCrossTrace(
TAG,
mapOf(
"errorMsg" to "roadCross is null",
"lat" to loc.latitude,
"lon" to loc.longitude
)
)
}
}
}
override fun onStopLineInfo(info: StopLine) {
super.onStopLineInfo(info)
distance = info.distance
}
override fun onRoadChange(cross: Boolean, roadCross: RoadCross?) {
super.onRoadChange(cross, roadCross)
// 进入路口
if (cross) {
isCameraRequest = false
// 停止请求摄像头数据
}
}
@ChainLog(
linkChainLog = ChainConstant.CHAIN_TYPE_STATUS,
linkCode = ChainConstant.CHAIN_SOURCE_MAP,
nodeAliasCode = ChainConstant.CHAIN_CODE_MAP_ROAD_CROSS_ERROR,
paramIndexes = [0, 1]
)
private fun roadCrossTrace(tag: String, paramMap: Any) {
}
}

View File

@@ -0,0 +1,46 @@
package com.mogo.eagle.core.function.business.roadcross.net
import com.mogo.eagle.core.data.Response
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.Headers
import retrofit2.http.POST
import retrofit2.http.Query
const val ROAD_CAMERA = "abilitySupport/rss/"
const val SINGLE_LIVE = "abilitySupport/rss/queryLive"
const val BATCH_LIVE = "abilitySupport/rss/queryLiveAll"
interface INDERoadCameraApiService {
// 获取路口处路侧直播流设备ip地址(批量返回) todo post地址待给出
@Headers("Content-type:application/json;charset=UTF-8")
@POST(ROAD_CAMERA)
suspend fun roadCameraRequest(
@Header("MogoAuthKey") authKey: String,
@Header("MogoReqTime") time: String,
@Body map: MutableMap<String, Any>
): Response<Any>
// 单ip查询设备直播流与缩略图
@Headers("Content-type:application/json;charset=UTF-8")
@GET(SINGLE_LIVE)
suspend fun cameraLiveSingleRequest(
@Header("MogoAuthKey") authKey: String,
@Header("MogoReqTime") time: String,
@Query("ip") ip: String,
@Query("lon") lon: Double,
@Query("lat") lat: Double
): Response<Any>
// 批量ip查询设备直播流与缩略图
@Headers("Content-type:application/json;charset=UTF-8")
@POST(BATCH_LIVE)
suspend fun cameraLiveBatchRequest(
@Header("MogoAuthKey") authKey: String,
@Header("MogoReqTime") time: String,
@Body map: MutableMap<String, Any>
): Response<Any>
}

View File

@@ -0,0 +1,43 @@
package com.mogo.eagle.core.function.business.roadcross.net
import com.mogo.commons.constants.HostConst
import com.mogo.eagle.core.data.Response
import com.mogo.eagle.core.network.MoGoRetrofitFactory
import com.mogo.eagle.core.network.apiResponseCall
import com.mogo.eagle.core.network.request
import com.mogo.eagle.core.utilcode.util.Md5Util
import java.util.Locale
class NDERoadCameraNetWorkModel {
companion object {
val ndeRoadCameraNetWorkModel by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
NDERoadCameraNetWorkModel()
}
}
private fun getNetWorkApi(baseUrl: String = HostConst.getNDEHost()): INDERoadCameraApiService {
return MoGoRetrofitFactory.getInstanceNoCallAdapter(baseUrl)
.create(INDERoadCameraApiService::class.java)
}
fun getRoadCrossInfo(crossID: String) {
request<Response<Any>> {
loader {
apiResponseCall {
val map = mutableMapOf<String, Any>()
map["crossID"] = crossID
val time = System.currentTimeMillis().toString()
val md5String = "${ROAD_CAMERA.uppercase(Locale.getDefault())}$time"
getNetWorkApi().roadCameraRequest(Md5Util.getMD5Result(md5String), time, map)
}
}
onSuccess {
}
onError {
}
}
}
}