[6.5.0] fix bug of request auth and result
This commit is contained in:
@@ -2,7 +2,6 @@ package com.mogo.eagle.function.biz.v2x.trafficlight.core
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Handler
|
||||
import android.os.HandlerThread
|
||||
import android.os.Looper
|
||||
import com.mogo.eagle.core.data.biz.trafficlight.RoadIDResult
|
||||
import com.mogo.eagle.core.data.biz.trafficlight.TrafficLightControl
|
||||
@@ -10,6 +9,7 @@ import com.mogo.eagle.core.data.biz.trafficlight.TrafficLightResult
|
||||
import com.mogo.eagle.core.data.biz.trafficlight.isInRange
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
import com.mogo.eagle.core.function.api.map.road.IMoGoMapRoadListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
|
||||
@@ -23,7 +23,7 @@ import com.mogo.eagle.function.biz.v2x.trafficlight.network.TrafficLightNetWorkM
|
||||
import com.zhidaoauto.map.data.road.RoadCross
|
||||
|
||||
class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener,
|
||||
CallerMapRoadListenerManager.OnRoadListener {
|
||||
IMoGoMapRoadListener {
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -52,7 +52,7 @@ class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener,
|
||||
fun initServer(context: Context) {
|
||||
mContext = context
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, this)
|
||||
CallerMapRoadListenerManager.registerRoadListener(TAG, this)
|
||||
CallerMapRoadListenerManager.addListener(TAG, this)
|
||||
mThreadHandler =
|
||||
TrafficLightThreadHandler(Looper.getMainLooper(), {
|
||||
//第一次查询路口时,如果红绿灯显示,则隐藏掉
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoV2XListener
|
||||
import com.mogo.eagle.core.function.api.cloud.IMoGoCloudListener
|
||||
import com.mogo.eagle.core.function.api.map.road.IMoGoMapRoadListener
|
||||
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
|
||||
@@ -42,7 +43,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerV2XListenerManager.V2NC
|
||||
import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager.OnRoadListener
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
@@ -79,7 +79,7 @@ import java.util.concurrent.atomic.AtomicReference
|
||||
|
||||
object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IV2XCallback,
|
||||
IMoGoAutopilotIdentifyListener, IMoGoCloudListener,
|
||||
IMoGoV2XListener, IMoGoAutopilotStatusListener, OnRoadListener {
|
||||
IMoGoV2XListener, IMoGoAutopilotStatusListener, IMoGoMapRoadListener {
|
||||
|
||||
private const val TAG = "V2XEventManager"
|
||||
|
||||
@@ -108,7 +108,7 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IV2XCallback,
|
||||
v2xPoiLoader.startLoopPoi()
|
||||
// 注册广播接收场景弹窗使用的
|
||||
SceneBroadcastReceiver.register(context)
|
||||
CallerMapRoadListenerManager.registerRoadListener(TAG, this)
|
||||
CallerMapRoadListenerManager.addListener(TAG, this)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,7 +363,7 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IV2XCallback,
|
||||
unRegisterListener()
|
||||
}
|
||||
v2xPoiLoader.stopLoopPoi()
|
||||
CallerMapRoadListenerManager.unRegisterRoadListener(TAG)
|
||||
CallerMapRoadListenerManager.removeListener(TAG)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.camera
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
|
||||
class RoadCrossLiveView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr) {
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_road_cross_live, this, true)
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
}
|
||||
}
|
||||
@@ -420,16 +420,16 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
*/
|
||||
tbStatusCenter.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
val cross = RoadCross()
|
||||
CallerMapRoadListenerManager.invokeRoadChange(0, cross)
|
||||
// if (isChecked) {
|
||||
// buttonView.setCompoundDrawables(null, null, iconDown, null)
|
||||
// //展示状态中心
|
||||
// statusCenterLayout.visibility = View.VISIBLE
|
||||
// } else {
|
||||
// buttonView.setCompoundDrawables(null, null, iconRight, null)
|
||||
// //隐藏状态中心
|
||||
// statusCenterLayout.visibility = View.GONE
|
||||
// }
|
||||
// CallerMapRoadListenerManager.invokeRoadChange(0, cross)
|
||||
if (isChecked) {
|
||||
buttonView.setCompoundDrawables(null, null, iconDown, null)
|
||||
//展示状态中心
|
||||
statusCenterLayout.visibility = View.VISIBLE
|
||||
} else {
|
||||
buttonView.setCompoundDrawables(null, null, iconRight, null)
|
||||
//隐藏状态中心
|
||||
statusCenterLayout.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -15,9 +15,9 @@ import com.mogo.eagle.core.function.angle.scenes.Default
|
||||
import com.mogo.eagle.core.function.angle.scenes.RoadEvent
|
||||
import com.mogo.eagle.core.function.api.map.angle.*
|
||||
import com.mogo.eagle.core.function.api.map.angle.Scene
|
||||
import com.mogo.eagle.core.function.api.map.road.IMoGoMapRoadListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.*
|
||||
import com.mogo.eagle.core.function.call.map.*
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager.OnRoadListener
|
||||
import com.mogo.eagle.core.utilcode.kotlin.*
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.zhidaoauto.map.data.road.StopLine
|
||||
@@ -61,7 +61,7 @@ class MoGoVisualAngleChangeProvider: IMoGoVisualAngleChangeProvider {
|
||||
PriorityQueue<Record>()
|
||||
}
|
||||
|
||||
private val listener = object : OnRoadListener {
|
||||
private val listener = object : IMoGoMapRoadListener {
|
||||
private val roadId = AtomicReference<String>()
|
||||
private val triggerRoadId = AtomicReference<String>()
|
||||
|
||||
@@ -122,11 +122,11 @@ class MoGoVisualAngleChangeProvider: IMoGoVisualAngleChangeProvider {
|
||||
ctx.lifeCycleOwner.lifecycle.addObserver(object : LifecycleEventObserver {
|
||||
override fun onStateChanged(source: LifecycleOwner, event: Event) {
|
||||
if (event == ON_DESTROY) {
|
||||
CallerMapRoadListenerManager.unRegisterRoadListener("VisualAngleChange")
|
||||
CallerMapRoadListenerManager.removeListener(TAG)
|
||||
}
|
||||
}
|
||||
})
|
||||
CallerMapRoadListenerManager.registerRoadListener("VisualAngleChange", listener)
|
||||
CallerMapRoadListenerManager.addListener(TAG, listener)
|
||||
}
|
||||
|
||||
@Volatile
|
||||
|
||||
@@ -3,8 +3,10 @@ package com.mogo.eagle.core.function.business.roadcross
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
import com.mogo.eagle.core.data.road.CameraDeviceInfo
|
||||
import com.mogo.eagle.core.function.api.map.road.IMoGoMapRoadListener
|
||||
import com.mogo.eagle.core.function.business.roadcross.net.NDERoadCameraNetWorkModel.Companion.ndeRoadCameraNetWorkModel
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager
|
||||
@@ -12,6 +14,7 @@ import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import com.mogo.eagle.core.function.view.CameraMarkerView
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.map.overlay.core.Level
|
||||
import com.mogo.map.overlay.point.Point
|
||||
import com.zhidaoauto.map.data.road.RoadCross
|
||||
@@ -19,7 +22,7 @@ import com.zhidaoauto.map.data.road.StopLine
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
class RoadCrossCameraManager : CallerMapRoadListenerManager.OnRoadListener {
|
||||
class RoadCrossCameraManager : IMoGoMapRoadListener {
|
||||
companion object {
|
||||
|
||||
private const val TAG = "RoadCrossCameraManager"
|
||||
@@ -41,7 +44,7 @@ class RoadCrossCameraManager : CallerMapRoadListenerManager.OnRoadListener {
|
||||
|
||||
fun init(context: Context?) {
|
||||
mContext = context
|
||||
CallerMapRoadListenerManager.registerRoadListener(TAG, this)
|
||||
CallerMapRoadListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
//todo 记录方法执行时间
|
||||
@@ -56,7 +59,7 @@ class RoadCrossCameraManager : CallerMapRoadListenerManager.OnRoadListener {
|
||||
if (roadCrossEnd != null) {
|
||||
ndeRoadCameraNetWorkModel.getRoadCrossInfo(roadCrossEnd,
|
||||
onSuccess = {
|
||||
if (it.roadUniqueId == null) {
|
||||
if (it.crossingId == null) {
|
||||
traceError("roadUniqueId is null")
|
||||
return@getRoadCrossInfo
|
||||
}
|
||||
@@ -64,10 +67,6 @@ class RoadCrossCameraManager : CallerMapRoadListenerManager.OnRoadListener {
|
||||
traceError("deviceInfoList isEmpty")
|
||||
return@getRoadCrossInfo
|
||||
}
|
||||
if (it.roadUniqueId != roadCrossEnd) {
|
||||
traceError("cloud roadId :${it.roadUniqueId} is not equal currentCross : $roadCrossEnd")
|
||||
return@getRoadCrossInfo
|
||||
}
|
||||
roadCrossCameraList = it.deviceInfoList
|
||||
// 地图上打marker(注意marker方向),marker点击获取对应ip
|
||||
it.deviceInfoList.forEach { deviceInfo ->
|
||||
@@ -86,6 +85,7 @@ class RoadCrossCameraManager : CallerMapRoadListenerManager.OnRoadListener {
|
||||
}
|
||||
|
||||
private fun addCameraDeviceMarker(cameraDeviceInfo: CameraDeviceInfo) {
|
||||
Log.d("emArrow","add marker:${cameraDeviceInfo.deviceIp}")
|
||||
mContext?.let {
|
||||
val builder =
|
||||
Point.Options.Builder(TAG, Level.MAP_MARKER)
|
||||
@@ -102,11 +102,11 @@ class RoadCrossCameraManager : CallerMapRoadListenerManager.OnRoadListener {
|
||||
.onClick { id ->
|
||||
Log.d("emArrow", "Marker click :$id")
|
||||
ndeRoadCameraNetWorkModel.singleRequestCrossLive(id,
|
||||
onSuccess = {
|
||||
|
||||
onSuccess = { live ->
|
||||
CallerMapRoadListenerManager.invokeRoadCrossLive(live)
|
||||
},
|
||||
onError = {
|
||||
|
||||
onError = {errorMsg ->
|
||||
traceError(" ${cameraDeviceInfo.deviceIp} click request error :$errorMsg")
|
||||
})
|
||||
}
|
||||
CallerLogger.d("$M_MAP$TAG", "new road cross camera=$overlayManager")
|
||||
@@ -135,12 +135,12 @@ class RoadCrossCameraManager : CallerMapRoadListenerManager.OnRoadListener {
|
||||
|
||||
override fun onRoadChange(cross: Boolean, roadCross: RoadCross?) {
|
||||
super.onRoadChange(cross, roadCross)
|
||||
// val data = CameraDeviceInfo("172.18.1.60", 112.582913287, 26.9320508672) //todo emArrow test
|
||||
// addCameraDeviceMarker(data)
|
||||
// val data1 = CameraDeviceInfo("172.18.1.42", 112.582947017, 26.9328373092)
|
||||
// addCameraDeviceMarker(data1)
|
||||
// val data2 = CameraDeviceInfo("172.18.1.72", 112.582421, 26.932519)
|
||||
// addCameraDeviceMarker(data2)
|
||||
val data = CameraDeviceInfo("172.18.1.60", 112.582913287, 26.9320508672) //todo emArrow test
|
||||
addCameraDeviceMarker(data)
|
||||
val data1 = CameraDeviceInfo("172.18.1.42", 112.582947017, 26.9328373092)
|
||||
addCameraDeviceMarker(data1)
|
||||
val data2 = CameraDeviceInfo("172.18.1.72", 112.582421, 26.932519)
|
||||
addCameraDeviceMarker(data2)
|
||||
|
||||
// 出路口
|
||||
if (!cross) {
|
||||
@@ -149,15 +149,20 @@ class RoadCrossCameraManager : CallerMapRoadListenerManager.OnRoadListener {
|
||||
// 清除marker
|
||||
roadCrossCameraList?.let {
|
||||
it.forEach { camera ->
|
||||
Log.d("emArrow","remove marker:${camera.deviceIp}")
|
||||
overlayManager?.removePoint(camera.deviceIp)
|
||||
}
|
||||
}
|
||||
// 释放控制
|
||||
isCameraRequest = false
|
||||
Log.d("emArrow", "经过路口,释放控制")
|
||||
}
|
||||
}
|
||||
|
||||
private fun traceError(msg: String) {
|
||||
if(DebugConfig.isDebug()){
|
||||
ToastUtils.showLong(msg)
|
||||
}
|
||||
val loc = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
|
||||
roadCrossTrace(
|
||||
TAG, mapOf(
|
||||
|
||||
@@ -24,7 +24,7 @@ interface INDERoadCameraApiService {
|
||||
@Query("roadUniqueId") roadId: String,
|
||||
@Query("lon") lon: Double,
|
||||
@Query("lat") lat: Double
|
||||
): BaseResponse<RoadCrossCamera>
|
||||
): BaseResponse<List<RoadCrossCamera>>
|
||||
|
||||
// 单ip查询设备直播流与缩略图
|
||||
@GET(SINGLE_LIVE)
|
||||
|
||||
@@ -30,7 +30,7 @@ class NDERoadCameraNetWorkModel private constructor() {
|
||||
onSuccess: ((RoadCrossCamera) -> Unit),
|
||||
onError: ((String) -> Unit)
|
||||
) {
|
||||
request<BaseResponse<RoadCrossCamera>>("roadCross") {
|
||||
request<BaseResponse<List<RoadCrossCamera>>>("roadCross") {
|
||||
loader {
|
||||
apiCall {
|
||||
val loc = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
|
||||
@@ -45,7 +45,11 @@ class NDERoadCameraNetWorkModel private constructor() {
|
||||
}
|
||||
}
|
||||
onSuccess {
|
||||
onSuccess.invoke(it.result)
|
||||
if(it.result.isNotEmpty()){
|
||||
onSuccess.invoke(it.result[0])
|
||||
}else{
|
||||
onError.invoke("getRoadCrossInfo empty camera info")
|
||||
}
|
||||
}
|
||||
onError {
|
||||
onError.invoke(it.message.toString())
|
||||
@@ -112,7 +116,7 @@ class NDERoadCameraNetWorkModel private constructor() {
|
||||
|
||||
private fun getAuth(url: String): Pair<String, String> {
|
||||
val time = System.currentTimeMillis().toString()
|
||||
val md5String = "${url.uppercase(Locale.getDefault())}$time"
|
||||
val md5String = "/${url.uppercase(Locale.getDefault())}$time"
|
||||
val auth = Md5Util.getMD5Result(md5String)
|
||||
return Pair(auth, time)
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context,
|
||||
//设置倾斜手势是否可用。
|
||||
it.setTiltGesturesEnabled(false)
|
||||
//设置双指缩放手势是否可用。
|
||||
it.setZoomGesturesEnabled(true)
|
||||
it.setZoomGesturesEnabled(false) //true todo emArrow test
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user