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

IO-Homecontrol 2W frame container implementation. More...

#include "proto_frame.h"
#include "proto_constants.h"
#include <cctype>
#include <cstdio>
#include <cstring>
Include dependency graph for proto_frame.cpp:

Go to the source code of this file.

Namespaces

namespace  esphome
namespace  esphome::home_io_control

Functions

static int esphome::home_io_control::hex_nibble (char ch)
bool esphome::home_io_control::hex_to_bytes (const std::string &hex, uint8_t *out, uint8_t len)
 Convert a hex string (e.g., "123ABC") to a byte array.
std::string esphome::home_io_control::node_id_to_string (const uint8_t id[NODE_ID_SIZE])
 Format a 3‑byte node ID as a 6‑character uppercase hex string.
uint16_t esphome::home_io_control::crc_ccitt (const uint8_t *data, uint8_t len)
 CRC-CCITT used by the IO-Homecontrol protocol for frame validation.
void esphome::home_io_control::init_frame (IoFrame &f, bool is_2w=true, bool start=false, bool end=false, bool low_power=false)
 Initialize an IoFrame header (ctrl0/ctrl1) with flags.
void esphome::home_io_control::set_dst (IoFrame &f, const uint8_t id[NODE_ID_SIZE])
 Set destination node ID.
void esphome::home_io_control::set_src (IoFrame &f, const uint8_t id[NODE_ID_SIZE])
 Set source node ID.
bool esphome::home_io_control::set_cmd (IoFrame &f, uint8_t cmd, const uint8_t *params=nullptr, uint8_t params_len=0)
 Set command and payload.
uint8_t esphome::home_io_control::frame_length (const IoFrame &f)
 Get total frame length from ctrl0.
bool esphome::home_io_control::is_start (const IoFrame &f)
 Check START flag.
bool esphome::home_io_control::is_end (const IoFrame &f)
 Check END flag.
uint8_t esphome::home_io_control::serialize (const IoFrame &f, uint8_t *buf, uint8_t buf_size)
 Serialize a parsed frame into a wire buffer (without CRC).
bool esphome::home_io_control::parse (const uint8_t *buf, uint8_t buf_len, IoFrame &f)
 Parse a wire buffer into a parsed IoFrame (validates length and CTRL0).

Detailed Description

IO-Homecontrol 2W frame container implementation.

Definition in file proto_frame.cpp.