QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
Wire Namespace Reference

Namespaces

namespace  detail
 

Classes

struct  Field
 
struct  Layout
 
struct  Layout< SBF::BlockHeader >
 
struct  Layout< SBF::PVTGeodetic >
 
struct  Layout< UBX::Ack >
 
struct  Layout< UBX::CfgMsg >
 
struct  Layout< UBX::CfgMsgRates >
 
struct  Layout< UBX::CfgNav5 >
 
struct  Layout< UBX::CfgPrt >
 
struct  Layout< UBX::CfgRate >
 
struct  Layout< UBX::CfgTmode3 >
 
struct  Layout< UBX::MonHw >
 
struct  Layout< UBX::MonRf >
 
struct  Layout< UBX::MonRfBlock >
 
struct  Layout< UBX::MonVer >
 
struct  Layout< UBX::MonVerExtension >
 
struct  Layout< UBX::NavDop >
 
struct  Layout< UBX::NavHpposllh >
 
struct  Layout< UBX::NavPvt >
 
struct  Layout< UBX::NavSat >
 
struct  Layout< UBX::NavSatSatellite >
 
struct  Layout< UBX::NavStatus >
 
struct  Layout< UBX::NavSvin >
 
struct  Layout< UBX::NavSvinfo >
 
struct  Layout< UBX::NavSvinfoChannel >
 
struct  Layout< UBX::SecSig >
 

Concepts

concept  Record
 

Functions

template<Record T>
constexpr T decode (std::span< const uint8_t > bytes, std::size_t offset=0)
 Decodes the record at offset. Fields whose bytes are unavailable decode as zero.
 
template<Record T>
constexpr std::array< uint8_t, SIZE< T > > encode (const T &value)
 

Variables

template<Record T>
constexpr std::size_t SIZE = Layout<T>::SIZE
 
template<Record T>
constexpr bool VALID_LAYOUT
 Every field belongs to T, fits within SIZE<T> and overlaps no other field.
 

Detailed Description

Table-driven little-endian records. A record specializes Layout<T> with its wire SIZE and a FIELDS tuple of Field<&T::member, offset>; members are scalars, records or fixed arrays of either. Bytes without a field are skipped on decode and zero on encode.

Function Documentation

◆ decode()

template<Record T>
constexpr T Wire::decode ( std::span< const uint8_t >  bytes,
std::size_t  offset = 0 
)
constexpr

Decodes the record at offset. Fields whose bytes are unavailable decode as zero.

Definition at line 128 of file WireFields.h.

References Wire::detail::read().

◆ encode()

template<Record T>
constexpr std::array< uint8_t, SIZE< T > > Wire::encode ( const T &  value)
constexpr

Definition at line 136 of file WireFields.h.

References Wire::detail::write().

Referenced by UBX::Plan::legacyPorts().

Variable Documentation

◆ SIZE

template<Record T>
constexpr std::size_t Wire::SIZE = Layout<T>::SIZE
inlineconstexpr

Definition at line 28 of file WireFields.h.

◆ VALID_LAYOUT

template<Record T>
constexpr bool Wire::VALID_LAYOUT
inlineconstexpr
Initial value:
= std::apply(
[](auto... field) {
const std::array<std::size_t, sizeof...(field)> begin{decltype(field)::OFFSET...};
const std::array<std::size_t, sizeof...(field)> end{(decltype(field)::OFFSET + decltype(field)::SIZE)...};
for (std::size_t i = 0; i < begin.size(); ++i) {
if (end[i] > SIZE<T>) {
return false;
}
for (std::size_t j = 0; j < i; ++j) {
if (begin[i] < end[j] && begin[j] < end[i]) {
return false;
}
}
}
return (std::same_as<typename decltype(field)::Class, T> && ...);
},
Layout<T>::FIELDS)

Every field belongs to T, fits within SIZE<T> and overlaps no other field.

Definition at line 67 of file WireFields.h.