From 775ec4be602aff2f333883c263e20706fae7bcee Mon Sep 17 00:00:00 2001 From: zhongchao Date: Tue, 10 Jan 2023 10:17:35 +0800 Subject: [PATCH] [2.13.2] wait to test --- .../scene/SceneManager.kt | 4 +- .../business/ai/AiCloudIdentifyData.kt | 38 ----------- .../business/ai/AiCloudIdentifyDataManager.kt | 54 ++++++++++++++++ .../ai/net/AiCloudIdentifyNetWorkModel.kt | 63 +++++++++++++++++++ .../ai/net/IAiCloudIdentifyApiService.kt | 11 ++++ .../eagle/core/function/map/MapFragment.java | 4 +- 6 files changed, 132 insertions(+), 42 deletions(-) delete mode 100644 core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/ai/AiCloudIdentifyData.kt create mode 100644 core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/ai/AiCloudIdentifyDataManager.kt create mode 100644 core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/ai/net/AiCloudIdentifyNetWorkModel.kt create mode 100644 core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/ai/net/IAiCloudIdentifyApiService.kt diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/scene/SceneManager.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/scene/SceneManager.kt index 329b2ff2ab..7ac30b517d 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/scene/SceneManager.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/scene/SceneManager.kt @@ -56,8 +56,8 @@ class SceneManager { sceneModuleTAG.map[DEVA] = SceneModule(false, M_DEVA) sceneModuleTAG.map[HMI] = SceneModule(false, M_HMI) sceneModuleTAG.map[OBU] = SceneModule(false, M_OBU) - sceneModuleTAG.map[V2X] = SceneModule(false, M_V2X) - sceneModuleTAG.map[MAP] = SceneModule(false, M_MAP) + sceneModuleTAG.map[V2X] = SceneModule(true, M_V2X) + sceneModuleTAG.map[MAP] = SceneModule(true, M_MAP) sceneModuleTAG.map[ROUTE] = SceneModule(true, M_OLD_ROUTE) sceneModuleTAG.map[NET] = SceneModule(true, M_NETWORK) sceneModuleTAG.map[BUS] = SceneModule(true, M_BUS) diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/ai/AiCloudIdentifyData.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/ai/AiCloudIdentifyData.kt deleted file mode 100644 index fca6942f1e..0000000000 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/ai/AiCloudIdentifyData.kt +++ /dev/null @@ -1,38 +0,0 @@ -package com.mogo.eagle.core.function.business.ai - -import android.content.Context -import com.mogo.cloud.socket.entity.SocketDownData - -import com.mogo.commons.debug.DebugConfig -import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger -import com.mogo.realtime.api.MoGoAiCloudRealTime -import com.mogo.realtime.socket.IMogoCloudOnMsgListener - -class AiCloudIdentifyData{ - - companion object{ - private const val TAG = "AiCloudIdentifyData" - - @JvmStatic - val aiCloudIdentifyData by lazy(LazyThreadSafetyMode.SYNCHRONIZED){ - AiCloudIdentifyData() - } - } - - fun init(mContext:Context){ - //todo emArrow - MoGoAiCloudRealTime.startRealTime(mContext, DebugConfig.getSocketAppId()) - MoGoAiCloudRealTime.registerOnMsgListener(object :IMogoCloudOnMsgListener { - override fun onMsgSend(id: Long) { - } - - override fun onMsgReceived(mogoSnapshotSetData: SocketDownData.LauncherSnapshotProto?) { - mogoSnapshotSetData?.let { - CallerLogger.d(TAG,"mogoSnapshotSetData : $mogoSnapshotSetData") - } - } - - }) - } - -} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/ai/AiCloudIdentifyDataManager.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/ai/AiCloudIdentifyDataManager.kt new file mode 100644 index 0000000000..f00ba5b09c --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/ai/AiCloudIdentifyDataManager.kt @@ -0,0 +1,54 @@ +package com.mogo.eagle.core.function.business.ai + +import android.content.Context +import com.mogo.cloud.socket.entity.SocketDownData +import com.mogo.eagle.core.function.business.ai.net.AiCloudIdentifyNetWorkModel +import com.mogo.eagle.core.function.business.identify.MapIdentifySubscriber +import com.mogo.eagle.core.function.call.map.CallerMapIdentifyManager +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP +import com.mogo.realtime.api.MoGoAiCloudRealTime +import com.mogo.realtime.socket.IMogoCloudOnMsgListener + +class AiCloudIdentifyDataManager { + + companion object { + private const val TAG = "AiCloudIdentifyData" + + @JvmStatic + val aiCloudIdentifyDataManager by lazy(LazyThreadSafetyMode.SYNCHRONIZED) { + AiCloudIdentifyDataManager() + } + + const val START_METRE = 140 + const val END_METRE = 2000 + } + + private val aiCloudIdentifyNetWorkModel = AiCloudIdentifyNetWorkModel() + + fun init(mContext: Context) { + MoGoAiCloudRealTime.registerOnMsgListener(object : IMogoCloudOnMsgListener { + override fun onMsgSend(id: Long) { + } + + override fun onMsgReceived(mogoSnapshotSetData: SocketDownData.LauncherSnapshotProto?) { + mogoSnapshotSetData?.let { + CallerLogger.d(TAG, "mogoSnapshotSetData : $it") + //todo 感知数据转换 +// MapIdentifySubscriber.instance.onAutopilotIdentifyDataUpdate() + } + } + }) + changeRangeOfIdentify() + } + + //todo 加调试广播 + private fun changeRangeOfIdentify() { + aiCloudIdentifyNetWorkModel.requestIdentifyRange({ + CallerLogger.d(M_MAP + TAG, "requestIdentifyRange ok") + }, { + CallerLogger.d(M_MAP + TAG, "requestIdentifyRange error : $it") + }) + } + +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/ai/net/AiCloudIdentifyNetWorkModel.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/ai/net/AiCloudIdentifyNetWorkModel.kt new file mode 100644 index 0000000000..966e84a430 --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/ai/net/AiCloudIdentifyNetWorkModel.kt @@ -0,0 +1,63 @@ +package com.mogo.eagle.core.function.business.ai.net + +import com.mogo.cloud.passport.MoGoAiCloudClientConfig +import com.mogo.commons.debug.DebugConfig +import com.mogo.eagle.core.data.BaseResponse +import com.mogo.eagle.core.function.business.ai.AiCloudIdentifyDataManager.Companion.END_METRE +import com.mogo.eagle.core.function.business.ai.AiCloudIdentifyDataManager.Companion.START_METRE +import com.mogo.eagle.core.network.MoGoRetrofitFactory +import com.mogo.eagle.core.network.apiCall +import com.mogo.eagle.core.network.request +import com.zhjt.service_biz.FuncConfig + +class AiCloudIdentifyNetWorkModel { + + companion object { + val aiCloudIdentifyNetWorkModel by lazy(LazyThreadSafetyMode.SYNCHRONIZED) { + AiCloudIdentifyNetWorkModel() + } + } + + private fun getHost(): String { + var host = "https://dzt-city.zhidaozhixing.com" + when (DebugConfig.getNetMode()) { + DebugConfig.NET_MODE_DEV, + DebugConfig.NET_MODE_QA -> host = "https://dzt-qa-city.zhidaozhixing.com" + } + return host + } + + private fun getNetWorkApi(baseUrl: String = getHost()): IAiCloudIdentifyApiService { + return MoGoRetrofitFactory.getInstanceNoCallAdapter(baseUrl) + .create(IAiCloudIdentifyApiService::class.java) + } + + fun requestIdentifyRange( + onSuccess: (() -> Unit), + onError: ((String) -> Unit) + ) { + request> { + val map = mutableMapOf() + start { + map["sn"] = MoGoAiCloudClientConfig.getInstance().sn + map["status"] = true + map["startMetre"] = START_METRE + map["endMetre"] = END_METRE + map["type"] = 1 + } + loader { + apiCall { + getNetWorkApi().identifyRange(map) + } + } + onSuccess { + onSuccess.invoke() + } + onError { + it.message?.let { errorMsg -> + onError.invoke(errorMsg) + } + } + } + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/ai/net/IAiCloudIdentifyApiService.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/ai/net/IAiCloudIdentifyApiService.kt new file mode 100644 index 0000000000..a8050196a8 --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/ai/net/IAiCloudIdentifyApiService.kt @@ -0,0 +1,11 @@ +package com.mogo.eagle.core.function.business.ai.net + +import com.mogo.eagle.core.data.BaseResponse +import retrofit2.http.Body +import retrofit2.http.POST + +interface IAiCloudIdentifyApiService { + + @POST("yycp-c-v2x-service/dataFusion/remoteDrivingSet") + suspend fun identifyRange(@Body map: MutableMap): BaseResponse +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.java b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.java index 69bbf943ca..3420ce4ae9 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.java +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.java @@ -16,7 +16,7 @@ import com.mogo.eagle.core.data.map.CenterLine; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener; import com.mogo.eagle.core.function.api.map.hd.IMoGoMapFragmentProvider; import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener; -import com.mogo.eagle.core.function.business.ai.AiCloudIdentifyData; +import com.mogo.eagle.core.function.business.ai.AiCloudIdentifyDataManager; import com.mogo.eagle.core.function.business.identify.MapIdentifySubscriber; import com.mogo.eagle.core.function.business.MapPointCloudSubscriber; import com.mogo.eagle.core.function.business.routeoverlay.MogoRouteOverlayManager; @@ -193,7 +193,7 @@ public class MapFragment extends MvpFragment MapIdentifySubscriber.Companion.getInstance(); MogoRouteOverlayManager.getInstance().init(); MapPointCloudSubscriber.Companion.getInstance(); - AiCloudIdentifyData.Companion.getAiCloudIdentifyData().init(AbsMogoApplication.getApp()); + AiCloudIdentifyDataManager.Companion.getAiCloudIdentifyDataManager().init(AbsMogoApplication.getApp()); } private void queryInfStructure() {