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

Result type and argument/result helpers shared by ManagementActions and DiagnosticProbes. More...

#include "device_registry.h"
#include "proto_codecs.h"
#include "proto_constants.h"
#include "proto_frame.h"
#include <algorithm>
#include <array>
#include <cctype>
#include <cstdint>
#include <cstdio>
#include <string>
Include dependency graph for management_helpers.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::ManagementActionResult
 Result of a hub-level management action such as rename. More...

Namespaces

namespace  esphome
namespace  esphome::home_io_control

Functions

std::string esphome::home_io_control::normalize_device_id_argument (const std::string &device_id)
 Trim and uppercase a device-ID argument as received from the native API.
std::string esphome::home_io_control::format_hex_byte (uint8_t value)
 Format a byte as two uppercase hex digits, no prefix.
ManagementActionResult esphome::home_io_control::make_management_result (const std::string &action, const std::string &device_id)
 A result that carries only the action name and the target device ID.
bool esphome::home_io_control::apply_error_response (const IoFrame &response, ManagementActionResult &result)
 Decode a CMD_ERROR_RESP frame's result code into result.
IoDevice * esphome::home_io_control::resolve_management_device (const char *action, const std::string &device_id, bool initialized, DeviceRegistry &registry, ManagementActionResult &result)
 Shared preamble for every device-addressed action: validate the hub and device ID, then resolve the target device.

Variables

constexpr size_t esphome::home_io_control::RESULT_CODE_BUFFER_SIZE = 5
 Size of the scratch buffer format_hex_byte() prints into: two digits plus the terminator, with headroom.

Detailed Description

Result type and argument/result helpers shared by ManagementActions and DiagnosticProbes.

Both classes take native-API string arguments, resolve a device from them and report through ManagementActionResult. The pieces they have in common live here, once: the result record, device-ID normalisation, the byte-hex formatter, the CMD_ERROR_RESP decoder and the device resolution preamble. Nothing here reaches the hub.

Definition in file management_helpers.h.