|
@ -2,6 +2,7 @@ package com.qyft.gd.device.service; |
|
|
|
|
|
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
import cn.hutool.json.JSONUtil; |
|
|
import com.qyft.gd.device.client.TcpClient; |
|
|
import com.qyft.gd.device.client.TcpClient; |
|
|
|
|
|
import com.qyft.gd.device.common.constant.DeviceCommands; |
|
|
import com.qyft.gd.device.common.jsonrpc.JsonRpcRequest; |
|
|
import com.qyft.gd.device.common.jsonrpc.JsonRpcRequest; |
|
|
import com.qyft.gd.device.model.bo.DeviceFeedback; |
|
|
import com.qyft.gd.device.model.bo.DeviceFeedback; |
|
|
import jakarta.annotation.PostConstruct; |
|
|
import jakarta.annotation.PostConstruct; |
|
@ -30,27 +31,26 @@ public class DeviceService { |
|
|
new Thread(this::executeTasks).start(); |
|
|
new Thread(this::executeTasks).start(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private boolean enqueueMoveRailTask(String method) { |
|
|
|
|
|
|
|
|
private boolean putTask(String method) { |
|
|
JsonRpcRequest request = new JsonRpcRequest(); |
|
|
JsonRpcRequest request = new JsonRpcRequest(); |
|
|
request.setMethod(method); |
|
|
request.setMethod(method); |
|
|
return this.enqueueMoveRailTask(request); |
|
|
|
|
|
|
|
|
return this.putTask(request); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private boolean enqueueMoveRailTask(String method, Map<String, Object> params) { |
|
|
|
|
|
|
|
|
private boolean putTask(String method, Map<String, Object> params) { |
|
|
JsonRpcRequest request = new JsonRpcRequest(); |
|
|
JsonRpcRequest request = new JsonRpcRequest(); |
|
|
request.setMethod(method); |
|
|
request.setMethod(method); |
|
|
request.setParams(params); |
|
|
request.setParams(params); |
|
|
return this.enqueueMoveRailTask(request); |
|
|
|
|
|
|
|
|
return this.putTask(request); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private boolean enqueueMoveRailTask(JsonRpcRequest request) { |
|
|
|
|
|
|
|
|
private boolean putTask(JsonRpcRequest request) { |
|
|
Callable<Boolean> task = () -> { |
|
|
Callable<Boolean> task = () -> { |
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand(request); |
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand(request); |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
log.error("TCP 指令执行错误 request:{} feedback:{}", JSONUtil.toJsonStr(request), JSONUtil.toJsonStr(deviceFeedback)); |
|
|
log.error("TCP 指令执行错误 request:{} feedback:{}", JSONUtil.toJsonStr(request), JSONUtil.toJsonStr(deviceFeedback)); |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
Thread.sleep(5000); |
|
|
|
|
|
return true; |
|
|
return true; |
|
|
}; |
|
|
}; |
|
|
try { |
|
|
try { |
|
@ -74,7 +74,7 @@ public class DeviceService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public boolean test() { |
|
|
public boolean test() { |
|
|
return this.enqueueMoveRailTask("moveRailArmRail", null); |
|
|
|
|
|
|
|
|
return this.putTask("moveRailArmRail"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -85,7 +85,7 @@ public class DeviceService { |
|
|
public boolean moveRailArmRail(double distance) { |
|
|
public boolean moveRailArmRail(double distance) { |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
params.put("distance", distance); |
|
|
params.put("distance", distance); |
|
|
return this.enqueueMoveRailTask("moveRailArmRail", params); |
|
|
|
|
|
|
|
|
return this.putTask(DeviceCommands.MOVE_RAIL_ARM_RAIL, params); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -100,7 +100,7 @@ public class DeviceService { |
|
|
params.put("joint1", joint1); |
|
|
params.put("joint1", joint1); |
|
|
params.put("joint2", joint2); |
|
|
params.put("joint2", joint2); |
|
|
params.put("distance", distance); |
|
|
params.put("distance", distance); |
|
|
return this.enqueueMoveRailTask("moveRailArmJoint", params); |
|
|
|
|
|
|
|
|
return this.putTask(DeviceCommands.MOVE_RAIL_ARM_JOINT, params); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -115,7 +115,7 @@ public class DeviceService { |
|
|
params.put("x", x); |
|
|
params.put("x", x); |
|
|
params.put("y", y); |
|
|
params.put("y", y); |
|
|
params.put("z", z); |
|
|
params.put("z", z); |
|
|
return this.enqueueMoveRailTask("moveRailArmToPoint", params); |
|
|
|
|
|
|
|
|
return this.putTask(DeviceCommands.MOVE_RAIL_ARM_TO_POINT, params); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -126,14 +126,14 @@ public class DeviceService { |
|
|
public boolean setRailArmSpeed(int speed) { |
|
|
public boolean setRailArmSpeed(int speed) { |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
params.put("speed", speed); |
|
|
params.put("speed", speed); |
|
|
return this.enqueueMoveRailTask("setRailArmSpeed", params); |
|
|
|
|
|
|
|
|
return this.putTask(DeviceCommands.SET_RAIL_ARM_SPEED, params); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 轨道机械臂移动停止移动 |
|
|
* 轨道机械臂移动停止移动 |
|
|
*/ |
|
|
*/ |
|
|
public boolean stopRailArm() { |
|
|
public boolean stopRailArm() { |
|
|
return this.enqueueMoveRailTask("stopRailArm"); |
|
|
|
|
|
|
|
|
return this.putTask(DeviceCommands.STOP_RAIL_ARM); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -146,7 +146,7 @@ public class DeviceService { |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
params.put("joint1", joint1); |
|
|
params.put("joint1", joint1); |
|
|
params.put("joint2", joint2); |
|
|
params.put("joint2", joint2); |
|
|
return this.enqueueMoveRailTask("moveLiquidArmJoint", params); |
|
|
|
|
|
|
|
|
return this.putTask(DeviceCommands.MOVE_LIQUID_ARM_JOINT, params); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -161,7 +161,7 @@ public class DeviceService { |
|
|
params.put("x", x); |
|
|
params.put("x", x); |
|
|
params.put("y", y); |
|
|
params.put("y", y); |
|
|
params.put("z", z); |
|
|
params.put("z", z); |
|
|
return this.enqueueMoveRailTask("moveLiquidArmToPoint", params); |
|
|
|
|
|
|
|
|
return this.putTask(DeviceCommands.MOVE_LIQUID_ARM_TO_POINT, params); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -172,7 +172,7 @@ public class DeviceService { |
|
|
public synchronized boolean setLiquidArmSpeed(int speed) { |
|
|
public synchronized boolean setLiquidArmSpeed(int speed) { |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
params.put("speed", speed); |
|
|
params.put("speed", speed); |
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("setLiquidArmSpeed", params); |
|
|
|
|
|
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand(DeviceCommands.SET_LIQUID_ARM_SPEED, params); |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
log.error("TCP setLiquidArmSpeed 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
log.error("TCP setLiquidArmSpeed 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
return false; |
|
|
return false; |
|
@ -184,7 +184,7 @@ public class DeviceService { |
|
|
* 加液机械臂移动停止 |
|
|
* 加液机械臂移动停止 |
|
|
*/ |
|
|
*/ |
|
|
public synchronized boolean stopLiquidArm() { |
|
|
public synchronized boolean stopLiquidArm() { |
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("stopLiquidArm"); |
|
|
|
|
|
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand(DeviceCommands.STOP_LIQUID_ARM); |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
log.error("TCP stopLiquidArm 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
log.error("TCP stopLiquidArm 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
return false; |
|
|
return false; |
|
@ -196,7 +196,7 @@ public class DeviceService { |
|
|
* 张开夹爪 |
|
|
* 张开夹爪 |
|
|
*/ |
|
|
*/ |
|
|
public synchronized boolean openClaw() { |
|
|
public synchronized boolean openClaw() { |
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("openClaw"); |
|
|
|
|
|
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand(DeviceCommands.OPEN_CLAW); |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
log.error("TCP openClaw 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
log.error("TCP openClaw 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
return false; |
|
|
return false; |
|
@ -208,7 +208,7 @@ public class DeviceService { |
|
|
* 收合夹爪 |
|
|
* 收合夹爪 |
|
|
*/ |
|
|
*/ |
|
|
public synchronized boolean closeClaw() { |
|
|
public synchronized boolean closeClaw() { |
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("closeClaw"); |
|
|
|
|
|
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand(DeviceCommands.CLOSE_CLAW); |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
log.error("TCP closeClaw 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
log.error("TCP closeClaw 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
return false; |
|
|
return false; |
|
@ -228,7 +228,7 @@ public class DeviceService { |
|
|
params.put("mode", mode); |
|
|
params.put("mode", mode); |
|
|
params.put("speed", speed); |
|
|
params.put("speed", speed); |
|
|
params.put("targetPos", targetPos); |
|
|
params.put("targetPos", targetPos); |
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("setClawParams", params); |
|
|
|
|
|
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand(DeviceCommands.SET_CLAW_PARAMS, params); |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
log.error("TCP setClawParams 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
log.error("TCP setClawParams 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
return false; |
|
|
return false; |
|
@ -246,7 +246,7 @@ public class DeviceService { |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
params.put("pumpId", pumpId); |
|
|
params.put("pumpId", pumpId); |
|
|
params.put("volume", volume); |
|
|
params.put("volume", volume); |
|
|
return this.enqueueMoveRailTask("addLiquid", params); |
|
|
|
|
|
|
|
|
return this.putTask(DeviceCommands.ADD_LIQUID, params); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -259,7 +259,7 @@ public class DeviceService { |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
params.put("heaterId", heaterId); |
|
|
params.put("heaterId", heaterId); |
|
|
params.put("on", on); |
|
|
params.put("on", on); |
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("setSealLid", params); |
|
|
|
|
|
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand(DeviceCommands.SET_SEAL_LID, params); |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
log.error("TCP setSealLid 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
log.error("TCP setSealLid 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
return false; |
|
|
return false; |
|
@ -272,14 +272,14 @@ public class DeviceService { |
|
|
* 开门 |
|
|
* 开门 |
|
|
*/ |
|
|
*/ |
|
|
public synchronized boolean openDoor() { |
|
|
public synchronized boolean openDoor() { |
|
|
return this.enqueueMoveRailTask("openDoor"); |
|
|
|
|
|
|
|
|
return this.putTask(DeviceCommands.OPEN_DOOR); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 关门 |
|
|
* 关门 |
|
|
*/ |
|
|
*/ |
|
|
public synchronized boolean closeDoor() { |
|
|
public synchronized boolean closeDoor() { |
|
|
return this.enqueueMoveRailTask("openDoor"); |
|
|
|
|
|
|
|
|
return this.putTask(DeviceCommands.CLOSE_DOOR); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -292,7 +292,7 @@ public class DeviceService { |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
params.put("speed", speed); |
|
|
params.put("speed", speed); |
|
|
params.put("targetPos", targetPos); |
|
|
params.put("targetPos", targetPos); |
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("setDoorParams", params); |
|
|
|
|
|
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand(DeviceCommands.SET_DOOR_PARAMS, params); |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
log.error("TCP setDoorParams 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
log.error("TCP setDoorParams 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
return false; |
|
|
return false; |
|
@ -310,7 +310,7 @@ public class DeviceService { |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
params.put("pumpId", pumpId); |
|
|
params.put("pumpId", pumpId); |
|
|
params.put("flowRate", flowRate); |
|
|
params.put("flowRate", flowRate); |
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("setFlowRate", params); |
|
|
|
|
|
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand(DeviceCommands.SET_FLOW_RATE, params); |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
log.error("TCP setFlowRate 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
log.error("TCP setFlowRate 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
return false; |
|
|
return false; |
|
@ -322,7 +322,7 @@ public class DeviceService { |
|
|
* 开始摇匀 |
|
|
* 开始摇匀 |
|
|
*/ |
|
|
*/ |
|
|
public synchronized boolean startShaking() { |
|
|
public synchronized boolean startShaking() { |
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("startShaking"); |
|
|
|
|
|
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand(DeviceCommands.START_SHAKING); |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
log.error("TCP startShaking 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
log.error("TCP startShaking 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
return false; |
|
|
return false; |
|
@ -334,7 +334,7 @@ public class DeviceService { |
|
|
* 停止摇匀 |
|
|
* 停止摇匀 |
|
|
*/ |
|
|
*/ |
|
|
public synchronized boolean stopShaking() { |
|
|
public synchronized boolean stopShaking() { |
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("stopShaking"); |
|
|
|
|
|
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand(DeviceCommands.STOP_SHAKING); |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
log.error("TCP stopShaking 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
log.error("TCP stopShaking 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
return false; |
|
|
return false; |
|
@ -350,7 +350,7 @@ public class DeviceService { |
|
|
public synchronized boolean setShakingSpeed(int speed) { |
|
|
public synchronized boolean setShakingSpeed(int speed) { |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
params.put("speed", speed); |
|
|
params.put("speed", speed); |
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("setShakingSpeed", params); |
|
|
|
|
|
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand(DeviceCommands.SET_SHAKING_SPEED, params); |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
log.error("TCP setShakingSpeed 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
log.error("TCP setShakingSpeed 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
return false; |
|
|
return false; |
|
@ -366,7 +366,7 @@ public class DeviceService { |
|
|
public boolean raiseTray(String heaterId) { |
|
|
public boolean raiseTray(String heaterId) { |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
params.put("heaterId", heaterId); |
|
|
params.put("heaterId", heaterId); |
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("raiseTray", params); |
|
|
|
|
|
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand(DeviceCommands.RAISE_TRAY, params); |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
log.error("TCP raiseTray 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
log.error("TCP raiseTray 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
return false; |
|
|
return false; |
|
@ -382,7 +382,7 @@ public class DeviceService { |
|
|
public boolean lowerTray(String heaterId) { |
|
|
public boolean lowerTray(String heaterId) { |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
params.put("heaterId", heaterId); |
|
|
params.put("heaterId", heaterId); |
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("lowerTray", params); |
|
|
|
|
|
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand(DeviceCommands.LOWER_TRAY, params); |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
log.error("TCP lowerTray 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
log.error("TCP lowerTray 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
return false; |
|
|
return false; |
|
@ -402,7 +402,7 @@ public class DeviceService { |
|
|
params.put("heaterId", heaterId); |
|
|
params.put("heaterId", heaterId); |
|
|
params.put("speed", speed); |
|
|
params.put("speed", speed); |
|
|
params.put("targetPos", targetPos); |
|
|
params.put("targetPos", targetPos); |
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("setTrayParams", params); |
|
|
|
|
|
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand(DeviceCommands.SET_TRAY_PARAMS, params); |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
log.error("TCP setTrayParams 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
log.error("TCP setTrayParams 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
return false; |
|
|
return false; |
|
@ -418,7 +418,7 @@ public class DeviceService { |
|
|
public synchronized boolean setCapHeight(int level) { |
|
|
public synchronized boolean setCapHeight(int level) { |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
params.put("level", level); |
|
|
params.put("level", level); |
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("setCapHeight", params); |
|
|
|
|
|
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand(DeviceCommands.SET_CAP_HEIGHT, params); |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
log.error("TCP setCapHeight 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
log.error("TCP setCapHeight 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
return false; |
|
|
return false; |
|
@ -436,7 +436,7 @@ public class DeviceService { |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
params.put("speed", speed); |
|
|
params.put("speed", speed); |
|
|
params.put("targetPos", targetPos); |
|
|
params.put("targetPos", targetPos); |
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("setCapParams", params); |
|
|
|
|
|
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand(DeviceCommands.SET_CAP_PARAMS, params); |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
log.error("TCP setCapParams 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
log.error("TCP setCapParams 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
return false; |
|
|
return false; |
|
@ -454,7 +454,7 @@ public class DeviceService { |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
params.put("heaterId", heaterId); |
|
|
params.put("heaterId", heaterId); |
|
|
params.put("temperature", temperature); |
|
|
params.put("temperature", temperature); |
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("startHeating", params); |
|
|
|
|
|
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand(DeviceCommands.START_HEATING, params); |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
log.error("TCP startHeating 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
log.error("TCP startHeating 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
return false; |
|
|
return false; |
|
@ -470,7 +470,7 @@ public class DeviceService { |
|
|
public boolean stopHeating(String heaterId) { |
|
|
public boolean stopHeating(String heaterId) { |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
params.put("heaterId", heaterId); |
|
|
params.put("heaterId", heaterId); |
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("stopHeating", params); |
|
|
|
|
|
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand(DeviceCommands.STOP_HEATING, params); |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
log.error("TCP stopHeating 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
log.error("TCP stopHeating 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
return false; |
|
|
return false; |
|
@ -482,7 +482,7 @@ public class DeviceService { |
|
|
* 拍照 |
|
|
* 拍照 |
|
|
*/ |
|
|
*/ |
|
|
public synchronized boolean takePhoto() { |
|
|
public synchronized boolean takePhoto() { |
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("takePhoto"); |
|
|
|
|
|
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand(DeviceCommands.TAKE_PHOTO); |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
log.error("TCP takePhoto 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
log.error("TCP takePhoto 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
return false; |
|
|
return false; |
|
|