31 const uint32_t arb11 = ext ? (clean_id >> 18) : clean_id;
32 const uint32_t rhs_arb11 = rhs_ext ? (rhs_clean_id >> 18) : rhs_clean_id;
33 if (arb11 != rhs_arb11)
35 return arb11 < rhs_arb11;
48 if (clean_id == rhs_clean_id && rtr != rhs_rtr)
56 return clean_id < rhs_clean_id;
64 static const unsigned AsciiColumnOffset = 36U;
68 char*
const epos = buf +
sizeof(buf);
69 fill(buf, buf +
sizeof(buf),
'\0');
73 wpos +=
snprintf(wpos,
unsigned(epos - wpos),
"0x%08x ",
unsigned(
id &
MaskExtID));
77 const char*
const fmt = (mode == StrAligned) ?
" 0x%03x " :
"0x%03x ";
83 wpos +=
snprintf(wpos,
unsigned(epos - wpos),
" RTR");
87 wpos +=
snprintf(wpos,
unsigned(epos - wpos),
" ERR");
91 for (
int dlen = 0; dlen <
dlc; dlen++)
93 wpos +=
snprintf(wpos,
unsigned(epos - wpos),
" %02x",
unsigned(
data[dlen]));
96 while ((mode == StrAligned) && (wpos < buf + AsciiColumnOffset))
101 wpos +=
snprintf(wpos,
unsigned(epos - wpos),
" \'");
102 for (
int dlen = 0; dlen <
dlc; dlen++)
105 if (ch < 0x20 || ch > 0x7E)
109 wpos +=
snprintf(wpos,
unsigned(epos - wpos),
"%c", ch);
111 wpos +=
snprintf(wpos,
unsigned(epos - wpos),
"\'");
114 return std::string(buf);
uint32_t id
CAN ID with flags (above)
static const uint8_t MaxDataLen
static const uint32_t MaskExtID
static const uint32_t FlagEFF
Extended frame format.
uint8_t dlc
Data Length Code.
UAVCAN_EXPORT void fill(ForwardIt first, ForwardIt last, const T &value)
static const uint32_t MaskStdID
static std::string toString(long x)
static const uint32_t FlagRTR
Remote transmission request.
bool priorityHigherThan(const CanFrame &rhs) const
static const uint32_t FlagERR
Error frame.
int snprintf(char *out, std::size_t maxlen, const char *format,...)