Open RTS
Full implementation of the Somfy RTS protocol
Loading...
Searching...
No Matches
RTSFrameBuilder Class Reference

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

Detailed Description

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.

Member Typedef Documentation

◆ FrameCallback

typedef void(* RTSFrameBuilder::FrameCallback) (RTSFrame *frame, uint8_t repeatCount, uint32_t repeatDuration, void *userData)

Frame callback function type.

Parameters
framethe RTSFrame that was detected.
repeatCountnumber of times this exact frame was repeated
repeatDurationhow long since we first saw this repeated frame, in milliseconds
userDatacustom userdata provided to RTSFrameBuilder::onFrame, if any

Constructor & Destructor Documentation

◆ RTSFrameBuilder()

RTSFrameBuilder::RTSFrameBuilder ( rts_timings timings = RTS_TIMINGS_DEFAULT)

Construct an RTSFrameBuilder with the specified timings.

Parameters
timingsthe rts_timings struct to use for pulse decoding

Member Function Documentation

◆ setFrameCallback()

void RTSFrameBuilder::setFrameCallback ( FrameCallback  callback,
void *  userData = nullptr 
)

Set a callback to call when new complete frames are received.

Parameters
callbackthe callback to fire
userDataoptional custom user data pointer, will be included as the last parameter when callback is fired

◆ handlePulse()

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.

Parameters
stateboolean pulse logic state, true = HIGH, false = LOW
microsthe time the pulse was in this state, in microseconds

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