ESPHome 2026.5.0b1
Loading...
Searching...
No Matches
esphome::radio_frequency::RadioFrequencyCall Class Reference

RadioFrequencyCall - Builder pattern for transmitting radio frequency signals. More...

#include <radio_frequency.h>

Public Member Functions

 RadioFrequencyCall (RadioFrequency *parent)
 
RadioFrequencyCallset_frequency (uint32_t frequency_hz)
 Set the carrier frequency in Hz (e.g. 433920000 for 433.92 MHz)
 
RadioFrequencyCallset_modulation (RadioFrequencyModulation modulation)
 Set the modulation type (defaults to OOK)
 
RadioFrequencyCallset_raw_timings (const std::vector< int32_t > &timings)
 Set the raw timings from a vector (positive = mark, negative = space)
 
RadioFrequencyCallset_raw_timings_base64url (const std::string &base64url)
 Set the raw timings from base64url-encoded little-endian int32 data.
 
RadioFrequencyCallset_raw_timings_packed (const uint8_t *data, uint16_t length, uint16_t count)
 Set the raw timings from packed protobuf sint32 data (zigzag + varint encoded)
 
RadioFrequencyCallset_repeat_count (uint32_t count)
 Set the number of times to repeat transmission (1 = transmit once, 2 = transmit twice, etc.)
 
void perform ()
 Perform the transmission.
 
const optional< uint32_t > & get_frequency () const
 Get the frequency in Hz.
 
RadioFrequencyModulation get_modulation () const
 Get the modulation type.
 
const std::vector< int32_t > & get_raw_timings () const
 Get the raw timings (only valid if set via set_raw_timings)
 
bool has_raw_timings () const
 Check if raw timings have been set (any format)
 
bool is_packed () const
 Check if using packed data format.
 
bool is_base64url () const
 Check if using base64url data format.
 
const std::string & get_base64url_data () const
 Get the base64url data string.
 
const uint8_t * get_packed_data () const
 Get packed data (only valid if set via set_raw_timings_packed)
 
uint16_t get_packed_length () const
 
uint16_t get_packed_count () const
 
uint32_t get_repeat_count () const
 Get the repeat count.
 

Protected Attributes

optional< uint32_tfrequency_hz_ {}
 
uint32_t repeat_count_ {1}
 
RadioFrequencyparent_
 
const std::vector< int32_t > * raw_timings_ {nullptr}
 
const std::string * base64url_ptr_ {nullptr}
 
const uint8_t * packed_data_ {nullptr}
 
uint16_t packed_length_ {0}
 
uint16_t packed_count_ {0}
 
RadioFrequencyModulation modulation_ {RADIO_FREQUENCY_MODULATION_OOK}
 

Detailed Description

RadioFrequencyCall - Builder pattern for transmitting radio frequency signals.

Definition at line 32 of file radio_frequency.h.

Constructor & Destructor Documentation

◆ RadioFrequencyCall()

esphome::radio_frequency::RadioFrequencyCall::RadioFrequencyCall ( RadioFrequency * parent)
inlineexplicit

Definition at line 34 of file radio_frequency.h.

Member Function Documentation

◆ get_base64url_data()

const std::string & esphome::radio_frequency::RadioFrequencyCall::get_base64url_data ( ) const
inline

Get the base64url data string.

Definition at line 85 of file radio_frequency.h.

◆ get_frequency()

const optional< uint32_t > & esphome::radio_frequency::RadioFrequencyCall::get_frequency ( ) const
inline

Get the frequency in Hz.

Definition at line 71 of file radio_frequency.h.

◆ get_modulation()

RadioFrequencyModulation esphome::radio_frequency::RadioFrequencyCall::get_modulation ( ) const
inline

Get the modulation type.

Definition at line 73 of file radio_frequency.h.

◆ get_packed_count()

uint16_t esphome::radio_frequency::RadioFrequencyCall::get_packed_count ( ) const
inline

Definition at line 89 of file radio_frequency.h.

◆ get_packed_data()

const uint8_t * esphome::radio_frequency::RadioFrequencyCall::get_packed_data ( ) const
inline

Get packed data (only valid if set via set_raw_timings_packed)

Definition at line 87 of file radio_frequency.h.

◆ get_packed_length()

uint16_t esphome::radio_frequency::RadioFrequencyCall::get_packed_length ( ) const
inline

Definition at line 88 of file radio_frequency.h.

◆ get_raw_timings()

const std::vector< int32_t > & esphome::radio_frequency::RadioFrequencyCall::get_raw_timings ( ) const
inline

Get the raw timings (only valid if set via set_raw_timings)

Definition at line 75 of file radio_frequency.h.

◆ get_repeat_count()

uint32_t esphome::radio_frequency::RadioFrequencyCall::get_repeat_count ( ) const
inline

Get the repeat count.

Definition at line 91 of file radio_frequency.h.

◆ has_raw_timings()

bool esphome::radio_frequency::RadioFrequencyCall::has_raw_timings ( ) const
inline

Check if raw timings have been set (any format)

Definition at line 77 of file radio_frequency.h.

◆ is_base64url()

bool esphome::radio_frequency::RadioFrequencyCall::is_base64url ( ) const
inline

Check if using base64url data format.

Definition at line 83 of file radio_frequency.h.

◆ is_packed()

bool esphome::radio_frequency::RadioFrequencyCall::is_packed ( ) const
inline

Check if using packed data format.

Definition at line 81 of file radio_frequency.h.

◆ perform()

void esphome::radio_frequency::RadioFrequencyCall::perform ( )

Perform the transmission.

Definition at line 55 of file radio_frequency.cpp.

◆ set_frequency()

RadioFrequencyCall & esphome::radio_frequency::RadioFrequencyCall::set_frequency ( uint32_t frequency_hz)

Set the carrier frequency in Hz (e.g. 433920000 for 433.92 MHz)

Definition at line 17 of file radio_frequency.cpp.

◆ set_modulation()

RadioFrequencyCall & esphome::radio_frequency::RadioFrequencyCall::set_modulation ( RadioFrequencyModulation modulation)

Set the modulation type (defaults to OOK)

Definition at line 22 of file radio_frequency.cpp.

◆ set_raw_timings()

RadioFrequencyCall & esphome::radio_frequency::RadioFrequencyCall::set_raw_timings ( const std::vector< int32_t > & timings)

Set the raw timings from a vector (positive = mark, negative = space)

Note
Lifetime: Stores a pointer to the vector. The vector must outlive perform().
Usage: Primarily for lambdas/automations where the vector is in scope.

Definition at line 27 of file radio_frequency.cpp.

◆ set_raw_timings_base64url()

RadioFrequencyCall & esphome::radio_frequency::RadioFrequencyCall::set_raw_timings_base64url ( const std::string & base64url)

Set the raw timings from base64url-encoded little-endian int32 data.

Note
Lifetime: Stores a pointer to the string. The string must outlive perform().
Usage: For web_server - base64url is fully URL-safe (uses '-' and '_').
Decoding happens at perform() time, directly into the transmit buffer.

Definition at line 34 of file radio_frequency.cpp.

◆ set_raw_timings_packed()

RadioFrequencyCall & esphome::radio_frequency::RadioFrequencyCall::set_raw_timings_packed ( const uint8_t * data,
uint16_t length,
uint16_t count )

Set the raw timings from packed protobuf sint32 data (zigzag + varint encoded)

Note
Lifetime: Stores a pointer to the buffer. The buffer must outlive perform().
Usage: For API component where data comes directly from the protobuf message.

Definition at line 41 of file radio_frequency.cpp.

◆ set_repeat_count()

RadioFrequencyCall & esphome::radio_frequency::RadioFrequencyCall::set_repeat_count ( uint32_t count)

Set the number of times to repeat transmission (1 = transmit once, 2 = transmit twice, etc.)

Definition at line 50 of file radio_frequency.cpp.

Field Documentation

◆ base64url_ptr_

const std::string* esphome::radio_frequency::RadioFrequencyCall::base64url_ptr_ {nullptr}
protected

Definition at line 100 of file radio_frequency.h.

◆ frequency_hz_

optional<uint32_t> esphome::radio_frequency::RadioFrequencyCall::frequency_hz_ {}
protected

Definition at line 94 of file radio_frequency.h.

◆ modulation_

RadioFrequencyModulation esphome::radio_frequency::RadioFrequencyCall::modulation_ {RADIO_FREQUENCY_MODULATION_OOK}
protected

Definition at line 105 of file radio_frequency.h.

◆ packed_count_

uint16_t esphome::radio_frequency::RadioFrequencyCall::packed_count_ {0}
protected

Definition at line 104 of file radio_frequency.h.

◆ packed_data_

const uint8_t* esphome::radio_frequency::RadioFrequencyCall::packed_data_ {nullptr}
protected

Definition at line 102 of file radio_frequency.h.

◆ packed_length_

uint16_t esphome::radio_frequency::RadioFrequencyCall::packed_length_ {0}
protected

Definition at line 103 of file radio_frequency.h.

◆ parent_

RadioFrequency* esphome::radio_frequency::RadioFrequencyCall::parent_
protected

Definition at line 96 of file radio_frequency.h.

◆ raw_timings_

const std::vector<int32_t>* esphome::radio_frequency::RadioFrequencyCall::raw_timings_ {nullptr}
protected

Definition at line 98 of file radio_frequency.h.

◆ repeat_count_

uint32_t esphome::radio_frequency::RadioFrequencyCall::repeat_count_ {1}
protected

Definition at line 95 of file radio_frequency.h.


The documentation for this class was generated from the following files: