2#ifdef USE_UART_DEBUGGER
42 this->
bytes_.push_back(
byte);
105 size_t len = bytes.size();
107 for (
size_t i = 0; i <
len; i++) {
111 buf_append_printf(buf,
sizeof(buf), 0,
"%02X", bytes[i]);
114 ESP_LOGD(TAG,
"%s%s", prefix.
c_str(), res.c_str());
125 size_t len = bytes.size();
127 for (
size_t i = 0; i <
len; i++) {
130 }
else if (bytes[i] == 8) {
132 }
else if (bytes[i] == 9) {
134 }
else if (bytes[i] == 10) {
136 }
else if (bytes[i] == 11) {
138 }
else if (bytes[i] == 12) {
140 }
else if (bytes[i] == 13) {
142 }
else if (bytes[i] == 27) {
144 }
else if (bytes[i] == 34) {
146 }
else if (bytes[i] == 39) {
148 }
else if (bytes[i] == 92) {
150 }
else if (bytes[i] < 32 || bytes[i] > 127) {
151 buf_append_printf(buf,
sizeof(buf), 0,
"\\x%02X", bytes[i]);
158 ESP_LOGD(TAG,
"%s%s", prefix.
c_str(), res.c_str());
164 size_t len = bytes.size();
171 for (
size_t i = 0; i <
len; i++) {
175 buf_append_printf(buf,
sizeof(buf), 0,
"%u", bytes[i]);
178 ESP_LOGD(TAG,
"%s%s", prefix.
c_str(), res.c_str());
184 size_t len = bytes.size();
191 for (
size_t i = 0; i <
len; i++) {
195 buf_append_printf(buf,
sizeof(buf), 0,
"0b" BYTE_TO_BINARY_PATTERN
" (0x%02X)", BYTE_TO_BINARY(bytes[i]), bytes[i]);
198 ESP_LOGD(TAG,
"%s%s", prefix.
c_str(), res.c_str());
StringRef is a reference to a string owned by something else.
constexpr const char * c_str() const
void trigger(const Ts &...x) ESPHOME_ALWAYS_INLINE
void add_debug_callback(F &&callback)
static void log_string(UARTDirection direction, std::vector< uint8_t > bytes, StringRef prefix=StringRef())
Log the bytes as string values, escaping unprintable characters.
static void log_hex(UARTDirection direction, std::vector< uint8_t > bytes, uint8_t separator, StringRef prefix=StringRef())
Log the bytes as hex values, separated by the provided separator character.
static void log_int(UARTDirection direction, std::vector< uint8_t > bytes, uint8_t separator, StringRef prefix=StringRef())
Log the bytes as integer values, separated by the provided separator character.
static void log_binary(UARTDirection direction, std::vector< uint8_t > bytes, uint8_t separator, StringRef prefix=StringRef())
Log the bytes as '<binary> (<hex>)' values, separated by the provided separator.
void store_byte_(UARTDirection direction, uint8_t byte)
UARTDirection for_direction_
void trigger_after_timeout_()
bool is_my_direction_(UARTDirection direction)
const uint8_t * after_delimiter_
void trigger_after_direction_change_(UARTDirection direction)
uint8_t after_delimiter_len_
std::vector< uint8_t > bytes_
void trigger_after_delimiter_(uint8_t byte)
bool has_buffered_bytes_()
void trigger_after_bytes_()
UARTDirection last_direction_
uint8_t after_delimiter_pos_
UARTDebugger(UARTComponent *parent)
bool read_byte(uint8_t *data)
ESPHOME_LOG_TAG(TAG, "uart.binary_sensor")
void HOT delay(uint32_t ms)
uint32_t IRAM_ATTR HOT millis()
uint8_t progmem_read_byte(const uint8_t *addr)