Browse Source

fix:tcp指令统一使用DeviceCommands

master
白凤吉 6 months ago
parent
commit
5baf5f09bb
  1. 34
      src/main/java/com/qyft/gd/device/common/constant/DeviceCommands.java
  2. 72
      src/main/java/com/qyft/gd/device/service/DeviceService.java

34
src/main/java/com/qyft/gd/device/common/constant/DeviceCommands.java

@ -14,12 +14,18 @@ public class DeviceCommands {
/** 设置导轨机械臂的速度 */ /** 设置导轨机械臂的速度 */
public static final String SET_RAIL_ARM_SPEED = "setRailArmSpeed"; public static final String SET_RAIL_ARM_SPEED = "setRailArmSpeed";
/** 轨道机械臂移动停止移动 */
public static final String STOP_RAIL_ARM = "stopRailArm";
/** 开门 */ /** 开门 */
public static final String OPEN_DOOR = "openDoor"; public static final String OPEN_DOOR = "openDoor";
/** 关门 */ /** 关门 */
public static final String CLOSE_DOOR = "closeDoor"; public static final String CLOSE_DOOR = "closeDoor";
/** 设置门参数 */
public static final String SET_DOOR_PARAMS = "setDoorParams";
/** 张开夹爪 */ /** 张开夹爪 */
public static final String OPEN_CLAW = "openClaw"; public static final String OPEN_CLAW = "openClaw";
@ -35,9 +41,18 @@ public class DeviceCommands {
/** 设置加液机械臂的速度 */ /** 设置加液机械臂的速度 */
public static final String SET_LIQUID_ARM_SPEED = "setLiquidArmSpeed"; public static final String SET_LIQUID_ARM_SPEED = "setLiquidArmSpeed";
/** 加液机械臂移动停止 */
public static final String STOP_LIQUID_ARM = "stopLiquidArm";
/** 设置夹爪 */
public static final String SET_CLAW_PARAMS = "setClawParams";
/** 加液 */ /** 加液 */
public static final String ADD_LIQUID = "addLiquid"; public static final String ADD_LIQUID = "addLiquid";
/** 设置加热位试管架拍子密封状态 */
public static final String SET_SEAL_LID = "setSealLid";
/** 设置加液泵流量 */ /** 设置加液泵流量 */
public static final String SET_FLOW_RATE = "setFlowRate"; public static final String SET_FLOW_RATE = "setFlowRate";
@ -56,15 +71,22 @@ public class DeviceCommands {
/** 停止加热 */ /** 停止加热 */
public static final String STOP_HEATING = "stopHeating"; public static final String STOP_HEATING = "stopHeating";
/** 抬起托盘到指定高度 */
public static final String MOVE_TRAY_TO_HEIGHT = "moveTrayToHeight";
/** 抬起托盘 */
public static final String RAISE_TRAY = "raiseTray";
/** 放下托盘 */
public static final String LOWER_TRAY = "lowerTray";
/** 设置托盘电机参数 */
public static final String SET_TRAY_PARAMS = "setTrayParams";
/** 调整拍子存放区高度 */
public static final String SET_CAP_HEIGHT = "setCapHeight";
/** 设置托盘抬起速度 */
public static final String SET_TRAY_SPEED = "setTraySpeed";
/** 调整拍子存放区电机参数 */
public static final String SET_CAP_PARAMS = "setCapParams";
/** 拍照 */ /** 拍照 */
public static final String TAKE_PHOTO = "takePhoto"; public static final String TAKE_PHOTO = "takePhoto";
/** 触发报警 */
public static final String ALARM_TEST = "alarmTest";
} }

72
src/main/java/com/qyft/gd/device/service/DeviceService.java

@ -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;

Loading…
Cancel
Save