ESPHome 2026.6.0-dev
Loading...
Searching...
No Matches
raw_protocol.cpp
Go to the documentation of this file.
1#include "raw_protocol.h"
3#include "esphome/core/log.h"
4
5namespace esphome::remote_base {
6
7static const char *const TAG = "remote.raw";
8
10 char buffer[256];
11 size_t pos = buf_append_printf(buffer, sizeof(buffer), 0, "Received Raw: ");
12
13 for (int32_t i = 0; i < src.size() - 1; i++) {
14 const int32_t value = src[i];
15 size_t prev_pos = pos;
16
17 if (i + 1 < src.size() - 1) {
18 pos = buf_append_printf(buffer, sizeof(buffer), pos, "%" PRId32 ", ", value);
19 } else {
20 pos = buf_append_printf(buffer, sizeof(buffer), pos, "%" PRId32, value);
21 }
22
23 if (pos >= sizeof(buffer) - 1) {
24 // buffer full, flush and continue
25 buffer[prev_pos] = '\0';
26 ESP_LOGI(TAG, "%s", buffer);
27 if (i + 1 < src.size() - 1) {
28 pos = buf_append_printf(buffer, sizeof(buffer), 0, " %" PRId32 ", ", value);
29 } else {
30 pos = buf_append_printf(buffer, sizeof(buffer), 0, " %" PRId32, value);
31 }
32 }
33 }
34 if (pos != 0) {
35 ESP_LOGI(TAG, "%s", buffer);
36 }
37 return true;
38}
39
40} // namespace esphome::remote_base
bool dump(RemoteReceiveData src) override
size_t size_t pos
Definition helpers.h:1038
const void * src
Definition hal.h:64