处理机场飞行控制数据
This commit is contained in:
parent
2348168502
commit
47b6d88e2c
|
|
@ -0,0 +1,94 @@
|
||||||
|
package com.ruoyi.device.domain.impl.machine.vendor.tuoheng.instruction;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.AbstractInstruction;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.CallbackConfig;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.InstructionContext;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class TuohengGimbalControlInstruction extends AbstractInstruction {
|
||||||
|
|
||||||
|
private final String commandValue;
|
||||||
|
private final String description;
|
||||||
|
private final String evalue;
|
||||||
|
private final String lightMode;
|
||||||
|
|
||||||
|
public TuohengGimbalControlInstruction(String commandValue, String description) {
|
||||||
|
this(commandValue, description, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TuohengGimbalControlInstruction(String commandValue, String description, String evalue) {
|
||||||
|
this(commandValue, description, evalue, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TuohengGimbalControlInstruction(String commandValue, String description, String evalue, String lightMode) {
|
||||||
|
this.commandValue = commandValue;
|
||||||
|
this.description = description;
|
||||||
|
this.evalue = evalue;
|
||||||
|
this.lightMode = lightMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "TUOHENG_GIMBAL_CONTROL_" + commandValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executeRemoteCall(InstructionContext context) throws Exception {
|
||||||
|
String sn = context.getSn();
|
||||||
|
log.info("发送拓恒云台控制指令: sn={}, command={}, desc={}", sn, commandValue, description);
|
||||||
|
|
||||||
|
JSONObject payload = new JSONObject();
|
||||||
|
payload.put("code", "yuntai");
|
||||||
|
payload.put("value", commandValue);
|
||||||
|
payload.put("messageID", System.currentTimeMillis());
|
||||||
|
payload.put("timestamp", System.currentTimeMillis());
|
||||||
|
payload.put("desc", description);
|
||||||
|
|
||||||
|
// 添加可选参数
|
||||||
|
if (evalue != null) {
|
||||||
|
payload.put("evalue", evalue);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lightMode != null) {
|
||||||
|
payload.put("lightMode", lightMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 从上下文获取额外参数
|
||||||
|
if (context.getCommandParam("evalue") != null) {
|
||||||
|
payload.put("evalue", context.getCommandParam("evalue"));
|
||||||
|
}
|
||||||
|
if (context.getCommandParam("value") != null) {
|
||||||
|
payload.put("value", context.getCommandParam("value"));
|
||||||
|
}
|
||||||
|
if (context.getCommandParam("messageID") != null) {
|
||||||
|
payload.put("messageID", context.getCommandParam("messageID"));
|
||||||
|
}
|
||||||
|
//专门用于云台变焦命令的,用于指定相机的灯光模式。
|
||||||
|
if (context.getCommandParam("lightMode") != null) {
|
||||||
|
payload.put("lightMode", context.getCommandParam("lightMode"));
|
||||||
|
}
|
||||||
|
|
||||||
|
String topic = "/topic/v1/airportDrone/" + sn + "/control";
|
||||||
|
context.getMqttClient().sendMessage(topic, payload.toJSONString());
|
||||||
|
log.info("云台控制指令发送成功: topic={}, payload={}", topic, payload.toJSONString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CallbackConfig getMethodCallbackConfig(InstructionContext context) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CallbackConfig getStateCallbackConfig(InstructionContext context) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getTimeoutMs() {
|
||||||
|
return 5000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,78 @@
|
||||||
|
package com.ruoyi.device.domain.impl.machine.vendor.tuoheng.instruction;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.AbstractInstruction;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.CallbackConfig;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.InstructionContext;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class TuohengGimbalMoveLeftInstruction extends AbstractInstruction {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "TUOHENG_GIMBAL_MOVE_LEFT";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executeRemoteCall(InstructionContext context) throws Exception {
|
||||||
|
String sn = context.getSn();
|
||||||
|
long messageID = context.getCommandParam("messageID", Long.class) != null ? (Long) context.getCommandParam("messageID") : System.currentTimeMillis();
|
||||||
|
log.info("发送拓恒云台左移指令序列: sn={}, messageID={}", sn, messageID);
|
||||||
|
|
||||||
|
String topic = "/topic/v1/airportDrone/" + sn + "/control";
|
||||||
|
|
||||||
|
// 1. 发送云台转速设置命令
|
||||||
|
JSONObject speedPayload = new JSONObject();
|
||||||
|
speedPayload.put("code", "yuntai");
|
||||||
|
speedPayload.put("messageID", messageID);
|
||||||
|
speedPayload.put("evalue", context.getCommandParam("evalue") != null ? context.getCommandParam("evalue") : 90);
|
||||||
|
speedPayload.put("value", "31");
|
||||||
|
speedPayload.put("timestamp", System.currentTimeMillis());
|
||||||
|
speedPayload.put("desc", "云台转速");
|
||||||
|
context.getMqttClient().sendMessage(topic, speedPayload.toJSONString());
|
||||||
|
log.info("云台转速设置指令发送成功: topic={}, payload={}", topic, speedPayload.toJSONString());
|
||||||
|
|
||||||
|
// 短暂延迟,确保命令按顺序执行
|
||||||
|
Thread.sleep(100);
|
||||||
|
|
||||||
|
// 2. 发送云台左移命令
|
||||||
|
JSONObject movePayload = new JSONObject();
|
||||||
|
movePayload.put("code", "yuntai");
|
||||||
|
movePayload.put("messageID", messageID);
|
||||||
|
movePayload.put("evalue", context.getCommandParam("evalue") != null ? context.getCommandParam("evalue") : 90);
|
||||||
|
movePayload.put("value", "03");
|
||||||
|
movePayload.put("timestamp", System.currentTimeMillis());
|
||||||
|
movePayload.put("desc", "云台左移");
|
||||||
|
context.getMqttClient().sendMessage(topic, movePayload.toJSONString());
|
||||||
|
log.info("云台左移指令发送成功: topic={}, payload={}", topic, movePayload.toJSONString());
|
||||||
|
|
||||||
|
// 短暂延迟,确保命令按顺序执行
|
||||||
|
Thread.sleep(500);
|
||||||
|
|
||||||
|
// 3. 发送云台停止命令
|
||||||
|
JSONObject stopPayload = new JSONObject();
|
||||||
|
stopPayload.put("code", "yuntai");
|
||||||
|
stopPayload.put("messageID", messageID);
|
||||||
|
stopPayload.put("value", "09");
|
||||||
|
stopPayload.put("timestamp", System.currentTimeMillis());
|
||||||
|
stopPayload.put("desc", "云台停止");
|
||||||
|
context.getMqttClient().sendMessage(topic, stopPayload.toJSONString());
|
||||||
|
log.info("云台停止指令发送成功: topic={}, payload={}", topic, stopPayload.toJSONString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CallbackConfig getMethodCallbackConfig(InstructionContext context) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CallbackConfig getStateCallbackConfig(InstructionContext context) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getTimeoutMs() {
|
||||||
|
return 3000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,78 @@
|
||||||
|
package com.ruoyi.device.domain.impl.machine.vendor.tuoheng.instruction;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.AbstractInstruction;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.CallbackConfig;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.InstructionContext;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class TuohengGimbalMoveRightInstruction extends AbstractInstruction {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "TUOHENG_GIMBAL_MOVE_RIGHT";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executeRemoteCall(InstructionContext context) throws Exception {
|
||||||
|
String sn = context.getSn();
|
||||||
|
long messageID = context.getCommandParam("messageID", Long.class) != null ? (Long) context.getCommandParam("messageID") : System.currentTimeMillis();
|
||||||
|
log.info("发送拓恒云台右移指令序列: sn={}, messageID={}", sn, messageID);
|
||||||
|
|
||||||
|
String topic = "/topic/v1/airportDrone/" + sn + "/control";
|
||||||
|
|
||||||
|
// 1. 发送云台转速设置命令
|
||||||
|
JSONObject speedPayload = new JSONObject();
|
||||||
|
speedPayload.put("code", "yuntai");
|
||||||
|
speedPayload.put("messageID", messageID);
|
||||||
|
speedPayload.put("evalue", context.getCommandParam("evalue") != null ? context.getCommandParam("evalue") : 90);
|
||||||
|
speedPayload.put("value", "31");
|
||||||
|
speedPayload.put("timestamp", System.currentTimeMillis());
|
||||||
|
speedPayload.put("desc", "云台转速");
|
||||||
|
context.getMqttClient().sendMessage(topic, speedPayload.toJSONString());
|
||||||
|
log.info("云台转速设置指令发送成功: topic={}, payload={}", topic, speedPayload.toJSONString());
|
||||||
|
|
||||||
|
// 短暂延迟,确保命令按顺序执行
|
||||||
|
Thread.sleep(100);
|
||||||
|
|
||||||
|
// 2. 发送云台右移命令
|
||||||
|
JSONObject movePayload = new JSONObject();
|
||||||
|
movePayload.put("code", "yuntai");
|
||||||
|
movePayload.put("messageID", messageID);
|
||||||
|
movePayload.put("evalue", context.getCommandParam("evalue") != null ? context.getCommandParam("evalue") : 90);
|
||||||
|
movePayload.put("value", "04");
|
||||||
|
movePayload.put("timestamp", System.currentTimeMillis());
|
||||||
|
movePayload.put("desc", "云台右移");
|
||||||
|
context.getMqttClient().sendMessage(topic, movePayload.toJSONString());
|
||||||
|
log.info("云台右移指令发送成功: topic={}, payload={}", topic, movePayload.toJSONString());
|
||||||
|
|
||||||
|
// 短暂延迟,确保命令按顺序执行
|
||||||
|
Thread.sleep(500);
|
||||||
|
|
||||||
|
// 3. 发送云台停止命令
|
||||||
|
JSONObject stopPayload = new JSONObject();
|
||||||
|
stopPayload.put("code", "yuntai");
|
||||||
|
stopPayload.put("messageID", messageID);
|
||||||
|
stopPayload.put("value", "09");
|
||||||
|
stopPayload.put("timestamp", System.currentTimeMillis());
|
||||||
|
stopPayload.put("desc", "云台停止");
|
||||||
|
context.getMqttClient().sendMessage(topic, stopPayload.toJSONString());
|
||||||
|
log.info("云台停止指令发送成功: topic={}, payload={}", topic, stopPayload.toJSONString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CallbackConfig getMethodCallbackConfig(InstructionContext context) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CallbackConfig getStateCallbackConfig(InstructionContext context) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getTimeoutMs() {
|
||||||
|
return 3000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
package com.ruoyi.device.domain.impl.machine.vendor.tuoheng.instruction;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.AbstractInstruction;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.CallbackConfig;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.InstructionContext;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class TuohengGimbalPitchDownInstruction extends AbstractInstruction {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "TUOHENG_GIMBAL_PITCH_DOWN";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executeRemoteCall(InstructionContext context) throws Exception {
|
||||||
|
String sn = context.getSn();
|
||||||
|
long messageID = context.getCommandParam("messageID", Long.class) != null ? (Long) context.getCommandParam("messageID") : System.currentTimeMillis();
|
||||||
|
log.info("发送拓恒云台俯仰(下)指令序列: sn={}, messageID={}", sn, messageID);
|
||||||
|
|
||||||
|
String topic = "/topic/v1/airportDrone/" + sn + "/control";
|
||||||
|
|
||||||
|
// 1. 发送云台俯仰(下)命令
|
||||||
|
JSONObject pitchPayload = new JSONObject();
|
||||||
|
pitchPayload.put("code", "yuntai");
|
||||||
|
pitchPayload.put("messageID", messageID);
|
||||||
|
pitchPayload.put("evalue", context.getCommandParam("evalue") != null ? context.getCommandParam("evalue") : 90);
|
||||||
|
pitchPayload.put("value", "02");
|
||||||
|
pitchPayload.put("timestamp", System.currentTimeMillis());
|
||||||
|
pitchPayload.put("desc", "云台俯仰(下)");
|
||||||
|
context.getMqttClient().sendMessage(topic, pitchPayload.toJSONString());
|
||||||
|
log.info("云台俯仰(下)指令发送成功: topic={}, payload={}", topic, pitchPayload.toJSONString());
|
||||||
|
|
||||||
|
// 短暂延迟,确保命令按顺序执行
|
||||||
|
Thread.sleep(500);
|
||||||
|
|
||||||
|
// 2. 发送云台停止命令
|
||||||
|
JSONObject stopPayload = new JSONObject();
|
||||||
|
stopPayload.put("code", "yuntai");
|
||||||
|
stopPayload.put("messageID", messageID);
|
||||||
|
stopPayload.put("value", "09");
|
||||||
|
stopPayload.put("timestamp", System.currentTimeMillis());
|
||||||
|
stopPayload.put("desc", "云台停止");
|
||||||
|
context.getMqttClient().sendMessage(topic, stopPayload.toJSONString());
|
||||||
|
log.info("云台停止指令发送成功: topic={}, payload={}", topic, stopPayload.toJSONString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CallbackConfig getMethodCallbackConfig(InstructionContext context) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CallbackConfig getStateCallbackConfig(InstructionContext context) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getTimeoutMs() {
|
||||||
|
return 3000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
package com.ruoyi.device.domain.impl.machine.vendor.tuoheng.instruction;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.AbstractInstruction;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.CallbackConfig;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.InstructionContext;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class TuohengGimbalPitchUpInstruction extends AbstractInstruction {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "TUOHENG_GIMBAL_PITCH_UP";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executeRemoteCall(InstructionContext context) throws Exception {
|
||||||
|
String sn = context.getSn();
|
||||||
|
long messageID = context.getCommandParam("messageID", Long.class) != null ? (Long) context.getCommandParam("messageID") : System.currentTimeMillis();
|
||||||
|
log.info("发送拓恒云台俯仰(上)指令序列: sn={}, messageID={}", sn, messageID);
|
||||||
|
|
||||||
|
String topic = "/topic/v1/airportDrone/" + sn + "/control";
|
||||||
|
|
||||||
|
// 1. 发送云台俯仰(上)命令
|
||||||
|
JSONObject pitchPayload = new JSONObject();
|
||||||
|
pitchPayload.put("code", "yuntai");
|
||||||
|
pitchPayload.put("messageID", messageID);
|
||||||
|
pitchPayload.put("evalue", context.getCommandParam("evalue") != null ? context.getCommandParam("evalue") : 90);
|
||||||
|
pitchPayload.put("value", "01");
|
||||||
|
pitchPayload.put("timestamp", System.currentTimeMillis());
|
||||||
|
pitchPayload.put("desc", "云台俯仰(上)");
|
||||||
|
context.getMqttClient().sendMessage(topic, pitchPayload.toJSONString());
|
||||||
|
log.info("云台俯仰(上)指令发送成功: topic={}, payload={}", topic, pitchPayload.toJSONString());
|
||||||
|
|
||||||
|
// 短暂延迟,确保命令按顺序执行
|
||||||
|
Thread.sleep(500);
|
||||||
|
|
||||||
|
// 2. 发送云台停止命令
|
||||||
|
JSONObject stopPayload = new JSONObject();
|
||||||
|
stopPayload.put("code", "yuntai");
|
||||||
|
stopPayload.put("messageID", messageID);
|
||||||
|
stopPayload.put("value", "09");
|
||||||
|
stopPayload.put("timestamp", System.currentTimeMillis());
|
||||||
|
stopPayload.put("desc", "云台停止");
|
||||||
|
context.getMqttClient().sendMessage(topic, stopPayload.toJSONString());
|
||||||
|
log.info("云台停止指令发送成功: topic={}, payload={}", topic, stopPayload.toJSONString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CallbackConfig getMethodCallbackConfig(InstructionContext context) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CallbackConfig getStateCallbackConfig(InstructionContext context) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getTimeoutMs() {
|
||||||
|
return 3000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
package com.ruoyi.device.domain.impl.machine.vendor.tuoheng.instruction;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.AbstractInstruction;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.CallbackConfig;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.InstructionContext;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class TuohengGimbalResetInstruction extends AbstractInstruction {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "TUOHENG_GIMBAL_RESET";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executeRemoteCall(InstructionContext context) throws Exception {
|
||||||
|
String sn = context.getSn();
|
||||||
|
log.info("发送拓恒云台复位指令: sn={}", sn);
|
||||||
|
|
||||||
|
JSONObject payload = new JSONObject();
|
||||||
|
payload.put("code", "yuntai");
|
||||||
|
payload.put("value", "10");
|
||||||
|
payload.put("messageID", context.getCommandParam("messageID", Long.class) != null ? context.getCommandParam("messageID") : System.currentTimeMillis());
|
||||||
|
payload.put("timestamp", System.currentTimeMillis());
|
||||||
|
payload.put("desc", "云台复位");
|
||||||
|
|
||||||
|
String topic = "/topic/v1/airportDrone/" + sn + "/control";
|
||||||
|
context.getMqttClient().sendMessage(topic, payload.toJSONString());
|
||||||
|
log.info("云台复位指令发送成功: topic={}, payload={}", topic, payload.toJSONString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CallbackConfig getMethodCallbackConfig(InstructionContext context) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CallbackConfig getStateCallbackConfig(InstructionContext context) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getTimeoutMs() {
|
||||||
|
return 5000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.ruoyi.device.domain.impl.machine.vendor.tuoheng.instruction;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.AbstractInstruction;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.CallbackConfig;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.InstructionContext;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class TuohengGimbalZoomInstruction extends AbstractInstruction {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "TUOHENG_GIMBAL_ZOOM";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executeRemoteCall(InstructionContext context) throws Exception {
|
||||||
|
String sn = context.getSn();
|
||||||
|
log.info("发送拓恒云台变焦指令: sn={}", sn);
|
||||||
|
|
||||||
|
JSONObject payload = new JSONObject();
|
||||||
|
payload.put("lightMode", "visibleLight");
|
||||||
|
payload.put("code", "yuntai");
|
||||||
|
payload.put("messageID", context.getCommandParam("messageID", Long.class) != null ? context.getCommandParam("messageID") : System.currentTimeMillis());
|
||||||
|
payload.put("evalue", context.getCommandParam("evalue") != null ? context.getCommandParam("evalue") : "3");
|
||||||
|
payload.put("value", context.getCommandParam("value") != null ? context.getCommandParam("value") : "30");
|
||||||
|
payload.put("timestamp", System.currentTimeMillis());
|
||||||
|
payload.put("desc", "云台变焦");
|
||||||
|
|
||||||
|
String topic = "/topic/v1/airportDrone/" + sn + "/control";
|
||||||
|
context.getMqttClient().sendMessage(topic, payload.toJSONString());
|
||||||
|
log.info("云台变焦指令发送成功: topic={}, payload={}", topic, payload.toJSONString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CallbackConfig getMethodCallbackConfig(InstructionContext context) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CallbackConfig getStateCallbackConfig(InstructionContext context) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getTimeoutMs() {
|
||||||
|
return 5000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
package com.ruoyi.device.domain.impl.machine.vendor.tuoheng.instruction;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.AbstractInstruction;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.CallbackConfig;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.InstructionContext;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class TuohengSwitchIRInstruction extends AbstractInstruction {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "TUOHENG_SWITCH_IR";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executeRemoteCall(InstructionContext context) throws Exception {
|
||||||
|
String sn = context.getSn();
|
||||||
|
log.info("发送拓恒切换红外指令: sn={}", sn);
|
||||||
|
|
||||||
|
JSONObject payload = new JSONObject();
|
||||||
|
payload.put("code", "yuntai");
|
||||||
|
payload.put("value", "22");
|
||||||
|
payload.put("messageID", context.getCommandParam("messageID", Long.class) != null ? context.getCommandParam("messageID") : System.currentTimeMillis());
|
||||||
|
payload.put("timestamp", System.currentTimeMillis());
|
||||||
|
payload.put("desc", "红外");
|
||||||
|
|
||||||
|
String topic = "/topic/v1/airportDrone/" + sn + "/control";
|
||||||
|
context.getMqttClient().sendMessage(topic, payload.toJSONString());
|
||||||
|
log.info("切换红外指令发送成功: topic={}, payload={}", topic, payload.toJSONString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CallbackConfig getMethodCallbackConfig(InstructionContext context) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CallbackConfig getStateCallbackConfig(InstructionContext context) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getTimeoutMs() {
|
||||||
|
return 5000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
package com.ruoyi.device.domain.impl.machine.vendor.tuoheng.instruction;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.AbstractInstruction;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.CallbackConfig;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.InstructionContext;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class TuohengSwitchVisibleLightInstruction extends AbstractInstruction {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "TUOHENG_SWITCH_VISIBLE_LIGHT";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executeRemoteCall(InstructionContext context) throws Exception {
|
||||||
|
String sn = context.getSn();
|
||||||
|
log.info("发送拓恒切换可见光指令: sn={}", sn);
|
||||||
|
|
||||||
|
JSONObject payload = new JSONObject();
|
||||||
|
payload.put("code", "yuntai");
|
||||||
|
payload.put("value", "21");
|
||||||
|
payload.put("messageID", context.getCommandParam("messageID", Long.class) != null ? context.getCommandParam("messageID") : System.currentTimeMillis());
|
||||||
|
payload.put("timestamp", System.currentTimeMillis());
|
||||||
|
payload.put("desc", "可见光");
|
||||||
|
|
||||||
|
String topic = "/topic/v1/airportDrone/" + sn + "/control";
|
||||||
|
context.getMqttClient().sendMessage(topic, payload.toJSONString());
|
||||||
|
log.info("切换可见光指令发送成功: topic={}, payload={}", topic, payload.toJSONString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CallbackConfig getMethodCallbackConfig(InstructionContext context) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CallbackConfig getStateCallbackConfig(InstructionContext context) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getTimeoutMs() {
|
||||||
|
return 5000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
package com.ruoyi.device.domain.impl.machine.vendor.tuoheng.instruction;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.AbstractInstruction;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.CallbackConfig;
|
||||||
|
import com.ruoyi.device.domain.impl.machine.instruction.InstructionContext;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class TuohengSwitchWideAngleInstruction extends AbstractInstruction {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "TUOHENG_SWITCH_WIDE_ANGLE";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executeRemoteCall(InstructionContext context) throws Exception {
|
||||||
|
String sn = context.getSn();
|
||||||
|
log.info("发送拓恒切换广角指令: sn={}", sn);
|
||||||
|
|
||||||
|
JSONObject payload = new JSONObject();
|
||||||
|
payload.put("code", "yuntai");
|
||||||
|
payload.put("value", "23");
|
||||||
|
payload.put("messageID", context.getCommandParam("messageID", Long.class) != null ? context.getCommandParam("messageID") : System.currentTimeMillis());
|
||||||
|
payload.put("timestamp", System.currentTimeMillis());
|
||||||
|
payload.put("desc", "广角");
|
||||||
|
|
||||||
|
String topic = "/topic/v1/airportDrone/" + sn + "/control";
|
||||||
|
context.getMqttClient().sendMessage(topic, payload.toJSONString());
|
||||||
|
log.info("切换广角指令发送成功: topic={}, payload={}", topic, payload.toJSONString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CallbackConfig getMethodCallbackConfig(InstructionContext context) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CallbackConfig getStateCallbackConfig(InstructionContext context) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getTimeoutMs() {
|
||||||
|
return 5000;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue