Browse Source

fix:摇匀新增指令

master
guoapeng 6 months ago
parent
commit
81022acd6c
  1. 7
      src/main/java/com/qyft/gd/common/constant/Commands.java
  2. 13
      src/main/java/com/qyft/gd/service/CMDService.java

7
src/main/java/com/qyft/gd/common/constant/Commands.java

@ -37,7 +37,12 @@ public class Commands {
/** /**
* 摇匀试管架 * 摇匀试管架
*/ */
public static final String SHAKE_UP = "shakeUp";
public static final String START_SHAKE_UP = "startShakeUp";
/**
* 停止摇匀试管架
*/
public static final String STOP_SHAKE_UP = "stopShakeUp";
/** /**
* 开始加热 * 开始加热

13
src/main/java/com/qyft/gd/service/CMDService.java

@ -33,7 +33,8 @@ public class CMDService {
commandMap.put(Commands.DOWN_TRAY, this::downTray); commandMap.put(Commands.DOWN_TRAY, this::downTray);
commandMap.put(Commands.INJECT_FLUID, this::injectFluid); commandMap.put(Commands.INJECT_FLUID, this::injectFluid);
commandMap.put(Commands.MOVE_TO_ACTION_AREA, this::moveToActionArea); commandMap.put(Commands.MOVE_TO_ACTION_AREA, this::moveToActionArea);
commandMap.put(Commands.SHAKE_UP, this::shakeUp);
commandMap.put(Commands.START_SHAKE_UP, this::startShakeUp);
commandMap.put(Commands.STOP_SHAKE_UP, this::stopShakeUp);
commandMap.put(Commands.START_HEAT, this::startHeat); commandMap.put(Commands.START_HEAT, this::startHeat);
commandMap.put(Commands.STOP_HEAT, this::stopHeat); commandMap.put(Commands.STOP_HEAT, this::stopHeat);
commandMap.put(Commands.TAKE_PHOTO, this::takePhoto); commandMap.put(Commands.TAKE_PHOTO, this::takePhoto);
@ -89,8 +90,8 @@ public class CMDService {
cmdList.add(() -> deviceService.startHeating((String) cmdForm.getParams().get("areaId"),(Double) cmdForm.getParams().get("temperature"))); cmdList.add(() -> deviceService.startHeating((String) cmdForm.getParams().get("areaId"),(Double) cmdForm.getParams().get("temperature")));
return run(cmdList); return run(cmdList);
} }
// 摇匀
private Boolean shakeUp(CMDForm cmdForm) {
// 开始摇匀
private Boolean startShakeUp(CMDForm cmdForm) {
// deviceService.startShaking(); // deviceService.startShaking();
// Timer timer = new Timer(); // Timer timer = new Timer();
// TimerTask task = new TimerTask() { // TimerTask task = new TimerTask() {
@ -106,6 +107,12 @@ public class CMDService {
cmdList.add(() -> deviceService.setShakingSpeed((Integer) cmdForm.getParams().get("speed"))); cmdList.add(() -> deviceService.setShakingSpeed((Integer) cmdForm.getParams().get("speed")));
return run(cmdList); return run(cmdList);
} }
// 结束摇匀
private Boolean stopShakeUp(CMDForm cmdForm) {
List<Supplier<Boolean>> cmdList = new ArrayList<>();
cmdList.add(() -> deviceService.stopShaking());
return run(cmdList);
}
// 移至加液 // 移至加液
private Boolean moveToActionArea(CMDForm cmdForm) { private Boolean moveToActionArea(CMDForm cmdForm) {

Loading…
Cancel
Save