Browse Source

feat: 新增psdk相关api

pull/75/head
Vincent 8 months ago
parent
commit
ea704db785
  1. 10
      cloud-sdk/src/main/java/com/dji/sdk/cloudapi/control/ControlMethodEnum.java
  2. 51
      cloud-sdk/src/main/java/com/dji/sdk/cloudapi/control/PSDKUiResourceUploadResult.java
  3. 29
      cloud-sdk/src/main/java/com/dji/sdk/cloudapi/control/PsdkFloatingWindowText.java
  4. 23
      cloud-sdk/src/main/java/com/dji/sdk/cloudapi/control/PsdkRequest.java
  5. 37
      cloud-sdk/src/main/java/com/dji/sdk/cloudapi/control/SpeakerAudioPlayStartRequest.java
  6. 55
      cloud-sdk/src/main/java/com/dji/sdk/cloudapi/control/SpeakerAudioPlayStartRequestFile.java
  7. 37
      cloud-sdk/src/main/java/com/dji/sdk/cloudapi/control/SpeakerPlayModeSetRequest.java
  8. 29
      cloud-sdk/src/main/java/com/dji/sdk/cloudapi/control/SpeakerPlayProgress.java
  9. 48
      cloud-sdk/src/main/java/com/dji/sdk/cloudapi/control/SpeakerPlayStartProgress.java
  10. 23
      cloud-sdk/src/main/java/com/dji/sdk/cloudapi/control/SpeakerPlayVolumeSetRequest.java
  11. 36
      cloud-sdk/src/main/java/com/dji/sdk/cloudapi/control/SpeakerTTSPlayStartRequest.java
  12. 43
      cloud-sdk/src/main/java/com/dji/sdk/cloudapi/control/SpeakerTTSPlayStartRequestTTS.java
  13. 74
      cloud-sdk/src/main/java/com/dji/sdk/cloudapi/control/api/AbstractControlService.java
  14. 7
      cloud-sdk/src/main/java/com/dji/sdk/mqtt/ChannelName.java
  15. 7
      cloud-sdk/src/main/java/com/dji/sdk/mqtt/events/EventsMethodEnum.java

10
cloud-sdk/src/main/java/com/dji/sdk/cloudapi/control/ControlMethodEnum.java

@ -76,6 +76,16 @@ public enum ControlMethodEnum { @@ -76,6 +76,16 @@ public enum ControlMethodEnum {
POI_CIRCLE_SPEED_SET("poi_circle_speed_set"),
//add by witcom@2024-06-03
SPEAKER_AUDIO_PLAY_START("speaker_audio_play_start"),
SPEAKER_TTS_PLAY_START("speaker_tts_play_start"),
SPEAKER_REPLAY("speaker_replay"),
SPEAKER_PLAY_STOP("speaker_play_stop"),
SPEAKER_PLAY_MODE_SET("speaker_play_mode_set"),
SPEAKER_PLAY_VOLUME_SET("speaker_play_volume_set"),
PSDK_WIDGET_VALUE_SET("psdk_widget_value_set"),
PSDK_INPUT_BOX_TEXT_SET("psdk_input_box_text_set"),
;
private final String method;

51
cloud-sdk/src/main/java/com/dji/sdk/cloudapi/control/PSDKUiResourceUploadResult.java

@ -0,0 +1,51 @@ @@ -0,0 +1,51 @@
/*************************************************
* @copyright 2017 Flision Corporation Inc.
* @author: Vincent Chan @ Canton
* @date: 2024年06月03日
* @version: 1.0.0
* @description:
**************************************************/
package com.dji.sdk.cloudapi.control;
public class PSDKUiResourceUploadResult {
String objectKey;
Integer psdk_index;
Integer result;
Integer size;
public String getObjectKey() {
return objectKey;
}
public void setObjectKey(String objectKey) {
this.objectKey = objectKey;
}
public Integer getPsdk_index() {
return psdk_index;
}
public void setPsdk_index(Integer psdk_index) {
this.psdk_index = psdk_index;
}
public Integer getResult() {
return result;
}
public void setResult(Integer result) {
this.result = result;
}
public Integer getSize() {
return size;
}
public void setSize(Integer size) {
this.size = size;
}
}

29
cloud-sdk/src/main/java/com/dji/sdk/cloudapi/control/PsdkFloatingWindowText.java

@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
/*************************************************
* @copyright 2017 Flision Corporation Inc.
* @author: Vincent Chan @ Canton
* @date: 2024年06月03日
* @version: 1.0.0
* @description:
**************************************************/
package com.dji.sdk.cloudapi.control;
public class PsdkFloatingWindowText {
String value;
Integer psdkIndex;
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public Integer getPsdkIndex() {
return psdkIndex;
}
public void setPsdkIndex(Integer psdkIndex) {
this.psdkIndex = psdkIndex;
}
}

23
cloud-sdk/src/main/java/com/dji/sdk/cloudapi/control/PsdkRequest.java

@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
/*************************************************
* @copyright 2017 Flision Corporation Inc.
* @author: Vincent Chan @ Canton
* @date: 2024年06月03日
* @version: 1.0.0
* @description:
**************************************************/
package com.dji.sdk.cloudapi.control;
import com.dji.sdk.common.BaseModel;
public class PsdkRequest extends BaseModel {
Integer psdkIndex;
public Integer getPsdkIndex() {
return psdkIndex;
}
public void setPsdkIndex(Integer psdkIndex) {
this.psdkIndex = psdkIndex;
}
}

37
cloud-sdk/src/main/java/com/dji/sdk/cloudapi/control/SpeakerAudioPlayStartRequest.java

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
/*************************************************
* @copyright 2017 Flision Corporation Inc.
* @author: Vincent Chan @ Canton
* @date: 2024年06月03日
* @version: 1.0.0
* @description:
**************************************************/
package com.dji.sdk.cloudapi.control;
import com.dji.sdk.common.BaseModel;
import jakarta.validation.constraints.NotNull;
public class SpeakerAudioPlayStartRequest extends BaseModel {
@NotNull
Integer psdkIndex;
@NotNull
SpeakerAudioPlayStartRequestFile file;
public Integer getPsdkIndex() {
return psdkIndex;
}
public void setPsdkIndex(Integer psdkIndex) {
this.psdkIndex = psdkIndex;
}
public SpeakerAudioPlayStartRequestFile getFile() {
return file;
}
public void setFile(SpeakerAudioPlayStartRequestFile file) {
this.file = file;
}
}

55
cloud-sdk/src/main/java/com/dji/sdk/cloudapi/control/SpeakerAudioPlayStartRequestFile.java

@ -0,0 +1,55 @@ @@ -0,0 +1,55 @@
/*************************************************
* @copyright 2017 Flision Corporation Inc.
* @author: Vincent Chan @ Canton
* @date: 2024年06月03日
* @version: 1.0.0
* @description:
**************************************************/
package com.dji.sdk.cloudapi.control;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
public class SpeakerAudioPlayStartRequestFile {
String format = "pcm";
@NotEmpty
String md5;
@NotEmpty
String name;
@NotEmpty
String url;
public String getFormat() {
return format;
}
public void setFormat(String format) {
this.format = format;
}
public String getMd5() {
return md5;
}
public void setMd5(String md5) {
this.md5 = md5;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}

37
cloud-sdk/src/main/java/com/dji/sdk/cloudapi/control/SpeakerPlayModeSetRequest.java

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
/*************************************************
* @copyright 2017 Flision Corporation Inc.
* @author: Vincent Chan @ Canton
* @date: 2024年06月03日
* @version: 1.0.0
* @description:
**************************************************/
package com.dji.sdk.cloudapi.control;
import com.dji.sdk.common.BaseModel;
import jakarta.validation.constraints.NotNull;
public class SpeakerPlayModeSetRequest extends BaseModel {
//"0":"单次播放","1":"循环播放(单曲)"
@NotNull
Integer playMode;
@NotNull
Integer psdkIndex;
public Integer getPlayMode() {
return playMode;
}
public void setPlayMode(Integer playMode) {
this.playMode = playMode;
}
public Integer getPsdkIndex() {
return psdkIndex;
}
public void setPsdkIndex(Integer psdkIndex) {
this.psdkIndex = psdkIndex;
}
}

29
cloud-sdk/src/main/java/com/dji/sdk/cloudapi/control/SpeakerPlayProgress.java

@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
/*************************************************
* @copyright 2017 Flision Corporation Inc.
* @author: Vincent Chan @ Canton
* @date: 2024年06月03日
* @version: 1.0.0
* @description:
**************************************************/
package com.dji.sdk.cloudapi.control;
public class SpeakerPlayProgress {
Integer percent;
String stepKey;
public Integer getPercent() {
return percent;
}
public void setPercent(Integer percent) {
this.percent = percent;
}
public String getStepKey() {
return stepKey;
}
public void setStepKey(String stepKey) {
this.stepKey = stepKey;
}
}

48
cloud-sdk/src/main/java/com/dji/sdk/cloudapi/control/SpeakerPlayStartProgress.java

@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
/*************************************************
* @copyright 2017 Flision Corporation Inc.
* @author: Vincent Chan @ Canton
* @date: 2024年06月03日
* @version: 1.0.0
* @description:
**************************************************/
package com.dji.sdk.cloudapi.control;
public class SpeakerPlayStartProgress {
String md5;
Integer psdkIndex;
String status;
SpeakerPlayProgress progress;
public String getMd5() {
return md5;
}
public void setMd5(String md5) {
this.md5 = md5;
}
public Integer getPsdkIndex() {
return psdkIndex;
}
public void setPsdkIndex(Integer psdkIndex) {
this.psdkIndex = psdkIndex;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public SpeakerPlayProgress getProgress() {
return progress;
}
public void setProgress(SpeakerPlayProgress progress) {
this.progress = progress;
}
}

23
cloud-sdk/src/main/java/com/dji/sdk/cloudapi/control/SpeakerPlayVolumeSetRequest.java

@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
/*************************************************
* @copyright 2017 Flision Corporation Inc.
* @author: Vincent Chan @ Canton
* @date: 2024年06月03日
* @version: 1.0.0
* @description:
**************************************************/
package com.dji.sdk.cloudapi.control;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
public class SpeakerPlayVolumeSetRequest {
@NotNull
Integer psdkIndex;
@NotNull
@Min(0)
@Max(100)
Integer playVolume;
}

36
cloud-sdk/src/main/java/com/dji/sdk/cloudapi/control/SpeakerTTSPlayStartRequest.java

@ -0,0 +1,36 @@ @@ -0,0 +1,36 @@
/*************************************************
* @copyright 2017 Flision Corporation Inc.
* @author: Vincent Chan @ Canton
* @date: 2024年06月03日
* @version: 1.0.0
* @description:
**************************************************/
package com.dji.sdk.cloudapi.control;
import com.dji.sdk.common.BaseModel;
import jakarta.validation.constraints.NotNull;
public class SpeakerTTSPlayStartRequest extends BaseModel {
@NotNull
Integer psdkIndex;
@NotNull
SpeakerTTSPlayStartRequestTTS tts;
public Integer getPsdkIndex() {
return psdkIndex;
}
public void setPsdkIndex(Integer psdkIndex) {
this.psdkIndex = psdkIndex;
}
public SpeakerTTSPlayStartRequestTTS getTts() {
return tts;
}
public void setTts(SpeakerTTSPlayStartRequestTTS tts) {
this.tts = tts;
}
}

43
cloud-sdk/src/main/java/com/dji/sdk/cloudapi/control/SpeakerTTSPlayStartRequestTTS.java

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
/*************************************************
* @copyright 2017 Flision Corporation Inc.
* @author: Vincent Chan @ Canton
* @date: 2024年06月03日
* @version: 1.0.0
* @description:
**************************************************/
package com.dji.sdk.cloudapi.control;
import com.google.common.base.Charsets;
import com.google.common.hash.Hashing;
import java.beans.Encoder;
public class SpeakerTTSPlayStartRequestTTS {
String md5;
String name;
String text;
public String getMd5() {
return md5;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
this.md5 = Hashing.md5().newHasher().putString(text, Charsets.UTF_8)
.hash().toString();
}
}

74
cloud-sdk/src/main/java/com/dji/sdk/cloudapi/control/api/AbstractControlService.java

@ -495,6 +495,80 @@ public abstract class AbstractControlService { @@ -495,6 +495,80 @@ public abstract class AbstractControlService {
request);
}
//============================== Psdk ==============================
@ServiceActivator(inputChannel = ChannelName.INBOUND_EVENTS_PSDK_UI_RESOURCE_UPLOAD_RESULT, outputChannel = ChannelName.OUTBOUND_EVENTS)
public TopicEventsResponse<MqttReply> psdkUiResourceUploadResult(TopicEventsRequest<PSDKUiResourceUploadResult> request, MessageHeaders headers) {
throw new UnsupportedOperationException("psdkUiResourceUploadResult not implemented");
}
@ServiceActivator(inputChannel = ChannelName.INBOUND_EVENTS_PSDK_FLOATING_WINDOW_TEXT, outputChannel = ChannelName.OUTBOUND_EVENTS)
public TopicEventsResponse<MqttReply> psdkFloatingWindowText(TopicEventsRequest<PsdkFloatingWindowText> request, MessageHeaders headers) {
throw new UnsupportedOperationException("psdkFloatingWindowText not implemented");
}
@CloudSDKVersion(since = CloudSDKVersionEnum.V1_0_2, include = {GatewayTypeEnum.DOCK, GatewayTypeEnum.DOCK2})
public TopicServicesResponse<ServicesReplyData> speakerAudioPlayStart(GatewayManager gateway, SpeakerAudioPlayStartRequest request) {
return servicesPublish.publish(
gateway.getGatewaySn(),
ControlMethodEnum.SPEAKER_AUDIO_PLAY_START.getMethod(),
request);
}
@ServiceActivator(inputChannel = ChannelName.INBOUND_EVENTS_SPEAKER_AUDIO_PLAY_START_PROGRESS, outputChannel = ChannelName.OUTBOUND_EVENTS)
public TopicEventsResponse<MqttReply> speakerAudioPlayStartProgress(TopicEventsRequest<EventsDataRequest<SpeakerPlayStartProgress>> request, MessageHeaders headers) {
throw new UnsupportedOperationException("speakerAudioPlayStartProgress not implemented");
}
@CloudSDKVersion(since = CloudSDKVersionEnum.V1_0_2, include = {GatewayTypeEnum.DOCK, GatewayTypeEnum.DOCK2})
public TopicServicesResponse<ServicesReplyData> speakerTtsPlayStart(GatewayManager gateway, SpeakerTTSPlayStartRequest request) {
return servicesPublish.publish(
gateway.getGatewaySn(),
ControlMethodEnum.SPEAKER_TTS_PLAY_START.getMethod(),
request);
}
@ServiceActivator(inputChannel = ChannelName.INBOUND_EVENTS_SPEAKER_TTS_PLAY_START_PROGRESS, outputChannel = ChannelName.OUTBOUND_EVENTS)
public TopicEventsResponse<MqttReply> speakerTTSPlayStartProgress(TopicEventsRequest<EventsDataRequest<SpeakerPlayStartProgress>> request, MessageHeaders headers) {
throw new UnsupportedOperationException("speakerTTSPlayStartProgress not implemented");
}
@CloudSDKVersion(since = CloudSDKVersionEnum.V1_0_2, include = {GatewayTypeEnum.DOCK, GatewayTypeEnum.DOCK2})
public TopicServicesResponse<ServicesReplyData> speakerReplay(GatewayManager gateway, PsdkRequest request) {
return servicesPublish.publish(
gateway.getGatewaySn(),
ControlMethodEnum.SPEAKER_REPLAY.getMethod(),
request);
}
@CloudSDKVersion(since = CloudSDKVersionEnum.V1_0_2, include = {GatewayTypeEnum.DOCK, GatewayTypeEnum.DOCK2})
public TopicServicesResponse<ServicesReplyData> speakerPlayStop(GatewayManager gateway, PsdkRequest request) {
return servicesPublish.publish(
gateway.getGatewaySn(),
ControlMethodEnum.SPEAKER_PLAY_STOP.getMethod(),
request);
}
@CloudSDKVersion(since = CloudSDKVersionEnum.V1_0_2, include = {GatewayTypeEnum.DOCK, GatewayTypeEnum.DOCK2})
public TopicServicesResponse<ServicesReplyData> speakerPlayModeSet(GatewayManager gateway, SpeakerPlayModeSetRequest request) {
return servicesPublish.publish(
gateway.getGatewaySn(),
ControlMethodEnum.SPEAKER_PLAY_MODE_SET.getMethod(),
request);
}
@CloudSDKVersion(since = CloudSDKVersionEnum.V1_0_2, include = {GatewayTypeEnum.DOCK, GatewayTypeEnum.DOCK2})
public TopicServicesResponse<ServicesReplyData> speakerPlayVolumeSet(GatewayManager gateway, SpeakerPlayVolumeSetRequest request) {
return servicesPublish.publish(
gateway.getGatewaySn(),
ControlMethodEnum.SPEAKER_PLAY_VOLUME_SET.getMethod(),
request);
}
/////////////////////////////////////////////////////////////////////
/**
* Payload control
* @param gateway

7
cloud-sdk/src/main/java/com/dji/sdk/mqtt/ChannelName.java

@ -158,6 +158,13 @@ public class ChannelName { @@ -158,6 +158,13 @@ public class ChannelName {
public static final String INBOUND_EVENTS_CAMERA_PHOTO_TAKE_PROGRESS = "inboundEventsCameraPhotoTakeProgress";
//Add by witcom@2024.06.03
public static final String INBOUND_EVENTS_PSDK_UI_RESOURCE_UPLOAD_RESULT = "inboundEventsPsdkUIResourceUploadResult";
public static final String INBOUND_EVENTS_PSDK_FLOATING_WINDOW_TEXT = "inboundEventsFloatWindowText";
public static final String INBOUND_EVENTS_SPEAKER_AUDIO_PLAY_START_PROGRESS = "inboundEventsSpeakerAudioPlayStartProgress";
public static final String INBOUND_EVENTS_SPEAKER_TTS_PLAY_START_PROGRESS = "inboundEventsSpeakerTTSPlayStartProgress";
// property
public static final String INBOUND_PROPERTY_SET_REPLY = "inboundPropertySetReply";

7
cloud-sdk/src/main/java/com/dji/sdk/mqtt/events/EventsMethodEnum.java

@ -98,6 +98,13 @@ public enum EventsMethodEnum { @@ -98,6 +98,13 @@ public enum EventsMethodEnum {
CAMERA_PHOTO_TAKE_PROGRESS("camera_photo_take_progress", ChannelName.INBOUND_EVENTS_CAMERA_PHOTO_TAKE_PROGRESS, new TypeReference<EventsDataRequest<CameraPhotoTakeProgress>>() {}),
//Add by witcom@2024.06.03
PSDK_UI_RESOURCE_UPLOAD_RESULT("psdk_ui_resource_upload_result", ChannelName.INBOUND_EVENTS_PSDK_UI_RESOURCE_UPLOAD_RESULT, new TypeReference<PSDKUiResourceUploadResult>(){}),
PSDK_FLOAT_WINDOW_TEXT("psdk_floating_window_text",ChannelName.INBOUND_EVENTS_PSDK_FLOATING_WINDOW_TEXT,new TypeReference<PsdkFloatingWindowText>(){}),
SPEAKER_AUDIO_PLAY_START_PROGRESS("speaker_audio_play_start_progress",ChannelName.INBOUND_EVENTS_SPEAKER_AUDIO_PLAY_START_PROGRESS,new TypeReference<EventsDataRequest<SpeakerPlayStartProgress>>() {}),
SPEAKER_TTS_PLAY_START_PROGRESS("speaker_tts_play_start_progress",ChannelName.INBOUND_EVENTS_SPEAKER_TTS_PLAY_START_PROGRESS,new TypeReference<EventsDataRequest<SpeakerPlayStartProgress>>() {}),
UNKNOWN("", ChannelName.DEFAULT, new TypeReference<>() {});
private final String method;

Loading…
Cancel
Save