|
|
@ -10,16 +10,17 @@ import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.dubbo.config.annotation.DubboReference; |
|
|
|
import org.dromara.business.api.RemoteBusinessTaskService; |
|
|
|
import org.dromara.common.satoken.utils.LoginHelper; |
|
|
|
import org.dromara.common.sdk.cloudapi.wayline.WaylineMethodEnum; |
|
|
|
import org.dromara.common.sdk.common.HttpResultResponse; |
|
|
|
import org.dromara.common.sdk.common.PaginationData; |
|
|
|
import org.dromara.common.sdk.exception.CloudSDKErrorEnum; |
|
|
|
import org.dromara.common.sdk.mqtt.CommonTopicRequest; |
|
|
|
import org.dromara.common.sdk.mqtt.MegaphoneTopicRequest; |
|
|
|
import org.dromara.common.sdk.mqtt.MqttGatewayPublish; |
|
|
|
import org.dromara.common.sdk.mqtt.TopicConst; |
|
|
|
import org.dromara.common.sdk.mqtt.*; |
|
|
|
import org.dromara.common.sdk.mqtt.property.PropertySetPublish; |
|
|
|
import org.dromara.common.sdk.mqtt.property.PropertySetReplyResultEnum; |
|
|
|
import org.dromara.common.sdk.mqtt.property.TopicPropertySetRequest; |
|
|
|
import org.dromara.common.sdk.mqtt.services.ServicesPublish; |
|
|
|
import org.dromara.common.sdk.mqtt.services.ServicesReplyReceiver; |
|
|
|
import org.dromara.common.sdk.mqtt.services.TopicServicesRequest; |
|
|
|
import org.dromara.sample.manage.model.dto.*; |
|
|
|
import org.dromara.sample.manage.service.IDeviceService; |
|
|
|
import org.dromara.system.api.RemoteConfigService; |
|
|
@ -29,6 +30,9 @@ import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
import static org.dromara.common.sdk.mqtt.MqttGatewayPublish.DEFAULT_RETRY_COUNT; |
|
|
|
import static org.dromara.common.sdk.mqtt.MqttGatewayPublish.DEFAULT_RETRY_TIMEOUT; |
|
|
|
|
|
|
|
/** |
|
|
|
* @author sean.zhou |
|
|
|
* @version 0.1 |
|
|
@ -44,6 +48,9 @@ public class MegaphoneController { |
|
|
|
|
|
|
|
@Resource |
|
|
|
private MqttGatewayPublish gatewayPublish; |
|
|
|
@Resource |
|
|
|
private ServicesPublish servicesPublish; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
PropertySetPublish propertySetPublish; |
|
|
@ -61,10 +68,16 @@ public class MegaphoneController { |
|
|
|
@RequestParam("gatewaySn") String gatewaySn, |
|
|
|
@RequestBody PlayStartDTO param |
|
|
|
) { |
|
|
|
String top = TOPIC+"gatewaySn"+"/services"; |
|
|
|
String top = TOPIC+gatewaySn+"/services"; |
|
|
|
//发送mqtt
|
|
|
|
propertySetPublish.publishPlayText(top,param,"speaker_tts_play_start"); |
|
|
|
return HttpResultResponse.success(); |
|
|
|
CommonTopicResponse<ServicesReplyReceiver> servicesReplyReceiverCommonTopicResponse = gatewayPublish.publishWithReply( |
|
|
|
ServicesReplyReceiver.class, top, new TopicServicesRequest<>() |
|
|
|
.setTid(UUID.randomUUID().toString()) |
|
|
|
.setBid(null) |
|
|
|
.setTimestamp(System.currentTimeMillis()) |
|
|
|
.setMethod("speaker_tts_play_start") |
|
|
|
.setData(param), DEFAULT_RETRY_COUNT, DEFAULT_RETRY_TIMEOUT); |
|
|
|
return HttpResultResponse.success(servicesReplyReceiverCommonTopicResponse); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -80,8 +93,14 @@ public class MegaphoneController { |
|
|
|
) { |
|
|
|
String top = TOPIC+gatewaySn+"/services"; |
|
|
|
//发送mqtt
|
|
|
|
propertySetPublish.publishPlayText(top,param,"speaker_replay"); |
|
|
|
return HttpResultResponse.success(); |
|
|
|
CommonTopicResponse<ServicesReplyReceiver> servicesReplyReceiverCommonTopicResponse = gatewayPublish.publishWithReply( |
|
|
|
ServicesReplyReceiver.class, top, new TopicServicesRequest<>() |
|
|
|
.setTid(UUID.randomUUID().toString()) |
|
|
|
.setBid(null) |
|
|
|
.setTimestamp(System.currentTimeMillis()) |
|
|
|
.setMethod("speaker_replay") |
|
|
|
.setData(param), DEFAULT_RETRY_COUNT, DEFAULT_RETRY_TIMEOUT); |
|
|
|
return HttpResultResponse.success(servicesReplyReceiverCommonTopicResponse); |
|
|
|
} |
|
|
|
/** |
|
|
|
* 喊话器-暂停播放文档 |
|
|
@ -96,8 +115,14 @@ public class MegaphoneController { |
|
|
|
) { |
|
|
|
String top = TOPIC+gatewaySn+"/services"; |
|
|
|
//发送mqtt
|
|
|
|
propertySetPublish.publishPlayText(top,param,"speaker_play_stop"); |
|
|
|
return HttpResultResponse.success(); |
|
|
|
CommonTopicResponse<ServicesReplyReceiver> servicesReplyReceiverCommonTopicResponse = gatewayPublish.publishWithReply( |
|
|
|
ServicesReplyReceiver.class, top, new TopicServicesRequest<>() |
|
|
|
.setTid(UUID.randomUUID().toString()) |
|
|
|
.setBid(null) |
|
|
|
.setTimestamp(System.currentTimeMillis()) |
|
|
|
.setMethod("speaker_play_stop") |
|
|
|
.setData(param), DEFAULT_RETRY_COUNT, DEFAULT_RETRY_TIMEOUT); |
|
|
|
return HttpResultResponse.success(servicesReplyReceiverCommonTopicResponse); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -113,8 +138,14 @@ public class MegaphoneController { |
|
|
|
) { |
|
|
|
String top = TOPIC+gatewaySn+"/services"; |
|
|
|
//发送mqtt
|
|
|
|
propertySetPublish.publishPlayText(top,param,"speaker_play_mode_set"); |
|
|
|
return HttpResultResponse.success(); |
|
|
|
CommonTopicResponse<ServicesReplyReceiver> servicesReplyReceiverCommonTopicResponse = gatewayPublish.publishWithReply( |
|
|
|
ServicesReplyReceiver.class, top, new TopicServicesRequest<>() |
|
|
|
.setTid(UUID.randomUUID().toString()) |
|
|
|
.setBid(null) |
|
|
|
.setTimestamp(System.currentTimeMillis()) |
|
|
|
.setMethod("speaker_play_mode_set") |
|
|
|
.setData(param), DEFAULT_RETRY_COUNT, DEFAULT_RETRY_TIMEOUT); |
|
|
|
return HttpResultResponse.success(servicesReplyReceiverCommonTopicResponse); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -127,20 +158,25 @@ public class MegaphoneController { |
|
|
|
*/ |
|
|
|
@PostMapping("/{workspace_id}/widgetValueSet") |
|
|
|
@Operation(summary = "喊话器-设置音量。", description = "喊话器-设置音量。") |
|
|
|
public int widgetValueSet(@PathVariable("workspace_id") String workspaceId, |
|
|
|
public HttpResultResponse widgetValueSet(@PathVariable("workspace_id") String workspaceId, |
|
|
|
@RequestParam("gatewaySn") String gatewaySn, |
|
|
|
@RequestBody PlayVolumeDTO param |
|
|
|
) { |
|
|
|
String top = TOPIC+gatewaySn+"/services"; |
|
|
|
//发送mqtt
|
|
|
|
PropertySetReplyResultEnum psdkWidgetValueSet = propertySetPublish.publishPlayText(top,param,"psdk_widget_value_set"); |
|
|
|
return psdkWidgetValueSet.getResult(); |
|
|
|
CommonTopicResponse<ServicesReplyReceiver> servicesReplyReceiverCommonTopicResponse = gatewayPublish.publishWithReply( |
|
|
|
ServicesReplyReceiver.class, top, new TopicServicesRequest<>() |
|
|
|
.setTid(UUID.randomUUID().toString()) |
|
|
|
.setBid(null) |
|
|
|
.setTimestamp(System.currentTimeMillis()) |
|
|
|
.setMethod("speaker_play_volume_set") |
|
|
|
.setData(param), DEFAULT_RETRY_COUNT, DEFAULT_RETRY_TIMEOUT); |
|
|
|
return HttpResultResponse.success(servicesReplyReceiverCommonTopicResponse); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 获取媒体流ip |
|
|
|
* Get the topology list of all online devices in one workspace. |
|
|
|