[清扫车]清扫车上装模式逻辑修改
This commit is contained in:
@@ -108,7 +108,15 @@ public class SweeperOperatePanelView extends LinearLayout {
|
|||||||
};
|
};
|
||||||
private boolean isSelectPureSweepMode = false;//用于标注是否选中纯扫
|
private boolean isSelectPureSweepMode = false;//用于标注是否选中纯扫
|
||||||
|
|
||||||
|
private boolean isFirst=false;//是否首次打开
|
||||||
|
|
||||||
|
private static boolean isResetWorkMode=false;//是否点击复位
|
||||||
|
|
||||||
private CleaningModeStateCallback cleaningModeStateCallback;
|
private CleaningModeStateCallback cleaningModeStateCallback;
|
||||||
|
|
||||||
|
private int count=0;
|
||||||
|
|
||||||
|
private ChassisStatesOuterClass.SweeperFuTianTaskSystemStates mCleanSystemState;//当前作业模式
|
||||||
//设置清扫模式数据
|
//设置清扫模式数据
|
||||||
private static ChassisStatesOuterClass.SweeperFuTianTaskSystemStates.Builder builder =
|
private static ChassisStatesOuterClass.SweeperFuTianTaskSystemStates.Builder builder =
|
||||||
ChassisStatesOuterClass.SweeperFuTianTaskSystemStates.newBuilder();
|
ChassisStatesOuterClass.SweeperFuTianTaskSystemStates.newBuilder();
|
||||||
@@ -181,16 +189,25 @@ public class SweeperOperatePanelView extends LinearLayout {
|
|||||||
&& currentChoosedModeBtnView.getId() == currentClickView.getId();
|
&& currentChoosedModeBtnView.getId() == currentClickView.getId();
|
||||||
//是否纯吸View
|
//是否纯吸View
|
||||||
boolean isPureAbsorptionClick = currentClickView.getId() == R.id.btn_clean_mode_pure_absorption;
|
boolean isPureAbsorptionClick = currentClickView.getId() == R.id.btn_clean_mode_pure_absorption;
|
||||||
builder.setSecuWorkTonSts(isPureAbsorptionClick&&isClickCurrentChoosedModeBtn);
|
builder.setSecuWorkTonSts(isPureAbsorptionClick && !isClickCurrentChoosedModeBtn);
|
||||||
//是否纯洗View
|
//是否纯洗View
|
||||||
boolean isPureWashClick = currentClickView.getId() == R.id.btn_clean_mode_pure_wash;
|
boolean isPureWashClick = currentClickView.getId() == R.id.btn_clean_mode_pure_wash;
|
||||||
builder.setSecuModWashSts(isPureWashClick&&isClickCurrentChoosedModeBtn);
|
builder.setSecuModWashSts(isPureWashClick && !isClickCurrentChoosedModeBtn);
|
||||||
//是否纯扫View
|
//是否纯扫View
|
||||||
boolean isPureSweepClick = currentClickView.getId() == R.id.btn_clean_mode_pure_sweep;
|
boolean isPureSweepClick = currentClickView.getId() == R.id.btn_clean_mode_pure_sweep;
|
||||||
|
if (isPureSweepClick){
|
||||||
|
builder.setSecuWorkTonSts(false);
|
||||||
|
builder.setSecuModWashSts(false);
|
||||||
|
builder.setSecuModWashSweepSts(false);
|
||||||
|
}
|
||||||
//是否洗扫View
|
//是否洗扫View
|
||||||
boolean isWashSweepClick = currentClickView.getId() == R.id.btn_clean_mode_sweep_wash;
|
boolean isWashSweepClick = currentClickView.getId() == R.id.btn_clean_mode_sweep_wash;
|
||||||
builder.setSecuModWashSweepSts(isWashSweepClick&&isClickCurrentChoosedModeBtn);
|
builder.setSecuModWashSweepSts(isWashSweepClick && !isClickCurrentChoosedModeBtn);
|
||||||
|
if (isPureAbsorptionClick) {
|
||||||
|
builder.setSecuWorkStandSts(true);
|
||||||
|
}else{
|
||||||
|
builder.setSecuWorkStandSts(false);
|
||||||
|
}
|
||||||
CmdRequestCallback cmdRequestCallback = new CmdRequestCallback() {
|
CmdRequestCallback cmdRequestCallback = new CmdRequestCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSendCmd() {
|
public void onSendCmd() {
|
||||||
@@ -229,6 +246,7 @@ public class SweeperOperatePanelView extends LinearLayout {
|
|||||||
//success = clean_mode_pure_sweep;
|
//success = clean_mode_pure_sweep;
|
||||||
//纯扫 这个模式实际在福田清扫车上没有这个按钮,只是发送指令给特种车端,默认此命令肯定是正确的
|
//纯扫 这个模式实际在福田清扫车上没有这个按钮,只是发送指令给特种车端,默认此命令肯定是正确的
|
||||||
success = true;
|
success = true;
|
||||||
|
isSelectPureSweepMode = true;
|
||||||
} else if (isPureWashClick) {
|
} else if (isPureWashClick) {
|
||||||
success = clean_mode_pure_wash;
|
success = clean_mode_pure_wash;
|
||||||
isSelectPureSweepMode = false;
|
isSelectPureSweepMode = false;
|
||||||
@@ -311,11 +329,14 @@ public class SweeperOperatePanelView extends LinearLayout {
|
|||||||
boolean isLeftSide = currentClickView.getId() == R.id.btn_clean_direction_left_side;
|
boolean isLeftSide = currentClickView.getId() == R.id.btn_clean_direction_left_side;
|
||||||
boolean isRightSide = currentClickView.getId() == R.id.btn_clean_direction_right_side;
|
boolean isRightSide = currentClickView.getId() == R.id.btn_clean_direction_right_side;
|
||||||
boolean isBothSide = currentClickView.getId() == R.id.btn_clean_direction_both_side;
|
boolean isBothSide = currentClickView.getId() == R.id.btn_clean_direction_both_side;
|
||||||
builder.setSecuWorkLeftSts(isLeftSide&&isClickCurrentChoosedDirectionBtn);
|
builder.setSecuWorkLeftSts(isLeftSide && !isClickCurrentChoosedDirectionBtn);
|
||||||
builder.setSecuWorkRightSts(isRightSide&&isClickCurrentChoosedDirectionBtn);
|
builder.setSecuWorkRightSts(isRightSide && !isClickCurrentChoosedDirectionBtn);
|
||||||
builder.setSecuWorkOnBothsidesSts(isBothSide&&isClickCurrentChoosedDirectionBtn);
|
builder.setSecuWorkOnBothsidesSts(isBothSide && !isClickCurrentChoosedDirectionBtn);
|
||||||
|
if (!isClickCurrentChoosedDirectionBtn) {
|
||||||
|
builder.setSecuWorkStandSts(true);
|
||||||
|
}else{
|
||||||
|
builder.setSecuWorkStandSts(false);
|
||||||
|
}
|
||||||
CmdRequestCallback cmdRequestCallback = new CmdRequestCallback() {
|
CmdRequestCallback cmdRequestCallback = new CmdRequestCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSendCmd() {
|
public void onSendCmd() {
|
||||||
@@ -402,6 +423,20 @@ public class SweeperOperatePanelView extends LinearLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onCleanIntensityBtnClick(final View currentClickView) {
|
private void onCleanIntensityBtnClick(final View currentClickView) {
|
||||||
|
CheckedTextView currentChoosedModeBtnView = null;
|
||||||
|
for (Integer viewId : cleanIntensityBtnViewIds) {
|
||||||
|
CheckedTextView view = (CheckedTextView) findViewById(viewId);
|
||||||
|
if (view.isChecked()) {
|
||||||
|
currentChoosedModeBtnView = view;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
boolean isClickCurrentChoosedModeBtn = currentChoosedModeBtnView != null
|
||||||
|
&& currentChoosedModeBtnView.getId() == currentClickView.getId();
|
||||||
|
//作业强度如果已经选中,则重复点击时不需要再重复发送指令
|
||||||
|
if (isClickCurrentChoosedModeBtn) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
boolean isStandardBtnClick = currentClickView.getId() == R.id.btn_clean_intensity_standard;
|
boolean isStandardBtnClick = currentClickView.getId() == R.id.btn_clean_intensity_standard;
|
||||||
builder.setSecuWorkStandSts(isStandardBtnClick);
|
builder.setSecuWorkStandSts(isStandardBtnClick);
|
||||||
boolean isStrongBtnClick = currentClickView.getId() == R.id.btn_clean_intensity_strong;
|
boolean isStrongBtnClick = currentClickView.getId() == R.id.btn_clean_intensity_strong;
|
||||||
@@ -561,6 +596,7 @@ public class SweeperOperatePanelView extends LinearLayout {
|
|||||||
/**
|
/**
|
||||||
* 发送命令后等待时,展示loading
|
* 发送命令后等待时,展示loading
|
||||||
*
|
*
|
||||||
|
*
|
||||||
* @param timeout
|
* @param timeout
|
||||||
*/
|
*/
|
||||||
private void showLoadingMask(int timeout) {
|
private void showLoadingMask(int timeout) {
|
||||||
@@ -628,9 +664,6 @@ public class SweeperOperatePanelView extends LinearLayout {
|
|||||||
* 命令执行超时toast
|
* 命令执行超时toast
|
||||||
*/
|
*/
|
||||||
private void showCmdExecuteTimeoutToast() {
|
private void showCmdExecuteTimeoutToast() {
|
||||||
if (cleaningModeStateCallback != null) {
|
|
||||||
cleaningModeStateCallback.cleaningModeState(OperateStateEnum.FAIL_STATUS, builder.build(), isSelectPureSweepMode);
|
|
||||||
}
|
|
||||||
ToastUtils.showLong("超时未响应,操作失败");
|
ToastUtils.showLong("超时未响应,操作失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -655,6 +688,14 @@ public class SweeperOperatePanelView extends LinearLayout {
|
|||||||
public void setSweeperFutianCleanSystemState(@NonNull ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState,
|
public void setSweeperFutianCleanSystemState(@NonNull ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState,
|
||||||
CleaningModeStateCallback cleaningModeStateCallback) {
|
CleaningModeStateCallback cleaningModeStateCallback) {
|
||||||
this.cleaningModeStateCallback = cleaningModeStateCallback;
|
this.cleaningModeStateCallback = cleaningModeStateCallback;
|
||||||
|
if (!isFirst){
|
||||||
|
this.mCleanSystemState=cleanSystemState;
|
||||||
|
isFirst=true;
|
||||||
|
}
|
||||||
|
if (isResetWorkMode){
|
||||||
|
isResetWorkMode=false;
|
||||||
|
resetSuccess(cleanSystemState);
|
||||||
|
}
|
||||||
onSyncVehicleStateCallBack(cleanSystemState);
|
onSyncVehicleStateCallBack(cleanSystemState);
|
||||||
// 有命令正在执行
|
// 有命令正在执行
|
||||||
// if (mCurrentCmdRequestCallback != null) {
|
// if (mCurrentCmdRequestCallback != null) {
|
||||||
@@ -812,9 +853,165 @@ public class SweeperOperatePanelView extends LinearLayout {
|
|||||||
* 复位
|
* 复位
|
||||||
*/
|
*/
|
||||||
private void onOperateReset() {
|
private void onOperateReset() {
|
||||||
|
if (mCleanSystemState!=null){
|
||||||
|
isResetWorkMode=true;
|
||||||
|
// 洗扫
|
||||||
|
if (mCleanSystemState.getSecuModWashSweepSts()){
|
||||||
|
count++;
|
||||||
|
// 发送命令
|
||||||
|
sendFuTianTaskCmd(SweeperFutianCmdUtil.buildCleanModeCmd(CLEAN_MODE_WASH_SWEEP));
|
||||||
|
builder.setSecuModWashSweepSts(true);
|
||||||
|
}
|
||||||
|
// 纯洗
|
||||||
|
if (mCleanSystemState.getSecuModWashSts()){
|
||||||
|
count++;
|
||||||
|
sendFuTianTaskCmd(SweeperFutianCmdUtil.buildCleanModeCmd(CLEAN_MODE_PURE_WASH));
|
||||||
|
builder.setSecuModWashSts(true);
|
||||||
|
}
|
||||||
|
// 纯吸
|
||||||
|
if (mCleanSystemState.getSecuWorkTonSts()){
|
||||||
|
count++;
|
||||||
|
sendFuTianTaskCmd(SweeperFutianCmdUtil.buildCleanModeCmd(CLEAN_MODE_PURE_DRAW));
|
||||||
|
builder.setSecuWorkTonSts(true);
|
||||||
|
}
|
||||||
|
//纯扫
|
||||||
|
if (SweeperFutianCmdUtil.checkIfCleanModePureSweep(mCleanSystemState)){
|
||||||
|
count++;
|
||||||
|
sendFuTianTaskCmd(SweeperFutianCmdUtil.buildCleanModeCmd(CLEAN_MODE_PURE_SWEEP));
|
||||||
|
builder.setSecuModWashSweepSts(false);
|
||||||
|
builder.setSecuModWashSts(false);
|
||||||
|
builder.setSecuWorkTonSts(false);
|
||||||
|
}
|
||||||
|
// 左侧
|
||||||
|
if(mCleanSystemState.getSecuWorkLeftSts()){
|
||||||
|
count++;
|
||||||
|
sendFuTianTaskCmd(SweeperFutianCmdUtil.buildCleanDirectionCmd(CLEAN_DIRECTION_LEFT_SIDE));
|
||||||
|
builder.setSecuWorkLeftSts(true);
|
||||||
|
}
|
||||||
|
// 右侧
|
||||||
|
if(mCleanSystemState.getSecuWorkRightSts()){
|
||||||
|
count++;
|
||||||
|
sendFuTianTaskCmd(SweeperFutianCmdUtil.buildCleanDirectionCmd(CLEAN_DIRECTION_RIGHT_SIDE));
|
||||||
|
builder.setSecuWorkRightSts(true);
|
||||||
|
}
|
||||||
|
// 两侧
|
||||||
|
if(mCleanSystemState.getSecuWorkOnBothsidesSts()){
|
||||||
|
count++;
|
||||||
|
sendFuTianTaskCmd(SweeperFutianCmdUtil.buildCleanDirectionCmd(CLEAN_DIRECTION_BOTH_SIDE));
|
||||||
|
builder.setSecuWorkOnBothsidesSts(true);
|
||||||
|
}
|
||||||
|
//标准
|
||||||
|
if (mCleanSystemState.getSecuWorkStandSts()){
|
||||||
|
count++;
|
||||||
|
sendFuTianTaskCmd(SweeperFutianCmdUtil.buildCleanIntensityCmd(CLEAN_INTENSITY_STRAND));
|
||||||
|
builder.setSecuWorkStandSts(true);
|
||||||
|
}
|
||||||
|
//强力
|
||||||
|
if (mCleanSystemState.getSecuWorkStrongSts()){
|
||||||
|
count++;
|
||||||
|
sendFuTianTaskCmd(SweeperFutianCmdUtil.buildCleanIntensityCmd(CLEAN_INTENSITY_STRONG));
|
||||||
|
builder.setSecuWorkStrongSts(true);
|
||||||
|
}
|
||||||
|
mCurrentCmdRequestCallback=new CmdRequestCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSendCmd() {
|
||||||
|
showLoadingMask(count*CMD_EXECUTE_TIMEOUT_SECONDS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCountDownTick(int senonds) {
|
||||||
|
updateLoadingCountDown(senonds);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCheckIfCmdSuccess(ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState) {
|
||||||
|
// 洗扫
|
||||||
|
if (cleanSystemState.getSecuModWashSweepSts()){
|
||||||
|
count--;
|
||||||
|
}
|
||||||
|
// 纯洗
|
||||||
|
if (cleanSystemState.getSecuModWashSts()){
|
||||||
|
count--;
|
||||||
|
}
|
||||||
|
// 纯吸
|
||||||
|
if (cleanSystemState.getSecuWorkTonSts()){
|
||||||
|
count--;
|
||||||
|
}
|
||||||
|
//纯扫
|
||||||
|
if (SweeperFutianCmdUtil.checkIfCleanModePureSweep(cleanSystemState)){
|
||||||
|
count--;
|
||||||
|
}
|
||||||
|
// 左侧
|
||||||
|
if(cleanSystemState.getSecuWorkLeftSts()){
|
||||||
|
count--;
|
||||||
|
}
|
||||||
|
// 右侧
|
||||||
|
if(cleanSystemState.getSecuWorkRightSts()){
|
||||||
|
count--;
|
||||||
|
}
|
||||||
|
// 两侧
|
||||||
|
if(cleanSystemState.getSecuWorkOnBothsidesSts()){
|
||||||
|
count--;
|
||||||
|
}
|
||||||
|
//标准
|
||||||
|
if (cleanSystemState.getSecuWorkStandSts()){
|
||||||
|
count--;
|
||||||
|
}
|
||||||
|
//强力
|
||||||
|
if (cleanSystemState.getSecuWorkStrongSts()){
|
||||||
|
count--;
|
||||||
|
}
|
||||||
|
return count==0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCmdSuccess() {
|
||||||
|
mCleanSystemState=builder.build();
|
||||||
|
resetSuccess(mCleanSystemState);
|
||||||
|
hideLoadingMask();
|
||||||
|
showCmdExecuteSuccessToast();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCmdFailed() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCmdTimeout() {
|
||||||
|
runOnUIThread(()->{
|
||||||
|
hideLoadingMask();
|
||||||
|
showCmdExecuteTimeoutToast();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// onSendCmd
|
||||||
|
mCurrentCmdRequestCallback.onSendCmd();
|
||||||
|
// 开启倒计时
|
||||||
|
Message msg = Message.obtain();
|
||||||
|
msg.what = MSG_CMD_EXECUTE_COUNT_DOWN;
|
||||||
|
msg.obj = count*CMD_EXECUTE_TIMEOUT_SECONDS;
|
||||||
|
mSweeperOperateCmdHandler.sendMessage(msg);
|
||||||
|
// Mock Cmd Success
|
||||||
|
mockSendCmdSuccess();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送指令
|
||||||
|
*/
|
||||||
|
private void sendFuTianTaskCmd(SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd fuTianTaskCmd){
|
||||||
|
CallerAutoPilotManager.INSTANCE.sendSweeperFuTianTaskCmd(fuTianTaskCmd);
|
||||||
|
// log发送命令
|
||||||
|
logSweeperCmdValue(fuTianTaskCmd);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 重置成功
|
||||||
|
*/
|
||||||
|
private void resetSuccess(ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState){
|
||||||
|
onSyncVehicleStateCallBack(cleanSystemState);
|
||||||
|
}
|
||||||
private final static SweeperOperateCmdHandler mSweeperOperateCmdHandler = new SweeperOperateCmdHandler();
|
private final static SweeperOperateCmdHandler mSweeperOperateCmdHandler = new SweeperOperateCmdHandler();
|
||||||
private static CmdRequestCallback mCurrentCmdRequestCallback;//发送命令后的回调
|
private static CmdRequestCallback mCurrentCmdRequestCallback;//发送命令后的回调
|
||||||
private static final int MSG_CMD_EXECUTE_COUNT_DOWN = 10001;
|
private static final int MSG_CMD_EXECUTE_COUNT_DOWN = 10001;
|
||||||
|
|||||||
@@ -31,8 +31,9 @@ class SweeperOperatePanelPopWindow : PopupWindow {
|
|||||||
width = ViewGroup.LayoutParams.WRAP_CONTENT
|
width = ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
height = ViewGroup.LayoutParams.WRAP_CONTENT
|
height = ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
contentView = mOperatePanelView
|
contentView = mOperatePanelView
|
||||||
isFocusable = true
|
isFocusable = false
|
||||||
isOutsideTouchable = true
|
isOutsideTouchable = false
|
||||||
|
isTouchable=true
|
||||||
mBtnCancel?.setOnClickListener {
|
mBtnCancel?.setOnClickListener {
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ public class SweeperFutianCmdUtil {
|
|||||||
* @return true:没有作业强度 false:有作业强度
|
* @return true:没有作业强度 false:有作业强度
|
||||||
*/
|
*/
|
||||||
public static boolean checkIfCleanIntensity(ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState){
|
public static boolean checkIfCleanIntensity(ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState){
|
||||||
return !cleanSystemState.getSecuWorkLeftSts()&&!cleanSystemState.getSecuWorkRightSts()&&!cleanSystemState.getSecuWorkOnBothsidesSts();
|
return !cleanSystemState.getSecuWorkStandSts()&&!cleanSystemState.getSecuWorkStrongSts();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 判断是否纯扫模式
|
* 判断是否纯扫模式
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import kotlinx.android.synthetic.main.sweeper_work_mode.view.*
|
|||||||
*/
|
*/
|
||||||
class SweeperWorkModeView : ConstraintLayout, CleaningModeStateCallback {
|
class SweeperWorkModeView : ConstraintLayout, CleaningModeStateCallback {
|
||||||
|
|
||||||
private var isSelectPureSweepMode:Boolean=false
|
private var isSelectPureSweepMode: Boolean = false
|
||||||
|
|
||||||
//清扫模式选择面板
|
//清扫模式选择面板
|
||||||
private var mOperatePanelPopWindow: SweeperOperatePanelPopWindow? = null
|
private var mOperatePanelPopWindow: SweeperOperatePanelPopWindow? = null
|
||||||
@@ -35,11 +35,12 @@ class SweeperWorkModeView : ConstraintLayout, CleaningModeStateCallback {
|
|||||||
LayoutInflater.from(context).inflate(R.layout.sweeper_work_mode, this)
|
LayoutInflater.from(context).inflate(R.layout.sweeper_work_mode, this)
|
||||||
mOperatePanelPopWindow = SweeperOperatePanelPopWindow(context)
|
mOperatePanelPopWindow = SweeperOperatePanelPopWindow(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置清扫模式面板
|
* 设置清扫模式面板
|
||||||
*/
|
*/
|
||||||
fun setSweeperFutianCleanSystemState(taskType:Int,cleanSystemState: SweeperFuTianTaskSystemStates, trafficDataView: SweeperTrafficDataView) {
|
fun setSweeperFutianCleanSystemState(taskType: Int, cleanSystemState: SweeperFuTianTaskSystemStates, trafficDataView: SweeperTrafficDataView) {
|
||||||
mOperatePanelPopWindow?.setCleanSystemState(cleanSystemState,this@SweeperWorkModeView)
|
mOperatePanelPopWindow?.setCleanSystemState(cleanSystemState, this@SweeperWorkModeView)
|
||||||
//清扫模式选择面板打开关闭处理
|
//清扫模式选择面板打开关闭处理
|
||||||
ivOpenOperatePanel.setOnClickListener {
|
ivOpenOperatePanel.setOnClickListener {
|
||||||
if (mOperatePanelPopWindow?.isShowing != true) {
|
if (mOperatePanelPopWindow?.isShowing != true) {
|
||||||
@@ -53,39 +54,39 @@ class SweeperWorkModeView : ConstraintLayout, CleaningModeStateCallback {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//清扫车暂未选择清扫模式或者任务类型是人工驾驶子任务,则暂无清扫模式
|
//清扫车暂未选择清扫模式或者任务类型是人工驾驶子任务,则暂无清扫模式
|
||||||
if (SweeperFutianCmdUtil.checkIfCleanMode(cleanSystemState)||taskType==2){
|
if (SweeperFutianCmdUtil.checkIfCleanMode(cleanSystemState) || taskType == 2) {
|
||||||
setShowOrHideCleanSystemState(OperateStateEnum.NO_STATUS,cleanSystemState)
|
setShowOrHideCleanSystemState(OperateStateEnum.NO_STATUS, cleanSystemState)
|
||||||
}else{
|
} else {
|
||||||
setShowOrHideCleanSystemState(OperateStateEnum.SUCCESS_STATUS,cleanSystemState)
|
setShowOrHideCleanSystemState(OperateStateEnum.SUCCESS_STATUS, cleanSystemState)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置清扫模式状态显示和隐藏
|
* 设置清扫模式状态显示和隐藏
|
||||||
*/
|
*/
|
||||||
fun setShowOrHideCleanSystemState(operateState: OperateStateEnum,cleanSystemState: SweeperFuTianTaskSystemStates) {
|
fun setShowOrHideCleanSystemState(operateState: OperateStateEnum, cleanSystemState: SweeperFuTianTaskSystemStates) {
|
||||||
when (operateState.code) {
|
when (operateState.code) {
|
||||||
OperateStateEnum.SYNCING_STATUS.code ->{
|
OperateStateEnum.SYNCING_STATUS.code -> {
|
||||||
groupWorkModelPanel?.visibility = View.GONE
|
groupWorkModelPanel?.visibility = View.GONE
|
||||||
tvNoDataDesc?.visibility = View.VISIBLE
|
tvNoDataDesc?.visibility = View.VISIBLE
|
||||||
tvNoDataDesc?.text = "状态同步中,请稍后"
|
tvNoDataDesc?.text = "状态同步中,请稍后"
|
||||||
}
|
}
|
||||||
OperateStateEnum.FAIL_STATUS.code ->{
|
OperateStateEnum.FAIL_STATUS.code -> {
|
||||||
groupWorkModelPanel?.visibility = View.GONE
|
groupWorkModelPanel?.visibility = View.GONE
|
||||||
tvNoDataDesc?.visibility = View.VISIBLE
|
tvNoDataDesc?.visibility = View.VISIBLE
|
||||||
tvNoDataDesc?.text = "上装启动失败"
|
tvNoDataDesc?.text = "上装启动失败"
|
||||||
}
|
}
|
||||||
OperateStateEnum.STARTING_STATUS.code ->{
|
OperateStateEnum.STARTING_STATUS.code -> {
|
||||||
groupWorkModelPanel?.visibility = View.GONE
|
groupWorkModelPanel?.visibility = View.GONE
|
||||||
tvNoDataDesc?.visibility = View.VISIBLE
|
tvNoDataDesc?.visibility = View.VISIBLE
|
||||||
tvNoDataDesc?.text = "上装启动中..."
|
tvNoDataDesc?.text = "上装启动中..."
|
||||||
}
|
}
|
||||||
OperateStateEnum.NO_STATUS.code ->{
|
OperateStateEnum.NO_STATUS.code -> {
|
||||||
groupWorkModelPanel?.visibility = View.GONE
|
groupWorkModelPanel?.visibility = View.GONE
|
||||||
tvNoDataDesc?.visibility = View.VISIBLE
|
tvNoDataDesc?.visibility = View.VISIBLE
|
||||||
tvNoDataDesc?.text = "暂无"
|
tvNoDataDesc?.text = "暂无"
|
||||||
}
|
}
|
||||||
else->{
|
else -> {
|
||||||
groupWorkModelPanel?.visibility = View.VISIBLE
|
groupWorkModelPanel?.visibility = View.VISIBLE
|
||||||
tvNoDataDesc?.visibility = View.GONE
|
tvNoDataDesc?.visibility = View.GONE
|
||||||
setCleanModeData(cleanSystemState)
|
setCleanModeData(cleanSystemState)
|
||||||
@@ -93,32 +94,40 @@ class SweeperWorkModeView : ConstraintLayout, CleaningModeStateCallback {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
override fun cleaningModeState(operateState: OperateStateEnum, cleanSystemState: SweeperFuTianTaskSystemStates,isSelectPureSweepMode:Boolean) {
|
|
||||||
this.isSelectPureSweepMode=isSelectPureSweepMode
|
override fun cleaningModeState(operateState: OperateStateEnum, cleanSystemState: SweeperFuTianTaskSystemStates, isSelectPureSweepMode: Boolean) {
|
||||||
setShowOrHideCleanSystemState(operateState,cleanSystemState)
|
this.isSelectPureSweepMode = isSelectPureSweepMode
|
||||||
|
setShowOrHideCleanSystemState(operateState, cleanSystemState)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置清扫模式数据
|
* 设置清扫模式数据
|
||||||
*/
|
*/
|
||||||
private fun setCleanModeData(cleanSystemState: SweeperFuTianTaskSystemStates){
|
private fun setCleanModeData(cleanSystemState: SweeperFuTianTaskSystemStates) {
|
||||||
if (SweeperFutianCmdUtil.checkIfCleanMode(cleanSystemState)){
|
if (isSelectPureSweepMode) {
|
||||||
groupWorkModelPanel?.visibility = View.GONE
|
tvCleaningMode?.text = "纯扫模式"
|
||||||
tvNoDataDesc?.visibility = View.VISIBLE
|
|
||||||
tvNoDataDesc?.text = "暂无"
|
|
||||||
}else{
|
|
||||||
groupWorkModelPanel?.visibility = View.VISIBLE
|
groupWorkModelPanel?.visibility = View.VISIBLE
|
||||||
tvNoDataDesc?.visibility = View.GONE
|
tvNoDataDesc?.visibility = View.GONE
|
||||||
// 作业模式
|
} else {
|
||||||
if (cleanSystemState.secuModWashSweepSts) tvCleaningMode?.text = "洗扫模式"
|
if (SweeperFutianCmdUtil.checkIfCleanMode(cleanSystemState)) {
|
||||||
if (cleanSystemState.secuModWashSts) tvCleaningMode?.text = "纯洗模式"
|
groupWorkModelPanel?.visibility = View.GONE
|
||||||
if (cleanSystemState.secuWorkTonSts) tvCleaningMode?.text = "纯吸模式"
|
tvNoDataDesc?.visibility = View.VISIBLE
|
||||||
if (SweeperFutianCmdUtil.checkIfCleanModePureSweep(cleanSystemState)||isSelectPureSweepMode) tvCleaningMode?.text = "纯扫模式"
|
tvNoDataDesc?.text = "暂无"
|
||||||
|
} else {
|
||||||
|
groupWorkModelPanel?.visibility = View.VISIBLE
|
||||||
|
tvNoDataDesc?.visibility = View.GONE
|
||||||
|
// 作业模式
|
||||||
|
if (cleanSystemState.secuModWashSweepSts) tvCleaningMode?.text = "洗扫模式"
|
||||||
|
if (cleanSystemState.secuModWashSts) tvCleaningMode?.text = "纯洗模式"
|
||||||
|
if (cleanSystemState.secuWorkTonSts) tvCleaningMode?.text = "纯吸模式"
|
||||||
|
if (SweeperFutianCmdUtil.checkIfCleanModePureSweep(cleanSystemState)) tvCleaningMode?.text = "纯扫模式"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//清扫方向
|
//清扫方向
|
||||||
if(SweeperFutianCmdUtil.checkIfCleanDirection(cleanSystemState)){
|
if (SweeperFutianCmdUtil.checkIfCleanDirection(cleanSystemState)) {
|
||||||
tvCleaningDirection.visibility=View.GONE
|
tvCleaningDirection.visibility = View.GONE
|
||||||
}else{
|
} else {
|
||||||
tvCleaningDirection.visibility=View.VISIBLE
|
tvCleaningDirection.visibility = View.VISIBLE
|
||||||
// 左侧
|
// 左侧
|
||||||
if (cleanSystemState.secuWorkLeftSts) tvCleaningDirection?.text = "左侧"
|
if (cleanSystemState.secuWorkLeftSts) tvCleaningDirection?.text = "左侧"
|
||||||
// 右侧
|
// 右侧
|
||||||
@@ -126,10 +135,10 @@ class SweeperWorkModeView : ConstraintLayout, CleaningModeStateCallback {
|
|||||||
// 两侧
|
// 两侧
|
||||||
if (cleanSystemState.secuWorkOnBothsidesSts) tvCleaningDirection?.text = "两侧"
|
if (cleanSystemState.secuWorkOnBothsidesSts) tvCleaningDirection?.text = "两侧"
|
||||||
}
|
}
|
||||||
if (SweeperFutianCmdUtil.checkIfCleanIntensity(cleanSystemState)){
|
if (SweeperFutianCmdUtil.checkIfCleanIntensity(cleanSystemState)) {
|
||||||
tvCleaningIntensity.visibility=View.GONE
|
tvCleaningIntensity.visibility = View.GONE
|
||||||
}else{
|
} else {
|
||||||
tvCleaningIntensity.visibility=View.VISIBLE
|
tvCleaningIntensity.visibility = View.VISIBLE
|
||||||
// 作业强度
|
// 作业强度
|
||||||
if (cleanSystemState.secuWorkStandSts) tvCleaningIntensity?.text = "标准"
|
if (cleanSystemState.secuWorkStandSts) tvCleaningIntensity?.text = "标准"
|
||||||
if (cleanSystemState.secuWorkStrongSts) tvCleaningIntensity?.text = "强力"
|
if (cleanSystemState.secuWorkStrongSts) tvCleaningIntensity?.text = "强力"
|
||||||
|
|||||||
Reference in New Issue
Block a user