From a7aaeabc7873a0eafb4a7ecad7f65b018b7a9bc9 Mon Sep 17 00:00:00 2001
From: sean.zhou <sean.zhou@dji.com>
Date: Fri, 24 Feb 2023 19:31:23 +0800
Subject: [PATCH] What's new? 1. Add license for dock. 2. Modify the logic corresponding to the firmware file and device type. 3. Add multiple mqtt clients options. 4. Modify the structure of the interface for obtaining the device list. 5. Fixed some issues.
---
src/main/java/com/dji/sample/manage/controller/LiveStreamController.java | 38 ++++++++++++--------------------------
1 files changed, 12 insertions(+), 26 deletions(-)
diff --git a/src/main/java/com/dji/sample/manage/controller/LiveStreamController.java b/src/main/java/com/dji/sample/manage/controller/LiveStreamController.java
index ef89f34..c8bd144 100644
--- a/src/main/java/com/dji/sample/manage/controller/LiveStreamController.java
+++ b/src/main/java/com/dji/sample/manage/controller/LiveStreamController.java
@@ -3,23 +3,18 @@
import com.dji.sample.common.model.CustomClaim;
import com.dji.sample.common.model.ResponseResult;
import com.dji.sample.component.mqtt.model.ChannelName;
-import com.dji.sample.component.mqtt.model.CommonTopicReceiver;
-import com.dji.sample.manage.model.Chan;
import com.dji.sample.manage.model.dto.CapacityDeviceDTO;
import com.dji.sample.manage.model.dto.LiveTypeDTO;
-import com.dji.sample.manage.model.receiver.CapacityDeviceReceiver;
-import com.dji.sample.manage.model.receiver.ServiceReplyReceiver;
+import com.dji.sample.manage.model.receiver.LiveCapacityReceiver;
import com.dji.sample.manage.service.ILiveStreamService;
-import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.annotation.ServiceActivator;
-import org.springframework.messaging.Message;
+import org.springframework.messaging.MessageHeaders;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
-import java.io.IOException;
import java.util.List;
import static com.dji.sample.component.AuthInterceptor.TOKEN_CLAIM;
@@ -38,15 +33,17 @@
@Autowired
private ILiveStreamService liveStreamService;
+ @Autowired
+ private ObjectMapper mapper;
+
/**
* Analyze the live streaming capabilities of drones.
* This data is necessary if drones are required for live streaming.
- * @param device the capacity of drone
+ * @param liveCapacity the capacity of drone and dock
*/
@ServiceActivator(inputChannel = ChannelName.INBOUND_STATE_CAPACITY)
- public void stateCapacity(CapacityDeviceReceiver device) {
- boolean parseCapacity = liveStreamService.saveLiveCapacity(device);
- log.debug("The result of parsing the live capacity is {}.", parseCapacity);
+ public void stateCapacity(LiveCapacityReceiver liveCapacity, MessageHeaders headers) {
+ liveStreamService.saveLiveCapacity(liveCapacity, headers.getTimestamp());
}
/**
@@ -94,20 +91,9 @@
return liveStreamService.liveSetQuality(liveParam);
}
- /**
- * Handle the reply message from the pilot side to the on-demand video.
- * @param message reply message
- * @throws IOException
- */
- @ServiceActivator(inputChannel = ChannelName.INBOUND_SERVICE_REPLY)
- public void serviceReply(Message<?> message) throws IOException {
- byte[] payload = (byte[])message.getPayload();
- ObjectMapper mapper = new ObjectMapper();
- CommonTopicReceiver<ServiceReplyReceiver> receiver = mapper.readValue(payload,
- new TypeReference<CommonTopicReceiver<ServiceReplyReceiver>>() {
- });
- Chan<CommonTopicReceiver> chan = Chan.getInstance();
- // Put the message to the chan object.
- chan.put(receiver);
+ @PostMapping("/streams/switch")
+ public ResponseResult liveLensChange(@RequestBody LiveTypeDTO liveParam) {
+ return liveStreamService.liveLensChange(liveParam);
}
+
}
\ No newline at end of file
--
Gitblit v1.9.3