diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/DataCenterProvider.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/DataCenterProvider.kt index 895fbc9706..dd8cb13fa5 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/DataCenterProvider.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/DataCenterProvider.kt @@ -4,7 +4,9 @@ import android.content.Context import com.alibaba.android.arouter.facade.annotation.Route import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.constants.MogoServicePaths +import com.mogo.eagle.core.function.api.datacenter.IDataCenterBizListener import com.mogo.eagle.core.function.api.datacenter.IDataCenterProvider +import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.mogo.eagle.core.function.datacenter.iot.IotManager @@ -14,31 +16,38 @@ import com.mogo.eagle.core.function.datacenter.v2x.TrafficLightDispatcher import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils @Route(path = MogoServicePaths.PATH_DATA_CENTER_MODULE) -class DataCenterProvider : IDataCenterProvider { +class DataCenterProvider : IDataCenterProvider, IDataCenterBizListener { override val functionName: String get() = "DataCenterProvider" private var mContext: Context? = null + private val TAG = "DataCenterProvider" override fun init(context: Context?) { MoGoLocationDispatcher.initListener() + CallerDataCenterBizListener.addListener(TAG,this) mContext = context mContext?.let { CallerDataCenterBizManager.init() CallerMsgBoxManager.queryAllMessages(it) TrafficLightDispatcher.INSTANCE.initServer(it) SpeedLimitDispatcher.INSTANCE.initLimit(it) - IotManager.init( - AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode), - AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode) - ) } } + override fun invokeVehicleChange() { + super.invokeVehicleChange() + IotManager.init( + AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode), + AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode) + ) + } + override fun onDestroy() { TrafficLightDispatcher.INSTANCE.destroy() SpeedLimitDispatcher.INSTANCE.destroy() IotManager.destroy() + CallerDataCenterBizListener.removeListener(TAG) } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/biz/DataCenterBizProvider.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/biz/DataCenterBizProvider.kt index a3db3c79ad..421c0054f6 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/biz/DataCenterBizProvider.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/biz/DataCenterBizProvider.kt @@ -49,6 +49,14 @@ class DataCenterBizProvider:IDataCenterBizProvider { CallerDataCenterBizListener.invokeLoginStatus(isLogin) } + override fun onProductChange() { + CallerDataCenterBizListener.invokeProductChange() + } + + override fun onVehicleChange() { + CallerDataCenterBizListener.invokeVehicleChange() + } + override fun onDestroy() { } diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/datacenter/IDataCenterBizListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/datacenter/IDataCenterBizListener.kt index cb7ab6d0f4..24530ce4a9 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/datacenter/IDataCenterBizListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/datacenter/IDataCenterBizListener.kt @@ -21,6 +21,10 @@ interface IDataCenterBizListener { fun invokeLoginStatus(isLogin: Boolean){} + fun invokeProductChange(){} + + fun invokeVehicleChange(){} + fun isLoginStatus(): Boolean{ return false } diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/och/IOchFunctionCallNotify.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/och/IOchFunctionCallNotify.kt index 4d3e687e22..91bccffa98 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/och/IOchFunctionCallNotify.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/och/IOchFunctionCallNotify.kt @@ -35,4 +35,10 @@ interface IOchFunctionCallNotify { // 登录状态变化 fun notifyLoginStatus(isLogin: Boolean) + //业务模式发生变化 + fun onProductChange() + + //车型发生变化 + fun onVehicleChange() + } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/datacenter/CallerDataCenterBizListener.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/datacenter/CallerDataCenterBizListener.kt index 2e6e6ae5d9..358e05c3b6 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/datacenter/CallerDataCenterBizListener.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/datacenter/CallerDataCenterBizListener.kt @@ -88,6 +88,18 @@ object CallerDataCenterBizListener : CallerBase() { } } + fun invokeProductChange(){ + M_LISTENERS.forEach{ + it.value.invokeProductChange() + } + } + + fun invokeVehicleChange(){ + M_LISTENERS.forEach{ + it.value.invokeVehicleChange() + } + } + fun isLoginStatus(): Boolean { return isLoginStatus.get() } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/datacenter/CallerDataCenterBizManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/datacenter/CallerDataCenterBizManager.kt index 29939a3444..dfe45a034f 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/datacenter/CallerDataCenterBizManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/datacenter/CallerDataCenterBizManager.kt @@ -48,4 +48,14 @@ object CallerDataCenterBizManager: IOchFunctionCallNotify { dataCenterBizProviderApi?.notifyLoginStatus(isLogin) } + //业务模式发生变化 + override fun onProductChange() { + dataCenterBizProviderApi?.onProductChange() + } + + //车型发生变化 + override fun onVehicleChange() { + dataCenterBizProviderApi?.onVehicleChange() + } + } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/och/CallerEagleBaseFunctionCall4OchManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/och/CallerEagleBaseFunctionCall4OchManager.kt index b251ac2c5c..4b21def2f9 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/och/CallerEagleBaseFunctionCall4OchManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/och/CallerEagleBaseFunctionCall4OchManager.kt @@ -131,11 +131,13 @@ object CallerEagleBaseFunctionCall4OchManager : IEagleBaseFunctionCall4Och { CallerDataCenterBizManager.notifyOrderRemoval() } + //业务模式发生变化 override fun onOchProductChange() { - + CallerDataCenterBizManager.onProductChange() } + //车型发生变化 override fun onOchVehicleChange() { - + CallerDataCenterBizManager.onVehicleChange() } } \ No newline at end of file