MIP_SDK
latest-2-g34f3e39
MicroStrain Communications Library for embedded systems
|
Go to the documentation of this file.
8 #if __cpp_impl_three_way_comparison
10 #endif // __cpp_impl_three_way_comparison
11 #if __cpp_lib_string_view >= 201606L
12 #include <string_view>
13 #endif // __cpp_lib_string_view >= 201606L
38 bool isNull()
const {
return m_version == 0; }
44 uint16_t
asU16()
const {
return m_version; }
45 uint16_t&
asU16() {
return m_version; }
49 uint8_t
major()
const {
return uint8_t(m_version / 1000); }
50 uint8_t
minor()
const {
return (m_version / 100) % 10; }
51 uint8_t
patch()
const {
return m_version % 100; }
55 #ifndef __cpp_impl_three_way_comparison
60 #else // __cpp_impl_three_way_comparison
64 return std::partial_ordering::unordered;
66 return std::partial_ordering(m_version <=> other.m_version);
68 #endif // !__cpp_impl_three_way_comparison
70 void toString(
char* buffer,
size_t buffer_size)
const;
71 bool fromString(
const char* str,
size_t length=-1);
74 #if __cpp_lib_string_view >= 201606L
76 #endif // __cpp_lib_string_view >= 201606L
79 uint16_t m_version = 0;
bool isDevVersion() const
Definition: firmware_version.hpp:40
A collection of C++ classes and functions covering the full mip api.
Definition: commands_3dm.c:11
FirmwareVersion()=default
FirmwareVersion(uint16_t version)
Definition: firmware_version.hpp:32
Represents the device firmware version.
Definition: firmware_version.hpp:27
uint16_t asU16() const
Definition: firmware_version.hpp:44
std::string toString() const
Convert a FirmwareVersion to a string separated by periods.
Definition: firmware_version.cpp:74
bool operator<=(FirmwareVersion other) const
Definition: firmware_version.hpp:56
uint8_t patch() const
Definition: firmware_version.hpp:51
bool fromString(const char *str, size_t length=-1)
Reads a standard-format string (X.Y.ZZ\0 or XYZZ\0).
Definition: firmware_version.cpp:31
bool operator==(FirmwareVersion other) const
Definition: firmware_version.hpp:53
uint8_t major() const
Definition: firmware_version.hpp:49
uint16_t & asU16()
Definition: firmware_version.hpp:45
void fromParts(uint8_t major, uint8_t minor, uint8_t patch)
Definition: firmware_version.hpp:47
bool operator>=(FirmwareVersion other) const
Definition: firmware_version.hpp:57
bool operator!=(FirmwareVersion other) const
Definition: firmware_version.hpp:54
FirmwareVersion & operator=(uint16_t version)
Definition: firmware_version.hpp:36
bool isReleaseVersion() const
Definition: firmware_version.hpp:41
bool operator>(FirmwareVersion other) const
Definition: firmware_version.hpp:59
FirmwareVersion(uint8_t major, uint8_t minor, uint8_t patch)
Definition: firmware_version.hpp:31
bool isSpecialVersion() const
Definition: firmware_version.hpp:42
uint8_t minor() const
Definition: firmware_version.hpp:50
bool isNull() const
Definition: firmware_version.hpp:38
FirmwareVersion & operator=(const FirmwareVersion &)=default
bool isValid() const
Definition: firmware_version.hpp:39
bool operator<(FirmwareVersion other) const
Definition: firmware_version.hpp:58