[6.6.0] union the chassis state in one caller
This commit is contained in:
@@ -24,7 +24,7 @@ import kotlinx.coroutines.flow.*
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
import kotlin.math.*
|
||||
|
||||
class M1LookAroundView: SurfaceView, SurfaceHolder.Callback, Runnable, IMoGoChassisSteeringStateListener {
|
||||
class M1LookAroundView: SurfaceView, SurfaceHolder.Callback, Runnable, IMoGoChassisStatesListener {
|
||||
|
||||
constructor(context: Context?) : super(context)
|
||||
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
|
||||
@@ -279,7 +279,7 @@ class M1LookAroundView: SurfaceView, SurfaceHolder.Callback, Runnable, IMoGoChas
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerChassisSteeringStateListenerManager.addListener(TAG, this)
|
||||
CallerChassisStatesListenerManager.addListener(TAG, this)
|
||||
CallerAutoPilotControlManager.setIsSubscribeM1StitchedVideo(true)
|
||||
scope.launch(ThreadUtils.getCpuPool().asCoroutineDispatcher()) {
|
||||
CallerDevaToolsManager.lookAroundProvider()?.flow()?.also { flow ->
|
||||
@@ -306,7 +306,7 @@ class M1LookAroundView: SurfaceView, SurfaceHolder.Callback, Runnable, IMoGoChas
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerChassisSteeringStateListenerManager.removeListener(TAG)
|
||||
CallerChassisStatesListenerManager.removeListener(TAG)
|
||||
CallerAutoPilotControlManager.setIsSubscribeM1StitchedVideo(false)
|
||||
handler.get()?.looper?.quitSafely()
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ import androidx.core.view.MenuCompat
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import chassis.Chassis
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.cloud.network.cronet.NetworkQualityListener
|
||||
import com.mogo.cloud.network.cronet.QuicConfig
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient
|
||||
@@ -41,7 +40,6 @@ import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig
|
||||
import com.mogo.eagle.core.data.config.JunkConfig
|
||||
import com.mogo.eagle.core.data.constants.MoGoConfig
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_BAG_RECORD
|
||||
@@ -58,7 +56,13 @@ import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.data.multidisplay.TelematicConstant
|
||||
import com.mogo.eagle.core.data.obu.MogoObuConst
|
||||
import com.mogo.eagle.core.data.obu.ObuStatusInfo
|
||||
import com.mogo.eagle.core.function.api.autopilot.*
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisStatesListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningTrajectoryListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoSweeperFutianCleanSystemListener
|
||||
import com.mogo.eagle.core.function.api.cloud.IMoGoCloudListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.obu.IMoGoObuConnectListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.obu.IMoGoObuInfoListener
|
||||
@@ -68,14 +72,20 @@ import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.FUNC_MODE_DEMO
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.FUNC_MODE_RAIN
|
||||
import com.mogo.eagle.core.function.api.setting.ISopSettingListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.*
|
||||
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.CallerAutopilotIdentifyListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningTrajectoryListenerManager
|
||||
import com.mogo.eagle.core.function.call.cloud.CallerCloudCertManager
|
||||
import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsFuncConfigListenerManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuApiManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuConnectListenerManager
|
||||
@@ -98,22 +108,213 @@ 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.mogo.permissions.BackgrounderPermission
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast
|
||||
import com.mogo.eagle.core.utilcode.util.*
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityUtils
|
||||
import com.mogo.eagle.core.utilcode.util.AppUtils
|
||||
import com.mogo.eagle.core.utilcode.util.BarUtils
|
||||
import com.mogo.eagle.core.utilcode.util.CommonUtils
|
||||
import com.mogo.eagle.core.utilcode.util.DeviceUtils
|
||||
import com.mogo.eagle.core.utilcode.util.KeyboardUtils
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ParseVersionUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ScreenUtils
|
||||
import com.mogo.eagle.core.utilcode.util.StringUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.TimeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.eagle.core.utilcode.util.Utils
|
||||
import com.mogo.map.MogoData.Companion.mogoMapData
|
||||
import com.mogo.map.uicontroller.VisualAngleMode
|
||||
import com.mogo.map.uicontroller.VisualAngleMode.*
|
||||
import com.mogo.test.crashreport.CrashReportConstants
|
||||
import com.mogo.test.crashreport.ITestCrashReportProvider
|
||||
import com.mogo.map.uicontroller.VisualAngleMode.MAP_STYLE_VR_ANGLE_300
|
||||
import com.mogo.map.uicontroller.VisualAngleMode.MAP_STYLE_VR_ANGLE_CROSS
|
||||
import com.mogo.map.uicontroller.VisualAngleMode.MAP_STYLE_VR_ANGLE_TOP
|
||||
import com.mogo.map.uicontroller.VisualAngleMode.MODE_LONG_SIGHT
|
||||
import com.mogo.tts.base.IMogoTTSCallback
|
||||
import com.zhidaoauto.map.data.road.RoadCross
|
||||
import com.zhjt.mogo.adas.data.AdasConstants
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.*
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.appVersionInfoLayout
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.brakeThresholdDivider
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.btChangeEnv
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.btnAppReboot
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.btnBrakeThreshold
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.btnConnectServerIp
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.btnDisconnectIpc
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.btnDrawFusion
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.btnIpcReboot
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.btnPointCloudColor
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.btnPointCloudSize
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.btnRecordBag
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.btnRecordPackage
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.btnSetAutopilotIP
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.btnSetFifty
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.btnSetObuIP
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.btnSetOneHundred
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.btnStartTTS
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.btnThresholdDefine
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.btn_cache_hd_map
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.cbAdasAutoPilot
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.cbAdasDataTrack
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.cbAdasLog
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.cbAdasTrafficlight
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.cbAdasTrajectory
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.cbAdasVehicle
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.cbBusLog
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.cbDevaLog
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.cbHmiLog
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.cbMapLog
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.cbNetworkLog
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.cbObuLog
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.cbSsl
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.cbSweeperPLog
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.cbTaxiLog
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.cbTaxiPLog
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.cbTraceLog
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.cbV2xLog
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.changesight_back_btn
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.changesight_cross_btn
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.changesight_far_btn
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.changesight_top_btn
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.clDebugContain
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.commonLayout
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.controlCenterLayout
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.deviceBindLayout
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.domainControllerLayout
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.eagleEyeControllerLayout
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.etAutopilotIP
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.etConnectServerIp
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.etInputBrakeThreshold
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.etInputRecordBagTime
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.etInputRecordTime
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.etLogCatch
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.etObuIP
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.etPointCloudColor
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.etPointCloudSize
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.etTTSContent
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.etThreshold
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.exportAllLogs
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.hdMapControllerLayout
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.hmiControllerLayout
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.logLoadingView
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.logcatCenterLayout
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.obuConnectStatusTv
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.obuControllerLayout
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.reportMsgLayout
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.reset_changesight
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.rgGpsProvider
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.statusCenterLayout
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.swDevelopMode
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbADASLog
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbAppUpgrade
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbAppVersionInfo
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbBeautyMode
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbBusStationStrategyBorderPoint
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbCarAperture
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbChangeAutoPilotStatus
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbChangeCurrentCarIcon
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbChangeCurrentSkinMode
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbControlCenter
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbControlPassengerDriverMonitor
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbCronet
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbDeviceBind
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbDomainController
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbDrawPointCloudData
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbEagleEyeController
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbHdMapController
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbHdMapLog
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbHmiController
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbIsDemoMode
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbIsDrawAutopilotTrajectoryData
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbIsDrawIdentifyData
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbIsDrawPath
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbIsDrawUnknownIdentifyData
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbIsRainMode
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbIsStrictMode
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbLogCatch
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbLogDebugView
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbLogcatCenter
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbNetLog
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbObuController
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbObuLog
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbObuWarningFusionUnion
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbOpenAcceleration
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbOpenSnBinding
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbReportMore
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbReportWarning
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbRouteDynamicEffect
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbSelfLog
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbStartAutopilotCommand
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbStatusCenter
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbTTSCenter
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbTraceEnable
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbVehicleStateController
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.trackerIPCProvider
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.trackerProvider
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.ttsCenterContainer
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvAppBuildTimeInfo
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvAppContent
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvAppHost
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvAppVersionName
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvAppVersionNameKey
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvAutopilotConnectStatus
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvAutopilotInfo
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvAutopilotProtocolVersionInfo
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvBackgroundOperation
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvCarInfo
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvCarInfoCopy
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvCarInfoCopyClip
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvCertFile
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvCmdbCarInfoContent
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvCurEnv
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvDriverServerStartupStatus
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvGearInfo
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvGitBranchInfo
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvIPCMac
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvIdentifyInfo
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvIdentifyInfoCopy
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvInternetEnvironment
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvIpcConnectStatus
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvIpcInfo
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvIpcInfoKey
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvIpcProtocolVersionInfo
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvIpcVersionInfo
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvIpcVersionInfoClip
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvIpcVersionInfoKey
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvLocationEnabled
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvMoGoMapVersion
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvMoGoMapVersionKey
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvObuConnectStatus
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvObuInfoContent
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvPadCopyrightId
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvPadSn
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvPadSnClip
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvPadSnKey
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvPlateNumber
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvReportActions
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvReportCode
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvReportLevel
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvReportMsg
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvReportResult
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvReportSrc
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvRouteInfoSize
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvRouteInfoSizeCopy
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvServerEnvironment
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvServerSocketStatus
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvSteeringInfo
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvTelematicTimeStamp
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvTrajectoryInfoSize
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvTrajectoryInfoSizeCopy
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tvUniqueDeviceId
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.vehicleStateLayout
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo_msg.MogoReportMsg
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
import java.util.Date
|
||||
import java.util.Timer
|
||||
import java.util.TimerTask
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlin.collections.component1
|
||||
import kotlin.collections.component2
|
||||
@@ -142,13 +343,8 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
IMoGoPlanningRottingListener,
|
||||
IMoGoPlanningTrajectoryListener,
|
||||
IMoGoDevaToolsFuncConfigListener,
|
||||
IMoGoChassisLamplightListener,
|
||||
IMoGoDevaToolsListener,
|
||||
IMoGoChassisAccStateListener,
|
||||
IMoGoChassisSteeringStateListener,
|
||||
IMoGoChassisGearStateListener,
|
||||
IMoGoChassisBrakeStateListener,
|
||||
IMoGoChassisThrottleStateListener,
|
||||
IMoGoChassisStatesListener,
|
||||
IMoGoSweeperFutianCleanSystemListener,
|
||||
IMoGoObuInfoListener,
|
||||
ISopSettingListener, IViewControlListener, IMoGoCloudListener {
|
||||
@@ -255,16 +451,10 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
// 添加 规划路径相关回调 监听
|
||||
CallerPlanningRottingListenerManager.addListener(TAG, this)
|
||||
CallerPlanningTrajectoryListenerManager.addListener(TAG, this)
|
||||
//添加 车辆底盘数据回调 监听
|
||||
CallerChassisAccStateListenerManager.addListener(TAG, this)
|
||||
CallerChassisBrakeStateListenerManager.addListener(TAG, this)
|
||||
CallerChassisGearStateListenerManager.addListener(TAG, this)
|
||||
CallerChassisSteeringStateListenerManager.addListener(TAG, this)
|
||||
CallerChassisThrottleStateListenerManager.addListener(TAG, this)
|
||||
//添加 开发套件工具接口 监听
|
||||
CallerDevaToolsListenerManager.addListener(TAG, this)
|
||||
//添加 底盘灯光数据 监听
|
||||
CallerChassisLamplightListenerManager.addListener(TAG, this)
|
||||
//添加 底盘数据 监听
|
||||
CallerChassisStatesListenerManager.addListener(TAG, this)
|
||||
//雨天、美化、点云设置同步
|
||||
CallerSopSettingManager.addListener(TAG, this)
|
||||
|
||||
@@ -304,16 +494,10 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
// 移除 规划路径相关回调 监听
|
||||
CallerPlanningRottingListenerManager.removeListener(TAG)
|
||||
CallerPlanningTrajectoryListenerManager.removeListener(TAG)
|
||||
// 移除 车辆底盘数据回调 监听
|
||||
CallerChassisAccStateListenerManager.removeListener(TAG)
|
||||
CallerChassisBrakeStateListenerManager.removeListener(TAG)
|
||||
CallerChassisGearStateListenerManager.removeListener(TAG)
|
||||
CallerChassisSteeringStateListenerManager.removeListener(TAG)
|
||||
CallerChassisThrottleStateListenerManager.removeListener(TAG)
|
||||
// 移除 开发套件工具接口 监听
|
||||
CallerDevaToolsListenerManager.removeListener(TAG)
|
||||
// 移除 底盘灯光数据 监听
|
||||
CallerChassisLamplightListenerManager.removeListener(TAG)
|
||||
// 移除 底盘数据 监听
|
||||
CallerChassisStatesListenerManager.removeListener(TAG)
|
||||
// 移除 obu获取信息 监听
|
||||
CallerObuInfoListenerManager.removeListener(TAG)
|
||||
//雨天、美化、点云设置同步
|
||||
|
||||
@@ -8,14 +8,14 @@ import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import chassis.Chassis
|
||||
import com.mogo.eagle.core.data.constants.MoGoConfig
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
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.scene.SceneConstant.Companion.M_HMI
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisStatesListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.Utils
|
||||
import kotlinx.android.synthetic.main.view_steering_brake.view.*
|
||||
@@ -25,7 +25,7 @@ import kotlinx.android.synthetic.main.view_steering_brake.view.*
|
||||
* 刹车,调用模型的逻辑暂时放入view。 转向不受影响
|
||||
*/
|
||||
class SteeringBrakeView(context: Context, attrs: AttributeSet?) : ConstraintLayout(context, attrs),
|
||||
IMoGoChassisLamplightListener, IMoGoChassisLocationWGS84Listener {
|
||||
IMoGoChassisStatesListener, IMoGoChassisLocationWGS84Listener {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "SteeringBrakeView"
|
||||
@@ -41,7 +41,7 @@ class SteeringBrakeView(context: Context, attrs: AttributeSet?) : ConstraintLayo
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerChassisLamplightListenerManager.addListener(TAG, this)
|
||||
CallerChassisStatesListenerManager.addListener(TAG, this)
|
||||
CallerChassisLocationWGS84ListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ class SteeringBrakeView(context: Context, attrs: AttributeSet?) : ConstraintLayo
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerChassisLamplightListenerManager.removeListener(TAG)
|
||||
CallerChassisStatesListenerManager.removeListener(TAG)
|
||||
CallerChassisLocationWGS84ListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
|
||||
@@ -12,9 +12,9 @@ import android.widget.ImageView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import chassis.Chassis
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisStatesListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTurnLightListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerTurnLightListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
@@ -30,7 +30,7 @@ open class TurnLightViewStatus @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoChassisLamplightListener,
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoChassisStatesListener,
|
||||
IMoGoTurnLightListener {
|
||||
|
||||
companion object {
|
||||
@@ -72,13 +72,13 @@ open class TurnLightViewStatus @JvmOverloads constructor(
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerChassisLamplightListenerManager.addListener(TAG, this)
|
||||
CallerChassisStatesListenerManager.addListener(TAG, this)
|
||||
CallerTurnLightListenerManager.addListener(TAG,this)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerChassisLamplightListenerManager.removeListener(TAG)
|
||||
CallerChassisStatesListenerManager.removeListener(TAG)
|
||||
CallerTurnLightListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
|
||||
@@ -13,11 +13,9 @@ import chassis.Chassis.GearPosition
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGearStateListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisSteeringStateListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisStatesListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGearStateListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisSteeringStateListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils.isBus
|
||||
@@ -35,8 +33,7 @@ import kotlin.math.abs
|
||||
* 档位随CAN数据做切换和高亮显示
|
||||
* @since: 4/7/22
|
||||
*/
|
||||
class SteeringWheelView : ConstraintLayout, IMoGoChassisSteeringStateListener,
|
||||
IMoGoChassisGearStateListener {
|
||||
class SteeringWheelView : ConstraintLayout, IMoGoChassisStatesListener {
|
||||
private var autopilotIV: ImageView? = null
|
||||
private var steeringTVL: TextView? = null
|
||||
private var steeringTVR: TextView? = null
|
||||
@@ -57,8 +54,7 @@ class SteeringWheelView : ConstraintLayout, IMoGoChassisSteeringStateListener,
|
||||
}
|
||||
initView()
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, mGoAutopilotStatusListener)
|
||||
CallerChassisGearStateListenerManager.addListener(TAG, this)
|
||||
CallerChassisSteeringStateListenerManager.addListener(TAG, this)
|
||||
CallerChassisStatesListenerManager.addListener(TAG, this)
|
||||
tapPositionView?.updateWithGear(GearPosition.GEAR_R)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,169 +0,0 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.widget;
|
||||
|
||||
import static com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningActionsListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisBrakeStateListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGearStateListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisThrottleStateListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningActionsListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisBrakeStateListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGearStateListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisThrottleStateListenerManager;
|
||||
import com.mogo.eagle.core.function.hmi.R;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import chassis.Chassis;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
/**
|
||||
* @author Jing
|
||||
* @description 速度 加速度 档位 刹车 油门状态值
|
||||
* @since: 6/24/22
|
||||
*/
|
||||
public class TrafficDataView extends ConstraintLayout implements
|
||||
IMoGoChassisGearStateListener ,
|
||||
IMoGoChassisBrakeStateListener,
|
||||
IMoGoChassisThrottleStateListener,
|
||||
IMoGoAutopilotPlanningActionsListener {
|
||||
private static final String TAG = "TrafficDataView";
|
||||
private TapPositionView tapPositionView;
|
||||
private TextView speedTextView;
|
||||
private TextView accTextView;
|
||||
private ImageView speedImage;
|
||||
private ImageView brakeStatus;
|
||||
|
||||
private static final int MSG_SEND_UPDATE = 1;
|
||||
private volatile double acceleration;
|
||||
private volatile float mBrake;
|
||||
private volatile float mThrottle;
|
||||
|
||||
@SuppressLint("HandlerLeak")
|
||||
private final Handler handler = new Handler() {
|
||||
@Override
|
||||
public void handleMessage(@NonNull Message msg) {
|
||||
super.handleMessage(msg);
|
||||
if (msg.what == MSG_SEND_UPDATE) {
|
||||
java.text.DecimalFormat mFormat = new java.text.DecimalFormat("0.0");
|
||||
String accStr = mFormat.format(Math.abs(acceleration));
|
||||
if (acceleration > 0f) {
|
||||
accTextView.setText(accStr);
|
||||
} else {
|
||||
accTextView.setText("- " + accStr);
|
||||
}
|
||||
int state = CallerAutoPilotStatusListenerManager.INSTANCE.getState();
|
||||
if (state < STATUS_AUTOPILOT_RUNNING) {
|
||||
if (mBrake > 0) {
|
||||
brakeStatus.setImageResource(R.drawable.traffic_data_brake);
|
||||
} else if (mThrottle >= 0 && mBrake == 0) {
|
||||
brakeStatus.setImageResource(R.drawable.traffic_data_accelerator);
|
||||
} else {
|
||||
brakeStatus.setImageResource(R.drawable.traffic_data_empty);
|
||||
}
|
||||
}
|
||||
if (state == 2) {
|
||||
brakeStatus.setImageResource(R.drawable.traffic_data_empty);
|
||||
}
|
||||
}
|
||||
handler.sendEmptyMessageDelayed(MSG_SEND_UPDATE, 1000L);
|
||||
}
|
||||
};
|
||||
|
||||
public TrafficDataView(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public TrafficDataView(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
initView(context);
|
||||
}
|
||||
|
||||
public TrafficDataView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
public TrafficDataView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
handler.sendEmptyMessageDelayed(MSG_SEND_UPDATE, 1000L);
|
||||
CallerChassisGearStateListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerChassisBrakeStateListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerChassisThrottleStateListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerPlanningActionsListenerManager.INSTANCE.addListener(TAG, this);
|
||||
}
|
||||
|
||||
private void initView(@NonNull Context context) {
|
||||
LayoutInflater.from(context).inflate(R.layout.hmi_traffic_data, this);
|
||||
tapPositionView = findViewById(R.id.traffic_position);
|
||||
speedImage = findViewById(R.id.speedImage);
|
||||
speedTextView = findViewById(R.id.speedTextView);
|
||||
accTextView = findViewById(R.id.speedAccTextView);
|
||||
brakeStatus = findViewById(R.id.brakeStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
CallerChassisGearStateListenerManager.INSTANCE.removeListener(TAG);
|
||||
CallerChassisBrakeStateListenerManager.INSTANCE.removeListener(TAG);
|
||||
CallerChassisThrottleStateListenerManager.INSTANCE.removeListener(TAG);
|
||||
CallerPlanningActionsListenerManager.INSTANCE.removeListener(TAG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pncActions(@NonNull MessagePad.PlanningActionMsg planningActionMsg) {
|
||||
acceleration = planningActionMsg.getDestinationAcc();
|
||||
}
|
||||
|
||||
/**
|
||||
* 档位
|
||||
*/
|
||||
@Override
|
||||
public void onAutopilotGearData(@NotNull Chassis.GearPosition gear) {
|
||||
ThreadUtils.runOnUiThread(() -> {
|
||||
if (tapPositionView != null) {
|
||||
tapPositionView.updateWithGear(gear);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotBrake(float brake) {
|
||||
mBrake = brake;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotThrottle(float throttle) {
|
||||
mThrottle = throttle;
|
||||
}
|
||||
|
||||
/**
|
||||
* value呈现
|
||||
*/
|
||||
public void updateSpeedWithValue(int newSpeed) {
|
||||
if (speedTextView != null) {
|
||||
speedTextView.setText(String.valueOf(newSpeed));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.widget
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.os.Message
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import chassis.Chassis.GearPosition
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningActionsListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisStatesListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getState
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningActionsListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import mogo.telematics.pad.MessagePad.PlanningActionMsg
|
||||
import java.text.DecimalFormat
|
||||
import kotlin.math.abs
|
||||
|
||||
/**
|
||||
* @author Jing
|
||||
* @description 速度 加速度 档位 刹车 油门状态值
|
||||
* @since: 6/24/22
|
||||
*/
|
||||
open class TrafficDataView : ConstraintLayout, IMoGoChassisStatesListener,
|
||||
IMoGoAutopilotPlanningActionsListener {
|
||||
private var tapPositionView: TapPositionView? = null
|
||||
private var speedTextView: TextView? = null
|
||||
private var accTextView: TextView? = null
|
||||
private var speedImage: ImageView? = null
|
||||
private var brakeStatus: ImageView? = null
|
||||
|
||||
@Volatile
|
||||
private var acceleration = 0.0
|
||||
|
||||
@Volatile
|
||||
private var mBrake = 0f
|
||||
|
||||
@Volatile
|
||||
private var mThrottle = 0f
|
||||
|
||||
@SuppressLint("HandlerLeak")
|
||||
private val handler: Handler = object : Handler(Looper.getMainLooper()) {
|
||||
override fun handleMessage(msg: Message) {
|
||||
super.handleMessage(msg)
|
||||
if (msg.what == MSG_SEND_UPDATE) {
|
||||
val mFormat = DecimalFormat("0.0")
|
||||
val accStr = mFormat.format(abs(acceleration))
|
||||
if (acceleration > 0f) {
|
||||
accTextView?.text = accStr
|
||||
} else {
|
||||
accTextView?.text = "- $accStr"
|
||||
}
|
||||
val state = getState()
|
||||
if (state < IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
if (mBrake > 0) {
|
||||
brakeStatus?.setImageResource(R.drawable.traffic_data_brake)
|
||||
} else if (mThrottle >= 0 && mBrake == 0f) {
|
||||
brakeStatus?.setImageResource(R.drawable.traffic_data_accelerator)
|
||||
} else {
|
||||
brakeStatus?.setImageResource(R.drawable.traffic_data_empty)
|
||||
}
|
||||
}
|
||||
if (state == 2) {
|
||||
brakeStatus?.setImageResource(R.drawable.traffic_data_empty)
|
||||
}
|
||||
}
|
||||
sendEmptyMessageDelayed(MSG_SEND_UPDATE, 1000L)
|
||||
}
|
||||
}
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {
|
||||
initView(context)
|
||||
}
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
|
||||
context,
|
||||
attrs,
|
||||
defStyleAttr
|
||||
)
|
||||
|
||||
constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet?,
|
||||
defStyleAttr: Int,
|
||||
defStyleRes: Int
|
||||
) : super(context, attrs, defStyleAttr, defStyleRes)
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
handler.sendEmptyMessageDelayed(MSG_SEND_UPDATE, 1000L)
|
||||
CallerChassisStatesListenerManager.addListener(TAG, this)
|
||||
CallerPlanningActionsListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
private fun initView(context: Context) {
|
||||
LayoutInflater.from(context).inflate(R.layout.hmi_traffic_data, this)
|
||||
tapPositionView = findViewById(R.id.traffic_position)
|
||||
speedImage = findViewById(R.id.speedImage)
|
||||
speedTextView = findViewById(R.id.speedTextView)
|
||||
accTextView = findViewById(R.id.speedAccTextView)
|
||||
brakeStatus = findViewById(R.id.brakeStatus)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerChassisStatesListenerManager.removeListener(TAG)
|
||||
CallerPlanningActionsListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
override fun pncActions(planningActionMsg: PlanningActionMsg) {
|
||||
acceleration = planningActionMsg.destinationAcc
|
||||
}
|
||||
|
||||
override fun onAutopilotGearData(gear: GearPosition) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
tapPositionView?.updateWithGear(gear)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAutopilotBrake(brake: Float) {
|
||||
mBrake = brake
|
||||
}
|
||||
|
||||
override fun onAutopilotThrottle(throttle: Float) {
|
||||
mThrottle = throttle
|
||||
}
|
||||
|
||||
/**
|
||||
* value呈现
|
||||
*/
|
||||
fun updateSpeedWithValue(newSpeed: Int) {
|
||||
speedTextView?.text = newSpeed.toString()
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "TrafficDataView"
|
||||
private const val MSG_SEND_UPDATE = 1
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user