|
Void Sentry
An AI-driven, real-time Sentry Turret platform leveraging asynchronous I/O and computer vision to deliver high-precision autonomous motion tracking on resource-constrained embedded hardware.
|
Shared framing for versioned NVS blobs: magic, body, CRC-32 (pure C++20, natively tested). More...
#include <cstddef>#include <cstdint>#include <optional>#include <span>Go to the source code of this file.
Functions | |
| void | checksum::frame_blob (std::span< uint8_t > blob, uint32_t magic) |
Stamps magic into the first four bytes and the CRC-32 of all but the last four bytes into the last four. | |
| std::optional< std::span< const uint8_t > > | checksum::unframe_blob (std::span< const uint8_t > blob, uint32_t magic) |
| Checks the magic and the CRC; returns the body (bytes 4 .. size-4), or empty if either check fails. | |
Variables | |
| constexpr size_t | checksum::kFrameOverhead = 8 |
| Bytes the frame adds around the body: the magic in front and the CRC behind. | |
Shared framing for versioned NVS blobs: magic, body, CRC-32 (pure C++20, natively tested).
Layout (host byte order, little-endian on every target): magic (u32), body (any length, version and fields included), CRC-32 of everything before it (u32). The caller owns the body layout and its version byte(s).
| void checksum::frame_blob | ( | std::span< uint8_t > | blob, |
| uint32_t | magic ) |
Stamps magic into the first four bytes and the CRC-32 of all but the last four bytes into the last four.
The caller has already written the body at offset 4. blob must be at least kFrameOverhead bytes.
| std::optional< std::span< const uint8_t > > checksum::unframe_blob | ( | std::span< const uint8_t > | blob, |
| uint32_t | magic ) |
Checks the magic and the CRC; returns the body (bytes 4 .. size-4), or empty if either check fails.
Length policy stays with the caller (compare blob.size() to the expected size first).