mavros_plugin.h
Go to the documentation of this file.
00001 
00010 /*
00011  * Copyright 2013,2014,2015 Vladimir Ermakov.
00012  *
00013  * This file is part of the mavros package and subject to the license terms
00014  * in the top-level LICENSE file of the mavros repository.
00015  * https://github.com/mavlink/mavros/tree/master/LICENSE.md
00016  */
00017 
00018 #pragma once
00019 
00020 #include <map>
00021 #include <diagnostic_updater/diagnostic_updater.h>
00022 #include <mavconn/interface.h>
00023 #include <mavros/mavros_uas.h>
00024 
00025 namespace mavplugin {
00026 using mavros::UAS;
00027 typedef std::lock_guard<std::recursive_mutex> lock_guard;
00028 typedef std::unique_lock<std::recursive_mutex> unique_lock;
00029 
00033 #define MESSAGE_HANDLER(_message_id, _class_method_ptr) \
00034         { _message_id, boost::bind(_class_method_ptr, this, _1, _2, _3) }
00035 
00039 class MavRosPlugin
00040 {
00041 private:
00042         MavRosPlugin(const MavRosPlugin&) = delete;
00043 
00044 public:
00045         typedef boost::function<void (const mavlink_message_t *msg, uint8_t sysid, uint8_t compid)> message_handler;
00046         typedef std::map<uint8_t, message_handler> message_map;
00047         // pluginlib return boost::shared_ptr
00048         typedef boost::shared_ptr<MavRosPlugin> Ptr;
00049         typedef boost::shared_ptr<MavRosPlugin const> ConstPtr;
00050 
00051         virtual ~MavRosPlugin() {};
00052 
00058         virtual void initialize(UAS &uas) = 0;
00059 
00063         virtual const message_map get_rx_handlers() = 0;
00064 
00065 protected:
00070         MavRosPlugin() {};
00071 };
00072 };      // namespace mavplugin


mavros
Author(s): Vladimir Ermakov
autogenerated on Thu Feb 9 2017 04:00:17