|
esphome-api-client 0.5.0
Modern C++17 client for the ESPHome native API (plaintext + Noise)
|
Maps the protocol's numeric message ids (the proto (id) option) to and from concrete message types.
More...
#include <message_registry.hpp>
Public Member Functions | |
| MessageRegistry (const MessageRegistry &)=delete | |
| MessageRegistry & | operator= (const MessageRegistry &)=delete |
Static Public Member Functions | |
| static const MessageRegistry & | instance () |
| The process-wide registry (constructed on first use). | |
| static std::unique_ptr< ProtoMessage > | create (std::uint32_t id) |
Create a default-constructed message for id, or nullptr if no message type carries that id. | |
| static std::unique_ptr< ProtoMessage > | create (MessageId id) |
| static bool | contains (std::uint32_t id) |
Whether a message type with id exists. | |
| static std::size_t | size () noexcept |
| Number of registered message types. | |
| static std::uint32_t | id_of (const ProtoMessage &msg) |
| The message id of a concrete message instance (0 if it carries none). | |
Maps the protocol's numeric message ids (the proto (id) option) to and from concrete message types.
Backed by a generated id<->type table (see api_registry.cpp) — no runtime reflection. The encode direction (id_of) reads the message's own id; the decode direction (create) is a generated switch.
|
delete |
|
static |
Whether a message type with id exists.
|
static |
|
static |
Create a default-constructed message for id, or nullptr if no message type carries that id.
|
static |
The message id of a concrete message instance (0 if it carries none).
|
static |
The process-wide registry (constructed on first use).
|
delete |
|
staticnoexcept |
Number of registered message types.