diff --git a/OCH/bus/driver/src/main/java/com/mogo/och/bus/fragment/BaseBusTabFragment.java b/OCH/bus/driver/src/main/java/com/mogo/och/bus/fragment/BaseBusTabFragment.java index 7c570bd3f3..2a8a1c8d6d 100644 --- a/OCH/bus/driver/src/main/java/com/mogo/och/bus/fragment/BaseBusTabFragment.java +++ b/OCH/bus/driver/src/main/java/com/mogo/och/bus/fragment/BaseBusTabFragment.java @@ -92,6 +92,7 @@ public abstract class BaseBusTabFragment public boolean isAnimateRunning = false; + /** * 滑动按钮触发的事件 */ @@ -123,7 +124,15 @@ public abstract class BaseBusTabFragment // tvOperationStatus = findViewById(R.id.module_mogo_och_operation_status); tvArrived = findViewById(R.id.module_mogo_och_arrived_tv); - mTrafficDataView = (TrafficDataView) findViewById(R.id.bus_arc); +// mTrafficDataView = (TrafficDataView) findViewById(R.id.bus_arc); + + + FrameLayout flSpeed = findViewById(R.id.fl_speed); + if (flSpeed != null) { + CallerDevaToolsManager.INSTANCE.attachAutopilotBeforeLaunchView(flSpeed.getContext(), flSpeed); + } + + LayoutInflater.from(getContext()).inflate(getStationPanelViewId(), flStationPanelContainer); slidePanelView.setOnSlidePanelMoveToEndListener(onSlideToEndListener); diff --git a/OCH/bus/driver/src/main/res/layout/bus_base_fragment.xml b/OCH/bus/driver/src/main/res/layout/bus_base_fragment.xml index 7268f93076..dcb176d60b 100644 --- a/OCH/bus/driver/src/main/res/layout/bus_base_fragment.xml +++ b/OCH/bus/driver/src/main/res/layout/bus_base_fragment.xml @@ -19,22 +19,32 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> + + + + + + + + + + + + + + + + - - - - + app:layout_constraintTop_toTopOf="parent"/> - diff --git a/OCH/shuttle/driver/src/main/java/com/mogo/och/bus/fragment/BaseShuttleTabFragment.java b/OCH/shuttle/driver/src/main/java/com/mogo/och/bus/fragment/BaseShuttleTabFragment.java index 5f69222cbd..231992331b 100644 --- a/OCH/shuttle/driver/src/main/java/com/mogo/och/bus/fragment/BaseShuttleTabFragment.java +++ b/OCH/shuttle/driver/src/main/java/com/mogo/och/bus/fragment/BaseShuttleTabFragment.java @@ -73,7 +73,7 @@ public abstract class BaseShuttleTabFragment + + + + + + + + + + + + + + + + + - - - - + app:layout_constraintTop_toTopOf="parent"/> - + app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintLeft_toLeftOf="@+id/taxi_speed_contain" + app:layout_constraintRight_toRightOf="@+id/taxi_speed_contain" + app:layout_constraintTop_toBottomOf="@+id/taxi_speed_contain"> > : MvpFragment> : MvpFragment> : MvpFragment implements ITaxiADASS @Override public void onCarLocationChanged(MogoLocation location) { - if (null != location) { - runOnUIThread(() -> { - mView.updateSpeedView((float) location.getGnssSpeed()); - }); - } +// if (null != location) { +// runOnUIThread(() -> { +// mView.updateSpeedView((float) location.getGnssSpeed()); +// }); +// } } @Override diff --git a/OCH/taxi/unmanned-driver/src/main/res/layout/taxi_base_fragment.xml b/OCH/taxi/unmanned-driver/src/main/res/layout/taxi_base_fragment.xml index e6b1c1ab50..240d5f295c 100644 --- a/OCH/taxi/unmanned-driver/src/main/res/layout/taxi_base_fragment.xml +++ b/OCH/taxi/unmanned-driver/src/main/res/layout/taxi_base_fragment.xml @@ -29,7 +29,19 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> - + + + app:layout_constraintLeft_toLeftOf="@+id/module_mogo_och_speed_layout" + app:layout_constraintRight_toRightOf="@+id/module_mogo_och_speed_layout" + app:layout_constraintTop_toBottomOf="@+id/module_mogo_och_speed_layout"> ? = null + override fun init(context: Context) { mContext = context } @@ -471,4 +475,20 @@ class DevaToolsProvider : IDevaToolsProvider { override fun setNetworkMode(isDebug: Boolean) { WeakNetworkStrategy.setDebug(isDebug) } + + override fun attachAutopilotStatusView(ctx: Context, group: ViewGroup) { + if (group.childCount > 0) { + if (group.visibility != View.VISIBLE) { + group.visibility = View.VISIBLE + } + return + } + this.container = WeakReference(group) + val child = AutoPilotLaunchBeforeView(ctx) + group.addView(child, ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)) + } + + override fun getExceptionStatusBeforeLaunchAutopilot(): Int { + return StatusManager.getExceptionStatusBeforeLaunchAutopilot() + } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/StatusManager.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/StatusManager.kt index 755b7a2012..c6f4dc18ef 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/StatusManager.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/StatusManager.kt @@ -23,6 +23,12 @@ import com.zhjt.mogo_core_function_devatools.status.entity.* import com.zhjt.mogo_core_function_devatools.status.model.StatusModel import com.zhjt.mogo_core_function_devatools.status.flow.IFlow import com.zhjt.mogo_core_function_devatools.status.flow.OverViewImpl +import com.zhjt.mogo_core_function_devatools.status.flow.autopilot.AcceleratorImpl +import com.zhjt.mogo_core_function_devatools.status.flow.autopilot.BrakeImpl +import com.zhjt.mogo_core_function_devatools.status.flow.autopilot.DoubleFlashImpl +import com.zhjt.mogo_core_function_devatools.status.flow.autopilot.GearImpl +import com.zhjt.mogo_core_function_devatools.status.flow.autopilot.SpeedImpl +import com.zhjt.mogo_core_function_devatools.status.flow.autopilot.SteerImpl import com.zhjt.mogo_core_function_devatools.status.flow.can.CanImpl import com.zhjt.mogo_core_function_devatools.status.flow.gps.GpsImpl import com.zhjt.mogo_core_function_devatools.status.flow.ipc.IpcImpl @@ -33,17 +39,21 @@ import kotlinx.coroutines.* import kotlinx.coroutines.flow.* import java.lang.ref.* import java.util.concurrent.* +import java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy object StatusManager { - private const val TAG = "StatusManager" private lateinit var model: StatusModel private var hasInit = false - private val listeners by lazy { CopyOnWriteArrayList() } + private val listeners by lazy { ConcurrentHashMap() } private var container: WeakReference? = null + private val dispatcher by lazy { + ThreadPoolExecutor(1, 2, 1, TimeUnit.MINUTES, LinkedBlockingQueue(128), Executors.defaultThreadFactory(), DiscardOldestPolicy()).asCoroutineDispatcher() + CoroutineName("stats-manager-impl") + } + private val flows: ArrayList> by lazy { ArrayList() } @@ -77,10 +87,16 @@ object StatusManager { is TracingStatus -> TracingImpl(ctx) is RTKStatus -> RTKImpl(ctx) is OverViewStatus -> OverViewImpl(ctx) + is SteerStatus -> SteerImpl(ctx) + is AcceleratorStatus -> AcceleratorImpl(ctx) + is BrakeStatus -> BrakeImpl(ctx) + is DoubleFlashStatus -> DoubleFlashImpl(ctx) + is GearStatus -> GearImpl(ctx) + is SpeedStatus -> SpeedImpl(ctx) } }.also { flows += it } for (f in flows) { - ctx.lifeCycleScope.launch(Dispatchers.Default) { + ctx.lifeCycleScope.launch(dispatcher) { f.asFlow().collect { model.update(it) } @@ -89,7 +105,7 @@ object StatusManager { } model.status.observe(ctx.lifeCycleOwner) { - listeners.forEach { itx -> + listeners.values.forEach { itx -> itx.onStatusChanged(it.second, it.first != null) } } @@ -120,6 +136,30 @@ object StatusManager { flows.clear() } + fun addListener(tag: String, listener: IStatusListener) { + if (listeners.containsKey(tag)) { + return + } + listeners[tag] = listener + } + + fun removeListener(tag: String) { + listeners.remove(tag) + } + + fun getExceptionStatusBeforeLaunchAutopilot(): Int { + var ret = 0 + model.status.value?.second?.filter { + it is IAutopilotPreLaunchStatus + }?.forEachIndexed { index, status -> + val shl = 1 shl index + if (status.isException()) { + ret = ret or shl + } + } + return ret + } + interface IStatusListener { fun onStatusChanged(data: List, hasException: Boolean) } diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/entity/Status.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/entity/Status.kt index 1cff920d33..44d6ddc1ee 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/entity/Status.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/entity/Status.kt @@ -1,8 +1,5 @@ package com.zhjt.mogo_core_function_devatools.status.entity -import com.mogo.eagle.core.data.status.StatusSummaryEntity -import com.mogo.eagle.core.function.api.autopilot.* -import com.mogo.eagle.core.function.call.autopilot.* import com.zhjt.mogo_core_function_devatools.status.entity.TracingStatus.Tracing import com.zhjt.mogo_core_function_devatools.status.entity.TracingStatus.Tracing.* @@ -250,7 +247,7 @@ class OverViewStatus(var hasException: Boolean = false): Status() { fun String.toState(msg: String?): Tracing? { val ss = msg?.split("|") var extra: Map? = null - if (ss != null && ss.isNotEmpty()) { + if (!ss.isNullOrEmpty()) { val sb = StringBuilder() for (element in ss) { sb.append(element) @@ -290,3 +287,70 @@ fun String.toState(msg: String?): Tracing? { else -> null } } + +interface IAutopilotPreLaunchStatus + +/** + * 速度 + */ +data class SpeedStatus(val speed: Float): Status(), IAutopilotPreLaunchStatus { + + + override fun isException(): Boolean { + return false + } +} + +/** + * 方向盘转角 + */ +data class SteerStatus(val angle: Float, var isError: Boolean = false): Status(), IAutopilotPreLaunchStatus { + + + override fun isException(): Boolean { + return isError + } +} + +/** + * 油门 + */ +data class AcceleratorStatus(val angle: Float, var isError: Boolean = false): Status(), IAutopilotPreLaunchStatus { + + override fun isException(): Boolean { + return isError + } +} + +/** + * 刹车 + */ +data class BrakeStatus(val angle: Float, var isError: Boolean = false): Status(), IAutopilotPreLaunchStatus { + + override fun isException(): Boolean { + return isError + } +} + + +/** + * 双闪 + */ +data class DoubleFlashStatus(val type: Int, var isError: Boolean = false): Status(), IAutopilotPreLaunchStatus { + + override fun isException(): Boolean { + return isError + } +} + +/** + * 挡位 + */ +data class GearStatus(val value: Int, var isError: Boolean = false): Status(), IAutopilotPreLaunchStatus { + + override fun isException(): Boolean { + return isError + } +} + + diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/AcceleratorImpl.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/AcceleratorImpl.kt new file mode 100644 index 0000000000..5a9d99b29d --- /dev/null +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/AcceleratorImpl.kt @@ -0,0 +1,57 @@ +package com.zhjt.mogo_core_function_devatools.status.flow.autopilot + +import android.content.Context +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisThrottleStateListener +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerChassisThrottleStateListenerManager +import com.mogo.eagle.core.utilcode.mogo.logger.Logger +import com.zhjt.mogo.adas.data.bean.UnableLaunchData +import com.zhjt.mogo.adas.data.bean.UnableLaunchReason +import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_THROTTLE +import com.zhjt.mogo_core_function_devatools.status.entity.AcceleratorStatus +import com.zhjt.mogo_core_function_devatools.status.flow.IFlow + +internal class AcceleratorImpl(ctx: Context): IFlow(ctx), IMoGoChassisThrottleStateListener, IMoGoAutopilotActionsListener { + + + companion object { + private const val TAG = "AcceleratorImpl" + } + + @Volatile + private var last: Float? = null + + @Volatile + private var isError: Boolean = false + + override fun onCreate() { + CallerChassisThrottleStateListenerManager.addListener(TAG, this) + CallerAutopilotActionsListenerManager.addListener(TAG, this) + } + + override fun onDestroy() { + super.onDestroy() + CallerChassisThrottleStateListenerManager.removeListener(TAG) + CallerAutopilotActionsListenerManager.removeListener(TAG) + } + + override fun onAutopilotThrottle(throttle: Float) { + super.onAutopilotThrottle(throttle) + if (last != throttle) { + send(AcceleratorStatus(throttle, isError)) + last = throttle + } + } + + override fun onAutopilotAbility(isAutopilotAbility: Boolean, unableLaunchData: UnableLaunchData?, unableAutopilotReasons: ArrayList?) { + Logger.d(TAG, "onAutopilotAbility->($isAutopilotAbility, $unableLaunchData, ${unableAutopilotReasons?.joinToString(",")}") + if (!isAutopilotAbility && unableAutopilotReasons != null && unableAutopilotReasons.find { it.unableType == CHASSIS_THROTTLE } != null) { + isError = true + send(AcceleratorStatus(last ?: 0.0f, true)) + } else { + isError = false + send(AcceleratorStatus(last ?: 0.0f, false)) + } + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/BrakeImpl.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/BrakeImpl.kt new file mode 100644 index 0000000000..4843878981 --- /dev/null +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/BrakeImpl.kt @@ -0,0 +1,60 @@ +package com.zhjt.mogo_core_function_devatools.status.flow.autopilot + +import android.content.Context +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisBrakeStateListener +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerChassisBrakeStateListenerManager +import com.mogo.eagle.core.utilcode.mogo.logger.Logger +import com.zhjt.mogo.adas.data.bean.UnableLaunchData +import com.zhjt.mogo.adas.data.bean.UnableLaunchReason +import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_BRAKE +import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_THROTTLE +import com.zhjt.mogo_core_function_devatools.status.entity.AcceleratorStatus +import com.zhjt.mogo_core_function_devatools.status.entity.BrakeStatus +import com.zhjt.mogo_core_function_devatools.status.flow.IFlow +import com.zhjt.mogo_core_function_devatools.status.flow.autopilot.AcceleratorImpl.Companion + +internal class BrakeImpl(ctx: Context): IFlow(ctx), IMoGoChassisBrakeStateListener, IMoGoAutopilotActionsListener { + + companion object { + private const val TAG = "BrakeImpl" + } + + @Volatile + private var last: Float = 0.0f + + @Volatile + private var isError: Boolean = false + + override fun onCreate() { + CallerChassisBrakeStateListenerManager.addListener(TAG, this) + CallerAutopilotActionsListenerManager.addListener(TAG, this) + } + + override fun onDestroy() { + super.onDestroy() + CallerChassisBrakeStateListenerManager.removeListener(TAG) + CallerAutopilotActionsListenerManager.removeListener(TAG) + } + + override fun onAutopilotBrake(brake: Float) { + super.onAutopilotBrake(brake) + + if (last != brake) { + send(BrakeStatus(brake, isError)) + last = brake + } + } + + override fun onAutopilotAbility(isAutopilotAbility: Boolean, unableLaunchData: UnableLaunchData?, unableAutopilotReasons: ArrayList?) { + Logger.d(TAG, "onAutopilotAbility->($isAutopilotAbility, $unableLaunchData, ${unableAutopilotReasons?.joinToString(",")}") + if (!isAutopilotAbility && unableAutopilotReasons != null && unableAutopilotReasons.find { it.unableType == CHASSIS_BRAKE } != null) { + isError = true + send(BrakeStatus(last, true)) + } else { + isError = false + send(BrakeStatus(last, false)) + } + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/DoubleFlashImpl.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/DoubleFlashImpl.kt new file mode 100644 index 0000000000..ef573ff078 --- /dev/null +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/DoubleFlashImpl.kt @@ -0,0 +1,58 @@ +package com.zhjt.mogo_core_function_devatools.status.flow.autopilot + +import android.content.Context +import chassis.Chassis.LightSwitch +import chassis.Chassis.LightSwitch.LIGHT_FLASH +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager +import com.mogo.eagle.core.utilcode.mogo.logger.Logger +import com.zhjt.mogo.adas.data.bean.UnableLaunchData +import com.zhjt.mogo.adas.data.bean.UnableLaunchReason +import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_HAZARD_LIGHTS +import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_THROTTLE +import com.zhjt.mogo_core_function_devatools.status.entity.AcceleratorStatus +import com.zhjt.mogo_core_function_devatools.status.entity.DoubleFlashStatus +import com.zhjt.mogo_core_function_devatools.status.flow.IFlow + +internal class DoubleFlashImpl(ctx: Context): IFlow(ctx), IMoGoChassisLamplightListener, IMoGoAutopilotActionsListener { + + companion object { + private const val TAG = "DoubleFlashImpl" + } + + @Volatile + private var isError: Boolean = false + + override fun onCreate() { + CallerChassisLamplightListenerManager.addListener(TAG, this) + CallerAutopilotActionsListenerManager.addListener(TAG, this) + } + + override fun onDestroy() { + super.onDestroy() + CallerChassisLamplightListenerManager.removeListener(TAG) + CallerAutopilotActionsListenerManager.removeListener(TAG) + } + + override fun onAutopilotLightSwitchData(lightSwitch: LightSwitch?) { + super.onAutopilotLightSwitchData(lightSwitch) + Logger.d(TAG, "-- onAutopilotLightSwitchData --: $lightSwitch") + if (lightSwitch == LIGHT_FLASH) { + send(DoubleFlashStatus(lightSwitch.number, isError)) + } + + } + + override fun onAutopilotAbility(isAutopilotAbility: Boolean, unableLaunchData: UnableLaunchData?, unableAutopilotReasons: ArrayList?) { + Logger.d(TAG, "onAutopilotAbility->($isAutopilotAbility, $unableLaunchData, ${unableAutopilotReasons?.joinToString(",")}") + if (!isAutopilotAbility && unableAutopilotReasons != null && unableAutopilotReasons.find { it.unableType == CHASSIS_HAZARD_LIGHTS } != null) { + isError = true + send(DoubleFlashStatus(LIGHT_FLASH.number, true)) + } else { + isError = false + send(DoubleFlashStatus(LIGHT_FLASH.number, false)) + } + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/GearImpl.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/GearImpl.kt new file mode 100644 index 0000000000..75edfd15a1 --- /dev/null +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/GearImpl.kt @@ -0,0 +1,57 @@ +package com.zhjt.mogo_core_function_devatools.status.flow.autopilot + +import android.content.Context +import chassis.Chassis.GearPosition +import chassis.Chassis.GearPosition.GEAR_NONE +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGearStateListener +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerChassisGearStateListenerManager +import com.mogo.eagle.core.utilcode.mogo.logger.Logger +import com.zhjt.mogo.adas.data.bean.UnableLaunchData +import com.zhjt.mogo.adas.data.bean.UnableLaunchReason +import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_GEAR +import com.zhjt.mogo_core_function_devatools.status.entity.GearStatus +import com.zhjt.mogo_core_function_devatools.status.flow.IFlow + +internal class GearImpl(ctx: Context): IFlow(ctx), IMoGoChassisGearStateListener, IMoGoAutopilotActionsListener { + + companion object { + private const val TAG = "GeerImpl" + } + + @Volatile + private var last: GearPosition = GEAR_NONE + + @Volatile + private var isError: Boolean = false + + override fun onCreate() { + CallerChassisGearStateListenerManager.addListener(TAG, this) + CallerAutopilotActionsListenerManager.addListener(TAG, this) + } + + override fun onDestroy() { + super.onDestroy() + CallerChassisGearStateListenerManager.removeListener(TAG) + CallerAutopilotActionsListenerManager.removeListener(TAG) + } + + override fun onAutopilotGearData(gear: GearPosition) { + if (last != gear) { + send(GearStatus(gear.number, isError)) + last = gear + } + } + + override fun onAutopilotAbility(isAutopilotAbility: Boolean, unableLaunchData: UnableLaunchData?, unableAutopilotReasons: ArrayList?) { + Logger.d(TAG, "onAutopilotAbility->($isAutopilotAbility, $unableLaunchData, ${unableAutopilotReasons?.joinToString(",")}") + if (!isAutopilotAbility && unableAutopilotReasons != null && unableAutopilotReasons.find { it.unableType == CHASSIS_GEAR } != null) { + isError = true + send(GearStatus(last.number, true)) + } else { + isError = false + send(GearStatus(last.number, false)) + } + } +} diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/SpeedImpl.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/SpeedImpl.kt new file mode 100644 index 0000000000..9978b4ce60 --- /dev/null +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/SpeedImpl.kt @@ -0,0 +1,44 @@ +package com.zhjt.mogo_core_function_devatools.status.flow.autopilot + +import android.content.Context +import com.mogo.eagle.core.data.map.MogoLocation +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisThrottleStateListener +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerChassisThrottleStateListenerManager +import com.mogo.eagle.core.utilcode.mogo.logger.Logger +import com.zhjt.mogo.adas.data.bean.UnableLaunchData +import com.zhjt.mogo.adas.data.bean.UnableLaunchReason +import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_THROTTLE +import com.zhjt.mogo_core_function_devatools.status.entity.AcceleratorStatus +import com.zhjt.mogo_core_function_devatools.status.entity.SpeedStatus +import com.zhjt.mogo_core_function_devatools.status.flow.IFlow + +internal class SpeedImpl(ctx: Context): IFlow(ctx), IMoGoChassisLocationGCJ02Listener { + + + companion object { + private const val TAG = "SpeedImpl" + } + + @Volatile + private var last: Float? = null + + override fun onCreate() { + CallerChassisLocationGCJ02ListenerManager.addListener(TAG, this) + } + + override fun onDestroy() { + super.onDestroy() + CallerChassisLocationGCJ02ListenerManager.removeListener(TAG) + } + + override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) { + if (last != mogoLocation?.gnssSpeed) { + send(SpeedStatus(mogoLocation?.gnssSpeed ?: 0f)) + last = mogoLocation?.gnssSpeed + } + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/SteerImpl.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/SteerImpl.kt new file mode 100644 index 0000000000..d82f7d1e72 --- /dev/null +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/SteerImpl.kt @@ -0,0 +1,50 @@ +package com.zhjt.mogo_core_function_devatools.status.flow.autopilot + +import android.content.Context +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisSteeringStateListener +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerChassisSteeringStateListenerManager +import com.mogo.eagle.core.utilcode.mogo.logger.Logger +import com.zhjt.mogo.adas.data.bean.UnableLaunchData +import com.zhjt.mogo.adas.data.bean.UnableLaunchReason +import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_STEERING +import com.zhjt.mogo_core_function_devatools.status.entity.SteerStatus +import com.zhjt.mogo_core_function_devatools.status.flow.IFlow + +internal class SteerImpl(ctx: Context): IFlow(ctx), IMoGoChassisSteeringStateListener, IMoGoAutopilotActionsListener { + + companion object { + private const val TAG = "SteerImpl" + } + + @Volatile + private var last: Float = 0f + + override fun onCreate() { + CallerChassisSteeringStateListenerManager.addListener(TAG, this) + CallerAutopilotActionsListenerManager.addListener(TAG, this) + } + + override fun onDestroy() { + super.onDestroy() + CallerChassisSteeringStateListenerManager.removeListener(TAG) + CallerAutopilotActionsListenerManager.removeListener(TAG) + } + + override fun onAutopilotSteeringData(steering: Float) { + if (last != steering) { + send(SteerStatus(steering)) + last = steering + } + } + + override fun onAutopilotAbility(isAutopilotAbility: Boolean, unableLaunchData: UnableLaunchData?, unableAutopilotReasons: ArrayList?) { + Logger.d(TAG, "onAutopilotAbility->($isAutopilotAbility, $unableLaunchData, ${unableAutopilotReasons?.joinToString(",")}") + if (!isAutopilotAbility && unableAutopilotReasons != null && unableAutopilotReasons.find { it.unableType == CHASSIS_STEERING } != null) { + send(SteerStatus(last, true)) + } else { + send(SteerStatus(last, false)) + } + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/model/StatusModel.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/model/StatusModel.kt index b0376af234..5ff213e815 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/model/StatusModel.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/model/StatusModel.kt @@ -4,7 +4,6 @@ import androidx.lifecycle.* import com.mogo.eagle.core.function.call.autopilot.* import com.zhjt.mogo_core_function_devatools.status.entity.* //import com.zhjt.mogo_core_function_devatools.status.entity.NetStatus -import com.zhjt.mogo_core_function_devatools.status.entity.TracingStatus.Tracing.UNKNOWN import java.util.concurrent.atomic.* import kotlin.Pair @@ -21,6 +20,12 @@ internal class StatusModel : ViewModel() { it += RTKStatus("", -1) // it += NetStatus(false) // it += GpsStatus(enabled = false, isGranted = false) + it += SteerStatus(0.0f) + it += AcceleratorStatus(0.0f) + it += BrakeStatus(0.0f) + it += DoubleFlashStatus(0) + it += GearStatus(0) + it += SpeedStatus(0f) }) } diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/ui/AutoPilotLaunchBeforeView.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/ui/AutoPilotLaunchBeforeView.kt new file mode 100644 index 0000000000..9503b17c0f --- /dev/null +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/ui/AutoPilotLaunchBeforeView.kt @@ -0,0 +1,112 @@ +package com.zhjt.mogo_core_function_devatools.status.ui + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import android.widget.LinearLayout +import androidx.core.content.ContextCompat +import chassis.Chassis.GearPosition +import chassis.Chassis.GearPosition.GEAR_D +import chassis.Chassis.GearPosition.GEAR_N +import chassis.Chassis.GearPosition.GEAR_NONE +import chassis.Chassis.GearPosition.GEAR_P +import chassis.Chassis.GearPosition.GEAR_R +import com.zhjt.mogo_core_function_devatools.R +import com.zhjt.mogo_core_function_devatools.status.StatusManager +import com.zhjt.mogo_core_function_devatools.status.StatusManager.IStatusListener +import com.zhjt.mogo_core_function_devatools.status.entity.AcceleratorStatus +import com.zhjt.mogo_core_function_devatools.status.entity.BrakeStatus +import com.zhjt.mogo_core_function_devatools.status.entity.DoubleFlashStatus +import com.zhjt.mogo_core_function_devatools.status.entity.GearStatus +import com.zhjt.mogo_core_function_devatools.status.entity.IAutopilotPreLaunchStatus +import com.zhjt.mogo_core_function_devatools.status.entity.SpeedStatus +import com.zhjt.mogo_core_function_devatools.status.entity.Status +import com.zhjt.mogo_core_function_devatools.status.entity.SteerStatus +import kotlinx.android.synthetic.main.layout_autopilot_launch_before.view.gear_d +import kotlinx.android.synthetic.main.layout_autopilot_launch_before.view.gear_n +import kotlinx.android.synthetic.main.layout_autopilot_launch_before.view.gear_p +import kotlinx.android.synthetic.main.layout_autopilot_launch_before.view.gear_r +import kotlinx.android.synthetic.main.layout_autopilot_launch_before.view.iv_brake_or_accelerator +import kotlinx.android.synthetic.main.layout_autopilot_launch_before.view.iv_double_flash +import kotlinx.android.synthetic.main.layout_autopilot_launch_before.view.iv_steer +import kotlinx.android.synthetic.main.layout_autopilot_launch_before.view.speed +import kotlinx.android.synthetic.main.layout_autopilot_launch_before.view.tv_brake_or_accelerator + +class AutoPilotLaunchBeforeView: LinearLayout, IStatusListener { + + companion object { + private const val TAG = "AutoPilotLaunchBeforeView" + } + + constructor(context: Context?) : this(context, null) + constructor(context: Context?, attrs: AttributeSet?) : this(context, attrs, 0) + constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { + LayoutInflater.from(context).inflate(R.layout.layout_autopilot_launch_before, this, true) + background = ContextCompat.getDrawable(context!!, R.drawable.bg_autopilot_launch_before) + } + + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + StatusManager.addListener(TAG, this) + } + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + StatusManager.removeListener(TAG) + } + + override fun onStatusChanged(data: List, hasException: Boolean) { + data.filter { it is IAutopilotPreLaunchStatus }.forEach { status -> + when(status) { + is GearStatus -> { + val position = try { GearPosition.valueOf(status.value) } catch (ignore: Throwable) { GEAR_NONE } + gear_n?.isPressed = false + gear_n?.isSelected = false + gear_p?.isPressed = false + gear_p?.isSelected =false + gear_r?.isPressed = false + gear_r?.isSelected = false + gear_d?.isPressed = false + gear_d?.isSelected = false + if (position != GEAR_NONE) { + val isError = status.isError + when(position) { + GEAR_N -> if (isError) gear_n?.isPressed = true else gear_n?.isSelected = true + GEAR_R -> if (isError) gear_r?.isPressed = true else gear_r?.isSelected = true + GEAR_P -> if (isError) gear_p?.isPressed = true else gear_p?.isSelected = true + GEAR_D -> if (isError) gear_d?.isPressed = true else gear_d?.isSelected = true + else -> {} + } + } + } + is AcceleratorStatus -> { + val isError = status.isError + val angle = status.angle + iv_brake_or_accelerator?.isSelected = isError + tv_brake_or_accelerator?.text = "a: $angle" + } + is BrakeStatus -> { + val isError = status.isError + val angle = status.angle + iv_brake_or_accelerator?.isSelected = isError + tv_brake_or_accelerator?.text = "a: -$angle" + } + is DoubleFlashStatus -> { + val isError = status.isError + iv_double_flash?.isSelected = isError + } + is SteerStatus -> { + val isError = status.isError + iv_steer?.isSelected = isError + } + is SpeedStatus -> { + speed?.text = "${status.speed.toInt()}" + } + else -> { + throw IllegalStateException() + } + } + } + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/ui/StatusView.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/ui/StatusView.kt index b7c6924d50..235c2631e4 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/ui/StatusView.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/ui/StatusView.kt @@ -9,6 +9,7 @@ import androidx.recyclerview.widget.* import com.mogo.eagle.core.utilcode.kotlin.* import com.mogo.eagle.core.utilcode.rv.divider.* import com.zhjt.mogo_core_function_devatools.R +import com.zhjt.mogo_core_function_devatools.status.entity.IAutopilotPreLaunchStatus import com.zhjt.mogo_core_function_devatools.status.entity.Status import com.zhjt.mogo_core_function_devatools.status.model.StatusModel import com.zhjt.mogo_core_function_devatools.status.ui.adapter.StatusAdapter @@ -47,12 +48,13 @@ internal class StatusView(private val model: StatusModel, ctx: Context): Constra .horizontalInnerSpace(10.PX) .build() ) - val adapter = model.status.value?.let { data -> StatusAdapter(context, data.second) }?.also { adapter -> itx.adapter = adapter } + val adapter = model.status.value?.let { data -> StatusAdapter(context, data.second.filter { it !is IAutopilotPreLaunchStatus }) }?.also { adapter -> itx.adapter = adapter } adapter?.let { _ -> model.status.observeForever(Observer>> { data -> val old = adapter.data - val result = DiffUtil.calculateDiff(StatusDiffCallback(old, data.second)) - adapter.data = data.second + val update = data.second.filter { it !is IAutopilotPreLaunchStatus } + val result = DiffUtil.calculateDiff(StatusDiffCallback(old, update)) + adapter.data = update result.dispatchUpdatesTo(adapter) }.also { observer = it }) } diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/ui/adapter/StatusAdapter.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/ui/adapter/StatusAdapter.kt index acf16bed1f..a1c611de11 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/ui/adapter/StatusAdapter.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/ui/adapter/StatusAdapter.kt @@ -18,7 +18,7 @@ import com.zhjt.mogo_core_function_devatools.status.entity.TracingStatus.Tracing import com.zhjt.mogo_core_function_devatools.status.ui.adapter.StatusAdapter.StatusViewHolder import me.jessyan.autosize.AutoSizeCompat -internal class StatusAdapter(val ctx: Context, var data: ArrayList): RecyclerView.Adapter() { +internal class StatusAdapter(val ctx: Context, var data: List): RecyclerView.Adapter() { companion object { const val TAG = "StatusAdapter" @@ -169,6 +169,9 @@ internal class StatusAdapter(val ctx: Context, var data: ArrayList): Rec is OverViewStatus -> { "" } + else -> { + throw AssertionError() + } } } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/ui/diff/StatusDiffCallback.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/ui/diff/StatusDiffCallback.kt index 71d80bfa97..039f7a2731 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/ui/diff/StatusDiffCallback.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/ui/diff/StatusDiffCallback.kt @@ -3,7 +3,7 @@ package com.zhjt.mogo_core_function_devatools.status.ui.diff import androidx.recyclerview.widget.* import com.zhjt.mogo_core_function_devatools.status.entity.Status -internal class StatusDiffCallback(private val old: ArrayList, private val update: ArrayList): DiffUtil.Callback() { +internal class StatusDiffCallback(private val old: List, private val update: List): DiffUtil.Callback() { override fun getOldListSize(): Int = old.size diff --git a/core/function-impl/mogo-core-function-devatools/src/main/res/color/color_geer_position_selector.xml b/core/function-impl/mogo-core-function-devatools/src/main/res/color/color_geer_position_selector.xml new file mode 100644 index 0000000000..6809485824 --- /dev/null +++ b/core/function-impl/mogo-core-function-devatools/src/main/res/color/color_geer_position_selector.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/res/drawable-xhdpi/icon_brake_or_accelerator_blue.png b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable-xhdpi/icon_brake_or_accelerator_blue.png new file mode 100644 index 0000000000..ace5bc5a7e Binary files /dev/null and b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable-xhdpi/icon_brake_or_accelerator_blue.png differ diff --git a/core/function-impl/mogo-core-function-devatools/src/main/res/drawable-xhdpi/icon_brake_or_accelerator_red.png b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable-xhdpi/icon_brake_or_accelerator_red.png new file mode 100644 index 0000000000..c643c96d8c Binary files /dev/null and b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable-xhdpi/icon_brake_or_accelerator_red.png differ diff --git a/core/function-impl/mogo-core-function-devatools/src/main/res/drawable-xhdpi/icon_double_flash_blue.png b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable-xhdpi/icon_double_flash_blue.png new file mode 100644 index 0000000000..f86a5ef72c Binary files /dev/null and b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable-xhdpi/icon_double_flash_blue.png differ diff --git a/core/function-impl/mogo-core-function-devatools/src/main/res/drawable-xhdpi/icon_double_flash_red.png b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable-xhdpi/icon_double_flash_red.png new file mode 100644 index 0000000000..47940a6365 Binary files /dev/null and b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable-xhdpi/icon_double_flash_red.png differ diff --git a/core/function-impl/mogo-core-function-devatools/src/main/res/drawable-xhdpi/icon_steer_blue.png b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable-xhdpi/icon_steer_blue.png new file mode 100644 index 0000000000..8e897b5737 Binary files /dev/null and b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable-xhdpi/icon_steer_blue.png differ diff --git a/core/function-impl/mogo-core-function-devatools/src/main/res/drawable-xhdpi/icon_steer_red.png b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable-xhdpi/icon_steer_red.png new file mode 100644 index 0000000000..fec957cf3f Binary files /dev/null and b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable-xhdpi/icon_steer_red.png differ diff --git a/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/bg_autopilot_brake_or_accelerator.xml b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/bg_autopilot_brake_or_accelerator.xml new file mode 100644 index 0000000000..5c257bcbeb --- /dev/null +++ b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/bg_autopilot_brake_or_accelerator.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/bg_autopilot_double_flash.xml b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/bg_autopilot_double_flash.xml new file mode 100644 index 0000000000..ac3f9c4786 --- /dev/null +++ b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/bg_autopilot_double_flash.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/bg_autopilot_launch_before.xml b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/bg_autopilot_launch_before.xml new file mode 100644 index 0000000000..677145e413 --- /dev/null +++ b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/bg_autopilot_launch_before.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + diff --git a/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/bg_autopilot_steer.xml b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/bg_autopilot_steer.xml new file mode 100644 index 0000000000..7d4447bef5 --- /dev/null +++ b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/bg_autopilot_steer.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/bg_geer_position.xml b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/bg_geer_position.xml new file mode 100644 index 0000000000..57a7b0ed33 --- /dev/null +++ b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/bg_geer_position.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/bg_speed_chart.xml b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/bg_speed_chart.xml new file mode 100644 index 0000000000..ecd8466379 --- /dev/null +++ b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/bg_speed_chart.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + diff --git a/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/speed_chart_stroke.xml b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/speed_chart_stroke.xml new file mode 100644 index 0000000000..49b75e52c0 --- /dev/null +++ b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/speed_chart_stroke.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/res/layout/layout_autopilot_launch_before.xml b/core/function-impl/mogo-core-function-devatools/src/main/res/layout/layout_autopilot_launch_before.xml new file mode 100644 index 0000000000..6c2c8659bf --- /dev/null +++ b/core/function-impl/mogo-core-function-devatools/src/main/res/layout/layout_autopilot_launch_before.xml @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/devatools/IDevaToolsProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/devatools/IDevaToolsProvider.kt index d211d737bd..5e9371809a 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/devatools/IDevaToolsProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/devatools/IDevaToolsProvider.kt @@ -291,4 +291,8 @@ interface IDevaToolsProvider : IProvider { fun usage(): IMoGoCpuUsageProvider? fun setNetworkMode(isDebug: Boolean) + + fun attachAutopilotStatusView(ctx: Context, group: ViewGroup) + + fun getExceptionStatusBeforeLaunchAutopilot(): Int } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsManager.kt index b8d30fed0c..cc3f580781 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsManager.kt @@ -351,4 +351,8 @@ object CallerDevaToolsManager { fun setNetworkMode(isDebug: Boolean) { devaToolsProviderApi?.setNetworkMode(isDebug) } + + fun attachAutopilotBeforeLaunchView(ctx: Context, group: ViewGroup) { + devaToolsProviderApi?.attachAutopilotStatusView(ctx, group) + } } \ No newline at end of file