获取osd中的无人机飞行数据
Completedpilot上云
如果需要获取无人机的飞行数据是不是直接去osd中消费消息就可以了,是不是可以通过继承实现 AbstractDeviceService 中的方法就可以了,或者自己直接订阅相关的topic去自己消费
-
这个我知道,那个MQTT类似消息队列那种,主要是每太研究明白这个上云APIDemo的源码,我看SDK里是做了消息的处理的,
public class InboundMessageRouter extends AbstractMessageRouter {
private static final Logger log = LoggerFactory.getLogger(InboundMessageRouter.class);
/**
* All mqtt broker messages will arrive here before distributing them to different channels.
* @param message message from mqtt broker
* @return channel
*/
@Override
@Router(inputChannel = ChannelName.INBOUND)
protected Collection<MessageChannel> determineTargetChannels(Message<?> message) {
MessageHeaders headers = message.getHeaders();
String topic = headers.get(MqttHeaders.RECEIVED_TOPIC).toString();
byte[] payload = (byte[])message.getPayload();
log.debug("received topic: {} \t payload =>{}", topic, new String(payload));
CloudApiTopicEnum topicEnum = CloudApiTopicEnum.find(topic);
MessageChannel bean = (MessageChannel) SpringBeanUtils.getBean(topicEnum.getBeanName());
return Collections.singleton(bean);
}
} -
刚接触这块。能加个联系方式请教一下吗?Boerma
Please sign in to leave a comment.
Comments
12 comments