diff --git a/aircraft-common/lib/cloud-sdk-1.0.3.jar b/aircraft-common/lib/cloud-sdk-1.0.3.jar new file mode 100644 index 0000000..e560fea Binary files /dev/null and b/aircraft-common/lib/cloud-sdk-1.0.3.jar differ diff --git a/aircraft-common/pom.xml b/aircraft-common/pom.xml index 2dd7015..4808c7f 100644 --- a/aircraft-common/pom.xml +++ b/aircraft-common/pom.xml @@ -25,5 +25,13 @@ jackson-datatype-jsr310 2.12.7 + + + com.cloud.sdk + cloud-sdk + 1.0.3 + system + ${project.basedir}/lib/cloud-sdk-1.0.3.jar + \ No newline at end of file diff --git a/aircraft-common/src/main/java/com/aircraft/config/mqtt/config/MqttMessageChannel.java b/aircraft-common/src/main/java/com/aircraft/config/mqtt/config/MqttMessageChannel.java new file mode 100644 index 0000000..7b7e517 --- /dev/null +++ b/aircraft-common/src/main/java/com/aircraft/config/mqtt/config/MqttMessageChannel.java @@ -0,0 +1,78 @@ +package com.aircraft.config.mqtt.config; + +import com.dji.sdk.mqtt.ChannelName; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.integration.channel.DirectChannel; +import org.springframework.integration.channel.ExecutorChannel; +import org.springframework.messaging.MessageChannel; + +import javax.annotation.Resource; +import java.util.concurrent.Executor; + +/** + * Definition classes for all channels + * @author sean.zhou + * @date 2021/11/10 + * @version 0.1 + */ +@Configuration +public class MqttMessageChannel { + + @Autowired + @Qualifier("taskScheduler") + private Executor threadPool; + + @Bean(name = ChannelName.INBOUND) + public MessageChannel inboundChannel() { + return new ExecutorChannel(threadPool); + } + + @Bean(name = ChannelName.DEFAULT) + public MessageChannel defaultChannel() { + return new DirectChannel(); + } + + @Bean(name = ChannelName.INBOUND_STATUS) + public MessageChannel statusChannel() { + return new DirectChannel(); + } + + @Bean(name = ChannelName.INBOUND_STATE) + public MessageChannel stateChannel() { + return new DirectChannel(); + } + + @Bean(name = ChannelName.INBOUND_SERVICES_REPLY) + public MessageChannel serviceReplyChannel() { + return new DirectChannel(); + } + + @Bean(name = ChannelName.INBOUND_OSD) + public MessageChannel osdChannel() { + return new ExecutorChannel(threadPool); + } + + @Bean(name = ChannelName.INBOUND_REQUESTS) + public MessageChannel requestsChannel() { + return new DirectChannel(); + } + + @Bean(name = ChannelName.INBOUND_EVENTS) + public MessageChannel eventsChannel() { + return new DirectChannel(); + } + + @Bean(name = ChannelName.INBOUND_PROPERTY_SET_REPLY) + public MessageChannel propertySetReply() { + return new DirectChannel(); + } + + @Bean(name = ChannelName.INBOUND_DRC_UP) + public MessageChannel drcUp() { + return new DirectChannel(); + } + +} diff --git a/aircraft-common/src/main/java/com/aircraft/config/mqtt/config/MqttPropertyConfiguration.java b/aircraft-common/src/main/java/com/aircraft/config/mqtt/config/MqttPropertyConfiguration.java new file mode 100644 index 0000000..1148413 --- /dev/null +++ b/aircraft-common/src/main/java/com/aircraft/config/mqtt/config/MqttPropertyConfiguration.java @@ -0,0 +1,122 @@ +package com.aircraft.config.mqtt.config; + +import com.aircraft.config.mqtt.util.JwtUtil; +import com.auth0.jwt.algorithms.Algorithm; +import com.aircraft.config.mqtt.model.MqttClientOptions; +import com.aircraft.config.mqtt.model.MqttProtocolEnum; +import com.aircraft.config.mqtt.model.MqttUseEnum; +import com.dji.sdk.cloudapi.control.DrcModeMqttBroker; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.eclipse.paho.client.mqttv3.MqttConnectOptions; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.integration.mqtt.core.DefaultMqttPahoClientFactory; +import org.springframework.integration.mqtt.core.MqttPahoClientFactory; +import org.springframework.util.StringUtils; + +import java.util.Map; + +/** + * + * @author sean.zhou + * @date 2021/11/10 + * @version 0.1 + */ +@Configuration +@Data +@ConfigurationProperties +@Slf4j +public class MqttPropertyConfiguration { + + private static Map mqtt; + + public void setMqtt(Map mqtt) { + MqttPropertyConfiguration.mqtt = mqtt; + } + + /** + * Get the configuration options of the basic link of the mqtt client. + * @return + */ + static MqttClientOptions getBasicClientOptions() { + if (!mqtt.containsKey(MqttUseEnum.BASIC)) { + throw new Error("Please configure the basic mqtt connection parameters first, otherwise application cannot be started."); + } + return mqtt.get(MqttUseEnum.BASIC); + } + + /** + * Get the mqtt address of the basic link. + * @return + */ + public static String getBasicMqttAddress() { + return getMqttAddress(getBasicClientOptions()); + } + + /** + * Splice the mqtt address according to the parameters of different clients. + * @param options + * @return + */ + private static String getMqttAddress(MqttClientOptions options) { + StringBuilder addr = new StringBuilder() + .append(options.getProtocol().getProtocolAddr()) + .append(options.getHost().trim()) + .append(":") + .append(options.getPort()); + if ((options.getProtocol() == MqttProtocolEnum.WS || options.getProtocol() == MqttProtocolEnum.WSS) + && StringUtils.hasText(options.getPath())) { + addr.append(options.getPath()); + } + return addr.toString(); + } + + /** + * Get the connection parameters of the mqtt client of the drc link. + * @param clientId + * @param username + * @param age The validity period of the token. unit: s + * @param map Custom data added in token. + * @return + */ + public static DrcModeMqttBroker getMqttBrokerWithDrc(String clientId, String username, Long age, Map map) { + if (!mqtt.containsKey(MqttUseEnum.DRC)) { + throw new RuntimeException("Please configure the drc link parameters of mqtt in the backend configuration file first."); + } + Algorithm algorithm = JwtUtil.algorithm; + + String token = JwtUtil.createToken(map, age, algorithm, null, null); + + return new DrcModeMqttBroker() + .setAddress(getMqttAddress(mqtt.get(MqttUseEnum.DRC))) + .setUsername(username) + .setClientId(clientId) + .setExpireTime(System.currentTimeMillis() / 1000 + age) + .setPassword(token) + .setEnableTls(false); + } + + + @Bean + public MqttConnectOptions mqttConnectOptions() { + MqttClientOptions customizeOptions = getBasicClientOptions(); + MqttConnectOptions mqttConnectOptions = new MqttConnectOptions(); + mqttConnectOptions.setServerURIs(new String[]{ getBasicMqttAddress() }); + mqttConnectOptions.setUserName(customizeOptions.getUsername()); + mqttConnectOptions.setPassword(StringUtils.hasText(customizeOptions.getPassword()) ? + customizeOptions.getPassword().toCharArray() : new char[0]); + mqttConnectOptions.setAutomaticReconnect(true); + mqttConnectOptions.setKeepAliveInterval(10); + return mqttConnectOptions; + } + + @Bean + public MqttPahoClientFactory mqttClientFactory() { + log.info("MqttPahoClientFactory被加载了"); + DefaultMqttPahoClientFactory factory = new DefaultMqttPahoClientFactory(); + factory.setConnectionOptions(mqttConnectOptions()); + return factory; + } +} diff --git a/aircraft-common/src/main/java/com/aircraft/config/mqtt/model/CustomClaim.java b/aircraft-common/src/main/java/com/aircraft/config/mqtt/model/CustomClaim.java new file mode 100644 index 0000000..afbdf86 --- /dev/null +++ b/aircraft-common/src/main/java/com/aircraft/config/mqtt/model/CustomClaim.java @@ -0,0 +1,88 @@ +package com.aircraft.config.mqtt.model; + +import com.auth0.jwt.interfaces.Claim; +import com.fasterxml.jackson.annotation.JsonAlias; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +import java.lang.reflect.Field; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * A custom claim for storing custom information in the token. + * @author sean.zhou + * @date 2021/11/16 + * @version 0.1 + */ +@AllArgsConstructor +@NoArgsConstructor +@Data +@Slf4j +public class CustomClaim { + + /** + * The id of the account. + */ + private String id; + + private String username; + + @JsonAlias("user_type") + private Integer userType; + + @JsonAlias("workspace_id") + private String workspaceId; + + /** + * Convert the custom claim data type to the Map type. + * @return map + */ + public ConcurrentHashMap convertToMap() { + ConcurrentHashMap map = new ConcurrentHashMap<>(4); + try { + Field[] declaredFields = this.getClass().getDeclaredFields(); + for (Field field : declaredFields) { + JsonAlias annotation = field.getAnnotation(JsonAlias.class); + field.setAccessible(true); + // The value of key is named underscore. + map.put(annotation != null ? annotation.value()[0] : field.getName(), + field.get(this).toString()); + } + } catch (IllegalAccessException e) { + log.info("CustomClaim converts failed. {}", this.toString()); + e.printStackTrace(); + } + return map; + } + + /** + * Convert the data in Map into a custom claim object. + * @param claimMap + */ + public CustomClaim(Map claimMap) { + Field[] declaredFields = this.getClass().getDeclaredFields(); + for (Field field : declaredFields) { + field.setAccessible(true); + JsonAlias annotation = field.getAnnotation(JsonAlias.class); + + Claim value = claimMap.get(annotation == null ? field.getName() : annotation.value()[0]); + try { + Class type = field.getType(); + if (Integer.class.equals(type)) { + field.set(this, Integer.valueOf(value.asString())); + continue; + } + if (String.class.equals(type)) { + field.set(this, value.asString()); + continue; + } + } catch (IllegalAccessException e) { + log.info("Claim parses failed. {}", claimMap.toString()); + e.printStackTrace(); + } + } + } +} \ No newline at end of file diff --git a/aircraft-common/src/main/java/com/aircraft/config/mqtt/model/EventsReceiver.java b/aircraft-common/src/main/java/com/aircraft/config/mqtt/model/EventsReceiver.java new file mode 100644 index 0000000..cb0420a --- /dev/null +++ b/aircraft-common/src/main/java/com/aircraft/config/mqtt/model/EventsReceiver.java @@ -0,0 +1,64 @@ +package com.aircraft.config.mqtt.model; + +import com.dji.sdk.mqtt.events.EventsDataRequest; +import com.dji.sdk.mqtt.events.EventsErrorCode; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.*; + +/** + * @author sean + * @version 1.1 + * @date 2022/6/9 + */ +@EqualsAndHashCode(callSuper = true) +@Data +@JsonIgnoreProperties(ignoreUnknown = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class EventsReceiver extends EventsDataRequest { + + private String bid; + + private String sn; + + @Override + public EventsErrorCode getResult() { + return super.getResult(); + } + + @Override + public EventsReceiver setResult(EventsErrorCode result) { + super.setResult(result); + return this; + } + + @Override + public T getOutput() { + return super.getOutput(); + } + + @Override + public EventsReceiver setOutput(T output) { + super.setOutput(output); + return this; + } + + public String getBid() { + return bid; + } + + public EventsReceiver setBid(String bid) { + this.bid = bid; + return this; + } + + public String getSn() { + return sn; + } + + public EventsReceiver setSn(String sn) { + this.sn = sn; + return this; + } +} diff --git a/aircraft-common/src/main/java/com/aircraft/config/mqtt/model/MapKeyConst.java b/aircraft-common/src/main/java/com/aircraft/config/mqtt/model/MapKeyConst.java new file mode 100644 index 0000000..0aa0889 --- /dev/null +++ b/aircraft-common/src/main/java/com/aircraft/config/mqtt/model/MapKeyConst.java @@ -0,0 +1,16 @@ +package com.aircraft.config.mqtt.model; + +/** + * @author sean + * @version 1.1 + * @date 2022/6/14 + */ +public final class MapKeyConst { + + private MapKeyConst(){ + + } + + public static final String ACL = "acl"; + +} diff --git a/aircraft-common/src/main/java/com/aircraft/config/mqtt/model/MqttClientOptions.java b/aircraft-common/src/main/java/com/aircraft/config/mqtt/model/MqttClientOptions.java new file mode 100644 index 0000000..04bdfa3 --- /dev/null +++ b/aircraft-common/src/main/java/com/aircraft/config/mqtt/model/MqttClientOptions.java @@ -0,0 +1,31 @@ +package com.aircraft.config.mqtt.model; + +import lombok.Data; + +/** + * @author sean + * @version 1.3 + * @date 2023/1/18 + */ +@Data +public class MqttClientOptions { + + private MqttProtocolEnum protocol; + + private String host; + + private Integer port; + + private String username; + + private String password; + + private String clientId; + + private String path; + + /** + * The topic to subscribe to immediately when client connects. Only required for basic link. + */ + private String inboundTopic; +} diff --git a/aircraft-common/src/main/java/com/aircraft/config/mqtt/model/MqttProtocolEnum.java b/aircraft-common/src/main/java/com/aircraft/config/mqtt/model/MqttProtocolEnum.java new file mode 100644 index 0000000..0138e49 --- /dev/null +++ b/aircraft-common/src/main/java/com/aircraft/config/mqtt/model/MqttProtocolEnum.java @@ -0,0 +1,30 @@ +package com.aircraft.config.mqtt.model; + +import lombok.Getter; + +/** + * @author sean + * @version 1.3 + * @date 2023/1/18 + */ +@Getter +public enum MqttProtocolEnum { + + MQTT("tcp"), + + MQTTS("ssl"), + + WS("ws"), + + WSS("wss"); + + String protocol; + + MqttProtocolEnum(String protocol) { + this.protocol = protocol; + } + + public String getProtocolAddr() { + return protocol + "://"; + } +} diff --git a/aircraft-common/src/main/java/com/aircraft/config/mqtt/model/MqttUseEnum.java b/aircraft-common/src/main/java/com/aircraft/config/mqtt/model/MqttUseEnum.java new file mode 100644 index 0000000..7c253d4 --- /dev/null +++ b/aircraft-common/src/main/java/com/aircraft/config/mqtt/model/MqttUseEnum.java @@ -0,0 +1,19 @@ +package com.aircraft.config.mqtt.model; + +/** + * @author sean + * @version 1.3 + * @date 2023/1/18 + */ +public enum MqttUseEnum { + + /** + * The broker is used for basic link. + */ + BASIC, + + /** + * This broker is used for the drc link. + */ + DRC +} diff --git a/aircraft-common/src/main/java/com/aircraft/config/mqtt/util/JwtUtil.java b/aircraft-common/src/main/java/com/aircraft/config/mqtt/util/JwtUtil.java new file mode 100644 index 0000000..be0de3a --- /dev/null +++ b/aircraft-common/src/main/java/com/aircraft/config/mqtt/util/JwtUtil.java @@ -0,0 +1,144 @@ +package com.aircraft.config.mqtt.util; + +import com.aircraft.config.mqtt.model.CustomClaim; +import com.auth0.jwt.JWT; +import com.auth0.jwt.JWTCreator; +import com.auth0.jwt.algorithms.Algorithm; +import com.auth0.jwt.exceptions.TokenExpiredException; +import com.auth0.jwt.interfaces.DecodedJWT; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import org.springframework.util.StringUtils; + +import java.util.*; + +@Slf4j +@Component +public class JwtUtil { + + private static String issuer; + + private static String subject; + + private static long age; + + private static String secret; + + public static Algorithm algorithm; + + @Value("${jwt.issuer: DJI}") + private void setIssuer(String issuer) { + JwtUtil.issuer = issuer; + } + + @Value("${jwt.subject: CloudApiSample}") + private void setSubject(String subject) { + JwtUtil.subject = subject; + } + + @Value("${jwt.age: 86400}") + private void setAge(long age) { + JwtUtil.age = age * 1000; + } + + @Value("${jwt.secret: CloudApiSample}") + private void setSecret(String secret) { + JwtUtil.secret = secret; + setAlgorithm(); + } + + private void setAlgorithm() { + JwtUtil.algorithm = Algorithm.HMAC256(secret); + } + + private JwtUtil() { + + } + + /** + * Create a token based on custom information. + * @param claims custom information + * @return token + */ + public static String createToken(Map claims) { + return JwtUtil.createToken(claims, age, algorithm, subject, issuer); + } + + /** + * + * @param claims + * @param age unit: s + * @param algorithm + * @param subject + * @param issuer + * @return + */ + public static String createToken(Map claims, Long age, Algorithm algorithm, String subject, String issuer) { + if (Objects.isNull(algorithm)) { + throw new IllegalArgumentException(); + } + + Date now = new Date(); + JWTCreator.Builder builder = JWT.create(); + // Add custom information to the token's payload segment. + claims.forEach((k, v) -> { + if (Objects.nonNull(v.getClass().getClassLoader())) { + log.error("claim can't be set to a custom object."); + return; + } + if (v instanceof Map) { + builder.withClaim(k, (Map) v); + } else if (v instanceof List) { + builder.withClaim(k, (List) v); + } else { + builder.withClaim(k, String.valueOf(v)); + } + }); + + if (StringUtils.hasText(subject)) { + builder.withSubject(subject); + } + + if (StringUtils.hasText(issuer)) { + builder.withIssuer(issuer); + } + + if (Objects.nonNull(age)) { + builder.withExpiresAt(new Date(now.getTime() + age)); + } + + String token = builder + .withIssuedAt(now) + .withNotBefore(now) + .sign(algorithm); + log.debug("token created. " + token); + return token; + } + + /** + * Verify that the token is valid. + * @param token + * @return + * @throws TokenExpiredException + */ + public static DecodedJWT verifyToken(String token) { + return JWT.require(algorithm).build().verify(token); + } + + /** + * Parses the custom information in the token into a CustomClaim object. + * @param token + * @return custom claim + */ + public static Optional parseToken(String token) { + DecodedJWT jwt; + try { + jwt = verifyToken(token); + } catch (Exception e) { + e.printStackTrace(); + return Optional.empty(); + } + return Optional.of(new CustomClaim(jwt.getClaims())); + } +} diff --git a/aircraft-common/src/main/java/com/aircraft/config/mybatis/MybatisPlusConfig.java b/aircraft-common/src/main/java/com/aircraft/config/mybatis/MybatisPlusConfig.java index 7e58aa7..de9d008 100644 --- a/aircraft-common/src/main/java/com/aircraft/config/mybatis/MybatisPlusConfig.java +++ b/aircraft-common/src/main/java/com/aircraft/config/mybatis/MybatisPlusConfig.java @@ -18,6 +18,7 @@ package com.aircraft.config.mybatis; import com.baomidou.mybatisplus.annotation.DbType; import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; +import lombok.extern.slf4j.Slf4j; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -27,6 +28,7 @@ import org.springframework.context.annotation.Configuration; * @date 2023-06-12 **/ @Configuration +@Slf4j public class MybatisPlusConfig { /** @@ -34,6 +36,7 @@ public class MybatisPlusConfig { */ @Bean public MybatisPlusInterceptor paginationInterceptor() { + log.info("MybatisPlusInterceptor被加载了"); MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); //添加MySQL的分页拦截器 interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); diff --git a/aircraft-system/src/main/java/com/aircraft/AppRun.java b/aircraft-system/src/main/java/com/aircraft/AppRun.java index 5cd4003..3daeaa4 100644 --- a/aircraft-system/src/main/java/com/aircraft/AppRun.java +++ b/aircraft-system/src/main/java/com/aircraft/AppRun.java @@ -25,6 +25,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.ApplicationPidFileWriter; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.web.bind.annotation.RestController; @@ -38,6 +39,7 @@ import org.springframework.web.bind.annotation.RestController; @SpringBootApplication @EnableTransactionManagement @MapperScan("com.aircraft.**.mapper") +@ComponentScan(basePackages = {"com.aircraft", "com.dji.sdk"}) public class AppRun { public static void main(String[] args) { diff --git a/aircraft-system/src/main/java/com/aircraft/modules/aircraft/service/impl/AircraftDeviceServiceImpl.java b/aircraft-system/src/main/java/com/aircraft/modules/aircraft/service/impl/AircraftDeviceServiceImpl.java index 564fa97..431ea99 100644 --- a/aircraft-system/src/main/java/com/aircraft/modules/aircraft/service/impl/AircraftDeviceServiceImpl.java +++ b/aircraft-system/src/main/java/com/aircraft/modules/aircraft/service/impl/AircraftDeviceServiceImpl.java @@ -17,6 +17,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.dji.sdk.mqtt.MqttGatewayPublish; import lombok.RequiredArgsConstructor; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; @@ -42,6 +43,10 @@ public class AircraftDeviceServiceImpl extends ServiceImpl page(AircraftDevicePageDTO dto, Page page) { //飞行端用户只能看到自己名下 diff --git a/aircraft-system/src/main/resources/config/application.yml b/aircraft-system/src/main/resources/config/application.yml index c1e5058..e2c4c7d 100644 --- a/aircraft-system/src/main/resources/config/application.yml +++ b/aircraft-system/src/main/resources/config/application.yml @@ -76,4 +76,30 @@ code: #密码加密传输,前端公钥加密,后端私钥解密 rsa: - private_key: MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9pB6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZUBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3tTbklZkD2A== \ No newline at end of file + private_key: MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9pB6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZUBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3tTbklZkD2A== + + + +mqtt: + # @see com.dji.sample.component.mqtt.model.MqttUseEnum + # BASIC parameters are required. + BASIC: + protocol: MQTT # @see com.dji.sample.component.mqtt.model.MqttProtocolEnum + host: 127.0.0.1 + port: 1883 + username: JavaServer + password: 123456 + client-id: 123456 + # If the protocol is ws/wss, this value is required. + path: + DRC: + protocol: WS # @see com.dji.sample.component.mqtt.model.MqttProtocolEnum + host: 127.0.0.1 + port: 8083 + path: /mqtt + username: JavaServer + password: 123456 +cloud-sdk: + mqtt: + # Topics that need to be subscribed when initially connecting to mqtt, multiple topics are divided by ",". + inbound-topic: sys/product/+/status,thing/product/+/requests \ No newline at end of file diff --git a/pom.xml b/pom.xml index 99b590d..10780a8 100644 --- a/pom.xml +++ b/pom.xml @@ -231,6 +231,16 @@ commons-text 1.13.0 + + org.springframework.integration + spring-integration-mqtt + 5.5.5 + + + com.auth0 + java-jwt + 3.12.1 +