Browse Source

AP_ADSB: add static create method

mission-4.1.18
Lucas De Marchi 8 years ago committed by Francisco Ferreira
parent
commit
cce51ec1c3
  1. 26
      libraries/AP_ADSB/AP_ADSB.h

26
libraries/AP_ADSB/AP_ADSB.h

@ -29,22 +29,23 @@ @@ -29,22 +29,23 @@
#include <AP_Buffer/AP_Buffer.h>
class AP_ADSB
{
class AP_ADSB {
public:
static AP_ADSB create(const AP_AHRS &ahrs) {
return AP_ADSB{ahrs};
}
constexpr AP_ADSB(AP_ADSB &&other) = default;
/* Do not allow copies */
AP_ADSB(const AP_ADSB &other) = delete;
AP_ADSB &operator=(const AP_ADSB&) = delete;
struct adsb_vehicle_t {
mavlink_adsb_vehicle_t info; // the whole mavlink struct with all the juicy details. sizeof() == 38
uint32_t last_update_ms; // last time this was refreshed, allows timeouts
};
// Constructor
AP_ADSB(const AP_AHRS &ahrs) :
_ahrs(ahrs)
{
AP_Param::setup_object_defaults(this, var_info);
}
// for holding parameters
static const struct AP_Param::GroupInfo var_info[];
@ -75,6 +76,11 @@ public: @@ -75,6 +76,11 @@ public:
void handle_message(const mavlink_channel_t chan, const mavlink_message_t* msg);
private:
AP_ADSB(const AP_AHRS &ahrs)
: _ahrs(ahrs)
{
AP_Param::setup_object_defaults(this, var_info);
}
// initialize _vehicle_list
void init();

Loading…
Cancel
Save