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> 7 #include <std_srvs/Trigger.h> 10 namespace extra_plugins {
14 nh(
"~log_transfer") {}
46 void handle_log_entry(
const mavlink::mavlink_message_t*, mavlink::common::msg::LOG_ENTRY& le)
48 auto msg = boost::make_shared<mavros_msgs::LogEntry>();
51 msg->num_logs = le.num_logs;
52 msg->last_log_num = le.last_log_num;
58 void handle_log_data(
const mavlink::mavlink_message_t*, mavlink::common::msg::LOG_DATA& ld)
60 auto msg = boost::make_shared<mavros_msgs::LogData>();
65 auto count = ld.count;
66 if (count > ld.data.max_size()) {
67 count = ld.data.max_size();
69 msg->data.insert(
msg->data.cbegin(), ld.data.cbegin(), ld.data.cbegin() + count);
74 mavros_msgs::LogRequestList::Response &res)
76 mavlink::common::msg::LOG_REQUEST_LIST
msg = {};
78 msg.start = req.start;
84 }
catch (std::length_error&) {
91 mavros_msgs::LogRequestData::Response &res)
93 mavlink::common::msg::LOG_REQUEST_DATA
msg = {};
97 msg.count = req.count;
102 }
catch (std::length_error&) {
109 mavros_msgs::LogRequestEnd::Response &res)
111 mavlink::common::msg::LOG_REQUEST_END
msg = {};
116 }
catch (std::length_error&) {
123 std_srvs::Trigger::Response &res)
125 mavlink::common::msg::LOG_ERASE
msg;
129 }
catch (std::length_error&) {
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)
void publish(const boost::shared_ptr< M > &message) const
#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)