9static const char *
const TAG =
"ir_rf_proxy";
14template<
typename CallT>
17 if (transmitter ==
nullptr) {
18 ESP_LOGW(TAG,
"No transmitter configured");
22 if (!call.has_raw_timings()) {
23 ESP_LOGE(TAG,
"No raw timings provided");
27 auto transmit_call = transmitter->
transmit();
28 auto *transmit_data = transmit_call.
get_data();
31 if (call.is_packed()) {
32 transmit_data->set_data_from_packed_sint32(call.get_packed_data(), call.get_packed_length(),
33 call.get_packed_count());
34 ESP_LOGD(TAG,
"Transmitting packed raw timings: count=%" PRIu16
", repeat=%" PRIu32, call.get_packed_count(),
35 call.get_repeat_count());
36 }
else if (call.is_base64url()) {
37 if (!transmit_data->set_data_from_base64url(call.get_base64url_data())) {
38 ESP_LOGE(TAG,
"Invalid base64url data");
41 constexpr int32_t max_timing_us = 500000;
42 for (int32_t timing : transmit_data->get_data()) {
43 int32_t abs_timing = timing < 0 ? -timing : timing;
44 if (abs_timing > max_timing_us) {
45 ESP_LOGE(TAG,
"Invalid timing value: %" PRId32
" µs (max %" PRId32
")", timing, max_timing_us);
49 ESP_LOGD(TAG,
"Transmitting base64url raw timings: count=%zu, repeat=%" PRIu32, transmit_data->get_data().size(),
50 call.get_repeat_count());
52 transmit_data->set_data(call.get_raw_timings());
53 ESP_LOGD(TAG,
"Transmitting raw timings: count=%zu, repeat=%" PRIu32, call.get_raw_timings().size(),
54 call.get_repeat_count());
57 if (call.get_repeat_count() > 0) {
58 transmit_call.set_send_times(call.get_repeat_count());
61 transmit_call.perform();
71 " Supports Transmitter: %s\n"
72 " Supports Receiver: %s",
77 ESP_LOGCONFIG(TAG,
" Hardware Type: RF (%.3f MHz)", this->
frequency_khz_ / 1e3f);
79 ESP_LOGCONFIG(TAG,
" Hardware Type: Infrared");
84 uint32_t carrier =
call.get_carrier_frequency().value_or(0);
92#ifdef USE_RADIO_FREQUENCY
109 " Supports Transmitter: %s\n"
110 " Supports Receiver: %s",
114 const auto &traits = this->
traits_;
115 if (traits.get_frequency_min_hz() > 0) {
116 if (traits.get_frequency_min_hz() == traits.get_frequency_max_hz()) {
117 ESP_LOGCONFIG(TAG,
" Frequency: %.3f MHz (fixed)", traits.get_frequency_min_hz() / 1e6f);
119 ESP_LOGCONFIG(TAG,
" Frequency Range: %.3f - %.3f MHz", traits.get_frequency_min_hz() / 1e6f,
120 traits.get_frequency_max_hz() / 1e6f);