[状态栏]优化算路和循迹状态处理逻辑
[状态栏]修正wifi名称为unknowxx
This commit is contained in:
@@ -154,9 +154,15 @@ internal class TracingStatus(var state: Tracing = UNKNOWN): Status() {
|
||||
*/
|
||||
ROUTE_FAILED("EMAP_HADMAP_ENGINE_NO_ROUTING_INFO"),
|
||||
|
||||
/**
|
||||
* 未知状态
|
||||
*/
|
||||
UNKNOWN;
|
||||
|
||||
fun isException(): Boolean = this == TRACK_FINDED || this == TRACK_NOT_EXIST || this == TRACK_LOAD_FAIL || this == ROUTE_FAILED || this == UNKNOWN
|
||||
fun isException(): Boolean = when (this) {
|
||||
TRACK_FINDED, TRACK_NOT_EXIST, TRACK_LOAD_FAIL, ROUTE_FAILED, UNKNOWN -> true
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
@@ -178,7 +184,7 @@ internal class TracingStatus(var state: Tracing = UNKNOWN): Status() {
|
||||
}
|
||||
}
|
||||
|
||||
internal fun String.toState(): Tracing {
|
||||
internal fun String.toState(): Tracing? {
|
||||
return when(this) {
|
||||
"IMAP_TRA_EXIST" -> TRACK_FINDED
|
||||
"IMAP_TRA_LOADED" -> TRACK_LOADED
|
||||
@@ -186,6 +192,6 @@ internal fun String.toState(): Tracing {
|
||||
"EMAP_TRA_LOAD_FAILED" -> TRACK_LOAD_FAIL
|
||||
"IMAP_TRA_ROUTING" -> ROUTE_LOADED
|
||||
"EMAP_HADMAP_ENGINE_NO_ROUTING_INFO" -> ROUTE_FAILED
|
||||
else -> UNKNOWN
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,11 @@ package com.zhjt.mogo_core_function_devatools.status.flow.trace
|
||||
|
||||
import android.content.*
|
||||
import android.util.*
|
||||
import com.mogo.eagle.core.data.autopilot.*
|
||||
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.*
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.TracingStatus.Tracing.UNKNOWN
|
||||
import com.zhjt.mogo_core_function_devatools.status.flow.*
|
||||
import mogo_msg.MogoReportMsg.MogoReportMessage
|
||||
|
||||
@@ -14,13 +16,14 @@ internal class TracingImpl(ctx: Context): IFlow<TracingStatus>(ctx), IMoGoAutopi
|
||||
const val TAG = "TracingImpl"
|
||||
}
|
||||
|
||||
private var old: String = ""
|
||||
private var old: TracingStatus.Tracing = UNKNOWN
|
||||
|
||||
override fun onCreate() {
|
||||
Log.d(TAG, "-- onCreate --")
|
||||
val code = CallerAutoPilotStatusListenerManager.getAutoPilotReportMessageCode()
|
||||
old = code
|
||||
send(TracingStatus(code.toState()))
|
||||
val state = code.toState() ?: UNKNOWN
|
||||
old = state
|
||||
send(TracingStatus(state))
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
@@ -29,9 +32,18 @@ internal class TracingImpl(ctx: Context): IFlow<TracingStatus>(ctx), IMoGoAutopi
|
||||
super.onAutopilotGuardian(guardianInfo)
|
||||
val current = guardianInfo?.code
|
||||
Log.d(TAG, "-- onAutopilotGuardian --: $current")
|
||||
if (current != null && current != old) {
|
||||
send(TracingStatus(current.toState()))
|
||||
old = current
|
||||
val newState = current?.toState()
|
||||
if (newState != null && newState != old) {
|
||||
send(TracingStatus(newState))
|
||||
old = newState
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
super.onAutopilotStatusResponse(autoPilotStatusInfo)
|
||||
if (autoPilotStatusInfo.pilotmode != 1) {
|
||||
send(TracingStatus(UNKNOWN))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,10 @@ internal class StatusModel : ViewModel() {
|
||||
}
|
||||
}
|
||||
is TracingStatus -> {
|
||||
if (CallerAutoPilotManager.isConnected() && (CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().pilotmode == 1) && s.state.isException()) {
|
||||
val c1 = CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().pilotmode == 1
|
||||
val c2 = s.state.isException()
|
||||
Log.d(TAG, "getExceptionStatus-::c1: $c1 -> c2: $c2")
|
||||
if (c1 && c2) {
|
||||
s
|
||||
} else {
|
||||
null
|
||||
|
||||
Reference in New Issue
Block a user