[code_opt_3.3.0] code opt
This commit is contained in:
@@ -16,7 +16,7 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
|
||||
import com.mogo.eagle.core.function.api.hmi.autopilot.IMoGoCheckAutoPilotBtnListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getState
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
@@ -73,10 +73,7 @@ class DispatchAutoPilotManager private constructor() :
|
||||
msg.obj as DispatchAdasAutoPilotLocReceiverBean
|
||||
CallerHmiManager.showDispatchDialog(msgData)
|
||||
} else if (msg.what == MSG_TYPE_UPLOAD_AUTOPILOT_STATUS) {
|
||||
dispatchServiceModel.uploadAutopilotStatus(
|
||||
getAutoPilotStatusInfo().state,
|
||||
getAutoPilotStatusInfo().reason
|
||||
)
|
||||
dispatchServiceModel.uploadAutopilotStatus(getState(), "")
|
||||
sendEmptyMessageDelayed(MSG_TYPE_UPLOAD_AUTOPILOT_STATUS, 1000L)
|
||||
} else if(msg.what == MSG_TYPE_UPLOAD_AUTOPILOT_ROTTING){
|
||||
val data = msg.obj as MessagePad.GlobalPathResp
|
||||
|
||||
@@ -48,7 +48,6 @@ class CronTaskManager {
|
||||
CRON_TASK_TYPE -> {
|
||||
removeMessages(CRON_TASK_TYPE)
|
||||
// 路测和车侧摄像头列表分开调用
|
||||
// requestCameraList()
|
||||
requestDeviceList()
|
||||
requestCarCameraList()
|
||||
sendEmptyMessageDelayed(CRON_TASK_TYPE, 10000)
|
||||
@@ -57,35 +56,6 @@ class CronTaskManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("已废弃", ReplaceWith("requestDeviceList()"), DeprecationLevel.WARNING)
|
||||
private fun requestCameraList() {
|
||||
// 衡阳可直播的摄像头有限,先写死roadId便于调试
|
||||
disposable = MoGoRetrofitFactory.getInstance(HostConst.CAMERA_STREAM_HOST)
|
||||
.create(ICameraListServices::class.java)
|
||||
.getCameraList("10849")
|
||||
.subscribeOn(Schedulers.io())
|
||||
.map { cameraListInfo ->
|
||||
cameraListInfo.result?.crossings?.flatMap { crossing ->
|
||||
crossing.cameras.filter { camera ->
|
||||
!camera.flvUrl.isNullOrEmpty()
|
||||
}.map {
|
||||
CameraEntity(
|
||||
it.flvUrl, "", it.roadName,
|
||||
it.crossingName, it.getHeadingStr(), it.ip
|
||||
)
|
||||
}
|
||||
} ?: ArrayList()
|
||||
}
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({
|
||||
cameraList = it
|
||||
CallerLogger.d("$M_MONITOR$TAG", "requestCameraList返回结果为:$it")
|
||||
}, {
|
||||
it.printStackTrace()
|
||||
CallerLogger.e("$M_MONITOR$TAG", "message is:${it.message}, cause is:${it.cause}")
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求路口一定范围内的设备信息(包含:摄像头、灯)
|
||||
*/
|
||||
@@ -124,7 +94,7 @@ class CronTaskManager {
|
||||
}
|
||||
|
||||
private fun requestCarCameraList() {
|
||||
CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()?.let { location ->
|
||||
CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02().let { location ->
|
||||
carDisposable = MoGoRetrofitFactory.getInstance(HostConst.getEagleHost())
|
||||
.create(ICameraListServices::class.java)
|
||||
.getCarCameraList(ReqLiveCarBean(location.longitude, location.latitude))
|
||||
@@ -151,41 +121,9 @@ class CronTaskManager {
|
||||
)
|
||||
it.printStackTrace()
|
||||
})
|
||||
} ?: run {
|
||||
CallerLogger.e("$M_MONITOR$TAG", "CurrentLocation is null!")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启从摄像头拉流
|
||||
*/
|
||||
@Deprecated("已废弃", ReplaceWith("requestDeviceList()"), DeprecationLevel.WARNING)
|
||||
fun requestOpenCamera(cameraIp: String) {
|
||||
streamDisposable?.let {
|
||||
if (!it.isDisposed) it.dispose()
|
||||
}
|
||||
streamDisposable = MoGoRetrofitFactory.getInstance(HostConst.OPEN_CAMERA_STREAM_HOST)
|
||||
.create(ICameraListServices::class.java)
|
||||
.openCameraStream(cameraIp)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({
|
||||
CallerLogger.d("$M_MONITOR$TAG", "openCameraStream返回结果为:$it")
|
||||
it.result?.let { streamResult ->
|
||||
if (!streamResult.flvUrl.isNullOrEmpty()) CallerHmiManager.startRoadCameraLive(
|
||||
streamResult.flvUrl!!
|
||||
)
|
||||
}
|
||||
}, {
|
||||
CallerLogger.e(
|
||||
"$M_MONITOR$TAG",
|
||||
"openCameraStream&message is:${it.message}, cause is:${it.cause}"
|
||||
)
|
||||
CallerHmiManager.showNoSignalView()
|
||||
it.printStackTrace()
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开单个视频推流
|
||||
*/
|
||||
|
||||
@@ -85,7 +85,7 @@ object OverViewDataManager {
|
||||
// 1分钟查询一次
|
||||
disposable = Observable.interval(2000, 60000, TimeUnit.MILLISECONDS)
|
||||
.flatMap {
|
||||
val lineId = getLineId()
|
||||
val lineId = CallerAutoPilotStatusListenerManager.getLineId()
|
||||
if (lineId > 0) {
|
||||
MoGoRetrofitFactory.getInstance(HostConst.getHost())
|
||||
.create(OverViewServiceApi::class.java)
|
||||
@@ -119,20 +119,4 @@ object OverViewDataManager {
|
||||
disposable?.dispose()
|
||||
}
|
||||
|
||||
private fun getLineId(): Long {
|
||||
var lineId: Long = -1
|
||||
val parameter = CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo()
|
||||
.autopilotControlParameters
|
||||
if (parameter != null) {
|
||||
if (parameter.autoPilotLine != null) {
|
||||
lineId = parameter.autoPilotLine!!.lineId
|
||||
CallerLogger.d(SceneConstant.M_MAP + TAG, "lineId为:$lineId")
|
||||
} else {
|
||||
CallerLogger.d(SceneConstant.M_MAP + TAG, "parameter.autoPilotLine为null")
|
||||
}
|
||||
} else {
|
||||
CallerLogger.d(SceneConstant.M_MAP + TAG, "parameter为null")
|
||||
}
|
||||
return lineId
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,6 @@ import com.mogo.eagle.core.data.v2x.V2XEvent
|
||||
import com.mogo.eagle.core.data.v2x.V2XMarkerResponse
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.eagle.function.biz.v2x.v2n.network.V2XRefreshModel
|
||||
import com.mogo.eagle.function.biz.v2x.v2n.network.callback.IV2XCallback
|
||||
@@ -143,33 +141,16 @@ class V2XPoiLoader private constructor() {
|
||||
fun queryWholeRoadEvents() {
|
||||
V2XRefreshModel.roadEventDispose()
|
||||
val sn = MoGoAiCloudClientConfig.getInstance().sn
|
||||
val lineId = getLineId()
|
||||
val lineId = CallerAutoPilotStatusListenerManager.getLineId()
|
||||
if (lineId > 0) {
|
||||
realQueryV2xEvents(lineId.toString(), sn)
|
||||
} else {
|
||||
UiThreadHandler.postDelayed({
|
||||
realQueryV2xEvents(getLineId().toString(), sn)
|
||||
realQueryV2xEvents(CallerAutoPilotStatusListenerManager.getLineId().toString(), sn)
|
||||
}, 500)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getLineId(): Long {
|
||||
var lineId: Long = -1
|
||||
val parameter = CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo()
|
||||
.autopilotControlParameters
|
||||
if (parameter != null) {
|
||||
if (parameter.autoPilotLine != null) {
|
||||
lineId = parameter.autoPilotLine!!.lineId
|
||||
CallerLogger.d(SceneConstant.M_V2X + TAG, "lineId为:$lineId")
|
||||
} else {
|
||||
CallerLogger.d(SceneConstant.M_V2X + TAG, "parameter.autoPilotLine为null")
|
||||
}
|
||||
} else {
|
||||
CallerLogger.d(SceneConstant.M_V2X + TAG, "parameter为null")
|
||||
}
|
||||
return lineId
|
||||
}
|
||||
|
||||
private fun realQueryV2xEvents(lineId: String, sn: String) {
|
||||
V2XRefreshModel.getRoadEvents(lineId, sn) {
|
||||
val size = it?.size ?: 0
|
||||
|
||||
Reference in New Issue
Block a user