[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
|
||||
|
||||
@@ -12,7 +12,6 @@ import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_AD
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_AUTOPILOT_RECORD
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_AUTOPILOT_ROUTE
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_AUTOPILOT_STATUS
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_AUTOPILOT_TRAFFIC_LIGHT
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_AUTOPILOT_TRAJECTORY
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_AUTOPILOT_VEHICLE
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_CAR_CONFIG
|
||||
@@ -21,21 +20,20 @@ import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_AD
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_P_OBJECTS
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_STATUS_QUERY_RESP
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_SOURCE_ADAS
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_GNSS
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_INIT_STATUS
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_SOCKET_AUTOPILOT
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_GNSS
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_SOCKET_P_ACTIONS
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_SOCKET_P_OBJECTS
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_SOCKET_TRAFFIC_LIGHT
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_SOCKET_TRAJECTORY
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_SOCKET_VEHICLE
|
||||
import com.mogo.eagle.core.function.call.autopilot.*
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeArriveAtStation
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutoPilotStatus
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotGuardian
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotSNRequest
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotStatusRespByQuery
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.updateAutoPilotStatus
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager.invokeAutopilotAbility
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager.invokeAutopilotCarConfigData
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager.invokeAutopilotIdentifyDataUpdate
|
||||
@@ -53,10 +51,8 @@ import com.mogo.eagle.core.function.call.obu.CallerObuWarningRsiListenerManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuWarningRsmListenerManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuWarningSpatListenerManager
|
||||
import com.mogo.eagle.core.function.call.v2x.*
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.support.obu.ObuScene
|
||||
import com.zhidao.support.adas.high.AdasManager
|
||||
import com.zhidao.support.adas.high.OnAdasListener
|
||||
import com.zhjt.mogo.adas.data.bean.AdasParam
|
||||
import com.zhidao.support.adas.high.common.ProtocolStatus
|
||||
@@ -83,10 +79,6 @@ import record_cache.RecordPanelOuterClass
|
||||
import system_master.SystemStatusInfo
|
||||
|
||||
/**
|
||||
* @author emArrow
|
||||
* @since 2022/3/11
|
||||
*
|
||||
*
|
||||
* 适配ADAS 回调监听分发,这里不做业务,只做数据包装及分发处理
|
||||
*/
|
||||
class MoGoAdasListenerImpl : OnAdasListener {
|
||||
@@ -139,7 +131,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
if (gnssInfo != null) {
|
||||
if (1 == FunctionBuildConfig.gpsProvider) {
|
||||
// 同步更新经纬度和系统时间至 AutoPilotStatusListener
|
||||
CallerAutoPilotStatusListenerManager.updateAutoPilotLatLon(
|
||||
CallerAutoPilotStatusListenerManager.updateAutoPilotLocAndTime(
|
||||
gnssInfo.satelliteTime,
|
||||
gnssInfo.longitude,
|
||||
gnssInfo.latitude
|
||||
@@ -288,29 +280,8 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
if (autopilotState != null) {
|
||||
//工控机模拟时间
|
||||
CallerAutopilotVehicleStateListenerManager.invokeAutopilotTime(header.timestamp.toLong())
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
// 初始化自动驾驶状态信息
|
||||
val autopilotStatusInfo = getAutoPilotStatusInfo()
|
||||
autopilotStatusInfo.state = autopilotState.state
|
||||
autopilotStatusInfo.pilotmode = autopilotState.autopilotMode
|
||||
autopilotStatusInfo.reason = autopilotState.reason
|
||||
autopilotStatusInfo.version = AdasManager.getInstance().adasVersion
|
||||
if (autopilotStatusInfo.connectIP == null) {
|
||||
autopilotStatusInfo.connectIP = AdasManager.getInstance().ipcConnectedIp
|
||||
}
|
||||
if (autopilotStatusInfo.connectPort == null) {
|
||||
autopilotStatusInfo.connectPort = AdasManager.getInstance().ipcConnectedPort
|
||||
}
|
||||
AdasManager.getInstance().carConfig?.let {
|
||||
autopilotStatusInfo.dockVersion = it.dockVersion
|
||||
}
|
||||
CallerLogger.d(
|
||||
"Upgrade",
|
||||
"origin = ${autopilotStatusInfo.connectStatus} -----now = ${AppConfigInfo.isConnectAutopilot} "
|
||||
)
|
||||
AppConfigInfo.isConnectAutopilot = autopilotStatusInfo.connectStatus
|
||||
AppConfigInfo.connectStatusDescribe = autopilotStatusInfo.connectStatusDescribe
|
||||
invokeAutoPilotStatus()
|
||||
if (HdMapBuildConfig.isMapLoaded) { //todo check
|
||||
updateAutoPilotStatus(autopilotState.state, autopilotState.autopilotMode)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -332,12 +303,6 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
}
|
||||
|
||||
//感知红绿灯
|
||||
@ChainLog(
|
||||
linkChainLog = CHAIN_TYPE_SOCKET_TRAFFIC_LIGHT,
|
||||
linkCode = CHAIN_SOURCE_ADAS,
|
||||
nodeAliasCode = CHAIN_CODE_ADAS_AUTOPILOT_TRAFFIC_LIGHT,
|
||||
paramIndexes = [0, 1]
|
||||
)
|
||||
override fun onPerceptionTrafficLight(
|
||||
header: MessagePad.Header?,
|
||||
trafficLights: TrafficLightOuterClass.TrafficLights?
|
||||
@@ -398,6 +363,8 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
carConfigResp: MessagePad.CarConfigResp?
|
||||
) {
|
||||
if (carConfigResp != null) {
|
||||
val autopilotStatusInfo = getAutoPilotStatusInfo()
|
||||
autopilotStatusInfo.dockVersion = carConfigResp.dockVersion
|
||||
AppConfigInfo.dockerVersion = carConfigResp.dockVersion
|
||||
AppConfigInfo.plateNumber = carConfigResp.plateNumber//车牌号
|
||||
AppConfigInfo.iPCMacAddress = carConfigResp.macAddress//工控机MAC地址
|
||||
@@ -584,7 +551,10 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
* @param header 头
|
||||
* @param roboSweeperTaskIndex 数据
|
||||
*/
|
||||
override fun onSweeperTaskIndexData(header: MessagePad.Header?, roboSweeperTaskIndex: RoboSweeperTaskIndexOuterClass.RoboSweeperTaskIndex?) {
|
||||
override fun onSweeperTaskIndexData(
|
||||
header: MessagePad.Header?,
|
||||
roboSweeperTaskIndex: RoboSweeperTaskIndexOuterClass.RoboSweeperTaskIndex?
|
||||
) {
|
||||
roboSweeperTaskIndex?.let {
|
||||
//清扫车(福田)清扫控制系统状态
|
||||
CallerSweeperFutianCleanSystemListenerManager.invokeSweeperFutianCleanTaskIndexData(it)
|
||||
@@ -719,7 +689,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
linkChainLog = ChainConstant.CHAIN_TYPE_CLOUD_V2N,
|
||||
linkCode = ChainConstant.CHAIN_SOURCE_CLOUD,
|
||||
nodeAliasCode = ChainConstant.CHAIN_CODE_CLOUD_V2N,
|
||||
paramIndexes = [0,1]
|
||||
paramIndexes = [0, 1]
|
||||
)
|
||||
override fun onV2nCongestionEvent(header: MessagePad.Header, rsi: MogoV2X.RSI_PB) {
|
||||
CallerAutopilotIdentifyListenerManager.invokeAutopilotV2nCongestionEvent(header, rsi)
|
||||
@@ -741,8 +711,21 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
nodeAliasCode = ChainConstant.CHAIN_CODE_CLOUD_V2N,
|
||||
paramIndexes = [0]
|
||||
)
|
||||
override fun onV2nGlobalPathEvents(header: MessagePad.Header, roadOverview: RoadOverviewEvents.RoadOverviewData, construct: MogoV2X.RSI_PB?, triangle: MogoV2X.RSI_PB?, congestion: MogoV2X.RSI_PB?, parkingViolation: MogoV2X.RSM_PB?) {
|
||||
CallerV2XListenerManager.dispatchV2nGlobalPathEvents(roadOverview.eventCount, construct, triangle, congestion, parkingViolation)
|
||||
override fun onV2nGlobalPathEvents(
|
||||
header: MessagePad.Header,
|
||||
roadOverview: RoadOverviewEvents.RoadOverviewData,
|
||||
construct: MogoV2X.RSI_PB?,
|
||||
triangle: MogoV2X.RSI_PB?,
|
||||
congestion: MogoV2X.RSI_PB?,
|
||||
parkingViolation: MogoV2X.RSM_PB?
|
||||
) {
|
||||
CallerV2XListenerManager.dispatchV2nGlobalPathEvents(
|
||||
roadOverview.eventCount,
|
||||
construct,
|
||||
triangle,
|
||||
congestion,
|
||||
parkingViolation
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.datacenter.autopilot.adapter
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.debug.DebugConfig.*
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.cloud.IMoGoCloudListener
|
||||
@@ -24,11 +25,11 @@ import com.zhidao.support.adas.high.common.Constants.TERMINAL_ROLE.PASSENGER
|
||||
* ADAS-SDK与工控机连接状态回调
|
||||
*/
|
||||
class MoGoAdasMsgConnectStatusListenerImpl :
|
||||
OnAdasConnectStatusListener,
|
||||
IMoGoAutopilotStatusListener,
|
||||
IMoGoCloudListener {
|
||||
OnAdasConnectStatusListener,
|
||||
IMoGoAutopilotStatusListener,
|
||||
IMoGoCloudListener {
|
||||
|
||||
companion object{
|
||||
companion object {
|
||||
private const val TAG = "ConnectStatus"
|
||||
}
|
||||
|
||||
@@ -40,9 +41,10 @@ class MoGoAdasMsgConnectStatusListenerImpl :
|
||||
|
||||
override fun onConnectionIPCStatus(ipcConnectionStatus: Int, reason: String?) {
|
||||
CallerAutoPilotStatusListenerManager.invokeAutoPilotIPCStatusChanged(
|
||||
ipcConnectionStatus,
|
||||
reason
|
||||
ipcConnectionStatus,
|
||||
reason
|
||||
)
|
||||
AppConfigInfo.connectStatusDescribe = reason
|
||||
when (ipcConnectionStatus) {
|
||||
Constants.IPC_CONNECTION_STATUS.CONNECTED -> {
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "webSocket 连接成功")
|
||||
@@ -52,7 +54,10 @@ class MoGoAdasMsgConnectStatusListenerImpl :
|
||||
AdasManager.getInstance().ipcConnectedIp
|
||||
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectPort =
|
||||
AdasManager.getInstance().ipcConnectedPort
|
||||
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().version =
|
||||
AdasManager.getInstance().adasVersion
|
||||
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectStatus = true
|
||||
AppConfigInfo.isConnectAutopilot = true
|
||||
// 同步SN给工控机
|
||||
syncBasicInfoToAutopilot()
|
||||
//每次工控机连接成功后,需同步当前设置的美化模式状态
|
||||
@@ -77,6 +82,7 @@ class MoGoAdasMsgConnectStatusListenerImpl :
|
||||
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectPort =
|
||||
AdasManager.getInstance().ipcConnectedPort
|
||||
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectStatus = false
|
||||
AppConfigInfo.isConnectAutopilot = false
|
||||
//与工控机断开连接,需要重置自动驾驶状态(包括上传至云平台缓存信息),等待连接成功后同步状态信息
|
||||
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state = 0
|
||||
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().pilotmode = 0
|
||||
@@ -91,8 +97,7 @@ class MoGoAdasMsgConnectStatusListenerImpl :
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "webSocket 找不到可用IP 传入的IP不可用或固定IP列表中所有IP不可用")
|
||||
}
|
||||
}
|
||||
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().ipcConnStatus =
|
||||
ipcConnectionStatus
|
||||
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().ipcConnStatus = ipcConnectionStatus
|
||||
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectStatusDescribe = reason
|
||||
CallerAutoPilotStatusListenerManager.invokeAutoPilotStatus()
|
||||
}
|
||||
@@ -116,19 +121,19 @@ class MoGoAdasMsgConnectStatusListenerImpl :
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
// 设置PAD-SN给工控,网络环境
|
||||
AdasManager.getInstance()
|
||||
.sendBasicInfoResp(
|
||||
MoGoAiCloudClientConfig.getInstance().sn,
|
||||
getEnvironment(),
|
||||
getTerminalRole()
|
||||
)
|
||||
.sendBasicInfoResp(
|
||||
MoGoAiCloudClientConfig.getInstance().sn,
|
||||
getEnvironment(),
|
||||
getTerminalRole()
|
||||
)
|
||||
} else {
|
||||
// 乘客屏先不传sn
|
||||
AdasManager.getInstance()
|
||||
.sendBasicInfoResp(
|
||||
"",
|
||||
getEnvironment(),
|
||||
getTerminalRole()
|
||||
)
|
||||
.sendBasicInfoResp(
|
||||
"",
|
||||
getEnvironment(),
|
||||
getTerminalRole()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.mogo.eagle.core.function.datacenter.location
|
||||
|
||||
import android.util.Log
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
@@ -53,7 +52,6 @@ object MoGoLocationDispatcher :
|
||||
|
||||
override fun onChassisGnss(gnssInfo: MessagePad.GnssInfo) {
|
||||
// 更新GNSS 信息
|
||||
Log.d("emArrow","高精 heading:${gnssInfo.heading}")
|
||||
lastGnssLocation.gnssInfo = gnssInfo
|
||||
lastGnssLocation.lastReceiveTime = TimeUtils.getNowMills()
|
||||
// 将高德中的一些用于业务的数据进行融合,例如:CityCode、address等
|
||||
@@ -81,7 +79,6 @@ object MoGoLocationDispatcher :
|
||||
lastGnssLocation.errorCode = it.errorCode
|
||||
lastGnssLocation.errorInfo = it.errorInfo
|
||||
}
|
||||
//FileUtils.writeToFile("/sdcard/Download/", "location_wgs84.txt", "${gnssInfo.longitude},${gnssInfo.latitude}\n")
|
||||
if (1 == FunctionBuildConfig.gpsProvider) {
|
||||
// WGS84坐标系高精度位置信息
|
||||
CallerChassisLocationWGS84ListenerManager.invokeChassisLocationWGS84(
|
||||
@@ -104,7 +101,6 @@ object MoGoLocationDispatcher :
|
||||
override fun onMoGoLocationChanged(mogoLocation: MogoLocation) {
|
||||
// 更新GaoDe 信息
|
||||
lastGaoDeLocation = mogoLocation
|
||||
Log.d("emArrow","高德 heading:${mogoLocation.heading}")
|
||||
// 计算最后一次工控机同步的定位是否超时,如果超时则切换为高德地图定位,暂定超过30秒需要切换
|
||||
if (1 == FunctionBuildConfig.gpsProvider) {
|
||||
if (TimeUtils.getNowMills() - lastGnssLocation.lastReceiveTime > 10000) {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.eagle.core.function.datacenter.obu
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig
|
||||
@@ -289,7 +288,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
|
||||
// 同步给MAP地图
|
||||
CallerObuLocationWGS84ListenerManager.invokeObuLocationWGS84(gnssInfo)
|
||||
// 同步更新经纬度和系统时间至 AutoPilotStatusListener
|
||||
CallerAutoPilotStatusListenerManager.updateAutoPilotLatLon(
|
||||
CallerAutoPilotStatusListenerManager.updateAutoPilotLocAndTime(
|
||||
System.currentTimeMillis() / 1000.0,
|
||||
gnssInfo.longitude,
|
||||
gnssInfo.latitude
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.os.CountDownTimer
|
||||
import android.os.Handler
|
||||
import com.mogo.eagle.core.data.biz.trafficlight.*
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
import com.mogo.eagle.core.data.enums.TrafficLightEnum
|
||||
import com.mogo.eagle.core.data.multidisplay.TelematicConstant
|
||||
@@ -17,6 +18,7 @@ import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
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.GsonUtils
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
import perception.TrafficLightOuterClass
|
||||
import perception.TrafficLightOuterClass.TrafficLight
|
||||
|
||||
@@ -64,7 +66,7 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
@Volatile
|
||||
private var hasObuLightStatus: Boolean = false
|
||||
|
||||
private var lightCountDownTimer: CountDownTimer?= null
|
||||
private var lightCountDownTimer: CountDownTimer? = null
|
||||
private var lastLightTime: Long = System.currentTimeMillis()
|
||||
|
||||
fun initServer(context: Context) {
|
||||
@@ -80,16 +82,17 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
* @param trafficLights 感知红绿灯
|
||||
*/
|
||||
override fun onAutopilotPerceptionTrafficLight(trafficLights: TrafficLightOuterClass.TrafficLights?) {
|
||||
CallerLogger.d("${SceneConstant.M_OBU}${TAG}", "onAutopilotPerceptionTrafficLight ---- hasObuLightStatus = $hasObuLightStatus ----hasAiLightStatus = $hasAiLightStatus ")
|
||||
if (!hasObuLightStatus) {
|
||||
if (!hasAiLightStatus) {
|
||||
|
||||
lastLightTime = System.currentTimeMillis()
|
||||
if(lightCountDownTimer==null){
|
||||
lightCountDownTimer = object: CountDownTimer(300000,1000){
|
||||
if (lightCountDownTimer == null) {
|
||||
lightCountDownTimer = object : CountDownTimer(300000, 1000) {
|
||||
override fun onTick(millisUntilFinished: Long) {
|
||||
if((System.currentTimeMillis() - lastLightTime)>1000){
|
||||
if ((System.currentTimeMillis() - lastLightTime) > 1000) {
|
||||
//隐藏红绿灯显示
|
||||
CallerTrafficLightListenerManager.disableTrafficLight()
|
||||
hide("感知倒计时结束隐藏", DataSourceType.TELEMATIC)
|
||||
lightCountDownTimer?.cancel()
|
||||
lightCountDownTimer = null
|
||||
}
|
||||
@@ -115,9 +118,13 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
} else if (it.hasUTurn()) {
|
||||
light = it.uTurn
|
||||
}
|
||||
CallerLogger.d(
|
||||
"${SceneConstant.M_OBU}${TAG}",
|
||||
"onAutopilotPerceptionTrafficLight light = $light "
|
||||
)
|
||||
if (light == null) {
|
||||
//隐藏红绿灯显示
|
||||
hide()
|
||||
hide("感知light为null隐藏", DataSourceType.TELEMATIC)
|
||||
} else {
|
||||
onTrafficLightPlusSource(light.convert(), 0, DataSourceType.TELEMATIC)
|
||||
}
|
||||
@@ -131,10 +138,17 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
*/
|
||||
override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) {
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.SHOW_TRAFFIC_LIGHT, GsonUtils.toJson(trafficLightResult).toByteArray())
|
||||
CallerTelematicManager.sendMsgToAllClients(
|
||||
TelematicConstant.SHOW_TRAFFIC_LIGHT,
|
||||
GsonUtils.toJson(trafficLightResult).toByteArray()
|
||||
)
|
||||
}
|
||||
if (!hasObuLightStatus) {
|
||||
hasAiLightStatus = true
|
||||
CallerLogger.d(
|
||||
"${SceneConstant.M_OBU}${TAG}",
|
||||
"onTrafficLightStatus trafficLightResult = $trafficLightResult "
|
||||
)
|
||||
updateTrafficLight(trafficLightResult)
|
||||
}
|
||||
}
|
||||
@@ -144,18 +158,22 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
* @param enter true:进入路口;false:离开路口
|
||||
*/
|
||||
override fun onEnterCrossRoad(enter: Boolean) {
|
||||
CallerLogger.d("${SceneConstant.M_OBU}${TAG}", "onEnterCrossRoad enter = $enter ")
|
||||
if (!enter) {
|
||||
Handler().postDelayed({
|
||||
hasAiLightStatus = false
|
||||
hasObuLightStatus = false
|
||||
}, 5000)
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.HIDE_TRAFFIC_LIGHT, "0".toByteArray())
|
||||
CallerTelematicManager.sendMsgToAllClients(
|
||||
TelematicConstant.HIDE_TRAFFIC_LIGHT,
|
||||
"0".toByteArray()
|
||||
)
|
||||
}
|
||||
//如果没有OBU灯态则进行隐藏,如果有OBU灯态,则交由OBU管理
|
||||
if(!hasObuLightStatus){
|
||||
if (!hasObuLightStatus) {
|
||||
CallerTrafficLightListenerManager.resetTrafficLightStatus(!hasObuLightStatus)
|
||||
hide()
|
||||
hide("云端离开路口隐藏", DataSourceType.AICLOUD)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -165,9 +183,13 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
*/
|
||||
override fun onTrafficRequestError() {
|
||||
hasAiLightStatus = false
|
||||
CallerLogger.d(
|
||||
"${SceneConstant.M_OBU}${TAG}",
|
||||
"onTrafficRequestError hasObuLightStatus = $hasObuLightStatus ------> "
|
||||
)
|
||||
CallerTrafficLightListenerManager.resetTrafficLightStatus(!hasObuLightStatus)
|
||||
if(!hasObuLightStatus){
|
||||
hide()
|
||||
if (!hasObuLightStatus) {
|
||||
hide("云端红绿灯接口请求失败隐藏", DataSourceType.AICLOUD)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,30 +197,46 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
* obu数据消失
|
||||
*/
|
||||
override fun onObuTrafficLightDisapper() {
|
||||
CallerLogger.d("${SceneConstant.M_OBU}${TAG}", "onObuTrafficLightDisapper ------> ")
|
||||
hasObuLightStatus = false
|
||||
hide()
|
||||
hide("OBU红绿灯消息关闭隐藏", DataSourceType.OBU)
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否重置红绿灯数据,需要确保,在obu的红绿灯显示的时候,不执行。否则会闪屏
|
||||
*/
|
||||
override fun resetTrafficLight(isReset: Boolean) {
|
||||
CallerLogger.d("${SceneConstant.M_OBU}${TAG}", "resetTrafficLight ------> isReset = $isReset ---hasObuLightStatus = $hasObuLightStatus")
|
||||
CallerLogger.d(
|
||||
"${SceneConstant.M_OBU}${TAG}",
|
||||
"resetTrafficLight ------> isReset = $isReset ---hasObuLightStatus = $hasObuLightStatus"
|
||||
)
|
||||
if (!hasObuLightStatus) {
|
||||
if(isReset){
|
||||
hide()
|
||||
if (isReset) {
|
||||
hide("云端重置红绿灯数据", DataSourceType.AICLOUD)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun hide(){
|
||||
CallerLogger.d("${SceneConstant.M_OBU}${TAG}", "hide() ---------> ")
|
||||
@ChainLog(
|
||||
linkChainLog = ChainConstant.CHAIN_TYPE_SOCKET_TRAFFIC_LIGHT,
|
||||
linkCode = ChainConstant.CHAIN_SOURCE_ADAS,
|
||||
nodeAliasCode = ChainConstant.CHAIN_CODE_ADAS_AUTOPILOT_TRAFFIC_LIGHT_HIDE,
|
||||
paramIndexes = [0, 1]
|
||||
)
|
||||
private fun hide(msg: String, sourceType: DataSourceType) {
|
||||
CallerLogger.d("${SceneConstant.M_OBU}${TAG}", "hide() :$msg type :$sourceType")
|
||||
CallerTrafficLightListenerManager.disableTrafficLight()
|
||||
}
|
||||
|
||||
/**
|
||||
* obu 红绿灯数据
|
||||
* 红绿灯数据
|
||||
*/
|
||||
@ChainLog(
|
||||
linkChainLog = ChainConstant.CHAIN_TYPE_SOCKET_TRAFFIC_LIGHT,
|
||||
linkCode = ChainConstant.CHAIN_SOURCE_ADAS,
|
||||
nodeAliasCode = ChainConstant.CHAIN_CODE_ADAS_AUTOPILOT_TRAFFIC_LIGHT,
|
||||
paramIndexes = [0, 1, 2]
|
||||
)
|
||||
override fun onTrafficLightPlusSource(
|
||||
light: TrafficLightEnum,
|
||||
remain: Int,
|
||||
@@ -208,7 +246,10 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
if (lightSource == DataSourceType.OBU) {
|
||||
hasObuLightStatus = true
|
||||
}
|
||||
|
||||
CallerLogger.d(
|
||||
"${SceneConstant.M_OBU}${TAG}",
|
||||
"onTrafficLightPlusSource ----- light = $light ---remain = $remain ---lightSource = $lightSource ---hasObuLightStatus = $hasObuLightStatus ---hasAiLightStatus = $hasAiLightStatus"
|
||||
)
|
||||
CallerTrafficLightListenerManager.showTrafficLight(light, lightSource)
|
||||
if (remain == -1) {
|
||||
CallerTrafficLightListenerManager.disableTrafficLightCountDown()
|
||||
@@ -226,10 +267,10 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
CallerTrafficLightListenerManager.changeCountdownYellow(remain)
|
||||
}
|
||||
TrafficLightEnum.BLACK -> {
|
||||
CallerTrafficLightListenerManager.disableTrafficLight()
|
||||
hide("感知数据BLACK隐藏", lightSource)
|
||||
}
|
||||
else -> {
|
||||
hide()
|
||||
hide("未知红绿灯类型隐藏", lightSource)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,6 +278,10 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
|
||||
private fun updateTrafficLight(trafficLightResult: TrafficLightResult) {
|
||||
val currentTrafficLight = trafficLightResult.currentRoadTrafficLight()
|
||||
CallerLogger.d(
|
||||
"${SceneConstant.M_OBU}${TAG}",
|
||||
"updateTrafficLight ----- currentTrafficLight = $currentTrafficLight"
|
||||
)
|
||||
currentTrafficLight?.let {
|
||||
val remain = if (it.remain > 99) {
|
||||
99
|
||||
@@ -245,9 +290,9 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
}
|
||||
onTrafficLightPlusSource(it.convert(), remain, DataSourceType.AICLOUD)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
fun destroy() {
|
||||
//取消注册监听AI云.OBU,路侧获取红绿灯状态
|
||||
CallerTrafficLightListenerManager.removeListener(TAG)
|
||||
|
||||
@@ -7,23 +7,18 @@ import android.view.View
|
||||
import android.view.WindowManager
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.lifecycle.Lifecycle.Event
|
||||
import androidx.lifecycle.LifecycleCoroutineScope
|
||||
import androidx.lifecycle.LifecycleEventObserver
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxType
|
||||
import com.mogo.eagle.core.data.msgbox.RecordBagMsg
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
|
||||
import com.mogo.eagle.core.utilcode.kotlin.lifecycleOwner
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
|
||||
@@ -34,14 +29,10 @@ import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.db.entity.AutoPilotRecord
|
||||
import com.zhjt.mogo_core_function_devatools.ext.enqueuePop
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.channels.Channel
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
import record_cache.RecordPanelOuterClass
|
||||
import java.lang.ref.WeakReference
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordListener,
|
||||
IMoGoChassisLocationWGS84Listener {
|
||||
internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordListener {
|
||||
|
||||
const val TAG = "BadCase"
|
||||
|
||||
@@ -50,13 +41,8 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
|
||||
@Volatile
|
||||
private var record: AutoPilotRecord? = null
|
||||
|
||||
private var longitude: Double = 0.0
|
||||
private var latitude: Double?= 0.0
|
||||
|
||||
fun init(){
|
||||
fun init() {
|
||||
CallerAutopilotRecordListenerManager.addListener(TAG, this)
|
||||
// 添加 ADAS车辆状态&定位 监听
|
||||
CallerChassisLocationWGS84ListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,15 +69,20 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
|
||||
/**
|
||||
* 展示BadCase录包管理页面
|
||||
*/
|
||||
fun showBadCaseManagerWindow(context: Context){
|
||||
fun showBadCaseManagerWindow(context: Context) {
|
||||
val badCaseManagerView = BadCaseManagerView(context)
|
||||
badCaseManagerView.setOnClickListener(object: BadCaseManagerView.ClickListener{
|
||||
badCaseManagerView.setOnClickListener(object : BadCaseManagerView.ClickListener {
|
||||
override fun onClose() {
|
||||
hideFloat?.invoke()
|
||||
hideFloat = null
|
||||
}
|
||||
})
|
||||
context.enqueuePop(badCaseManagerView,AutoSizeUtils.dp2px(context,960f), WindowManager.LayoutParams.MATCH_PARENT, key = "BadCaseManagerView").also {
|
||||
context.enqueuePop(
|
||||
badCaseManagerView,
|
||||
AutoSizeUtils.dp2px(context, 960f),
|
||||
WindowManager.LayoutParams.MATCH_PARENT,
|
||||
key = "BadCaseManagerView"
|
||||
).also {
|
||||
hideFloat = it
|
||||
}
|
||||
}
|
||||
@@ -246,29 +237,32 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
|
||||
)
|
||||
)
|
||||
)
|
||||
val lat =
|
||||
CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude
|
||||
val lon =
|
||||
CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude
|
||||
//埋点统计
|
||||
BadCaseAnalyticsManager.bagRecordReceive(recordPanel.key.toString(),recordPanel.filename,
|
||||
System.currentTimeMillis().toString(),recordPanel.stat.toString(),
|
||||
AppConfigInfo.plateNumber,recordPanel.duration.toString(),
|
||||
MoGoAiCloudClientConfig.getInstance().sn,BadCaseConfig.dockerVersion ?:"",
|
||||
AppUtils.getAppVersionName(),latitude.toString(),longitude.toString())
|
||||
BadCaseAnalyticsManager.bagRecordReceive(
|
||||
recordPanel.key.toString(), recordPanel.filename,
|
||||
System.currentTimeMillis().toString(), recordPanel.stat.toString(),
|
||||
AppConfigInfo.plateNumber, recordPanel.duration.toString(),
|
||||
MoGoAiCloudClientConfig.getInstance().sn, BadCaseConfig.dockerVersion ?: "",
|
||||
AppUtils.getAppVersionName(), lat.toString(), lon.toString()
|
||||
)
|
||||
//日志埋点
|
||||
CallerLogger.i("$M_DEVA$TAG", "BadCase Receive Analytics="+"key="+recordPanel.key+" filename="+recordPanel.filename+
|
||||
" receiveTime="+System.currentTimeMillis()+" stat="+recordPanel.stat+" plateNumber="+AppConfigInfo.plateNumber+
|
||||
" totalDuration="+recordPanel.duration+" carSn="+MoGoAiCloudClientConfig.getInstance().sn+" mapVersion="+BadCaseConfig.dockerVersion+
|
||||
" eyeVersion="+AppUtils.getAppVersionName()+" latitude="+latitude+" longitude="+longitude)
|
||||
CallerLogger.i(
|
||||
"$M_DEVA$TAG",
|
||||
"BadCase Receive Analytics=" + "key=" + recordPanel.key + " filename=" + recordPanel.filename +
|
||||
" receiveTime=" + System.currentTimeMillis() + " stat=" + recordPanel.stat + " plateNumber=" + AppConfigInfo.plateNumber +
|
||||
" totalDuration=" + recordPanel.duration + " carSn=" + MoGoAiCloudClientConfig.getInstance().sn + " mapVersion=" + BadCaseConfig.dockerVersion +
|
||||
" eyeVersion=" + AppUtils.getAppVersionName() + " latitude=" + lat + " longitude=" + lon
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun onStateChanged(source: LifecycleOwner, event: Event) {
|
||||
|
||||
}
|
||||
|
||||
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
|
||||
latitude = gnssInfo.latitude
|
||||
longitude = gnssInfo.longitude
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
@@ -37,7 +36,7 @@ import java.util.*
|
||||
* @since: 2022/7/12
|
||||
*/
|
||||
class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener,
|
||||
IMoGoAutopilotRecordListener, IMoGoChassisLocationWGS84Listener {
|
||||
IMoGoAutopilotRecordListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "AIDataCollectWindow"
|
||||
@@ -68,8 +67,6 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener
|
||||
|
||||
@Volatile
|
||||
private var recordFileName: String? = null //录制文件包名
|
||||
private var longitude: Double? = null
|
||||
private var latitude: Double? = null
|
||||
|
||||
private lateinit var mFloatLayout: View
|
||||
private var mInViewX = 0f
|
||||
@@ -116,8 +113,6 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener
|
||||
"时间:${millis2String(System.currentTimeMillis(), TimeUtils.getHourMinSecondFormat())}"
|
||||
//采集结果回调监听
|
||||
CallerAutopilotRecordListenerManager.addListener(this.hashCode().toString(), this)
|
||||
// 添加 ADAS车辆状态&定位 监听
|
||||
CallerChassisLocationWGS84ListenerManager.addListener(this.hashCode().toString(), this)
|
||||
//开始录制AI数据采集Bag包
|
||||
CallerAutoPilotControlManager.recordPackage(
|
||||
99,
|
||||
@@ -234,7 +229,8 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener
|
||||
itx["audioUrl"] = "" //音频COS地址
|
||||
itx["mapVersion"] = BadCaseConfig.dockerVersion ?: "" //工控机版本
|
||||
itx["eyeVersion"] = AppUtils.getAppVersionName() //鹰眼版本
|
||||
itx["coordinate"] = "latitude:${latitude};longitude:${longitude}" //坐标
|
||||
itx["coordinate"] =
|
||||
"latitude:${CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude};longitude:${CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude}" //坐标
|
||||
|
||||
})
|
||||
if (uploadResult == null || uploadResult.code != 200) {
|
||||
@@ -332,7 +328,7 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener
|
||||
// 默认固定位置,靠屏幕右边缘的中间
|
||||
mWindowManager!!.defaultDisplay.getMetrics(metrics)
|
||||
mWindowParams!!.x = metrics.widthPixels
|
||||
mWindowParams!!.y = metrics.heightPixels - BarUtils.getStatusBarHeight()-950
|
||||
mWindowParams!!.y = metrics.heightPixels - BarUtils.getStatusBarHeight() - 950
|
||||
mWindowManager!!.addView(mFloatLayout, mWindowParams)
|
||||
}
|
||||
}
|
||||
@@ -353,9 +349,4 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener
|
||||
fun closeWindow()
|
||||
}
|
||||
|
||||
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
|
||||
latitude = gnssInfo.latitude
|
||||
longitude = gnssInfo.longitude
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,6 +27,7 @@ import com.zhjt.mogo_core_function_devatools.upgrade.UpgradeAppNetWorkManager
|
||||
import mogo.telematics.pad.MessagePad
|
||||
|
||||
/**
|
||||
* //todo emArrow 链路biz
|
||||
* 车辆绑定
|
||||
*/
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
@@ -61,9 +62,9 @@ object BindingCarManager : IMoGoAutopilotCarConfigListener {
|
||||
}
|
||||
|
||||
override fun onAutopilotCarConfig(carConfigResp: MessagePad.CarConfigResp) {
|
||||
Logger.d("${SceneConstant.M_BINDING}${TAG}", "onAutopilotCarConfig ----------> ")
|
||||
CallerLogger.d("${SceneConstant.M_BINDING}${TAG}", "onAutopilotCarConfig ----------> ")
|
||||
if (!TextUtils.isEmpty(carConfigResp.macAddress)) {
|
||||
Logger.d("${SceneConstant.M_BINDING}${TAG}",
|
||||
CallerLogger.d("${SceneConstant.M_BINDING}${TAG}",
|
||||
"onAutopilotCarConfig carConfigResp.macAddress = ${carConfigResp.macAddress} ")
|
||||
getBindingCarInfo(carConfigResp.macAddress, MoGoAiCloudClientConfig.getInstance().sn)
|
||||
}
|
||||
@@ -75,17 +76,14 @@ object BindingCarManager : IMoGoAutopilotCarConfigListener {
|
||||
* @param macAddress
|
||||
*/
|
||||
fun getBindingCarInfo(macAddress: String, widevineIDWithMd5: String) {
|
||||
Log.d("UPGRADE", "-- getBindingCarInfo -- 1 -- : [mac: $macAddress, md5: $widevineIDWithMd5]")
|
||||
var flag = false
|
||||
if (!TextUtils.isEmpty(macAddress) && TextUtils.isEmpty(mAddress)) {
|
||||
Log.d("UPGRADE", "-- getBindingCarInfo -- 2 -- : [mac: $macAddress, md5: $widevineIDWithMd5]")
|
||||
flag = true
|
||||
}
|
||||
if (!TextUtils.isEmpty(macAddress) && !TextUtils.equals(macAddress, mAddress)) {
|
||||
mAddress = macAddress
|
||||
}
|
||||
if (flag) {
|
||||
Log.d("UPGRADE", "-- getBindingCarInfo -- 3 -- : [mac: $macAddress, md5: $widevineIDWithMd5]")
|
||||
queryAppUpgrade()
|
||||
val obuVersion = mObuVersion
|
||||
if (obuVersion != null && !TextUtils.isEmpty(obuVersion)) {
|
||||
|
||||
@@ -8,7 +8,6 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.view.KeyEvent
|
||||
import com.mogo.commons.context.ContextHolderUtil
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig
|
||||
import com.mogo.eagle.core.data.deva.mofang.MfConstants
|
||||
import com.mogo.eagle.core.function.api.devatools.mofang.IMoGoMoFangListener
|
||||
@@ -165,7 +164,10 @@ class MoFangManager private constructor() : IMoGoMoFangListener {
|
||||
* 魔方按键处理
|
||||
*/
|
||||
override fun onMofangHandle(keyCode: Int, action: Int): Boolean {
|
||||
val bluetoothName = SharedPrefsMgr.getInstance(ContextHolderUtil.getContext()).getString(
|
||||
if(mContext == null){
|
||||
return false
|
||||
}
|
||||
val bluetoothName = SharedPrefsMgr.getInstance(mContext!!).getString(
|
||||
MfConstants.BLUETOOTH_NAME)
|
||||
if (bluetoothName == "MINI_KEYBOARD") {
|
||||
if (!isPressEnd) {
|
||||
|
||||
@@ -57,7 +57,7 @@ class TraceManager : IMoGoCloudListener, IMoGoAutopilotCarConfigListener {
|
||||
fwBuildMap[ChainConstant.CHAIN_TYPE_SOCKET_VEHICLE] =
|
||||
FwBuild(false, 30, pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_VEHICLE)
|
||||
fwBuildMap[ChainConstant.CHAIN_TYPE_SOCKET_TRAFFIC_LIGHT] =
|
||||
FwBuild(false, 30, pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_TRAFFIC_LIGHT)
|
||||
FwBuild(true, -1, pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_TRAFFIC_LIGHT)
|
||||
fwBuildMap[ChainConstant.CHAIN_TYPE_SOCKET_P_OBJECTS] =
|
||||
FwBuild(false, 30, pkgName + ChainConstant.CHAIN_LINK_LOG_ADAS_PLANNING_OBJECTS)
|
||||
fwBuildMap[ChainConstant.CHAIN_TYPE_SOCKET_P_ACTIONS] =
|
||||
@@ -87,7 +87,7 @@ class TraceManager : IMoGoCloudListener, IMoGoAutopilotCarConfigListener {
|
||||
traceInfoCache[ChainConstant.CHAIN_TYPE_SOCKET_VEHICLE] =
|
||||
ChainLogParam(false, "ADAS车辆底盘数据")
|
||||
traceInfoCache[ChainConstant.CHAIN_TYPE_SOCKET_TRAFFIC_LIGHT] =
|
||||
ChainLogParam(false, "ADAS红绿灯数据")
|
||||
ChainLogParam(true, "ADAS红绿灯数据")
|
||||
traceInfoCache[ChainConstant.CHAIN_TYPE_SOCKET_P_OBJECTS] =
|
||||
ChainLogParam(false, "ADAS PLANNING 感知障碍物")
|
||||
traceInfoCache[ChainConstant.CHAIN_TYPE_SOCKET_P_ACTIONS] =
|
||||
|
||||
@@ -174,7 +174,7 @@ internal class AutoPilotAndCheckView @JvmOverloads constructor(
|
||||
svLayout.post {
|
||||
svLayout.fullScroll(View.FOCUS_DOWN)
|
||||
}
|
||||
if (!connectStatus) {
|
||||
if (!connectStatus) { //todo 单次获取
|
||||
ToastUtils.showShort("设置车速失败,请启动域控制器")
|
||||
keyBoardUtil?.hideKeyboard()
|
||||
return@setOnTouchListener true
|
||||
|
||||
@@ -107,7 +107,7 @@ class CheckSystemView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
connectStatus = autoPilotStatusInfo.connectStatus
|
||||
connectStatus = autoPilotStatusInfo.connectStatus //单次
|
||||
autopilotStatus = autoPilotStatusInfo.state
|
||||
ThreadUtils.runOnUiThread {
|
||||
setViewStatus()
|
||||
|
||||
@@ -6,8 +6,6 @@ import android.util.AttributeSet
|
||||
import android.view.Gravity
|
||||
import android.widget.FrameLayout
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
import com.mogo.eagle.core.function.api.datacenter.union.ILimitingVelocityListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager
|
||||
@@ -18,8 +16,7 @@ class SpeedPanelView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : FrameLayout(context, attrs, defStyleAttr), IMoGoChassisLocationGCJ02Listener,
|
||||
ILimitingVelocityListener {
|
||||
) : FrameLayout(context, attrs, defStyleAttr), ILimitingVelocityListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "SpeedPanelView"
|
||||
@@ -27,8 +24,6 @@ class SpeedPanelView @JvmOverloads constructor(
|
||||
|
||||
var mContext: Context
|
||||
var mSpeedChartView: SpeedChartView
|
||||
@Volatile
|
||||
var mLatLng: MogoLocation? = null
|
||||
|
||||
init {
|
||||
setBackgroundResource(R.drawable.yi_biao_pan_bg_nor)
|
||||
@@ -47,31 +42,22 @@ class SpeedPanelView @JvmOverloads constructor(
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerLimitingVelocityListenerManager.addListener(TAG, this)
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
|
||||
mogoLocation?.let {
|
||||
mLatLng = mogoLocation
|
||||
}
|
||||
}
|
||||
|
||||
override fun onLimitingVelocityChange(limitingVelocity: Int, sourceType: DataSourceType) {
|
||||
super.onLimitingVelocityChange(limitingVelocity, sourceType)
|
||||
mLatLng?.let {
|
||||
UiThreadHandler.post {
|
||||
val speed = (it.gnssSpeed * 3.6f).toInt()
|
||||
mSpeedChartView.setArcColor(Color.parseColor(if (speed > limitingVelocity) "#DB3137" else "#3E77F6"))
|
||||
mSpeedChartView.setValues(speed)
|
||||
setBackgroundResource(if (speed > limitingVelocity) R.drawable.yi_biao_pan_bg_speeding else R.drawable.yi_biao_pan_bg_nor)
|
||||
}
|
||||
UiThreadHandler.post {
|
||||
val speed =
|
||||
(CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02().gnssSpeed * 3.6f).toInt()
|
||||
mSpeedChartView.setArcColor(Color.parseColor(if (speed > limitingVelocity) "#DB3137" else "#3E77F6"))
|
||||
mSpeedChartView.setValues(speed)
|
||||
setBackgroundResource(if (speed > limitingVelocity) R.drawable.yi_biao_pan_bg_speeding else R.drawable.yi_biao_pan_bg_nor)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerLimitingVelocityListenerManager.removeListener(TAG)
|
||||
CallerChassisLocationGCJ02ListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -43,7 +43,6 @@ class SystemVersionView @JvmOverloads constructor(
|
||||
const val TAG = "SystemVersionView"
|
||||
}
|
||||
|
||||
private var connectStatus = false
|
||||
private var dockerVersion: String? = null //工控机版本
|
||||
private var autopilotStatus: Int? = null //自动驾驶状态 0代表不可自动驾驶,1代表可自动驾驶,2代表自动驾驶中
|
||||
|
||||
@@ -322,20 +321,12 @@ class SystemVersionView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
connectStatus = autoPilotStatusInfo.connectStatus
|
||||
dockerVersion = autoPilotStatusInfo.dockVersion
|
||||
autopilotStatus = autoPilotStatusInfo.state
|
||||
CallerLogger.i(
|
||||
"$M_HMI$TAG",
|
||||
"onAutopilotStatusResponse connectStatus=$connectStatus , dockerVersion=$dockerVersion , autopilotStatus=$autopilotStatus"
|
||||
"onAutopilotStatusResponse dockerVersion=$dockerVersion , autopilotStatus=$autopilotStatus"
|
||||
)
|
||||
// if(needQueryContainers && !AdUpgradeStateHelper.isUpgradeableStatus()){
|
||||
// dockerVersion?.let {
|
||||
// //查询是否有新的工控机docker版本
|
||||
// CallerBindingcarManager.getBindingcarProvider().queryContainers(MoGoAiCloudClient.getInstance().aiCloudClientConfig.sn,dockerVersion)
|
||||
// needQueryContainers = false
|
||||
// }
|
||||
// }
|
||||
setViewStatus()
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ public class TrafficDataView extends ConstraintLayout implements
|
||||
} else {
|
||||
accTextView.setText("- " + accStr);
|
||||
}
|
||||
int state = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState();
|
||||
int state = CallerAutoPilotStatusListenerManager.INSTANCE.getState();
|
||||
if (state < STATUS_AUTOPILOT_RUNNING) {
|
||||
if (mBrake > 0) {
|
||||
brakeStatus.setImageResource(R.drawable.traffic_data_brake);
|
||||
|
||||
@@ -176,200 +176,11 @@ public class PassengerLauncherActivity extends MainActivity implements IMogoInte
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
private long startPressTime = 0; //开始按减时间
|
||||
private boolean isPressEnd = false; //按键是否结束
|
||||
private boolean isCombinationKey = false; //是否是组合按键
|
||||
|
||||
private long pressADownTime = 0;
|
||||
private long pressAUpTime = 0;
|
||||
private long pressBDownTime = 0;
|
||||
private long pressBUpTime = 0;
|
||||
private long pressCDownTime = 0;
|
||||
private long pressCUpTime = 0;
|
||||
private long pressDDownTime = 0;
|
||||
private long pressDUpTime = 0;
|
||||
private long pressEDownTime = 0;
|
||||
private long pressEUpTime = 0;
|
||||
|
||||
|
||||
/**
|
||||
* 魔方按键分发 提测前注释 ToastUtils TODO
|
||||
*
|
||||
* @param event
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
// Log.d(TAG, "dispatchKeyEvent code = " + event.getKeyCode() + "--action = " + event.getAction() + "----" + event);
|
||||
String bluetoothName = SharedPrefsMgr.getInstance(getContext()).getString("BLUETOOTH");
|
||||
if (!isPressEnd) {
|
||||
Log.e(TAG, "dispatchKeyEvent bluetoothName = " + bluetoothName);
|
||||
}
|
||||
if (bluetoothName.equals("MINI_KEYBOARD")) {
|
||||
if (!isPressEnd) {
|
||||
isPressEnd = true;
|
||||
startPressTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
if (event.getKeyCode() == KeyEvent.KEYCODE_A) { //单击 -1,长按无操作,AB组合-2
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
pressADownTime = System.currentTimeMillis();
|
||||
Log.d(TAG, "dispatchKeyEvent A down pressADownTime = " + pressADownTime + "---" + (pressADownTime - startPressTime) + "----isCombinationKey = " + isCombinationKey + "--pressBDownTime = " + pressBDownTime);
|
||||
if ((pressADownTime - startPressTime) > 350 && (pressADownTime - startPressTime) < 1800 && pressBDownTime > 0) {
|
||||
ToastUtils.showShort("方块 A 按AB组合 -2 ");
|
||||
sendAcc(true, -2);
|
||||
isCombinationKey = true;
|
||||
}
|
||||
if (!isCombinationKey) {
|
||||
if ((pressADownTime - startPressTime) > 1900) {
|
||||
ToastUtils.showShort("方块 长按A 无 操作 ");
|
||||
}
|
||||
}
|
||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
pressAUpTime = System.currentTimeMillis();
|
||||
isPressEnd = false;
|
||||
isCombinationKey = false;
|
||||
Log.e(TAG, "dispatchKeyEvent A up pressAUpTime = " + pressAUpTime + "---" + (pressAUpTime - startPressTime) + "--pressBDownTime = " + pressBDownTime);
|
||||
if ((pressAUpTime - startPressTime) < 300) {
|
||||
ToastUtils.showShort("方块 单击A -1 ");
|
||||
sendAcc(true, -1);
|
||||
}
|
||||
pressAUpTime = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (event.getKeyCode() == KeyEvent.KEYCODE_B) {//单击复原,长按+1,AB组合-2
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
pressBDownTime = System.currentTimeMillis();
|
||||
Log.d(TAG, "dispatchKeyEvent B down pressBDownTime = " + pressBDownTime + "--差-" + (pressBDownTime - startPressTime) + "---isCombinationKey = " + isCombinationKey + "--pressADownTime = " + pressADownTime);
|
||||
if ((pressBDownTime - startPressTime) > 350 && (pressBDownTime - startPressTime) < 1800 && pressADownTime > 0) {
|
||||
ToastUtils.showShort("方块 B 按AB组合 ");
|
||||
sendAcc(true, -2);
|
||||
isCombinationKey = true;
|
||||
}
|
||||
if (!isCombinationKey) {
|
||||
if ((pressBDownTime - startPressTime) > 1900) {
|
||||
ToastUtils.showShort("方块 长按B =1 ");
|
||||
sendAcc(true, +1);
|
||||
}
|
||||
}
|
||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
pressBUpTime = System.currentTimeMillis();
|
||||
isPressEnd = false;
|
||||
isCombinationKey = false;
|
||||
Log.e(TAG, "dispatchKeyEvent B up pressBUpTime = " + pressBUpTime + "--差-" + (pressBUpTime - startPressTime) + "--pressADownTime = " + pressADownTime);
|
||||
if ((pressBUpTime - startPressTime) < 300) {
|
||||
ToastUtils.showShort("方块 单击B 0 ");
|
||||
sendAcc(false, 0.0);
|
||||
}
|
||||
pressBDownTime = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (event.getKeyCode() == KeyEvent.KEYCODE_C) { //单击左变道,长按无操作
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
pressCDownTime = System.currentTimeMillis();
|
||||
if (!isCombinationKey) {
|
||||
if ((pressCDownTime - startPressTime) > 1900) {
|
||||
ToastUtils.showShort("方块 长按C 无操作 ");
|
||||
}
|
||||
}
|
||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
pressCUpTime = System.currentTimeMillis();
|
||||
isPressEnd = false;
|
||||
isCombinationKey = false;
|
||||
if ((pressCUpTime - startPressTime) < 300) {
|
||||
ToastUtils.showShort("方块 单击C ← 向左变道 ");
|
||||
CallerAutoPilotControlManager.INSTANCE.sendOperatorChangeLaneLeft();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else if (event.getKeyCode() == KeyEvent.KEYCODE_D) { //单击向右变道,双击无操作
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
pressDDownTime = System.currentTimeMillis();
|
||||
if (!isCombinationKey) {
|
||||
if ((pressDDownTime - startPressTime) > 1900) {
|
||||
ToastUtils.showShort("方块 长按D 无操作 ");
|
||||
}
|
||||
}
|
||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
pressDUpTime = System.currentTimeMillis();
|
||||
isPressEnd = false;
|
||||
isCombinationKey = false;
|
||||
if ((pressDUpTime - startPressTime) < 300) {
|
||||
ToastUtils.showShort("方块 单击D → 向右变道 ");
|
||||
CallerAutoPilotControlManager.INSTANCE.sendOperatorChangeLaneRight();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (event.getKeyCode() == KeyEvent.KEYCODE_E) { //单击启动自驾,长按鸣笛
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
pressEDownTime = System.currentTimeMillis();
|
||||
if (!isCombinationKey) {
|
||||
if ((pressEDownTime - startPressTime) > 1900) {
|
||||
ToastUtils.showShort("方块 长按E 鸣笛 ");
|
||||
CallerAutoPilotControlManager.INSTANCE.sendOperatorSetHorn(1);
|
||||
if (timerHorn == null) {
|
||||
timerHorn = new Timer();
|
||||
}
|
||||
timerHorn.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
CallerAutoPilotControlManager.INSTANCE.sendOperatorSetHorn(2);
|
||||
timerHorn = null;
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
pressEUpTime = System.currentTimeMillis();
|
||||
isPressEnd = false;
|
||||
isCombinationKey = false;
|
||||
if ((pressEUpTime - startPressTime) < 300) {
|
||||
ToastUtils.showShort("方块 单击E 开启自动驾驶 ");
|
||||
CallerAutoPilotControlManager.INSTANCE.startAutoPilot(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getAutopilotControlParameters());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return super.dispatchKeyEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSkinModeChange(int skinMode) {
|
||||
|
||||
}
|
||||
|
||||
private synchronized void sendAcc(boolean isSend, double acc) {
|
||||
if (isSend) {
|
||||
accelerated = acc;
|
||||
if (timerAcc == null) {
|
||||
timerAcc = new Timer();
|
||||
timerAcc.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
CallerAutoPilotControlManager.INSTANCE.sendOperatorSetAcceleratedSpeed(accelerated);
|
||||
}
|
||||
}, 0, 500);
|
||||
}
|
||||
} else {
|
||||
if (timerAcc != null) {
|
||||
timerAcc.cancel();
|
||||
timerAcc = null;
|
||||
}
|
||||
CallerAutoPilotControlManager.INSTANCE.sendOperatorSetAcceleratedSpeed(acc);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化蓝牙广播
|
||||
*/
|
||||
|
||||
@@ -182,16 +182,16 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
|
||||
}
|
||||
|
||||
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
|
||||
if (gnssInfo.gnssInfo != null
|
||||
&& gnssInfo.gnssInfo.longitude != 0.0
|
||||
&& gnssInfo.gnssInfo.latitude != 0.0
|
||||
if (gnssInfo != null
|
||||
&& gnssInfo.longitude != 0.0
|
||||
&& gnssInfo.latitude != 0.0
|
||||
) {
|
||||
executor.get()?.updateLocation(
|
||||
gnssInfo.gnssInfo.longitude,
|
||||
gnssInfo.gnssInfo.latitude,
|
||||
gnssInfo.gnssInfo.altitude,
|
||||
gnssInfo.gnssInfo.heading.toFloat(),
|
||||
gnssInfo.gnssInfo.gnssSpeed.toFloat(),
|
||||
gnssInfo.longitude,
|
||||
gnssInfo.latitude,
|
||||
gnssInfo.altitude,
|
||||
gnssInfo.heading.toFloat(),
|
||||
gnssInfo.gnssSpeed,
|
||||
true
|
||||
)
|
||||
}
|
||||
|
||||
@@ -71,12 +71,12 @@ public class MogoRouteOverlayManager implements
|
||||
if (gnssInfo == null) {
|
||||
return;
|
||||
}
|
||||
if (isArriveAtStation.get() && autopilotMode.get() != 1) {
|
||||
if (isArriveAtStation.get() && autopilotMode.get() != 2) {
|
||||
RouteOverlayDrawer.getInstance().clearMogoRouteOverlay();
|
||||
return;
|
||||
}
|
||||
boolean force = FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData;
|
||||
if (!force && autopilotMode.get() != 1) {
|
||||
if (!force && autopilotMode.get() != 2) {
|
||||
RouteOverlayDrawer.getInstance().clearMogoRouteOverlay();
|
||||
return;
|
||||
}
|
||||
@@ -92,8 +92,8 @@ public class MogoRouteOverlayManager implements
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autoPilotStatusInfo) {
|
||||
int mode = autoPilotStatusInfo.getPilotmode();
|
||||
if (mode == 1) {
|
||||
int mode = autoPilotStatusInfo.getState();
|
||||
if (mode == 2) {
|
||||
isArriveAtStation.set(false);
|
||||
}
|
||||
this.autopilotMode.set(mode);
|
||||
|
||||
@@ -319,8 +319,8 @@ class SmallMapView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
val tempStatus = autoPilotStatusInfo.pilotmode
|
||||
if (tempStatus != 1) {
|
||||
val tempStatus = autoPilotStatusInfo.state
|
||||
if (tempStatus != 2) {
|
||||
UiThreadHandler.post {
|
||||
clearPolyline()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user