From bb22ec10d5be1d2a8e2023d68a0f1828082986c0 Mon Sep 17 00:00:00 2001 From: xinfengkun Date: Tue, 9 May 2023 15:33:08 +0800 Subject: [PATCH] =?UTF-8?q?[m1]=20=E6=B7=BB=E5=8A=A0M1=E6=8B=BC=E6=8E=A5?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E6=95=B0=E6=8D=AE=E8=AE=A2=E9=98=85=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E3=80=81=E6=B8=85=E6=89=AB=E8=BD=A6=E6=91=84=E5=83=8F?= =?UTF-8?q?=E5=A4=B4View=E5=92=8CM1=E6=91=84=E5=83=8F=E5=A4=B4View?= =?UTF-8?q?=E5=85=B1=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/res/layout/sweeper_base_fragment.xml | 2 +- .../autopilot/MoGoAutopilotControlProvider.kt | 16 ++++++++ .../autopilot/adapter/MoGoAdasListenerImpl.kt | 14 +++++++ ...eeperVideoView.java => MogoVideoView.java} | 37 +++++++++++++------ .../IMoGoAutopilotControlProvider.kt | 6 +++ ...MoGoRoboBusJinlvM1StitchedVideoListener.kt | 11 ++++++ .../CallerAutoPilotControlManager.kt | 8 ++++ ...oBusJinlvM1StitchedVideoListenerManager.kt | 20 ++++++++++ ...perFutianBackCameraVideoListenerManager.kt | 3 -- 9 files changed, 102 insertions(+), 15 deletions(-) rename core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/{SweeperVideoView.java => MogoVideoView.java} (65%) create mode 100644 core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoRoboBusJinlvM1StitchedVideoListener.kt create mode 100644 core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerRoboBusJinlvM1StitchedVideoListenerManager.kt diff --git a/OCH/sweeper/sweeper-cloud/src/main/res/layout/sweeper_base_fragment.xml b/OCH/sweeper/sweeper-cloud/src/main/res/layout/sweeper_base_fragment.xml index d9833a54ed..548ae4505e 100644 --- a/OCH/sweeper/sweeper-cloud/src/main/res/layout/sweeper_base_fragment.xml +++ b/OCH/sweeper/sweeper-cloud/src/main/res/layout/sweeper_base_fragment.xml @@ -100,7 +100,7 @@ android:layout_marginTop="@dimen/dp_27" app:roundLayoutRadius="@dimen/dp_16" > - target = new CustomTarget() { @@ -60,7 +65,7 @@ public class SweeperVideoView extends AppCompatImageView implements IMoGoSweeper public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition transition) { //回调内容 if (!resource.isRecycled()) { - SweeperVideoView.this.setImageBitmap(resource); + MogoVideoView.this.setImageBitmap(resource); } } @@ -70,18 +75,28 @@ public class SweeperVideoView extends AppCompatImageView implements IMoGoSweeper } }; - @Override - public void onSweeperFutianBackCameraVideo(@NonNull byte[] data) { + private void draw(@NonNull byte[] data) { ThreadUtils.runOnUiThread(new Runnable() { @Override public void run() { - GlideApp.with(SweeperVideoView.this) + GlideApp.with(MogoVideoView.this) .asBitmap() .load(data) - .placeholder(SweeperVideoView.this.getDrawable()) + .placeholder(MogoVideoView.this.getDrawable()) .apply(requestOptions) .into(target); } }); } + + @Override + public void onSweeperFutianBackCameraVideo(@NonNull byte[] data) { + draw(data); + } + + @Override + public void onRoboBusJinlvM1StitchedVideo(@NonNull byte[] data) { + draw(data); + } + } diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotControlProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotControlProvider.kt index 03509c9813..6292b53abc 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotControlProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotControlProvider.kt @@ -367,6 +367,12 @@ interface IMoGoAutopilotControlProvider : IMoGoFunctionServerProvider { */ fun setIsDrawPointCloud(isDrawPointCloud: Boolean) + /** + * 设置M1拼接视频接口订阅 + * @param isSubscribe 是否订阅 + */ + fun setIsSubscribeM1StitchedVideo(isSubscribe: Boolean) + fun sendRoboBusJinlvM1FrontDoorCmd(switchCmd: Int): Boolean fun sendRoboBusJinlvM1AirConditionerCmd( diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoRoboBusJinlvM1StitchedVideoListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoRoboBusJinlvM1StitchedVideoListener.kt new file mode 100644 index 0000000000..701b364821 --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoRoboBusJinlvM1StitchedVideoListener.kt @@ -0,0 +1,11 @@ +package com.mogo.eagle.core.function.api.autopilot + +/** + * M1拼接视频 10Hz + */ +interface IMoGoRoboBusJinlvM1StitchedVideoListener { + /** + * 金旅M1拼接视频数据 10Hz 每一帧为一张图片 + */ + fun onRoboBusJinlvM1StitchedVideo(data: ByteArray) +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotControlManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotControlManager.kt index 02d52f2a61..ac9d0f4e5d 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotControlManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotControlManager.kt @@ -511,6 +511,14 @@ object CallerAutoPilotControlManager { providerApi?.setIsDrawPointCloud(isDrawPointCloud) } + /** + * 设置M1拼接视频接口订阅 + * @param isSubscribe 是否订阅 + */ + fun setIsSubscribeM1StitchedVideo(isSubscribe: Boolean) { + providerApi?.setIsSubscribeM1StitchedVideo(isSubscribe) + } + fun sendRoboBusJinlvM1FrontDoorCmd(switchCmd: Int): Boolean { return providerApi?.sendRoboBusJinlvM1FrontDoorCmd(switchCmd) ?: false } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerRoboBusJinlvM1StitchedVideoListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerRoboBusJinlvM1StitchedVideoListenerManager.kt new file mode 100644 index 0000000000..7b40b6ffb5 --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerRoboBusJinlvM1StitchedVideoListenerManager.kt @@ -0,0 +1,20 @@ +package com.mogo.eagle.core.function.call.autopilot + +import com.mogo.eagle.core.function.api.autopilot.IMoGoRoboBusJinlvM1StitchedVideoListener +import com.mogo.eagle.core.function.call.base.CallerBase + +/** + * 清扫车(福田)后摄像头视频数据 + */ +object CallerRoboBusJinlvM1StitchedVideoListenerManager : CallerBase() { + + /** + * 后摄像头视频数据 + */ + fun invokeRoboBusJinlvM1StitchedVideo(data: ByteArray) { + M_LISTENERS.forEach { + val listener = it.value + listener.onRoboBusJinlvM1StitchedVideo(data) + } + } +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerSweeperFutianBackCameraVideoListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerSweeperFutianBackCameraVideoListenerManager.kt index 95d2dde9e8..ecf3d4dbff 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerSweeperFutianBackCameraVideoListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerSweeperFutianBackCameraVideoListenerManager.kt @@ -1,9 +1,6 @@ package com.mogo.eagle.core.function.call.autopilot -import chassis.ChassisStatesOuterClass -import chassis.VehicleStateOuterClass import com.mogo.eagle.core.function.api.autopilot.IMoGoSweeperFutianBackCameraVideoListener -import com.mogo.eagle.core.function.api.autopilot.IMoGoSweeperFutianCleanSystemListener import com.mogo.eagle.core.function.call.base.CallerBase /**