From 23c59f72561632886e8cc5f032083ba221c7e3a9 Mon Sep 17 00:00:00 2001 From: aibingbing Date: Tue, 23 Aug 2022 22:59:51 +0800 Subject: [PATCH 1/8] =?UTF-8?q?feat:=20=E6=B8=85=E6=89=AB=E8=BD=A6?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E9=9D=A2=E6=9D=BFView=20=E5=88=9D=E7=89=88?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fragment/BaseSweeperTabFragment.java | 10 + .../och/sweeper/fragment/SweeperFragment.java | 5 + .../sweeper/ui/SweeperOperatePanelView.java | 35 +++ .../bg_sweeper_operate_panel_btn_close.xml | 7 + .../bg_sweeper_operate_panel_btn_default.xml | 7 + .../bg_sweeper_operate_panel_btn_disabled.xml | 7 + .../bg_sweeper_operate_panel_btn_open.xml | 7 + .../bg_sweeper_operate_panel_btn_pressed.xml | 7 + ...sweeper_operate_panel_btn1_bg_selector.xml | 4 + ...sweeper_operate_panel_btn2_bg_selector.xml | 6 + .../main/res/layout/sweeper_base_fragment.xml | 11 + .../res/layout/sweeper_operate_panel_view.xml | 235 ++++++++++++++++++ .../src/main/res/values/colors.xml | 9 + .../src/main/res/values/dimens.xml | 3 + 14 files changed, 353 insertions(+) create mode 100644 OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java create mode 100644 OCH/mogo-och-sweeper/src/main/res/drawable/bg_sweeper_operate_panel_btn_close.xml create mode 100644 OCH/mogo-och-sweeper/src/main/res/drawable/bg_sweeper_operate_panel_btn_default.xml create mode 100644 OCH/mogo-och-sweeper/src/main/res/drawable/bg_sweeper_operate_panel_btn_disabled.xml create mode 100644 OCH/mogo-och-sweeper/src/main/res/drawable/bg_sweeper_operate_panel_btn_open.xml create mode 100644 OCH/mogo-och-sweeper/src/main/res/drawable/bg_sweeper_operate_panel_btn_pressed.xml create mode 100644 OCH/mogo-och-sweeper/src/main/res/drawable/sweeper_operate_panel_btn1_bg_selector.xml create mode 100755 OCH/mogo-och-sweeper/src/main/res/drawable/sweeper_operate_panel_btn2_bg_selector.xml create mode 100644 OCH/mogo-och-sweeper/src/main/res/layout/sweeper_operate_panel_view.xml diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java index cef6c8826a..714e6091fc 100644 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java @@ -72,6 +72,7 @@ public abstract class BaseSweeperTabFragment + + + + + \ No newline at end of file diff --git a/OCH/mogo-och-sweeper/src/main/res/drawable/bg_sweeper_operate_panel_btn_default.xml b/OCH/mogo-och-sweeper/src/main/res/drawable/bg_sweeper_operate_panel_btn_default.xml new file mode 100644 index 0000000000..84464f5307 --- /dev/null +++ b/OCH/mogo-och-sweeper/src/main/res/drawable/bg_sweeper_operate_panel_btn_default.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/OCH/mogo-och-sweeper/src/main/res/drawable/bg_sweeper_operate_panel_btn_disabled.xml b/OCH/mogo-och-sweeper/src/main/res/drawable/bg_sweeper_operate_panel_btn_disabled.xml new file mode 100644 index 0000000000..a5cb095bc8 --- /dev/null +++ b/OCH/mogo-och-sweeper/src/main/res/drawable/bg_sweeper_operate_panel_btn_disabled.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/OCH/mogo-och-sweeper/src/main/res/drawable/bg_sweeper_operate_panel_btn_open.xml b/OCH/mogo-och-sweeper/src/main/res/drawable/bg_sweeper_operate_panel_btn_open.xml new file mode 100644 index 0000000000..ec0eeb317b --- /dev/null +++ b/OCH/mogo-och-sweeper/src/main/res/drawable/bg_sweeper_operate_panel_btn_open.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/OCH/mogo-och-sweeper/src/main/res/drawable/bg_sweeper_operate_panel_btn_pressed.xml b/OCH/mogo-och-sweeper/src/main/res/drawable/bg_sweeper_operate_panel_btn_pressed.xml new file mode 100644 index 0000000000..8d7970361a --- /dev/null +++ b/OCH/mogo-och-sweeper/src/main/res/drawable/bg_sweeper_operate_panel_btn_pressed.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/OCH/mogo-och-sweeper/src/main/res/drawable/sweeper_operate_panel_btn1_bg_selector.xml b/OCH/mogo-och-sweeper/src/main/res/drawable/sweeper_operate_panel_btn1_bg_selector.xml new file mode 100644 index 0000000000..e73562aa4f --- /dev/null +++ b/OCH/mogo-och-sweeper/src/main/res/drawable/sweeper_operate_panel_btn1_bg_selector.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/OCH/mogo-och-sweeper/src/main/res/drawable/sweeper_operate_panel_btn2_bg_selector.xml b/OCH/mogo-och-sweeper/src/main/res/drawable/sweeper_operate_panel_btn2_bg_selector.xml new file mode 100755 index 0000000000..7f990b092f --- /dev/null +++ b/OCH/mogo-och-sweeper/src/main/res/drawable/sweeper_operate_panel_btn2_bg_selector.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_base_fragment.xml b/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_base_fragment.xml index db9054dc42..66b9868af6 100644 --- a/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_base_fragment.xml +++ b/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_base_fragment.xml @@ -63,6 +63,17 @@ app:layout_goneMarginTop="@dimen/module_mogo_och_station_panel_container_margin_top_no_call" tools:visibility="visible" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OCH/mogo-och-sweeper/src/main/res/values/colors.xml b/OCH/mogo-och-sweeper/src/main/res/values/colors.xml index 4ff9efb121..9ac3b75954 100644 --- a/OCH/mogo-och-sweeper/src/main/res/values/colors.xml +++ b/OCH/mogo-och-sweeper/src/main/res/values/colors.xml @@ -44,4 +44,13 @@ #FF006D43 #FFFFE198 #FFFF9B00 + + #7DE261 + #f00 + #BF30334C + #ffffff + #1FA7FF + #50000000 + #BF30334C + \ No newline at end of file diff --git a/OCH/mogo-och-sweeper/src/main/res/values/dimens.xml b/OCH/mogo-och-sweeper/src/main/res/values/dimens.xml index d3aedccd5e..8cbd5c847a 100644 --- a/OCH/mogo-och-sweeper/src/main/res/values/dimens.xml +++ b/OCH/mogo-och-sweeper/src/main/res/values/dimens.xml @@ -151,4 +151,7 @@ 154px 130px 60px + + 16px + 36px \ No newline at end of file From 803257a889d9576903e726545c9ba6884fdd986a Mon Sep 17 00:00:00 2001 From: aibingbing Date: Wed, 24 Aug 2022 13:38:23 +0800 Subject: [PATCH 2/8] =?UTF-8?q?[=E6=B8=85=E6=89=AB=E8=BD=A6]=20feat?= =?UTF-8?q?=EF=BC=9A=E5=B0=81=E8=A3=85=20=E5=8F=91=E9=80=81=E6=B8=85?= =?UTF-8?q?=E6=89=AB=E8=BD=A6=E4=BD=9C=E4=B8=9A=E5=91=BD=E4=BB=A4=20?= =?UTF-8?q?=E5=92=8C=20=E6=B8=85=E6=89=AB=E8=BD=A6=E6=B8=85=E6=89=AB?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E5=BA=95=E7=9B=98=E6=95=B0=E6=8D=AE=E9=80=8F?= =?UTF-8?q?=E5=87=BA=20=E6=8E=A5=E5=8F=A3=EF=BC=8C=E5=92=8CPB=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=AF=B9=E6=8E=A5=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/function/autopilot/MoGoAutopilotProvider.kt | 6 ++++++ .../autopilot/adapter/MoGoAdasListenerImpl.kt | 8 ++++---- .../autopilot/adapter/MoGoHandAdasMsgManager.java | 7 +++++++ .../status/flow/can/CanImpl.kt | 6 ++++++ .../core/function/hmi/ui/setting/DebugSettingView.kt | 8 ++++++++ .../function/hmi/ui/widget/SteeringWheelView.java | 5 +++++ .../core/function/hmi/ui/widget/TrafficDataView.java | 5 +++++ .../function/api/autopilot/IMoGoAutopilotProvider.kt | 6 ++++++ .../autopilot/IMoGoAutopilotVehicleStateListener.kt | 7 ++++++- .../function/call/autopilot/CallerAutoPilotManager.kt | 8 ++++++++ .../CallerAutopilotVehicleStateListenerManager.kt | 11 +++++++++++ 11 files changed, 72 insertions(+), 5 deletions(-) diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt index 76e82209f0..fc100d6ad6 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt @@ -4,6 +4,7 @@ import android.Manifest.permission import android.content.Context import android.util.Log import androidx.annotation.RequiresPermission +import chassis.SpecialVehicleTaskCmdOuterClass import com.alibaba.android.arouter.facade.annotation.Route import com.mogo.cloud.passport.MoGoAiCloudClientConfig import com.mogo.eagle.core.data.app.AppConfigInfo @@ -533,4 +534,9 @@ class MoGoAutopilotProvider : Log.d(TAG, "---- sendStatusQueryReq ----") AdasManager.getInstance().sendStatusQueryReq() } + + override fun sendSweeperFuTianTaskCmd(fuTianTaskCmd: SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd) { + Log.d(TAG, "---- sendSweeperFuTianTaskCmd ----") + AdasManager.getInstance().sendRoboSweeperFuTianTaskCmd(fuTianTaskCmd) + } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt index 2ad188b830..f36f3681d4 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt @@ -1,6 +1,5 @@ package com.mogo.eagle.core.function.autopilot.adapter -import android.util.* import chassis.VehicleStateOuterClass import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.config.HdMapBuildConfig @@ -45,7 +44,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPointCloudList import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager.invokeAutopilotRecordResult import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager -import com.mogo.eagle.core.network.utils.* import com.zhidao.support.adas.high.AdasManager import com.zhidao.support.adas.high.OnAdasListener import com.zhidao.support.adas.high.common.ProtocolStatus @@ -57,7 +55,6 @@ import mogo_msg.MogoReportMsg import perception.TrafficLightOuterClass import prediction.Prediction import record_cache.RecordPanelOuterClass -import rule_segement.MogoPointCloudOuterClass import system_master.SystemStatusInfo /** @@ -162,7 +159,10 @@ class MoGoAdasListenerImpl : OnAdasListener { CallerAutopilotVehicleStateListenerManager.invokeAutopilotThrottle(vehicleState.throttle) //刹车 CallerAutopilotVehicleStateListenerManager.invokeAutopilotBrake(vehicleState.brake) - + //清扫车(福田)清扫控制系统状态 + vehicleState.sweeperFutianCleanSystemState?.also { + CallerAutopilotVehicleStateListenerManager.invokeSweeperFutianCleanSystemState(it) + } } else { CallerAutopilotVehicleStateListenerManager.invokeAutopilotDataException(header.timestamp.toLong()) } diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java index ee651b95c2..6db47cdab3 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java @@ -4,6 +4,7 @@ import android.content.Context; import android.text.TextUtils; import android.util.Log; +import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.mogo.cloud.passport.MoGoAiCloudClientConfig; @@ -23,6 +24,7 @@ import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; import org.jetbrains.annotations.NotNull; import chassis.Chassis; +import chassis.VehicleStateOuterClass; import mogo.telematics.pad.MessagePad; public class MoGoHandAdasMsgManager implements @@ -166,4 +168,9 @@ public class MoGoHandAdasMsgManager implements public void onAutopilotBrake(float brake) { } + + @Override + public void onSweeperFutianCleanSystemState(VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) { + + } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/can/CanImpl.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/can/CanImpl.kt index 0e254a00b2..99ea3ba91d 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/can/CanImpl.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/can/CanImpl.kt @@ -4,6 +4,7 @@ import android.content.* import android.util.Log import chassis.Chassis.GearPosition import chassis.Chassis.LightSwitch +import chassis.VehicleStateOuterClass import com.mogo.eagle.core.function.api.autopilot.* import com.mogo.eagle.core.function.call.autopilot.* import com.mogo.eagle.core.utilcode.kotlin.* @@ -81,6 +82,11 @@ internal class CanImpl(ctx: Context): IFlow(ctx), IMoGoAutopilotVehic timeOutCheck() } + override fun onSweeperFutianCleanSystemState(cleanSystemState: VehicleStateOuterClass.SweeperFuTianCleanSystemState) { + send(CanStatus(isCanEnabled())) + timeOutCheck() + } + override fun onAutopilotGuardian(guardianInfo: MogoReportMessage?) { super.onAutopilotGuardian(guardianInfo) send(CanStatus(isCanEnabled())) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt index 18bc7c28dc..1fb0bdf472 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt @@ -19,6 +19,7 @@ import androidx.core.content.ContextCompat import androidx.core.view.* import androidx.recyclerview.widget.LinearLayoutManager import chassis.Chassis +import chassis.VehicleStateOuterClass import com.mogo.cloud.passport.MoGoAiCloudClient import com.mogo.cloud.passport.MoGoAiCloudClientConfig import com.mogo.commons.AbsMogoApplication @@ -1984,6 +1985,13 @@ class DebugSettingView @JvmOverloads constructor( } + /** + * 清扫车(福田)清扫控制系统状态 + */ + override fun onSweeperFutianCleanSystemState(cleanSystemState: VehicleStateOuterClass.SweeperFuTianCleanSystemState) { + + } + /** * 吐司提示 */ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SteeringWheelView.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SteeringWheelView.java index 67594f090e..7fe1bbbc7c 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SteeringWheelView.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SteeringWheelView.java @@ -28,6 +28,7 @@ import com.mogo.eagle.core.utilcode.util.ThreadUtils; import org.jetbrains.annotations.NotNull; import chassis.Chassis; +import chassis.VehicleStateOuterClass; import mogo.telematics.pad.MessagePad; import mogo_msg.MogoReportMsg; import system_master.SystemStatusInfo; @@ -170,6 +171,10 @@ public class SteeringWheelView extends ConstraintLayout { private final IMoGoAutopilotVehicleStateListener mIMoGoAutopilotVehicleStateListener = new IMoGoAutopilotVehicleStateListener() { + @Override + public void onSweeperFutianCleanSystemState(@NonNull VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) { + } + /** * @param brake 刹车 */ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.java index cc2d7aa78d..d8c2f8a433 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.java @@ -24,6 +24,7 @@ import com.mogo.eagle.core.utilcode.util.ThreadUtils; import org.jetbrains.annotations.NotNull; import chassis.Chassis; +import chassis.VehicleStateOuterClass; /** * @author Jing @@ -123,6 +124,10 @@ public class TrafficDataView extends ConstraintLayout { } private final IMoGoAutopilotVehicleStateListener mIMoGoAutopilotVehicleStateListener = new IMoGoAutopilotVehicleStateListener() { + @Override + public void onSweeperFutianCleanSystemState(@NonNull VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) { + } + /** * 车辆转向灯 * @param lightSwitch diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotProvider.kt index a360b916a5..340678071a 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotProvider.kt @@ -1,5 +1,6 @@ package com.mogo.eagle.core.function.api.autopilot +import chassis.SpecialVehicleTaskCmdOuterClass import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters import com.mogo.eagle.core.data.trafficlight.TrafficLightResult import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider @@ -205,4 +206,9 @@ interface IMoGoAutopilotProvider : IMoGoFunctionServerProvider { * 主动查询工控机的各topic状态 */ fun sendStatusQueryReq() + + /** + * 福田清扫车业务指令下发 + */ + fun sendSweeperFuTianTaskCmd(fuTianTaskCmd: SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd) } \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt index 75bde9e46f..bc80cc6fd9 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt @@ -1,7 +1,7 @@ package com.mogo.eagle.core.function.api.autopilot import chassis.Chassis -import mogo.telematics.pad.MessagePad +import chassis.VehicleStateOuterClass /** * 车辆底盘 数据 回调监听 @@ -52,4 +52,9 @@ interface IMoGoAutopilotVehicleStateListener { * 刹车 */ fun onAutopilotBrake(brake: Float) + + /** + * 清扫车(福田)清扫控制系统状态 + */ + fun onSweeperFutianCleanSystemState(cleanSystemState: VehicleStateOuterClass.SweeperFuTianCleanSystemState) } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotManager.kt index 7f3da3c452..5ef749755d 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotManager.kt @@ -1,6 +1,7 @@ package com.mogo.eagle.core.function.call.autopilot import android.os.SystemClock +import chassis.SpecialVehicleTaskCmdOuterClass import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters import com.mogo.eagle.core.data.constants.MogoServicePaths import com.mogo.eagle.core.data.deva.chain.ChainConstant @@ -263,4 +264,11 @@ object CallerAutoPilotManager { fun sendStatusQueryReq() { providerApi?.sendStatusQueryReq() } + + /** + * 福田清扫车业务指令下发 + */ + fun sendSweeperFuTianTaskCmd(fuTianTaskCmd: SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd) { + providerApi?.sendSweeperFuTianTaskCmd(fuTianTaskCmd) + } } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt index df4cd2c638..a704804633 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt @@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.call.autopilot import androidx.annotation.Nullable import chassis.Chassis +import chassis.VehicleStateOuterClass import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener import com.mogo.eagle.core.function.call.base.CallerBase import mogo.telematics.pad.MessagePad @@ -132,6 +133,16 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() { } } + /** + * clean system state 清扫车(福田)清扫控制系统状态 + */ + fun invokeSweeperFutianCleanSystemState(cleanSystemState: VehicleStateOuterClass.SweeperFuTianCleanSystemState){ + M_AUTOPILOT_VEHICLE_LISTENERS.forEach{ + val listener = it.value + listener.onSweeperFutianCleanSystemState(cleanSystemState) + } + } + /** * 工控机时间回调 From 09f15cdbe78b97bfe85076685f89926cfa2d44b3 Mon Sep 17 00:00:00 2001 From: aibingbing Date: Wed, 24 Aug 2022 21:17:52 +0800 Subject: [PATCH 3/8] =?UTF-8?q?[=E6=B8=85=E6=89=AB=E8=BD=A6]feat:=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E5=8F=91=E9=80=81=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E6=97=B6loading=20,=20=E5=91=BD=E4=BB=A4=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E7=AD=89=E5=BE=85=E3=80=81=E8=B6=85=E6=97=B6=E7=AD=89=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E6=96=B0=E5=A2=9E=E4=B8=80=E4=BA=9B=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E5=91=BD=E4=BB=A4=E8=B0=83=E7=94=A8=E6=96=B9=E6=B3=95?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fragment/BaseSweeperTabFragment.java | 4 - .../sweeper/ui/SweeperOperatePanelView.java | 258 +++++++++++++++++- .../sweeper/util/SweeperFutianCmdUtil.java | 77 ++++++ .../main/res/layout/sweeper_base_fragment.xml | 4 +- .../res/layout/sweeper_operate_panel_view.xml | 206 ++++++++------ .../src/main/res/values/strings.xml | 2 + 6 files changed, 454 insertions(+), 97 deletions(-) create mode 100644 OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/util/SweeperFutianCmdUtil.java diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java index 714e6091fc..843fb6e68b 100644 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java @@ -72,7 +72,6 @@ public abstract class BaseSweeperTabFragment 0) { + mCurrentCmdRequestCallback.onCountDownTick(seconds); + Message newMsg = Message.obtain(); + newMsg.what = MSG_CMD_EXECUTE_COUNT_DOWN; + newMsg.obj = seconds-1; + mSweeperOperateCmdHandler.sendMessageDelayed(newMsg, 1000L); + } else { + if (mCurrentCmdRequestCallback != null) { + mCurrentCmdRequestCallback.onCmdTimeout(); + mCurrentCmdRequestCallback = null; + } + } + } + } + } + + interface CmdRequestCallback { + void onSendCmd(); + + void onCountDownTick(int senonds); + + boolean onCheckIfCmdSuccess(VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState); + + void onCmdSuccess(); + + void onCmdFailed(); + + void onCmdTimeout(); } } diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/util/SweeperFutianCmdUtil.java b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/util/SweeperFutianCmdUtil.java new file mode 100644 index 0000000000..92b1eaecaf --- /dev/null +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/util/SweeperFutianCmdUtil.java @@ -0,0 +1,77 @@ +package com.mogo.och.sweeper.util; + +import chassis.SpecialVehicleTaskCmdOuterClass; + +/** + * 清扫车-福田,构建业务命令数据的工具类 + */ +public class SweeperFutianCmdUtil { + private static final int CLEAN_WORK_OPEN = 1; //清扫作业-开启 + private static final int CLEAN_WORK_CLOSE = 2;//清扫作业-关闭 + private static final int CLEAN_MODE_PURE_SWEEP = 1;//作业模式-纯扫 + private static final int CLEAN_MODE_WASH_SWEEP = 2;//作业模式-洗扫 + private static final int CLEAN_MODE_PURE_WASH = 3;//作业模式-纯洗 + private static final int CLEAN_MODE_PURE_DRAW = 4;//作业模式-纯吸 + private static final int CLEAN_MODE_CLOSE = 5;//作业模式-关闭 + private static final int CLEAN_DIRECTION_BOTH_SIDE = 1;//清扫方向-两侧 + private static final int CLEAN_DIRECTION_LEFT_SIDE = 2;//清扫方向-左侧 + private static final int CLEAN_DIRECTION_RIGHT_SIDE = 3;//清扫方向-右侧 + private static final int CLEAN_DIRECTION_CLOSE = 4;//清扫方向-关闭 + private static final int CLEAN_INTENSITY_STRAND = 1;//作业强度-标准 + private static final int CLEAN_INTENSITY_STRONG = 2;//作业强度-加强 + + public static SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd buildCleanWorkStartCmd() { + return buildCleanWorkCmd(CLEAN_WORK_OPEN); + } + + public static SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd buildCleanWorkStopCmd() { + return buildCleanWorkCmd(CLEAN_WORK_CLOSE); + } + + private static SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd buildCleanWorkCmd(int startOrStop) { + SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.Builder builder = SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.newBuilder(); + builder.setCleanOpenRequirement(startOrStop); + return buildTaskCmd(builder.build()); + } + + public static SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd buildCleanModeCmd(int value) { + SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.Builder builder = SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.newBuilder(); + builder.setCleanModeRequirement(value); + return buildTaskCmd(builder.build()); + } + + public static SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd buildCleanModeCloseCmd() { + return buildCleanModeCmd(CLEAN_MODE_CLOSE); + } + + public static SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd buildCleanDirectionCmd(int value) { + SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.Builder builder = SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.newBuilder(); + builder.setCleanDirectionRequirement(value); + return buildTaskCmd(builder.build()); + } + + public static SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd buildCleanDirectionCloseCmd() { + return buildCleanDirectionCmd(CLEAN_DIRECTION_CLOSE); + } + + public static SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd buildCleanIntensityStandardCmd() { + return buildCleanIntensityCmd(CLEAN_INTENSITY_STRAND); + } + + public static SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd buildCleanIntensityStrongCmd() { + return buildCleanIntensityCmd(CLEAN_INTENSITY_STRONG); + } + + private static SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd buildCleanIntensityCmd(int value) { + SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.Builder builder = SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.newBuilder(); + builder.setCleanIntensityRequirement(value); + return buildTaskCmd(builder.build()); + } + + private static SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd buildTaskCmd( + SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd fuTianCleanCmd) { + return SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd.newBuilder() + .setRoboSweeperFutianCleanCmd(fuTianCleanCmd).build(); + } + +} diff --git a/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_base_fragment.xml b/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_base_fragment.xml index 66b9868af6..be7b2b839f 100644 --- a/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_base_fragment.xml +++ b/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_base_fragment.xml @@ -63,12 +63,12 @@ app:layout_goneMarginTop="@dimen/module_mogo_och_station_panel_container_margin_top_no_call" tools:visibility="visible" /> - + android:layout_height="wrap_content"> + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintLeft_toRightOf="@id/hint_main_switch" + app:layout_constraintTop_toTopOf="@id/hint_main_switch" /> + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toBottomOf="@id/main_switch_barrier" /> + app:layout_constraintLeft_toRightOf="@id/hint_operate_mode" + app:layout_constraintTop_toTopOf="@id/hint_operate_mode" /> + app:layout_constraintLeft_toRightOf="@id/btn_operate_mode_pure_sweep" + app:layout_constraintTop_toTopOf="@id/hint_operate_mode" /> + app:layout_constraintLeft_toLeftOf="@id/btn_operate_mode_pure_sweep" + app:layout_constraintTop_toBottomOf="@id/btn_operate_mode_pure_sweep" /> + app:layout_constraintLeft_toRightOf="@id/btn_operate_mode_sweep_wash" + app:layout_constraintTop_toTopOf="@id/btn_operate_mode_sweep_wash" /> + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toBottomOf="@id/operate_mode_barrier" /> + app:layout_constraintLeft_toRightOf="@id/hint_clean_direction" + app:layout_constraintTop_toTopOf="@id/hint_clean_direction" /> + app:layout_constraintLeft_toRightOf="@id/btn_clean_direction_left_side" + app:layout_constraintTop_toTopOf="@id/hint_clean_direction" /> + app:layout_constraintLeft_toLeftOf="@id/btn_clean_direction_left_side" + app:layout_constraintTop_toBottomOf="@id/btn_clean_direction_left_side" /> + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toBottomOf="@id/clean_direction_barrier" /> + app:layout_constraintLeft_toRightOf="@id/hint_clean_intensity" + app:layout_constraintTop_toTopOf="@id/hint_clean_intensity" /> + app:layout_constraintLeft_toRightOf="@id/btn_clean_intensity_standard" + app:layout_constraintTop_toTopOf="@id/hint_clean_intensity" /> + + + + + + + \ No newline at end of file diff --git a/OCH/mogo-och-sweeper/src/main/res/values/strings.xml b/OCH/mogo-och-sweeper/src/main/res/values/strings.xml index b2d7412445..95a71366f9 100644 --- a/OCH/mogo-och-sweeper/src/main/res/values/strings.xml +++ b/OCH/mogo-och-sweeper/src/main/res/values/strings.xml @@ -24,4 +24,6 @@ 当前站点: 下一站: 自动驾驶状态为0不可用 + + 预计等待%d秒 From 7e55339bb6588849816088cfb7bdc16c43d79f8c Mon Sep 17 00:00:00 2001 From: aibingbing Date: Thu, 25 Aug 2022 21:42:52 +0800 Subject: [PATCH 4/8] =?UTF-8?q?[=E6=B8=85=E6=89=AB=E8=BD=A6]feat:=20?= =?UTF-8?q?=E6=B8=85=E6=89=AB=E8=BD=A6=E5=90=84=E6=8E=A7=E5=88=B6=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E4=B8=AD=E6=8C=89=E9=92=AE=E7=82=B9=E5=87=BB=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E5=8F=8A=E7=9B=B8=E5=85=B3=E9=80=BB=E8=BE=91=E5=A4=84?= =?UTF-8?q?=E7=90=86=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sweeper/ui/SweeperOperatePanelView.java | 709 +++++++++++++++--- .../sweeper/util/SweeperFutianCmdUtil.java | 52 +- ...sweeper_operate_panel_btn1_bg_selector.xml | 4 +- ...sweeper_operate_panel_btn2_bg_selector.xml | 6 +- .../res/layout/sweeper_operate_panel_view.xml | 76 +- 5 files changed, 692 insertions(+), 155 deletions(-) diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java index e2cc174570..1b40a8f95f 100644 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java @@ -1,16 +1,30 @@ package com.mogo.och.sweeper.ui; +import static com.mogo.och.sweeper.util.SweeperFutianCmdUtil.CLEAN_DIRECTION_BOTH_SIDE; +import static com.mogo.och.sweeper.util.SweeperFutianCmdUtil.CLEAN_DIRECTION_LEFT_SIDE; +import static com.mogo.och.sweeper.util.SweeperFutianCmdUtil.CLEAN_DIRECTION_RIGHT_SIDE; +import static com.mogo.och.sweeper.util.SweeperFutianCmdUtil.CLEAN_INTENSITY_STRAND; +import static com.mogo.och.sweeper.util.SweeperFutianCmdUtil.CLEAN_INTENSITY_STRONG; +import static com.mogo.och.sweeper.util.SweeperFutianCmdUtil.CLEAN_MODE_PURE_DRAW; +import static com.mogo.och.sweeper.util.SweeperFutianCmdUtil.CLEAN_MODE_PURE_SWEEP; +import static com.mogo.och.sweeper.util.SweeperFutianCmdUtil.CLEAN_MODE_PURE_WASH; +import static com.mogo.och.sweeper.util.SweeperFutianCmdUtil.CLEAN_MODE_WASH_SWEEP; + import android.content.Context; +import android.content.DialogInterface; import android.os.Handler; import android.os.Message; import android.util.AttributeSet; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; +import android.widget.CheckedTextView; import android.widget.LinearLayout; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.appcompat.app.AlertDialog; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener; import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager; @@ -19,6 +33,11 @@ import com.mogo.eagle.core.utilcode.util.ThreadUtils; import com.mogo.eagle.core.utilcode.util.ToastUtils; import com.mogo.module.common.view.OnPreventFastClickListener; import com.mogo.och.sweeper.R; +import com.mogo.och.sweeper.util.SweeperFutianCmdUtil; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; import chassis.Chassis; import chassis.SpecialVehicleTaskCmdOuterClass; @@ -27,25 +46,71 @@ import chassis.VehicleStateOuterClass; /** * 清扫车操作面板View */ -public class SweeperOperatePanelView extends LinearLayout{ +public class SweeperOperatePanelView extends LinearLayout { private static final String TAG = "SweeperOperatePanelView"; private static final int CMD_EXECUTE_TIMEOUT_SECONDS = 5; + private static final int CMD_EXECUTE_MOCK_SUCCESS_SECONDS = 3; - TextView mBtnMainSwitchOpenClose;//开关 - TextView mBtnOperateModePureSweep;//纯扫 - TextView mBtnOperateModePureWash;//纯洗 - TextView mBtnOperateModeSweepWash;//洗扫 - TextView mBtnOperateModePureAbsorption;//纯吸 - TextView mBtnCleanDirectionLeftSide;//左侧 - TextView mBtnCleanDirectionRightSide;//右侧 - TextView mBtnCleanDirectionBothSide;//两侧 - TextView mBtnCleanIntensityStandard;//普通 - TextView mBtnCleanIntensityStrong;//强力 + CheckedTextView mBtnCleanWorkOpenClose;//开关 + CheckedTextView mBtnCleanModePureSweep;//纯扫 + CheckedTextView mBtnCleanModePureWash;//纯洗 + CheckedTextView mBtnCleanModeSweepWash;//洗扫 + CheckedTextView mBtnCleanModePureAbsorption;//纯吸 + CheckedTextView mBtnCleanDirectionLeftSide;//左侧 + CheckedTextView mBtnCleanDirectionRightSide;//右侧 + CheckedTextView mBtnCleanDirectionBothSide;//两侧 + CheckedTextView mBtnCleanIntensityStandard;//普通 + CheckedTextView mBtnCleanIntensityStrong;//强力 LinearLayout mLoadingContainer;//loading container TextView mLoadingHintTop;//loading 提示-上面 TextView mLoadingHintBottom;//loading 提示-下面 + // 作业模式相关操作按钮的id + List cleanModeBtnViewIds = Arrays.asList( + R.id.btn_clean_mode_pure_sweep, + R.id.btn_clean_mode_pure_wash, + R.id.btn_clean_mode_sweep_wash, + R.id.btn_clean_mode_pure_absorption); + + // 作业模式相关操作按钮,对应命令参数值 + HashMap cleanModeBtnAndCmdValueMap = new HashMap() { + { + put(R.id.btn_clean_mode_pure_sweep, CLEAN_MODE_PURE_SWEEP); + put(R.id.btn_clean_mode_pure_wash, CLEAN_MODE_PURE_WASH); + put(R.id.btn_clean_mode_sweep_wash, CLEAN_MODE_WASH_SWEEP); + put(R.id.btn_clean_mode_pure_absorption, CLEAN_MODE_PURE_DRAW); + } + }; + + // 清扫方向相关操作按钮的id + List cleanDirectionBtnViewIds = Arrays.asList( + R.id.btn_clean_direction_left_side, + R.id.btn_clean_direction_right_side, + R.id.btn_clean_direction_both_side); + + // 清扫方向相关按钮操作,对应命令参数值 + HashMap cleanDirectionBtnAndCmdValueMap = new HashMap() { + { + put(R.id.btn_clean_direction_left_side, CLEAN_DIRECTION_LEFT_SIDE); + put(R.id.btn_clean_direction_right_side, CLEAN_DIRECTION_RIGHT_SIDE); + put(R.id.btn_clean_direction_both_side, CLEAN_DIRECTION_BOTH_SIDE); + } + }; + + // 作业强度相关按钮操作 + List cleanIntensityBtnViewIds = Arrays.asList( + R.id.btn_clean_intensity_standard, + R.id.btn_clean_intensity_strong); + + // 作业强度相关按钮操作,对应命令参数值 + HashMap cleanIntensityBtnAndCmdValueMap = new HashMap() { + { + put(R.id.btn_clean_intensity_standard, CLEAN_INTENSITY_STRAND); + put(R.id.btn_clean_intensity_strong, CLEAN_INTENSITY_STRONG); + } + }; + public SweeperOperatePanelView(Context context) { super(context); } @@ -67,16 +132,16 @@ public class SweeperOperatePanelView extends LinearLayout{ private void initView(Context context) { LayoutInflater.from(context).inflate(R.layout.sweeper_operate_panel_view, this, true); - mBtnMainSwitchOpenClose = findViewById(R.id.btn_main_switch_open_close); - mBtnOperateModePureSweep = findViewById(R.id.btn_operate_mode_pure_sweep); - mBtnOperateModePureWash = findViewById(R.id.btn_operate_mode_pure_wash); - mBtnOperateModeSweepWash = findViewById(R.id.btn_operate_mode_sweep_wash); - mBtnOperateModePureAbsorption = findViewById(R.id.btn_operate_mode_pure_absorption); - mBtnCleanDirectionLeftSide = findViewById(R.id.btn_clean_direction_left_side); - mBtnCleanDirectionRightSide = findViewById(R.id.btn_clean_direction_right_side); - mBtnCleanDirectionBothSide = findViewById(R.id.btn_clean_direction_both_side); - mBtnCleanIntensityStandard = findViewById(R.id.btn_clean_intensity_standard); - mBtnCleanIntensityStrong = findViewById(R.id.btn_clean_intensity_strong); + mBtnCleanWorkOpenClose = (CheckedTextView) findViewById(R.id.btn_clean_work_open_close); + mBtnCleanModePureSweep = (CheckedTextView) findViewById(R.id.btn_clean_mode_pure_sweep); + mBtnCleanModePureWash = (CheckedTextView) findViewById(R.id.btn_clean_mode_pure_wash); + mBtnCleanModeSweepWash = (CheckedTextView) findViewById(R.id.btn_clean_mode_sweep_wash); + mBtnCleanModePureAbsorption = (CheckedTextView) findViewById(R.id.btn_clean_mode_pure_absorption); + mBtnCleanDirectionLeftSide = (CheckedTextView) findViewById(R.id.btn_clean_direction_left_side); + mBtnCleanDirectionRightSide = (CheckedTextView) findViewById(R.id.btn_clean_direction_right_side); + mBtnCleanDirectionBothSide = (CheckedTextView) findViewById(R.id.btn_clean_direction_both_side); + mBtnCleanIntensityStandard = (CheckedTextView) findViewById(R.id.btn_clean_intensity_standard); + mBtnCleanIntensityStrong = (CheckedTextView) findViewById(R.id.btn_clean_intensity_strong); mLoadingContainer = findViewById(R.id.loading_hint_container); mLoadingHintTop = findViewById(R.id.loading_hint_top); mLoadingHintBottom = findViewById(R.id.loading_hint_bottom); @@ -84,85 +149,502 @@ public class SweeperOperatePanelView extends LinearLayout{ } private void initViewListener() { - mBtnMainSwitchOpenClose.setOnClickListener(new OnPreventFastClickListener() { + setClickListener(mBtnCleanWorkOpenClose, (v) -> onCleanWorkBtnClick()); + setClickListener(mBtnCleanModePureSweep, (v) -> onCleanModeBtnClick(v)); + setClickListener(mBtnCleanModePureWash, (v) -> onCleanModeBtnClick(v)); + setClickListener(mBtnCleanModeSweepWash, (v) -> onCleanModeBtnClick(v)); + setClickListener(mBtnCleanModePureAbsorption, (v) -> onCleanModeBtnClick(v)); + setClickListener(mBtnCleanDirectionLeftSide, (v) -> onCleanDirectionBtnClick(v)); + setClickListener(mBtnCleanDirectionRightSide, (v) -> onCleanDirectionBtnClick(v)); + setClickListener(mBtnCleanDirectionBothSide, (v) -> onCleanDirectionBtnClick(v)); + setClickListener(mBtnCleanIntensityStandard, (v) -> onCleanIntensityBtnClick(v)); + setClickListener(mBtnCleanIntensityStrong, (v) -> onCleanIntensityBtnClick(v)); + } + + /** + * 清扫任务开关按钮点击事件 + */ + private void onCleanWorkBtnClick() { + // 是否是 关闭 操作 + boolean isCloseAction = mBtnCleanWorkOpenClose.isChecked(); + CmdRequestCallback cmdRequestCallback = new CmdRequestCallback() { + @Override + public void onSendCmd() { + showLoadingMask(CMD_EXECUTE_TIMEOUT_SECONDS); + } + + @Override + public void onCountDownTick(int seconds) { + updateLoadingCountDown(seconds); + } + + @Override + public boolean onCheckIfCmdSuccess(VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) { + //TODO + return true; + } + + @Override + public void onCmdSuccess() { + if (isCloseAction) { + mBtnCleanWorkOpenClose.setText("Open"); + mBtnCleanWorkOpenClose.setChecked(false); + toggleCleanModeBtnsStatus(false); + toggleCleanDirectionBtnsStatus(false); + toggleCleanIntensityBtnsStatus(false); + } else { + mBtnCleanWorkOpenClose.setText("Close"); + mBtnCleanWorkOpenClose.setChecked(true); + toggleCleanModeBtnsStatus(true); + } + hideLoadingMask(); + showCmdExecuteSuccessToast(); + } + + @Override + public void onCmdFailed() { + } + + @Override + public void onCmdTimeout() { + //按钮样式恢复原样 + if (isCloseAction) { + mBtnCleanWorkOpenClose.setText("Close"); + mBtnCleanWorkOpenClose.setChecked(true); + } else { + mBtnCleanWorkOpenClose.setText("Open"); + mBtnCleanWorkOpenClose.setChecked(false); + } + hideLoadingMask(); + showCmdExecuteTimeoutToast(); + } + }; + if (isCloseAction) { + //关闭操作,点击时需要弹框提示确认后,关闭 + showConfirmCleanWorkCloseDialog(() -> { + sendSweeperCmd( + SweeperFutianCmdUtil.buildCleanWorkStopCmd(), + cmdRequestCallback + , CMD_EXECUTE_TIMEOUT_SECONDS); + }); + } else { + //打开操作,点击时打开 + sendSweeperCmd( + SweeperFutianCmdUtil.buildCleanWorkStartCmd(), + cmdRequestCallback, + CMD_EXECUTE_TIMEOUT_SECONDS); + } + } + + /** + * 作业模式按钮点击事件 + * + * @param currentClickView + */ + private void onCleanModeBtnClick(final View currentClickView) { + CheckedTextView currentChoosedModeBtnView = null; + for (Integer viewId : cleanModeBtnViewIds) { + CheckedTextView view = (CheckedTextView) findViewById(viewId); + if (view.isChecked()) { + currentChoosedModeBtnView = view; + break; + } + } + boolean isClickCurrentChoosedModeBtn = currentChoosedModeBtnView != null + && currentChoosedModeBtnView.getId() == currentClickView.getId(); + //是否纯吸 + boolean isPureAbsorption = currentClickView.getId() == R.id.btn_clean_mode_pure_absorption; + + CmdRequestCallback cmdRequestCallback = new CmdRequestCallback() { + @Override + public void onSendCmd() { + showLoadingMask(CMD_EXECUTE_TIMEOUT_SECONDS); + } + + @Override + public void onCountDownTick(int seconds) { + updateLoadingCountDown(seconds); + } + + @Override + public boolean onCheckIfCmdSuccess(VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) { + //TODO + return true; + } + + @Override + public void onCmdSuccess() { + ((CheckedTextView) currentClickView).setChecked(!isClickCurrentChoosedModeBtn); + toggleCleanModeBtnsByChoosedViewId(currentClickView.getId(), isClickCurrentChoosedModeBtn); + if (isClickCurrentChoosedModeBtn) { + toggleCleanDirectionBtnsStatus(false); + toggleCleanIntensityBtnsStatus(false); + } else { + // 如果是纯吸,没有设置清扫方向,同时自动设置作业强度为标准 + if (isPureAbsorption) { + toggleCleanDirectionBtnsStatus(false); + setCleanIntensityStandard(); + } else { + toggleCleanDirectionBtnsStatus(true); + toggleCleanIntensityBtnsStatus(false); + } + } + hideLoadingMask(); + showCmdExecuteSuccessToast(); + } + + @Override + public void onCmdFailed() { + } + + @Override + public void onCmdTimeout() { + ((CheckedTextView) currentClickView).setChecked(isClickCurrentChoosedModeBtn); + hideLoadingMask(); + showCmdExecuteTimeoutToast(); + } + }; + + if (isClickCurrentChoosedModeBtn) { + //当前已选择模式的按钮,取消当前模式,并关闭清扫方向 + sendSweeperCmd( + SweeperFutianCmdUtil.buildCleanModeCloseCmd(), + cmdRequestCallback, + CMD_EXECUTE_TIMEOUT_SECONDS); + } else { + //开启新的作业模式,直接发送命令(纯吸需要一并设置作业强度为标准) + int cmdValue = cleanModeBtnAndCmdValueMap.get(currentClickView.getId()); + sendSweeperCmd( + isPureAbsorption ? SweeperFutianCmdUtil.buildCleanModePureDrawCmd() + : SweeperFutianCmdUtil.buildCleanModeCmd(cmdValue), + cmdRequestCallback, + CMD_EXECUTE_TIMEOUT_SECONDS); + } + } + + private void onCleanDirectionBtnClick(final View currentClickView) { + CheckedTextView currentChoosedDirectionBtnView = null; + for (Integer viewId : cleanDirectionBtnViewIds) { + CheckedTextView view = (CheckedTextView) findViewById(viewId); + if (view.isChecked()) { + currentChoosedDirectionBtnView = view; + break; + } + } + boolean isClickCurrentChoosedDirectionBtn = currentChoosedDirectionBtnView != null + && currentChoosedDirectionBtnView.getId() == currentClickView.getId(); + + CmdRequestCallback cmdRequestCallback = new CmdRequestCallback() { + @Override + public void onSendCmd() { + showLoadingMask(CMD_EXECUTE_TIMEOUT_SECONDS); + } + + @Override + public void onCountDownTick(int seconds) { + updateLoadingCountDown(seconds); + } + + @Override + public boolean onCheckIfCmdSuccess(VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) { + //TODO + return true; + } + + @Override + public void onCmdSuccess() { + ((CheckedTextView) currentClickView).setChecked(!isClickCurrentChoosedDirectionBtn); + toggleCleanDirectionBtnsByChoosedViewId(currentClickView.getId(), isClickCurrentChoosedDirectionBtn); + if (isClickCurrentChoosedDirectionBtn) { + toggleCleanIntensityBtnsStatus(false); + } else { + toggleCleanIntensityBtnsStatus(true); + // 一并设置作业强度为标准 + setCleanIntensityStandard(); + } + hideLoadingMask(); + showCmdExecuteSuccessToast(); + } + + @Override + public void onCmdFailed() { + } + + @Override + public void onCmdTimeout() { + ((CheckedTextView) currentClickView).setChecked(isClickCurrentChoosedDirectionBtn); + hideLoadingMask(); + showCmdExecuteTimeoutToast(); + } + }; + if (isClickCurrentChoosedDirectionBtn) { + //当前已选择模式的按钮,取消当前模式,重置作业强度为标准,并置灰作业强度按钮 + sendSweeperCmd( + SweeperFutianCmdUtil.buildCleanDirectionCloseCmd(), + cmdRequestCallback, + CMD_EXECUTE_TIMEOUT_SECONDS); + } else { + //开启新的作业模式,直接发送命令(作业强度默认为标准) + int cmdValue = cleanDirectionBtnAndCmdValueMap.get(currentClickView.getId()); + sendSweeperCmd( + SweeperFutianCmdUtil.buildCleanDirectionCmd(cmdValue), + cmdRequestCallback, + CMD_EXECUTE_TIMEOUT_SECONDS); + } + } + + private void onCleanIntensityBtnClick(final View currentClickView) { + boolean isStandardBtnClick = currentClickView.getId() == R.id.btn_clean_intensity_standard; + CmdRequestCallback cmdRequestCallback = new CmdRequestCallback() { + @Override + public void onSendCmd() { + showLoadingMask(CMD_EXECUTE_TIMEOUT_SECONDS); + } + + @Override + public void onCountDownTick(int seconds) { + updateLoadingCountDown(seconds); + } + + @Override + public boolean onCheckIfCmdSuccess(VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) { + //TODO + return true; + } + + @Override + public void onCmdSuccess() { + ((CheckedTextView) currentClickView).setChecked(true); + if (isStandardBtnClick) { + setCleanIntensityStandard(); + } else { + setCleanIntensityStrong(); + } + hideLoadingMask(); + showCmdExecuteSuccessToast(); + } + + @Override + public void onCmdFailed() { + } + + @Override + public void onCmdTimeout() { + ((CheckedTextView) currentClickView).setChecked(false); + hideLoadingMask(); + showCmdExecuteTimeoutToast(); + } + }; + int cmdValue = cleanIntensityBtnAndCmdValueMap.get(currentClickView.getId()); + sendSweeperCmd( + SweeperFutianCmdUtil.buildCleanIntensityCmd(cmdValue), + cmdRequestCallback, + CMD_EXECUTE_TIMEOUT_SECONDS); + } + + /** + * 作业模式按钮状态切换-置灰/开启 按钮 + * + * @param enable + */ + private void toggleCleanModeBtnsStatus(boolean enable) { + for (Integer viewId : cleanModeBtnViewIds) { + CheckedTextView view = (CheckedTextView) findViewById(viewId); + view.setEnabled(enable); + view.setChecked(false); + } + } + + /** + * 作业模式按钮状态切换-将当前点击按钮之外的其他按钮 置灰或开启 + * + * @param choosedBtnId + * @param enable + */ + private void toggleCleanModeBtnsByChoosedViewId(int choosedBtnId, boolean enable) { + for (Integer viewId : cleanModeBtnViewIds) { + CheckedTextView view = (CheckedTextView) findViewById(viewId); + if (view.getId() != choosedBtnId) { + view.setEnabled(enable); + view.setChecked(false); + } + } + } + + /** + * 清扫方向按钮状态切换-置灰/开启 按钮 + * + * @param enable + */ + private void toggleCleanDirectionBtnsStatus(boolean enable) { + for (Integer viewId : cleanDirectionBtnViewIds) { + CheckedTextView view = (CheckedTextView) findViewById(viewId); + view.setEnabled(enable); + view.setChecked(false); + } + } + + /** + * 清扫方向按钮状态切换-将当前点击按钮之外的其他按钮 置灰或开启 + * + * @param choosedBtnId + * @param enable + */ + private void toggleCleanDirectionBtnsByChoosedViewId(int choosedBtnId, boolean enable) { + for (Integer viewId : cleanDirectionBtnViewIds) { + CheckedTextView view = (CheckedTextView) findViewById(viewId); + if (view.getId() != choosedBtnId) { + view.setEnabled(enable); + view.setChecked(false); + } + } + } + + /** + * 作业强度按钮状态切换-置灰/开启 按钮 + * + * @param enable + */ + private void toggleCleanIntensityBtnsStatus(boolean enable) { + for (Integer viewId : cleanIntensityBtnViewIds) { + CheckedTextView view = (CheckedTextView) findViewById(viewId); + view.setEnabled(enable); + view.setChecked(false); + } + } + + /** + * 设置作业强度-标准 + */ + private void setCleanIntensityStandard() { + mBtnCleanIntensityStandard.setChecked(true); + mBtnCleanIntensityStandard.setEnabled(true); + mBtnCleanIntensityStrong.setChecked(false); + mBtnCleanIntensityStrong.setEnabled(true); + } + + /** + * 设置作业强度-加强 + */ + private void setCleanIntensityStrong() { + mBtnCleanIntensityStandard.setChecked(false); + mBtnCleanIntensityStandard.setEnabled(true); + mBtnCleanIntensityStrong.setChecked(true); + mBtnCleanIntensityStrong.setEnabled(true); + } + + /** + * 发送命令后等待时,展示loading + * + * @param timeout + */ + private void showLoadingMask(int timeout) { + showLoadingMask("执行中,请稍后。。。", timeout); + } + + /** + * 发送命令后等待时,展示loading + * + * @param hint + * @param timeout + */ + private void showLoadingMask(String hint, int timeout) { + runOnUIThread(() -> { + mLoadingContainer.setVisibility(View.VISIBLE); + mLoadingHintTop.setText(hint); + mLoadingHintBottom.setText( + String.format( + getContext().getApplicationContext().getString(R.string.sweeper_operate_panel_cmd_execute_timeout), + timeout + )); + }); + } + + /** + * 隐藏loading + */ + private void hideLoadingMask() { + runOnUIThread(() -> { + mLoadingContainer.setVisibility(View.GONE); + }); + } + + /** + * 更新loading中倒计时 + * + * @param timeout + */ + private void updateLoadingCountDown(int timeout) { + runOnUIThread(() -> { + mLoadingHintBottom.setText( + String.format( + getContext().getApplicationContext().getString(R.string.sweeper_operate_panel_cmd_execute_timeout), + timeout + )); + }); + } + + /** + * 命令执行成功toast + */ + private void showCmdExecuteSuccessToast() { + ToastUtils.showLong("设备已响应,操作成功"); + } + + /** + * 命令执行超时toast + */ + private void showCmdExecuteTimeoutToast() { + ToastUtils.showLong("超时未响应,操作失败"); + } + + /** + * 关闭清扫作业时,确认操作的弹框 + * + * @param runnable + */ + private void showConfirmCleanWorkCloseDialog(Runnable runnable) { + AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); + builder.setMessage("是否关闭清扫作业?"); + builder.setCancelable(true); + builder.setPositiveButton("确认", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + runnable.run(); + dialog.dismiss(); + } + }); + builder.setNegativeButton("取消", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + dialog.dismiss(); + } + }); + AlertDialog dialog = builder.create(); + dialog.show(); + } + + private void runOnUIThread(Runnable runnable) { + ThreadUtils.runOnUiThread(new Runnable() { + @Override + public void run() { + runnable.run(); + } + }); + } + + private void setClickListener(View view, OnClickListener listener) { + view.setOnClickListener(new OnPreventFastClickListener() { @Override public void onClickImpl(View v) { - SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.Builder builder = SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.newBuilder(); - SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd fuTianCleanCmd = builder.build(); - SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd fuTianTaskCmd = SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd.newBuilder() - .setRoboSweeperFutianCleanCmd(fuTianCleanCmd).build(); - sendSweeperCmd(fuTianTaskCmd, new CmdRequestCallback() { - @Override - public void onSendCmd() { - showLoadingMask("命令执行中。。。", 10); - } - - @Override - public void onCountDownTick(int senonds) { - updateLoadingCountDown(senonds); - } - - @Override - public boolean onCheckIfCmdSuccess(VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) { - return false; - } - - @Override - public void onCmdSuccess() { - ToastUtils.showLong("执行成功"); - } - - @Override - public void onCmdFailed() { - - } - - @Override - public void onCmdTimeout() { - hideLoadingMask(); - } - }, 10); - } - }); - } - - private void showLoadingMask(String hint, int timeout) { - ThreadUtils.runOnUiThread(new Runnable() { - @Override - public void run() { - mLoadingContainer.setVisibility(View.VISIBLE); - mLoadingHintTop.setText(hint); - mLoadingHintBottom.setText( - String.format( - getContext().getApplicationContext().getString(R.string.sweeper_operate_panel_cmd_execute_timeout), - timeout - )); - } - }); - } - - private void hideLoadingMask() { - ThreadUtils.runOnUiThread(new Runnable() { - @Override - public void run() { - mLoadingContainer.setVisibility(View.GONE); - } - }); - } - - private void updateLoadingCountDown(int timeout) { - ThreadUtils.runOnUiThread(new Runnable() { - @Override - public void run() { - mLoadingHintBottom.setText( - String.format( - getContext().getApplicationContext().getString(R.string.sweeper_operate_panel_cmd_execute_timeout), - timeout - )); + listener.onClick(v); } }); } + /** + * 底盘数据透传listener + */ private final IMoGoAutopilotVehicleStateListener mIMoGoAutopilotVehicleStateListener = new IMoGoAutopilotVehicleStateListener() { @Override public void onAutopilotDataException(long timestamp) { @@ -221,7 +703,7 @@ public class SweeperOperatePanelView extends LinearLayout{ } /** - * 发送清扫车作业命令 + * 发送清扫车相关作业命令 * * @param fuTianCleanCmd * @param cmdRequestCallback @@ -237,17 +719,41 @@ public class SweeperOperatePanelView extends LinearLayout{ mCurrentCmdRequestCallback.onSendCmd(); // 发送命令 CallerAutoPilotManager.INSTANCE.sendSweeperFuTianTaskCmd(fuTianCleanCmd); + // log发送命令 + logSweeperCmdValue(fuTianCleanCmd); // 开启倒计时 Message msg = Message.obtain(); msg.what = MSG_CMD_EXECUTE_COUNT_DOWN; msg.obj = timeout; mSweeperOperateCmdHandler.sendMessage(msg); + // Mock Cmd Success + Message successMsg = Message.obtain(); + successMsg.what = MSG_CMD_EXECUTE_MOCK_SUCCESS; + mSweeperOperateCmdHandler.sendMessageDelayed(successMsg, 1000L * CMD_EXECUTE_MOCK_SUCCESS_SECONDS); + } + + private void logSweeperCmdValue(SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd taskCmd) { + SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd roboSweeperFutianCleanCmd = taskCmd.getRoboSweeperFutianCleanCmd(); + int clean_open_requirement = roboSweeperFutianCleanCmd.getCleanOpenRequirement(); + int clean_mode_requirement = roboSweeperFutianCleanCmd.getCleanModeRequirement(); + int clean_direction_requirement = roboSweeperFutianCleanCmd.getCleanDirectionRequirement(); + int clean_intensity_requirement = roboSweeperFutianCleanCmd.getCleanIntensityRequirement(); + Log.d(TAG, "---- sendSweeperFuTianTaskCmd ----" + + "[clean_open_requirement = " + clean_open_requirement + "]," + + "[clean_mode_requirement = " + clean_mode_requirement + "]," + + "[clean_direction_requirement = " + clean_direction_requirement + "]," + + "[clean_intensity_requirement = " + clean_intensity_requirement + "]" + ); } private final static SweeperOperateCmdHandler mSweeperOperateCmdHandler = new SweeperOperateCmdHandler(); private static CmdRequestCallback mCurrentCmdRequestCallback; private static final int MSG_CMD_EXECUTE_COUNT_DOWN = 10001; + private static final int MSG_CMD_EXECUTE_MOCK_SUCCESS = 10002; + /** + * 执行命令时倒计时的Handler + */ static class SweeperOperateCmdHandler extends Handler { @Override @@ -256,17 +762,26 @@ public class SweeperOperatePanelView extends LinearLayout{ if (msg.what == MSG_CMD_EXECUTE_COUNT_DOWN) { int seconds = (int) msg.obj; if (seconds > 0) { - mCurrentCmdRequestCallback.onCountDownTick(seconds); + if (mCurrentCmdRequestCallback != null) { + mCurrentCmdRequestCallback.onCountDownTick(seconds); + } Message newMsg = Message.obtain(); newMsg.what = MSG_CMD_EXECUTE_COUNT_DOWN; - newMsg.obj = seconds-1; + newMsg.obj = seconds - 1; mSweeperOperateCmdHandler.sendMessageDelayed(newMsg, 1000L); } else { if (mCurrentCmdRequestCallback != null) { mCurrentCmdRequestCallback.onCmdTimeout(); mCurrentCmdRequestCallback = null; } + removeMessages(MSG_CMD_EXECUTE_COUNT_DOWN); } + } else if (msg.what == MSG_CMD_EXECUTE_MOCK_SUCCESS) { + if (mCurrentCmdRequestCallback != null) { + mCurrentCmdRequestCallback.onCmdSuccess(); + mCurrentCmdRequestCallback = null; + } + removeMessages(MSG_CMD_EXECUTE_COUNT_DOWN); } } } diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/util/SweeperFutianCmdUtil.java b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/util/SweeperFutianCmdUtil.java index 92b1eaecaf..4fe8d9ff9c 100644 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/util/SweeperFutianCmdUtil.java +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/util/SweeperFutianCmdUtil.java @@ -8,17 +8,17 @@ import chassis.SpecialVehicleTaskCmdOuterClass; public class SweeperFutianCmdUtil { private static final int CLEAN_WORK_OPEN = 1; //清扫作业-开启 private static final int CLEAN_WORK_CLOSE = 2;//清扫作业-关闭 - private static final int CLEAN_MODE_PURE_SWEEP = 1;//作业模式-纯扫 - private static final int CLEAN_MODE_WASH_SWEEP = 2;//作业模式-洗扫 - private static final int CLEAN_MODE_PURE_WASH = 3;//作业模式-纯洗 - private static final int CLEAN_MODE_PURE_DRAW = 4;//作业模式-纯吸 + public static final int CLEAN_MODE_PURE_SWEEP = 1;//作业模式-纯扫 + public static final int CLEAN_MODE_WASH_SWEEP = 2;//作业模式-洗扫 + public static final int CLEAN_MODE_PURE_WASH = 3;//作业模式-纯洗 + public static final int CLEAN_MODE_PURE_DRAW = 4;//作业模式-纯吸 private static final int CLEAN_MODE_CLOSE = 5;//作业模式-关闭 - private static final int CLEAN_DIRECTION_BOTH_SIDE = 1;//清扫方向-两侧 - private static final int CLEAN_DIRECTION_LEFT_SIDE = 2;//清扫方向-左侧 - private static final int CLEAN_DIRECTION_RIGHT_SIDE = 3;//清扫方向-右侧 + public static final int CLEAN_DIRECTION_BOTH_SIDE = 1;//清扫方向-两侧 + public static final int CLEAN_DIRECTION_LEFT_SIDE = 2;//清扫方向-左侧 + public static final int CLEAN_DIRECTION_RIGHT_SIDE = 3;//清扫方向-右侧 private static final int CLEAN_DIRECTION_CLOSE = 4;//清扫方向-关闭 - private static final int CLEAN_INTENSITY_STRAND = 1;//作业强度-标准 - private static final int CLEAN_INTENSITY_STRONG = 2;//作业强度-加强 + public static final int CLEAN_INTENSITY_STRAND = 1;//作业强度-标准 + public static final int CLEAN_INTENSITY_STRONG = 2;//作业强度-加强 public static SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd buildCleanWorkStartCmd() { return buildCleanWorkCmd(CLEAN_WORK_OPEN); @@ -40,29 +40,41 @@ public class SweeperFutianCmdUtil { return buildTaskCmd(builder.build()); } + public static SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd buildCleanModePureDrawCmd() { + SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.Builder builder = SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.newBuilder(); + builder.setCleanModeRequirement(CLEAN_MODE_PURE_DRAW); + //不用设置作业方向,自动设置作业强度为:标准 + builder.setCleanIntensityRequirement(CLEAN_INTENSITY_STRAND); + return buildTaskCmd(builder.build()); + } + public static SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd buildCleanModeCloseCmd() { - return buildCleanModeCmd(CLEAN_MODE_CLOSE); + SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.Builder builder = SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.newBuilder(); + builder.setCleanModeRequirement(CLEAN_MODE_CLOSE); + //关闭清扫方向,待下次在选择 + builder.setCleanDirectionRequirement(CLEAN_DIRECTION_CLOSE); + //自动设置作业强度为:标准 + builder.setCleanIntensityRequirement(CLEAN_INTENSITY_STRAND); + return buildTaskCmd(builder.build()); } public static SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd buildCleanDirectionCmd(int value) { SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.Builder builder = SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.newBuilder(); builder.setCleanDirectionRequirement(value); + builder.setCleanIntensityRequirement(CLEAN_INTENSITY_STRAND); + // 同时作业强度默认:标准 return buildTaskCmd(builder.build()); } public static SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd buildCleanDirectionCloseCmd() { - return buildCleanDirectionCmd(CLEAN_DIRECTION_CLOSE); + SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.Builder builder = SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.newBuilder(); + builder.setCleanDirectionRequirement(CLEAN_DIRECTION_CLOSE); + //重置作业强度为标准 + builder.setCleanIntensityRequirement(CLEAN_INTENSITY_STRAND); + return buildTaskCmd(builder.build()); } - public static SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd buildCleanIntensityStandardCmd() { - return buildCleanIntensityCmd(CLEAN_INTENSITY_STRAND); - } - - public static SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd buildCleanIntensityStrongCmd() { - return buildCleanIntensityCmd(CLEAN_INTENSITY_STRONG); - } - - private static SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd buildCleanIntensityCmd(int value) { + public static SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd buildCleanIntensityCmd(int value) { SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.Builder builder = SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.newBuilder(); builder.setCleanIntensityRequirement(value); return buildTaskCmd(builder.build()); diff --git a/OCH/mogo-och-sweeper/src/main/res/drawable/sweeper_operate_panel_btn1_bg_selector.xml b/OCH/mogo-och-sweeper/src/main/res/drawable/sweeper_operate_panel_btn1_bg_selector.xml index e73562aa4f..ba7719ba91 100644 --- a/OCH/mogo-och-sweeper/src/main/res/drawable/sweeper_operate_panel_btn1_bg_selector.xml +++ b/OCH/mogo-och-sweeper/src/main/res/drawable/sweeper_operate_panel_btn1_bg_selector.xml @@ -1,4 +1,4 @@ - - + + \ No newline at end of file diff --git a/OCH/mogo-och-sweeper/src/main/res/drawable/sweeper_operate_panel_btn2_bg_selector.xml b/OCH/mogo-och-sweeper/src/main/res/drawable/sweeper_operate_panel_btn2_bg_selector.xml index 7f990b092f..c51538216c 100755 --- a/OCH/mogo-och-sweeper/src/main/res/drawable/sweeper_operate_panel_btn2_bg_selector.xml +++ b/OCH/mogo-och-sweeper/src/main/res/drawable/sweeper_operate_panel_btn2_bg_selector.xml @@ -1,6 +1,6 @@ - - - + + + \ No newline at end of file diff --git a/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_operate_panel_view.xml b/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_operate_panel_view.xml index d8ef44ecf0..99d21b9d10 100644 --- a/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_operate_panel_view.xml +++ b/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_operate_panel_view.xml @@ -6,7 +6,7 @@ android:layout_height="wrap_content"> - + app:layout_constraintLeft_toRightOf="@id/hint_clean_work" + app:layout_constraintTop_toTopOf="@id/hint_clean_work" /> + app:constraint_referenced_ids="hint_clean_work, btn_clean_work_open_close" /> + app:layout_constraintTop_toBottomOf="@id/clean_work_barrier" /> - + android:enabled="false" + app:layout_constraintLeft_toRightOf="@id/hint_clean_mode" + app:layout_constraintTop_toTopOf="@id/hint_clean_mode" /> - + android:enabled="false" + app:layout_constraintLeft_toRightOf="@id/btn_clean_mode_pure_sweep" + app:layout_constraintTop_toTopOf="@id/hint_clean_mode" /> - + android:enabled="false" + app:layout_constraintLeft_toLeftOf="@id/btn_clean_mode_pure_sweep" + app:layout_constraintTop_toBottomOf="@id/btn_clean_mode_pure_sweep" /> - + android:enabled="false" + app:layout_constraintLeft_toRightOf="@id/btn_clean_mode_sweep_wash" + app:layout_constraintTop_toTopOf="@id/btn_clean_mode_sweep_wash" /> + app:constraint_referenced_ids="hint_clean_mode, btn_clean_mode_pure_sweep, btn_clean_mode_pure_wash, btn_clean_mode_sweep_wash, btn_clean_mode_pure_absorption" /> + app:layout_constraintTop_toBottomOf="@id/clean_mode_barrier" /> - - - @@ -201,7 +209,7 @@ app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintTop_toBottomOf="@id/clean_direction_barrier" /> - - From 19f86f46cbfecf37461f51b371636a8ae99b3bc4 Mon Sep 17 00:00:00 2001 From: aibingbing Date: Fri, 26 Aug 2022 19:17:58 +0800 Subject: [PATCH 5/8] =?UTF-8?q?[=E6=B8=85=E6=89=AB=E8=BD=A6]feat:=20?= =?UTF-8?q?=E5=A4=84=E7=90=86=E5=BC=82=E5=B8=B8=E6=83=85=E5=86=B5=EF=BC=8C?= =?UTF-8?q?=E7=AC=AC=E4=B8=80=E6=AC=A1=E5=B1=95=E7=A4=BA=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E6=97=B6=E6=A0=B9=E6=8D=AE=E9=80=8F=E5=87=BA?= =?UTF-8?q?=E7=9A=84=E5=BA=95=E7=9B=98=E6=95=B0=E6=8D=AE=E6=81=A2=E5=A4=8D?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8C=89=E9=92=AE=E7=8A=B6=E6=80=81=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sweeper/ui/SweeperOperatePanelView.java | 111 +++++++++++++++++- .../sweeper/util/SweeperFutianCmdUtil.java | 59 ++++++++++ 2 files changed, 169 insertions(+), 1 deletion(-) diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java index 1b40a8f95f..86ee7e3d0d 100644 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java @@ -31,6 +31,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager; import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager; import com.mogo.eagle.core.utilcode.util.ThreadUtils; import com.mogo.eagle.core.utilcode.util.ToastUtils; +import com.mogo.eagle.core.utilcode.util.UiThreadHandler; import com.mogo.module.common.view.OnPreventFastClickListener; import com.mogo.och.sweeper.R; import com.mogo.och.sweeper.util.SweeperFutianCmdUtil; @@ -557,6 +558,7 @@ public class SweeperOperatePanelView extends LinearLayout { getContext().getApplicationContext().getString(R.string.sweeper_operate_panel_cmd_execute_timeout), timeout )); + mLoadingHintBottom.setVisibility(timeout < 0 ? View.INVISIBLE : View.VISIBLE); }); } @@ -680,6 +682,11 @@ public class SweeperOperatePanelView extends LinearLayout { @Override public void onSweeperFutianCleanSystemState(@NonNull VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) { + // 第一次进入时同步底盘状态,只拿第一次的数据 + if (mSyncingVehicleState) { + onSyncVehicleStateCallBack(cleanSystemState); + return; + } // 有命令正在执行 if (mCurrentCmdRequestCallback != null) { if (mCurrentCmdRequestCallback.onCheckIfCmdSuccess(cleanSystemState)) { @@ -694,6 +701,12 @@ public class SweeperOperatePanelView extends LinearLayout { protected void onAttachedToWindow() { super.onAttachedToWindow(); CallerAutopilotVehicleStateListenerManager.INSTANCE.addListener(TAG, mIMoGoAutopilotVehicleStateListener); + syncVehicleStateAndRecoverOperatePanelStates(); + // TODO + // Mock VehicleState 数据回调 + UiThreadHandler.postDelayed(() -> { + onSyncVehicleStateCallBack(SweeperFutianCmdUtil.buildSweeperFuTionCleanSystemStateMockData()); + }, 3000L); } @Override @@ -702,6 +715,101 @@ public class SweeperOperatePanelView extends LinearLayout { CallerAutopilotVehicleStateListenerManager.INSTANCE.removeListener(TAG); } + /** + * 等待同步底盘数据,并根据底盘数据恢复操作面板中按钮的状态 + */ + private synchronized void syncVehicleStateAndRecoverOperatePanelStates() { + // show sync loading + showLoadingMask("状态同步中,请稍后", -1); + mSyncingVehicleState = true; + } + + private synchronized void onSyncVehicleStateCallBack(VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) { + if (cleanSystemState == null) return; + mSyncingVehicleState = false; + // 清扫作业开启状态(以电机状态为true代表Open成功,实际控制端控制步骤为:1.发送远程控制上装指令 2.发送电机启动指令) + boolean clean_open_requirement = cleanSystemState.getSecuMotWorkSts(); + // 作业模式状态 + // 洗扫 + boolean clean_mode_wash_sweep = cleanSystemState.getSecuModWashSweepSts(); + // 纯洗 + boolean clean_mode_pure_wash = cleanSystemState.getSecuModWashSts(); + // 纯吸 + boolean clean_mode_pure_draw = cleanSystemState.getSecuWorkTonSts(); + + // 清扫方向状态 + // 左侧 + boolean clean_direction_left_side = cleanSystemState.getSecuWorkLeftSts(); + // 右侧 + boolean clean_direction_right_side = cleanSystemState.getSecuWorkRightSts(); + // 两侧 + boolean clean_direction_both_side = cleanSystemState.getSecuWorkOnBothsidesSts(); + + // 纯扫 模式判断:不是另外其他3个模式,同时有清扫方向,说明开启了纯扫模式 + boolean clean_mode_pure_sweep = (clean_direction_left_side || clean_direction_right_side || clean_direction_both_side) + && (!clean_mode_wash_sweep && !clean_mode_pure_wash && !clean_mode_pure_draw); + + // 作业强度状态 + boolean clean_intensity_standard = cleanSystemState.getSecuWorkStandSts(); + boolean clean_intensity_strong = cleanSystemState.getSecuWorkStrongSts(); + + runOnUIThread(() -> { + if (clean_open_requirement) { + // 打开状态 + mBtnCleanWorkOpenClose.setText("Close"); + mBtnCleanWorkOpenClose.setChecked(true); + } else { + // 关闭状态 + mBtnCleanWorkOpenClose.setText("Open"); + mBtnCleanWorkOpenClose.setChecked(false); + } + if (clean_mode_pure_sweep) { + //纯扫 + mBtnCleanModePureSweep.setChecked(true); + mBtnCleanModePureSweep.setEnabled(true); + toggleCleanModeBtnsByChoosedViewId(R.id.btn_clean_mode_pure_sweep, false); + } else if (clean_mode_pure_wash) { + //纯洗 + mBtnCleanModePureWash.setChecked(true); + mBtnCleanModePureWash.setEnabled(true); + toggleCleanModeBtnsByChoosedViewId(R.id.btn_clean_mode_pure_wash, false); + } else if (clean_mode_wash_sweep) { + //洗扫 + mBtnCleanModeSweepWash.setChecked(true); + mBtnCleanModeSweepWash.setEnabled(true); + toggleCleanModeBtnsByChoosedViewId(R.id.btn_clean_mode_sweep_wash, false); + } else if (clean_mode_pure_draw) { + //纯吸,需要disable作业方向 + mBtnCleanModePureAbsorption.setChecked(true); + mBtnCleanModePureAbsorption.setEnabled(true); + toggleCleanModeBtnsByChoosedViewId(R.id.btn_clean_mode_pure_absorption, false); + toggleCleanDirectionBtnsStatus(false); + } + + if (!clean_mode_pure_draw) {// 非纯吸模式才有清扫方向 + if (clean_direction_left_side) { + mBtnCleanDirectionLeftSide.setChecked(true); + mBtnCleanDirectionLeftSide.setEnabled(true); + toggleCleanDirectionBtnsByChoosedViewId(R.id.btn_clean_direction_left_side, false); + } else if (clean_direction_right_side) { + mBtnCleanDirectionRightSide.setChecked(true); + mBtnCleanDirectionRightSide.setEnabled(true); + toggleCleanDirectionBtnsByChoosedViewId(R.id.btn_clean_direction_right_side, false); + } else if (clean_direction_both_side) { + mBtnCleanDirectionBothSide.setChecked(true); + mBtnCleanDirectionBothSide.setEnabled(true); + toggleCleanDirectionBtnsByChoosedViewId(R.id.btn_clean_direction_both_side, false); + } + } + if (clean_intensity_standard) { + setCleanIntensityStandard(); + } else if (clean_intensity_strong) { + setCleanIntensityStrong(); + } + }); + hideLoadingMask(); + } + /** * 发送清扫车相关作业命令 * @@ -747,7 +855,8 @@ public class SweeperOperatePanelView extends LinearLayout { } private final static SweeperOperateCmdHandler mSweeperOperateCmdHandler = new SweeperOperateCmdHandler(); - private static CmdRequestCallback mCurrentCmdRequestCallback; + private static CmdRequestCallback mCurrentCmdRequestCallback;//发送命令后的回调 + private boolean mSyncingVehicleState;//第一次进入页面时,同步底盘状态的标志位 private static final int MSG_CMD_EXECUTE_COUNT_DOWN = 10001; private static final int MSG_CMD_EXECUTE_MOCK_SUCCESS = 10002; diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/util/SweeperFutianCmdUtil.java b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/util/SweeperFutianCmdUtil.java index 4fe8d9ff9c..969b0dbc34 100644 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/util/SweeperFutianCmdUtil.java +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/util/SweeperFutianCmdUtil.java @@ -1,6 +1,7 @@ package com.mogo.och.sweeper.util; import chassis.SpecialVehicleTaskCmdOuterClass; +import chassis.VehicleStateOuterClass; /** * 清扫车-福田,构建业务命令数据的工具类 @@ -20,26 +21,48 @@ public class SweeperFutianCmdUtil { public static final int CLEAN_INTENSITY_STRAND = 1;//作业强度-标准 public static final int CLEAN_INTENSITY_STRONG = 2;//作业强度-加强 + /** + * 清扫作业:打开 + * + * @return + */ public static SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd buildCleanWorkStartCmd() { return buildCleanWorkCmd(CLEAN_WORK_OPEN); } + /** + * 清扫作业:关闭 + * + * @return + */ public static SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd buildCleanWorkStopCmd() { return buildCleanWorkCmd(CLEAN_WORK_CLOSE); } + private static SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd buildCleanWorkCmd(int startOrStop) { SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.Builder builder = SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.newBuilder(); builder.setCleanOpenRequirement(startOrStop); return buildTaskCmd(builder.build()); } + /** + * 作业模式:传入具体的模式对应的值 + * + * @param value + * @return + */ public static SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd buildCleanModeCmd(int value) { SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.Builder builder = SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.newBuilder(); builder.setCleanModeRequirement(value); return buildTaskCmd(builder.build()); } + /** + * 作业模式:纯吸 + * + * @return + */ public static SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd buildCleanModePureDrawCmd() { SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.Builder builder = SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.newBuilder(); builder.setCleanModeRequirement(CLEAN_MODE_PURE_DRAW); @@ -48,6 +71,11 @@ public class SweeperFutianCmdUtil { return buildTaskCmd(builder.build()); } + /** + * 作业模式:关闭作业模式 + * + * @return + */ public static SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd buildCleanModeCloseCmd() { SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.Builder builder = SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.newBuilder(); builder.setCleanModeRequirement(CLEAN_MODE_CLOSE); @@ -58,6 +86,12 @@ public class SweeperFutianCmdUtil { return buildTaskCmd(builder.build()); } + /** + * 作业方向:根据具体的方向传入具体的值 + * + * @param value + * @return + */ public static SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd buildCleanDirectionCmd(int value) { SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.Builder builder = SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.newBuilder(); builder.setCleanDirectionRequirement(value); @@ -66,6 +100,11 @@ public class SweeperFutianCmdUtil { return buildTaskCmd(builder.build()); } + /** + * 作业方向:关闭作业方向 + * + * @return + */ public static SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd buildCleanDirectionCloseCmd() { SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.Builder builder = SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.newBuilder(); builder.setCleanDirectionRequirement(CLEAN_DIRECTION_CLOSE); @@ -74,6 +113,12 @@ public class SweeperFutianCmdUtil { return buildTaskCmd(builder.build()); } + /** + * 作业强度:传入具体的值 + * + * @param value + * @return + */ public static SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd buildCleanIntensityCmd(int value) { SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.Builder builder = SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.newBuilder(); builder.setCleanIntensityRequirement(value); @@ -86,4 +131,18 @@ public class SweeperFutianCmdUtil { .setRoboSweeperFutianCleanCmd(fuTianCleanCmd).build(); } + /** + * 构建底盘Mock数据 + * + * @return + */ + public static VehicleStateOuterClass.SweeperFuTianCleanSystemState buildSweeperFuTionCleanSystemStateMockData() { + VehicleStateOuterClass.SweeperFuTianCleanSystemState.Builder builder = VehicleStateOuterClass.SweeperFuTianCleanSystemState.newBuilder(); + builder.setSecuMotWorkSts(true); + builder.setSecuModWashSts(true); + builder.setSecuWorkOnBothsidesSts(true); + builder.setSecuWorkStrongSts(true); + return builder.build(); + } + } From 88ac8dc81e3053ebbe72e5b957c37ec175e9ebba Mon Sep 17 00:00:00 2001 From: aibingbing Date: Fri, 26 Aug 2022 20:33:14 +0800 Subject: [PATCH 6/8] =?UTF-8?q?[=E6=B8=85=E6=89=AB=E8=BD=A6]refactor:=20?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=B8=85=E6=89=AB=E8=BD=A6=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=EF=BC=8C=E6=8C=89=E9=92=AE=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sweeper/ui/SweeperOperatePanelView.java | 10 +- .../res/drawable/bg_sweeper_operate_panel.xml | 6 + .../main/res/layout/sweeper_base_fragment.xml | 4 +- .../res/layout/sweeper_operate_panel_view.xml | 168 +++++++++++------- .../src/main/res/values/colors.xml | 2 +- 5 files changed, 119 insertions(+), 71 deletions(-) create mode 100644 OCH/mogo-och-sweeper/src/main/res/drawable/bg_sweeper_operate_panel.xml diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java index 86ee7e3d0d..b03088d321 100644 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java @@ -600,6 +600,13 @@ public class SweeperOperatePanelView extends LinearLayout { ToastUtils.showLong("超时未响应,操作失败"); } + /** + * 根据底盘数据恢复操作面板中相关按钮状态 成功toast + */ + private void showRecoverPanelButtonStateSuccessToast() { + ToastUtils.showLong("恢复操作面板状态成功"); + } + /** * 关闭清扫作业时,确认操作的弹框 * @@ -806,8 +813,9 @@ public class SweeperOperatePanelView extends LinearLayout { } else if (clean_intensity_strong) { setCleanIntensityStrong(); } + hideLoadingMask(); + showRecoverPanelButtonStateSuccessToast(); }); - hideLoadingMask(); } /** diff --git a/OCH/mogo-och-sweeper/src/main/res/drawable/bg_sweeper_operate_panel.xml b/OCH/mogo-och-sweeper/src/main/res/drawable/bg_sweeper_operate_panel.xml new file mode 100644 index 0000000000..c9f7378baa --- /dev/null +++ b/OCH/mogo-och-sweeper/src/main/res/drawable/bg_sweeper_operate_panel.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_base_fragment.xml b/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_base_fragment.xml index be7b2b839f..3329a05a39 100644 --- a/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_base_fragment.xml +++ b/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_base_fragment.xml @@ -67,8 +67,8 @@ android:id="@+id/module_mogo_och_sweeper_operate_panel" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/dp_30" - android:layout_marginStart="@dimen/dp_16" + android:layout_marginTop="@dimen/dp_24" + android:layout_marginStart="@dimen/dp_8" app:layout_constraintLeft_toRightOf="@id/fl_speed" app:layout_constraintTop_toTopOf="@id/fl_speed" tools:background="#f00" diff --git a/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_operate_panel_view.xml b/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_operate_panel_view.xml index 99d21b9d10..a2921be484 100644 --- a/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_operate_panel_view.xml +++ b/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_operate_panel_view.xml @@ -3,13 +3,21 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" - android:layout_height="wrap_content"> + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/dp_32" + android:background="@drawable/bg_sweeper_operate_panel" + android:padding="@dimen/dp_8"> @@ -73,16 +88,17 @@ android:id="@+id/btn_clean_mode_pure_wash" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="@dimen/dp_32" + android:layout_marginStart="@dimen/dp_28" android:background="@drawable/sweeper_operate_panel_btn2_bg_selector" - android:paddingStart="@dimen/dp_20" - android:paddingTop="@dimen/dp_6" - android:paddingEnd="@dimen/dp_20" - android:paddingBottom="@dimen/dp_6" + android:enabled="false" + android:gravity="center" + android:paddingStart="@dimen/dp_32" + android:paddingTop="@dimen/dp_12" + android:paddingEnd="@dimen/dp_32" + android:paddingBottom="@dimen/dp_12" android:text="纯洗" android:textColor="#000000" android:textSize="@dimen/sweeper_operate_panel_btn_text_size" - android:enabled="false" app:layout_constraintLeft_toRightOf="@id/btn_clean_mode_pure_sweep" app:layout_constraintTop_toTopOf="@id/hint_clean_mode" /> @@ -90,16 +106,17 @@ android:id="@+id/btn_clean_mode_sweep_wash" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/dp_32" + android:layout_marginTop="@dimen/dp_28" android:background="@drawable/sweeper_operate_panel_btn2_bg_selector" - android:paddingStart="@dimen/dp_20" - android:paddingTop="@dimen/dp_6" - android:paddingEnd="@dimen/dp_20" - android:paddingBottom="@dimen/dp_6" + android:enabled="false" + android:gravity="center" + android:paddingStart="@dimen/dp_32" + android:paddingTop="@dimen/dp_12" + android:paddingEnd="@dimen/dp_32" + android:paddingBottom="@dimen/dp_12" android:text="洗扫" android:textColor="#000000" android:textSize="@dimen/sweeper_operate_panel_btn_text_size" - android:enabled="false" app:layout_constraintLeft_toLeftOf="@id/btn_clean_mode_pure_sweep" app:layout_constraintTop_toBottomOf="@id/btn_clean_mode_pure_sweep" /> @@ -107,16 +124,17 @@ android:id="@+id/btn_clean_mode_pure_absorption" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="@dimen/dp_32" + android:layout_marginStart="@dimen/dp_28" android:background="@drawable/sweeper_operate_panel_btn2_bg_selector" - android:paddingStart="@dimen/dp_20" - android:paddingTop="@dimen/dp_6" - android:paddingEnd="@dimen/dp_20" - android:paddingBottom="@dimen/dp_6" + android:enabled="false" + android:gravity="center" + android:paddingStart="@dimen/dp_32" + android:paddingTop="@dimen/dp_12" + android:paddingEnd="@dimen/dp_32" + android:paddingBottom="@dimen/dp_12" android:text="纯吸" android:textColor="#000000" android:textSize="@dimen/sweeper_operate_panel_btn_text_size" - android:enabled="false" app:layout_constraintLeft_toRightOf="@id/btn_clean_mode_sweep_wash" app:layout_constraintTop_toTopOf="@id/btn_clean_mode_sweep_wash" /> @@ -131,8 +149,13 @@ android:id="@+id/hint_clean_direction" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/dp_32" + android:layout_marginTop="@dimen/dp_28" android:background="#ffffff" + android:gravity="top|center_horizontal" + android:paddingStart="@dimen/dp_8" + android:paddingTop="@dimen/dp_12" + android:paddingEnd="@dimen/dp_8" + android:paddingBottom="@dimen/dp_12" android:text="清扫方向" android:textColor="#000000" android:textSize="@dimen/sweeper_operate_panel_btn_text_size" @@ -143,16 +166,17 @@ android:id="@+id/btn_clean_direction_left_side" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="@dimen/dp_32" + android:layout_marginStart="@dimen/dp_28" android:background="@drawable/sweeper_operate_panel_btn2_bg_selector" - android:paddingStart="@dimen/dp_20" - android:paddingTop="@dimen/dp_6" - android:paddingEnd="@dimen/dp_20" - android:paddingBottom="@dimen/dp_6" + android:enabled="false" + android:gravity="center" + android:paddingStart="@dimen/dp_32" + android:paddingTop="@dimen/dp_12" + android:paddingEnd="@dimen/dp_32" + android:paddingBottom="@dimen/dp_12" android:text="左侧" android:textColor="#000000" android:textSize="@dimen/sweeper_operate_panel_btn_text_size" - android:enabled="false" app:layout_constraintLeft_toRightOf="@id/hint_clean_direction" app:layout_constraintTop_toTopOf="@id/hint_clean_direction" /> @@ -160,16 +184,17 @@ android:id="@+id/btn_clean_direction_right_side" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="@dimen/dp_32" + android:layout_marginStart="@dimen/dp_28" android:background="@drawable/sweeper_operate_panel_btn2_bg_selector" - android:paddingStart="@dimen/dp_20" - android:paddingTop="@dimen/dp_6" - android:paddingEnd="@dimen/dp_20" - android:paddingBottom="@dimen/dp_6" + android:enabled="false" + android:gravity="center" + android:paddingStart="@dimen/dp_32" + android:paddingTop="@dimen/dp_12" + android:paddingEnd="@dimen/dp_32" + android:paddingBottom="@dimen/dp_12" android:text="右侧" android:textColor="#000000" android:textSize="@dimen/sweeper_operate_panel_btn_text_size" - android:enabled="false" app:layout_constraintLeft_toRightOf="@id/btn_clean_direction_left_side" app:layout_constraintTop_toTopOf="@id/hint_clean_direction" /> @@ -177,16 +202,17 @@ android:id="@+id/btn_clean_direction_both_side" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/dp_32" + android:layout_marginTop="@dimen/dp_28" android:background="@drawable/sweeper_operate_panel_btn2_bg_selector" - android:paddingStart="@dimen/dp_20" - android:paddingTop="@dimen/dp_6" - android:paddingEnd="@dimen/dp_20" - android:paddingBottom="@dimen/dp_6" + android:enabled="false" + android:gravity="center" + android:paddingStart="@dimen/dp_32" + android:paddingTop="@dimen/dp_12" + android:paddingEnd="@dimen/dp_32" + android:paddingBottom="@dimen/dp_12" android:text="两侧" android:textColor="#000000" android:textSize="@dimen/sweeper_operate_panel_btn_text_size" - android:enabled="false" app:layout_constraintLeft_toLeftOf="@id/btn_clean_direction_left_side" app:layout_constraintTop_toBottomOf="@id/btn_clean_direction_left_side" /> @@ -201,8 +227,13 @@ android:id="@+id/hint_clean_intensity" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/dp_32" + android:layout_marginTop="@dimen/dp_28" android:background="#ffffff" + android:gravity="top|center_horizontal" + android:paddingStart="@dimen/dp_8" + android:paddingTop="@dimen/dp_12" + android:paddingEnd="@dimen/dp_8" + android:paddingBottom="@dimen/dp_12" android:text="作业强度" android:textColor="#000000" android:textSize="@dimen/sweeper_operate_panel_btn_text_size" @@ -213,16 +244,17 @@ android:id="@+id/btn_clean_intensity_standard" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="@dimen/dp_32" + android:layout_marginStart="@dimen/dp_28" android:background="@drawable/sweeper_operate_panel_btn2_bg_selector" - android:paddingStart="@dimen/dp_20" - android:paddingTop="@dimen/dp_6" - android:paddingEnd="@dimen/dp_20" - android:paddingBottom="@dimen/dp_6" + android:enabled="false" + android:gravity="center" + android:paddingStart="@dimen/dp_32" + android:paddingTop="@dimen/dp_12" + android:paddingEnd="@dimen/dp_32" + android:paddingBottom="@dimen/dp_12" android:text="标准" android:textColor="#000000" android:textSize="@dimen/sweeper_operate_panel_btn_text_size" - android:enabled="false" app:layout_constraintLeft_toRightOf="@id/hint_clean_intensity" app:layout_constraintTop_toTopOf="@id/hint_clean_intensity" /> @@ -230,16 +262,17 @@ android:id="@+id/btn_clean_intensity_strong" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="@dimen/dp_32" + android:layout_marginStart="@dimen/dp_28" android:background="@drawable/sweeper_operate_panel_btn2_bg_selector" - android:paddingStart="@dimen/dp_20" - android:paddingTop="@dimen/dp_6" - android:paddingEnd="@dimen/dp_20" - android:paddingBottom="@dimen/dp_6" + android:enabled="false" + android:gravity="center" + android:paddingStart="@dimen/dp_32" + android:paddingTop="@dimen/dp_12" + android:paddingEnd="@dimen/dp_32" + android:paddingBottom="@dimen/dp_12" android:text="强力" android:textColor="#000000" android:textSize="@dimen/sweeper_operate_panel_btn_text_size" - android:enabled="false" app:layout_constraintLeft_toRightOf="@id/btn_clean_intensity_standard" app:layout_constraintTop_toTopOf="@id/hint_clean_intensity" /> @@ -247,14 +280,14 @@ android:id="@+id/loading_hint_container" android:layout_width="0dp" android:layout_height="0dp" - android:background="#80000000" + android:background="#cc000000" android:gravity="center" android:orientation="vertical" + android:visibility="visible" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" - app:layout_constraintTop_toTopOf="parent" - android:visibility="gone"> + app:layout_constraintTop_toTopOf="parent"> diff --git a/OCH/mogo-och-sweeper/src/main/res/values/colors.xml b/OCH/mogo-och-sweeper/src/main/res/values/colors.xml index 9ac3b75954..855ffb1a50 100644 --- a/OCH/mogo-och-sweeper/src/main/res/values/colors.xml +++ b/OCH/mogo-och-sweeper/src/main/res/values/colors.xml @@ -50,7 +50,7 @@ #BF30334C #ffffff #1FA7FF - #50000000 + #80ffffff #BF30334C \ No newline at end of file From 3406135832dbccbfa3f9bda4918f650e2d8b5dc8 Mon Sep 17 00:00:00 2001 From: aibingbing Date: Fri, 26 Aug 2022 20:36:09 +0800 Subject: [PATCH 7/8] =?UTF-8?q?[=E6=B8=85=E6=89=AB=E8=BD=A6]refactor:=20?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=B8=85=E6=89=AB=E8=BD=A6=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=EF=BC=8C=E6=8C=89=E9=92=AE=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sweeper/ui/SweeperOperatePanelView.java | 10 +- .../res/drawable/bg_sweeper_operate_panel.xml | 6 + .../main/res/layout/sweeper_base_fragment.xml | 4 +- .../res/layout/sweeper_operate_panel_view.xml | 168 +++++++++++------- .../src/main/res/values/colors.xml | 2 +- 5 files changed, 119 insertions(+), 71 deletions(-) create mode 100644 OCH/mogo-och-sweeper/src/main/res/drawable/bg_sweeper_operate_panel.xml diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java index 86ee7e3d0d..b03088d321 100644 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java @@ -600,6 +600,13 @@ public class SweeperOperatePanelView extends LinearLayout { ToastUtils.showLong("超时未响应,操作失败"); } + /** + * 根据底盘数据恢复操作面板中相关按钮状态 成功toast + */ + private void showRecoverPanelButtonStateSuccessToast() { + ToastUtils.showLong("恢复操作面板状态成功"); + } + /** * 关闭清扫作业时,确认操作的弹框 * @@ -806,8 +813,9 @@ public class SweeperOperatePanelView extends LinearLayout { } else if (clean_intensity_strong) { setCleanIntensityStrong(); } + hideLoadingMask(); + showRecoverPanelButtonStateSuccessToast(); }); - hideLoadingMask(); } /** diff --git a/OCH/mogo-och-sweeper/src/main/res/drawable/bg_sweeper_operate_panel.xml b/OCH/mogo-och-sweeper/src/main/res/drawable/bg_sweeper_operate_panel.xml new file mode 100644 index 0000000000..c9f7378baa --- /dev/null +++ b/OCH/mogo-och-sweeper/src/main/res/drawable/bg_sweeper_operate_panel.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_base_fragment.xml b/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_base_fragment.xml index be7b2b839f..3329a05a39 100644 --- a/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_base_fragment.xml +++ b/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_base_fragment.xml @@ -67,8 +67,8 @@ android:id="@+id/module_mogo_och_sweeper_operate_panel" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/dp_30" - android:layout_marginStart="@dimen/dp_16" + android:layout_marginTop="@dimen/dp_24" + android:layout_marginStart="@dimen/dp_8" app:layout_constraintLeft_toRightOf="@id/fl_speed" app:layout_constraintTop_toTopOf="@id/fl_speed" tools:background="#f00" diff --git a/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_operate_panel_view.xml b/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_operate_panel_view.xml index 99d21b9d10..71c7fc1754 100644 --- a/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_operate_panel_view.xml +++ b/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_operate_panel_view.xml @@ -3,13 +3,21 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" - android:layout_height="wrap_content"> + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/dp_32" + android:background="@drawable/bg_sweeper_operate_panel" + android:padding="@dimen/dp_8"> @@ -73,16 +88,17 @@ android:id="@+id/btn_clean_mode_pure_wash" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="@dimen/dp_32" + android:layout_marginStart="@dimen/dp_28" android:background="@drawable/sweeper_operate_panel_btn2_bg_selector" - android:paddingStart="@dimen/dp_20" - android:paddingTop="@dimen/dp_6" - android:paddingEnd="@dimen/dp_20" - android:paddingBottom="@dimen/dp_6" + android:enabled="false" + android:gravity="center" + android:paddingStart="@dimen/dp_32" + android:paddingTop="@dimen/dp_12" + android:paddingEnd="@dimen/dp_32" + android:paddingBottom="@dimen/dp_12" android:text="纯洗" android:textColor="#000000" android:textSize="@dimen/sweeper_operate_panel_btn_text_size" - android:enabled="false" app:layout_constraintLeft_toRightOf="@id/btn_clean_mode_pure_sweep" app:layout_constraintTop_toTopOf="@id/hint_clean_mode" /> @@ -90,16 +106,17 @@ android:id="@+id/btn_clean_mode_sweep_wash" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/dp_32" + android:layout_marginTop="@dimen/dp_28" android:background="@drawable/sweeper_operate_panel_btn2_bg_selector" - android:paddingStart="@dimen/dp_20" - android:paddingTop="@dimen/dp_6" - android:paddingEnd="@dimen/dp_20" - android:paddingBottom="@dimen/dp_6" + android:enabled="false" + android:gravity="center" + android:paddingStart="@dimen/dp_32" + android:paddingTop="@dimen/dp_12" + android:paddingEnd="@dimen/dp_32" + android:paddingBottom="@dimen/dp_12" android:text="洗扫" android:textColor="#000000" android:textSize="@dimen/sweeper_operate_panel_btn_text_size" - android:enabled="false" app:layout_constraintLeft_toLeftOf="@id/btn_clean_mode_pure_sweep" app:layout_constraintTop_toBottomOf="@id/btn_clean_mode_pure_sweep" /> @@ -107,16 +124,17 @@ android:id="@+id/btn_clean_mode_pure_absorption" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="@dimen/dp_32" + android:layout_marginStart="@dimen/dp_28" android:background="@drawable/sweeper_operate_panel_btn2_bg_selector" - android:paddingStart="@dimen/dp_20" - android:paddingTop="@dimen/dp_6" - android:paddingEnd="@dimen/dp_20" - android:paddingBottom="@dimen/dp_6" + android:enabled="false" + android:gravity="center" + android:paddingStart="@dimen/dp_32" + android:paddingTop="@dimen/dp_12" + android:paddingEnd="@dimen/dp_32" + android:paddingBottom="@dimen/dp_12" android:text="纯吸" android:textColor="#000000" android:textSize="@dimen/sweeper_operate_panel_btn_text_size" - android:enabled="false" app:layout_constraintLeft_toRightOf="@id/btn_clean_mode_sweep_wash" app:layout_constraintTop_toTopOf="@id/btn_clean_mode_sweep_wash" /> @@ -131,8 +149,13 @@ android:id="@+id/hint_clean_direction" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/dp_32" + android:layout_marginTop="@dimen/dp_28" android:background="#ffffff" + android:gravity="top|center_horizontal" + android:paddingStart="@dimen/dp_8" + android:paddingTop="@dimen/dp_12" + android:paddingEnd="@dimen/dp_8" + android:paddingBottom="@dimen/dp_12" android:text="清扫方向" android:textColor="#000000" android:textSize="@dimen/sweeper_operate_panel_btn_text_size" @@ -143,16 +166,17 @@ android:id="@+id/btn_clean_direction_left_side" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="@dimen/dp_32" + android:layout_marginStart="@dimen/dp_28" android:background="@drawable/sweeper_operate_panel_btn2_bg_selector" - android:paddingStart="@dimen/dp_20" - android:paddingTop="@dimen/dp_6" - android:paddingEnd="@dimen/dp_20" - android:paddingBottom="@dimen/dp_6" + android:enabled="false" + android:gravity="center" + android:paddingStart="@dimen/dp_32" + android:paddingTop="@dimen/dp_12" + android:paddingEnd="@dimen/dp_32" + android:paddingBottom="@dimen/dp_12" android:text="左侧" android:textColor="#000000" android:textSize="@dimen/sweeper_operate_panel_btn_text_size" - android:enabled="false" app:layout_constraintLeft_toRightOf="@id/hint_clean_direction" app:layout_constraintTop_toTopOf="@id/hint_clean_direction" /> @@ -160,16 +184,17 @@ android:id="@+id/btn_clean_direction_right_side" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="@dimen/dp_32" + android:layout_marginStart="@dimen/dp_28" android:background="@drawable/sweeper_operate_panel_btn2_bg_selector" - android:paddingStart="@dimen/dp_20" - android:paddingTop="@dimen/dp_6" - android:paddingEnd="@dimen/dp_20" - android:paddingBottom="@dimen/dp_6" + android:enabled="false" + android:gravity="center" + android:paddingStart="@dimen/dp_32" + android:paddingTop="@dimen/dp_12" + android:paddingEnd="@dimen/dp_32" + android:paddingBottom="@dimen/dp_12" android:text="右侧" android:textColor="#000000" android:textSize="@dimen/sweeper_operate_panel_btn_text_size" - android:enabled="false" app:layout_constraintLeft_toRightOf="@id/btn_clean_direction_left_side" app:layout_constraintTop_toTopOf="@id/hint_clean_direction" /> @@ -177,16 +202,17 @@ android:id="@+id/btn_clean_direction_both_side" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/dp_32" + android:layout_marginTop="@dimen/dp_28" android:background="@drawable/sweeper_operate_panel_btn2_bg_selector" - android:paddingStart="@dimen/dp_20" - android:paddingTop="@dimen/dp_6" - android:paddingEnd="@dimen/dp_20" - android:paddingBottom="@dimen/dp_6" + android:enabled="false" + android:gravity="center" + android:paddingStart="@dimen/dp_32" + android:paddingTop="@dimen/dp_12" + android:paddingEnd="@dimen/dp_32" + android:paddingBottom="@dimen/dp_12" android:text="两侧" android:textColor="#000000" android:textSize="@dimen/sweeper_operate_panel_btn_text_size" - android:enabled="false" app:layout_constraintLeft_toLeftOf="@id/btn_clean_direction_left_side" app:layout_constraintTop_toBottomOf="@id/btn_clean_direction_left_side" /> @@ -201,8 +227,13 @@ android:id="@+id/hint_clean_intensity" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/dp_32" + android:layout_marginTop="@dimen/dp_28" android:background="#ffffff" + android:gravity="top|center_horizontal" + android:paddingStart="@dimen/dp_8" + android:paddingTop="@dimen/dp_12" + android:paddingEnd="@dimen/dp_8" + android:paddingBottom="@dimen/dp_12" android:text="作业强度" android:textColor="#000000" android:textSize="@dimen/sweeper_operate_panel_btn_text_size" @@ -213,16 +244,17 @@ android:id="@+id/btn_clean_intensity_standard" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="@dimen/dp_32" + android:layout_marginStart="@dimen/dp_28" android:background="@drawable/sweeper_operate_panel_btn2_bg_selector" - android:paddingStart="@dimen/dp_20" - android:paddingTop="@dimen/dp_6" - android:paddingEnd="@dimen/dp_20" - android:paddingBottom="@dimen/dp_6" + android:enabled="false" + android:gravity="center" + android:paddingStart="@dimen/dp_32" + android:paddingTop="@dimen/dp_12" + android:paddingEnd="@dimen/dp_32" + android:paddingBottom="@dimen/dp_12" android:text="标准" android:textColor="#000000" android:textSize="@dimen/sweeper_operate_panel_btn_text_size" - android:enabled="false" app:layout_constraintLeft_toRightOf="@id/hint_clean_intensity" app:layout_constraintTop_toTopOf="@id/hint_clean_intensity" /> @@ -230,16 +262,17 @@ android:id="@+id/btn_clean_intensity_strong" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="@dimen/dp_32" + android:layout_marginStart="@dimen/dp_28" android:background="@drawable/sweeper_operate_panel_btn2_bg_selector" - android:paddingStart="@dimen/dp_20" - android:paddingTop="@dimen/dp_6" - android:paddingEnd="@dimen/dp_20" - android:paddingBottom="@dimen/dp_6" + android:enabled="false" + android:gravity="center" + android:paddingStart="@dimen/dp_32" + android:paddingTop="@dimen/dp_12" + android:paddingEnd="@dimen/dp_32" + android:paddingBottom="@dimen/dp_12" android:text="强力" android:textColor="#000000" android:textSize="@dimen/sweeper_operate_panel_btn_text_size" - android:enabled="false" app:layout_constraintLeft_toRightOf="@id/btn_clean_intensity_standard" app:layout_constraintTop_toTopOf="@id/hint_clean_intensity" /> @@ -247,14 +280,14 @@ android:id="@+id/loading_hint_container" android:layout_width="0dp" android:layout_height="0dp" - android:background="#80000000" + android:background="#cc000000" android:gravity="center" android:orientation="vertical" + android:visibility="gone" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" - app:layout_constraintTop_toTopOf="parent" - android:visibility="gone"> + app:layout_constraintTop_toTopOf="parent"> diff --git a/OCH/mogo-och-sweeper/src/main/res/values/colors.xml b/OCH/mogo-och-sweeper/src/main/res/values/colors.xml index 9ac3b75954..855ffb1a50 100644 --- a/OCH/mogo-och-sweeper/src/main/res/values/colors.xml +++ b/OCH/mogo-och-sweeper/src/main/res/values/colors.xml @@ -50,7 +50,7 @@ #BF30334C #ffffff #1FA7FF - #50000000 + #80ffffff #BF30334C \ No newline at end of file From 6122e3ec3df87b29456b048814f196ec7791033b Mon Sep 17 00:00:00 2001 From: aibingbing Date: Mon, 29 Aug 2022 11:53:49 +0800 Subject: [PATCH 8/8] =?UTF-8?q?[=E6=B8=85=E6=89=AB=E8=BD=A6]=20feat:=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=88=A4=E6=96=AD=E5=90=84=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E5=8F=91=E9=80=81=E6=98=AF=E5=90=A6=E6=88=90?= =?UTF-8?q?=E5=8A=9F=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sweeper/ui/SweeperOperatePanelView.java | 115 ++++++++++++++++-- 1 file changed, 107 insertions(+), 8 deletions(-) diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java index b03088d321..bb0ac4310e 100644 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java @@ -31,7 +31,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager; import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager; import com.mogo.eagle.core.utilcode.util.ThreadUtils; import com.mogo.eagle.core.utilcode.util.ToastUtils; -import com.mogo.eagle.core.utilcode.util.UiThreadHandler; import com.mogo.module.common.view.OnPreventFastClickListener; import com.mogo.och.sweeper.R; import com.mogo.och.sweeper.util.SweeperFutianCmdUtil; @@ -181,6 +180,15 @@ public class SweeperOperatePanelView extends LinearLayout { @Override public boolean onCheckIfCmdSuccess(VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) { + boolean success = false; + if (cleanSystemState == null) { + return success; + } + if (isCloseAction) { + success = !cleanSystemState.getSecuMotWorkSts(); + } else { + success = cleanSystemState.getSecuMotWorkSts(); + } //TODO return true; } @@ -253,8 +261,14 @@ public class SweeperOperatePanelView extends LinearLayout { } boolean isClickCurrentChoosedModeBtn = currentChoosedModeBtnView != null && currentChoosedModeBtnView.getId() == currentClickView.getId(); - //是否纯吸 + //是否纯吸View boolean isPureAbsorption = currentClickView.getId() == R.id.btn_clean_mode_pure_absorption; + //是否纯洗View + boolean isPureWash = currentClickView.getId() == R.id.btn_clean_mode_pure_wash; + //是否纯扫View + boolean isPureSweep = currentClickView.getId() == R.id.btn_clean_mode_pure_sweep; + //是否洗扫View + boolean isWashSweep = currentClickView.getId() == R.id.btn_clean_mode_sweep_wash; CmdRequestCallback cmdRequestCallback = new CmdRequestCallback() { @Override @@ -269,6 +283,28 @@ public class SweeperOperatePanelView extends LinearLayout { @Override public boolean onCheckIfCmdSuccess(VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) { + boolean success = false; + if (cleanSystemState == null) { + return success; + } + // 洗扫 + boolean clean_mode_wash_sweep = cleanSystemState.getSecuModWashSweepSts(); + // 纯洗 + boolean clean_mode_pure_wash = cleanSystemState.getSecuModWashSts(); + // 纯吸 + boolean clean_mode_pure_draw = cleanSystemState.getSecuWorkTonSts(); + // 纯扫 模式判断:不是另外其他3个模式,同时有清扫方向,说明开启了纯扫模式 + boolean clean_mode_pure_sweep = checkIfCleanModePureSweep(cleanSystemState); + + if (isPureSweep) { + success = clean_mode_pure_sweep; + } else if (isPureWash) { + success = clean_mode_pure_wash; + } else if (isWashSweep) { + success = clean_mode_wash_sweep; + } else if (isPureAbsorption) { + success = clean_mode_pure_draw; + } //TODO return true; } @@ -335,6 +371,11 @@ public class SweeperOperatePanelView extends LinearLayout { boolean isClickCurrentChoosedDirectionBtn = currentChoosedDirectionBtnView != null && currentChoosedDirectionBtnView.getId() == currentClickView.getId(); + boolean isLeftSide = currentClickView.getId() == R.id.btn_clean_direction_left_side; + boolean isRightSide = currentClickView.getId() == R.id.btn_clean_direction_right_side; + boolean isBothSide = currentClickView.getId() == R.id.btn_clean_direction_both_side; + + CmdRequestCallback cmdRequestCallback = new CmdRequestCallback() { @Override public void onSendCmd() { @@ -348,6 +389,24 @@ public class SweeperOperatePanelView extends LinearLayout { @Override public boolean onCheckIfCmdSuccess(VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) { + boolean success = false; + if (cleanSystemState == null) { + return success; + } + // 左侧 + boolean clean_direction_left_side = cleanSystemState.getSecuWorkLeftSts(); + // 右侧 + boolean clean_direction_right_side = cleanSystemState.getSecuWorkRightSts(); + // 两侧 + boolean clean_direction_both_side = cleanSystemState.getSecuWorkOnBothsidesSts(); + + if (isLeftSide) { + success = clean_direction_left_side; + } else if (isRightSide) { + success = clean_direction_right_side; + } else if (isBothSide) { + success = clean_direction_both_side; + } //TODO return true; } @@ -396,6 +455,7 @@ public class SweeperOperatePanelView extends LinearLayout { private void onCleanIntensityBtnClick(final View currentClickView) { boolean isStandardBtnClick = currentClickView.getId() == R.id.btn_clean_intensity_standard; + boolean isStrongBtnClick = currentClickView.getId() == R.id.btn_clean_intensity_strong; CmdRequestCallback cmdRequestCallback = new CmdRequestCallback() { @Override public void onSendCmd() { @@ -409,6 +469,17 @@ public class SweeperOperatePanelView extends LinearLayout { @Override public boolean onCheckIfCmdSuccess(VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) { + boolean success = false; + if (cleanSystemState == null) { + return success; + } + boolean clean_intensity_standard = cleanSystemState.getSecuWorkStandSts(); + boolean clean_intensity_strong = cleanSystemState.getSecuWorkStrongSts(); + if (isStandardBtnClick) { + success = clean_intensity_standard; + } else if (isStrongBtnClick) { + success = clean_intensity_strong; + } //TODO return true; } @@ -708,12 +779,12 @@ public class SweeperOperatePanelView extends LinearLayout { protected void onAttachedToWindow() { super.onAttachedToWindow(); CallerAutopilotVehicleStateListenerManager.INSTANCE.addListener(TAG, mIMoGoAutopilotVehicleStateListener); - syncVehicleStateAndRecoverOperatePanelStates(); +// syncVehicleStateAndRecoverOperatePanelStates(); // TODO // Mock VehicleState 数据回调 - UiThreadHandler.postDelayed(() -> { - onSyncVehicleStateCallBack(SweeperFutianCmdUtil.buildSweeperFuTionCleanSystemStateMockData()); - }, 3000L); +// UiThreadHandler.postDelayed(() -> { +// onSyncVehicleStateCallBack(SweeperFutianCmdUtil.buildSweeperFuTionCleanSystemStateMockData()); +// }, 3000L); } @Override @@ -753,8 +824,7 @@ public class SweeperOperatePanelView extends LinearLayout { boolean clean_direction_both_side = cleanSystemState.getSecuWorkOnBothsidesSts(); // 纯扫 模式判断:不是另外其他3个模式,同时有清扫方向,说明开启了纯扫模式 - boolean clean_mode_pure_sweep = (clean_direction_left_side || clean_direction_right_side || clean_direction_both_side) - && (!clean_mode_wash_sweep && !clean_mode_pure_wash && !clean_mode_pure_draw); + boolean clean_mode_pure_sweep = checkIfCleanModePureSweep(cleanSystemState); // 作业强度状态 boolean clean_intensity_standard = cleanSystemState.getSecuWorkStandSts(); @@ -818,6 +888,35 @@ public class SweeperOperatePanelView extends LinearLayout { }); } + /** + * 通过底盘数据判断是纯扫模式 + * + * @param cleanSystemState + * @return + */ + private boolean checkIfCleanModePureSweep(VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) { + // 作业模式状态 + // 洗扫 + boolean clean_mode_wash_sweep = cleanSystemState.getSecuModWashSweepSts(); + // 纯洗 + boolean clean_mode_pure_wash = cleanSystemState.getSecuModWashSts(); + // 纯吸 + boolean clean_mode_pure_draw = cleanSystemState.getSecuWorkTonSts(); + + // 清扫方向状态 + // 左侧 + boolean clean_direction_left_side = cleanSystemState.getSecuWorkLeftSts(); + // 右侧 + boolean clean_direction_right_side = cleanSystemState.getSecuWorkRightSts(); + // 两侧 + boolean clean_direction_both_side = cleanSystemState.getSecuWorkOnBothsidesSts(); + + // 纯扫 模式判断:不是另外其他3个模式,同时有清扫方向,说明开启了纯扫模式 + boolean clean_mode_pure_sweep = (clean_direction_left_side || clean_direction_right_side || clean_direction_both_side) + && (!clean_mode_wash_sweep && !clean_mode_pure_wash && !clean_mode_pure_draw); + return clean_mode_pure_sweep; + } + /** * 发送清扫车相关作业命令 *