16 nlohmann::json params;
18 bool operator==(
const DeviceInfo &b) {
return ((type == b.type) && (name == b.type) && (cfg == b.cfg) && (params == b.params)); }
20 NLOHMANN_DEFINE_TYPE_INTRUSIVE(
DeviceInfo, type, name, cfg, params)
23 class DeviceBlock :
public Block
26 bool work() {
throw satdump_exception(
"Device Source and/or Sync does not implement work. Should NOT have been called!"); }
39 device_mode_t devMode = MODE_NORMAL;
42 DeviceBlock(std::string
id, std::vector<BlockIO> in = {}, std::vector<BlockIO> out = {}) :
Block(
id, in, out) {}
44 virtual void setDevInfo(
DeviceInfo i, device_mode_t m)
46 devInfo = i, devMode = m;
51 virtual double getStreamSamplerate(
int id,
bool output) = 0;
52 virtual void setStreamSamplerate(
int id,
bool output,
double samplerate) = 0;
53 virtual double getStreamFrequency(
int id,
bool output) = 0;
54 virtual void setStreamFrequency(
int id,
bool output,
double frequency) = 0;
59 std::vector<DeviceInfo> &i;
60 DeviceBlock::device_mode_t m;
63 std::vector<DeviceInfo> getDeviceList(DeviceBlock::device_mode_t m);
68 std::vector<std::shared_ptr<DeviceBlock>> &i;
71 std::shared_ptr<DeviceBlock> getDeviceInstanceFromInfo(
DeviceInfo i, DeviceBlock::device_mode_t m);
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 ha...
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