add func
This commit is contained in:
@@ -23,7 +23,6 @@ internal class CanImpl(ctx: Context) : IFlow<CanStatus>(ctx), IMoGoAutopilotVehi
|
||||
private var job: Job? = null
|
||||
|
||||
override fun onCreate() {
|
||||
Log.d(TAG, "-- onCreate --")
|
||||
send(CanStatus(CallerAutoPilotManager.isConnected()))
|
||||
CallerAutopilotVehicleStateListenerManager.addListener(TAG, this)
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
@@ -86,7 +85,6 @@ internal class CanImpl(ctx: Context) : IFlow<CanStatus>(ctx), IMoGoAutopilotVehi
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
job?.safeCancel()
|
||||
Log.d(TAG, "-- onDestroy --")
|
||||
CallerAutopilotVehicleStateListenerManager.removeListener(TAG)
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.zhjt.mogo_core_function_devatools.status.flow.ipc
|
||||
|
||||
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.flow.IFlow
|
||||
@@ -17,7 +15,6 @@ internal class IpcImpl(ctx: Context): IFlow<IpcStatus>(ctx), IMoGoAutopilotStatu
|
||||
private var state: Int = -1
|
||||
|
||||
override fun onCreate() {
|
||||
Log.d(TAG, "-- onCreate --")
|
||||
checkAndSend()
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
}
|
||||
@@ -36,7 +33,6 @@ internal class IpcImpl(ctx: Context): IFlow<IpcStatus>(ctx), IMoGoAutopilotStatu
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
Log.d(TAG, "-- onDestroy --")
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
}
|
||||
}
|
||||
@@ -37,47 +37,39 @@ internal class NetsImpl(ctx: Context): IFlow<NetStatus>(ctx) {
|
||||
|
||||
override fun onAvailable(network: Network) {
|
||||
super.onAvailable(network)
|
||||
Log.d(TAG, "-- onAvailable --:: $network")
|
||||
checkAndSend()
|
||||
}
|
||||
|
||||
override fun onLosing(network: Network, maxMsToLive: Int) {
|
||||
super.onLosing(network, maxMsToLive)
|
||||
Log.d(TAG, "-- onLosing --:: $network::$maxMsToLive")
|
||||
}
|
||||
|
||||
override fun onLost(network: Network) {
|
||||
super.onLost(network)
|
||||
Log.d(TAG, "-- onLost --:: $network")
|
||||
checkAndSend()
|
||||
}
|
||||
|
||||
override fun onUnavailable() {
|
||||
super.onUnavailable()
|
||||
Log.d(TAG, "-- onUnavailable --")
|
||||
checkAndSend()
|
||||
}
|
||||
|
||||
override fun onCapabilitiesChanged(network: Network, networkCapabilities: NetworkCapabilities) {
|
||||
super.onCapabilitiesChanged(network, networkCapabilities)
|
||||
Log.d(TAG, "-- onCapabilitiesChanged --:$network::$networkCapabilities")
|
||||
checkAndSend()
|
||||
}
|
||||
|
||||
override fun onLinkPropertiesChanged(network: Network, linkProperties: LinkProperties) {
|
||||
super.onLinkPropertiesChanged(network, linkProperties)
|
||||
Log.d(TAG, "-- onLinkPropertiesChanged --:$network::$linkProperties")
|
||||
}
|
||||
|
||||
override fun onBlockedStatusChanged(network: Network, blocked: Boolean) {
|
||||
super.onBlockedStatusChanged(network, blocked)
|
||||
Log.d(TAG, "-- onBlockedStatusChanged --:$network::$blocked")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun onCreate() {
|
||||
Log.d(TAG, "-- onCreate --")
|
||||
checkAndSend()
|
||||
val builder = NetworkRequest.Builder()
|
||||
.addTransportType(NetworkCapabilities.TRANSPORT_WIFI)
|
||||
@@ -106,7 +98,6 @@ internal class NetsImpl(ctx: Context): IFlow<NetStatus>(ctx) {
|
||||
sr = connectionInfo.rxLinkSpeedMbps
|
||||
}
|
||||
val speed = Speed(tr, sr)
|
||||
Log.d(TAG, "checkAndSend----:enable: $enabled :: name: $name")
|
||||
send(enabled, name, speed)
|
||||
}
|
||||
|
||||
@@ -129,7 +120,6 @@ internal class NetsImpl(ctx: Context): IFlow<NetStatus>(ctx) {
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
Log.d(TAG, "-- onDestroy --")
|
||||
if (registered.compareAndSet(true, false)) {
|
||||
connectMgr.unregisterNetworkCallback(cb)
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ internal class TracingImpl(ctx: Context): IFlow<TracingStatus>(ctx), IMoGoAutopi
|
||||
private var old: TracingStatus.Tracing = UNKNOWN
|
||||
|
||||
override fun onCreate() {
|
||||
Log.d(TAG, "-- onCreate --")
|
||||
val code = CallerAutoPilotStatusListenerManager.getAutoPilotReportMessageCode()
|
||||
val state = code.toState() ?: UNKNOWN
|
||||
old = state
|
||||
@@ -31,7 +30,6 @@ internal class TracingImpl(ctx: Context): IFlow<TracingStatus>(ctx), IMoGoAutopi
|
||||
override fun onAutopilotGuardian(guardianInfo: MogoReportMessage?) {
|
||||
super.onAutopilotGuardian(guardianInfo)
|
||||
val current = guardianInfo?.code
|
||||
Log.d(TAG, "-- onAutopilotGuardian --: $current")
|
||||
val newState = current?.toState()
|
||||
if (newState != null && newState != old) {
|
||||
send(TracingStatus(newState))
|
||||
@@ -42,7 +40,6 @@ internal class TracingImpl(ctx: Context): IFlow<TracingStatus>(ctx), IMoGoAutopi
|
||||
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
super.onAutopilotStatusResponse(autoPilotStatusInfo)
|
||||
//Log.d(TAG, "-- onAutopilotStatusResponse -- autopilotMode: ${autoPilotStatusInfo.pilotmode} :: state: ${autoPilotStatusInfo.state}")
|
||||
if (autoPilotStatusInfo.state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
|
||||
send(TracingStatus(UNKNOWN))
|
||||
}
|
||||
@@ -53,7 +50,6 @@ internal class TracingImpl(ctx: Context): IFlow<TracingStatus>(ctx), IMoGoAutopi
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
Log.d(TAG, "-- onDestroy --")
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
}
|
||||
}
|
||||
@@ -45,8 +45,6 @@ internal class StatusModel : ViewModel() {
|
||||
val nv = ArrayList(v).also { it.updateOrInsert(s) }
|
||||
val data = Pair(getExceptionStatus(nv), nv)
|
||||
old.set(data)
|
||||
Log.d(TAG, "status: $s")
|
||||
Log.d(TAG, "data: ${data.second}")
|
||||
status.postValue(data)
|
||||
}
|
||||
}
|
||||
@@ -86,7 +84,6 @@ internal class StatusModel : ViewModel() {
|
||||
is TracingStatus -> {
|
||||
val c1 = CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE
|
||||
val c2 = s.state.isException()
|
||||
Log.d(TAG, "getExceptionStatus-::c1: $c1 -> c2: $c2")
|
||||
if (c1 && c2) {
|
||||
s
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user