From 0a7ed0387e68c7fc1ac01985e89507e7b88e280d Mon Sep 17 00:00:00 2001 From: renwenjie Date: Fri, 5 Nov 2021 10:27:34 +0800 Subject: [PATCH 1/3] =?UTF-8?q?[Fix]=E8=A7=A3=E5=86=B3ALocationClien?= =?UTF-8?q?=E5=AE=9A=E4=BD=8D=E4=BF=A1=E6=81=AF=E5=9B=A0=E4=B8=BA=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E5=AE=9E=E6=97=B6=E4=B8=8A=E4=BC=A0=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99=E5=BD=93=E6=8E=A5=E5=85=A5=E5=B7=A5=E6=8E=A7=E6=9C=BA?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E5=9B=9E=E8=B0=83=E4=BF=A1=E6=81=AF=E4=BC=9A?= =?UTF-8?q?=E4=B8=A2=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 移除日志 --- .../mogo-core-function-map/build.gradle | 2 +- .../impl/map/MoGoLocationUpdater4AutoPilot.kt | 34 +++++++++++++++++++ .../core/data/constants/MogoServicePaths.java | 8 +++++ .../IMoGoLocationUpdater4AutoPilot.kt | 13 +++++++ .../call/map/CallerLocationUpdaterManager.kt | 18 ++++++++++ .../mogo/map/impl/custom/AMapViewWrapper.java | 2 ++ .../impl/custom/location/ALocationClient.java | 22 ++++++++++++ .../map/location/IMogoLocationClient.java | 6 ++++ .../java/com/mogo/map/MogoLocationClient.java | 7 ++++ 9 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/impl/map/MoGoLocationUpdater4AutoPilot.kt create mode 100644 core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/location/IMoGoLocationUpdater4AutoPilot.kt create mode 100644 core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerLocationUpdaterManager.kt diff --git a/core/function-impl/mogo-core-function-map/build.gradle b/core/function-impl/mogo-core-function-map/build.gradle index 0cf2df7226..80d2375f93 100644 --- a/core/function-impl/mogo-core-function-map/build.gradle +++ b/core/function-impl/mogo-core-function-map/build.gradle @@ -50,8 +50,8 @@ dependencies { implementation rootProject.ext.dependencies.rxandroid kapt rootProject.ext.dependencies.aroutercompiler - implementation rootProject.ext.dependencies.adasHigh + implementation project(':modules:mogo-module-common') if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { implementation rootProject.ext.dependencies.mogo_core_data diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/impl/map/MoGoLocationUpdater4AutoPilot.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/impl/map/MoGoLocationUpdater4AutoPilot.kt new file mode 100644 index 0000000000..6f0ddd336d --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/impl/map/MoGoLocationUpdater4AutoPilot.kt @@ -0,0 +1,34 @@ +package com.mogo.eagle.core.function.impl.map + +import android.content.Context +import com.alibaba.android.arouter.facade.annotation.Route +import com.mogo.eagle.core.data.constants.MogoServicePaths +import com.mogo.eagle.core.function.api.map.location.IMoGoLocationUpdater4AutoPilot +import com.mogo.eagle.core.utilcode.util.Utils +import com.mogo.module.common.MogoApisHandler +import com.mogo.service.IMogoServiceApis + + +@Route(path = MogoServicePaths.PATH_MAP_LOCATION_UPDATE_4_AUTO_PILOT) +class MoGoLocationUpdater4AutoPilot: IMoGoLocationUpdater4AutoPilot { + + private val TAG = "MoGoLocationUpdater4AutoPilot" + + override val functionName = TAG; + + private val api: IMogoServiceApis? by lazy { + MogoApisHandler.getInstance().apis + } + + override fun updateLocation(location: Any?) { + api?.mapServiceApi?.getSingletonLocationClient(Utils.getApp())?.updateLocation(location); + } + + override fun init(context: Context?) { + //DO NOTING + } + + override fun onDestroy() { + //DO NOTHING + } +} \ No newline at end of file diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/constants/MogoServicePaths.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/constants/MogoServicePaths.java index 6139a3b512..0decc8e078 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/constants/MogoServicePaths.java +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/constants/MogoServicePaths.java @@ -375,4 +375,12 @@ public class MogoServicePaths { @Keep @Deprecated public static final String PATH_AI_MONITORING = "/monitoring/api"; + + + /** + * 自动驾驶时,定位信息改变要同步更新 + */ + @Keep + @Deprecated + public static final String PATH_MAP_LOCATION_UPDATE_4_AUTO_PILOT = "/map_x/location_update"; } diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/location/IMoGoLocationUpdater4AutoPilot.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/location/IMoGoLocationUpdater4AutoPilot.kt new file mode 100644 index 0000000000..6e5e77deb1 --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/location/IMoGoLocationUpdater4AutoPilot.kt @@ -0,0 +1,13 @@ +package com.mogo.eagle.core.function.api.map.location + +import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider + +/** + * @author renwj + * @date 2021/11/04 16:10 下午 + * 此类主要用来同步自动驾驶定位信息给各业务方 + */ +interface IMoGoLocationUpdater4AutoPilot : IMoGoFunctionServerProvider { + + fun updateLocation(location: Any?) +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerLocationUpdaterManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerLocationUpdaterManager.kt new file mode 100644 index 0000000000..2532c984c2 --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerLocationUpdaterManager.kt @@ -0,0 +1,18 @@ +package com.mogo.eagle.core.function.call.map + +import com.mogo.eagle.core.data.constants.MogoServicePaths +import com.mogo.eagle.core.function.api.map.location.IMoGoLocationUpdater4AutoPilot +import com.mogo.eagle.core.function.call.base.CallerBase + +object CallerLocationUpdaterManager { + + private val updater : IMoGoLocationUpdater4AutoPilot? by lazy { + CallerBase.getApiInstance( + IMoGoLocationUpdater4AutoPilot::class.java, + MogoServicePaths.PATH_MAP_LOCATION_UPDATE_4_AUTO_PILOT) + } + + fun updateLocation(location: Any?) { + updater?.updateLocation(location); + } +} \ No newline at end of file diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java index 0c437d2bc9..83b062a33f 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java @@ -23,6 +23,7 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig; import com.mogo.commons.constants.SharedPrefsConstants; import com.mogo.commons.debug.DebugConfig; import com.mogo.eagle.core.data.map.MogoLatLng; +import com.mogo.eagle.core.function.call.map.CallerLocationUpdaterManager; import com.mogo.map.IMogoMap; import com.mogo.map.IMogoMapView; import com.mogo.map.impl.custom.location.GpsTester; @@ -1071,6 +1072,7 @@ public class AMapViewWrapper implements IMogoMapView, bean.setLat(lat); // 使用外部定位数据修改自车位置 mMapView.getLocationClient().updateRTKAutoPilotLocation(bean); + CallerLocationUpdaterManager.INSTANCE.updateLocation(bean); } } diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/location/ALocationClient.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/location/ALocationClient.java index 91bb83acdb..f2bc34327a 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/location/ALocationClient.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/location/ALocationClient.java @@ -11,6 +11,7 @@ import com.mogo.map.location.MogoLocationListenerRegister; import com.mogo.utils.logger.Logger; import com.zhidaoauto.map.sdk.open.location.LocationClient; import com.zhidaoauto.map.sdk.open.location.LocationListener; +import com.zhidaoauto.map.sdk.open.location.RTKAutopilotLocationBean; import org.jetbrains.annotations.NotNull; @@ -135,4 +136,25 @@ public class ALocationClient implements IMogoLocationClient { private void destroyWarming() { Logger.w( TAG, "location client has destroyed." ); } + + @Override + public void updateLocation(Object locationToUpdate) { + if (locationToUpdate == null) { + return; + } + if (locationToUpdate instanceof MogoLocation) { + return; + } + if (locationToUpdate instanceof RTKAutopilotLocationBean) { + MogoLocation last = getLastKnowLocation(); + RTKAutopilotLocationBean current = (RTKAutopilotLocationBean) locationToUpdate; + boolean isNeedUpdate = (last == null || last.getLatitude() != current.getLat() || last.getLongitude() != current.getLon()); + if (!isNeedUpdate) { + return; + } + if (mClient != null) { + mClient.updateRTKAutoPilotLocation(current); + } + } + } } diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/location/IMogoLocationClient.java b/libraries/mogo-map-api/src/main/java/com/mogo/map/location/IMogoLocationClient.java index b17912e41d..61310341a2 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/location/IMogoLocationClient.java +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/location/IMogoLocationClient.java @@ -35,4 +35,10 @@ public interface IMogoLocationClient extends IMogoLocationListenerRegister { MogoLocation getLastKnowLocation(); void destroy(); + + /** + * 更正最新的位置 + * @param locationToUpdate + */ + void updateLocation(Object locationToUpdate); } diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/MogoLocationClient.java b/libraries/mogo-map/src/main/java/com/mogo/map/MogoLocationClient.java index 520b5ce157..cf1a304533 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/MogoLocationClient.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/MogoLocationClient.java @@ -78,4 +78,11 @@ public class MogoLocationClient implements IMogoLocationClient { mDelegate.destroy(); } } + + @Override + public void updateLocation(Object locationToUpdate) { + if (mDelegate != null) { + mDelegate.updateLocation(locationToUpdate); + } + } } From b99fa18a48be76b9df2e2844b92217e204636d11 Mon Sep 17 00:00:00 2001 From: renwj Date: Fri, 5 Nov 2021 18:20:08 +0800 Subject: [PATCH 2/3] =?UTF-8?q?[Fix]=E4=BC=98=E5=8C=96=E5=9C=B0=E5=9B=BE?= =?UTF-8?q?=E5=AE=9A=E4=BD=8D=E5=9B=9E=E8=B0=83=E5=88=A4=E6=96=AD=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E9=9C=80=E8=A6=81=E6=9B=B4=E6=96=B0=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mogo/map/impl/custom/location/ALocationClient.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/location/ALocationClient.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/location/ALocationClient.java index f2bc34327a..90059ded7e 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/location/ALocationClient.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/location/ALocationClient.java @@ -152,6 +152,10 @@ public class ALocationClient implements IMogoLocationClient { if (!isNeedUpdate) { return; } + if (last != null) { + last.setLatitude(current.getLat()); + last.setLongitude(current.getLon()); + } if (mClient != null) { mClient.updateRTKAutoPilotLocation(current); } From 07f5133c6d3b48e347ee41ede20768ffbe2caf16 Mon Sep 17 00:00:00 2001 From: renwj Date: Fri, 5 Nov 2021 18:47:58 +0800 Subject: [PATCH 3/3] =?UTF-8?q?[Fix]=E6=9B=B4=E6=96=B0=E9=80=9A=E7=94=A8?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E4=BE=9D=E8=B5=96=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/function-impl/mogo-core-function-map/build.gradle | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/function-impl/mogo-core-function-map/build.gradle b/core/function-impl/mogo-core-function-map/build.gradle index 80d2375f93..522a2f928b 100644 --- a/core/function-impl/mogo-core-function-map/build.gradle +++ b/core/function-impl/mogo-core-function-map/build.gradle @@ -51,18 +51,19 @@ dependencies { kapt rootProject.ext.dependencies.aroutercompiler implementation rootProject.ext.dependencies.adasHigh - implementation project(':modules:mogo-module-common') if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { implementation rootProject.ext.dependencies.mogo_core_data implementation rootProject.ext.dependencies.mogo_core_utils implementation rootProject.ext.dependencies.mogo_core_function_api implementation rootProject.ext.dependencies.mogo_core_function_call + implementation rootProject.ext.dependencies.modulecommon } else { implementation project(':core:mogo-core-data') implementation project(':core:mogo-core-utils') implementation project(':core:mogo-core-function-api') implementation project(':core:mogo-core-function-call') + implementation project(':modules:mogo-module-common') } }