lanyard.flight.FlightMode.1.0¶
The commanded flight mode of the vehicle.
| Full name | lanyard.flight.FlightMode |
| Version | 1.0 |
| Kind | Message |
| Fixed port ID | none (nested type) |
| Least supported transport | unspecified |
Wire layout¶
| Section | Extent (bytes) | Max serialized (bytes) |
|---|---|---|
| Message | 1 | 1 |
A sealed type reports its extent as its exact serialised size; a delimited type reports the declared @extent, which bounds what a reader must be prepared to receive.
Definition¶
# The commanded flight mode of the vehicle.
#
# This is a nested type: it has no fixed port identifier and is never
# published on its own. It exists so that the mode enumeration is
# defined exactly once and embedded by value into every message that
# needs it, rather than being redeclared as a bare integer in each.
#
# The DSDL idiom for an enumeration is a value field followed by a set
# of constants of the same type. Constants are compile-time only -- they
# occupy no bits on the wire -- and every backend surfaces them as named
# values in the generated code, together with the documentation attached
# here.
uint8 value
# The active mode, one of the constants below. Values not listed are
# reserved and shall be treated by a receiver as equivalent to FAILSAFE.
uint8 MANUAL = 0
# Direct passthrough of pilot stick positions to the mixer. No
# stabilisation.
uint8 STABILIZE = 1
# Attitude is stabilised; stick position commands lean angle. Altitude
# is not held.
uint8 ALTITUDE_HOLD = 2
# As STABILIZE, plus barometric altitude hold when the throttle stick is
# centered.
uint8 POSITION_HOLD = 3
# Full three-axis position hold using the navigation solution. Requires
# a valid GNSS fix.
uint8 AUTO_MISSION = 4
# The vehicle is flying a stored mission plan without pilot input.
uint8 RETURN_TO_LAUNCH = 5
# The vehicle is navigating autonomously back to its recorded launch
# position.
uint8 LAND = 6
# Controlled descent to touchdown at the current horizontal position.
uint8 FAILSAFE = 7
# The flight controller has lost a resource it requires (link, GNSS, or
# power margin) and is running its configured contingency behaviour.
@sealed
Generated code¶
Declaration excerpts only -- the serialisation bodies are omitted for length. Build the showroom target for the complete output in every language and profile.
C¶
/* The commanded flight mode of the vehicle. */
/* */
/* This is a nested type: it has no fixed port identifier and is never */
/* published on its own. It exists so that the mode enumeration is */
/* defined exactly once and embedded by value into every message that */
/* needs it, rather than being redeclared as a bare integer in each. */
/* */
/* The DSDL idiom for an enumeration is a value field followed by a set */
/* of constants of the same type. Constants are compile-time only -- they */
/* occupy no bits on the wire -- and every backend surfaces them as named */
/* values in the generated code, together with the documentation attached */
/* here. */
typedef struct lanyard__flight__FlightMode_1_0 {
/* The active mode, one of the constants below. Values not listed are */
/* reserved and shall be treated by a receiver as equivalent to FAILSAFE. */
uint8_t value;
} lanyard__flight__FlightMode_1_0;
C++ (std)¶
// The commanded flight mode of the vehicle.
//
// This is a nested type: it has no fixed port identifier and is never
// published on its own. It exists so that the mode enumeration is
// defined exactly once and embedded by value into every message that
// needs it, rather than being redeclared as a bare integer in each.
//
// The DSDL idiom for an enumeration is a value field followed by a set
// of constants of the same type. Constants are compile-time only -- they
// occupy no bits on the wire -- and every backend surfaces them as named
// values in the generated code, together with the documentation attached
// here.
struct FlightMode_1_0 {
// The active mode, one of the constants below. Values not listed are
// reserved and shall be treated by a receiver as equivalent to FAILSAFE.
std::uint8_t value{};
static constexpr const char* FULL_NAME = "lanyard.flight.FlightMode";
static constexpr bool IS_DEPRECATED = false;
static constexpr const char* FULL_NAME_AND_VERSION = "lanyard.flight.FlightMode.1.0";
static constexpr std::size_t EXTENT_BYTES = 1U;
static constexpr std::size_t SERIALIZATION_BUFFER_SIZE_BYTES = 1U;
static constexpr bool WIRE_FLAT = true;
static constexpr const char* WIRE_FLAT_REASON = "flat";
static constexpr bool HOST_IMAGE = true;
static constexpr const char* HOST_IMAGE_REASON = "flat";
#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__)
# if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__
# error "FlightMode_1_0: its serialisation moves the object as the wire's bytes, which holds only on a little-endian host. Regenerate with --target-triple naming this target."
# endif
#elif !(defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM) || defined(_M_ARM64) || defined(_M_ARM64EC)))
# error "FlightMode_1_0: its serialisation moves the object as the wire's bytes, which holds only on a little-endian host, and this compiler states no byte order. Regenerate with --target-triple naming this target."
#endif
static constexpr bool HAS_FIXED_PORT_ID = false;
// Direct passthrough of pilot stick positions to the mixer. No
// stabilisation.
static constexpr auto MANUAL = 0;
// Attitude is stabilised; stick position commands lean angle. Altitude
// is not held.
static constexpr auto STABILIZE = 1;
// As STABILIZE, plus barometric altitude hold when the throttle stick is
// centered.
static constexpr auto ALTITUDE_HOLD = 2;
// Full three-axis position hold using the navigation solution. Requires
// a valid GNSS fix.
static constexpr auto POSITION_HOLD = 3;
// The vehicle is flying a stored mission plan without pilot input.
static constexpr auto AUTO_MISSION = 4;
// The vehicle is navigating autonomously back to its recorded launch
// position.
static constexpr auto RETURN_TO_LAUNCH = 5;
// Controlled descent to touchdown at the current horizontal position.
static constexpr auto LAND = 6;
// The flight controller has lost a resource it requires (link, GNSS, or
// power margin) and is running its configured contingency behaviour.
static constexpr auto FAILSAFE = 7;
LLVMDSDL_NODISCARD inline std::int8_t serialize(std::uint8_t* buffer, std::size_t* inout_buffer_size_bytes) const {
return FlightMode_1_0_serialize_(this, buffer, inout_buffer_size_bytes);
}
LLVMDSDL_NODISCARD inline std::int8_t deserialize(const std::uint8_t* buffer, std::size_t* inout_buffer_size_bytes) {
return FlightMode_1_0_deserialize_(this, buffer, inout_buffer_size_bytes);
}
static std::uint8_t get_value(const std::uint8_t* const buffer, const std::size_t buffer_size_bytes)
{
const std::uint8_t* const buf = ((buffer != nullptr) ? buffer : reinterpret_cast<const std::uint8_t*>(""));
const std::uint64_t value = static_cast<std::uint64_t>(dsdl_runtime_get_u8(buf, static_cast<std::size_t>(buffer_size_bytes), static_cast<std::size_t>(0ULL), 8U));
const std::uint64_t value_2 = mlir_llvmdsdl_plan_scalar_unsigned_lanyard_flight_FlightMode_1_0_0_deser(value);
return static_cast<std::uint8_t>(value_2);
}
static std::int8_t set_value(std::uint8_t* const buffer, const std::size_t buffer_size_bytes, const std::uint8_t member_value)
{
const std::uint64_t value = static_cast<std::uint64_t>(member_value);
const bool is_null = (buffer == nullptr);
const std::uint64_t v0 = (buffer_size_bytes * 8ULL);
const bool v1 = (v0 >= 8ULL);
const std::int8_t v2 = static_cast<std::int8_t>(v1 ? static_cast<std::int8_t>(0) : static_cast<std::int8_t>(-3));
const std::int8_t v3 = static_cast<std::int8_t>(is_null ? static_cast<std::int8_t>(-2) : v2);
const bool v4 = (v3 == static_cast<std::int8_t>(0));
std::int8_t err{};
if (v4) {
const std::uint64_t value_2 = mlir_llvmdsdl_plan_scalar_unsigned_lanyard_flight_FlightMode_1_0_0_ser(value);
const std::int8_t err_2 = dsdl_runtime_set_uxx(buffer, static_cast<std::size_t>(buffer_size_bytes), static_cast<std::size_t>(0ULL), value_2, 8U);
err = err_2;
} else {
err = v3;
}
return err;
}
};
C++ (pmr)¶
Polymorphic-allocator profile: variable-length fields route through std::pmr.
// The commanded flight mode of the vehicle.
//
// This is a nested type: it has no fixed port identifier and is never
// published on its own. It exists so that the mode enumeration is
// defined exactly once and embedded by value into every message that
// needs it, rather than being redeclared as a bare integer in each.
//
// The DSDL idiom for an enumeration is a value field followed by a set
// of constants of the same type. Constants are compile-time only -- they
// occupy no bits on the wire -- and every backend surfaces them as named
// values in the generated code, together with the documentation attached
// here.
struct FlightMode_1_0 {
// The active mode, one of the constants below. Values not listed are
// reserved and shall be treated by a receiver as equivalent to FAILSAFE.
std::uint8_t value{};
FlightMode_1_0() = default;
explicit FlightMode_1_0(::llvmdsdl::cpp::MemoryResource*) {}
void set_memory_resource(::llvmdsdl::cpp::MemoryResource*) {}
static constexpr const char* FULL_NAME = "lanyard.flight.FlightMode";
static constexpr bool IS_DEPRECATED = false;
static constexpr const char* FULL_NAME_AND_VERSION = "lanyard.flight.FlightMode.1.0";
static constexpr std::size_t EXTENT_BYTES = 1U;
static constexpr std::size_t SERIALIZATION_BUFFER_SIZE_BYTES = 1U;
static constexpr bool WIRE_FLAT = true;
static constexpr const char* WIRE_FLAT_REASON = "flat";
static constexpr bool HOST_IMAGE = true;
static constexpr const char* HOST_IMAGE_REASON = "flat";
#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__)
# if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__
# error "FlightMode_1_0: its serialisation moves the object as the wire's bytes, which holds only on a little-endian host. Regenerate with --target-triple naming this target."
# endif
#elif !(defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM) || defined(_M_ARM64) || defined(_M_ARM64EC)))
# error "FlightMode_1_0: its serialisation moves the object as the wire's bytes, which holds only on a little-endian host, and this compiler states no byte order. Regenerate with --target-triple naming this target."
#endif
static constexpr bool HAS_FIXED_PORT_ID = false;
// Direct passthrough of pilot stick positions to the mixer. No
// stabilisation.
static constexpr auto MANUAL = 0;
// Attitude is stabilised; stick position commands lean angle. Altitude
// is not held.
static constexpr auto STABILIZE = 1;
// As STABILIZE, plus barometric altitude hold when the throttle stick is
// centered.
static constexpr auto ALTITUDE_HOLD = 2;
// Full three-axis position hold using the navigation solution. Requires
// a valid GNSS fix.
static constexpr auto POSITION_HOLD = 3;
// The vehicle is flying a stored mission plan without pilot input.
static constexpr auto AUTO_MISSION = 4;
// The vehicle is navigating autonomously back to its recorded launch
// position.
static constexpr auto RETURN_TO_LAUNCH = 5;
// Controlled descent to touchdown at the current horizontal position.
static constexpr auto LAND = 6;
// The flight controller has lost a resource it requires (link, GNSS, or
// power margin) and is running its configured contingency behaviour.
static constexpr auto FAILSAFE = 7;
LLVMDSDL_NODISCARD inline std::int8_t serialize(std::uint8_t* buffer, std::size_t* inout_buffer_size_bytes) const {
return FlightMode_1_0_serialize_(this, buffer, inout_buffer_size_bytes, nullptr);
}
LLVMDSDL_NODISCARD inline std::int8_t deserialize(const std::uint8_t* buffer, std::size_t* inout_buffer_size_bytes) {
return FlightMode_1_0_deserialize_(this, buffer, inout_buffer_size_bytes, nullptr);
}
LLVMDSDL_NODISCARD inline std::int8_t serialize(std::uint8_t* buffer, std::size_t* inout_buffer_size_bytes, ::llvmdsdl::cpp::MemoryResource* memory_resource) const {
return FlightMode_1_0_serialize_(this, buffer, inout_buffer_size_bytes, memory_resource);
}
LLVMDSDL_NODISCARD inline std::int8_t deserialize(const std::uint8_t* buffer, std::size_t* inout_buffer_size_bytes, ::llvmdsdl::cpp::MemoryResource* memory_resource) {
return FlightMode_1_0_deserialize_(this, buffer, inout_buffer_size_bytes, memory_resource);
}
static std::uint8_t get_value(const std::uint8_t* const buffer, const std::size_t buffer_size_bytes)
{
const std::uint8_t* const buf = ((buffer != nullptr) ? buffer : reinterpret_cast<const std::uint8_t*>(""));
const std::uint64_t value = static_cast<std::uint64_t>(dsdl_runtime_get_u8(buf, static_cast<std::size_t>(buffer_size_bytes), static_cast<std::size_t>(0ULL), 8U));
const std::uint64_t value_2 = mlir_llvmdsdl_plan_scalar_unsigned_lanyard_flight_FlightMode_1_0_0_deser(value);
return static_cast<std::uint8_t>(value_2);
}
static std::int8_t set_value(std::uint8_t* const buffer, const std::size_t buffer_size_bytes, const std::uint8_t member_value)
{
const std::uint64_t value = static_cast<std::uint64_t>(member_value);
const bool is_null = (buffer == nullptr);
const std::uint64_t v0 = (buffer_size_bytes * 8ULL);
const bool v1 = (v0 >= 8ULL);
const std::int8_t v2 = static_cast<std::int8_t>(v1 ? static_cast<std::int8_t>(0) : static_cast<std::int8_t>(-3));
const std::int8_t v3 = static_cast<std::int8_t>(is_null ? static_cast<std::int8_t>(-2) : v2);
const bool v4 = (v3 == static_cast<std::int8_t>(0));
std::int8_t err{};
if (v4) {
const std::uint64_t value_2 = mlir_llvmdsdl_plan_scalar_unsigned_lanyard_flight_FlightMode_1_0_0_ser(value);
const std::int8_t err_2 = dsdl_runtime_set_uxx(buffer, static_cast<std::size_t>(buffer_size_bytes), static_cast<std::size_t>(0ULL), value_2, 8U);
err = err_2;
} else {
err = v3;
}
return err;
}
};
C++ (autosar)¶
AUTOSAR C++14 subset profile.
// The commanded flight mode of the vehicle.
//
// This is a nested type: it has no fixed port identifier and is never
// published on its own. It exists so that the mode enumeration is
// defined exactly once and embedded by value into every message that
// needs it, rather than being redeclared as a bare integer in each.
//
// The DSDL idiom for an enumeration is a value field followed by a set
// of constants of the same type. Constants are compile-time only -- they
// occupy no bits on the wire -- and every backend surfaces them as named
// values in the generated code, together with the documentation attached
// here.
struct FlightMode_1_0 {
// The active mode, one of the constants below. Values not listed are
// reserved and shall be treated by a receiver as equivalent to FAILSAFE.
std::uint8_t value{};
static constexpr const char* FULL_NAME = "lanyard.flight.FlightMode";
static constexpr bool IS_DEPRECATED = false;
static constexpr const char* FULL_NAME_AND_VERSION = "lanyard.flight.FlightMode.1.0";
static constexpr std::size_t EXTENT_BYTES = 1U;
static constexpr std::size_t SERIALIZATION_BUFFER_SIZE_BYTES = 1U;
static constexpr bool WIRE_FLAT = true;
static constexpr const char* WIRE_FLAT_REASON = "flat";
static constexpr bool HOST_IMAGE = true;
static constexpr const char* HOST_IMAGE_REASON = "flat";
#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__)
# if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__
# error "FlightMode_1_0: its serialisation moves the object as the wire's bytes, which holds only on a little-endian host. Regenerate with --target-triple naming this target."
# endif
#elif !(defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM) || defined(_M_ARM64) || defined(_M_ARM64EC)))
# error "FlightMode_1_0: its serialisation moves the object as the wire's bytes, which holds only on a little-endian host, and this compiler states no byte order. Regenerate with --target-triple naming this target."
#endif
static constexpr bool HAS_FIXED_PORT_ID = false;
// Direct passthrough of pilot stick positions to the mixer. No
// stabilisation.
static constexpr auto MANUAL = 0;
// Attitude is stabilised; stick position commands lean angle. Altitude
// is not held.
static constexpr auto STABILIZE = 1;
// As STABILIZE, plus barometric altitude hold when the throttle stick is
// centered.
static constexpr auto ALTITUDE_HOLD = 2;
// Full three-axis position hold using the navigation solution. Requires
// a valid GNSS fix.
static constexpr auto POSITION_HOLD = 3;
// The vehicle is flying a stored mission plan without pilot input.
static constexpr auto AUTO_MISSION = 4;
// The vehicle is navigating autonomously back to its recorded launch
// position.
static constexpr auto RETURN_TO_LAUNCH = 5;
// Controlled descent to touchdown at the current horizontal position.
static constexpr auto LAND = 6;
// The flight controller has lost a resource it requires (link, GNSS, or
// power margin) and is running its configured contingency behaviour.
static constexpr auto FAILSAFE = 7;
LLVMDSDL_NODISCARD inline std::int8_t serialize(std::uint8_t* buffer, std::size_t* inout_buffer_size_bytes) const {
return FlightMode_1_0_serialize_(this, buffer, inout_buffer_size_bytes);
}
LLVMDSDL_NODISCARD inline std::int8_t deserialize(const std::uint8_t* buffer, std::size_t* inout_buffer_size_bytes) {
return FlightMode_1_0_deserialize_(this, buffer, inout_buffer_size_bytes);
}
static std::uint8_t get_value(const std::uint8_t* const buffer, const std::size_t buffer_size_bytes)
{
const std::uint8_t* const buf = ((buffer != nullptr) ? buffer : reinterpret_cast<const std::uint8_t*>(""));
const std::uint64_t value = static_cast<std::uint64_t>(dsdl_runtime_get_u8(buf, static_cast<std::size_t>(buffer_size_bytes), static_cast<std::size_t>(0ULL), 8U));
const std::uint64_t value_2 = mlir_llvmdsdl_plan_scalar_unsigned_lanyard_flight_FlightMode_1_0_0_deser(value);
return static_cast<std::uint8_t>(value_2);
}
static std::int8_t set_value(std::uint8_t* const buffer, const std::size_t buffer_size_bytes, const std::uint8_t member_value)
{
const std::uint64_t value = static_cast<std::uint64_t>(member_value);
const bool is_null = (buffer == nullptr);
const std::uint64_t v0 = (buffer_size_bytes * 8ULL);
const bool v1 = (v0 >= 8ULL);
const std::int8_t v2 = static_cast<std::int8_t>(v1 ? static_cast<std::int8_t>(0) : static_cast<std::int8_t>(-3));
const std::int8_t v3 = static_cast<std::int8_t>(is_null ? static_cast<std::int8_t>(-2) : v2);
const bool v4 = (v3 == static_cast<std::int8_t>(0));
std::int8_t err{};
if (v4) {
const std::uint64_t value_2 = mlir_llvmdsdl_plan_scalar_unsigned_lanyard_flight_FlightMode_1_0_0_ser(value);
const std::int8_t err_2 = dsdl_runtime_set_uxx(buffer, static_cast<std::size_t>(buffer_size_bytes), static_cast<std::size_t>(0ULL), value_2, 8U);
err = err_2;
} else {
err = v3;
}
return err;
}
};
Rust (std)¶
/// The commanded flight mode of the vehicle.
///
/// This is a nested type: it has no fixed port identifier and is never
/// published on its own. It exists so that the mode enumeration is
/// defined exactly once and embedded by value into every message that
/// needs it, rather than being redeclared as a bare integer in each.
///
/// The DSDL idiom for an enumeration is a value field followed by a set
/// of constants of the same type. Constants are compile-time only -- they
/// occupy no bits on the wire -- and every backend surfaces them as named
/// values in the generated code, together with the documentation attached
/// here.
#[repr(C)]
#[derive(Clone, Debug, PartialEq)]
pub struct lanyard_flight_FlightMode_1_0 {
/// The active mode, one of the constants below. Values not listed are
/// reserved and shall be treated by a receiver as equivalent to FAILSAFE.
pub value: u8,
}
Rust (no-std)¶
no_std + alloc profile, as a flight-controller firmware build would use.
/// The commanded flight mode of the vehicle.
///
/// This is a nested type: it has no fixed port identifier and is never
/// published on its own. It exists so that the mode enumeration is
/// defined exactly once and embedded by value into every message that
/// needs it, rather than being redeclared as a bare integer in each.
///
/// The DSDL idiom for an enumeration is a value field followed by a set
/// of constants of the same type. Constants are compile-time only -- they
/// occupy no bits on the wire -- and every backend surfaces them as named
/// values in the generated code, together with the documentation attached
/// here.
#[repr(C)]
#[derive(Clone, Debug, PartialEq)]
pub struct lanyard_flight_FlightMode_1_0 {
/// The active mode, one of the constants below. Values not listed are
/// reserved and shall be treated by a receiver as equivalent to FAILSAFE.
pub value: u8,
}
Go¶
// The commanded flight mode of the vehicle.
//
// This is a nested type: it has no fixed port identifier and is never
// published on its own. It exists so that the mode enumeration is
// defined exactly once and embedded by value into every message that
// needs it, rather than being redeclared as a bare integer in each.
//
// The DSDL idiom for an enumeration is a value field followed by a set
// of constants of the same type. Constants are compile-time only -- they
// occupy no bits on the wire -- and every backend surfaces them as named
// values in the generated code, together with the documentation attached
// here.
type FlightMode_1_0 struct {
// The active mode, one of the constants below. Values not listed are
// reserved and shall be treated by a receiver as equivalent to FAILSAFE.
Value uint8
}
TypeScript¶
// The commanded flight mode of the vehicle.
//
// This is a nested type: it has no fixed port identifier and is never
// published on its own. It exists so that the mode enumeration is
// defined exactly once and embedded by value into every message that
// needs it, rather than being redeclared as a bare integer in each.
//
// The DSDL idiom for an enumeration is a value field followed by a set
// of constants of the same type. Constants are compile-time only -- they
// occupy no bits on the wire -- and every backend surfaces them as named
// values in the generated code, together with the documentation attached
// here.
export interface FlightMode_1_0 {
// The active mode, one of the constants below. Values not listed are
// reserved and shall be treated by a receiver as equivalent to FAILSAFE.
value: number;
}
Python¶
# The commanded flight mode of the vehicle.
#
# This is a nested type: it has no fixed port identifier and is never
# published on its own. It exists so that the mode enumeration is
# defined exactly once and embedded by value into every message that
# needs it, rather than being redeclared as a bare integer in each.
#
# The DSDL idiom for an enumeration is a value field followed by a set
# of constants of the same type. Constants are compile-time only -- they
# occupy no bits on the wire -- and every backend surfaces them as named
# values in the generated code, together with the documentation attached
# here.
@dataclass(slots=True)
class FlightMode_1_0:
# The active mode, one of the constants below. Values not listed are
# reserved and shall be treated by a receiver as equivalent to FAILSAFE.
value: int = 0
Every build recipe compiles this definition along with the rest of the namespace.