libsdr
0.1.0
A simple SDR library
|
A simple BPSK31 "demodulator". More...
#include <psk31.hh>
Public Member Functions | |
BPSK31 (double dF=0.1) | |
Constructs a new BPSK31 demodulator. More... | |
virtual | ~BPSK31 () |
Destructor. More... | |
virtual void | config (const Config &src_cfg) |
Needs to be implemented by any sub-type to check and perform the configuration of the node. More... | |
virtual void | process (const Buffer< std::complex< Scalar > > &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< std::complex< Scalar > > | |
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 | |
bool | _hasTransition () const |
Returns true if there is a phase transition at the current sample. More... | |
int | _currentContellation () const |
Returns the current constellation. More... | |
float | _phaseError (const std::complex< float > &value) const |
Computes the phase error. More... | |
void | _updatePLL (const std::complex< float > &sample) |
Updates the PLL (_F and _P ). More... | |
void | _updateSampler (const std::complex< Scalar > &value) |
Updates the sub-sampler. More... | |
void | _errorTracking (const std::complex< float > &sample) |
Updates the PPL state (_mu and _omega ). 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 | |
size_t | _superSample |
Holds the number of phase constellations per bit. More... | |
float | _P |
Phase of the carrier PLL. More... | |
float | _F |
Frequency of the carrier PLL. More... | |
float | _Fmin |
Lower frequency limit of the carrier PLL. More... | |
float | _Fmax |
Upper frequency limit of the carrier PLL. More... | |
float | _alpha |
Gain factor of the carrier PLL. More... | |
float | _beta |
Gain factor of the carrier PLL. More... | |
Buffer< std::complex< float > > | _dl |
The delay line for the interpolating sub-sampler. More... | |
size_t | _dl_idx |
The current index of the delay line. More... | |
float | _mu |
Holds the fractional sub-sampling counter. More... | |
float | _gain_mu |
Gain factor of the sub-sampler. More... | |
float | _theta |
Constant phase shift between real axis and first constellation. More... | |
float | _omega |
Current sub-sample rate. More... | |
float | _omega_rel |
Relative error of the subsample rate. More... | |
float | _min_omega |
Minimum of the sub-sample rate. More... | |
float | _max_omega |
Maximum of the sub-sample rate. More... | |
float | _gain_omega |
Gain of the sub-sample rate correction. More... | |
std::complex< float > | _p_0T |
Phase at T = 0 (samples). More... | |
std::complex< float > | _p_1T |
Phase at T=-1 (samples). More... | |
std::complex< float > | _p_2T |
Phase at T=-2 (samples). More... | |
std::complex< float > | _c_0T |
Constellation at T=0 (samples). More... | |
std::complex< float > | _c_1T |
Constellation at T=-1 (samples). More... | |
std::complex< float > | _c_2T |
Constellation at T=-2 (samples). More... | |
Buffer< float > | _hist |
The last _superSample phases. More... | |
size_t | _hist_idx |
Current phase history index. More... | |
int | _last_constellation |
The last output constellation. 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... | |
A simple BPSK31 "demodulator".
This node consumes a complex input stream with a sample rate of at least 2000Hz and produces a bitstream with 31.25 Hz "sample rate". Use the Varicode
node to decode this bitstream to ASCII chars. The BPSK31 signal should be centered around 0Hz. This node uses a simple PLL to adjust for small detunings.
|
inline |
Constructs a new BPSK31 demodulator.
This node first subsamples the input signal to a multiple of 31.25 Hz (by default to 2000Hz = 64*31.25) using an interpolating sub-sampler. Therefore, the input signal must be filtered sufficiently well to avoid artifacts of the interpolating sub-sampler. Then, the phase-constellation of the signal is determined as either -pi or pi while the frequency of the carrier is tracked using a simple PLL. Finally, the BPSK31 bit stream is decoded by detecting a phase-change (0) or not (1).
dF | Specfies the (relative anglular) frequency range of the PLL to adjust for small deviations of the BPSK31 signal from 0Hz. |
|
inlinevirtual |
Destructor.
|
inlineprotected |
Returns the current constellation.
|
inlineprotected |
Updates the PPL state (_mu
and _omega
).
|
inlineprotected |
Returns true
if there is a phase transition at the current sample.
|
inlineprotected |
Computes the phase error.
|
inlineprotected |
Updates the PLL (_F
and _P
).
|
inlineprotected |
Updates the sub-sampler.
|
inlinevirtual |
Needs to be implemented by any sub-type to check and perform the configuration of the node.
Implements sdr::SinkBase.
|
inlinevirtual |
Needs to be implemented by any sub-type to process the received data.
Implements sdr::Sink< std::complex< Scalar > >.
|
protected |
Gain factor of the carrier PLL.
|
protected |
Gain factor of the carrier PLL.
|
protected |
Output buffer.
|
protected |
Constellation at T=0 (samples).
|
protected |
Constellation at T=-1 (samples).
|
protected |
Constellation at T=-2 (samples).
|
protected |
The delay line for the interpolating sub-sampler.
|
protected |
The current index of the delay line.
|
protected |
Frequency of the carrier PLL.
|
protected |
Upper frequency limit of the carrier PLL.
|
protected |
Lower frequency limit of the carrier PLL.
|
protected |
Gain factor of the sub-sampler.
|
protected |
Gain of the sub-sample rate correction.
|
protected |
The last _superSample
phases.
|
protected |
Current phase history index.
|
protected |
The last output constellation.
|
protected |
Maximum of the sub-sample rate.
|
protected |
Minimum of the sub-sample rate.
|
protected |
Holds the fractional sub-sampling counter.
|
protected |
Current sub-sample rate.
|
protected |
Relative error of the subsample rate.
|
protected |
Phase of the carrier PLL.
|
protected |
Phase at T = 0 (samples).
|
protected |
Phase at T=-1 (samples).
|
protected |
Phase at T=-2 (samples).
|
protected |
Holds the number of phase constellations per bit.
|
protected |
Constant phase shift between real axis and first constellation.
(Currently unused).