ardupilot/libraries/AP_Common/AP_FWVersion.h
Patrick José Pereira adda695630 AP_Common: Update AP_FWVersion struct to be used with binary parsers
- Add an uint64_t header to allow easy detection of struct
- Add an uint16_t version
    - MSB is for major release, compatibility break
    - LSB for minor version, no compatibility break
- Add pointer size variable to allow decode of pointers
- Add vehicle type information
- Add board type and subtype to allow hardware identification
- Set type of fw_type to uint8_t since enum is declared as int
- Organize struct to be packed inside 32bits system

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2020-10-07 19:32:12 +11:00

46 lines
1.1 KiB
C++

#pragma once
#include <stdint.h>
#include <GCS_MAVLink/GCS_MAVLink.h>
class PACKED AP_FWVersion {
public:
/**
* @brief Struct to hold infomation about the software version struct
*
*/
// First 7 MSBs are a start sequence, LSB is a checksum
const uint64_t header;
// MSB (major version breaks compatibility), LSB (minor version no compatibility break)
const uint16_t header_version;
// Pointer size to extract pointer values
const uint8_t pointer_size;
const uint8_t reserved; // padding
const uint8_t vehicle_type;
const uint8_t board_type;
const uint16_t board_subtype;
const uint8_t major;
const uint8_t minor;
const uint8_t patch;
const uint8_t fw_type; /*FIRMWARE_VERSION_TYPE*/
const uint32_t os_sw_version;
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;
static const AP_FWVersion &get_fwverz() { return fwver; }
private:
static const AP_FWVersion fwver;
};
namespace AP {
const AP_FWVersion &fwversion();
};