|
|
@ -22,15 +22,10 @@ public class DeviceService { |
|
|
|
* |
|
|
|
* @param distance 移动距离 |
|
|
|
*/ |
|
|
|
public synchronized boolean moveRailArmRail(double distance) { |
|
|
|
public boolean moveRailArmRail(double distance) { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("distance", distance); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("moveRailArmRail", params); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP moveRailArmRail 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
return tcpClient.sendCommand("moveRailArmRail", params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -40,17 +35,12 @@ public class DeviceService { |
|
|
|
* @param joint2 关节2角度 |
|
|
|
* @param distance 移动距离 |
|
|
|
*/ |
|
|
|
public synchronized boolean moveRailArmJoint(double joint1, double joint2, double distance) { |
|
|
|
public boolean moveRailArmJoint(double joint1, double joint2, double distance) { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("joint1", joint1); |
|
|
|
params.put("joint2", joint2); |
|
|
|
params.put("distance", distance); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("moveRailArmJoint", params); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP moveRailArmJoint 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
return tcpClient.sendCommand("moveRailArmJoint", params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -60,17 +50,12 @@ public class DeviceService { |
|
|
|
* @param y 坐标y |
|
|
|
* @param z 坐标z |
|
|
|
*/ |
|
|
|
public synchronized boolean moveRailArmToPoint(int x, int y, int z) { |
|
|
|
public boolean moveRailArmToPoint(int x, int y, int z) { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("x", x); |
|
|
|
params.put("y", y); |
|
|
|
params.put("z", z); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("moveRailArmToPoint", params); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP moveRailArmToPoint 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
return tcpClient.sendCommand("moveRailArmToPoint", params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -81,60 +66,35 @@ public class DeviceService { |
|
|
|
public boolean setRailArmSpeed(int speed) { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("speed", speed); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("setRailArmSpeed", params); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP setRailArmSpeed 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
return tcpClient.sendCommand("setRailArmSpeed", params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 开门 |
|
|
|
*/ |
|
|
|
public boolean openDoor() { |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("openDoor"); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP openDoor 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
return tcpClient.sendCommand("openDoor"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 关门 |
|
|
|
*/ |
|
|
|
public boolean closeDoor() { |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("closeDoor"); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP closeDoor 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
return tcpClient.sendCommand("closeDoor"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 张开夹爪 |
|
|
|
*/ |
|
|
|
public boolean openClaw() { |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("openClaw"); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP openClaw 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
return tcpClient.sendCommand("openClaw"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 收合夹爪 |
|
|
|
*/ |
|
|
|
public boolean closeClaw() { |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("closeClaw"); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP closeClaw 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
return tcpClient.sendCommand("closeClaw"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -143,16 +103,11 @@ public class DeviceService { |
|
|
|
* @param joint1 关节1角度 |
|
|
|
* @param joint2 关节2角度 |
|
|
|
*/ |
|
|
|
public synchronized boolean moveLiquidArmJoint(double joint1, double joint2) { |
|
|
|
public boolean moveLiquidArmJoint(double joint1, double joint2) { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("joint1", joint1); |
|
|
|
params.put("joint2", joint2); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("moveLiquidArmJoint", params); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP moveLiquidArmJoint 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
return tcpClient.sendCommand("moveLiquidArmJoint", params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -162,17 +117,12 @@ public class DeviceService { |
|
|
|
* @param y 坐标y |
|
|
|
* @param z 坐标z |
|
|
|
*/ |
|
|
|
public synchronized boolean moveLiquidArmToPoint(int x, int y, int z) { |
|
|
|
public boolean moveLiquidArmToPoint(int x, int y, int z) { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("x", x); |
|
|
|
params.put("y", y); |
|
|
|
params.put("z", z); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("moveLiquidArmToPoint", params); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP moveLiquidArmToPoint 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
return tcpClient.sendCommand("moveLiquidArmToPoint", params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -183,12 +133,7 @@ public class DeviceService { |
|
|
|
public boolean setLiquidArmSpeed(int speed) { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("speed", speed); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("setLiquidArmSpeed", params); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP setLiquidArmSpeed 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
return tcpClient.sendCommand("setLiquidArmSpeed", params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -197,16 +142,11 @@ public class DeviceService { |
|
|
|
* @param pumpId 泵id |
|
|
|
* @param volume 液体体积 |
|
|
|
*/ |
|
|
|
public synchronized boolean addLiquid(String pumpId, int volume) { |
|
|
|
public boolean addLiquid(String pumpId, int volume) { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("pumpId", pumpId); |
|
|
|
params.put("volume", volume); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("addLiquid", params); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP addLiquid 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
return tcpClient.sendCommand("addLiquid", params); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -220,36 +160,21 @@ public class DeviceService { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("pumpId", pumpId); |
|
|
|
params.put("flowRate", flowRate); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("setFlowRate", params); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP setFlowRate 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
return tcpClient.sendCommand("setFlowRate", params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 开始摇匀 |
|
|
|
*/ |
|
|
|
public boolean startShaking() { |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("startShaking"); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP startShaking 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
return tcpClient.sendCommand("startShaking"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 停止摇匀 |
|
|
|
*/ |
|
|
|
public boolean stopShaking() { |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("stopShaking"); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP stopShaking 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
return tcpClient.sendCommand("stopShaking"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -260,12 +185,7 @@ public class DeviceService { |
|
|
|
public boolean setShakingSpeed(int speed) { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("speed", speed); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("setShakingSpeed", params); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP setShakingSpeed 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
return tcpClient.sendCommand("setShakingSpeed", params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -278,27 +198,18 @@ public class DeviceService { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("heaterId", heaterId); |
|
|
|
params.put("temperature", temperature); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("startHeating", params); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP startHeating 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
return tcpClient.sendCommand("startHeating", params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 停止加热 |
|
|
|
* @param heaterId 加热器id |
|
|
|
* |
|
|
|
* @param heaterId 加热器id |
|
|
|
*/ |
|
|
|
public boolean stopHeating(String heaterId) { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("heaterId", heaterId); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("stopHeating", params); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP stopHeating 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
return tcpClient.sendCommand("stopHeating", params); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -310,12 +221,7 @@ public class DeviceService { |
|
|
|
public boolean moveTrayToHeight(double distance) { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("distance", distance); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("moveTrayToHeight", params); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP moveTrayToHeight 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
return tcpClient.sendCommand("moveTrayToHeight", params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -326,24 +232,14 @@ public class DeviceService { |
|
|
|
public boolean setTraySpeed(int speed) { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("speed", speed); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("setTraySpeed", params); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP setTraySpeed 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
return tcpClient.sendCommand("setTraySpeed", params); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 拍照 |
|
|
|
*/ |
|
|
|
public boolean takePhoto() { |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("takePhoto"); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP takePhoto 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
return tcpClient.sendCommand("takePhoto"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -354,11 +250,6 @@ public class DeviceService { |
|
|
|
params.put("code", code); |
|
|
|
params.put("msg", msg); |
|
|
|
params.put("module", module); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("alarmTest", params); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP alarmTest 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
return tcpClient.sendCommand("alarmTest", params); |
|
|
|
} |
|
|
|
} |