[6.6.0] find bug of pb to json

This commit is contained in:
EmArrow
2024-08-09 16:54:34 +08:00
parent 41f762cbdd
commit e5b5f3194a
6 changed files with 124 additions and 108 deletions

View File

@@ -8,29 +8,28 @@ import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.config.HdMapBuildConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_ABILITY
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_ARRIVE
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_GUARDIAN
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_RECORD
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_ROUTE
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_STATUS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_TRAJECTORY
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_VEHICLE
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_CAR_CONFIG
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_CAR_LOC
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_FM_MSG
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_GUARDIAN
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_MAP_PARAM
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_PARALLEL
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_P_ACTIONS
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_RECORD
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_ROUTE
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_STATUS
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_CODE_ADAS_TRAJECTORY
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_VEHICLE
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_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_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.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_STATUS
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeArriveAtStation
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotGuardian
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotSNRequest
@@ -38,38 +37,67 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeSystemStatus
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.updateAutoPilotDockerInfo
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.updateAutoPilotStatus
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager
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.CallerAutopilotGetParamResponseDispatcher
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager.invokeAutopilotIdentifyDataUpdate
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager.invokeAutopilotIdentifyPlanningObj
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPointCloudListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager.invokeAutopilotRecordConfig
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager.invokeAutopilotRecordResult
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotStatisticsListenerManager.invokeAutopilotStatistics
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerBackCameraVideoListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerBatteryManagementSystemListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisAccStateListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisBrakeStateListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisDoorStateListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGearStateListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGnssListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisSteeringStateListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisThrottleStateListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerFaultManagementStateListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerFsm2024ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerLocalizationStateListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerParallelDrivingActionsListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerParallelDrivingListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningActionsListenerManager.invokePNCActions
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager.invokeAutopilotRotting
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningTrajectoryListenerManager.invokeAutopilotTrajectory
import com.mogo.eagle.core.function.call.autopilot.CallerReceiveReceivedAckListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerRoboBusJinlvM1StatesListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerRoboBusJinlvM1StitchedVideoListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerStartAutopilotFailedListenerManager.invokeStartAutopilotFailed
import com.mogo.eagle.core.function.call.autopilot.CallerSweeperFutianCleanSystemListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerSweeperFutianCloudTaskListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerV2XListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerV2nNioEventListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuMapMathListenerManager
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.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_D_C
import com.mogo.eagle.core.utilcode.util.DeviceUtils
import com.mogo.support.obu.ObuScene
import com.zhidao.support.adas.high.OnAdasListener
import com.zhjt.mogo.adas.data.bean.AdasParam
import com.zhidao.support.adas.high.common.ProtocolStatus
import com.zhjt.mogo.adas.data.AiCloudTask
import com.zhjt.mogo.adas.data.bean.AdasParam
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics
import com.zhjt.mogo.adas.data.bean.ReceivedAck
import com.zhjt.mogo.adas.data.bean.LaunchConditionData
import com.zhjt.mogo.adas.data.bean.ReceivedAck
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason
import com.zhjt.mogo.adas.data.sweeper.bootable.SweeperBootable
import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask
import com.zhjt.mogo.adas.data.sweeper.task.s_r.SweeperTaskSuspendResume
import com.zhjt.mogo.adas.data.sweeper.task.big.SweeperBigTaskStatus
import com.zhjt.mogo.adas.data.sweeper.task.cloud.s_r.SweeperTaskCloudSuspendResume
import com.zhjt.mogo.adas.data.sweeper.task.confirm.SweeperTaskConfirm
import com.zhjt.mogo.adas.data.sweeper.task.s_r.SweeperTaskSuspendResume
import com.zhjt.mogo.adas.data.sweeper.task.status.SweeperTaskStatus
import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop
import com.zhjt.service.chain.ChainLog
@@ -140,10 +168,13 @@ class MoGoAdasListenerImpl : OnAdasListener {
override fun onGnssInfo(header: MessagePad.Header, gnssInfo: MessagePad.GnssInfo) {
CallerChassisGnssListenerManager.invokeChassisGnssListener(gnssInfo)
if (gnssInfo != null) {
if (1 == FunctionBuildConfig.gpsProvider) {
// 同步更新经纬度和系统时间至 AutoPilotStatusListener
CallerAutoPilotStatusListenerManager.updateAutoPilotLocAndTime(gnssInfo.satelliteTime, gnssInfo.longitude, gnssInfo.latitude, gnssInfo.heading)
}
// 同步更新经纬度和系统时间至 AutoPilotStatusListener
CallerAutoPilotStatusListenerManager.updateAutoPilotLocAndTime(
gnssInfo.satelliteTime,
gnssInfo.longitude,
gnssInfo.latitude,
gnssInfo.heading
)
}
}
@@ -167,8 +198,6 @@ class MoGoAdasListenerImpl : OnAdasListener {
) {
CallerAutopilotActionsListenerManager.setVehicleState(vehicleState)
if (vehicleState != null) {
//转向灯数据
// CallerChassisLamplightListenerManager.invokeAutopilotLightSwitchData(vehicleState.light)
//刹车灯数据
CallerChassisLamplightListenerManager.invokeAutopilotBrakeLightData(vehicleState.brakeLightStatus)
//方向盘转向角数据
@@ -231,10 +260,6 @@ class MoGoAdasListenerImpl : OnAdasListener {
CallerAutopilotActionsListenerManager.setChassisStates(chassisStates)
if (chassisStates != null) {
chassisStates.bcmSystemStates?.let { bcmSystemStates ->
// bcmSystemStates.turnLightState?.let {
// //转向灯数据
// CallerChassisLamplightListenerManager.invokeAutopilotLightSwitchData(it)
// }
//刹车灯数据
CallerChassisLamplightListenerManager.invokeAutopilotBrakeLightData(bcmSystemStates.brakeLightState != 0)
}
@@ -461,18 +486,20 @@ class MoGoAdasListenerImpl : OnAdasListener {
header: MessagePad.Header?,
statusInfo: SystemStatusInfo.StatusInfo?
) {
if(statusInfo!=null && statusInfo.hasAutoPilotReady()){
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().ssmAutoPilotReady = statusInfo.autoPilotReady
}else{
if (statusInfo != null && statusInfo.hasAutoPilotReady()) {
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().ssmAutoPilotReady =
statusInfo.autoPilotReady
} else {
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().ssmAutoPilotReady = false
}
invokeAutopilotStatusRespByQuery(statusInfo)
}
override fun onSystemStatus(header: MessagePad.Header?, statusInf: SsmInfo.SsmStatusInf?) {
if(statusInf!=null && statusInf.hasAutoPilotReady()){
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().ssmAutoPilotReady = statusInf.autoPilotReady
}else{
if (statusInf != null && statusInf.hasAutoPilotReady()) {
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().ssmAutoPilotReady =
statusInf.autoPilotReady
} else {
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().ssmAutoPilotReady = false
}
invokeSystemStatus(statusInf)
@@ -817,8 +844,19 @@ class MoGoAdasListenerImpl : OnAdasListener {
* @param sysTime 当前时间戳
* @param bigTaskActionPush 数据
*/
override fun onSweeperFutianCloudTaskCloudSuspendResume(header: MessagePad.Header, messageType: AiCloudTask.MessageType, reqNo: String?, sysTime: Long, bigTaskActionPush: SweeperTaskCloudSuspendResume.BigTaskActionPush?) {
CallerSweeperFutianCloudTaskListenerManager.invokeSweeperFutianCloudTaskCloudSuspendResume(messageType, reqNo, sysTime, bigTaskActionPush)
override fun onSweeperFutianCloudTaskCloudSuspendResume(
header: MessagePad.Header,
messageType: AiCloudTask.MessageType,
reqNo: String?,
sysTime: Long,
bigTaskActionPush: SweeperTaskCloudSuspendResume.BigTaskActionPush?
) {
CallerSweeperFutianCloudTaskListenerManager.invokeSweeperFutianCloudTaskCloudSuspendResume(
messageType,
reqNo,
sysTime,
bigTaskActionPush
)
}
/**
@@ -1034,18 +1072,15 @@ class MoGoAdasListenerImpl : OnAdasListener {
launchConditionData: LaunchConditionData,
unableAutopilotReasons: ArrayList<UnableLaunchReason>?
) {
var reason = ""
if (unableAutopilotReasons != null) {
reason = unableAutopilotReasons.toString()
}
autopilotAbilityCheck(isAutopilotAbility, reason, launchConditionData.json)
invokeAutopilotAbility(isAutopilotAbility, launchConditionData, unableAutopilotReasons)
}
override fun onParallelDrivingAbility(
isParallelDrivingAbility: Boolean
) {
CallerParallelDrivingActionsListenerManager.invokeParallelDrivingAbility(isParallelDrivingAbility)
CallerParallelDrivingActionsListenerManager.invokeParallelDrivingAbility(
isParallelDrivingAbility
)
}
/**
@@ -1058,16 +1093,6 @@ class MoGoAdasListenerImpl : OnAdasListener {
CallerReceiveReceivedAckListenerManager.invokeReceiveReceivedAck(receivedAck)
}
@ChainLog(
linkChainLog = CHAIN_TYPE_SOCKET_AUTOPILOT,
linkCode = CHAIN_SOURCE_ADAS,
nodeAliasCode = CHAIN_CODE_ADAS_ABILITY,
paramIndexes = [0, 1, 2]
)
private fun autopilotAbilityCheck(isAutopilotAbility: Boolean, reason: String, launchConditionDataJson: String) {
}
/**
* 启动自动驾驶失败回调
* 根据MAP 系统监控状态返回过滤
@@ -1097,6 +1122,6 @@ class MoGoAdasListenerImpl : OnAdasListener {
* @param bytes 原始数据
*/
override fun onError(status: ProtocolStatus, bytes: ByteArray) {
Logger.e(TAG, "status===$status")
CallerLogger.e("$M_D_C$TAG", "status===$status")
}
}

View File

@@ -9,6 +9,7 @@ import androidx.lifecycle.Lifecycle.Event
import androidx.lifecycle.Lifecycle.Event.ON_CREATE
import androidx.lifecycle.Lifecycle.Event.ON_DESTROY
import com.mogo.commons.utils.MogoAnalyticUtils
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager
import com.mogo.eagle.core.utilcode.kotlin.*
import com.mogo.eagle.core.utilcode.mogo.logger.*
@@ -37,6 +38,7 @@ import com.zhjt.mogo_core_function_devatools.status.flow.ipc.IpcImpl
import com.zhjt.mogo_core_function_devatools.status.flow.rtk.RTKImpl
import com.zhjt.mogo_core_function_devatools.status.flow.trace.TracingImpl
import com.zhjt.mogo_core_function_devatools.status.ui.StatusView
import com.zhjt.service.chain.ChainLog
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.*
import java.lang.ref.*
@@ -194,6 +196,7 @@ object StatusManager {
l.filter { it.isException() }.also { ll ->
val time = System.currentTimeMillis()
val launchCondition = CallerAutopilotActionsListenerManager.getLaunchCondition()
logLauncherCondition(launchCondition)
ThreadUtils.getIoPool().execute {
val result = runCatching {
MogoAnalyticUtils.track(
@@ -251,4 +254,12 @@ object StatusManager {
*/
fun onStatusChanged(changed: List<Status>, all: List<Status>)
}
@ChainLog(
linkChainLog = ChainConstant.CHAIN_TYPE_SOCKET_AUTOPILOT,
linkCode = ChainConstant.CHAIN_SOURCE_ADAS,
nodeAliasCode = ChainConstant.CHAIN_CODE_ADAS_ABILITY,
paramIndexes = [0]
)
private fun logLauncherCondition(json:String){}
}

View File

@@ -10,7 +10,6 @@ import com.mogo.cloud.trafficlive.api.MoGoAiCloudTrafficLive
import com.mogo.commons.storage.SharedPrefsMgr
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.eagle.core.widget.RoundConstraintLayout
@@ -116,10 +115,6 @@ class DriverMonitorView :
currentDriverLiveSN = ""
}
Logger.d(
"${SceneConstant.M_HMI}$TAG",
"当前车上的司机端SN=${currentDriverSN},直播分体机SN=${currentDriverLiveSN}"
)
CallerLogger.d(
"${SceneConstant.M_HMI}$TAG",
"当前车上的司机端SN=${currentDriverSN},直播分体机SN=${currentDriverLiveSN}"
@@ -133,10 +128,6 @@ class DriverMonitorView :
*/
fun startLive() {
if (currentDriverLiveSN.isNotEmpty()) {
Logger.d(
"${SceneConstant.M_HMI}$TAG",
"检查司机直播……isLived=$isLived 当前车上的司机端SN=${currentDriverSN},直播分体机SN=${currentDriverLiveSN}"
)
CallerLogger.d(
"${SceneConstant.M_HMI}$TAG",
"检查司机直播……isLived=$isLived 当前车上的司机端SN=${currentDriverSN},直播分体机SN=${currentDriverLiveSN}"
@@ -153,10 +144,6 @@ class DriverMonitorView :
} else {
ToastUtils.showShort("当前车内没有直播源")
//为空又怎么撸
Logger.d(
"${SceneConstant.M_HMI}$TAG",
"检查司机直播……isLived=$isLived 当前车辆SN=${currentDriverSN} 不支持直播"
)
CallerLogger.d(
"${SceneConstant.M_HMI}$TAG",
"检查司机直播……isLived=$isLived 当前车辆SN=${currentDriverSN} 不支持直播"
@@ -190,40 +177,34 @@ class DriverMonitorView :
private val carLiveCallBack = object : ITrafficCarLiveCallBack {
override fun onLive(liveSn: String?) {
Logger.i("${SceneConstant.M_HMI}$TAG", "onLive:$liveSn")
CallerLogger.d("${SceneConstant.M_HMI}$TAG", "onLive:$liveSn")
}
override fun onFirstFrame() {
Logger.i("${SceneConstant.M_HMI}$TAG", "onFirstFrame:isFirstPage")
CallerLogger.d("${SceneConstant.M_HMI}$TAG", "onFirstFrame:isFirstPage")
isLived = true
refreshView(isLived)
}
override fun onDisConnect() {
Logger.w("${SceneConstant.M_HMI}$TAG", "onDisConnect")
CallerLogger.w("${SceneConstant.M_HMI}$TAG", "onDisConnect")
isLived = false
refreshView(isLived)
}
override fun onError(errorMsg: String?) {
Logger.e("${SceneConstant.M_HMI}$TAG", "onError msg is:${errorMsg}")
CallerLogger.e("${SceneConstant.M_HMI}$TAG", "onError msg is:${errorMsg}")
isLived = false
refreshView(isLived)
}
override fun onPlaying() {
Logger.i("${SceneConstant.M_HMI}$TAG", "onPlaying……")
CallerLogger.i("${SceneConstant.M_HMI}$TAG", "onPlaying……")
isLived = true
refreshView(isLived)
}
override fun onPlaRequesting() {
Logger.w("${SceneConstant.M_HMI}$TAG", "onPlaRequesting……")
CallerLogger.w("${SceneConstant.M_HMI}$TAG", "onPlaRequesting……")
isLived = false
refreshView(isLived)

View File

@@ -21,13 +21,18 @@ import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.kotlin.scope
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.util.BarUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import kotlinx.android.synthetic.main.view_status_bar.view.*
import kotlinx.android.synthetic.main.view_status_bar.view.routeDownloadFailMark
import kotlinx.android.synthetic.main.view_status_bar.view.routeDownloadStatus
import kotlinx.android.synthetic.main.view_status_bar.view.routeDownloadStatusRoot
import kotlinx.android.synthetic.main.view_status_bar.view.status_container
import kotlinx.android.synthetic.main.view_status_bar.view.viewProgressTv
import kotlinx.android.synthetic.main.view_status_bar.view.viewStatusBarLeft
import kotlinx.android.synthetic.main.view_status_bar.view.viewStatusBarRight
import kotlinx.android.synthetic.main.view_status_bar.view.viewTextClock
import kotlinx.coroutines.Runnable
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import java.util.concurrent.CopyOnWriteArrayList
import java.util.concurrent.atomic.AtomicLong
@@ -36,7 +41,8 @@ class StatusBarView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : LinearLayout(context, attrs, defStyleAttr), IMoGoSkinModeChangeListener, IViewControlListener, IMoGoAutopilotStatusListener {
) : LinearLayout(context, attrs, defStyleAttr), IMoGoSkinModeChangeListener, IViewControlListener,
IMoGoAutopilotStatusListener {
companion object {
const val TAG = "StatusBarView"
@@ -61,35 +67,49 @@ class StatusBarView @JvmOverloads constructor(
}
//添加view控制
CallerHmiViewControlListenerManager.addListener(TAG,this)
CallerHmiViewControlListenerManager.addListener(TAG, this)
// 添加换肤监听
CallerSkinModeListenerManager.addListener(TAG, this)
//将状态窗口中的状态移到状态栏上
CallerDevaToolsManager.showStatusBar(context, status_container)
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
updateStatusBarLeftView(true, FUNC_MODE_DEMO, DemoModeView(this.context))
updateStatusBarLeftView(true, FUNC_MODE_RAIN, RainModeView(this.context))
routeDownloadStatusRoot?.visibility = View.GONE
CallerDevaToolsManager.registerRouteDownloadListener(TAG) { state ->
when(state) {
when (state) {
0 -> {
routeDownloadStatusRoot?.visibility = View.GONE
}
1 -> {
routeDownloadStatusRoot?.visibility = View.VISIBLE
routeDownloadStatus?.background = ContextCompat.getDrawable(context, R.drawable.bg_autopilot_route_download_start)
routeDownloadStatus?.background = ContextCompat.getDrawable(
context,
R.drawable.bg_autopilot_route_download_start
)
routeDownloadFailMark?.visibility = View.GONE
}
2 -> {
routeDownloadStatusRoot?.visibility = View.VISIBLE
routeDownloadStatus?.background = ContextCompat.getDrawable(context, R.drawable.bg_autopilot_route_download_success)
routeDownloadStatus?.background = ContextCompat.getDrawable(
context,
R.drawable.bg_autopilot_route_download_success
)
routeDownloadFailMark?.visibility = View.GONE
UiThreadHandler.postDelayed(Runnable { routeDownloadStatusRoot?.visibility = View.GONE }, 3000)
UiThreadHandler.postDelayed(Runnable {
routeDownloadStatusRoot?.visibility = View.GONE
}, 3000)
}
3 -> {
routeDownloadStatusRoot?.visibility = View.VISIBLE
routeDownloadStatus?.background = ContextCompat.getDrawable(context, R.drawable.bg_autopilot_route_download_failed)
routeDownloadStatus?.background = ContextCompat.getDrawable(
context,
R.drawable.bg_autopilot_route_download_failed
)
routeDownloadFailMark?.visibility = View.VISIBLE
}
}
@@ -111,10 +131,11 @@ class StatusBarView @JvmOverloads constructor(
super.onAutopilotRouteLineId(lineId)
if (lineId != this.lineId.get()) {
this.lineId.set(lineId)
Logger.d(TAG, "--- onAutopilotRouteLineId ---: $lineId")
routeDownloadStatusRoot?.scope?.launch {
Logger.d(TAG, "--- onAutopilotRouteLineId 1 ---: $lineId")
if ((routeDownloadStatusRoot?.visibility == View.VISIBLE) && AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
if ((routeDownloadStatusRoot?.visibility == View.VISIBLE) && AppIdentityModeUtils.isDriver(
FunctionBuildConfig.appIdentityMode
)
) {
routeDownloadStatusRoot?.visibility = View.GONE
}
}
@@ -143,7 +164,7 @@ class StatusBarView @JvmOverloads constructor(
override fun updateStatusBarLeftView(insert: Boolean, tag: String, viewGroup: ViewGroup) {
if (insert) {
if(leftViewList.contains(tag)){
if (leftViewList.contains(tag)) {
return
}
leftViewList.add(0, tag)