3#include "common/dsp/block.h"
4#include "common/dsp/complex.h"
14 class IQSinkBlock :
public Block
17 size_t total_written_raw;
18 size_t total_written_bytes_compressed;
21 int buffer_size = 1024 * 1024;
25 double samplerate = 1e6;
26 double frequency = 100e6;
29 FILE *file_stream =
nullptr;
30 void *buffer_convert =
nullptr;
36 void stop(
bool stop_now =
false,
bool force=
false);
46 nlohmann::ordered_json p;
47 add_param_simple(p,
"file",
"string");
48 p[
"file"][
"disable"] = is_work_running();
49 add_param_simple(p,
"type",
"string");
50 p[
"type"][
"disable"] = is_work_running();
51 add_param_simple(p,
"buffer_size",
"int");
52 p[
"buffer_size"][
"disable"] = is_work_running();
53 add_param_simple(p,
"autogen",
"bool");
54 p[
"autogen"][
"disable"] = is_work_running();
55 add_param_simple(p,
"samplerate",
"float");
56 p[
"samplerate"][
"disable"] = is_work_running();
57 add_param_simple(p,
"frequency",
"float");
58 p[
"frequency"][
"disable"] = is_work_running();
59 add_param_simple(p,
"timestamp",
"float");
60 p[
"timestamp"][
"disable"] = is_work_running();
66 if (key ==
"buffer_size")
68 else if (key ==
"file")
70 else if (key ==
"type")
72 else if (key ==
"autogen")
74 else if (key ==
"samplerate")
76 else if (key ==
"frequency")
78 else if (key ==
"timestamp")
81 throw satdump_exception(key);
86 if (key ==
"buffer_size")
88 else if (key ==
"file")
90 else if (key ==
"type")
91 format = v.get<std::string>();
92 else if (key ==
"samplerate")
94 else if (key ==
"autogen")
96 else if (key ==
"frequency")
98 else if (key ==
"timestamp")
101 throw satdump_exception(key);
106 static std::string prepareBasebandFileName(
double timeValue_precise, uint64_t samplerate, uint64_t frequency);
cfg_res_t
set_cfg status.
Definition block.h:241
virtual bool work()=0
The actual looping work function meant to handle all the DSP (well, in most blocks)
Block(std::string id, std::vector< BlockIO > in={}, std::vector< BlockIO > out={})
Generic constructor, to be overloaded.
Definition block.h:208
nlohmann::json get_cfg(std::string key)
Get parameters of the block as JSON.
Definition iq_sink.h:64
cfg_res_t set_cfg(std::string key, nlohmann::json v)
Set parameters of the block from JSON, including potentially IO configurations for blocks that may ha...
Definition iq_sink.h:84
void start()
Starts this block's internal thread and loop.
Definition iq_sink.cpp:20
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....
Definition iq_sink.cpp:46
nlohmann::ordered_json get_cfg_list()
Get parameters LIST of the block's parameters. This does not contain actual values,...
Definition iq_sink.h:44
void init()
Applies current parameters to the block. This is called automatically once in start(),...
Definition iq_sink.h:42