Browse Source

AP_Common: AP_FWVersion: create singleton

master
Peter Barker 7 years ago committed by Francisco Ferreira
parent
commit
6ba1678c5e
  1. 10
      libraries/AP_Common/AP_FWVersion.cpp
  2. 19
      libraries/AP_Common/AP_FWVersion.h

10
libraries/AP_Common/AP_FWVersion.cpp

@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
#include "AP_FWVersion.h"
namespace AP {
const AP_FWVersion &fwversion()
{
return AP_FWVersion::get_fwverz();
}
}

19
libraries/AP_Common/AP_FWVersion.h

@ -3,13 +3,28 @@ @@ -3,13 +3,28 @@
#include <stdint.h>
#include <GCS_MAVLink/GCS_MAVLink.h>
typedef struct {
class AP_FWVersion {
public:
uint8_t major;
uint8_t minor;
uint8_t patch;
FIRMWARE_VERSION_TYPE fw_type;
const char *fw_string;
const char *fw_hash_str;
const char *middleware_name;
const char *middleware_hash_str;
const char *os_name;
const char *os_hash_str;
} AP_FWVersion;
static const AP_FWVersion &get_fwverz() { return fwver; }
private:
static const AP_FWVersion fwver;
};
namespace AP {
const AP_FWVersion &fwversion();
};

Loading…
Cancel
Save