4 changed files with 139 additions and 0 deletions
-
36src/main/java/com/iflytop/gd/app/command/debug/DebugFillLightCloseCommand.java
-
37src/main/java/com/iflytop/gd/app/command/debug/DebugFillLightOpenCommand.java
-
33src/main/java/com/iflytop/gd/app/command/debug/DebugTriColorLightCloseCommand.java
-
33src/main/java/com/iflytop/gd/app/command/debug/DebugTriColorLightOpenCommand.java
@ -0,0 +1,36 @@ |
|||||
|
package com.iflytop.gd.app.command.debug; |
||||
|
|
||||
|
import com.iflytop.gd.app.core.BaseCommandHandler; |
||||
|
import com.iflytop.gd.app.model.dto.CmdDTO; |
||||
|
import com.iflytop.gd.app.service.device.DeviceCommandService; |
||||
|
import com.iflytop.gd.common.annotation.CommandMapping; |
||||
|
import com.iflytop.gd.common.command.CommandFuture; |
||||
|
import com.iflytop.gd.common.command.DeviceCommandBundle; |
||||
|
import com.iflytop.gd.common.command.DeviceCommandGenerator; |
||||
|
import com.iflytop.gd.common.utils.CommandUtil; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.concurrent.CompletableFuture; |
||||
|
|
||||
|
/** |
||||
|
* 补光灯关 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Component |
||||
|
@RequiredArgsConstructor |
||||
|
@CommandMapping("debug_fill_light_close") |
||||
|
public class DebugFillLightCloseCommand extends BaseCommandHandler { |
||||
|
private final DeviceCommandService deviceCommandService; |
||||
|
|
||||
|
@Override |
||||
|
public CompletableFuture<Void> handle(CmdDTO cmdDTO) { |
||||
|
return runAsync(() -> { |
||||
|
DeviceCommandBundle deviceCommand = DeviceCommandGenerator.fillLightClose(); |
||||
|
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); |
||||
|
CommandUtil.wait(deviceCommandFuture); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
@ -0,0 +1,37 @@ |
|||||
|
package com.iflytop.gd.app.command.debug; |
||||
|
|
||||
|
import com.iflytop.gd.app.core.BaseCommandHandler; |
||||
|
import com.iflytop.gd.app.model.dto.CmdDTO; |
||||
|
import com.iflytop.gd.app.service.device.DeviceCommandService; |
||||
|
import com.iflytop.gd.common.annotation.CommandMapping; |
||||
|
import com.iflytop.gd.common.command.CommandFuture; |
||||
|
import com.iflytop.gd.common.command.DeviceCommandBundle; |
||||
|
import com.iflytop.gd.common.command.DeviceCommandGenerator; |
||||
|
import com.iflytop.gd.common.utils.CommandUtil; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.concurrent.CompletableFuture; |
||||
|
|
||||
|
/** |
||||
|
* 补光灯开 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Component |
||||
|
@RequiredArgsConstructor |
||||
|
@CommandMapping("debug_fill_light_open") |
||||
|
public class DebugFillLightOpenCommand extends BaseCommandHandler { |
||||
|
private final DeviceCommandService deviceCommandService; |
||||
|
|
||||
|
@Override |
||||
|
public CompletableFuture<Void> handle(CmdDTO cmdDTO) { |
||||
|
Double lightIntensity = cmdDTO.getDoubleParam("lightIntensity"); |
||||
|
return runAsync(() -> { |
||||
|
DeviceCommandBundle deviceCommand = DeviceCommandGenerator.fillLightOpen(lightIntensity); |
||||
|
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); |
||||
|
CommandUtil.wait(deviceCommandFuture); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
@ -0,0 +1,33 @@ |
|||||
|
package com.iflytop.gd.app.command.debug; |
||||
|
|
||||
|
import com.iflytop.gd.app.core.BaseCommandHandler; |
||||
|
import com.iflytop.gd.app.model.dto.CmdDTO; |
||||
|
import com.iflytop.gd.app.service.device.DeviceCommandService; |
||||
|
import com.iflytop.gd.common.annotation.CommandMapping; |
||||
|
import com.iflytop.gd.hardware.drivers.TricolorLightDriver; |
||||
|
import com.iflytop.gd.hardware.type.MId; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.concurrent.CompletableFuture; |
||||
|
|
||||
|
/** |
||||
|
* 三色灯关 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Component |
||||
|
@RequiredArgsConstructor |
||||
|
@CommandMapping("debug_tri_color_light_close") |
||||
|
public class DebugTriColorLightCloseCommand extends BaseCommandHandler { |
||||
|
private final TricolorLightDriver tricolorLightDriver; |
||||
|
|
||||
|
@Override |
||||
|
public CompletableFuture<Void> handle(CmdDTO cmdDTO) { |
||||
|
|
||||
|
return runAsync(() -> { |
||||
|
tricolorLightDriver.close(MId.TriColorLight); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
@ -0,0 +1,33 @@ |
|||||
|
package com.iflytop.gd.app.command.debug; |
||||
|
|
||||
|
import com.iflytop.gd.app.core.BaseCommandHandler; |
||||
|
import com.iflytop.gd.app.model.dto.CmdDTO; |
||||
|
import com.iflytop.gd.common.annotation.CommandMapping; |
||||
|
import com.iflytop.gd.hardware.drivers.TricolorLightDriver; |
||||
|
import com.iflytop.gd.hardware.type.MId; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.concurrent.CompletableFuture; |
||||
|
|
||||
|
/** |
||||
|
* 三色灯开 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Component |
||||
|
@RequiredArgsConstructor |
||||
|
@CommandMapping("debug_tri_color_light_open") |
||||
|
public class DebugTriColorLightOpenCommand extends BaseCommandHandler { |
||||
|
private final TricolorLightDriver tricolorLightDriver; |
||||
|
|
||||
|
@Override |
||||
|
public CompletableFuture<Void> handle(CmdDTO cmdDTO) { |
||||
|
String colorStr = cmdDTO.getStringParam("color"); |
||||
|
TricolorLightDriver.Color color = TricolorLightDriver.Color.valueOf(colorStr); |
||||
|
return runAsync(() -> { |
||||
|
tricolorLightDriver.open(MId.TriColorLight, color); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue