|
|
@ -0,0 +1,35 @@ |
|
|
|
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.DeviceCommandBundle; |
|
|
|
import com.iflytop.gd.common.cmd.DeviceCommandGenerator; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
import java.util.concurrent.CompletableFuture; |
|
|
|
|
|
|
|
/** |
|
|
|
* 处理摇匀回原点 |
|
|
|
*/ |
|
|
|
@Slf4j |
|
|
|
@Component |
|
|
|
@RequiredArgsConstructor |
|
|
|
@CommandMapping("debug_shaker_reset") |
|
|
|
public class DebugShakerResetCommand extends BaseCommandHandler { |
|
|
|
private final DeviceCommandService deviceCommandService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public CompletableFuture<Void> handle(CmdDTO cmdDTO) { |
|
|
|
return runAsync(() -> { |
|
|
|
DeviceCommandBundle deviceCommand = DeviceCommandGenerator.shakeMotorOrigin(); |
|
|
|
CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); |
|
|
|
commandWait(deviceCommandFuture); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|