[3.3.0][Feat]新增状态监控汇总功能
This commit is contained in:
@@ -34,6 +34,8 @@ import com.mogo.eagle.core.function.datacenter.autopilot.telematic.TeleMsgHandle
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicStatusListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_ADAS_IMPL
|
||||
@@ -144,6 +146,7 @@ class MoGoAutopilotControlProvider :
|
||||
}
|
||||
}, 1000, 10000)
|
||||
invokeNettyConnResult("司机端服务启动成功!")
|
||||
CallerTelematicStatusListenerManager.invokeServerStatusChanged(true)
|
||||
}
|
||||
|
||||
override fun onStopServer() {
|
||||
@@ -151,6 +154,7 @@ class MoGoAutopilotControlProvider :
|
||||
timer?.cancel()
|
||||
timer = null
|
||||
invokeNettyConnResult("司机端服务停止!")
|
||||
CallerTelematicStatusListenerManager.invokeServerStatusChanged(false)
|
||||
}
|
||||
|
||||
override fun onChannelConnect(channel: Channel?) {
|
||||
|
||||
@@ -18,8 +18,11 @@ import com.zhjt.mogo_core_function_devatools.status.entity.IpcStatus
|
||||
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.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.can.CanImpl
|
||||
import com.zhjt.mogo_core_function_devatools.status.flow.gps.GpsImpl
|
||||
import com.zhjt.mogo_core_function_devatools.status.flow.ipc.IpcImpl
|
||||
@@ -73,6 +76,7 @@ object StatusManager {
|
||||
is GpsStatus -> GpsImpl(ctx)
|
||||
is TracingStatus -> TracingImpl(ctx)
|
||||
is RTKStatus -> RTKImpl(ctx)
|
||||
is OverViewStatus -> OverViewImpl(ctx)
|
||||
}
|
||||
}.also { flows += it }
|
||||
for (f in flows) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zhjt.mogo_core_function_devatools.status.entity
|
||||
|
||||
import com.mogo.eagle.core.data.status.StatusSummaryEntity
|
||||
import com.mogo.eagle.core.function.api.autopilot.*
|
||||
import com.mogo.eagle.core.function.call.autopilot.*
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.TracingStatus.Tracing
|
||||
@@ -228,6 +229,24 @@ class TracingStatus(var state: Tracing = UNKNOWN): Status() {
|
||||
override fun isException(): Boolean = state.isException()
|
||||
}
|
||||
|
||||
class OverViewStatus(var hasException: Boolean = false): Status() {
|
||||
override fun isException(): Boolean {
|
||||
return hasException
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (javaClass != other?.javaClass) return false
|
||||
other as OverViewStatus
|
||||
if (hasException != other.hasException) return false
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun String.toState(msg: String?): Tracing? {
|
||||
val ss = msg?.split("|")
|
||||
var extra: Map<String, String>? = null
|
||||
|
||||
@@ -0,0 +1,282 @@
|
||||
package com.zhjt.mogo_core_function_devatools.status.flow
|
||||
|
||||
import android.Manifest
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.location.LocationManager
|
||||
import android.util.Log
|
||||
import androidx.core.location.LocationManagerCompat
|
||||
import com.mogo.commons.module.status.IMogoStatusChangedListener
|
||||
import com.mogo.commons.module.status.MogoStatusManager
|
||||
import com.mogo.commons.module.status.StatusDescriptor
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
|
||||
import com.mogo.eagle.core.function.api.telematic.IConnectStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicStatusListenerManager
|
||||
import com.mogo.eagle.core.utilcode.util.AppStateManager
|
||||
import com.mogo.eagle.core.utilcode.util.IAppStateListener
|
||||
import com.mogo.eagle.core.utilcode.util.PermissionUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.OverViewStatus
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.TracingStatus
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.toState
|
||||
import mogo_msg.MogoReportMsg
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
|
||||
internal class OverViewImpl(ctx: Context) : IFlow<OverViewStatus>(ctx),
|
||||
IMoGoDevaToolsListener, IMoGoAutopilotStatusListener,
|
||||
IConnectStatusListener, IMogoStatusChangedListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "OverViewImpl"
|
||||
}
|
||||
|
||||
// =====GPS相关=====
|
||||
private val registered = AtomicBoolean(false)
|
||||
|
||||
private var receiver: CheckLocationReceiver? = null
|
||||
|
||||
@Volatile
|
||||
private var isServerException = false
|
||||
|
||||
@Volatile
|
||||
private var isGpsException = false
|
||||
|
||||
@Volatile
|
||||
private var isCloudSocketException = false
|
||||
|
||||
@Volatile
|
||||
private var isTracingException = false
|
||||
|
||||
@Volatile
|
||||
private var isFirst = true
|
||||
|
||||
inner class CheckLocationReceiver(private val onClose: ()->Unit, private val onOpen:()-> Unit) : BroadcastReceiver() {
|
||||
|
||||
override fun onReceive(context: Context?, intent: Intent?) {
|
||||
if (intent?.action == LocationManager.MODE_CHANGED_ACTION) {
|
||||
if (isLocationEnabled()) {
|
||||
onOpen.invoke()
|
||||
} else {
|
||||
onClose.invoke()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val onClose = {
|
||||
isGpsException = true
|
||||
send(OverViewStatus(true))
|
||||
CallerDevaToolsListenerManager.invokeGpsStatus(false)
|
||||
}
|
||||
|
||||
private val onOpen = {
|
||||
if (!isGrandFineLocation()) {
|
||||
isGpsException = true
|
||||
send(OverViewStatus(true))
|
||||
CallerDevaToolsListenerManager.invokeGpsStatus(false)
|
||||
} else {
|
||||
isGpsException = false
|
||||
checkIfNotException()
|
||||
CallerDevaToolsListenerManager.invokeGpsStatus(true)
|
||||
}
|
||||
}
|
||||
|
||||
private fun isGrandFineLocation(): Boolean = try {
|
||||
PermissionUtils.isGranted(Manifest.permission.ACCESS_FINE_LOCATION)
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
false
|
||||
}
|
||||
|
||||
private val onStateListener = object : IAppStateListener {
|
||||
|
||||
override fun onAppStateChanged(isForeground: Boolean) {
|
||||
if (isForeground) {
|
||||
val enable = isLocationEnabled()
|
||||
val grant = isGrandFineLocation()
|
||||
if (!enable || !grant) {
|
||||
isGpsException = true
|
||||
send(OverViewStatus(true))
|
||||
CallerDevaToolsListenerManager.invokeGpsStatus(false)
|
||||
} else {
|
||||
isGpsException = false
|
||||
checkIfNotException()
|
||||
CallerDevaToolsListenerManager.invokeGpsStatus(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreate() {
|
||||
// // 蓝牙魔方状态
|
||||
// CallerDevaToolsListenerManager.addListener(TAG, this)
|
||||
// 司机屏Server服务是否开启的状态
|
||||
CallerTelematicStatusListenerManager.addListener(TAG, this)
|
||||
// 云socket连接状态
|
||||
MogoStatusManager.getInstance()
|
||||
.registerStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this)
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
|
||||
val isGranted = checkIsGpsException()
|
||||
if (!isGranted) {
|
||||
PermissionUtils.requestAccessFineLocation(object : PermissionUtils.SimpleCallback {
|
||||
override fun onGranted() {
|
||||
Log.d(TAG,"权限: ${Manifest.permission.ACCESS_FINE_LOCATION} 被授予了....")
|
||||
if (isLocationEnabled()) {
|
||||
isGpsException = true
|
||||
send(OverViewStatus(true))
|
||||
CallerDevaToolsListenerManager.invokeGpsStatus(false)
|
||||
} else {
|
||||
isGpsException = false
|
||||
checkIfNotException()
|
||||
CallerDevaToolsListenerManager.invokeGpsStatus(true)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDenied() {
|
||||
ToastUtils.showShort("定位权限被拒绝, 可能导致RTK定位不准确,请开启~")
|
||||
isGpsException = true
|
||||
send(OverViewStatus(true))
|
||||
CallerDevaToolsListenerManager.invokeGpsStatus(false)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (registered.compareAndSet(false, true)) {
|
||||
ctx.registerReceiver(CheckLocationReceiver(onClose, onOpen).also { receiver = it }, IntentFilter().also { it.addAction(LocationManager.MODE_CHANGED_ACTION) })
|
||||
}
|
||||
// // 工控机连接状态外层状态栏已显示,先隐藏
|
||||
// CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
private fun checkIsGpsException(): Boolean {
|
||||
val isGranted = isGrandFineLocation()
|
||||
AppStateManager.registerAppStateListener(onStateListener)
|
||||
if (isLocationEnabled() && isGranted) {
|
||||
isGpsException = false
|
||||
checkIfNotException()
|
||||
CallerDevaToolsListenerManager.invokeGpsStatus(true)
|
||||
} else {
|
||||
isGpsException = true
|
||||
send(OverViewStatus(true))
|
||||
CallerDevaToolsListenerManager.invokeGpsStatus(false)
|
||||
}
|
||||
return isGranted
|
||||
}
|
||||
|
||||
/**
|
||||
* App定位是否打开
|
||||
*/
|
||||
private fun isLocationEnabled() = LocationManagerCompat.isLocationEnabled(ctx.getSystemService(Context.LOCATION_SERVICE) as LocationManager)
|
||||
|
||||
/**
|
||||
* 魔方状态
|
||||
*/
|
||||
override fun mofangStatus(status: Boolean) {
|
||||
super.mofangStatus(status)
|
||||
// if (!status) {
|
||||
// send(OverViewStatus(true))
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 司机屏服务是否启动的状态
|
||||
*/
|
||||
override fun onServerStatusChanged(isStarted: Boolean) {
|
||||
super.onServerStatusChanged(isStarted)
|
||||
if (!isStarted) {
|
||||
isServerException = true
|
||||
send(OverViewStatus(true))
|
||||
} else {
|
||||
isServerException = false
|
||||
checkIfNotException()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 只监听云Socket状态
|
||||
*/
|
||||
override fun onStatusChanged(descriptor: StatusDescriptor?, isTrue: Boolean) {
|
||||
if (StatusDescriptor.CLOUD_SOCKET == descriptor) {
|
||||
if (!isTrue) {
|
||||
isCloudSocketException = true
|
||||
send(OverViewStatus(true))
|
||||
} else {
|
||||
isCloudSocketException = false
|
||||
checkIfNotException()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 工控机监控节点
|
||||
*/
|
||||
override fun onAutopilotGuardian(guardianInfo: MogoReportMsg.MogoReportMessage?) {
|
||||
super.onAutopilotGuardian(guardianInfo)
|
||||
val code = guardianInfo?.code
|
||||
val message = guardianInfo?.msg
|
||||
val newState = code?.toState(message)
|
||||
if (newState != null) {
|
||||
when (newState) {
|
||||
TracingStatus.Tracing.MAP_DATA_NOT_EXIST, TracingStatus.Tracing.TRACK_NOT_EXIST,
|
||||
TracingStatus.Tracing.TRACK_LOAD_FAIL, TracingStatus.Tracing.ROUTE_FAILED, TracingStatus.Tracing.UNKNOWN -> {
|
||||
if (!isTracingException) {
|
||||
isTracingException = true
|
||||
send(OverViewStatus(true))
|
||||
CallerDevaToolsListenerManager.invokeTracingStatus(false)
|
||||
}
|
||||
}
|
||||
TracingStatus.Tracing.MAP_TRA_TYPE, TracingStatus.Tracing.MAP_DATA_EXIST,
|
||||
TracingStatus.Tracing.TRACK_FINDED, TracingStatus.Tracing.TRACK_LOADED,
|
||||
TracingStatus.Tracing.ROUTE_LOADED -> {
|
||||
// 默认是false,需要加第一次的判断
|
||||
if (isFirst || isTracingException) {
|
||||
isFirst = false
|
||||
isTracingException = false
|
||||
// 不加锁,并行时多触发几次可接受
|
||||
checkIfNotException()
|
||||
CallerDevaToolsListenerManager.invokeTracingStatus(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkIfNotException() {
|
||||
if (!isServerException && !isCloudSocketException && !isTracingException && !isGpsException) {
|
||||
send(OverViewStatus(false))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 工控机连接状态
|
||||
*/
|
||||
override fun onAutopilotIpcConnectStatusChanged(status: Int, reason: String?) {
|
||||
super.onAutopilotIpcConnectStatusChanged(status, reason)
|
||||
}
|
||||
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
// CallerDevaToolsListenerManager.removeListener(TAG)
|
||||
CallerTelematicStatusListenerManager.removeListener(TAG)
|
||||
MogoStatusManager.getInstance()
|
||||
.unregisterStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this)
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
// CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
|
||||
try {
|
||||
if (registered.compareAndSet(true, false) && receiver != null) {
|
||||
ctx.unregisterReceiver(receiver)
|
||||
}
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
AppStateManager.unRegisterAppStateListener(onStateListener)
|
||||
}
|
||||
}
|
||||
@@ -2,13 +2,8 @@ package com.zhjt.mogo_core_function_devatools.status.model
|
||||
|
||||
import androidx.lifecycle.*
|
||||
import com.mogo.eagle.core.function.call.autopilot.*
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.CanStatus
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.GpsStatus
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.IpcStatus
|
||||
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.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.TracingStatus.Tracing.UNKNOWN
|
||||
import java.util.concurrent.atomic.*
|
||||
import kotlin.Pair
|
||||
@@ -19,11 +14,13 @@ internal class StatusModel : ViewModel() {
|
||||
|
||||
const val TAG = "StatusModel"
|
||||
val DEFAULTS = Pair(null, ArrayList<Status>().also {
|
||||
it += OverViewStatus()
|
||||
it += IpcStatus(CallerAutoPilotControlManager.isConnected())
|
||||
it += CanStatus(false)
|
||||
it += TracingStatus(UNKNOWN)
|
||||
// it += TracingStatus(UNKNOWN)
|
||||
it += RTKStatus("", -1)
|
||||
it += GpsStatus(enabled = false, isGranted = false)
|
||||
// it += NetStatus(false)
|
||||
// it += GpsStatus(enabled = false, isGranted = false)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.zhjt.mogo_core_function_devatools.status.ui
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.FrameLayout
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.zhjt.mogo_core_function_devatools.R
|
||||
|
||||
/**
|
||||
* 状态汇总View控件
|
||||
*/
|
||||
class StatusSummaryView@JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : FrameLayout(
|
||||
context,
|
||||
attrs,
|
||||
defStyleAttr
|
||||
), IMoGoAutopilotStatusListener {
|
||||
companion object{
|
||||
private const val TAG = "SummaryStatusView"
|
||||
}
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_initiative_bad_case, this, true)
|
||||
initView()
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import android.view.*
|
||||
import android.widget.*
|
||||
import androidx.core.content.*
|
||||
import androidx.recyclerview.widget.*
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.utilcode.kotlin.*
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.*
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
|
||||
@@ -15,6 +16,7 @@ import com.zhjt.mogo_core_function_devatools.status.entity.*
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.IpcStatus
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.Status
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.TracingStatus.Tracing.*
|
||||
import com.zhjt.mogo_core_function_devatools.status.ui.StatusSummaryView
|
||||
import com.zhjt.mogo_core_function_devatools.status.ui.adapter.StatusAdapter.StatusViewHolder
|
||||
|
||||
internal class StatusAdapter(val ctx: Context, var data: ArrayList<Status>): RecyclerView.Adapter<StatusViewHolder>() {
|
||||
@@ -39,9 +41,12 @@ internal class StatusAdapter(val ctx: Context, var data: ArrayList<Status>): Rec
|
||||
}
|
||||
|
||||
fun bind(status: Status) {
|
||||
// itemView.onClick {
|
||||
itemView.onClick {
|
||||
// ToastUtils.showShort(getText(status))
|
||||
// }
|
||||
if (status is OverViewStatus) {
|
||||
CallerHmiManager.showStatusSummaryDialog()
|
||||
}
|
||||
}
|
||||
when(status) {
|
||||
is IpcStatus -> {
|
||||
if (status.enabled) {
|
||||
@@ -99,6 +104,15 @@ internal class StatusAdapter(val ctx: Context, var data: ArrayList<Status>): Rec
|
||||
iv.background = ContextCompat.getDrawable(itemView.context, drawable.icon_dev_status_rtk_unknow)
|
||||
}
|
||||
}
|
||||
is OverViewStatus -> {
|
||||
if (status.hasException) {
|
||||
iv.scaleType = ImageView.ScaleType.FIT_CENTER
|
||||
iv.setImageResource(drawable.icon_red_warning)
|
||||
} else {
|
||||
iv.scaleType = ImageView.ScaleType.FIT_CENTER
|
||||
iv.setImageResource(drawable.icon_grey_warning)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,6 +154,9 @@ internal class StatusAdapter(val ctx: Context, var data: ArrayList<Status>): Rec
|
||||
UNKNOWN -> "暂无轨迹"
|
||||
}
|
||||
}
|
||||
is OverViewStatus -> {
|
||||
""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 291 B |
Binary file not shown.
|
After Width: | Height: | Size: 291 B |
@@ -41,6 +41,7 @@ class WarningFloat {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 浮窗的属性构建类,支持链式调用
|
||||
*/
|
||||
@@ -136,6 +137,10 @@ class WarningFloat {
|
||||
config.immersionStatusBar = immersionStatusBar
|
||||
}
|
||||
|
||||
fun slideDel(status: Boolean) = apply {
|
||||
this.config.defaultSlideDel = status
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置浮窗的出入动画
|
||||
* @param floatAnimator 浮窗的出入动画,为空时不执行动画
|
||||
@@ -194,7 +199,10 @@ class WarningFloat {
|
||||
content?.let {
|
||||
config.layoutId = null
|
||||
config.layoutView = it
|
||||
Reminder.enqueue(getLifecycleOwner(activity), WarningFloatReminder(activity, config, it))
|
||||
Reminder.enqueue(
|
||||
getLifecycleOwner(activity),
|
||||
WarningFloatReminder(activity, config, it)
|
||||
)
|
||||
}
|
||||
} else {
|
||||
WarningFloatWindowManager.create(activity, config)
|
||||
@@ -214,7 +222,11 @@ class WarningFloat {
|
||||
}
|
||||
|
||||
|
||||
internal class WarningFloatReminder(private val activity: Context, private val config: WarningNotificationConfig, content: View): ViewReminder(content) {
|
||||
internal class WarningFloatReminder(
|
||||
private val activity: Context,
|
||||
private val config: WarningNotificationConfig,
|
||||
content: View
|
||||
) : ViewReminder(content) {
|
||||
|
||||
private var hasShow = false
|
||||
|
||||
@@ -235,7 +247,8 @@ class WarningFloat {
|
||||
}
|
||||
}
|
||||
|
||||
fun isShow(): Boolean = WarningFloatWindowManager.getHelper(config.floatTag)?.isShow() ?: false
|
||||
fun isShow(): Boolean =
|
||||
WarningFloatWindowManager.getHelper(config.floatTag)?.isShow() ?: false
|
||||
|
||||
fun resetExpireTime(expireTime: Long) {
|
||||
if (!isShow()) {
|
||||
|
||||
@@ -128,7 +128,9 @@ internal class WarningFloatWindowHelper(
|
||||
|
||||
// 设置触摸监听,直接关掉弹窗
|
||||
frameLayout?.setOnTouchListener { _, _ ->
|
||||
exitAnim()
|
||||
if(config.defaultSlideDel){
|
||||
exitAnim()
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,10 @@ data class WarningNotificationConfig(
|
||||
var width: Int = WindowManager.LayoutParams.WRAP_CONTENT,
|
||||
|
||||
// 窗口高度
|
||||
var height: Int = WindowManager.LayoutParams.WRAP_CONTENT
|
||||
var height: Int = WindowManager.LayoutParams.WRAP_CONTENT,
|
||||
|
||||
// 默认滑动删除
|
||||
var defaultSlideDel :Boolean = true
|
||||
) {
|
||||
var isEnqueue: Boolean = false
|
||||
var isOverride: Boolean = true
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.mogo.eagle.core.data.enums.WarningDirectionEnum
|
||||
import com.mogo.eagle.core.data.map.Infrastructure
|
||||
import com.mogo.eagle.core.data.biz.notice.NoticeNormalData
|
||||
import com.mogo.eagle.core.data.biz.notice.NoticeTrafficStylePushData
|
||||
import com.mogo.eagle.core.data.status.StatusSummaryEntity
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoHmiProvider
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
|
||||
import com.mogo.eagle.core.function.call.hmi.*
|
||||
@@ -33,6 +34,7 @@ import com.mogo.eagle.core.function.hmi.ui.notice.DispatchDialogManager
|
||||
import com.mogo.eagle.core.function.hmi.ui.notice.NoticeCheckDialog
|
||||
import com.mogo.eagle.core.function.hmi.ui.notice.traffic.NoticeTrafficDialog
|
||||
import com.mogo.eagle.core.function.hmi.ui.setting.CameraLiveView.Companion.cameraLiveView
|
||||
import com.mogo.eagle.core.function.hmi.ui.setting.StatusView
|
||||
import com.mogo.eagle.core.function.hmi.ui.setting.ToolsView.Companion.toolsView
|
||||
import com.mogo.eagle.core.function.hmi.ui.tools.AdUpgradeDialog
|
||||
import com.mogo.eagle.core.function.hmi.ui.tools.ModifyBindingCarDialog
|
||||
@@ -357,4 +359,7 @@ class MoGoHmiProvider : IMoGoHmiProvider {
|
||||
override fun is360LookAroundShowing(): Boolean {
|
||||
return lookAround.get()?.isShowing() ?: false
|
||||
}
|
||||
override fun showStatusSummaryDialog() {
|
||||
context?.let { StatusView.statusView.toggle(it) }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.setting
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.data.status.StatusSummaryEntity
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
|
||||
class StatusSummaryAdapter(private val ctx: Context, var data: ArrayList<StatusSummaryEntity>): RecyclerView.Adapter<StatusSummaryAdapter.StatusViewHolder>() {
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = StatusViewHolder(
|
||||
LayoutInflater.from(ctx).inflate(R.layout.item_status_summary_layout, parent, false))
|
||||
|
||||
override fun getItemCount(): Int = data.size
|
||||
|
||||
override fun onBindViewHolder(holder: StatusViewHolder, position: Int) {
|
||||
holder.bind(data[position])
|
||||
}
|
||||
|
||||
class StatusViewHolder(item: View) : RecyclerView.ViewHolder(item) {
|
||||
private val ivFuncView: ImageView by lazy {
|
||||
itemView.findViewById(R.id.ivFuncView)
|
||||
}
|
||||
|
||||
private val tvStatusDesc: TextView by lazy {
|
||||
itemView.findViewById(R.id.tvStatusDesc)
|
||||
}
|
||||
|
||||
fun bind(entity: StatusSummaryEntity) {
|
||||
when(entity.type) {
|
||||
0 -> {
|
||||
ivFuncView.setImageResource(R.drawable.driver_server)
|
||||
}
|
||||
1 -> {
|
||||
ivFuncView.setImageResource(R.drawable.gps)
|
||||
}
|
||||
2 -> {
|
||||
ivFuncView.setImageResource(R.drawable.cloud_socket)
|
||||
}
|
||||
3 -> {
|
||||
ivFuncView.setImageResource(R.drawable.tracing)
|
||||
}
|
||||
}
|
||||
if (entity.isException) {
|
||||
tvStatusDesc.setTextColor(Color.parseColor("#FF4444"))
|
||||
} else {
|
||||
tvStatusDesc.setTextColor(Color.parseColor("#FFFFFF"))
|
||||
}
|
||||
tvStatusDesc.text = entity.desc
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.setting
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.FrameLayout
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.commons.module.status.IMogoStatusChangedListener
|
||||
import com.mogo.commons.module.status.MogoStatusManager
|
||||
import com.mogo.commons.module.status.StatusDescriptor
|
||||
import com.mogo.eagle.core.data.status.StatusSummaryEntity
|
||||
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
|
||||
import com.mogo.eagle.core.function.api.telematic.IConnectStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicStatusListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.kotlin.PX
|
||||
import com.mogo.eagle.core.utilcode.rv.divider.CommonDividerItemDecoration
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
|
||||
/**
|
||||
* 状态汇总View控件
|
||||
*/
|
||||
class StatusSummaryView@JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : FrameLayout(
|
||||
context,
|
||||
attrs,
|
||||
defStyleAttr
|
||||
), IConnectStatusListener, IMogoStatusChangedListener,
|
||||
IMoGoDevaToolsListener {
|
||||
companion object{
|
||||
private const val TAG = "SummaryStatusView"
|
||||
}
|
||||
|
||||
private var clickListener: ClickListener? = null
|
||||
private var rvStatusView: RecyclerView? = null
|
||||
private var adapter: StatusSummaryAdapter? = null
|
||||
private val data by lazy {
|
||||
ArrayList<StatusSummaryEntity>().also {
|
||||
it.add(StatusSummaryEntity(0))
|
||||
it.add(StatusSummaryEntity(1))
|
||||
it.add(StatusSummaryEntity(2))
|
||||
it.add(StatusSummaryEntity(3))
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_status_summary_layout, this, true)
|
||||
initView()
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerDevaToolsListenerManager.addListener(TAG, this)
|
||||
// 司机屏Server服务是否开启的状态
|
||||
CallerTelematicStatusListenerManager.addListener(TAG, this)
|
||||
// 云socket连接状态
|
||||
MogoStatusManager.getInstance()
|
||||
.registerStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this)
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
rvStatusView = findViewById(R.id.rvStatusView)
|
||||
rvStatusView?.let {
|
||||
it.itemAnimator?.apply {
|
||||
changeDuration = 0
|
||||
addDuration = 0
|
||||
moveDuration = 0
|
||||
removeDuration = 0
|
||||
}
|
||||
it.layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
|
||||
it.addItemDecoration(
|
||||
CommonDividerItemDecoration.Builder()
|
||||
.spanCountTBCare(false)
|
||||
.horizontalInnerSpace(10.PX)
|
||||
.build())
|
||||
StatusSummaryAdapter(context, data).apply {
|
||||
adapter = this
|
||||
it.adapter = this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun setClickListener(clickListener: ClickListener) {
|
||||
this.clickListener = clickListener
|
||||
}
|
||||
|
||||
interface ClickListener {
|
||||
fun showWindow(show: Boolean)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
// 司机屏Server服务是否开启的状态
|
||||
CallerTelematicStatusListenerManager.removeListener(TAG)
|
||||
CallerDevaToolsListenerManager.removeListener(TAG)
|
||||
// 云socket连接状态
|
||||
MogoStatusManager.getInstance()
|
||||
.unregisterStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this)
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
/**
|
||||
* 司机屏服务是否启动的状态
|
||||
*/
|
||||
override fun onServerStatusChanged(isStarted: Boolean) {
|
||||
super.onServerStatusChanged(isStarted)
|
||||
UiThreadHandler.post({
|
||||
if (data.size < 1) return@post
|
||||
data[0].desc = "司机屏Server启动${if (isStarted) "正常" else "异常"}"
|
||||
data[0].isException = !isStarted
|
||||
adapter?.notifyItemChanged(0)
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
override fun gpsStatus(status: Boolean) {
|
||||
super.gpsStatus(status)
|
||||
UiThreadHandler.post({
|
||||
if (data.size < 2) return@post
|
||||
data[1].desc = "GPS${if (status) "正常" else "异常"}"
|
||||
data[1].isException = !status
|
||||
adapter?.notifyItemChanged(1)
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
/**
|
||||
* 云Socket
|
||||
*/
|
||||
override fun onStatusChanged(descriptor: StatusDescriptor?, isTrue: Boolean) {
|
||||
if (StatusDescriptor.CLOUD_SOCKET == descriptor) {
|
||||
UiThreadHandler.post({
|
||||
if (data.size < 3) return@post
|
||||
data[2].desc = "云Socket连接${if (isTrue) "正常" else "异常"}"
|
||||
data[2].isException = !isTrue
|
||||
adapter?.notifyItemChanged(2)
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
}
|
||||
|
||||
override fun tracingStatus(status: Boolean) {
|
||||
super.tracingStatus(status)
|
||||
// 发送事件前限制了频率
|
||||
UiThreadHandler.post({
|
||||
if (data.size < 4) return@post
|
||||
data[3].desc = "寻迹算路${if (status) "正常" else "异常"}"
|
||||
data[3].isException = !status
|
||||
adapter?.notifyItemChanged(3)
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.setting
|
||||
|
||||
import android.animation.Animator
|
||||
import android.content.Context
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.view.WindowManager
|
||||
import android.view.animation.OvershootInterpolator
|
||||
import com.mogo.eagle.core.data.enums.SidePattern
|
||||
import com.mogo.eagle.core.data.status.StatusSummaryEntity
|
||||
import com.mogo.eagle.core.function.hmi.notification.WarningFloat
|
||||
import com.mogo.eagle.core.function.hmi.notification.anim.DefaultAnimator
|
||||
import com.mogo.eagle.core.utilcode.util.BarUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ScreenUtils
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
|
||||
/**
|
||||
* 汇总状态View的管理类
|
||||
*/
|
||||
class StatusView private constructor() {
|
||||
|
||||
private var mStatusSummaryViewFloat: WarningFloat.Builder? = null
|
||||
private var mStatusSummaryView: StatusSummaryView? = null
|
||||
|
||||
companion object {
|
||||
val statusView by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
StatusView()
|
||||
}
|
||||
}
|
||||
|
||||
fun toggle(context: Context, gravity: Int = Gravity.RIGHT, sidePattern: SidePattern = SidePattern.RIGHT) {
|
||||
if (mStatusSummaryViewFloat != null) {
|
||||
dismiss()
|
||||
} else {
|
||||
if (mStatusSummaryView == null) {
|
||||
mStatusSummaryView = StatusSummaryView(context)
|
||||
mStatusSummaryView?.setClickListener(object : StatusSummaryView.ClickListener {
|
||||
override fun showWindow(show: Boolean) {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
val height = AutoSizeUtils.dp2px(context, 1100f)
|
||||
val maxHeight = ScreenUtils.getScreenHeight() - BarUtils.getStatusBarHeight()
|
||||
val currentHeight = if(height>maxHeight) maxHeight else height
|
||||
mStatusSummaryViewFloat = WarningFloat.with(context)
|
||||
.setTag("StatusSummaryView")
|
||||
.setLayout(mStatusSummaryView!!)
|
||||
.setSidePattern(sidePattern)
|
||||
.setGravity(gravity, offsetY = 70)
|
||||
.setImmersionStatusBar(true)
|
||||
.slideDel(false)
|
||||
.setWindowHeight(currentHeight)
|
||||
.setWindowWidth(AutoSizeUtils.dp2px(context, 600f))
|
||||
.setAnimator(object : DefaultAnimator() {
|
||||
override fun enterAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.enterAnim(view, params, windowManager, sidePattern)
|
||||
?.apply {
|
||||
interpolator = OvershootInterpolator()
|
||||
}
|
||||
|
||||
override fun exitAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.exitAnim(view, params, windowManager, sidePattern)
|
||||
?.setDuration(200)
|
||||
})
|
||||
.show()
|
||||
}
|
||||
}
|
||||
|
||||
fun dismiss() {
|
||||
mStatusSummaryViewFloat?.let {
|
||||
WarningFloat.dismiss(it.config.floatTag, false)
|
||||
mStatusSummaryViewFloat = null
|
||||
mStatusSummaryView = null
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 480 B |
Binary file not shown.
|
After Width: | Height: | Size: 425 B |
Binary file not shown.
|
After Width: | Height: | Size: 487 B |
Binary file not shown.
|
After Width: | Height: | Size: 319 B |
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.mogo.eagle.core.widget.RoundConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="@dimen/dp_600"
|
||||
android:layout_height="@dimen/dp_80"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
app:roundLayoutRadius="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:layout_marginBottom="@dimen/dp_12"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivFuncView"
|
||||
android:layout_width="@dimen/dp_64"
|
||||
android:layout_height="@dimen/dp_64"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:scaleType="fitCenter"
|
||||
android:layout_marginStart="12dp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvStatusDesc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="已连接xxxxxxxxxxxxxxxx"
|
||||
android:textSize="@dimen/dp_20"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginEnd="10dp"
|
||||
/>
|
||||
|
||||
</com.mogo.eagle.core.widget.RoundConstraintLayout>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="@dimen/dp_600"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/notice_dialog_check_background"
|
||||
tools:ignore="MissingDefaultResource">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:text="状态汇总:"
|
||||
android:textSize="@dimen/dp_32"
|
||||
android:textColor="#FFFFFF"
|
||||
/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvStatusView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvTitle"
|
||||
android:layout_marginTop="12dp"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.mogo.eagle.core.data.status
|
||||
|
||||
/**
|
||||
* 状态汇总
|
||||
*/
|
||||
data class StatusSummaryEntity(
|
||||
var type: Int,
|
||||
var desc: String = "",
|
||||
var isException: Boolean = false
|
||||
)
|
||||
@@ -55,4 +55,11 @@ interface IMoGoDevaToolsListener {
|
||||
|
||||
}
|
||||
|
||||
fun gpsStatus(status:Boolean) {// true:开启并授权
|
||||
|
||||
}
|
||||
|
||||
fun tracingStatus(status:Boolean) {// true:未异常
|
||||
|
||||
}
|
||||
}
|
||||
@@ -148,4 +148,5 @@ interface IMoGoHmiProvider :IProvider{
|
||||
* 360环视弹窗是否正在展示
|
||||
*/
|
||||
fun is360LookAroundShowing(): Boolean
|
||||
fun showStatusSummaryDialog()
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.mogo.eagle.core.function.api.telematic
|
||||
|
||||
interface IConnectStatusListener {
|
||||
fun onServerStatusChanged(isStarted: Boolean) {}
|
||||
}
|
||||
@@ -6,6 +6,15 @@ import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
|
||||
object CallerDevaToolsListenerManager : CallerBase<IMoGoDevaToolsListener>() {
|
||||
|
||||
private var gpsStatus: Boolean = true
|
||||
private var tracingStatus: Boolean = true
|
||||
|
||||
override fun doSomeAfterAddListener(tag: String, listener: IMoGoDevaToolsListener) {
|
||||
super.doSomeAfterAddListener(tag, listener)
|
||||
listener.gpsStatus(gpsStatus)
|
||||
listener.tracingStatus(tracingStatus)
|
||||
}
|
||||
|
||||
fun invokeDevaToolsLogCatchStart() {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
@@ -62,4 +71,19 @@ object CallerDevaToolsListenerManager : CallerBase<IMoGoDevaToolsListener>() {
|
||||
}
|
||||
}
|
||||
|
||||
fun invokeGpsStatus(status: Boolean) {
|
||||
gpsStatus = status
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.gpsStatus(status)
|
||||
}
|
||||
}
|
||||
|
||||
fun invokeTracingStatus(status: Boolean) {
|
||||
tracingStatus = status
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.tracingStatus(status)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -219,4 +219,8 @@ object CallerHmiManager {
|
||||
fun isM1360LookAroundShowing(): Boolean {
|
||||
return hmiProviderApi?.is360LookAroundShowing() ?: false
|
||||
}
|
||||
|
||||
fun showStatusSummaryDialog() {
|
||||
hmiProviderApi?.showStatusSummaryDialog()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.mogo.eagle.core.function.call.telematic
|
||||
|
||||
import android.util.Log
|
||||
import com.mogo.eagle.core.function.api.telematic.IConnectStatusListener
|
||||
import com.mogo.eagle.core.function.api.telematic.IReceivedMsgListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
|
||||
object CallerTelematicStatusListenerManager: CallerBase<IConnectStatusListener>() {
|
||||
|
||||
private const val TAG = "CallerTelematicStatusListenerManager"
|
||||
|
||||
private var isServerStarted = false
|
||||
|
||||
override fun doSomeAfterAddListener(tag: String, listener: IConnectStatusListener) {
|
||||
super.doSomeAfterAddListener(tag, listener)
|
||||
listener.onServerStatusChanged(isServerStarted)
|
||||
}
|
||||
|
||||
fun invokeServerStatusChanged(isStarted: Boolean) {
|
||||
isServerStarted = isStarted
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
try {
|
||||
listener.onServerStatusChanged(isStarted)
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "转发出现异常:${e.message}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user