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

Decodes a bitstream with the desired baud rate. More...

#include <fsk.hh>

Inheritance diagram for sdr::BitStream:
sdr::Sink< uint8_t > sdr::Source sdr::SinkBase

Public Types

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

Public Member Functions

 BitStream (float baud, Mode mode=TRANSITION)
 Constructor. More...
 
void config (const Config &src_cfg)
 Needs to be implemented by any sub-type to check and perform the configuration of the node. More...
 
void process (const Buffer< uint8_t > &buffer, bool allow_overwrite)
 Needs to be implemented by any sub-type to process the received data. More...
 
- Public Member Functions inherited from sdr::Sink< uint8_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 Attributes

float _baud
 The baud rate. More...
 
Mode _mode
 The bit detection mode. More...
 
size_t _corrLen
 The approximative bit length in samples. More...
 
Buffer< int8_t > _symbols
 Last received symbols. More...
 
size_t _symIdx
 Insertion index for the next symbol. More...
 
int32_t _symSum
 Sum over all received symbol (encoded as -1 & 1). More...
 
int32_t _lastSymSum
 Last sum over all received symbol (encoded as -1 & 1). More...
 
float _phase
 Current bit "phase". More...
 
float _omega
 Phase velocity. More...
 
float _omegaMin
 Minimum phase velocity. More...
 
float _omegaMax
 Maximum phase velocity. More...
 
float _pllGain
 PLL gain. More...
 
uint8_t _lastBits
 The last decoded bits (needed for transition mode). 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...
 

Additional Inherited Members

- 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...
 

Detailed Description

Decodes a bitstream with the desired baud rate.

This node implements a simple PLL to syncronize the bit sampling with the transitions of the input symbol sequence.

Member Enumeration Documentation

Possible bit decoding modes.

Enumerator
NORMAL 

Normal mode (i.e. mark -> 1, space -> 0).

TRANSITION 

Transition mode (i.e. transition -> 0, no transition -> 1).

Constructor & Destructor Documentation

BitStream::BitStream ( float  baud,
Mode  mode = TRANSITION 
)

Constructor.

Parameters
baudSpecifies the baud-rate of the input signal.
modeSpecifies the bit detection mode.

Member Function Documentation

void BitStream::config ( const Config src_cfg)
virtual

Needs to be implemented by any sub-type to check and perform the configuration of the node.

Implements sdr::SinkBase.

void BitStream::process ( const Buffer< uint8_t > &  buffer,
bool  allow_overwrite 
)
virtual

Needs to be implemented by any sub-type to process the received data.

Implements sdr::Sink< uint8_t >.

Member Data Documentation

float sdr::BitStream::_baud
protected

The baud rate.

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

Output buffer.

size_t sdr::BitStream::_corrLen
protected

The approximative bit length in samples.

uint8_t sdr::BitStream::_lastBits
protected

The last decoded bits (needed for transition mode).

int32_t sdr::BitStream::_lastSymSum
protected

Last sum over all received symbol (encoded as -1 & 1).

Mode sdr::BitStream::_mode
protected

The bit detection mode.

float sdr::BitStream::_omega
protected

Phase velocity.

float sdr::BitStream::_omegaMax
protected

Maximum phase velocity.

float sdr::BitStream::_omegaMin
protected

Minimum phase velocity.

float sdr::BitStream::_phase
protected

Current bit "phase".

float sdr::BitStream::_pllGain
protected

PLL gain.

Buffer<int8_t> sdr::BitStream::_symbols
protected

Last received symbols.

size_t sdr::BitStream::_symIdx
protected

Insertion index for the next symbol.

int32_t sdr::BitStream::_symSum
protected

Sum over all received symbol (encoded as -1 & 1).


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