lanyard.health.LegacyBatteryPoll.1.0¶
Read the state of one battery pack. DEPRECATED -- use the BatteryStatus.2.0 message instead.
| Full name | lanyard.health.LegacyBatteryPoll |
| Version | 1.0 |
| Kind | Service |
| Fixed port ID | 258 |
| Least supported transport | Classic CAN |
Wire layout¶
| Section | Extent (bytes) | Max serialized (bytes) |
|---|---|---|
| Request | 1 | 1 |
| Response | 6 | 6 |
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¶
# Read the state of one battery pack. DEPRECATED -- use the
# BatteryStatus.2.0 message instead.
#
# LEAST SUPPORTED TRANSPORT: Classic CAN.
#
# WHY IT IS STILL HERE: this is the showroom's deprecation example. The
# @deprecated directive marks a definition as scheduled for removal
# without deleting it, so that nodes still speaking it keep working
# while integrators migrate.
#
# WHAT THE GENERATED CODE CARRIES: every backend appends a `Deprecated:
# ...` notice to this comment block and emits an IS_DEPRECATED constant,
# so the marking is visible to a developer who never opens the DSDL. Go
# picks it up as a real deprecation (its toolchain keys on a
# `Deprecated: ` doc paragraph), and TypeScript additionally gets a `/**
# @deprecated */` JSDoc block, which is what tsc and editors read.
#
# C, C++, and Rust go further and add `__attribute__((deprecated))`,
# `[[deprecated]]`, and `#[deprecated]` respectively, so the compiler
# says it too. That is the default: a deprecation only a comment-reader
# can see is one nobody acts on. Each generated file silences the
# diagnostic across its own body, so including these headers is clean
# under -Werror and only your code naming the type is flagged. `dsdlc
# --no-deprecation-attributes` drops the attributes for a -Werror build
# that has nowhere to migrate to yet.
#
# Note the placement: @deprecated appears in the request section, ahead
# of the first attribute, and applies to the whole service. The language
# accepts it nowhere else -- not after a field, and not in the response
# section.
#
# MIGRATION: subscribe to lanyard.health.BatteryStatus.2.0 (port 6251),
# which the pack publishes at 2 Hz on its own. Polling cost the bus a
# request and a response per pack per interval and gave the flight
# controller a scheduling problem it did not need.
@deprecated
uint8 battery_index
# Zero-based index of the pack to read.
@sealed
---
uint16 voltage_mv
# Pack terminal voltage in millivolts.
int16 current_ca
# Pack current in centiamperes. Positive is discharge.
uint8 remaining_pct
# State of charge as a percentage, 0 to 100.
int8 temperature_c
# Hottest cell temperature in whole degrees Celsius. Note that the
# replacement message reports temperature in kelvin via the standard SI
# type, so a migration is not a straight field copy.
@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¶
/* Read the state of one battery pack. DEPRECATED -- use the */
/* BatteryStatus.2.0 message instead. */
/* */
/* LEAST SUPPORTED TRANSPORT: Classic CAN. */
/* */
/* WHY IT IS STILL HERE: this is the showroom's deprecation example. The */
/* @deprecated directive marks a definition as scheduled for removal */
/* without deleting it, so that nodes still speaking it keep working */
/* while integrators migrate. */
/* */
/* WHAT THE GENERATED CODE CARRIES: every backend appends a `Deprecated: */
/* ...` notice to this comment block and emits an IS_DEPRECATED constant, */
/* so the marking is visible to a developer who never opens the DSDL. Go */
/* picks it up as a real deprecation (its toolchain keys on a */
/* `Deprecated: ` doc paragraph), and TypeScript additionally gets a `/ ** */
/* @deprecated * /` JSDoc block, which is what tsc and editors read. */
/* */
/* C, C++, and Rust go further and add `__attribute__((deprecated))`, */
/* `[[deprecated]]`, and `#[deprecated]` respectively, so the compiler */
/* says it too. That is the default: a deprecation only a comment-reader */
/* can see is one nobody acts on. Each generated file silences the */
/* diagnostic across its own body, so including these headers is clean */
/* under -Werror and only your code naming the type is flagged. `dsdlc */
/* --no-deprecation-attributes` drops the attributes for a -Werror build */
/* that has nowhere to migrate to yet. */
/* */
/* Note the placement: @deprecated appears in the request section, ahead */
/* of the first attribute, and applies to the whole service. The language */
/* accepts it nowhere else -- not after a field, and not in the response */
/* section. */
/* */
/* MIGRATION: subscribe to lanyard.health.BatteryStatus.2.0 (port 6251), */
/* which the pack publishes at 2 Hz on its own. Polling cost the bus a */
/* request and a response per pack per interval and gave the flight */
/* controller a scheduling problem it did not need. */
/* */
/* Deprecated: lanyard.health.LegacyBatteryPoll.1.0 is marked @deprecated */
/* in its DSDL definition and is scheduled for removal; migrate to a newer */
/* version of this type. */
typedef struct lanyard__health__LegacyBatteryPoll_1_0__Request {
/* Zero-based index of the pack to read. */
uint8_t battery_index;
} lanyard__health__LegacyBatteryPoll_1_0__Request __attribute__((deprecated));
/* Read the state of one battery pack. DEPRECATED -- use the */
/* BatteryStatus.2.0 message instead. */
/* */
/* LEAST SUPPORTED TRANSPORT: Classic CAN. */
/* */
/* WHY IT IS STILL HERE: this is the showroom's deprecation example. The */
/* @deprecated directive marks a definition as scheduled for removal */
/* without deleting it, so that nodes still speaking it keep working */
/* while integrators migrate. */
/* */
/* WHAT THE GENERATED CODE CARRIES: every backend appends a `Deprecated: */
/* ...` notice to this comment block and emits an IS_DEPRECATED constant, */
/* so the marking is visible to a developer who never opens the DSDL. Go */
/* picks it up as a real deprecation (its toolchain keys on a */
/* `Deprecated: ` doc paragraph), and TypeScript additionally gets a `/ ** */
/* @deprecated * /` JSDoc block, which is what tsc and editors read. */
/* */
/* C, C++, and Rust go further and add `__attribute__((deprecated))`, */
/* `[[deprecated]]`, and `#[deprecated]` respectively, so the compiler */
/* says it too. That is the default: a deprecation only a comment-reader */
/* can see is one nobody acts on. Each generated file silences the */
/* diagnostic across its own body, so including these headers is clean */
/* under -Werror and only your code naming the type is flagged. `dsdlc */
/* --no-deprecation-attributes` drops the attributes for a -Werror build */
/* that has nowhere to migrate to yet. */
/* */
/* Note the placement: @deprecated appears in the request section, ahead */
/* of the first attribute, and applies to the whole service. The language */
/* accepts it nowhere else -- not after a field, and not in the response */
/* section. */
/* */
/* MIGRATION: subscribe to lanyard.health.BatteryStatus.2.0 (port 6251), */
/* which the pack publishes at 2 Hz on its own. Polling cost the bus a */
/* request and a response per pack per interval and gave the flight */
/* controller a scheduling problem it did not need. */
/* */
/* Deprecated: lanyard.health.LegacyBatteryPoll.1.0 is marked @deprecated */
/* in its DSDL definition and is scheduled for removal; migrate to a newer */
/* version of this type. */
typedef struct lanyard__health__LegacyBatteryPoll_1_0__Response {
/* Pack terminal voltage in millivolts. */
uint16_t voltage_mv;
/* Pack current in centiamperes. Positive is discharge. */
int16_t current_ca;
/* State of charge as a percentage, 0 to 100. */
uint8_t remaining_pct;
/* Hottest cell temperature in whole degrees Celsius. Note that the */
/* replacement message reports temperature in kelvin via the standard SI */
/* type, so a migration is not a straight field copy. */
int8_t temperature_c;
} lanyard__health__LegacyBatteryPoll_1_0__Response __attribute__((deprecated));
C++ (std)¶
// Read the state of one battery pack. DEPRECATED -- use the
// BatteryStatus.2.0 message instead.
//
// LEAST SUPPORTED TRANSPORT: Classic CAN.
//
// WHY IT IS STILL HERE: this is the showroom's deprecation example. The
// @deprecated directive marks a definition as scheduled for removal
// without deleting it, so that nodes still speaking it keep working
// while integrators migrate.
//
// WHAT THE GENERATED CODE CARRIES: every backend appends a `Deprecated:
// ...` notice to this comment block and emits an IS_DEPRECATED constant,
// so the marking is visible to a developer who never opens the DSDL. Go
// picks it up as a real deprecation (its toolchain keys on a
// `Deprecated: ` doc paragraph), and TypeScript additionally gets a `/**
// @deprecated */` JSDoc block, which is what tsc and editors read.
//
// C, C++, and Rust go further and add `__attribute__((deprecated))`,
// `[[deprecated]]`, and `#[deprecated]` respectively, so the compiler
// says it too. That is the default: a deprecation only a comment-reader
// can see is one nobody acts on. Each generated file silences the
// diagnostic across its own body, so including these headers is clean
// under -Werror and only your code naming the type is flagged. `dsdlc
// --no-deprecation-attributes` drops the attributes for a -Werror build
// that has nowhere to migrate to yet.
//
// Note the placement: @deprecated appears in the request section, ahead
// of the first attribute, and applies to the whole service. The language
// accepts it nowhere else -- not after a field, and not in the response
// section.
//
// MIGRATION: subscribe to lanyard.health.BatteryStatus.2.0 (port 6251),
// which the pack publishes at 2 Hz on its own. Polling cost the bus a
// request and a response per pack per interval and gave the flight
// controller a scheduling problem it did not need.
//
// Deprecated: lanyard.health.LegacyBatteryPoll.1.0 is marked @deprecated
// in its DSDL definition and is scheduled for removal; migrate to a newer
// version of this type.
struct LegacyBatteryPoll_1_0_Request_ {
// Zero-based index of the pack to read.
std::uint8_t battery_index{};
static constexpr const char* FULL_NAME = "lanyard.health.LegacyBatteryPoll.Request";
static constexpr bool IS_DEPRECATED = true;
static constexpr const char* FULL_NAME_AND_VERSION = "lanyard.health.LegacyBatteryPoll.Request.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 "LegacyBatteryPoll_1_0_Request: 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 "LegacyBatteryPoll_1_0_Request: 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
LLVMDSDL_NODISCARD inline std::int8_t serialize(std::uint8_t* buffer, std::size_t* inout_buffer_size_bytes) const {
return LegacyBatteryPoll_1_0_Request_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 LegacyBatteryPoll_1_0_Request_deserialize_(this, buffer, inout_buffer_size_bytes);
}
static std::uint8_t get_battery_index(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_health_LegacyBatteryPoll_1_0_request_0_deser(value);
return static_cast<std::uint8_t>(value_2);
}
static std::int8_t set_battery_index(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_health_LegacyBatteryPoll_1_0_request_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;
}
};
// Read the state of one battery pack. DEPRECATED -- use the
// BatteryStatus.2.0 message instead.
//
// LEAST SUPPORTED TRANSPORT: Classic CAN.
//
// WHY IT IS STILL HERE: this is the showroom's deprecation example. The
// @deprecated directive marks a definition as scheduled for removal
// without deleting it, so that nodes still speaking it keep working
// while integrators migrate.
//
// WHAT THE GENERATED CODE CARRIES: every backend appends a `Deprecated:
// ...` notice to this comment block and emits an IS_DEPRECATED constant,
// so the marking is visible to a developer who never opens the DSDL. Go
// picks it up as a real deprecation (its toolchain keys on a
// `Deprecated: ` doc paragraph), and TypeScript additionally gets a `/**
// @deprecated */` JSDoc block, which is what tsc and editors read.
//
// C, C++, and Rust go further and add `__attribute__((deprecated))`,
// `[[deprecated]]`, and `#[deprecated]` respectively, so the compiler
// says it too. That is the default: a deprecation only a comment-reader
// can see is one nobody acts on. Each generated file silences the
// diagnostic across its own body, so including these headers is clean
// under -Werror and only your code naming the type is flagged. `dsdlc
// --no-deprecation-attributes` drops the attributes for a -Werror build
// that has nowhere to migrate to yet.
//
// Note the placement: @deprecated appears in the request section, ahead
// of the first attribute, and applies to the whole service. The language
// accepts it nowhere else -- not after a field, and not in the response
// section.
//
// MIGRATION: subscribe to lanyard.health.BatteryStatus.2.0 (port 6251),
// which the pack publishes at 2 Hz on its own. Polling cost the bus a
// request and a response per pack per interval and gave the flight
// controller a scheduling problem it did not need.
//
// Deprecated: lanyard.health.LegacyBatteryPoll.1.0 is marked @deprecated
// in its DSDL definition and is scheduled for removal; migrate to a newer
// version of this type.
struct LegacyBatteryPoll_1_0_Response_ {
// Pack terminal voltage in millivolts.
std::uint16_t voltage_mv{};
// Pack current in centiamperes. Positive is discharge.
std::int16_t current_ca{};
// State of charge as a percentage, 0 to 100.
std::uint8_t remaining_pct{};
// Hottest cell temperature in whole degrees Celsius. Note that the
// replacement message reports temperature in kelvin via the standard SI
// type, so a migration is not a straight field copy.
std::int8_t temperature_c{};
static constexpr const char* FULL_NAME = "lanyard.health.LegacyBatteryPoll.Response";
static constexpr bool IS_DEPRECATED = true;
static constexpr const char* FULL_NAME_AND_VERSION = "lanyard.health.LegacyBatteryPoll.Response.1.0";
static constexpr std::size_t EXTENT_BYTES = 6U;
static constexpr std::size_t SERIALIZATION_BUFFER_SIZE_BYTES = 6U;
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 "LegacyBatteryPoll_1_0_Response: 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 "LegacyBatteryPoll_1_0_Response: 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
LLVMDSDL_NODISCARD inline std::int8_t serialize(std::uint8_t* buffer, std::size_t* inout_buffer_size_bytes) const {
return LegacyBatteryPoll_1_0_Response_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 LegacyBatteryPoll_1_0_Response_deserialize_(this, buffer, inout_buffer_size_bytes);
}
static std::uint16_t get_voltage_mv(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_u16(buf, static_cast<std::size_t>(buffer_size_bytes), static_cast<std::size_t>(0ULL), 16U));
const std::uint64_t value_2 = mlir_llvmdsdl_plan_scalar_unsigned_lanyard_health_LegacyBatteryPoll_1_0_response_0_deser(value);
return static_cast<std::uint16_t>(value_2);
}
static std::int8_t set_voltage_mv(std::uint8_t* const buffer, const std::size_t buffer_size_bytes, const std::uint16_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 >= 16ULL);
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_health_LegacyBatteryPoll_1_0_response_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, 16U);
err = err_2;
} else {
err = v3;
}
return err;
}
static std::int16_t get_current_ca(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_i16(buf, static_cast<std::size_t>(buffer_size_bytes), static_cast<std::size_t>(16ULL), 16U));
const std::uint64_t value_2 = mlir_llvmdsdl_plan_scalar_signed_lanyard_health_LegacyBatteryPoll_1_0_response_1_deser(value);
return static_cast<std::int16_t>(value_2);
}
static std::int8_t set_current_ca(std::uint8_t* const buffer, const std::size_t buffer_size_bytes, const std::int16_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 >= 32ULL);
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_signed_lanyard_health_LegacyBatteryPoll_1_0_response_1_ser(value);
const std::int8_t err_2 = dsdl_runtime_set_ixx(buffer, static_cast<std::size_t>(buffer_size_bytes), static_cast<std::size_t>(16ULL), static_cast<std::int64_t>(value_2), 16U);
err = err_2;
} else {
err = v3;
}
return err;
}
static std::uint8_t get_remaining_pct(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>(32ULL), 8U));
const std::uint64_t value_2 = mlir_llvmdsdl_plan_scalar_unsigned_lanyard_health_LegacyBatteryPoll_1_0_response_2_deser(value);
return static_cast<std::uint8_t>(value_2);
}
static std::int8_t set_remaining_pct(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 >= 40ULL);
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_health_LegacyBatteryPoll_1_0_response_2_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>(32ULL), value_2, 8U);
err = err_2;
} else {
err = v3;
}
return err;
}
static std::int8_t get_temperature_c(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_i8(buf, static_cast<std::size_t>(buffer_size_bytes), static_cast<std::size_t>(40ULL), 8U));
const std::uint64_t value_2 = mlir_llvmdsdl_plan_scalar_signed_lanyard_health_LegacyBatteryPoll_1_0_response_3_deser(value);
return static_cast<std::int8_t>(value_2);
}
static std::int8_t set_temperature_c(std::uint8_t* const buffer, const std::size_t buffer_size_bytes, const std::int8_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 >= 48ULL);
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_signed_lanyard_health_LegacyBatteryPoll_1_0_response_3_ser(value);
const std::int8_t err_2 = dsdl_runtime_set_ixx(buffer, static_cast<std::size_t>(buffer_size_bytes), static_cast<std::size_t>(40ULL), static_cast<std::int64_t>(value_2), 8U);
err = err_2;
} else {
err = v3;
}
return err;
}
};
C++ (pmr)¶
Polymorphic-allocator profile: variable-length fields route through std::pmr.
// Read the state of one battery pack. DEPRECATED -- use the
// BatteryStatus.2.0 message instead.
//
// LEAST SUPPORTED TRANSPORT: Classic CAN.
//
// WHY IT IS STILL HERE: this is the showroom's deprecation example. The
// @deprecated directive marks a definition as scheduled for removal
// without deleting it, so that nodes still speaking it keep working
// while integrators migrate.
//
// WHAT THE GENERATED CODE CARRIES: every backend appends a `Deprecated:
// ...` notice to this comment block and emits an IS_DEPRECATED constant,
// so the marking is visible to a developer who never opens the DSDL. Go
// picks it up as a real deprecation (its toolchain keys on a
// `Deprecated: ` doc paragraph), and TypeScript additionally gets a `/**
// @deprecated */` JSDoc block, which is what tsc and editors read.
//
// C, C++, and Rust go further and add `__attribute__((deprecated))`,
// `[[deprecated]]`, and `#[deprecated]` respectively, so the compiler
// says it too. That is the default: a deprecation only a comment-reader
// can see is one nobody acts on. Each generated file silences the
// diagnostic across its own body, so including these headers is clean
// under -Werror and only your code naming the type is flagged. `dsdlc
// --no-deprecation-attributes` drops the attributes for a -Werror build
// that has nowhere to migrate to yet.
//
// Note the placement: @deprecated appears in the request section, ahead
// of the first attribute, and applies to the whole service. The language
// accepts it nowhere else -- not after a field, and not in the response
// section.
//
// MIGRATION: subscribe to lanyard.health.BatteryStatus.2.0 (port 6251),
// which the pack publishes at 2 Hz on its own. Polling cost the bus a
// request and a response per pack per interval and gave the flight
// controller a scheduling problem it did not need.
//
// Deprecated: lanyard.health.LegacyBatteryPoll.1.0 is marked @deprecated
// in its DSDL definition and is scheduled for removal; migrate to a newer
// version of this type.
struct LegacyBatteryPoll_1_0_Request_ {
// Zero-based index of the pack to read.
std::uint8_t battery_index{};
LegacyBatteryPoll_1_0_Request_() = default;
explicit LegacyBatteryPoll_1_0_Request_(::llvmdsdl::cpp::MemoryResource*) {}
void set_memory_resource(::llvmdsdl::cpp::MemoryResource*) {}
static constexpr const char* FULL_NAME = "lanyard.health.LegacyBatteryPoll.Request";
static constexpr bool IS_DEPRECATED = true;
static constexpr const char* FULL_NAME_AND_VERSION = "lanyard.health.LegacyBatteryPoll.Request.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 "LegacyBatteryPoll_1_0_Request: 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 "LegacyBatteryPoll_1_0_Request: 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
LLVMDSDL_NODISCARD inline std::int8_t serialize(std::uint8_t* buffer, std::size_t* inout_buffer_size_bytes) const {
return LegacyBatteryPoll_1_0_Request_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 LegacyBatteryPoll_1_0_Request_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 LegacyBatteryPoll_1_0_Request_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 LegacyBatteryPoll_1_0_Request_deserialize_(this, buffer, inout_buffer_size_bytes, memory_resource);
}
static std::uint8_t get_battery_index(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_health_LegacyBatteryPoll_1_0_request_0_deser(value);
return static_cast<std::uint8_t>(value_2);
}
static std::int8_t set_battery_index(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_health_LegacyBatteryPoll_1_0_request_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;
}
};
// Read the state of one battery pack. DEPRECATED -- use the
// BatteryStatus.2.0 message instead.
//
// LEAST SUPPORTED TRANSPORT: Classic CAN.
//
// WHY IT IS STILL HERE: this is the showroom's deprecation example. The
// @deprecated directive marks a definition as scheduled for removal
// without deleting it, so that nodes still speaking it keep working
// while integrators migrate.
//
// WHAT THE GENERATED CODE CARRIES: every backend appends a `Deprecated:
// ...` notice to this comment block and emits an IS_DEPRECATED constant,
// so the marking is visible to a developer who never opens the DSDL. Go
// picks it up as a real deprecation (its toolchain keys on a
// `Deprecated: ` doc paragraph), and TypeScript additionally gets a `/**
// @deprecated */` JSDoc block, which is what tsc and editors read.
//
// C, C++, and Rust go further and add `__attribute__((deprecated))`,
// `[[deprecated]]`, and `#[deprecated]` respectively, so the compiler
// says it too. That is the default: a deprecation only a comment-reader
// can see is one nobody acts on. Each generated file silences the
// diagnostic across its own body, so including these headers is clean
// under -Werror and only your code naming the type is flagged. `dsdlc
// --no-deprecation-attributes` drops the attributes for a -Werror build
// that has nowhere to migrate to yet.
//
// Note the placement: @deprecated appears in the request section, ahead
// of the first attribute, and applies to the whole service. The language
// accepts it nowhere else -- not after a field, and not in the response
// section.
//
// MIGRATION: subscribe to lanyard.health.BatteryStatus.2.0 (port 6251),
// which the pack publishes at 2 Hz on its own. Polling cost the bus a
// request and a response per pack per interval and gave the flight
// controller a scheduling problem it did not need.
//
// Deprecated: lanyard.health.LegacyBatteryPoll.1.0 is marked @deprecated
// in its DSDL definition and is scheduled for removal; migrate to a newer
// version of this type.
struct LegacyBatteryPoll_1_0_Response_ {
// Pack terminal voltage in millivolts.
std::uint16_t voltage_mv{};
// Pack current in centiamperes. Positive is discharge.
std::int16_t current_ca{};
// State of charge as a percentage, 0 to 100.
std::uint8_t remaining_pct{};
// Hottest cell temperature in whole degrees Celsius. Note that the
// replacement message reports temperature in kelvin via the standard SI
// type, so a migration is not a straight field copy.
std::int8_t temperature_c{};
LegacyBatteryPoll_1_0_Response_() = default;
explicit LegacyBatteryPoll_1_0_Response_(::llvmdsdl::cpp::MemoryResource*) {}
void set_memory_resource(::llvmdsdl::cpp::MemoryResource*) {}
static constexpr const char* FULL_NAME = "lanyard.health.LegacyBatteryPoll.Response";
static constexpr bool IS_DEPRECATED = true;
static constexpr const char* FULL_NAME_AND_VERSION = "lanyard.health.LegacyBatteryPoll.Response.1.0";
static constexpr std::size_t EXTENT_BYTES = 6U;
static constexpr std::size_t SERIALIZATION_BUFFER_SIZE_BYTES = 6U;
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 "LegacyBatteryPoll_1_0_Response: 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 "LegacyBatteryPoll_1_0_Response: 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
LLVMDSDL_NODISCARD inline std::int8_t serialize(std::uint8_t* buffer, std::size_t* inout_buffer_size_bytes) const {
return LegacyBatteryPoll_1_0_Response_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 LegacyBatteryPoll_1_0_Response_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 LegacyBatteryPoll_1_0_Response_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 LegacyBatteryPoll_1_0_Response_deserialize_(this, buffer, inout_buffer_size_bytes, memory_resource);
}
static std::uint16_t get_voltage_mv(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_u16(buf, static_cast<std::size_t>(buffer_size_bytes), static_cast<std::size_t>(0ULL), 16U));
const std::uint64_t value_2 = mlir_llvmdsdl_plan_scalar_unsigned_lanyard_health_LegacyBatteryPoll_1_0_response_0_deser(value);
return static_cast<std::uint16_t>(value_2);
}
static std::int8_t set_voltage_mv(std::uint8_t* const buffer, const std::size_t buffer_size_bytes, const std::uint16_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 >= 16ULL);
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_health_LegacyBatteryPoll_1_0_response_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, 16U);
err = err_2;
} else {
err = v3;
}
return err;
}
static std::int16_t get_current_ca(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_i16(buf, static_cast<std::size_t>(buffer_size_bytes), static_cast<std::size_t>(16ULL), 16U));
const std::uint64_t value_2 = mlir_llvmdsdl_plan_scalar_signed_lanyard_health_LegacyBatteryPoll_1_0_response_1_deser(value);
return static_cast<std::int16_t>(value_2);
}
static std::int8_t set_current_ca(std::uint8_t* const buffer, const std::size_t buffer_size_bytes, const std::int16_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 >= 32ULL);
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_signed_lanyard_health_LegacyBatteryPoll_1_0_response_1_ser(value);
const std::int8_t err_2 = dsdl_runtime_set_ixx(buffer, static_cast<std::size_t>(buffer_size_bytes), static_cast<std::size_t>(16ULL), static_cast<std::int64_t>(value_2), 16U);
err = err_2;
} else {
err = v3;
}
return err;
}
static std::uint8_t get_remaining_pct(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>(32ULL), 8U));
const std::uint64_t value_2 = mlir_llvmdsdl_plan_scalar_unsigned_lanyard_health_LegacyBatteryPoll_1_0_response_2_deser(value);
return static_cast<std::uint8_t>(value_2);
}
static std::int8_t set_remaining_pct(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 >= 40ULL);
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_health_LegacyBatteryPoll_1_0_response_2_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>(32ULL), value_2, 8U);
err = err_2;
} else {
err = v3;
}
return err;
}
static std::int8_t get_temperature_c(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_i8(buf, static_cast<std::size_t>(buffer_size_bytes), static_cast<std::size_t>(40ULL), 8U));
const std::uint64_t value_2 = mlir_llvmdsdl_plan_scalar_signed_lanyard_health_LegacyBatteryPoll_1_0_response_3_deser(value);
return static_cast<std::int8_t>(value_2);
}
static std::int8_t set_temperature_c(std::uint8_t* const buffer, const std::size_t buffer_size_bytes, const std::int8_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 >= 48ULL);
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_signed_lanyard_health_LegacyBatteryPoll_1_0_response_3_ser(value);
const std::int8_t err_2 = dsdl_runtime_set_ixx(buffer, static_cast<std::size_t>(buffer_size_bytes), static_cast<std::size_t>(40ULL), static_cast<std::int64_t>(value_2), 8U);
err = err_2;
} else {
err = v3;
}
return err;
}
};
C++ (autosar)¶
AUTOSAR C++14 subset profile.
// Read the state of one battery pack. DEPRECATED -- use the
// BatteryStatus.2.0 message instead.
//
// LEAST SUPPORTED TRANSPORT: Classic CAN.
//
// WHY IT IS STILL HERE: this is the showroom's deprecation example. The
// @deprecated directive marks a definition as scheduled for removal
// without deleting it, so that nodes still speaking it keep working
// while integrators migrate.
//
// WHAT THE GENERATED CODE CARRIES: every backend appends a `Deprecated:
// ...` notice to this comment block and emits an IS_DEPRECATED constant,
// so the marking is visible to a developer who never opens the DSDL. Go
// picks it up as a real deprecation (its toolchain keys on a
// `Deprecated: ` doc paragraph), and TypeScript additionally gets a `/**
// @deprecated */` JSDoc block, which is what tsc and editors read.
//
// C, C++, and Rust go further and add `__attribute__((deprecated))`,
// `[[deprecated]]`, and `#[deprecated]` respectively, so the compiler
// says it too. That is the default: a deprecation only a comment-reader
// can see is one nobody acts on. Each generated file silences the
// diagnostic across its own body, so including these headers is clean
// under -Werror and only your code naming the type is flagged. `dsdlc
// --no-deprecation-attributes` drops the attributes for a -Werror build
// that has nowhere to migrate to yet.
//
// Note the placement: @deprecated appears in the request section, ahead
// of the first attribute, and applies to the whole service. The language
// accepts it nowhere else -- not after a field, and not in the response
// section.
//
// MIGRATION: subscribe to lanyard.health.BatteryStatus.2.0 (port 6251),
// which the pack publishes at 2 Hz on its own. Polling cost the bus a
// request and a response per pack per interval and gave the flight
// controller a scheduling problem it did not need.
//
// Deprecated: lanyard.health.LegacyBatteryPoll.1.0 is marked @deprecated
// in its DSDL definition and is scheduled for removal; migrate to a newer
// version of this type.
struct LegacyBatteryPoll_1_0_Request_ {
// Zero-based index of the pack to read.
std::uint8_t battery_index{};
static constexpr const char* FULL_NAME = "lanyard.health.LegacyBatteryPoll.Request";
static constexpr bool IS_DEPRECATED = true;
static constexpr const char* FULL_NAME_AND_VERSION = "lanyard.health.LegacyBatteryPoll.Request.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 "LegacyBatteryPoll_1_0_Request: 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 "LegacyBatteryPoll_1_0_Request: 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
LLVMDSDL_NODISCARD inline std::int8_t serialize(std::uint8_t* buffer, std::size_t* inout_buffer_size_bytes) const {
return LegacyBatteryPoll_1_0_Request_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 LegacyBatteryPoll_1_0_Request_deserialize_(this, buffer, inout_buffer_size_bytes);
}
static std::uint8_t get_battery_index(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_health_LegacyBatteryPoll_1_0_request_0_deser(value);
return static_cast<std::uint8_t>(value_2);
}
static std::int8_t set_battery_index(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_health_LegacyBatteryPoll_1_0_request_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;
}
};
// Read the state of one battery pack. DEPRECATED -- use the
// BatteryStatus.2.0 message instead.
//
// LEAST SUPPORTED TRANSPORT: Classic CAN.
//
// WHY IT IS STILL HERE: this is the showroom's deprecation example. The
// @deprecated directive marks a definition as scheduled for removal
// without deleting it, so that nodes still speaking it keep working
// while integrators migrate.
//
// WHAT THE GENERATED CODE CARRIES: every backend appends a `Deprecated:
// ...` notice to this comment block and emits an IS_DEPRECATED constant,
// so the marking is visible to a developer who never opens the DSDL. Go
// picks it up as a real deprecation (its toolchain keys on a
// `Deprecated: ` doc paragraph), and TypeScript additionally gets a `/**
// @deprecated */` JSDoc block, which is what tsc and editors read.
//
// C, C++, and Rust go further and add `__attribute__((deprecated))`,
// `[[deprecated]]`, and `#[deprecated]` respectively, so the compiler
// says it too. That is the default: a deprecation only a comment-reader
// can see is one nobody acts on. Each generated file silences the
// diagnostic across its own body, so including these headers is clean
// under -Werror and only your code naming the type is flagged. `dsdlc
// --no-deprecation-attributes` drops the attributes for a -Werror build
// that has nowhere to migrate to yet.
//
// Note the placement: @deprecated appears in the request section, ahead
// of the first attribute, and applies to the whole service. The language
// accepts it nowhere else -- not after a field, and not in the response
// section.
//
// MIGRATION: subscribe to lanyard.health.BatteryStatus.2.0 (port 6251),
// which the pack publishes at 2 Hz on its own. Polling cost the bus a
// request and a response per pack per interval and gave the flight
// controller a scheduling problem it did not need.
//
// Deprecated: lanyard.health.LegacyBatteryPoll.1.0 is marked @deprecated
// in its DSDL definition and is scheduled for removal; migrate to a newer
// version of this type.
struct LegacyBatteryPoll_1_0_Response_ {
// Pack terminal voltage in millivolts.
std::uint16_t voltage_mv{};
// Pack current in centiamperes. Positive is discharge.
std::int16_t current_ca{};
// State of charge as a percentage, 0 to 100.
std::uint8_t remaining_pct{};
// Hottest cell temperature in whole degrees Celsius. Note that the
// replacement message reports temperature in kelvin via the standard SI
// type, so a migration is not a straight field copy.
std::int8_t temperature_c{};
static constexpr const char* FULL_NAME = "lanyard.health.LegacyBatteryPoll.Response";
static constexpr bool IS_DEPRECATED = true;
static constexpr const char* FULL_NAME_AND_VERSION = "lanyard.health.LegacyBatteryPoll.Response.1.0";
static constexpr std::size_t EXTENT_BYTES = 6U;
static constexpr std::size_t SERIALIZATION_BUFFER_SIZE_BYTES = 6U;
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 "LegacyBatteryPoll_1_0_Response: 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 "LegacyBatteryPoll_1_0_Response: 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
LLVMDSDL_NODISCARD inline std::int8_t serialize(std::uint8_t* buffer, std::size_t* inout_buffer_size_bytes) const {
return LegacyBatteryPoll_1_0_Response_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 LegacyBatteryPoll_1_0_Response_deserialize_(this, buffer, inout_buffer_size_bytes);
}
static std::uint16_t get_voltage_mv(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_u16(buf, static_cast<std::size_t>(buffer_size_bytes), static_cast<std::size_t>(0ULL), 16U));
const std::uint64_t value_2 = mlir_llvmdsdl_plan_scalar_unsigned_lanyard_health_LegacyBatteryPoll_1_0_response_0_deser(value);
return static_cast<std::uint16_t>(value_2);
}
static std::int8_t set_voltage_mv(std::uint8_t* const buffer, const std::size_t buffer_size_bytes, const std::uint16_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 >= 16ULL);
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_health_LegacyBatteryPoll_1_0_response_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, 16U);
err = err_2;
} else {
err = v3;
}
return err;
}
static std::int16_t get_current_ca(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_i16(buf, static_cast<std::size_t>(buffer_size_bytes), static_cast<std::size_t>(16ULL), 16U));
const std::uint64_t value_2 = mlir_llvmdsdl_plan_scalar_signed_lanyard_health_LegacyBatteryPoll_1_0_response_1_deser(value);
return static_cast<std::int16_t>(value_2);
}
static std::int8_t set_current_ca(std::uint8_t* const buffer, const std::size_t buffer_size_bytes, const std::int16_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 >= 32ULL);
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_signed_lanyard_health_LegacyBatteryPoll_1_0_response_1_ser(value);
const std::int8_t err_2 = dsdl_runtime_set_ixx(buffer, static_cast<std::size_t>(buffer_size_bytes), static_cast<std::size_t>(16ULL), static_cast<std::int64_t>(value_2), 16U);
err = err_2;
} else {
err = v3;
}
return err;
}
static std::uint8_t get_remaining_pct(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>(32ULL), 8U));
const std::uint64_t value_2 = mlir_llvmdsdl_plan_scalar_unsigned_lanyard_health_LegacyBatteryPoll_1_0_response_2_deser(value);
return static_cast<std::uint8_t>(value_2);
}
static std::int8_t set_remaining_pct(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 >= 40ULL);
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_health_LegacyBatteryPoll_1_0_response_2_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>(32ULL), value_2, 8U);
err = err_2;
} else {
err = v3;
}
return err;
}
static std::int8_t get_temperature_c(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_i8(buf, static_cast<std::size_t>(buffer_size_bytes), static_cast<std::size_t>(40ULL), 8U));
const std::uint64_t value_2 = mlir_llvmdsdl_plan_scalar_signed_lanyard_health_LegacyBatteryPoll_1_0_response_3_deser(value);
return static_cast<std::int8_t>(value_2);
}
static std::int8_t set_temperature_c(std::uint8_t* const buffer, const std::size_t buffer_size_bytes, const std::int8_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 >= 48ULL);
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_signed_lanyard_health_LegacyBatteryPoll_1_0_response_3_ser(value);
const std::int8_t err_2 = dsdl_runtime_set_ixx(buffer, static_cast<std::size_t>(buffer_size_bytes), static_cast<std::size_t>(40ULL), static_cast<std::int64_t>(value_2), 8U);
err = err_2;
} else {
err = v3;
}
return err;
}
};
Rust (std)¶
/// Read the state of one battery pack. DEPRECATED -- use the
/// BatteryStatus.2.0 message instead.
///
/// LEAST SUPPORTED TRANSPORT: Classic CAN.
///
/// WHY IT IS STILL HERE: this is the showroom's deprecation example. The
/// @deprecated directive marks a definition as scheduled for removal
/// without deleting it, so that nodes still speaking it keep working
/// while integrators migrate.
///
/// WHAT THE GENERATED CODE CARRIES: every backend appends a `Deprecated:
/// ...` notice to this comment block and emits an IS_DEPRECATED constant,
/// so the marking is visible to a developer who never opens the DSDL. Go
/// picks it up as a real deprecation (its toolchain keys on a
/// `Deprecated: ` doc paragraph), and TypeScript additionally gets a `/**
/// @deprecated */` JSDoc block, which is what tsc and editors read.
///
/// C, C++, and Rust go further and add `__attribute__((deprecated))`,
/// `[[deprecated]]`, and `#[deprecated]` respectively, so the compiler
/// says it too. That is the default: a deprecation only a comment-reader
/// can see is one nobody acts on. Each generated file silences the
/// diagnostic across its own body, so including these headers is clean
/// under -Werror and only your code naming the type is flagged. `dsdlc
/// --no-deprecation-attributes` drops the attributes for a -Werror build
/// that has nowhere to migrate to yet.
///
/// Note the placement: @deprecated appears in the request section, ahead
/// of the first attribute, and applies to the whole service. The language
/// accepts it nowhere else -- not after a field, and not in the response
/// section.
///
/// MIGRATION: subscribe to lanyard.health.BatteryStatus.2.0 (port 6251),
/// which the pack publishes at 2 Hz on its own. Polling cost the bus a
/// request and a response per pack per interval and gave the flight
/// controller a scheduling problem it did not need.
///
/// Deprecated: lanyard.health.LegacyBatteryPoll.1.0 is marked @deprecated
/// in its DSDL definition and is scheduled for removal; migrate to a newer
/// version of this type.
#[repr(C)]
#[derive(Clone, Debug, PartialEq)]
pub struct lanyard_health_LegacyBatteryPoll_1_0_Request_ {
/// Zero-based index of the pack to read.
pub battery_index: u8,
}
/// Read the state of one battery pack. DEPRECATED -- use the
/// BatteryStatus.2.0 message instead.
///
/// LEAST SUPPORTED TRANSPORT: Classic CAN.
///
/// WHY IT IS STILL HERE: this is the showroom's deprecation example. The
/// @deprecated directive marks a definition as scheduled for removal
/// without deleting it, so that nodes still speaking it keep working
/// while integrators migrate.
///
/// WHAT THE GENERATED CODE CARRIES: every backend appends a `Deprecated:
/// ...` notice to this comment block and emits an IS_DEPRECATED constant,
/// so the marking is visible to a developer who never opens the DSDL. Go
/// picks it up as a real deprecation (its toolchain keys on a
/// `Deprecated: ` doc paragraph), and TypeScript additionally gets a `/**
/// @deprecated */` JSDoc block, which is what tsc and editors read.
///
/// C, C++, and Rust go further and add `__attribute__((deprecated))`,
/// `[[deprecated]]`, and `#[deprecated]` respectively, so the compiler
/// says it too. That is the default: a deprecation only a comment-reader
/// can see is one nobody acts on. Each generated file silences the
/// diagnostic across its own body, so including these headers is clean
/// under -Werror and only your code naming the type is flagged. `dsdlc
/// --no-deprecation-attributes` drops the attributes for a -Werror build
/// that has nowhere to migrate to yet.
///
/// Note the placement: @deprecated appears in the request section, ahead
/// of the first attribute, and applies to the whole service. The language
/// accepts it nowhere else -- not after a field, and not in the response
/// section.
///
/// MIGRATION: subscribe to lanyard.health.BatteryStatus.2.0 (port 6251),
/// which the pack publishes at 2 Hz on its own. Polling cost the bus a
/// request and a response per pack per interval and gave the flight
/// controller a scheduling problem it did not need.
///
/// Deprecated: lanyard.health.LegacyBatteryPoll.1.0 is marked @deprecated
/// in its DSDL definition and is scheduled for removal; migrate to a newer
/// version of this type.
#[repr(C)]
#[derive(Clone, Debug, PartialEq)]
pub struct lanyard_health_LegacyBatteryPoll_1_0_Response_ {
/// Pack terminal voltage in millivolts.
pub voltage_mv: u16,
/// Pack current in centiamperes. Positive is discharge.
pub current_ca: i16,
/// State of charge as a percentage, 0 to 100.
pub remaining_pct: u8,
/// Hottest cell temperature in whole degrees Celsius. Note that the
/// replacement message reports temperature in kelvin via the standard SI
/// type, so a migration is not a straight field copy.
pub temperature_c: i8,
}
Rust (no-std)¶
no_std + alloc profile, as a flight-controller firmware build would use.
/// Read the state of one battery pack. DEPRECATED -- use the
/// BatteryStatus.2.0 message instead.
///
/// LEAST SUPPORTED TRANSPORT: Classic CAN.
///
/// WHY IT IS STILL HERE: this is the showroom's deprecation example. The
/// @deprecated directive marks a definition as scheduled for removal
/// without deleting it, so that nodes still speaking it keep working
/// while integrators migrate.
///
/// WHAT THE GENERATED CODE CARRIES: every backend appends a `Deprecated:
/// ...` notice to this comment block and emits an IS_DEPRECATED constant,
/// so the marking is visible to a developer who never opens the DSDL. Go
/// picks it up as a real deprecation (its toolchain keys on a
/// `Deprecated: ` doc paragraph), and TypeScript additionally gets a `/**
/// @deprecated */` JSDoc block, which is what tsc and editors read.
///
/// C, C++, and Rust go further and add `__attribute__((deprecated))`,
/// `[[deprecated]]`, and `#[deprecated]` respectively, so the compiler
/// says it too. That is the default: a deprecation only a comment-reader
/// can see is one nobody acts on. Each generated file silences the
/// diagnostic across its own body, so including these headers is clean
/// under -Werror and only your code naming the type is flagged. `dsdlc
/// --no-deprecation-attributes` drops the attributes for a -Werror build
/// that has nowhere to migrate to yet.
///
/// Note the placement: @deprecated appears in the request section, ahead
/// of the first attribute, and applies to the whole service. The language
/// accepts it nowhere else -- not after a field, and not in the response
/// section.
///
/// MIGRATION: subscribe to lanyard.health.BatteryStatus.2.0 (port 6251),
/// which the pack publishes at 2 Hz on its own. Polling cost the bus a
/// request and a response per pack per interval and gave the flight
/// controller a scheduling problem it did not need.
///
/// Deprecated: lanyard.health.LegacyBatteryPoll.1.0 is marked @deprecated
/// in its DSDL definition and is scheduled for removal; migrate to a newer
/// version of this type.
#[repr(C)]
#[derive(Clone, Debug, PartialEq)]
pub struct lanyard_health_LegacyBatteryPoll_1_0_Request_ {
/// Zero-based index of the pack to read.
pub battery_index: u8,
}
/// Read the state of one battery pack. DEPRECATED -- use the
/// BatteryStatus.2.0 message instead.
///
/// LEAST SUPPORTED TRANSPORT: Classic CAN.
///
/// WHY IT IS STILL HERE: this is the showroom's deprecation example. The
/// @deprecated directive marks a definition as scheduled for removal
/// without deleting it, so that nodes still speaking it keep working
/// while integrators migrate.
///
/// WHAT THE GENERATED CODE CARRIES: every backend appends a `Deprecated:
/// ...` notice to this comment block and emits an IS_DEPRECATED constant,
/// so the marking is visible to a developer who never opens the DSDL. Go
/// picks it up as a real deprecation (its toolchain keys on a
/// `Deprecated: ` doc paragraph), and TypeScript additionally gets a `/**
/// @deprecated */` JSDoc block, which is what tsc and editors read.
///
/// C, C++, and Rust go further and add `__attribute__((deprecated))`,
/// `[[deprecated]]`, and `#[deprecated]` respectively, so the compiler
/// says it too. That is the default: a deprecation only a comment-reader
/// can see is one nobody acts on. Each generated file silences the
/// diagnostic across its own body, so including these headers is clean
/// under -Werror and only your code naming the type is flagged. `dsdlc
/// --no-deprecation-attributes` drops the attributes for a -Werror build
/// that has nowhere to migrate to yet.
///
/// Note the placement: @deprecated appears in the request section, ahead
/// of the first attribute, and applies to the whole service. The language
/// accepts it nowhere else -- not after a field, and not in the response
/// section.
///
/// MIGRATION: subscribe to lanyard.health.BatteryStatus.2.0 (port 6251),
/// which the pack publishes at 2 Hz on its own. Polling cost the bus a
/// request and a response per pack per interval and gave the flight
/// controller a scheduling problem it did not need.
///
/// Deprecated: lanyard.health.LegacyBatteryPoll.1.0 is marked @deprecated
/// in its DSDL definition and is scheduled for removal; migrate to a newer
/// version of this type.
#[repr(C)]
#[derive(Clone, Debug, PartialEq)]
pub struct lanyard_health_LegacyBatteryPoll_1_0_Response_ {
/// Pack terminal voltage in millivolts.
pub voltage_mv: u16,
/// Pack current in centiamperes. Positive is discharge.
pub current_ca: i16,
/// State of charge as a percentage, 0 to 100.
pub remaining_pct: u8,
/// Hottest cell temperature in whole degrees Celsius. Note that the
/// replacement message reports temperature in kelvin via the standard SI
/// type, so a migration is not a straight field copy.
pub temperature_c: i8,
}
Go¶
// Read the state of one battery pack. DEPRECATED -- use the
// BatteryStatus.2.0 message instead.
//
// LEAST SUPPORTED TRANSPORT: Classic CAN.
//
// WHY IT IS STILL HERE: this is the showroom's deprecation example. The
// @deprecated directive marks a definition as scheduled for removal
// without deleting it, so that nodes still speaking it keep working
// while integrators migrate.
//
// WHAT THE GENERATED CODE CARRIES: every backend appends a `Deprecated:
// ...` notice to this comment block and emits an IS_DEPRECATED constant,
// so the marking is visible to a developer who never opens the DSDL. Go
// picks it up as a real deprecation (its toolchain keys on a
// `Deprecated: ` doc paragraph), and TypeScript additionally gets a `/**
// @deprecated */` JSDoc block, which is what tsc and editors read.
//
// C, C++, and Rust go further and add `__attribute__((deprecated))`,
// `[[deprecated]]`, and `#[deprecated]` respectively, so the compiler
// says it too. That is the default: a deprecation only a comment-reader
// can see is one nobody acts on. Each generated file silences the
// diagnostic across its own body, so including these headers is clean
// under -Werror and only your code naming the type is flagged. `dsdlc
// --no-deprecation-attributes` drops the attributes for a -Werror build
// that has nowhere to migrate to yet.
//
// Note the placement: @deprecated appears in the request section, ahead
// of the first attribute, and applies to the whole service. The language
// accepts it nowhere else -- not after a field, and not in the response
// section.
//
// MIGRATION: subscribe to lanyard.health.BatteryStatus.2.0 (port 6251),
// which the pack publishes at 2 Hz on its own. Polling cost the bus a
// request and a response per pack per interval and gave the flight
// controller a scheduling problem it did not need.
//
// Deprecated: lanyard.health.LegacyBatteryPoll.1.0 is marked @deprecated
// in its DSDL definition and is scheduled for removal; migrate to a newer
// version of this type.
type LegacyBatteryPoll_1_0_Request struct {
// Zero-based index of the pack to read.
BatteryIndex uint8
}
// Read the state of one battery pack. DEPRECATED -- use the
// BatteryStatus.2.0 message instead.
//
// LEAST SUPPORTED TRANSPORT: Classic CAN.
//
// WHY IT IS STILL HERE: this is the showroom's deprecation example. The
// @deprecated directive marks a definition as scheduled for removal
// without deleting it, so that nodes still speaking it keep working
// while integrators migrate.
//
// WHAT THE GENERATED CODE CARRIES: every backend appends a `Deprecated:
// ...` notice to this comment block and emits an IS_DEPRECATED constant,
// so the marking is visible to a developer who never opens the DSDL. Go
// picks it up as a real deprecation (its toolchain keys on a
// `Deprecated: ` doc paragraph), and TypeScript additionally gets a `/**
// @deprecated */` JSDoc block, which is what tsc and editors read.
//
// C, C++, and Rust go further and add `__attribute__((deprecated))`,
// `[[deprecated]]`, and `#[deprecated]` respectively, so the compiler
// says it too. That is the default: a deprecation only a comment-reader
// can see is one nobody acts on. Each generated file silences the
// diagnostic across its own body, so including these headers is clean
// under -Werror and only your code naming the type is flagged. `dsdlc
// --no-deprecation-attributes` drops the attributes for a -Werror build
// that has nowhere to migrate to yet.
//
// Note the placement: @deprecated appears in the request section, ahead
// of the first attribute, and applies to the whole service. The language
// accepts it nowhere else -- not after a field, and not in the response
// section.
//
// MIGRATION: subscribe to lanyard.health.BatteryStatus.2.0 (port 6251),
// which the pack publishes at 2 Hz on its own. Polling cost the bus a
// request and a response per pack per interval and gave the flight
// controller a scheduling problem it did not need.
//
// Deprecated: lanyard.health.LegacyBatteryPoll.1.0 is marked @deprecated
// in its DSDL definition and is scheduled for removal; migrate to a newer
// version of this type.
type LegacyBatteryPoll_1_0_Response struct {
// Pack terminal voltage in millivolts.
VoltageMv uint16
// Pack current in centiamperes. Positive is discharge.
CurrentCa int16
// State of charge as a percentage, 0 to 100.
RemainingPct uint8
// Hottest cell temperature in whole degrees Celsius. Note that the
// replacement message reports temperature in kelvin via the standard SI
// type, so a migration is not a straight field copy.
TemperatureC int8
}
TypeScript¶
// Read the state of one battery pack. DEPRECATED -- use the
// BatteryStatus.2.0 message instead.
//
// LEAST SUPPORTED TRANSPORT: Classic CAN.
//
// WHY IT IS STILL HERE: this is the showroom's deprecation example. The
// @deprecated directive marks a definition as scheduled for removal
// without deleting it, so that nodes still speaking it keep working
// while integrators migrate.
//
// WHAT THE GENERATED CODE CARRIES: every backend appends a `Deprecated:
// ...` notice to this comment block and emits an IS_DEPRECATED constant,
// so the marking is visible to a developer who never opens the DSDL. Go
// picks it up as a real deprecation (its toolchain keys on a
// `Deprecated: ` doc paragraph), and TypeScript additionally gets a `/**
// @deprecated */` JSDoc block, which is what tsc and editors read.
//
// C, C++, and Rust go further and add `__attribute__((deprecated))`,
// `[[deprecated]]`, and `#[deprecated]` respectively, so the compiler
// says it too. That is the default: a deprecation only a comment-reader
// can see is one nobody acts on. Each generated file silences the
// diagnostic across its own body, so including these headers is clean
// under -Werror and only your code naming the type is flagged. `dsdlc
// --no-deprecation-attributes` drops the attributes for a -Werror build
// that has nowhere to migrate to yet.
//
// Note the placement: @deprecated appears in the request section, ahead
// of the first attribute, and applies to the whole service. The language
// accepts it nowhere else -- not after a field, and not in the response
// section.
//
// MIGRATION: subscribe to lanyard.health.BatteryStatus.2.0 (port 6251),
// which the pack publishes at 2 Hz on its own. Polling cost the bus a
// request and a response per pack per interval and gave the flight
// controller a scheduling problem it did not need.
/**
* @deprecated lanyard.health.LegacyBatteryPoll.1.0 is marked @deprecated in its
* DSDL definition and is scheduled for removal; migrate to a newer
* version of this type.
*/
export interface LegacyBatteryPoll_1_0_Request {
// Zero-based index of the pack to read.
battery_index: number;
}
// Read the state of one battery pack. DEPRECATED -- use the
// BatteryStatus.2.0 message instead.
//
// LEAST SUPPORTED TRANSPORT: Classic CAN.
//
// WHY IT IS STILL HERE: this is the showroom's deprecation example. The
// @deprecated directive marks a definition as scheduled for removal
// without deleting it, so that nodes still speaking it keep working
// while integrators migrate.
//
// WHAT THE GENERATED CODE CARRIES: every backend appends a `Deprecated:
// ...` notice to this comment block and emits an IS_DEPRECATED constant,
// so the marking is visible to a developer who never opens the DSDL. Go
// picks it up as a real deprecation (its toolchain keys on a
// `Deprecated: ` doc paragraph), and TypeScript additionally gets a `/**
// @deprecated */` JSDoc block, which is what tsc and editors read.
//
// C, C++, and Rust go further and add `__attribute__((deprecated))`,
// `[[deprecated]]`, and `#[deprecated]` respectively, so the compiler
// says it too. That is the default: a deprecation only a comment-reader
// can see is one nobody acts on. Each generated file silences the
// diagnostic across its own body, so including these headers is clean
// under -Werror and only your code naming the type is flagged. `dsdlc
// --no-deprecation-attributes` drops the attributes for a -Werror build
// that has nowhere to migrate to yet.
//
// Note the placement: @deprecated appears in the request section, ahead
// of the first attribute, and applies to the whole service. The language
// accepts it nowhere else -- not after a field, and not in the response
// section.
//
// MIGRATION: subscribe to lanyard.health.BatteryStatus.2.0 (port 6251),
// which the pack publishes at 2 Hz on its own. Polling cost the bus a
// request and a response per pack per interval and gave the flight
// controller a scheduling problem it did not need.
/**
* @deprecated lanyard.health.LegacyBatteryPoll.1.0 is marked @deprecated in its
* DSDL definition and is scheduled for removal; migrate to a newer
* version of this type.
*/
export interface LegacyBatteryPoll_1_0_Response {
// Pack terminal voltage in millivolts.
voltage_mv: number;
// Pack current in centiamperes. Positive is discharge.
current_ca: number;
// State of charge as a percentage, 0 to 100.
remaining_pct: number;
// Hottest cell temperature in whole degrees Celsius. Note that the
// replacement message reports temperature in kelvin via the standard SI
// type, so a migration is not a straight field copy.
temperature_c: number;
}
export type LegacyBatteryPoll_1_0 = LegacyBatteryPoll_1_0_Request;
Python¶
# Read the state of one battery pack. DEPRECATED -- use the
# BatteryStatus.2.0 message instead.
#
# LEAST SUPPORTED TRANSPORT: Classic CAN.
#
# WHY IT IS STILL HERE: this is the showroom's deprecation example. The
# @deprecated directive marks a definition as scheduled for removal
# without deleting it, so that nodes still speaking it keep working
# while integrators migrate.
#
# WHAT THE GENERATED CODE CARRIES: every backend appends a `Deprecated:
# ...` notice to this comment block and emits an IS_DEPRECATED constant,
# so the marking is visible to a developer who never opens the DSDL. Go
# picks it up as a real deprecation (its toolchain keys on a
# `Deprecated: ` doc paragraph), and TypeScript additionally gets a `/**
# @deprecated */` JSDoc block, which is what tsc and editors read.
#
# C, C++, and Rust go further and add `__attribute__((deprecated))`,
# `[[deprecated]]`, and `#[deprecated]` respectively, so the compiler
# says it too. That is the default: a deprecation only a comment-reader
# can see is one nobody acts on. Each generated file silences the
# diagnostic across its own body, so including these headers is clean
# under -Werror and only your code naming the type is flagged. `dsdlc
# --no-deprecation-attributes` drops the attributes for a -Werror build
# that has nowhere to migrate to yet.
#
# Note the placement: @deprecated appears in the request section, ahead
# of the first attribute, and applies to the whole service. The language
# accepts it nowhere else -- not after a field, and not in the response
# section.
#
# MIGRATION: subscribe to lanyard.health.BatteryStatus.2.0 (port 6251),
# which the pack publishes at 2 Hz on its own. Polling cost the bus a
# request and a response per pack per interval and gave the flight
# controller a scheduling problem it did not need.
#
# Deprecated: lanyard.health.LegacyBatteryPoll.1.0 is marked @deprecated
# in its DSDL definition and is scheduled for removal; migrate to a newer
# version of this type.
@dataclass(slots=True)
class LegacyBatteryPoll_1_0_Request:
# Zero-based index of the pack to read.
battery_index: int = 0
# Read the state of one battery pack. DEPRECATED -- use the
# BatteryStatus.2.0 message instead.
#
# LEAST SUPPORTED TRANSPORT: Classic CAN.
#
# WHY IT IS STILL HERE: this is the showroom's deprecation example. The
# @deprecated directive marks a definition as scheduled for removal
# without deleting it, so that nodes still speaking it keep working
# while integrators migrate.
#
# WHAT THE GENERATED CODE CARRIES: every backend appends a `Deprecated:
# ...` notice to this comment block and emits an IS_DEPRECATED constant,
# so the marking is visible to a developer who never opens the DSDL. Go
# picks it up as a real deprecation (its toolchain keys on a
# `Deprecated: ` doc paragraph), and TypeScript additionally gets a `/**
# @deprecated */` JSDoc block, which is what tsc and editors read.
#
# C, C++, and Rust go further and add `__attribute__((deprecated))`,
# `[[deprecated]]`, and `#[deprecated]` respectively, so the compiler
# says it too. That is the default: a deprecation only a comment-reader
# can see is one nobody acts on. Each generated file silences the
# diagnostic across its own body, so including these headers is clean
# under -Werror and only your code naming the type is flagged. `dsdlc
# --no-deprecation-attributes` drops the attributes for a -Werror build
# that has nowhere to migrate to yet.
#
# Note the placement: @deprecated appears in the request section, ahead
# of the first attribute, and applies to the whole service. The language
# accepts it nowhere else -- not after a field, and not in the response
# section.
#
# MIGRATION: subscribe to lanyard.health.BatteryStatus.2.0 (port 6251),
# which the pack publishes at 2 Hz on its own. Polling cost the bus a
# request and a response per pack per interval and gave the flight
# controller a scheduling problem it did not need.
#
# Deprecated: lanyard.health.LegacyBatteryPoll.1.0 is marked @deprecated
# in its DSDL definition and is scheduled for removal; migrate to a newer
# version of this type.
@dataclass(slots=True)
class LegacyBatteryPoll_1_0_Response:
# Pack terminal voltage in millivolts.
voltage_mv: int = 0
# Pack current in centiamperes. Positive is discharge.
current_ca: int = 0
# State of charge as a percentage, 0 to 100.
remaining_pct: int = 0
# Hottest cell temperature in whole degrees Celsius. Note that the
# replacement message reports temperature in kelvin via the standard SI
# type, so a migration is not a straight field copy.
temperature_c: int = 0
Every build recipe compiles this definition along with the rest of the namespace.