6 changed files with 113 additions and 2 deletions
-
36src/main/java/com/iflytop/sgs/app/cmd/debug/DebugBeeCloseCommand.java
-
38src/main/java/com/iflytop/sgs/app/cmd/debug/DebugBeeOpenCommand.java
-
32src/main/java/com/iflytop/sgs/app/service/device/DeviceStopService.java
-
4src/main/java/com/iflytop/sgs/app/ws/client/DeviceEmergencyStopConfig.java
-
4src/main/java/com/iflytop/sgs/common/cmd/DeviceCommandGenerator.java
-
1src/main/java/com/iflytop/sgs/common/cmd/DeviceCommandParams.java
@ -0,0 +1,36 @@ |
|||
package com.iflytop.sgs.app.cmd.debug; |
|||
|
|||
import com.iflytop.sgs.app.core.BaseCommandHandler; |
|||
import com.iflytop.sgs.app.model.dto.CmdDTO; |
|||
import com.iflytop.sgs.app.service.device.DeviceCommandService; |
|||
import com.iflytop.sgs.common.annotation.CommandDebugMapping; |
|||
import com.iflytop.sgs.common.cmd.CommandFuture; |
|||
import com.iflytop.sgs.common.cmd.DeviceCommandBundle; |
|||
import com.iflytop.sgs.common.cmd.DeviceCommandGenerator; |
|||
import com.iflytop.sgs.common.utils.CommandUtil; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.concurrent.CompletableFuture; |
|||
|
|||
/** |
|||
* 蜂鸣器关闭 |
|||
*/ |
|||
@Slf4j |
|||
@Component |
|||
@RequiredArgsConstructor |
|||
@CommandDebugMapping("door_close") |
|||
public class DebugBeeCloseCommand extends BaseCommandHandler { |
|||
private final DeviceCommandService deviceCommandService; |
|||
|
|||
@Override |
|||
public CompletableFuture<Void> handle(CmdDTO cmdDTO) { |
|||
return runAsync(() -> { |
|||
DeviceCommandBundle beepCloseDeviceCommandBundle = DeviceCommandGenerator.beepClose(); |
|||
CommandFuture doorSetDeviceCommandSetFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), beepCloseDeviceCommandBundle); |
|||
CommandUtil.wait(doorSetDeviceCommandSetFuture); |
|||
}); |
|||
} |
|||
} |
|||
|
@ -0,0 +1,38 @@ |
|||
package com.iflytop.sgs.app.cmd.debug; |
|||
|
|||
import com.iflytop.sgs.app.core.BaseCommandHandler; |
|||
import com.iflytop.sgs.app.model.dto.CmdDTO; |
|||
import com.iflytop.sgs.app.service.device.DeviceCommandService; |
|||
import com.iflytop.sgs.common.annotation.CommandDebugMapping; |
|||
import com.iflytop.sgs.common.cmd.CommandFuture; |
|||
import com.iflytop.sgs.common.cmd.DeviceCommandBundle; |
|||
import com.iflytop.sgs.common.cmd.DeviceCommandGenerator; |
|||
import com.iflytop.sgs.common.utils.CommandUtil; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.concurrent.CompletableFuture; |
|||
|
|||
/** |
|||
* 蜂鸣器打开 |
|||
*/ |
|||
@Slf4j |
|||
@Component |
|||
@RequiredArgsConstructor |
|||
@CommandDebugMapping("door_close") |
|||
public class DebugBeeOpenCommand extends BaseCommandHandler { |
|||
private final DeviceCommandService deviceCommandService; |
|||
|
|||
@Override |
|||
public CompletableFuture<Void> handle(CmdDTO cmdDTO) { |
|||
String mode = cmdDTO.getStringParam("mode"); |
|||
return runAsync(() -> { |
|||
DeviceCommandBundle beeOpenDeviceCommand = DeviceCommandGenerator.beepOpen(mode); |
|||
CommandFuture doorMoveDeviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), beeOpenDeviceCommand); |
|||
CommandUtil.wait(doorMoveDeviceCommandFuture); |
|||
|
|||
}); |
|||
} |
|||
} |
|||
|
@ -0,0 +1,32 @@ |
|||
package com.iflytop.sgs.app.service.device; |
|||
|
|||
import com.iflytop.sgs.common.cmd.DeviceCommandBundle; |
|||
import com.iflytop.sgs.common.cmd.DeviceCommandGenerator; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
@Slf4j |
|||
@Service |
|||
@RequiredArgsConstructor |
|||
public class DeviceStopService { |
|||
private final DeviceCommandService deviceCommandService; |
|||
|
|||
|
|||
public void stopAll() { |
|||
//门电机 |
|||
DeviceCommandBundle doorStopDeviceCommandBundle = DeviceCommandGenerator.doorStop(); |
|||
deviceCommandService.sendCommand(null, null, doorStopDeviceCommandBundle); |
|||
//x轴 |
|||
DeviceCommandBundle xStopDeviceCommandBundle = DeviceCommandGenerator.transferXStop(); |
|||
deviceCommandService.sendCommand(null, null, xStopDeviceCommandBundle); |
|||
//z轴 |
|||
DeviceCommandBundle yStopDeviceCommandBundle = DeviceCommandGenerator.transferZStop(); |
|||
deviceCommandService.sendCommand(null, null, yStopDeviceCommandBundle); |
|||
//机械臂 |
|||
DeviceCommandBundle liquidMotorStopDeviceCommandBundle = DeviceCommandGenerator.liquidMotorStop(); |
|||
deviceCommandService.sendCommand(null, null, liquidMotorStopDeviceCommandBundle); |
|||
//蠕动泵 |
|||
DeviceCommandBundle liquidPumpStopDeviceCommandBundle = DeviceCommandGenerator.liquidPumpStop(); |
|||
deviceCommandService.sendCommand(null, null, liquidPumpStopDeviceCommandBundle); |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue