|
@ -8,6 +8,7 @@ import lombok.RequiredArgsConstructor; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam; |
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
|
@Tag(name = "测试") |
|
|
@Tag(name = "测试") |
|
@ -21,9 +22,231 @@ public class TestController { |
|
|
@Operation(summary = "开门") |
|
|
@Operation(summary = "开门") |
|
|
@GetMapping("/openDoor") |
|
|
@GetMapping("/openDoor") |
|
|
public Result<String> openDoor() { |
|
|
public Result<String> openDoor() { |
|
|
deviceService.openDoor(); |
|
|
|
|
|
return Result.success(); |
|
|
|
|
|
|
|
|
boolean success = deviceService.openDoor(); |
|
|
|
|
|
if (success) { |
|
|
|
|
|
return Result.success(); |
|
|
|
|
|
} else { |
|
|
|
|
|
return Result.failed("开门失败"); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "关门") |
|
|
|
|
|
@GetMapping("/closeDoor") |
|
|
|
|
|
public Result<String> closeDoor() { |
|
|
|
|
|
boolean success = deviceService.closeDoor(); |
|
|
|
|
|
if (success) { |
|
|
|
|
|
return Result.success(); |
|
|
|
|
|
} else { |
|
|
|
|
|
return Result.failed("关门失败"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "张开夹爪") |
|
|
|
|
|
@GetMapping("/openClaw") |
|
|
|
|
|
public Result<String> openClaw() { |
|
|
|
|
|
boolean success = deviceService.openClaw(); |
|
|
|
|
|
if (success) { |
|
|
|
|
|
return Result.success(); |
|
|
|
|
|
} else { |
|
|
|
|
|
return Result.failed("张开夹爪失败"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "收合夹爪") |
|
|
|
|
|
@GetMapping("/closeClaw") |
|
|
|
|
|
public Result<String> closeClaw() { |
|
|
|
|
|
boolean success = deviceService.closeClaw(); |
|
|
|
|
|
if (success) { |
|
|
|
|
|
return Result.success(); |
|
|
|
|
|
} else { |
|
|
|
|
|
return Result.failed("收合夹爪失败"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "移动导轨机械臂的导轨") |
|
|
|
|
|
@GetMapping("/moveRailArmRail") |
|
|
|
|
|
public Result<String> moveRailArmRail(@RequestParam double distance) { |
|
|
|
|
|
boolean success = deviceService.moveRailArmRail(distance); |
|
|
|
|
|
if (success) { |
|
|
|
|
|
return Result.success(); |
|
|
|
|
|
} else { |
|
|
|
|
|
return Result.failed("移动导轨机械臂的导轨失败"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "移动导轨机械臂的关节") |
|
|
|
|
|
@GetMapping("/moveRailArmJoint") |
|
|
|
|
|
public Result<String> moveRailArmJoint(@RequestParam double joint1, @RequestParam double joint2, @RequestParam double distance) { |
|
|
|
|
|
boolean success = deviceService.moveRailArmJoint(joint1, joint2, distance); |
|
|
|
|
|
if (success) { |
|
|
|
|
|
return Result.success(); |
|
|
|
|
|
} else { |
|
|
|
|
|
return Result.failed("移动导轨机械臂的关节失败"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "导轨机械臂运动到指定点位") |
|
|
|
|
|
@GetMapping("/moveRailArmToPoint") |
|
|
|
|
|
public Result<String> moveRailArmToPoint(@RequestParam int x, @RequestParam int y, @RequestParam int z) { |
|
|
|
|
|
boolean success = deviceService.moveRailArmToPoint(x, y, z); |
|
|
|
|
|
if (success) { |
|
|
|
|
|
return Result.success(); |
|
|
|
|
|
} else { |
|
|
|
|
|
return Result.failed("导轨机械臂运动到指定点位失败"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "设置导轨机械臂的速度") |
|
|
|
|
|
@GetMapping("/setRailArmSpeed") |
|
|
|
|
|
public Result<String> setRailArmSpeed(@RequestParam int speed) { |
|
|
|
|
|
boolean success = deviceService.setRailArmSpeed(speed); |
|
|
|
|
|
if (success) { |
|
|
|
|
|
return Result.success(); |
|
|
|
|
|
} else { |
|
|
|
|
|
return Result.failed("设置导轨机械臂的速度失败"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "移动加液机械臂的关节") |
|
|
|
|
|
@GetMapping("/moveLiquidArmJoint") |
|
|
|
|
|
public Result<String> moveLiquidArmJoint(@RequestParam double joint1, @RequestParam double joint2) { |
|
|
|
|
|
boolean success = deviceService.moveLiquidArmJoint(joint1, joint2); |
|
|
|
|
|
if (success) { |
|
|
|
|
|
return Result.success(); |
|
|
|
|
|
} else { |
|
|
|
|
|
return Result.failed("移动加液机械臂的关节失败"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "加液机械臂运动到指定点位") |
|
|
|
|
|
@GetMapping("/moveLiquidArmToPoint") |
|
|
|
|
|
public Result<String> moveLiquidArmToPoint(@RequestParam int x, @RequestParam int y, @RequestParam int z) { |
|
|
|
|
|
boolean success = deviceService.moveLiquidArmToPoint(x, y, z); |
|
|
|
|
|
if (success) { |
|
|
|
|
|
return Result.success(); |
|
|
|
|
|
} else { |
|
|
|
|
|
return Result.failed("加液机械臂运动到指定点位失败"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "设置加液机械臂的速度") |
|
|
|
|
|
@GetMapping("/setLiquidArmSpeed") |
|
|
|
|
|
public Result<String> setLiquidArmSpeed(@RequestParam int speed) { |
|
|
|
|
|
boolean success = deviceService.setLiquidArmSpeed(speed); |
|
|
|
|
|
if (success) { |
|
|
|
|
|
return Result.success(); |
|
|
|
|
|
} else { |
|
|
|
|
|
return Result.failed("设置加液机械臂的速度失败"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "加液") |
|
|
|
|
|
@GetMapping("/addLiquid") |
|
|
|
|
|
public Result<String> addLiquid(@RequestParam int pumpId, @RequestParam int volume) { |
|
|
|
|
|
boolean success = deviceService.addLiquid(pumpId, volume); |
|
|
|
|
|
if (success) { |
|
|
|
|
|
return Result.success(); |
|
|
|
|
|
} else { |
|
|
|
|
|
return Result.failed("加液失败"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "设置加液泵流量") |
|
|
|
|
|
@GetMapping("/setFlowRate") |
|
|
|
|
|
public Result<String> setFlowRate(@RequestParam int pumpId, @RequestParam int flowRate) { |
|
|
|
|
|
boolean success = deviceService.setFlowRate(pumpId, flowRate); |
|
|
|
|
|
if (success) { |
|
|
|
|
|
return Result.success(); |
|
|
|
|
|
} else { |
|
|
|
|
|
return Result.failed("设置加液泵流量失败"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "开始摇匀") |
|
|
|
|
|
@GetMapping("/startShaking") |
|
|
|
|
|
public Result<String> startShaking() { |
|
|
|
|
|
boolean success = deviceService.startShaking(); |
|
|
|
|
|
if (success) { |
|
|
|
|
|
return Result.success(); |
|
|
|
|
|
} else { |
|
|
|
|
|
return Result.failed("开始摇匀失败"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "停止摇匀") |
|
|
|
|
|
@GetMapping("/stopShaking") |
|
|
|
|
|
public Result<String> stopShaking() { |
|
|
|
|
|
boolean success = deviceService.stopShaking(); |
|
|
|
|
|
if (success) { |
|
|
|
|
|
return Result.success(); |
|
|
|
|
|
} else { |
|
|
|
|
|
return Result.failed("停止摇匀失败"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "设置摇匀速度") |
|
|
|
|
|
@GetMapping("/setShakingSpeed") |
|
|
|
|
|
public Result<String> setShakingSpeed(@RequestParam int speed) { |
|
|
|
|
|
boolean success = deviceService.setShakingSpeed(speed); |
|
|
|
|
|
if (success) { |
|
|
|
|
|
return Result.success(); |
|
|
|
|
|
} else { |
|
|
|
|
|
return Result.failed("设置摇匀速度失败"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "开始加热") |
|
|
|
|
|
@GetMapping("/startHeating") |
|
|
|
|
|
public Result<String> startHeating(@RequestParam int temperature) { |
|
|
|
|
|
boolean success = deviceService.startHeating(temperature); |
|
|
|
|
|
if (success) { |
|
|
|
|
|
return Result.success(); |
|
|
|
|
|
} else { |
|
|
|
|
|
return Result.failed("开始加热失败"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "停止加热") |
|
|
|
|
|
@GetMapping("/stopHeating") |
|
|
|
|
|
public Result<String> stopHeating() { |
|
|
|
|
|
boolean success = deviceService.stopHeating(); |
|
|
|
|
|
if (success) { |
|
|
|
|
|
return Result.success(); |
|
|
|
|
|
} else { |
|
|
|
|
|
return Result.failed("停止加热失败"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "抬起托盘到指定高度") |
|
|
|
|
|
@GetMapping("/moveTrayToHeight") |
|
|
|
|
|
public Result<String> moveTrayToHeight(@RequestParam double distance) { |
|
|
|
|
|
boolean success = deviceService.moveTrayToHeight(distance); |
|
|
|
|
|
if (success) { |
|
|
|
|
|
return Result.success(); |
|
|
|
|
|
} else { |
|
|
|
|
|
return Result.failed("抬起托盘到指定高度失败"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "设置托盘抬起速度") |
|
|
|
|
|
@GetMapping("/setTraySpeed") |
|
|
|
|
|
public Result<String> setTraySpeed(@RequestParam int speed) { |
|
|
|
|
|
boolean success = deviceService.setTraySpeed(speed); |
|
|
|
|
|
if (success) { |
|
|
|
|
|
return Result.success(); |
|
|
|
|
|
} else { |
|
|
|
|
|
return Result.failed("设置托盘抬起速度失败"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "拍照") |
|
|
|
|
|
@GetMapping("/takePhoto") |
|
|
|
|
|
public Result<String> takePhoto() { |
|
|
|
|
|
boolean success = deviceService.takePhoto(); |
|
|
|
|
|
if (success) { |
|
|
|
|
|
return Result.success(); |
|
|
|
|
|
} else { |
|
|
|
|
|
return Result.failed("拍照失败"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |