Open RTS
Full implementation of the Somfy RTS protocol
|
Assembles pulses received via RTSFrameBuilder::handlePulse, into a complete RTSFrame, and delivers them to the user-provided callback. More...
#include <RTSFrameBuilder.hpp>
Inherits rts_frame_builder.
Public Types | |
typedef void(* | FrameCallback) (RTSFrame *frame, uint8_t repeatCount, uint32_t repeatDuration, void *userData) |
Frame callback function type. | |
Public Member Functions | |
RTSFrameBuilder (rts_timings *timings=RTS_TIMINGS_DEFAULT) | |
Construct an RTSFrameBuilder with the specified timings. | |
void | setFrameCallback (FrameCallback callback, void *userData=nullptr) |
Set a callback to call when new complete frames are received. | |
void | handlePulse (bool state, uint32_t micros) |
Inform the frame builder about a new pulse. | |
Friends | |
class | RTSPulseSource |
Additional Inherited Members | |
Related Symbols inherited from rts_frame_builder | |
void | rts_frame_builder_init (struct rts_frame_builder *builder, struct rts_timings *timings) |
Initialize an rts_frame_builder with the specified timings. | |
void | rts_frame_builder_handle_pulse (struct rts_frame_builder *builder, bool state, uint32_t micros) |
Inform the frame builder about a new pulse. | |
void | rts_frame_builder_set_callback (struct rts_frame_builder *builder, void(*callback)(struct rts_frame *frame, uint8_t count, uint32_t duration, void *user_data), void *user_data) |
Set a callback to call when new complete frames are received. | |
Assembles pulses received via RTSFrameBuilder::handlePulse, into a complete RTSFrame, and delivers them to the user-provided callback.
This class will fire the callback set by RTSFrameBuilder::setFrameCallback every time a valid RTS frame is received. It does not perform any sort of deduplication, or validation of remote addresses or rolling codes, which makes it ideal for building a "frame sniffer", "remote sniffer", or any kind of promiscuous receiver.
An RTSFrameBuilder can be attached to an RTSPulseSrouce (eg. a GPIO or radio) with RTSPulseSource::attach to observe pulses and build frames automatically.
typedef void(* RTSFrameBuilder::FrameCallback) (RTSFrame *frame, uint8_t repeatCount, uint32_t repeatDuration, void *userData) |
Frame callback function type.
frame | the RTSFrame that was detected. |
repeatCount | number of times this exact frame was repeated |
repeatDuration | how long since we first saw this repeated frame, in milliseconds |
userData | custom userdata provided to RTSFrameBuilder::onFrame, if any |
RTSFrameBuilder::RTSFrameBuilder | ( | rts_timings * | timings = RTS_TIMINGS_DEFAULT | ) |
Construct an RTSFrameBuilder with the specified timings.
timings | the rts_timings struct to use for pulse decoding |
void RTSFrameBuilder::setFrameCallback | ( | FrameCallback | callback, |
void * | userData = nullptr |
||
) |
Set a callback to call when new complete frames are received.
callback | the callback to fire |
userData | optional custom user data pointer, will be included as the last parameter when callback is fired |
void RTSFrameBuilder::handlePulse | ( | bool | state, |
uint32_t | micros | ||
) |
Inform the frame builder about a new pulse.
This is typically called from an RTSPulseSource that has been attached using RTSPulseSource::attach.
state | boolean pulse logic state, true = HIGH, false = LOW |
micros | the time the pulse was in this state, in microseconds |