[dev_arch_opt_3.0]

[Change]
[1、拆分汽车底盘数据透出,都采用单个类型数据回调]

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2023-01-05 21:21:02 +08:00
parent 22198c92ec
commit 723540b9a4
26 changed files with 333 additions and 325 deletions

View File

@@ -10,10 +10,10 @@ import android.widget.RadioButton
import android.widget.TextView
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGnssInfoListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGnssInfoListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
@@ -37,7 +37,7 @@ import java.util.*
* @since: 2022/7/12
*/
class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener,
IMoGoAutopilotRecordListener, IMoGoAutopilotCarStateListener {
IMoGoAutopilotRecordListener, IMoGoChassisGnssInfoListener {
companion object {
const val TAG = "AIDataCollectWindow"
@@ -117,7 +117,7 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener
//采集结果回调监听
CallerAutopilotRecordListenerManager.addListener(this.hashCode().toString(), this)
// 添加 ADAS车辆状态&定位 监听
CallerAutopilotCarStatusListenerManager.addListener(this.hashCode().toString(), this)
CallerChassisGnssInfoListenerManager.addListener(this.hashCode().toString(), this)
//开始录制AI数据采集Bag包
CallerAutoPilotManager.recordPackage(
99,
@@ -341,7 +341,7 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener
//注销采集结果回调监听
CallerAutopilotRecordListenerManager.removeListener(this.hashCode().toString())
// 移除 ADAS车辆状态&定位 监听
CallerAutopilotCarStatusListenerManager.removeListener(this.hashCode().toString())
CallerChassisGnssInfoListenerManager.removeListener(this.hashCode().toString())
if (mFloatLayout.parent != null) mWindowManager!!.removeView(mFloatLayout)
}

View File

@@ -14,10 +14,10 @@ import android.widget.TextView
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.badcase.RecordCaseEntity
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGnssInfoListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGnssInfoListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
@@ -47,7 +47,7 @@ import java.util.*
* @since: 2022/7/13
*/
class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchListener,
IMoGoAutopilotRecordListener, IMoGoAutopilotCarStateListener {
IMoGoAutopilotRecordListener, IMoGoChassisGnssInfoListener {
companion object {
const val TAG = "InitiativeBadCaseWindow"
@@ -140,7 +140,7 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
//采集结果回调监听
CallerAutopilotRecordListenerManager.addListener(this.hashCode().toString(), this)
// 添加 ADAS车辆状态&定位 监听
CallerAutopilotCarStatusListenerManager.addListener(this.hashCode().toString(), this)
CallerChassisGnssInfoListenerManager.addListener(this.hashCode().toString(), this)
viewAudioButton.setOnClickListener {
audioStatus = !audioStatus
setAudio(audioStatus)
@@ -367,7 +367,7 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
//注销采集结果回调监听
CallerAutopilotRecordListenerManager.removeListener(this.hashCode().toString())
// 移除 ADAS车辆状态&定位 监听
CallerAutopilotCarStatusListenerManager.removeListener(this.hashCode().toString())
CallerChassisGnssInfoListenerManager.removeListener(this.hashCode().toString())
if (mFloatLayout.parent != null) mWindowManager!!.removeView(mFloatLayout)
}

View File

@@ -17,8 +17,8 @@ import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.RecordBagMsg
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGnssInfoListener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGnssInfoListenerManager
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.Companion.M_DEVA
@@ -44,7 +44,7 @@ import java.io.File
* @since: 2022/7/17
*/
class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListener,
IMoGoAutopilotCarStateListener, CompoundButton.OnCheckedChangeListener {
IMoGoChassisGnssInfoListener, CompoundButton.OnCheckedChangeListener {
companion object {
const val TAG = "PassiveBadCaseWindow"
@@ -117,7 +117,7 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
"时间:${millis2String(System.currentTimeMillis(), TimeUtils.getHourMinSecondFormat())}"
tvPassiveIdentity.text = "身份:${BadCaseConfig.identity}"
// 添加 ADAS车辆状态&定位 监听
CallerAutopilotCarStatusListenerManager.addListener(TAG, this)
CallerChassisGnssInfoListenerManager.addListener(TAG, this)
viewAudioButton.setOnClickListener {
audioStatus = !audioStatus
setAudio(audioStatus)
@@ -361,7 +361,7 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
fun hideFloatWindow() {
// 移除 ADAS车辆状态&定位 监听
CallerAutopilotCarStatusListenerManager.removeListener(TAG)
CallerChassisGnssInfoListenerManager.removeListener(TAG)
if (mFloatLayout.parent != null) mWindowManager!!.removeView(mFloatLayout)
}

View File

@@ -5,14 +5,8 @@ import android.util.Log
import chassis.Chassis.GearPosition
import chassis.Chassis.LightSwitch
import chassis.VehicleStateOuterClass
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoSweeperFutianCleanSystemListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager
import com.mogo.eagle.core.function.api.autopilot.*
import com.mogo.eagle.core.function.call.autopilot.*
import com.mogo.eagle.core.utilcode.kotlin.safeCancel
import com.zhjt.mogo_core_function_devatools.status.entity.CanStatus
import com.zhjt.mogo_core_function_devatools.status.flow.IFlow
@@ -24,9 +18,17 @@ import mogo_msg.MogoReportMsg.MogoReportMessage
import system_master.SystemStatusInfo.StatusInfo
import java.util.concurrent.atomic.AtomicInteger
internal class CanImpl(ctx: Context):
internal class CanImpl(ctx: Context) :
IFlow<CanStatus>(ctx),
IMoGoAutopilotVehicleStateListener,
IMoGoChassisAccStateListener,
IMoGoChassisSteeringStateListener,
IMoGoChassisGearStateListener,
IMoGoChassisBrakeStateListener,
IMoGoChassisThrottleStateListener,
IMoGoAutopilotStatusListener,
IMoGoChassisLamplightListener,
IMoGoSweeperFutianCleanSystemListener {
@@ -40,7 +42,13 @@ internal class CanImpl(ctx: Context):
override fun onCreate() {
send(CanStatus(CallerAutoPilotManager.isConnected()))
CallerAutopilotVehicleStateListenerManager.addListener(TAG, this)
CallerChassisAccStateListenerManager.addListener(TAG, this)
CallerChassisBrakeStateListenerManager.addListener(TAG, this)
CallerChassisGearStateListenerManager.addListener(TAG, this)
CallerChassisSteeringStateListenerManager.addListener(TAG, this)
CallerChassisThrottleStateListenerManager.addListener(TAG, this)
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerChassisLamplightListenerManager.addListener(TAG, this)
}
@@ -121,13 +129,19 @@ internal class CanImpl(ctx: Context):
launch(Dispatchers.Unconfined) {
delay(4000)
send(CanStatus(isCanEnabled()))
}.also { job = it }
}.also { job = it }
}
override fun onDestroy() {
super.onDestroy()
job?.safeCancel()
CallerAutopilotVehicleStateListenerManager.removeListener(TAG)
CallerChassisAccStateListenerManager.removeListener(TAG)
CallerChassisBrakeStateListenerManager.removeListener(TAG)
CallerChassisGearStateListenerManager.removeListener(TAG)
CallerChassisSteeringStateListenerManager.removeListener(TAG)
CallerChassisThrottleStateListenerManager.removeListener(TAG)
CallerAutoPilotStatusListenerManager.removeListener(TAG)
CallerChassisLamplightListenerManager.removeListener(TAG)
}

View File

@@ -14,7 +14,7 @@ import system_master.SystemStatusInfo.HealthInfo
import system_master.SystemStatusInfo.StatusInfo
import java.util.concurrent.atomic.*
internal class RTKImpl(ctx: Context): IFlow<RTKStatus>(ctx), IMoGoAutopilotStatusListener, IMoGoAutopilotCarStateListener {
internal class RTKImpl(ctx: Context): IFlow<RTKStatus>(ctx), IMoGoAutopilotStatusListener, IMoGoChassisGnssInfoListener {
companion object {
const val TAG = "RTKImpl"
}
@@ -34,7 +34,7 @@ internal class RTKImpl(ctx: Context): IFlow<RTKStatus>(ctx), IMoGoAutopilotStatu
send(RTKStatus(getDesc(), getCode()))
CallerLogger.d("$M_DEVA$TAG", "-- onCreate --")
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerAutopilotCarStatusListenerManager.addListener(TAG, this)
CallerChassisGnssInfoListenerManager.addListener(TAG, this)
if (CallerAutoPilotManager.isConnected()) {
check()
}
@@ -95,7 +95,7 @@ internal class RTKImpl(ctx: Context): IFlow<RTKStatus>(ctx), IMoGoAutopilotStatu
private fun isRTKEnabled(): Boolean {
val code = CallerAutoPilotStatusListenerManager.getAutoPilotReportMessageCode()
val gnssInfo = CallerAutopilotCarStatusListenerManager.getCurrentGnssInfo()
val gnssInfo = CallerChassisGnssInfoListenerManager.getCurrentGnssInfo()
return CallerAutoPilotManager.isConnected() && (
code != "EHW_RTK" &&
code != "EHW_GNSS" &&
@@ -117,6 +117,6 @@ internal class RTKImpl(ctx: Context): IFlow<RTKStatus>(ctx), IMoGoAutopilotStatu
isOldVersion.set(false)
CallerLogger.d("$M_DEVA$TAG", "-- onDestroy --")
CallerAutoPilotStatusListenerManager.removeListener(TAG)
CallerAutopilotCarStatusListenerManager.removeListener(TAG)
CallerChassisGnssInfoListenerManager.removeListener(TAG)
}
}