|
HardFOC Core
API reference
|
Classes | |
| struct | Header |
| Datagram header. More... | |
Enumerations | |
| enum class | DecodeError : uint8_t { None = 0 , Truncated , BadVersion , BadLength , BadFrame } |
| Why a datagram was rejected. More... | |
Functions | |
| void | PutU16 (uint8_t *p, uint16_t v) noexcept |
| void | PutU32 (uint8_t *p, uint32_t v) noexcept |
| uint16_t | GetU16 (const uint8_t *p) noexcept |
| uint32_t | GetU32 (const uint8_t *p) noexcept |
| std::size_t | EncodeHeader (uint8_t *out, const Header &h) noexcept |
Write the header; out has kHeaderSize bytes. | |
| constexpr std::size_t | RecordSize (const CanFrame &f) noexcept |
Bytes the record of f takes. | |
| std::size_t | EncodeRecord (uint8_t *out, std::size_t cap, const CanFrame &f) noexcept |
Append the record of f. | |
| template<typename OnFrame > | |
| DecodeError | DecodeDatagram (const uint8_t *p, std::size_t n, Header *header, OnFrame &&on_frame) |
Decode a datagram; on_frame(const CanFrame&) is called per record. | |
Variables | |
| constexpr uint8_t | kVersion = 1U |
| constexpr std::size_t | kHeaderSize = 8U |
| constexpr std::size_t | kRecordHeaderSize = 6U |
| constexpr std::size_t | kMaxRecordSize = kRecordHeaderSize + kFdMaxLen |
| constexpr std::size_t | kMaxDatagram = 4096U |
| constexpr uint32_t | kIdExtBit = 0x80000000U |
| constexpr uint32_t | kIdRtrBit = 0x40000000U |
| constexpr uint8_t | kRecordFlagMask = frame_flag::kFdf | frame_flag::kBrs | frame_flag::kEsi |
| constexpr uint8_t | kDgramKeepAlive = 0x01U |
|
strong |
| DecodeError hf::can::record::DecodeDatagram | ( | const uint8_t * | p, |
| std::size_t | n, | ||
| Header * | header, | ||
| OnFrame && | on_frame | ||
| ) |
Decode a datagram; on_frame(const CanFrame&) is called per record.
The whole datagram is validated before the first callback, so a malformed datagram delivers nothing.
|
inlinenoexcept |
Write the header; out has kHeaderSize bytes.
|
inlinenoexcept |
Append the record of f.
cap is too small or the frame is malformed
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
constexprnoexcept |
Bytes the record of f takes.
|
inlineconstexpr |
Datagram flag: keep-alive, no records expected.
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
Largest datagram this codec emits or accepts (stream length prefix is u16).
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |