|
SatDump 2.0.0-alpha-520736c72
|
#include <block.h>
Public Types | |
| enum | cfg_res_t { RES_OK = 0 , RES_LISTUPD = 1 , RES_IOUPD = 2 , RES_ERR = 3 } |
| set_cfg status. More... | |
Public Member Functions | |
| virtual std::vector< BlockIO > | get_inputs () |
| Get the block's input configurations and streams. You should not modify them. | |
| virtual std::vector< BlockIO > | get_outputs () |
| Get the block's output configurations and streams. You should not modify them. | |
| virtual void | set_input (BlockIO f, int i) |
| Link an input to an output stream of some sort. This also checks the type of the BlockIO to ensure (some level of) compatibility. | |
| virtual BlockIO | get_output (int i, int nbuf) |
| Get one of the block's outputs, creating the fifo it if nbuf != 0. | |
| void | link (Block *ptr, int output_index, int input_index, int nbuf) |
| Link a block's output to another input, more or less just a warper around set_input and set_output. | |
| Block (std::string id, std::vector< BlockIO > in={}, std::vector< BlockIO > out={}) | |
| Generic constructor, to be overloaded. | |
| virtual bool | is_async () |
| Returns true if a block is async. An async block is a block that has outputs without inputs or inputs that won't directly affect/stop the outputs' behavior. This includes sources (eg, a SDR Device), TXing and RXing at the same time, and anything with similar requirements. | |
| virtual nlohmann::ordered_json | get_cfg_list () |
| Get parameters LIST of the block's parameters. This does not contain actual values, only a description of what is available. This will contains a name, optionally description, its type and range if applicable, string options and so on. This must be re-pulled in several cases : | |
| virtual nlohmann::json | get_cfg (std::string key)=0 |
| Get parameters of the block as JSON. | |
| nlohmann::json | get_cfg () |
| Get parameters of the block as JSON. Unlike get_cfg(key), this returns every single available parameter as declared by get_cfg_list(). | |
| virtual cfg_res_t | set_cfg (std::string key, nlohmann::json v)=0 |
| Set parameters of the block from JSON, including potentially IO configurations for blocks that may have variable output sizes. However, you likely should implemenet that in a separate function as well (eg, addVFO or such) for it to be easy to be done in C++ directly, and using said function here. Optionally, this can also be made to be functional while the block is running! | |
| cfg_res_t | set_cfg (nlohmann::json v) |
| Set parameters of the block from JSON. Essentially the same as set_cfg(key, v), except this will set any number of them at once. | |
| virtual void | start () |
| Starts this block's internal thread and loop. | |
| virtual void | stop (bool stop_now=false, bool force=false) |
| Stops the block, or rather tells the internal loop it should exit & joins the thread to wait. TODOREWORK, potentially allow sending the terminator as well to force-quit. | |
Public Attributes | |
| const std::string | d_id |
Protected Member Functions | |
| virtual bool | work ()=0 |
| The actual looping work function meant to handle all the DSP (well, in most blocks) | |
| bool | is_work_running () |
| template<typename T> | |
| void | setValFromJSONIfExists (T &v, nlohmann::json p) |
| virtual void | init () |
| Applies current parameters to the block. This is called automatically once in start(), but may also be called manually by the block as needed. | |
Protected Attributes | |
| std::vector< BlockIO > | inputs |
| std::vector< BlockIO > | outputs |
| bool | work_should_exit |
| Used to signal to a block it should exit in order to stop(). Usually only needed in sources. | |
Base Block class.
This has several goals :
See each function's documentation for more information!
| d_id | the block's ID |
| inputs | the block's inputs |
| outputs | the block's outputs |
set_cfg status.
| RES_OK | Applied fine |
| RES_LISTUPD | get_cfg_list must be pulled again |
| RES_IOUPD | IO Configuration changed (must ALSO re-pull get_cfg_list!!!) |
| RES_ERR | Config option not applied |
|
inline |
Generic constructor, to be overloaded.
| id | of the block, meant to be a short identifier (eg, agc_cc) |
| in | Inputs configurations, optional |
| out | Output configurations, optional |
|
inline |
Get parameters of the block as JSON. Unlike get_cfg(key), this returns every single available parameter as declared by get_cfg_list().
|
pure virtual |
Get parameters of the block as JSON.
| key | the parameter to retrieve |
Implemented in satdump::ndsp::AddBlock< T >, satdump::ndsp::AGCBlock< T >, satdump::ndsp::AGCBlock< complex_t >, satdump::ndsp::BlankerBlock< T >, satdump::ndsp::BlkAGCBlock< T >, satdump::ndsp::ChannelModelSimpleBlock, satdump::ndsp::CharToFloatBlock, satdump::ndsp::ComplexToFloatBlock, satdump::ndsp::ComplexToIFloatBlock, satdump::ndsp::ComplexToImagBlock, satdump::ndsp::ComplexToMagBlock, satdump::ndsp::ComplexToMagSquaredBlock, satdump::ndsp::ComplexToRealBlock, satdump::ndsp::ConstellationDisplayBlock, satdump::ndsp::CorrectIQBlock< T >, satdump::ndsp::CostasBlock, satdump::ndsp::CyclostationaryAnalysis, satdump::ndsp::DelayOneImagBlock, satdump::ndsp::ExponentiateBlock, satdump::ndsp::FFTPanBlock, satdump::ndsp::FileSinkBlock< T >, satdump::ndsp::FileSourceBlock< T >, satdump::ndsp::FIRBlock< T >, satdump::ndsp::FIRBlock< complex_t >, satdump::ndsp::FloatToCharBlock, satdump::ndsp::FloatToComplexBlock, satdump::ndsp::FreqShiftBlock, satdump::ndsp::HilbertBlock, satdump::ndsp::HistogramDisplayBlock, satdump::ndsp::IFloatToComplexBlock, satdump::ndsp::IQSinkBlock, satdump::ndsp::IQSourceBlock, satdump::ndsp::MMClockRecoveryBlock< T >, satdump::ndsp::MMClockRecoveryBlock< complex_t >, satdump::ndsp::MMClockRecoveryFastBlock< T >, satdump::ndsp::MultiplyBlock< T >, satdump::ndsp::NNGIQSinkBlock, satdump::ndsp::PLLCarrierTrackingBlock, satdump::ndsp::PSKDemodHierBlock, satdump::ndsp::QuadratureDemodBlock, satdump::ndsp::RationalResamplerBlock< T >, satdump::ndsp::RealToComplexBlock, satdump::ndsp::RRC_FIRBlock< T >, satdump::ndsp::RRC_FIRBlock< complex_t >, satdump::ndsp::SamplerateMeterBlock< T >, satdump::ndsp::ShortToFloatBlock, satdump::ndsp::SplitterBlock< T >, satdump::ndsp::SubtractBlock< T >, satdump::ndsp::ThrottleBlock< T >, satdump::ndsp::UCharToFloatBlock, satdump::ndsp::VCOBlock, and satdump::ndsp::WaveformBlock< T >.
|
inlinevirtual |
Get parameters LIST of the block's parameters. This does not contain actual values, only a description of what is available. This will contains a name, optionally description, its type and range if applicable, string options and so on. This must be re-pulled in several cases :
Reimplemented in satdump::ndsp::AddBlock< T >, satdump::ndsp::AGCBlock< T >, satdump::ndsp::AGCBlock< complex_t >, satdump::ndsp::BlankerBlock< T >, satdump::ndsp::BlkAGCBlock< T >, satdump::ndsp::ChannelModelSimpleBlock, satdump::ndsp::CharToFloatBlock, satdump::ndsp::ComplexToFloatBlock, satdump::ndsp::ComplexToIFloatBlock, satdump::ndsp::ComplexToMagBlock, satdump::ndsp::ComplexToMagSquaredBlock, satdump::ndsp::CostasBlock, satdump::ndsp::ExponentiateBlock, satdump::ndsp::FileSinkBlock< T >, satdump::ndsp::FileSourceBlock< T >, satdump::ndsp::FloatToCharBlock, satdump::ndsp::FloatToComplexBlock, satdump::ndsp::FreqShiftBlock, satdump::ndsp::HilbertBlock, satdump::ndsp::IFloatToComplexBlock, satdump::ndsp::IQSinkBlock, satdump::ndsp::IQSourceBlock, satdump::ndsp::MMClockRecoveryBlock< T >, satdump::ndsp::MMClockRecoveryBlock< complex_t >, satdump::ndsp::MMClockRecoveryFastBlock< T >, satdump::ndsp::MultiplyBlock< T >, satdump::ndsp::NNGIQSinkBlock, satdump::ndsp::PLLCarrierTrackingBlock, satdump::ndsp::PSKDemodHierBlock, satdump::ndsp::QuadratureDemodBlock, satdump::ndsp::RationalResamplerBlock< T >, satdump::ndsp::RRC_FIRBlock< T >, satdump::ndsp::RRC_FIRBlock< complex_t >, satdump::ndsp::SamplerateMeterBlock< T >, satdump::ndsp::ShortToFloatBlock, satdump::ndsp::SplitterBlock< T >, satdump::ndsp::SubtractBlock< T >, satdump::ndsp::ThrottleBlock< T >, satdump::ndsp::UCharToFloatBlock, satdump::ndsp::VCOBlock, and satdump::ndsp::WaveformBlock< T >.
|
inlinevirtual |
Get the block's input configurations and streams. You should not modify them.
Reimplemented in satdump::ndsp::PSKDemodHierBlock.
|
inlinevirtual |
Get one of the block's outputs, creating the fifo it if nbuf != 0.
| i | index of the output |
| nbuf | of buffers to setup in the output |
Reimplemented in satdump::ndsp::PSKDemodHierBlock.
|
inlinevirtual |
Get the block's output configurations and streams. You should not modify them.
Reimplemented in satdump::ndsp::PSKDemodHierBlock.
|
inlineprotectedvirtual |
Applies current parameters to the block. This is called automatically once in start(), but may also be called manually by the block as needed.
Reimplemented in satdump::ndsp::AddBlock< T >, satdump::ndsp::AGCBlock< T >, satdump::ndsp::AGCBlock< complex_t >, satdump::ndsp::BlankerBlock< T >, satdump::ndsp::BlkAGCBlock< T >, satdump::ndsp::ChannelModelSimpleBlock, satdump::ndsp::CharToFloatBlock, satdump::ndsp::ComplexToFloatBlock, satdump::ndsp::ComplexToIFloatBlock, satdump::ndsp::ComplexToImagBlock, satdump::ndsp::ComplexToMagBlock, satdump::ndsp::ComplexToMagSquaredBlock, satdump::ndsp::ComplexToRealBlock, satdump::ndsp::CorrectIQBlock< T >, satdump::ndsp::CostasBlock, satdump::ndsp::CyclostationaryAnalysis, satdump::ndsp::DelayOneImagBlock, satdump::ndsp::ExponentiateBlock, satdump::ndsp::FileSinkBlock< T >, satdump::ndsp::FileSourceBlock< T >, satdump::ndsp::FIRBlock< T >, satdump::ndsp::FIRBlock< complex_t >, satdump::ndsp::FloatToCharBlock, satdump::ndsp::FloatToComplexBlock, satdump::ndsp::FreqShiftBlock, satdump::ndsp::HilbertBlock, satdump::ndsp::IFloatToComplexBlock, satdump::ndsp::IQSinkBlock, satdump::ndsp::IQSourceBlock, satdump::ndsp::MMClockRecoveryBlock< T >, satdump::ndsp::MMClockRecoveryBlock< complex_t >, satdump::ndsp::MMClockRecoveryFastBlock< T >, satdump::ndsp::MultiplyBlock< T >, satdump::ndsp::PLLCarrierTrackingBlock, satdump::ndsp::PSKDemodHierBlock, satdump::ndsp::QuadratureDemodBlock, satdump::ndsp::RationalResamplerBlock< T >, satdump::ndsp::RealToComplexBlock, satdump::ndsp::SamplerateMeterBlock< T >, satdump::ndsp::ShortToFloatBlock, satdump::ndsp::SplitterBlock< T >, satdump::ndsp::SubtractBlock< T >, satdump::ndsp::ThrottleBlock< T >, satdump::ndsp::UCharToFloatBlock, satdump::ndsp::VCOBlock, and satdump::ndsp::WaveformBlock< T >.
|
inlinevirtual |
Returns true if a block is async. An async block is a block that has outputs without inputs or inputs that won't directly affect/stop the outputs' behavior. This includes sources (eg, a SDR Device), TXing and RXing at the same time, and anything with similar requirements.
|
inline |
Link a block's output to another input, more or less just a warper around set_input and set_output.
| ptr | block to get the output from |
| output_index | index of the output to use, from ptr |
| input_index | index of the input to asign no (this block, NOT ptr) |
| nbuf | of buffers to setup in the output (see set_input for more info) |
|
inline |
Set parameters of the block from JSON. Essentially the same as set_cfg(key, v), except this will set any number of them at once.
| v | values to set |
|
pure virtual |
Set parameters of the block from JSON, including potentially IO configurations for blocks that may have variable output sizes. However, you likely should implemenet that in a separate function as well (eg, addVFO or such) for it to be easy to be done in C++ directly, and using said function here. Optionally, this can also be made to be functional while the block is running!
| key | parameter to set |
| v | value to set |
Implemented in satdump::ndsp::AddBlock< T >, satdump::ndsp::AGCBlock< T >, satdump::ndsp::AGCBlock< complex_t >, satdump::ndsp::BlankerBlock< T >, satdump::ndsp::BlkAGCBlock< T >, satdump::ndsp::ChannelModelSimpleBlock, satdump::ndsp::CharToFloatBlock, satdump::ndsp::ComplexToFloatBlock, satdump::ndsp::ComplexToIFloatBlock, satdump::ndsp::ComplexToImagBlock, satdump::ndsp::ComplexToMagBlock, satdump::ndsp::ComplexToMagSquaredBlock, satdump::ndsp::ComplexToRealBlock, satdump::ndsp::ConstellationDisplayBlock, satdump::ndsp::CorrectIQBlock< T >, satdump::ndsp::CostasBlock, satdump::ndsp::CyclostationaryAnalysis, satdump::ndsp::DelayOneImagBlock, satdump::ndsp::ExponentiateBlock, satdump::ndsp::FFTPanBlock, satdump::ndsp::FileSinkBlock< T >, satdump::ndsp::FileSourceBlock< T >, satdump::ndsp::FIRBlock< T >, satdump::ndsp::FIRBlock< complex_t >, satdump::ndsp::FloatToCharBlock, satdump::ndsp::FloatToComplexBlock, satdump::ndsp::FreqShiftBlock, satdump::ndsp::HilbertBlock, satdump::ndsp::HistogramDisplayBlock, satdump::ndsp::IFloatToComplexBlock, satdump::ndsp::IQSinkBlock, satdump::ndsp::IQSourceBlock, satdump::ndsp::MMClockRecoveryBlock< T >, satdump::ndsp::MMClockRecoveryBlock< complex_t >, satdump::ndsp::MMClockRecoveryFastBlock< T >, satdump::ndsp::MultiplyBlock< T >, satdump::ndsp::NNGIQSinkBlock, satdump::ndsp::PLLCarrierTrackingBlock, satdump::ndsp::PSKDemodHierBlock, satdump::ndsp::QuadratureDemodBlock, satdump::ndsp::RationalResamplerBlock< T >, satdump::ndsp::RealToComplexBlock, satdump::ndsp::RRC_FIRBlock< T >, satdump::ndsp::RRC_FIRBlock< complex_t >, satdump::ndsp::SamplerateMeterBlock< T >, satdump::ndsp::ShortToFloatBlock, satdump::ndsp::SplitterBlock< T >, satdump::ndsp::SubtractBlock< T >, satdump::ndsp::ThrottleBlock< T >, satdump::ndsp::UCharToFloatBlock, satdump::ndsp::VCOBlock, and satdump::ndsp::WaveformBlock< T >.
|
inlinevirtual |
Link an input to an output stream of some sort. This also checks the type of the BlockIO to ensure (some level of) compatibility.
| f | input BlockIO to link to an input |
| i | index of the input (probably quite often 0) |
Reimplemented in satdump::ndsp::PSKDemodHierBlock.
|
inlinevirtual |
Starts this block's internal thread and loop.
Reimplemented in satdump::ndsp::IQSinkBlock, satdump::ndsp::NNGIQSinkBlock, and satdump::ndsp::PSKDemodHierBlock.
|
inlinevirtual |
Stops the block, or rather tells the internal loop it should exit & joins the thread to wait. TODOREWORK, potentially allow sending the terminator as well to force-quit.
| stop_now | the normal stop just marks the block for stopping when convenient, when the work() function exists by itself. Setting this to true will tell the block to stop now if it can send a terminator. |
| force | this will exit work() as soon as possible, leaving it in an unknown state. Do not use until it is for live-reconfiguration! |
Reimplemented in satdump::ndsp::IQSinkBlock, satdump::ndsp::NNGIQSinkBlock, and satdump::ndsp::PSKDemodHierBlock.
|
protectedpure virtual |
The actual looping work function meant to handle all the DSP (well, in most blocks)
Implemented in satdump::ndsp::ConstellationDisplayBlock, satdump::ndsp::HistogramDisplayBlock, and satdump::ndsp::PSKDemodHierBlock.