[6.2.6][小智形象] 添加v2n小智形象状态回调
This commit is contained in:
@@ -23,6 +23,9 @@ import com.mogo.eagle.core.data.enums.WarningDirectionEnum
|
||||
import com.mogo.eagle.core.data.map.Infrastructure
|
||||
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.api.hmi.xiaozhi.event.Event
|
||||
import com.mogo.eagle.core.function.api.hmi.xiaozhi.listener.OnXiaoZhiStateChangeListener
|
||||
import com.mogo.eagle.core.function.api.hmi.xiaozhi.state.State
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerTurnLightListenerManager
|
||||
@@ -40,6 +43,7 @@ import com.mogo.eagle.core.function.hmi.ui.tools.ToBindingCarDialog
|
||||
import com.mogo.eagle.core.function.hmi.ui.tools.UpgradeAppDialog
|
||||
import com.mogo.eagle.core.function.hmi.ui.utils.HmiActionLog
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.StatusBarView
|
||||
import com.mogo.eagle.core.function.hmi.xiaozhi.XiaoZhiStateManager
|
||||
import com.mogo.eagle.core.utilcode.floating.MoGoPopWindow
|
||||
import com.mogo.eagle.core.utilcode.kotlin.safeCancel
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
@@ -77,6 +81,8 @@ class MoGoHmiProvider : IMoGoHmiProvider {
|
||||
|
||||
private val isPlayingTts by lazy { AtomicBoolean(false) }
|
||||
|
||||
private val xiaozhi by lazy { XiaoZhiStateManager() }
|
||||
|
||||
|
||||
override fun init(context: Context?) {
|
||||
this.context = context
|
||||
@@ -381,4 +387,15 @@ class MoGoHmiProvider : IMoGoHmiProvider {
|
||||
MogoStatusManager.getInstance().setTaxiUnmanedDriverLineRoutingVerifyMode(TAG, isMode)
|
||||
}
|
||||
|
||||
override fun registerXiaoZhiStatusChangeListener(listener: OnXiaoZhiStateChangeListener) {
|
||||
xiaozhi.addListener(listener)
|
||||
}
|
||||
|
||||
override fun unRegisterXiaoZhiStatusChangedListener(listener: OnXiaoZhiStateChangeListener) {
|
||||
xiaozhi.removeListener(listener)
|
||||
}
|
||||
|
||||
override fun notifyXiaoZhiStatusChanged(event: Event, state: State) {
|
||||
xiaozhi.notify(event, state)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.mogo.eagle.core.function.hmi.xiaozhi
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.eagle.core.function.api.hmi.xiaozhi.IXiaoZhiStateManager
|
||||
import com.mogo.eagle.core.function.api.hmi.xiaozhi.event.Event
|
||||
import com.mogo.eagle.core.function.api.hmi.xiaozhi.listener.OnXiaoZhiStateChangeListener
|
||||
import com.mogo.eagle.core.function.api.hmi.xiaozhi.state.State
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
|
||||
internal class XiaoZhiStateManager: IXiaoZhiStateManager {
|
||||
|
||||
private val listeners by lazy { CopyOnWriteArrayList<OnXiaoZhiStateChangeListener>() }
|
||||
|
||||
override fun init(context: Context?) {}
|
||||
|
||||
override fun addListener(listener: OnXiaoZhiStateChangeListener) {
|
||||
if (listeners.contains(listener)) {
|
||||
return
|
||||
}
|
||||
listeners.add(listener)
|
||||
}
|
||||
|
||||
override fun removeListener(listener: OnXiaoZhiStateChangeListener) {
|
||||
if (!listeners.contains(listener)) {
|
||||
return
|
||||
}
|
||||
listeners.remove(listener)
|
||||
}
|
||||
|
||||
override fun notify(event: Event, state: State) {
|
||||
listeners.forEach {
|
||||
it.onChanged(event, state)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,9 @@ 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.function.api.hmi.xiaozhi.event.Event
|
||||
import com.mogo.eagle.core.function.api.hmi.xiaozhi.listener.OnXiaoZhiStateChangeListener
|
||||
import com.mogo.eagle.core.function.api.hmi.xiaozhi.state.State
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
@@ -200,4 +203,18 @@ interface IMoGoHmiProvider :IProvider{
|
||||
*/
|
||||
fun setTaxiUnmanedDriverLineRoutingVerifyMode(isMode: Boolean)
|
||||
|
||||
/**
|
||||
* 添加小智形象展示的状态监听
|
||||
*/
|
||||
fun registerXiaoZhiStatusChangeListener(listener: OnXiaoZhiStateChangeListener)
|
||||
|
||||
/**
|
||||
* 移除小智形象展示的状态监听
|
||||
*/
|
||||
fun unRegisterXiaoZhiStatusChangedListener(listener: OnXiaoZhiStateChangeListener)
|
||||
|
||||
/**
|
||||
* 通知小智形象要变化了
|
||||
*/
|
||||
fun notifyXiaoZhiStatusChanged(event: Event, state: State)
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.mogo.eagle.core.function.api.hmi.xiaozhi
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider
|
||||
import com.mogo.eagle.core.function.api.hmi.xiaozhi.event.Event
|
||||
import com.mogo.eagle.core.function.api.hmi.xiaozhi.listener.OnXiaoZhiStateChangeListener
|
||||
import com.mogo.eagle.core.function.api.hmi.xiaozhi.state.State
|
||||
|
||||
interface IXiaoZhiStateManager : IProvider {
|
||||
|
||||
fun addListener(listener: OnXiaoZhiStateChangeListener)
|
||||
|
||||
fun removeListener(listener: OnXiaoZhiStateChangeListener)
|
||||
|
||||
fun notify(event: Event, state: State)
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.mogo.eagle.core.function.api.hmi.xiaozhi.event
|
||||
|
||||
enum class Event {
|
||||
|
||||
V2N
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.mogo.eagle.core.function.api.hmi.xiaozhi.listener
|
||||
|
||||
import com.mogo.eagle.core.function.api.hmi.xiaozhi.event.Event
|
||||
import com.mogo.eagle.core.function.api.hmi.xiaozhi.state.State
|
||||
|
||||
interface OnXiaoZhiStateChangeListener {
|
||||
|
||||
fun onChanged(event: Event, state: State)
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.mogo.eagle.core.function.api.hmi.xiaozhi.state
|
||||
|
||||
enum class State {
|
||||
|
||||
START,
|
||||
DOING,
|
||||
STOP
|
||||
}
|
||||
@@ -13,6 +13,9 @@ import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_NON
|
||||
import com.mogo.eagle.core.data.map.Infrastructure
|
||||
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.api.hmi.xiaozhi.event.Event
|
||||
import com.mogo.eagle.core.function.api.hmi.xiaozhi.listener.OnXiaoZhiStateChangeListener
|
||||
import com.mogo.eagle.core.function.api.hmi.xiaozhi.state.State
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
@@ -294,4 +297,24 @@ object CallerHmiManager {
|
||||
hmiProviderApi?.setTaxiUnmanedDriverLineRoutingVerifyMode(isMode)
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加小智形象展示的状态监听
|
||||
*/
|
||||
fun registerXiaoZhiStatusChangeListener(listener: OnXiaoZhiStateChangeListener) {
|
||||
hmiProviderApi?.registerXiaoZhiStatusChangeListener(listener)
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除小智形象展示的状态监听
|
||||
*/
|
||||
fun unRegisterXiaoZhiStatusChangedListener(listener: OnXiaoZhiStateChangeListener) {
|
||||
hmiProviderApi?.unRegisterXiaoZhiStatusChangedListener(listener)
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知小智形象要变化了
|
||||
*/
|
||||
fun notifyXiaoZhiStatusChanged(event: Event, state: State) {
|
||||
hmiProviderApi?.notifyXiaoZhiStatusChanged(event, state)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user