Browse Source

feat:门业务指令

master
白凤吉 3 months ago
parent
commit
728c057bfa
  1. 31
      src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorClose.java
  2. 31
      src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorOpen.java
  3. 29
      src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorOrigin.java
  4. 32
      src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorSet.java
  5. 29
      src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorStop.java

31
src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorClose.java

@ -0,0 +1,31 @@
package com.iflytop.gd.app.cmd.debug;
import com.iflytop.gd.app.core.BaseCommandHandler;
import com.iflytop.gd.app.model.dto.CmdDTO;
import com.iflytop.gd.app.service.DeviceCommandService;
import com.iflytop.gd.common.annotation.CommandMapping;
import com.iflytop.gd.common.cmd.CommandFuture;
import com.iflytop.gd.common.cmd.DeviceCommand;
import com.iflytop.gd.common.cmd.DeviceCommandGenerator;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* 门电机 关门
*/
@Slf4j
@Component
@RequiredArgsConstructor
@CommandMapping("debug_door_close")
public class DebugDoorClose extends BaseCommandHandler {
private final DeviceCommandService deviceCommandService;
@Override
public void handle(CmdDTO cmdDTO) throws Exception {
Double position = cmdDTO.getDoubleParam("position");
DeviceCommand deviceCommand = DeviceCommandGenerator.doorMove(position);
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand);
commandWait(deviceCommandFuture);
}
}

31
src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorOpen.java

@ -0,0 +1,31 @@
package com.iflytop.gd.app.cmd.debug;
import com.iflytop.gd.app.core.BaseCommandHandler;
import com.iflytop.gd.app.model.dto.CmdDTO;
import com.iflytop.gd.app.service.DeviceCommandService;
import com.iflytop.gd.common.annotation.CommandMapping;
import com.iflytop.gd.common.cmd.CommandFuture;
import com.iflytop.gd.common.cmd.DeviceCommand;
import com.iflytop.gd.common.cmd.DeviceCommandGenerator;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* 门电机 开门
*/
@Slf4j
@Component
@RequiredArgsConstructor
@CommandMapping("debug_door_open")
public class DebugDoorOpen extends BaseCommandHandler {
private final DeviceCommandService deviceCommandService;
@Override
public void handle(CmdDTO cmdDTO) throws Exception {
Double position = cmdDTO.getDoubleParam("position");
DeviceCommand deviceCommand = DeviceCommandGenerator.doorMove(position);
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand);
commandWait(deviceCommandFuture);
}
}

29
src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorOrigin.java

@ -0,0 +1,29 @@
package com.iflytop.gd.app.cmd.debug;
import com.iflytop.gd.app.core.BaseCommandHandler;
import com.iflytop.gd.app.model.dto.CmdDTO;
import com.iflytop.gd.app.service.DeviceCommandService;
import com.iflytop.gd.common.annotation.CommandMapping;
import com.iflytop.gd.common.cmd.CommandFuture;
import com.iflytop.gd.common.cmd.DeviceCommand;
import com.iflytop.gd.common.cmd.DeviceCommandGenerator;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* 门电机 回原点
*/
@Slf4j
@Component
@RequiredArgsConstructor
@CommandMapping("debug_door_stop")
public class DebugDoorOrigin extends BaseCommandHandler {
private final DeviceCommandService deviceCommandService;
@Override
public void handle(CmdDTO cmdDTO) throws Exception {
DeviceCommand deviceCommand = DeviceCommandGenerator.doorOrigin();
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand);
commandWait(deviceCommandFuture);
}
}

32
src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorSet.java

@ -0,0 +1,32 @@
package com.iflytop.gd.app.cmd.debug;
import com.iflytop.gd.app.core.BaseCommandHandler;
import com.iflytop.gd.app.model.dto.CmdDTO;
import com.iflytop.gd.app.service.DeviceCommandService;
import com.iflytop.gd.common.annotation.CommandMapping;
import com.iflytop.gd.common.cmd.CommandFuture;
import com.iflytop.gd.common.cmd.DeviceCommand;
import com.iflytop.gd.common.cmd.DeviceCommandGenerator;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* 门电机 设置参数
*/
@Slf4j
@Component
@RequiredArgsConstructor
@CommandMapping("debug_door_set")
public class DebugDoorSet extends BaseCommandHandler {
private final DeviceCommandService deviceCommandService;
@Override
public void handle(CmdDTO cmdDTO) throws Exception {
Integer current = cmdDTO.getIntegerParam("current");
Double speed = cmdDTO.getDoubleParam("speed");
DeviceCommand deviceCommand = DeviceCommandGenerator.doorSet(current, speed);
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand);
commandWait(deviceCommandFuture);
}
}

29
src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorStop.java

@ -0,0 +1,29 @@
package com.iflytop.gd.app.cmd.debug;
import com.iflytop.gd.app.core.BaseCommandHandler;
import com.iflytop.gd.app.model.dto.CmdDTO;
import com.iflytop.gd.app.service.DeviceCommandService;
import com.iflytop.gd.common.annotation.CommandMapping;
import com.iflytop.gd.common.cmd.CommandFuture;
import com.iflytop.gd.common.cmd.DeviceCommand;
import com.iflytop.gd.common.cmd.DeviceCommandGenerator;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* 门电机 停止移动
*/
@Slf4j
@Component
@RequiredArgsConstructor
@CommandMapping("debug_door_stop")
public class DebugDoorStop extends BaseCommandHandler {
private final DeviceCommandService deviceCommandService;
@Override
public void handle(CmdDTO cmdDTO) throws Exception {
DeviceCommand deviceCommand = DeviceCommandGenerator.doorStop();
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand);
commandWait(deviceCommandFuture);
}
}
Loading…
Cancel
Save