atMETEO
An ATmega based weather station
Files | Classes | Enumerations

Sensors::RfDevice is the base template for RF receivers connecting Demodulator, Bit Decoder and Sensor. More...

Collaboration diagram for RF Device:

Files

file  rfdevice.h
 Sensors::RfDevice is the base template for RF receivers connecting Demodulator, Bit Decoder and Sensor.
 

Classes

class  Sensors::RfDevice< TDemodulator, TBitDecoder, TSensor, TBitLength >
 Connects Demodulator, Bit Decoder and Sensor for decoding sensor data from RF receivers. More...
 

Enumerations

enum  Sensors::RfDeviceStatus : uint8_t { Sensors::RfDeviceStatus::Complete = 0, Sensors::RfDeviceStatus::Incomplete, Sensors::RfDeviceStatus::InvalidData }
 RfDevice status returned from RfDevice::addPulseWidth(). More...
 

Detailed Description

Sensors::RfDevice is the base template for RF receivers connecting Demodulator, Bit Decoder and Sensor.


Class Documentation

◆ Sensors::RfDevice

class Sensors::RfDevice

template<typename TDemodulator, typename TBitDecoder, typename TSensor, uint16_t TBitLength = 0>
class Sensors::RfDevice< TDemodulator, TBitDecoder, TSensor, TBitLength >

Connects Demodulator, Bit Decoder and Sensor for decoding sensor data from RF receivers.

Usage:

using namespace Sensors;
MyDevice myRfDevice;
RfDevice &rfdevice = myRfDevice;
while (...) {
switch (rfdevice.addPulseWidth(pulseWidth)) {
break;
handle_complete_rfdevice_data(myRfDevice.getData());
break;
default:
break;
}
}

Accessing sensor data is specific to the sensor therefore there is no generic API defined.

Template Parameters
TDemodulatorThe demodulator configuration.
TBitDecoderThe demodulator configuration.
TSensorThe sensor configuration.
TBitLengthMaximum length of a message in bits. If set to a non-zero value, the RfDevice will expect to receive as many bits as specified before the TSensor is called for decoding the data.
Attention
This class must not be used directly, it only serves as template for specific RF devices.

Public Member Functions

RfDeviceStatus addPulseWidth (uint16_t pulseWidth)
 Adds the pulseWidth value to the RfDevice state. More...
 
void reset ()
 Resets the device state. More...
 

Member Function Documentation

◆ addPulseWidth()

template<typename TDemodulator , typename TBitDecoder , typename TSensor , uint16_t TBitLength = 0>
RfDeviceStatus Sensors::RfDevice< TDemodulator, TBitDecoder, TSensor, TBitLength >::addPulseWidth ( uint16_t  pulseWidth)
inline

Adds the pulseWidth value to the RfDevice state.

This function will call TDeviceObserver::dataAvailable() as soon as a complete sensor data set has been decoded.

Parameters
pulseWidthPulse width to add.
Returns
RfDevice state after adding the pulse width.

◆ reset()

template<typename TDemodulator , typename TBitDecoder , typename TSensor , uint16_t TBitLength = 0>
void Sensors::RfDevice< TDemodulator, TBitDecoder, TSensor, TBitLength >::reset ( )
inline

Resets the device state.

Enumeration Type Documentation

◆ RfDeviceStatus

enum Sensors::RfDeviceStatus : uint8_t
strong

RfDevice status returned from RfDevice::addPulseWidth().

Enumerator
Complete 

The RfDevice data is complete. The decoded data can be accessed using sensor specific methods.

Incomplete 

The RfDevice data is incomplete. More pulse widths have to be added using RfDevice::addPulseWidth() before the data can be accessed.

InvalidData 

The received data is invalid. A new decoder run is started automatically when new pulse widths are added using RfDevice::addPulseWidth().