Merge branch 'dev_robotaxi-d_240401_6.4.0' into dev_robotaxi-d_240401_6.4.0_work_order
@@ -40,6 +40,7 @@ import com.tencent.matrix.trace.config.TraceConfig
|
||||
import com.zhjt.mogo_core_function_devatools.apm.*
|
||||
import com.mogo.eagle.core.function.api.upgrade.*
|
||||
import com.mogo.weak.network.SdtManager
|
||||
import com.zhjt.mogo.adas.data.bean.ReceivedAck.Status
|
||||
import com.zhjt.mogo_core_function_devatools.adas.PowerOffManager
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.BadCaseManager
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig
|
||||
@@ -60,6 +61,8 @@ import com.zhjt.mogo_core_function_devatools.perf.MoGoCpuUsageProviderImpl
|
||||
import com.zhjt.mogo_core_function_devatools.report.IPCReportManager.Companion.iPCReportManager
|
||||
import com.zhjt.mogo_core_function_devatools.scene.SceneManager.Companion.sceneManager
|
||||
import com.zhjt.mogo_core_function_devatools.status.StatusManager
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.RouteDownloadStatus
|
||||
import com.zhjt.mogo_core_function_devatools.status.ui.AutoPilotLaunchBeforeView
|
||||
import com.zhjt.mogo_core_function_devatools.strict.*
|
||||
import com.zhjt.mogo_core_function_devatools.trace.TraceManager.Companion.traceManager
|
||||
import com.zhjt.mogo_core_function_devatools.tts.TtsManager.Companion.ttsManager
|
||||
@@ -67,6 +70,9 @@ import com.zhjt.mogo_core_function_devatools.upgrade.UpgradeManager.Companion.up
|
||||
import com.zhjt.mogo_core_function_devatools.weaknetwork.DetectResultImpl
|
||||
import com.zhjt.mogo_core_function_devatools.weaknetwork.WeakNetworkStrategy
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
import java.lang.ref.WeakReference
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
|
||||
@Route(path = MogoServicePaths.PATH_DEVA_TOOLS)
|
||||
class DevaToolsProvider : IDevaToolsProvider {
|
||||
@@ -81,7 +87,6 @@ class DevaToolsProvider : IDevaToolsProvider {
|
||||
|
||||
private val strictModeProvider by lazy { StrictModeProviderImpl() }
|
||||
|
||||
|
||||
private val lookAroundDataProvider by lazy { MoGoLookAroundProviderImpl() }
|
||||
|
||||
private val mofangProvider by lazy { MoGoMoFangProviderImpl() }
|
||||
@@ -95,6 +100,22 @@ class DevaToolsProvider : IDevaToolsProvider {
|
||||
@Volatile
|
||||
private var mDockerVersion: String? = null
|
||||
|
||||
private var container: WeakReference<ViewGroup>? = null
|
||||
|
||||
private val downloadCallbacks by lazy { ConcurrentHashMap<String, ArrayList<(Int) -> Unit>>() }
|
||||
|
||||
private val statusListener by lazy {
|
||||
object : StatusManager.IStatusListener {
|
||||
override fun onStatusChanged(data: List<com.zhjt.mogo_core_function_devatools.status.entity.Status>, hasException: Boolean) {
|
||||
data.filterIsInstance(RouteDownloadStatus::class.java).forEach { s ->
|
||||
downloadCallbacks.values.flatten().forEach { listener ->
|
||||
listener.invoke(s.state.ordinal)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun init(context: Context) {
|
||||
mContext = context
|
||||
}
|
||||
@@ -135,6 +156,7 @@ class DevaToolsProvider : IDevaToolsProvider {
|
||||
block.init(it)
|
||||
block.start()
|
||||
}
|
||||
StatusManager.addListener(TAG, statusListener)
|
||||
}
|
||||
|
||||
override fun checkMonitorDb() {
|
||||
@@ -483,4 +505,29 @@ class DevaToolsProvider : IDevaToolsProvider {
|
||||
override fun setNetworkMode(isDebug: Boolean) {
|
||||
WeakNetworkStrategy.setDebug(isDebug)
|
||||
}
|
||||
|
||||
override fun attachAutopilotStatusView(ctx: Context, group: ViewGroup) {
|
||||
StatusManager.init(ctx)
|
||||
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()
|
||||
}
|
||||
|
||||
override fun registerRouteDownloadListener(tag: String, block: (state: Int) -> Unit) {
|
||||
downloadCallbacks.getOrPut(tag) { ArrayList() }.add(block)
|
||||
}
|
||||
|
||||
override fun unRegisterRouteDownloadListener(tag: String) {
|
||||
downloadCallbacks.remove(tag)
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import android.Manifest
|
||||
import android.content.*
|
||||
import android.content.pm.PackageManager.PERMISSION_GRANTED
|
||||
import android.os.Build
|
||||
import android.os.Environment
|
||||
import android.os.Process
|
||||
import android.os.SystemClock
|
||||
import android.util.Log
|
||||
@@ -14,10 +15,13 @@ import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.core.log.record.*
|
||||
import com.mogo.core.log.record.config.*
|
||||
import com.mogo.core.log.record.config.crash.CrashConfig
|
||||
import com.mogo.core.log.record.config.extra.IExtraFileToUpload
|
||||
import com.mogo.core.log.record.config.extra.ToUploadFile
|
||||
import com.mogo.core.log.record.config.state.IStateProvider
|
||||
import com.mogo.core.log.record.model.UploadError
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.function.api.devatools.logcat.*
|
||||
import com.mogo.eagle.core.utilcode.download.DownloadUtils
|
||||
import com.zhidao.loglib.bean.RemoteLogPushContent
|
||||
import com.zhjt.mogo_core_function_devatools.BuildConfig
|
||||
import com.zhjt.mogo_core_function_devatools.logcat.checker.AnrLogChecker
|
||||
@@ -25,6 +29,7 @@ import com.zhjt.mogo_core_function_devatools.logcat.config.LogRecordConfig
|
||||
import com.zhjt.mogo_core_function_devatools.logcat.uploader.*
|
||||
import kotlinx.coroutines.*
|
||||
import java.io.*
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.concurrent.TimeUnit.MINUTES
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
@@ -45,13 +50,12 @@ internal class MoGoLogRecordProviderImpl: IMoGoLogRecordProvider,
|
||||
private val lastUploadTime by lazy { AtomicLong(0) }
|
||||
|
||||
override fun init(context: Context) {
|
||||
val zip = File(context.getExternalFilesDir(null), "logcat/zip")
|
||||
val builder = LogcatConfig.Builder().context(context)
|
||||
.recordPeriod(MINUTES.toMillis(5)) // 5分钟一个文件
|
||||
.maxSizeInLogDir((512 * 1024 * 1024).toLong()) // 512M最大容量
|
||||
.recordDir(File(context.getExternalFilesDir(null), "logcat"))
|
||||
.pid(Process.myPid())
|
||||
.generateZipDir(zip.absolutePath)
|
||||
.generateZipDir(File(context.getExternalFilesDir(null), "logcat/zip").absolutePath)
|
||||
.stateProvider(object : IStateProvider {
|
||||
override fun provide(divider: String?): Map<String, Any?> {
|
||||
return mutableMapOf<String, Any?>().also { itx ->
|
||||
@@ -104,6 +108,18 @@ internal class MoGoLogRecordProviderImpl: IMoGoLogRecordProvider,
|
||||
itx["协议版本号"] = AppConfigInfo.protocolVersionNumber
|
||||
itx["${divider}-7"] = divider
|
||||
itx["角色"] = AppConfigInfo.role
|
||||
val downloads = try {
|
||||
DownloadUtils.getAllDownloadRecords()
|
||||
} catch (t: Throwable) {
|
||||
emptyList()
|
||||
}
|
||||
if (downloads.isNotEmpty()) {
|
||||
itx["${divider}-8"] = divider
|
||||
itx["下载汇总"] = "(${downloads.size})"
|
||||
downloads.forEach {
|
||||
itx[it.first] = "\n\r----------------------------------------------------------${it.second}\n\r"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -114,26 +130,26 @@ internal class MoGoLogRecordProviderImpl: IMoGoLogRecordProvider,
|
||||
.systemTags("ActivityManager")
|
||||
.checker(AnrLogChecker())
|
||||
}
|
||||
|
||||
// if (BuildConfig.DEBUG) {
|
||||
// builder.crashConfig(
|
||||
// CrashConfig.Builder()
|
||||
// .enabled(true)
|
||||
// .crashDir(File(context.getExternalFilesDir(null), "logcat/crash"))
|
||||
// .nativeCrash(true)
|
||||
// .anr(true)
|
||||
// .javaCrash(true)
|
||||
// .build()
|
||||
// )
|
||||
// }
|
||||
LogcatManager.init(builder)
|
||||
scope.launch {
|
||||
try {
|
||||
zip.takeIf { it.exists() }?.deleteRecursively()
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
if (BuildConfig.DEBUG) {
|
||||
builder.crashConfig(
|
||||
CrashConfig.Builder()
|
||||
.enabled(true)
|
||||
.crashDir(File(context.getExternalFilesDir(null), "crash"))
|
||||
.expireDuration(TimeUnit.DAYS.toMillis(3))
|
||||
.javaCrash(true)
|
||||
.nativeCrash(true)
|
||||
.anr(true)
|
||||
.build()
|
||||
)
|
||||
}
|
||||
builder.extraFilesToUpload(object : IExtraFileToUpload {
|
||||
override fun filesToUpload(): List<ToUploadFile> {
|
||||
return ArrayList<ToUploadFile>().also {
|
||||
it.add(ToUploadFile(File(Environment.getExternalStorageDirectory(), "MLog")))
|
||||
}
|
||||
}
|
||||
})
|
||||
LogcatManager.init(builder)
|
||||
}
|
||||
|
||||
override fun target(): Class<RemoteLogPushContent> {
|
||||
@@ -195,8 +211,8 @@ internal class MoGoLogRecordProviderImpl: IMoGoLogRecordProvider,
|
||||
return LogcatManager.export()
|
||||
}
|
||||
|
||||
override fun upload(): Unit = runBlocking {
|
||||
val state = LogcatManager.upload(0, System.currentTimeMillis())
|
||||
override fun upload(startTime: Long, endTime: Long): Unit = runBlocking {
|
||||
val state = LogcatManager.upload(startTime, endTime)
|
||||
if (state is UploadError) {
|
||||
throw AssertionError(state.toString())
|
||||
}
|
||||
|
||||
@@ -19,10 +19,17 @@ import com.zhjt.mogo_core_function_devatools.status.entity.RTKStatus
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.Status
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.TracingStatus
|
||||
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.RouteState.RouteStart //import com.zhjt.mogo_core_function_devatools.status.entity.NetStatus
|
||||
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.RouteDownloadImpl
|
||||
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 +40,24 @@ import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.flow.*
|
||||
import java.lang.ref.*
|
||||
import java.util.concurrent.*
|
||||
import java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
|
||||
|
||||
object StatusManager {
|
||||
|
||||
private const val TAG = "StatusManager"
|
||||
|
||||
private lateinit var model: StatusModel
|
||||
private var hasInit = false
|
||||
private val listeners by lazy { CopyOnWriteArrayList<IStatusListener>() }
|
||||
private val listeners by lazy { ConcurrentHashMap<String, IStatusListener>() }
|
||||
private var container: WeakReference<ViewGroup>? = null
|
||||
|
||||
private val last by lazy { AtomicReference<List<Status>>() }
|
||||
|
||||
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<IFlow<out Status>> by lazy {
|
||||
ArrayList()
|
||||
}
|
||||
@@ -77,20 +91,54 @@ 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)
|
||||
is RouteDownloadStatus -> RouteDownloadImpl(ctx)
|
||||
}
|
||||
}.also { flows += it }
|
||||
for (f in flows) {
|
||||
ctx.lifeCycleScope.launch(Dispatchers.Default) {
|
||||
ctx.lifeCycleScope.launch(dispatcher) {
|
||||
f.asFlow().collect {
|
||||
model.update(it)
|
||||
}
|
||||
}
|
||||
f.onCreate()
|
||||
}
|
||||
|
||||
model.status.observe(ctx.lifeCycleOwner) {
|
||||
listeners.forEach { itx ->
|
||||
itx.onStatusChanged(it.second, it.first != null)
|
||||
ctx.lifeCycleScope.launch(dispatcher) {
|
||||
model.status.asFlow().collect {
|
||||
listeners.values.forEach { itx ->
|
||||
val current = it.second
|
||||
val previous = last.get()
|
||||
val changed = ArrayList<Status>()
|
||||
if (previous == null) {
|
||||
changed.addAll(current)
|
||||
} else {
|
||||
val l1 = current.size
|
||||
val l2 = previous.size
|
||||
var index = 0
|
||||
while (index < l1 && index < l2) {
|
||||
val d1 = current[index]
|
||||
val d2 = previous[index]
|
||||
if (d1 != d2) {
|
||||
changed += d1
|
||||
}
|
||||
index++
|
||||
}
|
||||
while (index < l1) {
|
||||
changed += current[index++]
|
||||
}
|
||||
}
|
||||
if (changed.isNotEmpty()) {
|
||||
withContext(Dispatchers.Main) {
|
||||
itx.onStatusChanged(changed, it.first != null)
|
||||
}
|
||||
}
|
||||
last.set(current)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -120,6 +168,39 @@ 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 = if (status is RouteDownloadStatus) {
|
||||
if (status.state == RouteStart) {
|
||||
ret or shl
|
||||
} else {
|
||||
ret or (shl shl 1)
|
||||
}
|
||||
} else {
|
||||
ret or shl
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
interface IStatusListener {
|
||||
fun onStatusChanged(data: List<Status>, hasException: Boolean)
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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.RouteState.RouteFailed
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.RouteState.RouteNone
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.RouteState.RouteStart
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.TracingStatus.Tracing
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.TracingStatus.Tracing.*
|
||||
|
||||
@@ -250,7 +250,7 @@ class OverViewStatus(var hasException: Boolean = false): Status() {
|
||||
fun String.toState(msg: String?): Tracing? {
|
||||
val ss = msg?.split("|")
|
||||
var extra: Map<String, String>? = null
|
||||
if (ss != null && ss.isNotEmpty()) {
|
||||
if (!ss.isNullOrEmpty()) {
|
||||
val sb = StringBuilder()
|
||||
for (element in ss) {
|
||||
sb.append(element)
|
||||
@@ -290,3 +290,199 @@ 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
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as SteerStatus
|
||||
|
||||
if (angle != other.angle) return false
|
||||
if (isError != other.isError) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = angle.hashCode()
|
||||
result = 31 * result + isError.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 油门
|
||||
*/
|
||||
data class AcceleratorStatus(val angle: Float, var isError: Boolean = false): Status(), IAutopilotPreLaunchStatus {
|
||||
|
||||
override fun isException(): Boolean {
|
||||
return isError
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as AcceleratorStatus
|
||||
|
||||
if (angle != other.angle) return false
|
||||
if (isError != other.isError) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = angle.hashCode()
|
||||
result = 31 * result + isError.hashCode()
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 刹车
|
||||
*/
|
||||
data class BrakeStatus(val angle: Float, var isError: Boolean = false): Status(), IAutopilotPreLaunchStatus {
|
||||
|
||||
override fun isException(): Boolean {
|
||||
return isError
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as BrakeStatus
|
||||
|
||||
if (angle != other.angle) return false
|
||||
if (isError != other.isError) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = angle.hashCode()
|
||||
result = 31 * result + isError.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 双闪
|
||||
*/
|
||||
data class DoubleFlashStatus(val type: Int, var isError: Boolean = false): Status(), IAutopilotPreLaunchStatus {
|
||||
|
||||
override fun isException(): Boolean {
|
||||
return isError
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as DoubleFlashStatus
|
||||
|
||||
if (type != other.type) return false
|
||||
if (isError != other.isError) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = type
|
||||
result = 31 * result + isError.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 挡位
|
||||
*/
|
||||
data class GearStatus(val value: Int, var isError: Boolean = false): Status(), IAutopilotPreLaunchStatus {
|
||||
|
||||
override fun isException(): Boolean {
|
||||
return isError
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as GearStatus
|
||||
|
||||
if (value != other.value) return false
|
||||
if (isError != other.isError) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = value
|
||||
result = 31 * result + isError.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
enum class RouteState {
|
||||
RouteNone,
|
||||
RouteStart,
|
||||
RouteComplete,
|
||||
RouteFailed
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 轨迹下载状态
|
||||
*/
|
||||
data class RouteDownloadStatus(val lineId: Long = -1, val state: RouteState = RouteNone): Status(), IAutopilotPreLaunchStatus {
|
||||
|
||||
override fun isException(): Boolean {
|
||||
return state == RouteStart || state == RouteFailed
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as RouteDownloadStatus
|
||||
|
||||
if (lineId != other.lineId) return false
|
||||
if (state != other.state) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = lineId.hashCode()
|
||||
result = 31 * result + state.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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<AcceleratorStatus>(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<UnableLaunchReason>?) {
|
||||
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))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<BrakeStatus>(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<UnableLaunchReason>?) {
|
||||
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))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<DoubleFlashStatus>(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<UnableLaunchReason>?) {
|
||||
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))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<GearStatus>(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<UnableLaunchReason>?) {
|
||||
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))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.zhjt.mogo_core_function_devatools.status.flow.autopilot
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters.AutoPilotLine
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.zhjt.mogo.adas.data.bean.MogoReport
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.RouteDownloadStatus
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.RouteState.RouteComplete
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.RouteState.RouteFailed
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.RouteState.RouteStart
|
||||
import com.zhjt.mogo_core_function_devatools.status.flow.IFlow
|
||||
import mogo_msg.MogoReportMsg.MogoReportMessage
|
||||
import java.lang.Exception
|
||||
|
||||
|
||||
internal class RouteDownloadImpl(ctx: Context): IFlow<RouteDownloadStatus>(ctx), IMoGoAutopilotStatusListener {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "RouteDownloadImpl"
|
||||
}
|
||||
|
||||
@Volatile
|
||||
private var toDownloadLineId: Long = Long.MIN_VALUE
|
||||
|
||||
override fun onCreate() {
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
override fun onAutopilotTrajectoryDownloadReq(autoPilotLine: AutoPilotLine, downloadType: Int) {
|
||||
super.onAutopilotTrajectoryDownloadReq(autoPilotLine, downloadType)
|
||||
if (downloadType == 0) {
|
||||
toDownloadLineId = autoPilotLine.lineId
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAutopilotGuardian(guardianInfo: MogoReportMessage?) {
|
||||
super.onAutopilotGuardian(guardianInfo)
|
||||
var lineId = -1L
|
||||
if (MogoReport.Code.Info.ISYS.INIT_TRAJECTORY_START == guardianInfo?.code ||
|
||||
MogoReport.Code.Info.ISYS.INIT_TRAJECTORY_SUCCESS == guardianInfo?.code ||
|
||||
MogoReport.Code.Info.ISYS.INIT_TRAJECTORY_FAILURE == guardianInfo?.code ||
|
||||
MogoReport.Code.Info.ISYS.INIT_TRAJECTORY_WARNING == guardianInfo?.code ||
|
||||
MogoReport.Code.Info.ISYS.INIT_TRAJECTORY_TIMEOUT == guardianInfo?.code
|
||||
) {
|
||||
val msg = guardianInfo.msg
|
||||
try {
|
||||
val regex = Regex("lineid:(\\d+)")
|
||||
val matchResult = regex.find(msg)
|
||||
if (matchResult != null) {
|
||||
lineId = matchResult.groupValues[1].toLong()
|
||||
}
|
||||
} catch (ignore: Exception) { }
|
||||
if (lineId == -1L) {
|
||||
try {
|
||||
val regex = Regex("lineID=(\\d+)")
|
||||
val matchResult = regex.find(msg)
|
||||
if (matchResult != null) {
|
||||
lineId = matchResult.groupValues[1].toLong()
|
||||
}
|
||||
} catch (ignore: Exception) { }
|
||||
}
|
||||
}
|
||||
|
||||
if (toDownloadLineId != lineId) {
|
||||
return
|
||||
}
|
||||
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters()
|
||||
if (guardianInfo == null || !guardianInfo.hasCode())
|
||||
return
|
||||
when (guardianInfo.code) {
|
||||
"ISYS_INIT_TRAJECTORY_START" -> { // 1. 轨迹管理_轨迹开始下载(本地已有对应轨迹也触发)
|
||||
send(RouteDownloadStatus(lineId, RouteStart))
|
||||
}
|
||||
"ISYS_INIT_TRAJECTORY_SUCCESS" -> { // 2. 轨迹管理_轨迹下载成功(本地已有对应轨迹也触发)
|
||||
send(RouteDownloadStatus(lineId, RouteComplete))
|
||||
toDownloadLineId = Long.MIN_VALUE
|
||||
}
|
||||
"ISYS_INIT_TRAJECTORY_FAILURE" -> { // 3. 轨迹管理_轨迹下载失败,本地无对应轨迹
|
||||
send(RouteDownloadStatus(lineId, RouteFailed))
|
||||
toDownloadLineId = Long.MIN_VALUE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
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<SpeedStatus>(ctx), IMoGoChassisLocationGCJ02Listener {
|
||||
|
||||
|
||||
companion object {
|
||||
private const val TAG = "SpeedImpl"
|
||||
}
|
||||
|
||||
@Volatile
|
||||
private var last: Float? = null
|
||||
|
||||
override fun onCreate() {
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, 5, 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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<SteerStatus>(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<UnableLaunchReason>?) {
|
||||
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))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,13 @@ 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 += RouteDownloadStatus()
|
||||
it += SpeedStatus(0f)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
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.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
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
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
import kotlin.math.abs
|
||||
|
||||
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.icon_bg_autopilot_status)
|
||||
setPadding(AutoSizeUtils.dp2px(context, 27f), AutoSizeUtils.dp2px(context, 33f), AutoSizeUtils.dp2px(context, 30f), AutoSizeUtils.dp2px(context, 30f))
|
||||
}
|
||||
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
StatusManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
StatusManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
override fun onStatusChanged(data: List<Status>, hasException: Boolean) {
|
||||
data.filter { it is IAutopilotPreLaunchStatus }.forEach { status ->
|
||||
val isError = status.isException() && CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
when(status) {
|
||||
is GearStatus -> {
|
||||
val position = try { GearPosition.valueOf(status.value) } catch (ignore: Throwable) { GEAR_NONE }
|
||||
gear_n?.isEnabled = false
|
||||
gear_n?.isSelected = false
|
||||
gear_p?.isEnabled = false
|
||||
gear_p?.isSelected =false
|
||||
gear_r?.isEnabled = false
|
||||
gear_r?.isSelected = false
|
||||
gear_d?.isEnabled = false
|
||||
gear_d?.isSelected = false
|
||||
if (position != GEAR_NONE) {
|
||||
when(position) {
|
||||
GEAR_N -> if (isError) gear_n?.isEnabled = true else gear_n?.isSelected = true
|
||||
GEAR_R -> if (isError) gear_r?.isEnabled = true else gear_r?.isSelected = true
|
||||
GEAR_P -> if (isError) gear_p?.isEnabled = true else gear_p?.isSelected = true
|
||||
GEAR_D -> if (isError) gear_d?.isEnabled = true else gear_d?.isSelected = true
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
is AcceleratorStatus -> {
|
||||
val angle = status.angle
|
||||
iv_brake_or_accelerator?.isSelected = isError
|
||||
tv_brake_or_accelerator?.text = "a:${angle.toInt()}"
|
||||
}
|
||||
is BrakeStatus -> {
|
||||
val angle = status.angle
|
||||
iv_brake_or_accelerator?.isSelected = isError
|
||||
tv_brake_or_accelerator?.text = "a:-${angle.toInt()}"
|
||||
}
|
||||
is DoubleFlashStatus -> {
|
||||
iv_double_flash?.isSelected = isError
|
||||
}
|
||||
is SteerStatus -> {
|
||||
iv_steer?.isSelected = isError
|
||||
}
|
||||
is SpeedStatus -> {
|
||||
speed?.text = "${(abs(status.speed) * 3.6f).toInt()}"
|
||||
}
|
||||
else -> {
|
||||
Logger.d(TAG, "other state: $status")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<Pair<Status?, ArrayList<Status>>> { 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 })
|
||||
}
|
||||
|
||||
@@ -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<Status>): RecyclerView.Adapter<StatusViewHolder>() {
|
||||
internal class StatusAdapter(val ctx: Context, var data: List<Status>): RecyclerView.Adapter<StatusViewHolder>() {
|
||||
|
||||
companion object {
|
||||
const val TAG = "StatusAdapter"
|
||||
@@ -169,6 +169,9 @@ internal class StatusAdapter(val ctx: Context, var data: ArrayList<Status>): Rec
|
||||
is OverViewStatus -> {
|
||||
""
|
||||
}
|
||||
else -> {
|
||||
throw AssertionError()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<Status>, private val update: ArrayList<Status>): DiffUtil.Callback() {
|
||||
internal class StatusDiffCallback(private val old: List<Status>, private val update: List<Status>): DiffUtil.Callback() {
|
||||
|
||||
override fun getOldListSize(): Int = old.size
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/white" android:state_selected="true" />
|
||||
<item android:color="#F73B3C" android:state_enabled="true" />
|
||||
<item android:color="#343C63" android:state_enabled="false"/>
|
||||
</selector>
|
||||
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 5.0 KiB |
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_selected="true" android:drawable="@drawable/icon_brake_or_accelerator_red" />
|
||||
<item android:drawable="@drawable/icon_brake_or_accelerator_blue" />
|
||||
</selector>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_selected="true" android:drawable="@drawable/icon_double_flash_red" />
|
||||
<item android:drawable="@drawable/icon_double_flash_blue" />
|
||||
</selector>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_selected="true" android:drawable="@drawable/icon_steer_red" />
|
||||
<item android:drawable="@drawable/icon_steer_blue" />
|
||||
</selector>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="#141B47" />
|
||||
<corners android:radius="@dimen/dp_60" />
|
||||
</shape>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<color xmlns:android="http://schemas.android.com/apk/res/android" android:color="@color/white">
|
||||
|
||||
</color>
|
||||
@@ -0,0 +1,136 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:parentTag="android.widget.LinearLayout"
|
||||
tools:layout_width="@dimen/dp_624"
|
||||
tools:layout_height="@dimen/dp_269"
|
||||
tools:orientation="horizontal"
|
||||
tools:background="@drawable/icon_bg_autopilot_status"
|
||||
tools:paddingTop="@dimen/dp_33"
|
||||
tools:paddingBottom="@dimen/dp_30"
|
||||
tools:paddingStart="@dimen/dp_27"
|
||||
tools:paddingEnd="@dimen/dp_30">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/speed_chart_parent"
|
||||
android:layout_width="@dimen/dp_184"
|
||||
android:layout_height="@dimen/dp_200"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/icon_bg_speed">
|
||||
<TextView
|
||||
android:id="@+id/speed"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/dp_74"
|
||||
android:textColor="@color/white"
|
||||
tools:text="65"
|
||||
android:text="0"
|
||||
android:layout_marginBottom="@dimen/dp_2"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/dp_32"
|
||||
android:text="Km/h"
|
||||
android:textColor="@color/white"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="@dimen/dp_200"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingEnd="@dimen/dp_34">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginStart="@dimen/dp_34"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:background="@drawable/bg_geer_position"
|
||||
android:paddingStart="@dimen/dp_53"
|
||||
android:paddingEnd="@dimen/dp_53"
|
||||
android:paddingTop="@dimen/dp_6"
|
||||
android:paddingBottom="@dimen/dp_6">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/gear_p"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="P"
|
||||
android:textSize="@dimen/dp_36"
|
||||
android:enabled="false"
|
||||
android:layout_marginEnd="@dimen/dp_32"
|
||||
android:textColor="@color/color_geer_position_selector"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/gear_r"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="R"
|
||||
android:textSize="@dimen/dp_36"
|
||||
android:enabled="false"
|
||||
android:layout_marginEnd="@dimen/dp_32"
|
||||
android:textColor="@color/color_geer_position_selector"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/gear_n"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="N"
|
||||
android:textSize="@dimen/dp_36"
|
||||
android:enabled="false"
|
||||
android:layout_marginEnd="@dimen/dp_32"
|
||||
android:textColor="@color/color_geer_position_selector"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/gear_d"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="D"
|
||||
android:textSize="@dimen/dp_36"
|
||||
android:enabled="false"
|
||||
android:textColor="@color/color_geer_position_selector"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_34"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginTop="@dimen/dp_23">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_steer"
|
||||
android:layout_width="@dimen/dp_55"
|
||||
android:layout_height="@dimen/dp_55"
|
||||
android:layout_marginEnd="@dimen/dp_20"
|
||||
android:src="@drawable/bg_autopilot_steer"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_double_flash"
|
||||
android:layout_width="@dimen/dp_55"
|
||||
android:layout_height="@dimen/dp_55"
|
||||
android:layout_marginEnd="@dimen/dp_20"
|
||||
android:src="@drawable/bg_autopilot_double_flash"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_brake_or_accelerator"
|
||||
android:layout_width="@dimen/dp_55"
|
||||
android:layout_height="@dimen/dp_55"
|
||||
android:src="@drawable/bg_autopilot_brake_or_accelerator"
|
||||
android:layout_marginEnd="@dimen/dp_14"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_brake_or_accelerator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/dp_34"
|
||||
android:layout_marginTop="-1dp"
|
||||
android:textColor="@color/white"
|
||||
android:text="a:-0.0"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</merge>
|
||||
@@ -1582,26 +1582,48 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
|
||||
//上传全量日志
|
||||
exportAllLogs?.onClick { v ->
|
||||
v.visibility = View.INVISIBLE
|
||||
logLoadingView?.visibility = View.VISIBLE
|
||||
v.scope.launch(Dispatchers.IO) {
|
||||
var isUploadSuccess = false
|
||||
try {
|
||||
CallerDevaToolsManager.logcat()?.upload()
|
||||
isUploadSuccess = true
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
withContext(Dispatchers.Main) {
|
||||
if (isUploadSuccess) {
|
||||
ToastUtils.showShort("上传成功")
|
||||
} else {
|
||||
ToastUtils.showShort("上传失败")
|
||||
ListPopupWindow(v.context).also { p ->
|
||||
val items = LogcatUploadDuration.values()
|
||||
p.setAdapter(LogcatUploadAdapter(v.context, items))
|
||||
p.anchorView = v
|
||||
p.isModal = true
|
||||
p.setBackgroundDrawable(ColorDrawable(Color.WHITE))
|
||||
p.setOnItemClickListener { _, _, position, _ ->
|
||||
val item = items[position]
|
||||
v.visibility = View.INVISIBLE
|
||||
logLoadingView?.visibility = View.VISIBLE
|
||||
p.dismiss()
|
||||
v.scope.launch(Dispatchers.IO) {
|
||||
val endTime = System.currentTimeMillis()
|
||||
val startTime = when(item) {
|
||||
LogcatUploadDuration.IN_15M -> endTime - TimeUnit.MINUTES.toMillis(15)
|
||||
LogcatUploadDuration.IN_45M -> endTime - TimeUnit.MINUTES.toMillis(45)
|
||||
LogcatUploadDuration.IN_1H -> endTime - TimeUnit.HOURS.toMillis(1)
|
||||
LogcatUploadDuration.IN_2H -> endTime - TimeUnit.HOURS.toMillis(2)
|
||||
LogcatUploadDuration.IN_3H -> endTime - TimeUnit.HOURS.toMillis(3)
|
||||
LogcatUploadDuration.IN_6H -> endTime - TimeUnit.HOURS.toMillis(6)
|
||||
LogcatUploadDuration.IN_1D -> endTime - TimeUnit.DAYS.toMillis(1)
|
||||
LogcatUploadDuration.ALL -> 0
|
||||
}
|
||||
var isUploadSuccess = false
|
||||
try {
|
||||
CallerDevaToolsManager.logcat()?.upload(startTime, endTime)
|
||||
isUploadSuccess = true
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
withContext(Dispatchers.Main) {
|
||||
if (isUploadSuccess) {
|
||||
ToastUtils.showShort("上传成功")
|
||||
} else {
|
||||
ToastUtils.showShort("上传失败")
|
||||
}
|
||||
logLoadingView?.visibility = View.INVISIBLE
|
||||
exportAllLogs?.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
logLoadingView?.visibility = View.INVISIBLE
|
||||
exportAllLogs?.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
}.show()
|
||||
}
|
||||
|
||||
if (JunkConfig.isSupportJunkDetect) {
|
||||
@@ -1737,6 +1759,54 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private enum class LogcatUploadDuration(val text: String) {
|
||||
IN_15M("15分钟内"),
|
||||
IN_45M("45分钟内"),
|
||||
IN_1H("1小时内"),
|
||||
IN_2H("2小时内"),
|
||||
IN_3H("3小时内"),
|
||||
IN_6H("6小时内"),
|
||||
IN_1D("一天内"),
|
||||
ALL("上传所有")
|
||||
}
|
||||
|
||||
private class LogcatUploadAdapter(private val ctx: Context, private val items: Array<LogcatUploadDuration>): BaseAdapter() {
|
||||
override fun getCount(): Int {
|
||||
return items.size
|
||||
}
|
||||
|
||||
override fun getItem(position: Int): Any {
|
||||
return items[position]
|
||||
}
|
||||
|
||||
override fun getItemId(position: Int): Long {
|
||||
return items[position].ordinal.toLong()
|
||||
}
|
||||
|
||||
override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
|
||||
var result = convertView
|
||||
val duration = items[position]
|
||||
if (result == null) {
|
||||
val temp = View.inflate(ctx, android.R.layout.simple_list_item_1, null)
|
||||
temp.tag = Holder(temp.findViewById(android.R.id.text1))
|
||||
result = temp
|
||||
}
|
||||
val holder = result?.tag as? Holder
|
||||
if (holder != null) {
|
||||
holder.text?.setTextColor(Color.BLACK)
|
||||
holder.text?.text = duration.text
|
||||
} else {
|
||||
val text = result?.findViewById<TextView>(android.R.id.text1)
|
||||
text?.setTextColor(Color.BLACK)
|
||||
text?.text = duration.text
|
||||
result?.tag = Holder(text)
|
||||
}
|
||||
return result!!
|
||||
}
|
||||
|
||||
private inner class Holder(val text: TextView? = null)
|
||||
}
|
||||
|
||||
private enum class ApmVLogUploadDuration(val text: String) {
|
||||
IN_15M("15分钟内"),
|
||||
IN_45M("45分钟内"),
|
||||
|
||||
@@ -19,12 +19,14 @@ import java.lang.ref.WeakReference
|
||||
|
||||
class BatteryGroupView : LinearLayout, IMoGoSkinModeChangeListener {
|
||||
|
||||
constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : super(context, attrs, defStyleAttr) {
|
||||
}
|
||||
constructor(context: Context?) : super(context)
|
||||
|
||||
constructor(context: Context?, attributeSet: AttributeSet) : super(context, attributeSet)
|
||||
|
||||
constructor(context: Context?, attributeSet: AttributeSet, defStyleAttr: Int) : super(context, attributeSet, defStyleAttr)
|
||||
|
||||
constructor(context: Context?, attributeSet: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attributeSet, defStyleAttr, defStyleRes)
|
||||
|
||||
|
||||
private var batteryHandler: BatteryHandler = BatteryHandler(this)
|
||||
private var view: View =
|
||||
|
||||
@@ -4,8 +4,10 @@ import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.FUNC_MODE_DEMO
|
||||
@@ -15,10 +17,13 @@ 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.setting.CallerSkinModeListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.kotlin.scope
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.BarUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import kotlinx.android.synthetic.main.view_status_bar.view.*
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
|
||||
class StatusBarView @JvmOverloads constructor(
|
||||
@@ -46,7 +51,6 @@ class StatusBarView @JvmOverloads constructor(
|
||||
params.height = BarUtils.getStatusBarHeight()
|
||||
layoutParams = params
|
||||
}
|
||||
viewStatusBarRight.addView(BatteryGroupView(this.context))
|
||||
|
||||
//添加view控制
|
||||
CallerHmiViewControlListenerManager.addListener(TAG,this)
|
||||
@@ -58,6 +62,28 @@ class StatusBarView @JvmOverloads constructor(
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){
|
||||
updateStatusBarLeftView(true, FUNC_MODE_DEMO, DemoModeView(this.context))
|
||||
updateStatusBarLeftView(true, FUNC_MODE_RAIN, RainModeView(this.context))
|
||||
CallerDevaToolsManager.registerRouteDownloadListener(TAG) { state ->
|
||||
routeDownloadStatusRoot?.visibility = View.VISIBLE
|
||||
when(state) {
|
||||
1 -> {
|
||||
routeDownloadStatus?.background = ContextCompat.getDrawable(context, R.drawable.bg_autopilot_route_download_start)
|
||||
routeDownloadFailMark?.visibility = View.GONE
|
||||
}
|
||||
2 -> {
|
||||
routeDownloadStatus?.background = ContextCompat.getDrawable(context, R.drawable.bg_autopilot_route_download_success)
|
||||
routeDownloadFailMark?.visibility = View.GONE
|
||||
scope.launch {
|
||||
delay(3000)
|
||||
routeDownloadStatusRoot?.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
3 -> {
|
||||
routeDownloadStatus?.background = ContextCompat.getDrawable(context, R.drawable.bg_autopilot_route_download_failed)
|
||||
routeDownloadFailMark?.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +145,6 @@ class StatusBarView @JvmOverloads constructor(
|
||||
|
||||
private fun setTextColor(color: Int) {
|
||||
viewTextClock.setTextColor(color)
|
||||
viewStatusBarTag.setTextColor(color)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
@@ -127,6 +152,7 @@ class StatusBarView @JvmOverloads constructor(
|
||||
CallerHmiViewControlListenerManager.removeListener(TAG)
|
||||
CallerSkinModeListenerManager.removeListener(TAG)
|
||||
CallerDevaToolsManager.hideStatusBar()
|
||||
CallerDevaToolsManager.unRegisterRouteDownloadListener(TAG)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,19 +8,27 @@ import android.net.wifi.WifiManager
|
||||
import android.os.Handler
|
||||
import android.os.Message
|
||||
import android.util.AttributeSet
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import android.util.Log
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.ImageView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import kotlinx.android.synthetic.main.view_wifi_state.view.viewStatusBarTag
|
||||
import kotlinx.android.synthetic.main.view_wifi_state.view.viewWifiStateBg
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
import java.lang.ref.WeakReference
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
|
||||
class WifiStateView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : AppCompatImageView(context, attrs, defStyleAttr), IMoGoSkinModeChangeListener {
|
||||
context: Context, attrs: AttributeSet? = null,defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs), IMoGoSkinModeChangeListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "WifiStateView"
|
||||
@@ -37,20 +45,46 @@ class WifiStateView @JvmOverloads constructor(
|
||||
override fun handleMessage(msg: Message) {
|
||||
super.handleMessage(msg)
|
||||
val view = stateViewWeakReference?.get()
|
||||
view?.updateView(msg.what) {
|
||||
view.setImageResource(it)
|
||||
view?.updateLevel(msg.what)
|
||||
}
|
||||
}
|
||||
}
|
||||
private var wifiManager: WifiManager? = null
|
||||
private var wifiHandler: WifiHandler? = null
|
||||
|
||||
private var level: Int by Delegates.observable(0) { _, o, n ->
|
||||
if (o != n) {
|
||||
UiThreadHandler.post {
|
||||
updateView(n){
|
||||
viewWifiStateBg.setImageResource(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var wifiManager: WifiManager? = null
|
||||
private var wifiHandler: WifiHandler? = null
|
||||
private var wifiName: String by Delegates.observable("") { _, o, n ->
|
||||
if (o != n) {
|
||||
UiThreadHandler.post {
|
||||
if(n.contains("unknow")){
|
||||
viewStatusBarTag.text = ""
|
||||
}else{
|
||||
viewStatusBarTag.text = n
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Volatile
|
||||
private var level: Int = 0
|
||||
private val txtSize: Float
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_wifi_state, this, true)
|
||||
val a = context.obtainStyledAttributes(attrs, R.styleable.WifiStateView, defStyleAttr, 0)
|
||||
txtSize = a.getDimension(
|
||||
R.styleable.WifiStateView_wifi_size,
|
||||
resources.getDimension(R.dimen.dp_35)
|
||||
)
|
||||
a.recycle()
|
||||
viewStatusBarTag.setTextSize(TypedValue.COMPLEX_UNIT_PX,AutoSizeUtils.dp2px(context,txtSize).toFloat())
|
||||
wifiManager =
|
||||
context.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager?
|
||||
wifiHandler = WifiHandler(this)
|
||||
@@ -67,6 +101,8 @@ class WifiStateView @JvmOverloads constructor(
|
||||
return
|
||||
}
|
||||
val wifiInfo = wifiManager!!.connectionInfo
|
||||
wifiName = wifiInfo.ssid.replace("\"","")
|
||||
Log.i("emArrow", "wifiName: $wifiName")
|
||||
level = WifiManager.calculateSignalLevel(wifiInfo.rssi, 5)
|
||||
wifiHandler?.sendEmptyMessage(level)
|
||||
}
|
||||
@@ -95,9 +131,25 @@ class WifiStateView @JvmOverloads constructor(
|
||||
|
||||
override fun onSkinModeChange(skinMode: Int) {
|
||||
wifiHandler?.sendEmptyMessage(level)
|
||||
UiThreadHandler.post {
|
||||
when (skinMode) {
|
||||
0 -> setStatusBarDarkOrLight(false)
|
||||
1 -> setStatusBarDarkOrLight(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun updateView(wifiState: Int, resId: ((Int) -> Unit)) {
|
||||
private fun setStatusBarDarkOrLight(light: Boolean) = if (light) {
|
||||
viewStatusBarTag.setTextColor(resources.getColor(R.color.color_2C2E30))
|
||||
} else {
|
||||
viewStatusBarTag.setTextColor(resources.getColor(R.color.color_FFFFFF))
|
||||
}
|
||||
|
||||
fun updateLevel(wifiState: Int){
|
||||
level = wifiState
|
||||
}
|
||||
|
||||
private fun updateView(wifiState: Int, resId: ((Int) -> Unit)) {
|
||||
when (FunctionBuildConfig.skinMode) {
|
||||
0 -> {
|
||||
when (wifiState) {
|
||||
@@ -109,6 +161,7 @@ class WifiStateView @JvmOverloads constructor(
|
||||
4 -> resId.invoke(R.drawable.wifi_light_state_five)
|
||||
}
|
||||
}
|
||||
|
||||
1 -> {
|
||||
when (wifiState) {
|
||||
-1 -> resId.invoke(R.drawable.wifi_dark_state_one)
|
||||
|
||||
@@ -82,7 +82,6 @@ open class MainActivity : MvpActivity<MainView?, MainPresenter?>(), MainView,
|
||||
|
||||
override fun initViews() {
|
||||
injectFloatView()
|
||||
injectStatusBar()
|
||||
window.setBackgroundDrawable(null)
|
||||
initConnectInfoRV()
|
||||
CallerHmiManager.init(this)
|
||||
@@ -95,28 +94,6 @@ open class MainActivity : MvpActivity<MainView?, MainPresenter?>(), MainView,
|
||||
PermissionsDialogUtils.openAppDetails(this, "显示悬浮窗", REQUEST_CODE_DIALOG)
|
||||
}
|
||||
|
||||
private fun injectStatusBar() {
|
||||
val decorView = this.window.decorView as? FrameLayout ?: return
|
||||
val contentView =
|
||||
(decorView.findViewById<View>(android.R.id.content) as? ViewGroup)?.getChildAt(0)
|
||||
?: return
|
||||
contentView.fitsSystemWindows = false
|
||||
decorView.clipToPadding = false
|
||||
var statusBarView = decorView.findViewWithTag<View>("status_bar")
|
||||
if (statusBarView == null) {
|
||||
val statusBar = CallerHmiFloatViewManager.getView(this)
|
||||
statusBarView = statusBar ?: StatusBarView(this)
|
||||
statusBarView.tag = "status_bar"
|
||||
}
|
||||
val statusBarLP = FrameLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||
)
|
||||
statusBarLP.topMargin = 0
|
||||
statusBarLP.gravity = Gravity.TOP
|
||||
decorView.addView(statusBarView, statusBarLP)
|
||||
}
|
||||
|
||||
// todo 优化 车聊聊
|
||||
private fun injectFloatView() {
|
||||
val decorView = this.window.decorView as? FrameLayout ?: return
|
||||
@@ -201,23 +178,22 @@ open class MainActivity : MvpActivity<MainView?, MainPresenter?>(), MainView,
|
||||
MogoStatusManager.getInstance().setVrMode(TAG, true)
|
||||
MogoModulesManager.getInstance().init(this)
|
||||
loadOthersModules()
|
||||
mogoMapListenerHandler.registerHostMapListener(TAG, object : IMogoMapListener {
|
||||
override fun onMapLoaded() {
|
||||
// 延时加载其他模块
|
||||
window.decorView.post {
|
||||
MogoStatusManager.getInstance().setScreenCoverMode(TAG, true)
|
||||
HdMapBuildConfig.isMapLoaded = true
|
||||
mPresenter!!.delayOperations()
|
||||
loadFunctionFragment()
|
||||
// 设置地图样式
|
||||
mogoMapListenerHandler.onMapModeChanged(EnumMapUI.MAP_STYLE_DAY_VR)
|
||||
}
|
||||
i(
|
||||
SceneConstant.M_HMI + TAG,
|
||||
"App launch timer cost " + (System.currentTimeMillis() - start) + "ms"
|
||||
)
|
||||
}
|
||||
})
|
||||
mPresenter!!.delayOperations()
|
||||
// mogoMapListenerHandler.registerHostMapListener(TAG, object : IMogoMapListener {
|
||||
// override fun onMapLoaded() {
|
||||
// // 延时加载其他模块
|
||||
// window.decorView.post {
|
||||
// MogoStatusManager.getInstance().setScreenCoverMode(TAG, true)
|
||||
// HdMapBuildConfig.isMapLoaded = true
|
||||
// // 设置地图样式
|
||||
// mogoMapListenerHandler.onMapModeChanged(EnumMapUI.MAP_STYLE_DAY_VR)
|
||||
// }
|
||||
// i(
|
||||
// SceneConstant.M_HMI + TAG,
|
||||
// "App launch timer cost " + (System.currentTimeMillis() - start) + "ms"
|
||||
// )
|
||||
// }
|
||||
// })
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -349,7 +325,7 @@ open class MainActivity : MvpActivity<MainView?, MainPresenter?>(), MainView,
|
||||
super.onDestroy()
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
CallerRequestActivityHandleManager.removeListener(TAG)
|
||||
mogoMapListenerHandler.unregisterHostMapListener(TAG)
|
||||
//mogoMapListenerHandler.unregisterHostMapListener(TAG)
|
||||
MogoStatusManager.getInstance().setMainPageIsBackgroundStatus(TAG, false)
|
||||
d(SceneConstant.M_HMI + TAG, "destroy.")
|
||||
ContextHolderUtil.releaseContext()
|
||||
|
||||
@@ -111,31 +111,18 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
private void loadOCHModule() {
|
||||
IMoGoFunctionProvider ochProvider;
|
||||
// 兼容处理之前联想PAD及小巴车多个设备部署不同APP方案
|
||||
if (!DebugConfig.isMultiDisplay()) {
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
ochProvider = (IMoGoFunctionProvider) ARouter.getInstance()
|
||||
.build("/driver/api")
|
||||
.navigation(getContext());
|
||||
} else if(AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)){
|
||||
ochProvider = (IMoGoFunctionProvider) ARouter.getInstance()
|
||||
.build("/passenger/api")
|
||||
.navigation(getContext());
|
||||
} else {
|
||||
ochProvider = (IMoGoFunctionProvider) ARouter.getInstance()
|
||||
.build("/noop/api")
|
||||
.navigation(getContext());
|
||||
}
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
ochProvider = (IMoGoFunctionProvider) ARouter.getInstance()
|
||||
.build("/driver/api")
|
||||
.navigation(getContext());
|
||||
} else if(AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)){
|
||||
ochProvider = (IMoGoFunctionProvider) ARouter.getInstance()
|
||||
.build("/passenger/api")
|
||||
.navigation(getContext());
|
||||
} else {
|
||||
// 目前只有金旅星辰乘客屏是连接的双屏
|
||||
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||
ochProvider = (IMoGoFunctionProvider) ARouter.getInstance()
|
||||
.build("/passenger/api")
|
||||
.navigation(getContext());
|
||||
} else {
|
||||
ochProvider = (IMoGoFunctionProvider) ARouter.getInstance()
|
||||
.build("/noop/api")
|
||||
.navigation(getContext());
|
||||
}
|
||||
ochProvider = (IMoGoFunctionProvider) ARouter.getInstance()
|
||||
.build("/noop/api")
|
||||
.navigation(getContext());
|
||||
}
|
||||
|
||||
if (ochProvider != null) {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
<gradient
|
||||
android:startColor="#FF5A35" android:endColor="#FF0000"/>
|
||||
<corners
|
||||
android:radius="@dimen/dp_10"/>
|
||||
</shape>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
|
||||
<item android:width="@dimen/dp_70" android:height="@dimen/dp_10">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#40000000" />
|
||||
<corners
|
||||
android:radius="@dimen/dp_10"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:width="@dimen/dp_47" android:height="@dimen/dp_10">
|
||||
<shape android:shape="rectangle">
|
||||
<gradient
|
||||
android:startColor="#35B8FF" android:endColor="#0081FF"/>
|
||||
<corners
|
||||
android:radius="@dimen/dp_10"/>
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
<gradient
|
||||
android:startColor="#31C2DA" android:endColor="#17CAB5"/>
|
||||
<corners
|
||||
android:radius="@dimen/dp_10"/>
|
||||
</shape>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/color_1A000000" />
|
||||
</shape>
|
||||
@@ -18,20 +18,9 @@
|
||||
android:textSize="@dimen/dp_45"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/viewStatusBarTag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="@dimen/dp_27"
|
||||
android:gravity="center"
|
||||
android:text="@string/status_bar_tag"
|
||||
android:textColor="@color/color_2C2E30"
|
||||
android:textSize="@dimen/dp_35" />
|
||||
|
||||
<!--Wifi状态-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView
|
||||
android:layout_width="@dimen/dp_54"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_54"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="@dimen/dp_18" />
|
||||
@@ -67,6 +56,37 @@
|
||||
android:textColor="@color/background_debug"
|
||||
android:textSize="@dimen/dp_20" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/routeDownloadStatusRoot"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
tools:background="#2F4266">
|
||||
<View
|
||||
android:id="@+id/routeDownloadStatus"
|
||||
android:layout_width="@dimen/dp_70"
|
||||
android:layout_height="@dimen/dp_10"
|
||||
android:layout_gravity="center_vertical"
|
||||
tools:visibility="visible"
|
||||
tools:background="@drawable/bg_autopilot_route_download_failed"/>
|
||||
<TextView
|
||||
android:id="@+id/routeDownloadFailMark"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/white"
|
||||
android:text="!"
|
||||
android:textStyle="bold"
|
||||
tools:visibility="visible"
|
||||
android:visibility="gone"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:textSize="@dimen/dp_28"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
<Space
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="@dimen/dp_1"
|
||||
@@ -88,5 +108,8 @@
|
||||
android:layout_marginEnd="@dimen/dp_44"
|
||||
android:gravity="end|center"
|
||||
android:orientation="horizontal">
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.BatteryGroupView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
</merge>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/viewStatusBarTag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_27"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLength="15"
|
||||
android:textColor="@color/color_2C2E30"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/viewWifiStateBg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@+id/viewStatusBarTag"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="MissingConstraints" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -89,6 +89,10 @@
|
||||
<attr name="pnc_txt_style" format="reference"/>
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="WifiStateView">
|
||||
<attr name="wifi_size" format="dimension"/>
|
||||
</declare-styleable>
|
||||
|
||||
<style name="AudioFileInfoOverlayText">
|
||||
<item name="android:shadowColor">#80000000</item>
|
||||
<item name="android:shadowRadius">11</item>
|
||||
|
||||
@@ -8,6 +8,7 @@ import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.mogo.eagle.core.data.enums.TrafficTypeEnum;
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData;
|
||||
import com.mogo.eagle.core.utilcode.geometry.S2CellId;
|
||||
import com.mogo.eagle.core.utilcode.geometry.S2LatLng;
|
||||
@@ -103,7 +104,7 @@ public class TrackManager {
|
||||
MessagePad.TrackedObject cache = cacheTrack.getCache();
|
||||
if (cache != null) {
|
||||
//相对静止物体 感知融合同位置物体,使用缓存数据做覆盖
|
||||
if (cacheTrack.relativeStatic()) {
|
||||
if (cacheTrack.relativeStatic() && data.getType() != TrafficTypeEnum.TYPE_TRAFFIC_ID_CONE.getType()) {
|
||||
if (data.getColor() != null && !data.getColor().isEmpty()) {
|
||||
cache = cache.toBuilder().setColor(data.getColor()).build();
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ object TrackerSourceFilterHelper {
|
||||
@SuppressLint("NewApi")
|
||||
fun filterData(data: TrackedObject): Boolean {
|
||||
if (!FunctionBuildConfig.isDrawUnknownIdentifyData && (data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI.type
|
||||
|| data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_501.type || data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_502.type)
|
||||
|| data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_DAO_LU_SHI_GONG.type || data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_DAO_LU_SHI_GU.type)
|
||||
) {
|
||||
return true
|
||||
}
|
||||
@@ -55,6 +55,10 @@ object TrackerSourceFilterHelper {
|
||||
return ""
|
||||
}
|
||||
|
||||
if(data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_CONE.type){
|
||||
return ""
|
||||
}
|
||||
|
||||
if(FunctionBuildConfig.isFusionColor){
|
||||
if(isFusion(data)){
|
||||
color = "#982FFFFF"
|
||||
|
||||
@@ -174,9 +174,9 @@ class SmallMapView @JvmOverloads constructor(
|
||||
// 关闭显示实时路况图层,aMap是地图控制器对象。
|
||||
mAMap?.isTrafficEnabled = false
|
||||
// 设置 锚点 图标
|
||||
iconRes = if (AppIdentityModeUtils.isJL(FunctionBuildConfig.appIdentityMode)) {
|
||||
iconRes = if (AppIdentityModeUtils.isB1(FunctionBuildConfig.appIdentityMode)) {
|
||||
R.drawable.map_bus_icon
|
||||
} else if (AppIdentityModeUtils.isM2(FunctionBuildConfig.appIdentityMode) || AppIdentityModeUtils.isM1(FunctionBuildConfig.appIdentityMode)) {
|
||||
} else if (AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode) || AppIdentityModeUtils.isM1(FunctionBuildConfig.appIdentityMode)) {
|
||||
R.drawable.map_m2_icon
|
||||
} else {
|
||||
R.drawable.map_car_icon
|
||||
|
||||
@@ -257,12 +257,13 @@ class HttpDnsStartUp : AndroidStartup<Boolean>(), IMoGoCloudListener {
|
||||
// 初始化网络配置
|
||||
NetConfigUtils.init()
|
||||
// 加入启动统计
|
||||
val mStartParams: HashMap<String, Any> = HashMap()
|
||||
mStartParams["start_time"] = TimeUtils.getNowMills()
|
||||
mStartParams["app_version"] = AppUtils.getAppVersionName()
|
||||
mStartParams["app_flavor"] = DebugConfig.getProductFlavor()
|
||||
mStartParams["app_identity_mode"] = FunctionBuildConfig.appIdentityMode
|
||||
MogoAnalyticUtils.track("app_start_time", mStartParams)
|
||||
// todo 钟超 登陆后调用 获取 app_flavor
|
||||
// val mStartParams: HashMap<String, Any> = HashMap()
|
||||
// mStartParams["start_time"] = TimeUtils.getNowMills()
|
||||
// mStartParams["app_version"] = AppUtils.getAppVersionName()
|
||||
// mStartParams["app_flavor"] = DebugConfig.getProductFlavor()
|
||||
// mStartParams["app_identity_mode"] = FunctionBuildConfig.appIdentityMode
|
||||
// MogoAnalyticUtils.track("app_start_time", mStartParams)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||