libsdr  0.1.0
A simple SDR library
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
sdr::AFSK Class Reference

A simple (Audio) Frequency Shift Keying (AFSK) demodulator. More...

#include <afsk.hh>

Inheritance diagram for sdr::AFSK:
sdr::Sink< int16_t > sdr::Source sdr::SinkBase

Public Types

enum  Mode { NORMAL, TRANSITION }
 Possible bit decoding modes. More...
 

Public Member Functions

 AFSK (double baud=1200.0, double Fmark=1200.0, double Fspace=2200.0, Mode mode=TRANSITION)
 Constructs a AFSK node with the specified baud rate and Fmark, Fspace frequencies. More...
 
virtual ~AFSK ()
 Destructor. More...
 
virtual void config (const Config &src_cfg)
 Configures the node. More...
 
virtual void process (const Buffer< int16_t > &buffer, bool allow_overwrite)
 Processes the given buffer. More...
 
- Public Member Functions inherited from sdr::Sink< int16_t >
 Sink ()
 Constructor. More...
 
virtual ~Sink ()
 Drestructor. More...
 
virtual void handleBuffer (const RawBuffer &buffer, bool allow_overwrite)
 Re-implemented from SinkBase. More...
 
- Public Member Functions inherited from sdr::SinkBase
 SinkBase ()
 Constructor. More...
 
virtual ~SinkBase ()
 Destructor. More...
 
- Public Member Functions inherited from sdr::Source
 Source ()
 Constructor. More...
 
virtual ~Source ()
 Destructor. More...
 
virtual void send (const RawBuffer &buffer, bool allow_overwrite=false)
 Sends the given buffer to all connected sinks. More...
 
void connect (SinkBase *sink, bool direct=false)
 Connect this source to a sink. More...
 
void disconnect (SinkBase *sink)
 Disconnect a sink again. More...
 
virtual void setConfig (const Config &config)
 Stores the configuration and propergates it if the configuration has been changed. More...
 
virtual double sampleRate () const
 Returns the configured sample rate or 0 otherwise. More...
 
virtual Config::Type type () const
 Returns the configured source type or Config::Type_UNDEFINED otherwise. More...
 
template<class T >
void addEOS (T *instance, void(T::*function)())
 Adds a callback to the end-of-stream signal of the source. More...
 

Protected Member Functions

double _getSymbol ()
 Performs the convolution filtering of the mark & space frequencies. More...
 
- Protected Member Functions inherited from sdr::Source
void signalEOS ()
 Signals the EOS. More...
 
void propagateConfig (const Config &config)
 Propagates the given configuration to all connected sinks. More...
 

Protected Attributes

float _sampleRate
 The sample rate of the input signal. More...
 
float _symbolRate
 A multiple of the baud rate. More...
 
float _baud
 The baud rate. More...
 
float _Fmark
 Mark "tone" frequency. More...
 
float _Fspace
 Space "tone" frequency. More...
 
Mode _mode
 Bit encoding mode. More...
 
uint32_t _corrLen
 Correlation length, the number of "symbols" per bit. More...
 
uint32_t _lutIdx
 The current FIR filter LUT index. More...
 
Buffer< std::complex< float > > _markLUT
 Mark frequency FIR filter LUT. More...
 
Buffer< std::complex< float > > _spaceLUT
 Space frequency FIR filter LUT. More...
 
Buffer< std::complex< float > > _markHist
 FIR filter buffer. More...
 
Buffer< std::complex< float > > _spaceHist
 FIR filter buffer. More...
 
float _mu
 Symbol subsampling counter. More...
 
float _muIncr
 Symbol subsampling. More...
 
Buffer< float > _dl
 Delay line for the 8-pole interpolation filter. More...
 
size_t _dl_idx
 Delay line index. More...
 
Buffer< int16_t > _symbols
 Ring buffer of the last _corrLen symbols. More...
 
size_t _symbolIdx
 Insertion index. More...
 
int32_t _symSum
 Sum of the current _corrLen symbols. More...
 
int32_t _lastSymSum
 Sum of the last _corrLen symbols. More...
 
uint32_t _lastBits
 Last received bits. More...
 
float _phase
 Current PLL phase. More...
 
float _omega
 PLL phase speed. More...
 
float _omegaMin
 Maximum PLL phase speed. More...
 
float _omegaMax
 Minimum PLL phase speed. More...
 
float _gainOmega
 PLL gain. More...
 
Buffer< uint8_t > _buffer
 Output buffer. More...
 
- Protected Attributes inherited from sdr::Source
Config _config
 Holds the source configuration, this can be updated by calling setConfig. More...
 
std::map< SinkBase *, bool > _sinks
 The connected sinks. More...
 
std::list< DelegateInterface * > _eos
 The connected EOS singal handlers. More...
 

Detailed Description

A simple (Audio) Frequency Shift Keying (AFSK) demodulator.

This node consists of two convolution peak-filters at the mark and space frequencies, a interpolating sub-sampler to match the baud-rate exactly and a PLL to lock to the symbol transitions. The node will decode the (A)FSK signal and will send a bit-stream (uint8_t).

Constructor & Destructor Documentation

AFSK::AFSK ( double  baud = 1200.0,
double  Fmark = 1200.0,
double  Fspace = 2200.0,
Mode  mode = TRANSITION 
)

Constructs a AFSK node with the specified baud rate and Fmark, Fspace frequencies.

The default valuse corresponds to those used for 1200 baud packet radio.

AFSK::~AFSK ( )
virtual

Destructor.

Member Function Documentation

double sdr::AFSK::_getSymbol ( )
inlineprotected

Performs the convolution filtering of the mark & space frequencies.

void AFSK::config ( const Config src_cfg)
virtual

Configures the node.

Implements sdr::SinkBase.

void AFSK::process ( const Buffer< int16_t > &  buffer,
bool  allow_overwrite 
)
virtual

Processes the given buffer.

std::cerr << "Transition at phi=" << _phase << std::endl << " update omega from " << _omega << " to ";

Implements sdr::Sink< int16_t >.

Member Data Documentation

float sdr::AFSK::_baud
protected

The baud rate.

Buffer<uint8_t> sdr::AFSK::_buffer
protected

Output buffer.

uint32_t sdr::AFSK::_corrLen
protected

Correlation length, the number of "symbols" per bit.

Buffer< float > sdr::AFSK::_dl
protected

Delay line for the 8-pole interpolation filter.

size_t sdr::AFSK::_dl_idx
protected

Delay line index.

float sdr::AFSK::_Fmark
protected

Mark "tone" frequency.

float sdr::AFSK::_Fspace
protected

Space "tone" frequency.

float sdr::AFSK::_gainOmega
protected

PLL gain.

uint32_t sdr::AFSK::_lastBits
protected

Last received bits.

int32_t sdr::AFSK::_lastSymSum
protected

Sum of the last _corrLen symbols.

uint32_t sdr::AFSK::_lutIdx
protected

The current FIR filter LUT index.

Buffer< std::complex<float> > sdr::AFSK::_markHist
protected

FIR filter buffer.

Buffer< std::complex<float> > sdr::AFSK::_markLUT
protected

Mark frequency FIR filter LUT.

Mode sdr::AFSK::_mode
protected

Bit encoding mode.

float sdr::AFSK::_mu
protected

Symbol subsampling counter.

float sdr::AFSK::_muIncr
protected

Symbol subsampling.

float sdr::AFSK::_omega
protected

PLL phase speed.

float sdr::AFSK::_omegaMax
protected

Minimum PLL phase speed.

float sdr::AFSK::_omegaMin
protected

Maximum PLL phase speed.

float sdr::AFSK::_phase
protected

Current PLL phase.

float sdr::AFSK::_sampleRate
protected

The sample rate of the input signal.

Buffer< std::complex<float> > sdr::AFSK::_spaceHist
protected

FIR filter buffer.

Buffer< std::complex<float> > sdr::AFSK::_spaceLUT
protected

Space frequency FIR filter LUT.

size_t sdr::AFSK::_symbolIdx
protected

Insertion index.

float sdr::AFSK::_symbolRate
protected

A multiple of the baud rate.

Buffer<int16_t> sdr::AFSK::_symbols
protected

Ring buffer of the last _corrLen symbols.

int32_t sdr::AFSK::_symSum
protected

Sum of the current _corrLen symbols.


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