3#include "common/utils.h"
12 class FileSourceBlock :
public Block
15 std::string p_file =
"/tmp/afile";
16 int p_buffer_size = 8192;
21 std::atomic<bool> d_eof;
23 std::ifstream file_reader;
29 std::atomic<uint64_t> d_filesize;
30 std::atomic<uint64_t> d_progress;
38 d_buffer_size = p_buffer_size;
40 file_reader = std::ifstream(p_file, std::ios::binary);
42 d_filesize = getFilesize(p_file);
49 nlohmann::ordered_json p;
50 add_param_simple(p,
"file",
"string");
51 p[
"file"][
"disable"] = is_work_running();
52 add_param_simple(p,
"buffer_size",
"int");
53 p[
"buffer_size"][
"disable"] = is_work_running();
61 else if (key ==
"buffer_size")
64 throw satdump_exception(key);
71 else if (key ==
"buffer_size")
74 throw satdump_exception(key);
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
void init()
Applies current parameters to the block. This is called automatically once in start(),...
Definition file_source.h:36
nlohmann::json get_cfg(std::string key)
Get parameters of the block as JSON.
Definition file_source.h:57
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:67
nlohmann::ordered_json get_cfg_list()
Get parameters LIST of the block's parameters. This does not contain actual values,...
Definition file_source.h:47