esphome-api-client 0.5.0
Modern C++17 client for the ESPHome native API (plaintext + Noise)
Loading...
Searching...
No Matches
Classes | Namespaces | Typedefs | Enumerations | Functions | Variables
bytes.hpp File Reference

Byte buffer / view aliases and protobuf base-128 varint codec. More...

#include <cstddef>
#include <cstdint>
#include <vector>
Include dependency graph for bytes.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  esphome::api::ByteView
 Non-owning view over a contiguous run of bytes (a C++17 stand-in for std::span<const std::uint8_t>). More...
 

Namespaces

namespace  esphome
 
namespace  esphome::api
 

Typedefs

using esphome::api::ByteBuffer = std::vector< std::uint8_t >
 Owning, growable byte buffer.
 

Enumerations

enum class  esphome::api::VarintStatus { esphome::api::Ok , esphome::api::Incomplete , esphome::api::Overflow }
 Outcome of decoding a varint from a (possibly partial) buffer. More...
 

Functions

std::size_t esphome::api::varint_size (std::uint32_t value) noexcept
 Number of bytes the base-128 encoding of value occupies.
 
void esphome::api::append_varint (ByteBuffer &out, std::uint32_t value)
 Append the base-128 varint encoding of value to out.
 
VarintStatus esphome::api::decode_varint (const std::uint8_t *data, std::size_t len, std::uint32_t &value, std::size_t &consumed, std::size_t max_bytes=max_varint_bytes) noexcept
 Decode a base-128 varint from [data, data+len).
 

Variables

constexpr std::size_t esphome::api::max_varint_bytes = 5
 Maximum number of bytes a base-128 varint may occupy for a 32-bit value.
 

Detailed Description

Byte buffer / view aliases and protobuf base-128 varint codec.