diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index e7a8fa7..31d28d2 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,7 +4,26 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -23,28 +42,30 @@
+
- {
+ "keyToString": {
+ "RequestMappingsPanelOrder0": "0",
+ "RequestMappingsPanelOrder1": "1",
+ "RequestMappingsPanelWidth0": "75",
+ "RequestMappingsPanelWidth1": "75",
+ "RunOnceActivity.OpenProjectViewOnStart": "true",
+ "RunOnceActivity.ShowReadmeOnStart": "true",
+ "WebServerToolWindowFactoryState": "false",
+ "last_opened_file_path": "D:/code/dji_demo",
+ "node.js.detected.package.eslint": "true",
+ "node.js.detected.package.tslint": "true",
+ "node.js.selected.package.eslint": "(autodetect)",
+ "node.js.selected.package.tslint": "(autodetect)",
+ "settings.editor.selected.configurable": "MavenSettings",
+ "spring.configuration.checksum": "4f45992762eb36378bf6bd0fb0b9c291",
+ "vue.rearranger.settings.migration": "true"
}
-}]]>
+}
@@ -52,8 +73,26 @@
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -74,6 +113,11 @@
+
+
+
+
+
@@ -84,6 +128,82 @@
1745457734060
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -99,8 +219,115 @@
+
+
+
+
+
+
+
+ file://$PROJECT_DIR$/src/main/java/com/example/math/controller/OperateController.java
+ 1199
+
+
+
+ file://$PROJECT_DIR$/src/main/java/com/example/math/controller/OperateController.java
+ 1213
+
+
+
+ file://$PROJECT_DIR$/src/main/java/com/example/math/mqtt/consumer/MqttConsumerCallBack.java
+ 344
+
+
+
+ file://$PROJECT_DIR$/src/main/java/com/example/math/mqtt/consumer/MqttConsumerCallBack.java
+ 352
+
+
+
+ file://$PROJECT_DIR$/src/main/java/com/example/math/mqtt/consumer/MqttConsumerCallBack.java
+ 220
+
+
+
+ file://$PROJECT_DIR$/src/main/java/com/example/math/mqtt/consumer/MqttConsumerCallBack.java
+ 225
+
+
+
+ file://$PROJECT_DIR$/src/main/java/com/example/math/mqtt/consumer/MqttConsumerCallBack.java
+ 222
+
+
+
+ file://$PROJECT_DIR$/src/main/java/com/example/math/controller/OperateController.java
+ 1625
+
+
+
+ file://$PROJECT_DIR$/src/main/java/com/example/math/controller/OperateController.java
+ 1553
+
+
+
+ file://$PROJECT_DIR$/src/main/java/com/example/math/controller/OperateController.java
+ 1627
+
+
+
+ file://$PROJECT_DIR$/src/main/java/com/example/math/controller/OperateController.java
+ 1515
+
+
+
+ file://$PROJECT_DIR$/src/main/java/com/example/math/controller/OperateController.java
+ 1539
+
+
+
+ file://$PROJECT_DIR$/src/main/java/com/example/math/controller/OperateController.java
+ 1730
+
+
+
+ file://$PROJECT_DIR$/src/main/java/com/example/math/controller/OperateController.java
+ 1733
+
+
+
+ file://$PROJECT_DIR$/src/main/java/com/example/math/mqtt/consumer/MqttConsumerCallBack.java
+ 244
+
+
+
+ file://$PROJECT_DIR$/src/main/java/com/example/math/mqtt/consumer/MqttConsumerCallBack.java
+ 1284
+
+
+
+ file://$PROJECT_DIR$/src/main/java/com/example/math/mqtt/consumer/MqttConsumerCallBack.java
+ 241
+
+
+
+ file://$PROJECT_DIR$/src/main/java/com/example/math/mqtt/consumer/MqttConsumerCallBack.java
+ 273
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/com/example/math/constants/CommonConstants.java b/src/main/java/com/example/math/constants/CommonConstants.java
index 7815df1..5a98c32 100644
--- a/src/main/java/com/example/math/constants/CommonConstants.java
+++ b/src/main/java/com/example/math/constants/CommonConstants.java
@@ -11,4 +11,45 @@ public class CommonConstants {
* 无人机异步飞行
*/
public static final String ASYNFLY = "asynFly";
+
+ /**
+ * 喊话次数(对应租户 唯一)
+ */
+ public static final String SHOUT_NUM = "shoutNum";
+
+ /**
+ * 喊话标识,1代表喊话中,null代表无喊话(实时)
+ */
+ public static final String SHOUT_FLAG = "shoutFlag";
+
+ /**
+ * 最近一次某个喊话器的喊话类型 1:停止 2:暂停 3:恢复
+ */
+ public static final String SHOUT_TYPE = "shoutType";
+
+ /**
+ * 喊话,点击暂停时间戳
+ */
+ public static final String SHOUT_PAUSE_TIME = "shoutPauseTime";
+
+ /**
+ * 喊话,点击恢复时间戳
+ */
+ public static final String SHOUT_RESUME_TIME = "shoutResumeTime";
+
+ /**
+ * 喊话,某一次喊话开始时间戳
+ */
+ public static final String SHOUT_START_TIME = "shoutStartTime";
+
+ /**
+ * 一键起飞事件通知 redis的key值
+ */
+ public static final String TAKE_OFF_TO_POINT_PROGRESS = "takeoffToPointProgress";
+
+ /**
+ * flyto 执行结果事件通知 redis的key值
+ */
+ public static final String FLY_TOPOINT_PROGRESS = "flyToPointProgress";
+
}
diff --git a/src/main/java/com/example/math/constants/DJICommonConstants.java b/src/main/java/com/example/math/constants/DJICommonConstants.java
new file mode 100644
index 0000000..ca3d726
--- /dev/null
+++ b/src/main/java/com/example/math/constants/DJICommonConstants.java
@@ -0,0 +1,83 @@
+package com.example.math.constants;
+
+/**
+ * @Author: 吴彬
+ * @CreateTime: 2023-08-07 16:11
+ * @Description: 公共常量
+ * @Version: 1.0
+ */
+public class DJICommonConstants {
+
+ /**
+ * 直播方法
+ */
+ public static final String NTP_SERVER_HOST = "Google.mzr.me";
+
+ /**
+ * events 飞行任务时间
+ */
+ public static final String APP_ID = "148774";
+
+ /**
+ * 大疆机场关于 组织 设备绑定码校验回复
+ */
+ public static final String APP_KEY = "a3ba3e9934f43b82bd52428b26e695b";
+
+ /**
+ * 大疆机场关于 组织 设备绑定码校验回复 二次握手??
+ */
+ public static final String APP_LICENSE = "Cm+BDccW/auc1L5Fixy59JrudnnXxguksAfGNPRjaDDqf3ESlHJt4JYaYBlXJ/rkkSPREF/MIg5FZV3MSwPVcXQ2ioOahFH0OEHx0fhxLnrS2uUVXaXcDkDxLRfDuOTvkmojS3KFZIgPOjt6hdF9Madi/WC+EsnZzpA5RvTD/u4=";
+
+ /**
+ * 下发任务后的二次航线获取
+ */
+ public static final Integer EXPIRE = 3600;
+
+ /**
+ * 下发任务后的二次航线获取
+ */
+ public static final String BUCKET = "dji-dev";
+
+ /**
+ * 下发任务后的二次航线获取
+ */
+ public static final String ENDPOINT = "https://oss-cn-shanghai.aliyuncs.com";
+
+ /**
+ * 下发任务后的二次航线获取
+ */
+ public static final String OBJECT_KEY_PREFIX = "hyslj";
+
+ /**
+ * 下发任务后的二次航线获取
+ */
+ public static final String PROVIDER = "ali";
+
+ /**
+ * 下发任务后的二次航线获取
+ */
+ public static final String REGION = "sh";
+
+ /**
+ * 是设备绑定组织
+ */
+ public static final Boolean IS_DEVICE_BIND_ORGANIZATION = true;
+
+ /**
+ * 大疆组织id 和机器输入的一致
+ */
+ public static final String ORGANIZATION_ID = "w";
+
+ /**
+ * 默认即可
+ */
+ public static final String ORGANIZATION_NAME = "Test Group One";
+
+
+ /**
+ * DJI 大疆前缀
+ */
+ public static final String DJI = "DJI";
+
+
+}
diff --git a/src/main/java/com/example/math/constants/DJIMethonConstants.java b/src/main/java/com/example/math/constants/DJIMethonConstants.java
index 333365e..5bce786 100644
--- a/src/main/java/com/example/math/constants/DJIMethonConstants.java
+++ b/src/main/java/com/example/math/constants/DJIMethonConstants.java
@@ -8,16 +8,81 @@ package com.example.math.constants;
*/
public class DJIMethonConstants {
+ /**
+ * 开启调试模式
+ */
+ public static final String DEBUG_MODE_OPEN = "debug_mode_open";
+
+ /**
+ * 关闭调试模式
+ */
+ public static final String DEBUG_MODE_CLOSE = "debug_mode_close";
+
+ /**
+ * 开机
+ */
+ public static final String DRONE_OPEN = "drone_open";
+
+ /**
+ * 关机
+ */
+ public static final String DRONE_CLOSE = "drone_close";
+
+ /**
+ * 机场重启
+ */
+ public static final String DEVICE_REBOOT = "device_reboot";
+
+ /**
+ * 空调模式切换
+ */
+ public static final String AIR_CONDITIONER_MODE_SWITCH = "air_conditioner_mode_switch";
+
+ /**
+ * 镜头点击转动
+ */
+ public static final String CAMERA_AIM = "camera_aim";
+
+ /**
+ * 开舱
+ */
+ public static final String COVER_OPEN = "cover_open";
+
+ /**
+ * 强制关舱盖
+ */
+ public static final String COVER_FORCE_CLOSE = "cover_force_close";
+
+ /**
+ * 回舱
+ */
+ public static final String COVER_CLOSE = "cover_close";
+
/**
* 直播方法
*/
public static final String LIVE_START_PUSH = "live_start_push";
/**
- * events 飞行任务时间
+ * 关闭直播
+ */
+ public static final String LIVE_STOP_PUSH = "live_stop_push";
+
+ /**
+ * events 飞行任务
*/
public static final String FLIGHTTASK_PROGRESS = "flighttask_progress";
+ /**
+ * events 告警事件
+ */
+ public static final String HMS = "hms";
+
+ /**
+ * events 飞行任务时间
+ */
+ public static final String drc_status_notify = "drc_status_notify";
+
/**
* 大疆机场关于 组织 设备绑定码校验回复
*/
@@ -29,13 +94,19 @@ public class DJIMethonConstants {
public static final String AIRPORT_ORGANIZATION_GET = "airport_organization_get";
/**
- * 机场建立连接???
+ * 设备绑定到组织????????
*/
public static final String AIRPORT_ORGANIZATION_BIND = "airport_organization_bind";
/**
* 与阿里云建立连接
*/
+ public static final String CONFIG = "config";
+
+
+ /**
+ * 与阿里云建立连接 ?????????
+ */
public static final String STORAGE_CONFIG_GET = "storage_config_get";
/**
@@ -44,29 +115,9 @@ public class DJIMethonConstants {
public static final String FLIGHTTASK_RESOURCE_GET = "flighttask_resource_get";
/**
- * 一键起飞
+ * 设备拓扑更新 请求设备上线
*/
- public static final String TAKEOFF_TO_POINT = "takeoff_to_point";
-
- /**
- * 飞行控制权抢夺
- */
- public static final String FLIGHT_AUTHORITY_GRAB = "flight_authority_grab";
-
- /**
- * 负载控制权抢夺
- */
- public static final String PAYLOAD_AUTHORITY_GRAB = "payload_authority_grab";
-
- /**
- * 进入指令飞行控制模式
- */
- public static final String DRC_MODE_ENTER = "drc_mode_enter";
-
- /**
- * 退出指令飞行控制模式
- */
- public static final String DRC_MODE_EXIT = "drc_mode_exit";
+ public static final String UPDATE_TODO = "update_topo";
/**
* 负载控制—切换相机模式
@@ -108,11 +159,25 @@ public class DJIMethonConstants {
*/
public static final String DRONE_EMERGENCY_STOP = "drone_emergency_stop";
+ /**
+ * DRC-杆量控制
+ */
+ public static final String STICK_CONTROL = "stick_control";
+
/**
* DRC-飞行控制
*/
public static final String DRONE_CONTROL = "drone_control";
+ /**
+ * 下发任务
+ */
+ public static final String FLIGHTTASK_PREPARE = "flighttask_prepare";
+
+ /**
+ * 执行任务
+ */
+ public static final String FLIGHTTASK_EXECUTE = "flighttask_execute";
/**
* 航线暂停
@@ -134,21 +199,36 @@ public class DJIMethonConstants {
*/
public static final String LIVE_LENS_CHANGE = "live_lens_change";
+ /**
+ * 仓内外镜头切换
+ */
+ public static final String LIVE_CAMERA_CHANGE = "live_camera_change";
+
/**
* 一键返航
*/
public static final String RETURN_HOME = "return_home";
/**
- * 取消任务
+ * 一键起飞
*/
- public static final String FLIGHTTASK_UNDO = "flighttask_undo";
+ public static final String TAKEOFF_TO_POINT = "takeoff_to_point";
/**
* 指点飞行
*/
public static final String FLY_TO_POINT = "fly_to_point";
+ /**
+ * 指点飞行结果
+ */
+ public static final String FLY_TO_POINT_PROGRESS = "fly_to_point_progress";
+
+ /**
+ * 一键起飞结果事件通知
+ */
+ public static final String TAKEOFF_TO_POINT_PROGRESS = "takeoff_to_point_progress";
+
/**
* 结束 flyto 飞向目标点任务
*/
@@ -159,4 +239,102 @@ public class DJIMethonConstants {
*/
public static final String FLY_TO_POINT_UPDATE = "fly_to_point_update";
+
+ /**
+ * 取消任务
+ */
+ public static final String FLIGHTTASK_UNDO = "flighttask_undo";
+
+
+
+ /**
+ * 开启补光灯
+ */
+ public static final String SUPPLEMENT_LIGHT_OPEN = "supplement_light_open";
+
+ /**
+ * 关闭补光灯
+ */
+ public static final String SUPPLEMENT_LIGHT_CLOSE = "supplement_light_close";
+
+ /**
+ * 浮窗文本推送
+ */
+ public static final String PSDK_FLOATING_WINDOW_TEXT = "psdk_floating_window_text";
+
+ /**
+ * 发送文本框内容
+ */
+ public static final String PSDK_INPUT_BOX_TEXT_SET = "psdk_input_box_text_set";
+
+ /**
+ * 设置单元控件
+ */
+ public static final String PSDK_WIDGET_VALUE_SET = "psdk_widget_value_set";
+
+ /**
+ * 设置单元控件
+ */
+ public static final String SPEAKER_PLAY_STOP = "speaker_play_stop";
+
+ /**
+ * 设置播放模式
+ */
+ public static final String SPEAKER_PLAY_MODE_SET = "speaker_play_mode_set";
+
+ /**
+ * 设置播放音量
+ */
+ public static final String SPEAKER_PLAY_VOLUME_SET = "speaker_play_volume_set";
+
+ /**
+ * tts文本播放
+ */
+ public static final String SPEAKER_TTS_PLAY_START = "speaker_tts_play_start";
+
+ /**
+ * 音频播放
+ */
+ public static final String SPEAKER_AUDIO_PLAY_START = "speaker_audio_play_start";
+
+ /**
+ * 飞行控制权抢夺
+ */
+ public static final String FLIGHT_AUTHORITY_GRAB = "flight_authority_grab";
+
+ /**
+ * 负载控制权抢夺
+ */
+ public static final String PAYLOAD_AUTHORITY_GRAB = "payload_authority_grab";
+
+ /**
+ * 进入指令飞行控制模式
+ */
+ public static final String DRC_MODE_ENTER = "drc_mode_enter";
+
+ /**
+ * 指令飞行控制模式 状态
+ */
+ public static final String DRC_STATUS = "drc_status";
+
+ /**
+ * DRC心跳包
+ */
+ public static final String HEART_BEAT = "heart_beat";
+
+ /**
+ * 退出指令飞行控制模式
+ */
+ public static final String DRC_MODE_EXIT = "drc_mode_exit";
+
+ /**
+ * events 返航信息
+ */
+ public static final String RETURN_HOME_INFO = "return_home_info";
+
+ /**
+ * 切换直播清晰度
+ */
+ public static final String LIVE_SET_QUALITY = "live_set_quality";
+
}
diff --git a/src/main/java/com/example/math/controller/OperateController.java b/src/main/java/com/example/math/controller/OperateController.java
index f94617f..a7298fd 100644
--- a/src/main/java/com/example/math/controller/OperateController.java
+++ b/src/main/java/com/example/math/controller/OperateController.java
@@ -3,6 +3,12 @@ package com.example.math.controller;
import com.alibaba.fastjson2.JSONObject;
+import com.aliyun.sts20150401.Client;
+import com.aliyun.sts20150401.models.AssumeRoleRequest;
+import com.aliyun.sts20150401.models.AssumeRoleResponse;
+import com.aliyun.tea.TeaException;
+import com.aliyun.teautil.models.RuntimeOptions;
+import com.example.math.constants.DJICommonConstants;
import com.example.math.constants.DJIMethonConstants;
import com.example.math.entity.dto.BreakPoint;
import com.example.math.entity.dto.ExecutableConditions;
@@ -13,20 +19,22 @@ import com.example.math.entity.dto.SimulateMission;
import com.example.math.mqtt.MqttConfig;
import com.example.math.mqtt.SpringUtil;
//import com.example.math.task.FirstTask;
+import com.example.math.mqtt.consumer.MqttConsumerCallBack;
+import com.example.math.task.FirstTask;
import com.example.math.utils.RedisUtils;
import com.example.math.utils.SslUtils;
+import lombok.extern.slf4j.Slf4j;
import org.apache.commons.compress.archivers.ArchiveEntry;
import org.apache.commons.compress.archivers.ArchiveInputStream;
import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream;
+import org.apache.commons.lang3.ThreadUtils;
import org.eclipse.paho.client.mqttv3.MqttDeliveryToken;
+import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.util.CollectionUtils;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.BufferedReader;
@@ -41,12 +49,11 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.sql.Date;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.UUID;
+import java.time.Instant;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
/**
@@ -75,10 +82,25 @@ import java.util.UUID;
*
* live_stop_push
* http://localhost:9999/operate/live_stop_push?one=7CTDM7H00B5EM1&two=165-0-7&three=normal-0
+ *
* http://localhost:9999/operate/live_stop_push?one=1581F6Q8D248900G5PYE&two=81-0-0&three=normal-0
*
* http://localhost:9999/operate/live_lens_change?video_type=normal
*
+ * 控制模式
+ * http://localhost:9999/operate/flightAuthorityGrab
+ *
+ * http://localhost:9999/operate/payloadAuthorityGrab
+ *
+ * http://localhost:9999/operate/drcModeEnter
+ *
+ * http://localhost:9999/operate/droneEmergencyStop
+ *
+ * http://localhost:9999/operate/stickControl?roll=1024&pitch=1024&throttle=1024&yaw=1024&gimbal_pitch=1024
+ *Integer roll, Integer pitch, Integer throttle, Integer yaw, Integer gimbal_pitch
+ *
+ *
+ *
*
* * @param airPortSn 机场sn号
* * @param airPortSn 速度 String maxsSpeed
@@ -98,6 +120,7 @@ import java.util.UUID;
*/
@RequestMapping(path="/operate")
@Controller
+@Slf4j
public class OperateController {
@@ -112,7 +135,7 @@ public class OperateController {
qos = 2;
}
if(retained == null){
- retained = true;
+ retained = false;
}
if(topic == null){
topic = "firsttest";
@@ -145,7 +168,7 @@ public class OperateController {
qos = 2;
}
if(retained == null){
- retained = true;
+ retained = false;
}
if(topic == null){
topic = "thing/product/7CTDM7H00B5EM1/services";
@@ -187,7 +210,7 @@ public class OperateController {
qos = 2;
}
if(retained == null){
- retained = true;
+ retained = false;
}
if(topic == null){
topic = "thing/product/7CTDM7H00B5EM1/services";
@@ -230,7 +253,7 @@ public class OperateController {
qos = 2;
}
if(retained == null){
- retained = true;
+ retained = false;
}
if(topic == null){
topic = "thing/product/7CTDM7H00B5EM1/services";
@@ -272,7 +295,7 @@ public class OperateController {
qos = 2;
}
if(retained == null){
- retained = true;
+ retained = false;
}
if(topic == null){
topic = "thing/product/7CTDM7H00B5EM1/services";
@@ -315,7 +338,7 @@ public class OperateController {
qos = 2;
}
if(retained == null){
- retained = true;
+ retained = false;
}
if(topic == null){
topic = "thing/product/7CTDM7H00B5EM1/services";
@@ -359,7 +382,7 @@ public class OperateController {
qos = 2;
}
if(retained == null){
- retained = true;
+ retained = false;
}
if(topic == null){
topic = "thing/product/7CTDM7H00B5EM1/services";
@@ -395,7 +418,7 @@ public class OperateController {
qos = 2;
}
if(retained == null){
- retained = true;
+ retained = false;
}
if(topic == null){
topic = "thing/product/7CTDM7H00BXZD1/services";
@@ -437,7 +460,7 @@ public class OperateController {
qos = 2;
}
if(retained == null){
- retained = true;
+ retained = false;
}
if(topic == null){
topic = "thing/product/7CTDM7H00B5EM1/services";
@@ -531,7 +554,7 @@ public class OperateController {
qos = 2;
}
if(retained == null){
- retained = true;
+ retained = false;
}
if(topic == null){
topic = "thing/product/7CTDM7H00B5EM1/services";
@@ -582,7 +605,7 @@ public class OperateController {
qos = 2;
}
if(retained == null){
- retained = true;
+ retained = false;
}
if(topic == null){
topic = "thing/product/7CTDM7H00B5EM1/services";
@@ -621,7 +644,7 @@ public class OperateController {
qos = 2;
}
if(retained == null){
- retained = true;
+ retained = false;
}
if(topic == null){
topic = "thing/product/7CTXM9Q00B02H2/services";
@@ -660,7 +683,7 @@ public class OperateController {
qos = 2;
}
if(retained == null){
- retained = true;
+ retained = false;
}
if(topic == null){
topic = "thing/product/7CTDM7H00B5EM1/services";
@@ -704,7 +727,7 @@ public class OperateController {
qos = 2;
}
if(retained == null){
- retained = true;
+ retained = false;
}
if(topic == null){
topic = "thing/product/7CTDM7H00B5EM1/services";
@@ -748,7 +771,7 @@ public class OperateController {
qos = 2;
}
if(retained == null){
- retained = true;
+ retained = false;
}
if(topic == null){
topic = "thing/product/7CTDM7H00B5EM1/services";
@@ -788,7 +811,7 @@ public class OperateController {
qos = 2;
}
if(retained == null){
- retained = true;
+ retained = false;
}
if(topic == null){
topic = "thing/product/7CTDM7H00B5EM1/services";
@@ -831,7 +854,7 @@ public class OperateController {
qos = 2;
}
if(retained == null){
- retained = true;
+ retained = false;
}
if(topic == null){
topic = "thing/product/7CTDM7H00B5EM1/services";
@@ -875,7 +898,7 @@ public class OperateController {
qos = 2;
}
if(retained == null){
- retained = true;
+ retained = false;
}
if(topic == null){
topic = "thing/product/7CTDM7H00B5EM1/services";
@@ -923,7 +946,7 @@ public class OperateController {
}
try {
Integer qos = 2;
- Boolean retained = true;
+ Boolean retained = false;
//topic主题 sn是机场sn号 thing/product/%s/services
String topic = String.format(someTopic, airPortSn);
//封装数据
@@ -971,7 +994,7 @@ public class OperateController {
}
@Autowired
- private static String airPortSn = "7CTXMC900B054P";
+ private static String airPortSn = "7CTDM7H00BXZD1";
/**
* 飞行控制权抢夺 /flightAuthorityGrab
@@ -983,7 +1006,7 @@ public class OperateController {
public String flightAuthorityGrab(){
try {
Integer qos = 2;
- Boolean retained = true;
+ Boolean retained = false;
//topic主题 sn是机场sn号 thing/product/%s/services
//TODO 此处用的是无人的SN号 待测试
String topic = String.format(someTopic, airPortSn);
@@ -1014,7 +1037,7 @@ public class OperateController {
public String payloadAuthorityGrab(String cameraIndex){
try {
Integer qos = 2;
- Boolean retained = true;
+ Boolean retained = false;
//topic主题 sn是机场sn号 thing/product/%s/services
//TODO 此处用的是无人的SN号 待测试
String topic = String.format(someTopic, airPortSn);
@@ -1054,9 +1077,37 @@ public class OperateController {
@Value("${spring.mqtt.client.id}")
private String clientId;
+
+
+ /**
+ * DRC心跳
+ * @return JsonResult
+ */
+
+ private static Integer seq = 0;
+
+ @ResponseBody
+ @RequestMapping("/drcOsd")
+ public String drcOsd() throws InterruptedException{
+ if (true){
+ Map content = new HashMap<>();
+ HashMap data = new HashMap<>();
+ data.put("timestamp", System.currentTimeMillis());
+ seq++;
+ content.put("method", "heart_beat");
+ content.put("data", data);
+ content.put("seq", 0);
+ String message = com.alibaba.fastjson.JSONObject.toJSONString(content);
+ Thread.sleep(2000L);
+ MqttDeliveryToken publish = providerClient.publish(1, false, "thing/product/8UUXN3500A02BE/drc/down", message);
+ }
+ return "发送成功";
+ }
+
+
+
/**
* 进入指令飞行控制模式
- * @param airPortSn 机场sn号
* @return JsonResult
*/
@ResponseBody
@@ -1065,7 +1116,7 @@ public class OperateController {
try {
Integer qos = 1;
- Boolean retained = true;
+ Boolean retained = false;
//topic主题 sn是机场sn号 thing/product/%s/services
//TODO 此处用的是无人的SN号 待测试
String topic = String.format(someTopic, airPortSn);
@@ -1073,7 +1124,7 @@ public class OperateController {
Map content = new HashMap<>();
Map data = new HashMap<>();
//负载枚举值 镜头负载
- data.put("hsi_frequency", 20);
+ data.put("hsi_frequency", 1);
//Broker 连接信息
Map mqttBroker = new HashMap<>();
@@ -1091,7 +1142,7 @@ public class OperateController {
mqttBroker.put("username", username);
data.put("mqtt_broker", mqttBroker);
//设置 OSD 上报频率 {"max":30,"min":1,"unit_name":"赫兹 / Hz"}
- data.put("osd_frequency", 20);
+ data.put("osd_frequency", 1);
content.put("tid", UUID.randomUUID().toString());
content.put("bid", UUID.randomUUID().toString());
@@ -1099,6 +1150,40 @@ public class OperateController {
content.put("method", DJIMethonConstants.DRC_MODE_ENTER);
content.put("data", data);
String message = com.alibaba.fastjson.JSONObject.toJSONString(content);
+ System.out.println(topic);
+ System.out.println(message);
+ MqttDeliveryToken publish = providerClient.publish(qos, retained, topic, message);
+ return "发送成功";
+ } catch (Exception e) {
+ e.printStackTrace();
+ return "发送失败";
+ }
+ }
+
+
+ /**
+ * 退出指令飞行控制模式
+ * @return JsonResult
+ */
+ @ResponseBody
+ @RequestMapping("/drcModeExit")
+ public String drcModeExit(){
+ try {
+ Integer qos = 1;
+ Boolean retained = false;
+ //topic主题 sn是机场sn号 thing/product/%s/services
+ //TODO 此处用的是无人的SN号 待测试
+ String topic = String.format(someTopic, airPortSn);
+ //封装数据
+ Map content = new HashMap<>();
+ Map data = new HashMap<>();
+ content.put("tid", UUID.randomUUID().toString());
+ content.put("bid", UUID.randomUUID().toString());
+ content.put("timestamp",System.currentTimeMillis());
+ content.put("method", DJIMethonConstants.DRC_MODE_EXIT);
+ content.put("data", data);
+ String message = com.alibaba.fastjson.JSONObject.toJSONString(content);
+ System.out.println(topic);
System.out.println(message);
MqttDeliveryToken publish = providerClient.publish(qos, retained, topic, message);
return "发送成功";
@@ -1110,10 +1195,10 @@ public class OperateController {
@RequestMapping("/droneEmergencyStop")
- public String droneEmergencyStop(String airPortSn){
+ public String droneEmergencyStop(){
try {
Integer qos = 2;
- Boolean retained = true;
+ Boolean retained = false;
//topic主题 sn是机场sn号 thing/product/%s/services
//TODO 此处用的是无人的SN号 待测试
String topic = String.format("thing/product/%s/drc/down", airPortSn);
@@ -1123,6 +1208,7 @@ public class OperateController {
content.put("method", DJIMethonConstants.DRONE_EMERGENCY_STOP);
content.put("data", data);
String message = com.alibaba.fastjson.JSONObject.toJSONString(content);
+ System.out.println(topic);
System.out.println(message);
MqttDeliveryToken publish = providerClient.publish(qos, retained, topic, message);
return "发送成功";
@@ -1133,6 +1219,53 @@ public class OperateController {
}
+
+
+ @RequestMapping("/stickControl")
+ public String stickControl(Integer roll, Integer pitch, Integer throttle, Integer yaw, Integer gimbal_pitch){
+ Integer seq = 1;
+// for (int i = 0; i < 10; i++) {
+ if (!roll.equals(0)){
+ roll += 20;
+ }
+ if (!pitch.equals(0)){
+ pitch += 20;
+ }
+ if (!throttle.equals(0)){
+ throttle += 20;
+ }
+ if (!yaw.equals(0)){
+ yaw += 20;
+ }
+ if (!gimbal_pitch.equals(0)){
+ gimbal_pitch += 20;
+ }
+ seq = seq + 1;
+ Integer qos = 2;
+ Boolean retained = false;
+ //topic主题 sn是机场sn号
+ //TODO 此处用的是无人的SN号 待测试
+ String topic = String.format("thing/product/%s/drc/down", airPortSn);
+ //封装数据
+ Map content = new HashMap<>();
+ Map data = new HashMap<>();
+ data.put("roll", roll);
+ data.put("pitch", pitch);
+ data.put("throttle", throttle);
+ data.put("yaw", yaw);
+ data.put("gimbal_pitch", gimbal_pitch);
+ content.put("method", "stick_control");
+ content.put("seq", seq);
+ content.put("data", data);
+ String message = com.alibaba.fastjson.JSONObject.toJSONString(content);
+ System.out.println(message);
+ MqttDeliveryToken publish = providerClient.publish(qos, retained, topic, message);
+
+// }
+ return "";
+ }
+
+
/**
* @param sn 机场sn号
* @param flightId 任务id
@@ -1144,7 +1277,7 @@ public class OperateController {
try {
//sn = "7CTDM7H00B5EM1";
Integer qos = 2;
- Boolean retained = true;
+ Boolean retained = false;
//topic主题 sn是机场sn号 thing/product/%s/services
String topic = String.format("thing/product/%s/services", sn);
//参数封装
@@ -1183,7 +1316,7 @@ public class OperateController {
public String flyToPoint(String airPortSn, Integer maxsSpeed, Integer height, Double latitude, Double longitude){
try {
Integer qos = 2;
- Boolean retained = true;
+ Boolean retained = false;
//topic主题 sn是机场sn号 thing/product/%s/services
String topic = String.format(someTopic, airPortSn);
Map content = new HashMap<>();
@@ -1230,7 +1363,7 @@ public class OperateController {
public String flyToPointStop(String airPortSn){
try {
Integer qos = 2;
- Boolean retained = true;
+ Boolean retained = false;
//topic主题 sn是机场sn号 thing/product/%s/services
String topic = String.format(someTopic, airPortSn);
Map content = new HashMap<>();
@@ -1265,7 +1398,7 @@ public class OperateController {
public String flyToPointUpdate(String airPortSn, String maxsSpeed, String height, String latitude, String longitude){
try {
Integer qos = 2;
- Boolean retained = true;
+ Boolean retained = false;
//topic主题 sn是机场sn号 thing/product/%s/services
String topic = String.format(someTopic, airPortSn);
Map content = new HashMap<>();
@@ -1370,26 +1503,317 @@ public class OperateController {
}
- public static void main(String[] args) {
- String capacityPercent = "32767.00";
- if(Objects.nonNull(capacityPercent)){
- double v = Double.parseDouble(capacityPercent.toString());
- if (v > 100){
- System.out.printf("++++++"+ capacityPercent);
- }
+ /**
+ * 查询日志列表
+ * @return
+ */
+ @RequestMapping("/fileuploadList")
+ public String fileuploadList(String airPortSn, String module) {
+ try {
+ // 从请求中获取参数,如果没有提供则使用默认值或生成
+
+ // 构建消息内容
+ Map content = new HashMap<>();
+ Map data = new HashMap<>();
+
+ // 构建module_list
+ List moduleList = new ArrayList<>();
+// moduleList.add("0");
+// moduleList.add("3");
+ moduleList.add(module);
+ data.put("module_list", moduleList);
+
+ content.put("bid", UUID.randomUUID().toString());
+ content.put("tid", UUID.randomUUID().toString());
+ content.put("timestamp", System.currentTimeMillis());
+ content.put("method", "fileupload_list");
+ content.put("data", data);
+
+ // 转换为JSON字符串
+ String message = JSONObject.toJSONString(content);
+ System.out.println("发送的消息: " + message);
+
+ // 发布消息
+ String topic = String.format(someTopic, airPortSn);
+ int qos = 1;
+ boolean retained = false;
+ MqttDeliveryToken publish = providerClient.publish(qos, retained, topic, message);
+
+ return "发送成功: " + publish.isComplete();
+ } catch (Exception e) {
+ e.printStackTrace();
+ return "发送失败: " + e.getMessage();
}
}
+ @ResponseBody
+ @RequestMapping("/fileuploadStart")
+ public String fileuploadStart(String airPortSn, String type, Integer[] bootIndices, String module) {
+ try {
+ Integer qos = 1;
+ Boolean retained = false;
+ String topic = String.format(someTopic, airPortSn);
+
+ Map content = new HashMap<>();
+ Map data = new HashMap<>();
+ Map credentials = new HashMap<>();
+ Map params = new HashMap<>();
+ List