SatDump 2.0.0-alpha-76a915210
|
Simplified DSP block implementation, for synchronous blocks that can process one buffer at a time. Takes away the burden of boilerplate code. More...
#include <block_simple.h>
Public Member Functions | |
BlockSimple (std::string id, std::vector< BlockIO > in={}, std::vector< BlockIO > out={}) | |
virtual uint32_t | process (Ti *input, uint32_t nsamples, To *output)=0 |
Simplified "work" function, called automatically by work(). This takes away all boilerplate work usually needed, making simpler block implementations more trivial to work with. | |
Public Member Functions inherited from satdump::ndsp::Block | |
std::vector< BlockIO > | get_inputs () |
Get the block's input configurations and streams. You should not modify them. | |
std::vector< BlockIO > | get_outputs () |
Get the block's output configurations and streams. You should not modify them. | |
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. | |
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 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) |
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. |
Additional Inherited Members | |
Public Types inherited from satdump::ndsp::Block | |
enum | cfg_res_t { RES_OK = 0 , RES_LISTUPD = 1 , RES_IOUPD = 2 , RES_ERR = 3 } |
set_cfg status. More... | |
Public Attributes inherited from satdump::ndsp::Block | |
const std::string | d_id |
Protected Member Functions inherited from satdump::ndsp::Block | |
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 inherited from satdump::ndsp::Block | |
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. |
Simplified DSP block implementation, for synchronous blocks that can process one buffer at a time. Takes away the burden of boilerplate code.
|
pure virtual |
Simplified "work" function, called automatically by work(). This takes away all boilerplate work usually needed, making simpler block implementations more trivial to work with.
The number of output samples MUST be <= nsamples!
input | input sample buffer |
nsamples | number of input samples |
output | output sample byffer |
Implemented in satdump::ndsp::AGCBlock< T >, satdump::ndsp::CorrectIQBlock< T >, satdump::ndsp::DelayOneImagBlock, satdump::ndsp::FreqShiftBlock, satdump::ndsp::QuadratureDemodBlock, and satdump::ndsp::RealToComplexBlock.