Home IO Control
ESPHome add-on for IO-Homecontrol devices
Loading...
Searching...
No Matches
proto_codecs.h File Reference

Device-name, address-classification and 1W-frame codecs. More...

#include "proto_device_model.h"
#include "proto_sizes.h"
#include <cstddef>
#include <cstdint>
#include <optional>
#include <string>
Include dependency graph for proto_codecs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  esphome::home_io_control::OneWayFrameInfo
 Decoded representation of a 1W remote frame. More...
struct  esphome::home_io_control::DiscoveryResponseInfo
 Extended discovery-response fields (manufacturer, Multi Information Byte, backbone address, timestamp) plus flags recording how much of the payload was actually present. More...

Namespaces

namespace  esphome
namespace  esphome::home_io_control

Enumerations

enum class  esphome::home_io_control::DeviceNameValidationError : uint8_t {
  esphome::home_io_control::NONE = 0x00 , esphome::home_io_control::EMPTY = 0x01 , esphome::home_io_control::TOO_LONG = 0x02 , esphome::home_io_control::INVALID_UTF8 = 0x03 ,
  esphome::home_io_control::UNSUPPORTED_CHAR = 0x04
}
 Validation result for outbound device-name writes. More...
enum class  esphome::home_io_control::AddressClass : uint8_t {
  esphome::home_io_control::UNICAST = 0 , esphome::home_io_control::BROADCAST_ALL , esphome::home_io_control::BROADCAST_TYPE , esphome::home_io_control::DISCOVERY ,
  esphome::home_io_control::UNKNOWN_BROADCAST
}
 Address classification categories for diagnostic purposes. More...

Functions

std::string esphome::home_io_control::decode_device_name_payload (const uint8_t *data, uint8_t len)
 Decode a device-name payload from IO-homecontrol's Latin-1 wire format into UTF-8.
std::string esphome::home_io_control::trim_ascii_whitespace (const std::string &value)
 Trim leading and trailing ASCII whitespace from a string.
DeviceNameValidationError esphome::home_io_control::encode_device_name_payload (const std::string &name, uint8_t payload[DEVICE_NAME_WRITE_PAYLOAD_SIZE], std::string &normalized_name)
 Validate and encode a user-supplied UTF-8 device name into the fixed Latin-1 write payload.
const char * esphome::home_io_control::device_name_validation_error_name (DeviceNameValidationError error)
 Return a stable symbolic name for a device-name validation result.
const char * esphome::home_io_control::device_name_validation_error_description (DeviceNameValidationError error)
 Return a human-readable explanation for a device-name validation result.
AddressClass esphome::home_io_control::classify_address (const uint8_t addr[NODE_ID_SIZE])
 Classify an IO-Homecontrol 3-byte address.
const char * esphome::home_io_control::address_class_name (AddressClass address_class)
 Get a human-readable name for an address classification.
DeviceType esphome::home_io_control::broadcast_target_type (const uint8_t addr[NODE_ID_SIZE])
 Extract the target device type from a typed broadcast address.
void esphome::home_io_control::decode_1w_main_intent (uint8_t main0, uint8_t main1, char *out, size_t out_size)
 Decode the "main" position/command bytes from a 1W execute payload.
std::optional< float > esphome::home_io_control::oneway_intent_to_target (uint8_t main0, uint8_t main1)
 Resolve a 1W main-byte pair to an optimistic IO target position, if unambiguous.
OneWayFrameInfo esphome::home_io_control::decode_1w_frame (const IoFrame &frame)
 Decode a parsed 1W frame into a structured OneWayFrameInfo.
DiscoveryResponseInfo esphome::home_io_control::decode_discovery_response (const IoFrame &frame, IoDevice &device, std::string &device_id)
 Decode a discovery-response payload (CMD_DISCOVER_RESP 0x29 or CMD_DISCOVER_SPE_RESP 0x2B — both carry the identical DISCOVERY_RESP_FULL_SIZE layout) into device metadata.

Variables

static constexpr uint8_t esphome::home_io_control::DEVICE_NAME_WRITE_CHAR_LIMIT = 15
 Reference write limit before the trailing null.
static constexpr uint8_t esphome::home_io_control::DEVICE_NAME_WRITE_PAYLOAD_SIZE
 Fixed write payload: 15 visible chars plus trailing null/padding.
static constexpr uint16_t esphome::home_io_control::LATIN1_CODEPOINT_MAX = 0x00FF
 Highest Unicode code point representable in Latin-1.
static constexpr size_t esphome::home_io_control::ONEWAY_INTENT_BUFFER_SIZE = 24
 Buffer size for the decoded 1W main-intent string.
static constexpr uint8_t esphome::home_io_control::ADDRESS_SUFFIX_MASK = 0x3F
 Well-known address suffix values in the broadcast address space.
static constexpr uint8_t esphome::home_io_control::ADDRESS_SUFFIX_BROADCAST = 0x3F
 Suffix for "all devices of this type" broadcast.
static constexpr uint8_t esphome::home_io_control::ADDRESS_SUFFIX_DISCOVERY = 0x3B
 Suffix for discovery-related broadcasts.

Detailed Description

Device-name, address-classification and 1W-frame codecs.

Higher-level decode/encode helpers layered on the frame and device model: Latin-1 device-name round-tripping, broadcast address classification and structured decoding of overheard 1W remote frames.

Definition in file proto_codecs.h.