2 #include <mavros_msgs/LogData.h> 3 #include <mavros_msgs/LogEntry.h> 4 #include <mavros_msgs/LogRequestData.h> 5 #include <mavros_msgs/LogRequestEnd.h> 6 #include <mavros_msgs/LogRequestList.h> 9 namespace extra_plugins {
13 nh(
"~log_transfer") {}
43 void handle_log_entry(
const mavlink::mavlink_message_t*, mavlink::common::msg::LOG_ENTRY& le)
45 auto msg = boost::make_shared<mavros_msgs::LogEntry>();
48 msg->num_logs = le.num_logs;
49 msg->last_log_num = le.last_log_num;
55 void handle_log_data(
const mavlink::mavlink_message_t*, mavlink::common::msg::LOG_DATA& ld)
57 auto msg = boost::make_shared<mavros_msgs::LogData>();
62 auto count = ld.count;
63 if (count > ld.data.max_size()) {
64 count = ld.data.max_size();
66 msg->data.insert(
msg->data.cbegin(), ld.data.cbegin(), ld.data.cbegin() + count);
71 mavros_msgs::LogRequestList::Response &res)
73 mavlink::common::msg::LOG_REQUEST_LIST
msg = {};
75 msg.start = req.start;
81 }
catch (std::length_error&) {
88 mavros_msgs::LogRequestData::Response &res)
90 mavlink::common::msg::LOG_REQUEST_DATA
msg = {};
94 msg.count = req.count;
99 }
catch (std::length_error&) {
106 mavros_msgs::LogRequestEnd::Response &res)
108 mavlink::common::msg::LOG_REQUEST_END
msg = {};
113 }
catch (std::length_error&) {
void publish(const boost::shared_ptr< M > &message) const
HandlerInfo make_handler(const mavlink::msgid_t id, void(_C::*fn)(const mavlink::mavlink_message_t *msg, const mavconn::Framing framing))
void msg_set_target(_T &msg)
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
#define UAS_FCU(uasobjptr)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
std::vector< HandlerInfo > Subscriptions
void initialize(UAS &uas_) override
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)