Home IO Control
ESPHome add-on for IO-Homecontrol devices
Loading...
Searching...
No Matches
proto_sizes.h
Go to the documentation of this file.
1#pragma once
2
3/// @file proto_sizes.h
4/// @brief Fundamental IO-Homecontrol frame and crypto size constants.
5/// @ingroup hioc_protocol
6///
7/// These sizes are the lowest layer of the protocol model: node-ID widths,
8/// AES/HMAC sizes and frame bounds. They live in their own header so the other
9/// protocol headers can depend on them without pulling in the full frame API.
10
11#include <cstdint>
12
13namespace esphome {
14namespace home_io_control {
15
16// ============================================================================
17// Frame and Crypto Sizes
18// ============================================================================
19
20static constexpr uint8_t NODE_ID_SIZE = 3; ///< Device/node addresses are 3 bytes (e.g., "123ABC")
21static constexpr uint8_t NODE_ID_STRING_SIZE = (NODE_ID_SIZE * 2) + 1; ///< Uppercase hex node ID plus null terminator
22static constexpr uint8_t HMAC_SIZE = 6; ///< Authentication HMAC is 6 bytes (truncated AES output)
23static constexpr uint8_t AES_KEY_SIZE = 16; ///< AES-128 key size
24static constexpr uint8_t AES_BLOCK_SIZE = 16; ///< AES block size
25static constexpr uint8_t IV_SIZE = 16; ///< Initialization vector size for AES
26static constexpr uint8_t IV_PADDING = 0x55; ///< Padding byte used in IV construction
27static constexpr uint8_t BITS_PER_BYTE = 8; ///< Number of bits in one protocol byte
28
29static constexpr uint8_t FRAME_MIN_SIZE = 9; ///< Minimum frame: CTRL0+CTRL1+DST(3)+SRC(3)+CMD(1)
30static constexpr uint8_t FRAME_MAX_SIZE = 32; ///< Maximum frame size (9 header + 23 data)
31static constexpr uint8_t FRAME_MAX_DATA_SIZE = 23; ///< Maximum data bytes after command ID
32static constexpr uint8_t FRAME_CMD_OFFSET = 8; ///< Byte offset of the command ID in a raw wire buffer
33static constexpr uint8_t FRAME_CRC_SIZE = 2; ///< CRC-CCITT trailer appended after the frame body
34
35} // namespace home_io_control
36} // namespace esphome
static constexpr uint8_t BITS_PER_BYTE
Number of bits in one protocol byte.
Definition proto_sizes.h:27
static constexpr uint8_t NODE_ID_SIZE
Device/node addresses are 3 bytes (e.g., "123ABC").
Definition proto_sizes.h:20
static constexpr uint8_t AES_BLOCK_SIZE
AES block size.
Definition proto_sizes.h:24
static constexpr uint8_t FRAME_MIN_SIZE
Minimum frame: CTRL0+CTRL1+DST(3)+SRC(3)+CMD(1).
Definition proto_sizes.h:29
static constexpr uint8_t FRAME_MAX_DATA_SIZE
Maximum data bytes after command ID.
Definition proto_sizes.h:31
static constexpr uint8_t HMAC_SIZE
Authentication HMAC is 6 bytes (truncated AES output).
Definition proto_sizes.h:22
static constexpr uint8_t FRAME_MAX_SIZE
Maximum frame size (9 header + 23 data).
Definition proto_sizes.h:30
static constexpr uint8_t NODE_ID_STRING_SIZE
Uppercase hex node ID plus null terminator.
Definition proto_sizes.h:21
static constexpr uint8_t FRAME_CRC_SIZE
CRC-CCITT trailer appended after the frame body.
Definition proto_sizes.h:33
static constexpr uint8_t AES_KEY_SIZE
AES-128 key size.
Definition proto_sizes.h:23
static constexpr uint8_t IV_PADDING
Padding byte used in IV construction.
Definition proto_sizes.h:26
static constexpr uint8_t IV_SIZE
Initialization vector size for AES.
Definition proto_sizes.h:25
static constexpr uint8_t FRAME_CMD_OFFSET
Byte offset of the command ID in a raw wire buffer.
Definition proto_sizes.h:32