3#include "common/dsp/io/baseband_interface.h"
10 class FileSourceBlock :
public Block
13 std::string p_file =
"/tmp/afile";
14 dsp::BasebandType p_type = dsp::CF_32;
15 int p_buffer_size = 8192;
16 bool p_iq_swap =
false;
19 dsp::BasebandType d_type;
23 std::atomic<bool> d_eof;
25 dsp::BasebandReader baseband_reader;
31 std::atomic<uint64_t> d_filesize;
32 std::atomic<uint64_t> d_progress;
41 d_buffer_size = p_buffer_size;
42 d_iq_swap = p_iq_swap;
44 baseband_reader.set_file(p_file, p_type);
46 d_filesize = baseband_reader.filesize;
53 nlohmann::ordered_json p;
54 add_param_simple(p,
"file",
"string");
55 p[
"file"][
"disable"] = is_work_running();
56 add_param_simple(p,
"type",
"string");
57 p[
"type"][
"disable"] = is_work_running();
58 add_param_simple(p,
"buffer_size",
"int");
59 p[
"buffer_size"][
"disable"] = is_work_running();
60 add_param_simple(p,
"iq_swap",
"bool");
61 p[
"iq_swap"][
"disable"] = is_work_running();
69 else if (key ==
"type")
70 return (std::string)p_type;
71 else if (key ==
"buffer_size")
73 else if (key ==
"iq_swap")
76 throw satdump_exception(key);
83 else if (key ==
"type")
84 p_type = v.get<std::string>();
85 else if (key ==
"buffer_size")
87 else if (key ==
"iq_swap")
90 throw satdump_exception(key);
cfg_res_t
set_cfg status.
Definition block.h:227
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:206
nlohmann::json get_cfg(std::string key)
Get parameters of the block as JSON.
Definition file_source.h:65
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 file_source.h:79
void init()
Applies current parameters to the block. This is called automatically once in start(),...
Definition file_source.h:38
nlohmann::ordered_json get_cfg_list()
Get parameters LIST of the block's parameters. This does not contain actual values,...
Definition file_source.h:51