|
ESPHome 2026.11.0-dev
|
Providing packet encoding functions for exchanging data with a remote host. More...
Data Structures | |
| struct | BinarySensor |
| class | PacketTransport |
| struct | Provider |
| struct | Sensor |
Typedefs | |
| template<typename T > | |
| using | string_map_t = std::map<std::string, T, std::less<>> |
Enumerations | |
| enum | DataKey { ZERO_FILL_KEY , DATA_KEY , SENSOR_KEY , BINARY_SENSOR_KEY , PING_KEY , ROLLING_CODE_KEY } |
| enum | DecodeResult { DECODE_OK , DECODE_UNMATCHED , DECODE_ERROR , DECODE_EMPTY } |
Functions | |
| ESPHOME_LOG_TAG (TAG, "packet_transport") | |
| Structure of a data packet; everything is little-endian. | |
Providing packet encoding functions for exchanging data with a remote host.
A transport is required to send the data; this is provided by a child class. The child class should implement the virtual functions send_packet_ and get_max_packet_size_. On receipt of a data packet, it should call this->process_() with the data.
| using esphome::packet_transport::string_map_t = std::map<std::string, T, std::less<>> |
Definition at line 28 of file packet_transport.h.
| Enumerator | |
|---|---|
| ZERO_FILL_KEY | |
| DATA_KEY | |
| SENSOR_KEY | |
| BINARY_SENSOR_KEY | |
| PING_KEY | |
| ROLLING_CODE_KEY | |
Definition at line 65 of file packet_transport.cpp.
| Enumerator | |
|---|---|
| DECODE_OK | |
| DECODE_UNMATCHED | |
| DECODE_ERROR | |
| DECODE_EMPTY | |
Definition at line 74 of file packet_transport.cpp.
| esphome::packet_transport::ESPHOME_LOG_TAG | ( | TAG | , |
| "packet_transport" | ) |
Structure of a data packet; everything is little-endian.
— In clear text — MAGIC_NUMBER: 16 bits host name length: 1 byte host name: (length) bytes padding: 0 or more null bytes to a 4 byte boundary
— Encrypted (if key set) -— DATA_KEY: 1 byte: OR ROLLING_CODE_KEY: Rolling code (if enabled): 8 bytes Ping keys: if any repeat: PING_KEY: 1 byte ping code: 4 bytes Sensors: repeat: SENSOR_KEY: 1 byte float value: 4 bytes name length: 1 byte name Binary Sensors: repeat: BINARY_SENSOR_KEY: 1 byte bool value: 1 bytes name length: 1 byte name
Padded to a 4 byte boundary with nulls
Structure of a ping request packet: — In clear text — MAGIC_PING: 16 bits host name length: 1 byte host name: (length) bytes Ping key (4 bytes)