Open dariofil-star opened 1 year ago
You can get that information from the device_osd event
@dariofil-star package com.dji.sample.component.mqtt.handler;
import com.alibaba.fastjson2.JSONObject; import com.dji.sample.common.util.SpringBeanUtils; import com.dji.sample.component.mqtt.model.ChannelName; import com.dji.sample.component.mqtt.model.DeviceTopicEnum; import com.dji.sample.component.redis.RedisConst; import com.dji.sample.component.redis.RedisOpsUtils; import com.dji.sample.manage.model.dto.DeviceDTO; import com.google.gson.JsonObject; import javax.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.integration.annotation.Router; import org.springframework.integration.config.xml.PayloadDeserializingTransformerParser; import org.springframework.integration.mqtt.support.MqttHeaders; import org.springframework.integration.router.AbstractMessageRouter; import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; import org.springframework.messaging.MessageHeaders; import org.springframework.stereotype.Component;
import java.util.Collection; import java.util.Collections; import org.springframework.web.client.RestTemplate;
/**
@date 2021/11/10 */ @Component @Slf4j public class InboundMessageRouter extends AbstractMessageRouter {
@Resource RestTemplate restTemplate;
@Autowired private RedisOpsUtils redisOps;
/**
log.debug("received topic :{} \t payload :{}", topic, new String(payload));
DeviceTopicEnum topicEnum = DeviceTopicEnum.find(topic); if (topicEnum == DeviceTopicEnum.OSD) {
JSONObject jsonObject = JSONObject.parseObject(new String(payload)); String redisKey = RedisConst.DEVICE_ONLINE_PREFIX + jsonObject.getString("gateway"); DeviceDTO device = (DeviceDTO) redisOps.get(redisKey);
if (device != null) { //do something } } MessageChannel bean = (MessageChannel) SpringBeanUtils.getBean(topicEnum.getBeanName());
return Collections.singleton(bean); }
}
Hi,
We have a business requirement to obtain GPS position of drone. Currently it is very complex/complicated to do this via CloudAPI.
It would be of benefit to many if the DJI Pilot 2 app exposed a simple output of this information every few seconds. Lat, Long, Battery %, Speed
Just a few read only parrameters that we can use for simple integration to represent the drones on the map.