|
|
@ -0,0 +1,40 @@ |
|
|
|
package com.qyft.ms.app.front.cmd.test; |
|
|
|
|
|
|
|
import com.qyft.ms.system.common.annotation.CommandMapping; |
|
|
|
import com.qyft.ms.system.common.device.command.CommandFuture; |
|
|
|
import com.qyft.ms.system.common.device.command.DeviceCommandGenerator; |
|
|
|
import com.qyft.ms.system.core.handler.BaseCommandHandler; |
|
|
|
import com.qyft.ms.system.model.bo.DeviceCommand; |
|
|
|
import com.qyft.ms.system.model.form.FrontCmdControlForm; |
|
|
|
import com.qyft.ms.system.service.device.DeviceCommandService; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
import java.util.concurrent.CompletableFuture; |
|
|
|
|
|
|
|
/** |
|
|
|
* 指令连贯性测试 |
|
|
|
*/ |
|
|
|
@Slf4j |
|
|
|
@Component |
|
|
|
@RequiredArgsConstructor |
|
|
|
@CommandMapping("test_coherence") |
|
|
|
public class TestCoherence extends BaseCommandHandler { |
|
|
|
private final DeviceCommandService deviceCommandService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public CompletableFuture<Void> handle(FrontCmdControlForm form) { |
|
|
|
return runAsync(() -> { |
|
|
|
for (int i = 0; i < 10; i++) { |
|
|
|
DeviceCommand washValveOpenToCommand = DeviceCommandGenerator.motorXPositionSet(20.0); |
|
|
|
CommandFuture washValveOpenToCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), washValveOpenToCommand); |
|
|
|
commandWait(washValveOpenToCommandFuture); |
|
|
|
DeviceCommand washValveOpenBackCommand = DeviceCommandGenerator.motorXPositionSet(0.0); |
|
|
|
CommandFuture washValveOpenBackCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), washValveOpenBackCommand); |
|
|
|
commandWait(washValveOpenBackCommandFuture); |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |