libcyberradio 22.01.24
NbddcComponent.h
1/***************************************************************************
2 * \file NbddcComponent.h
3 * \brief Defines the basic NBDDC interface for an NDR-class radio.
4 * \author DA
5 * \author NH
6 * \author MN
7 * \copyright (c) 2017 CyberRadio Solutions, Inc. All rights reserved.
8 *
9 ***************************************************************************/
10
11#ifndef INCLUDED_LIBCYBERRADIO_DRIVER_NBDDCCOMPONENT_H
12#define INCLUDED_LIBCYBERRADIO_DRIVER_NBDDCCOMPONENT_H
13
14#include "LibCyberRadio/Driver/RadioComponent.h"
15#include "LibCyberRadio/Common/BasicDict.h"
16#include "LibCyberRadio/Common/BasicList.h"
17#include <string>
18
19
23namespace LibCyberRadio
24{
28 namespace Driver
29 {
36 typedef BASIC_DICT_CONTAINER<int, double> NbddcRateSet;
37
59 {
60 public:
97 NbddcComponent(const std::string& name = "NBDDC",
98 int index = 1,
99 RadioHandler* parent = NULL,
100 bool debug = false,
101 bool nbddcCommandSetsFreq = false,
102 bool nbddcCommandSetsSource = false,
103 bool selectableDataPort = false,
104 double freqRangeMin = 0.0,
105 double freqRangeMax = 0.0,
106 double freqRes = 1.0,
107 double freqUnits = 1.0,
108 int source = 1,
109 int dataPort = 1,
110 double frequency = 0.0,
111 int rateIndex = 0,
112 int udpDestination = 0,
113 int vitaEnable = 0,
114 unsigned int streamId = 0);
118 virtual ~NbddcComponent();
123 NbddcComponent(const NbddcComponent& other);
129 virtual NbddcComponent& operator=(const NbddcComponent& other);
135 virtual bool enable(bool enabled = true);
141 virtual bool setConfiguration(ConfigurationDict& cfg);
146 virtual void queryConfiguration();
147 // NbddcComponent extensions
153 virtual double getFrequency() const;
160 virtual bool setFrequency(double freq);
166 virtual BasicDoubleList getFrequencyRange() const;
172 virtual double getFrequencyRes() const;
178 virtual double getFrequencyUnit() const;
184 virtual int getSource() const;
191 virtual bool setSource(int source);
196 virtual int getRateIndex() const;
202 virtual bool setRateIndex(int index);
207 virtual int getUdpDestination() const;
213 virtual bool setUdpDestination(int dest);
218 virtual int getVitaEnable() const;
224 virtual bool setVitaEnable(int enable);
229 virtual unsigned int getStreamId() const;
235 virtual bool setStreamId(unsigned int sid);
241 virtual int getDataPort() const;
248 virtual bool setDataPort(int port);
253 virtual NbddcRateSet getRateSet() const;
259 virtual bool setRateSet(const NbddcRateSet& set);
265 virtual BasicDoubleList getRateList() const;
266
267 protected:
268 // RadioComponent interface
273 virtual void initConfigurationDict();
277 virtual void updateConfigurationDict();
278 // NbddcComponent extensions
296 virtual bool executeNbddcQuery(int index,
297 int& rateIndex,
298 int& udpDestination,
299 bool& enabled,
300 int& vitaEnable,
301 unsigned int& streamId,
302 double& frequency,
303 int& source);
318 virtual bool executeNbddcCommand(int index,
319 int& rateIndex,
320 int& udpDestination,
321 bool& enabled,
322 int& vitaEnable,
323 unsigned int& streamId,
324 double& frequency,
325 int& source);
336 virtual bool executeFreqQuery(int index, double& freq);
344 virtual bool executeFreqCommand(int index, double& freq);
355 virtual bool executeSourceQuery(int index, int& source);
363 virtual bool executeSourceCommand(int index, int& source);
374 virtual bool executeDataPortQuery(int index, int& dataPort);
382 virtual bool executeDataPortCommand(int index, int& dataPort);
383
384 protected:
385 // Whether or not the NBDDC config command sets its frequency
386 bool _nbddcCommandSetsFreq;
387 // Whether or not the NBDDC config command sets its source
388 bool _nbddcCommandSetsSource;
389 // Whether or not radio uses data ports
390 bool _selectableDataPort;
391 // Minimum tunable frequency (Hz)
392 double _freqRangeMin;
393 // Maximum tunable frequency (Hz)
394 double _freqRangeMax;
395 // Frequency resolution (Hz)
396 double _freqRes;
397 // Frequency units (Hz)
398 double _freqUnits;
399 // Source
400 int _source;
401 // Data port
402 int _dataPort;
403 // Tuned frequency
404 double _frequency;
405 // Rate index
406 int _rateIndex;
407 // UDP destination
408 int _udpDestination;
409 // VITA 49 framing setting
410 int _vitaEnable;
411 // VITA 49 stream ID
412 unsigned int _streamId;
413 // Rate set
414 NbddcRateSet _rateSet;
415
416 }; // class NbddcComponent
417
421 typedef BASIC_DICT_CONTAINER<int, NbddcComponent*> NbddcComponentDict;
422
423 } // namespace Driver
424
425} // namespace LibCyberRadio
426
427
428#endif // INCLUDED_LIBCYBERRADIO_DRIVER_NBDDCCOMPONENT_H
virtual int debug(const char *format,...)
Outputs debug information.
A configuration dictionary.
virtual bool enable(bool enabled=true)
Enables this component.
virtual bool setConfiguration(ConfigurationDict &cfg)
Sets the configuration dictionary for this component.
virtual int getSource() const
Gets the NBDDC's source (which tuner is supplying the signal).
virtual bool executeNbddcQuery(int index, int &rateIndex, int &udpDestination, bool &enabled, int &vitaEnable, unsigned int &streamId, double &frequency, int &source)
Executes the NBDDC configuration query command.
virtual bool executeSourceQuery(int index, int &source)
Executes the NBDDC source query command.
virtual int getUdpDestination() const
Gets the NBDDC's UDP destination.
virtual BasicDoubleList getFrequencyRange() const
Gets the tunable frequency range.
virtual bool setVitaEnable(int enable)
Sets the NBDDC's VITA 49 setting.
virtual bool setFrequency(double freq)
Sets the NBDDC tuned frequency.
virtual bool executeSourceCommand(int index, int &source)
Executes the NBDDC source set command.
virtual int getDataPort() const
Gets the NBDDC's data port.
virtual double getFrequency() const
Gets the tuned frequency.
virtual BasicDoubleList getRateList() const
Gets the list of allowed sample rates, based on the rate set.
virtual bool executeFreqCommand(int index, double &freq)
Executes the NBDDC frequency set command.
virtual unsigned int getStreamId() const
Gets the NBDDC's VITA 49 stream ID.
virtual int getRateIndex() const
Gets the NBDDC's rate index.
virtual NbddcRateSet getRateSet() const
Gets the NBDDC's rate set.
virtual bool setUdpDestination(int dest)
Sets the NBDDC's UDP destination.
virtual void queryConfiguration()
Tells the component to query its hardware configuration in order to create its configuration dictiona...
virtual bool setDataPort(int port)
Sets the NBDDC's data port.
virtual bool setRateSet(const NbddcRateSet &set)
Sets the NBDDC rate set.
virtual bool executeFreqQuery(int index, double &freq)
Executes the NBDDC frequency query command.
virtual bool setStreamId(unsigned int sid)
Sets the NBDDC's VITA 49 stream ID.
virtual void updateConfigurationDict()
Updates the configuration dictionary from component settings.
virtual bool executeNbddcCommand(int index, int &rateIndex, int &udpDestination, bool &enabled, int &vitaEnable, unsigned int &streamId, double &frequency, int &source)
Executes the NBDDC configuration set command.
virtual ~NbddcComponent()
Destroys a NbddcComponent object.
virtual bool setRateIndex(int index)
Sets the NBDDC's rate index.
virtual NbddcComponent & operator=(const NbddcComponent &other)
Assignment operator for NbddcComponent objects.
virtual void initConfigurationDict()
Initializes the configuration dictionary, defining the allowed keys.
virtual bool executeDataPortQuery(int index, int &dataPort)
Executes the NBDDC data port query command.
virtual double getFrequencyUnit() const
Gets the tuned frequency units.
NbddcComponent(const std::string &name="NBDDC", int index=1, RadioHandler *parent=NULL, bool debug=false, bool nbddcCommandSetsFreq=false, bool nbddcCommandSetsSource=false, bool selectableDataPort=false, double freqRangeMin=0.0, double freqRangeMax=0.0, double freqRes=1.0, double freqUnits=1.0, int source=1, int dataPort=1, double frequency=0.0, int rateIndex=0, int udpDestination=0, int vitaEnable=0, unsigned int streamId=0)
Constructs a NbddcComponent object.
virtual int getVitaEnable() const
Gets the NBDDC's VITA 49 setting.
virtual bool setSource(int source)
Sets the NBDDC's source (which tuner is supplying the signal).
virtual bool executeDataPortCommand(int index, int &dataPort)
Executes the NBDDC data port set command.
virtual double getFrequencyRes() const
Gets the tuned frequency resolution.
RadioComponent(const std::string &name="<unknown>", int index=0, RadioHandler *parent=NULL, bool debug=false)
Constructs a RadioComponent object.
Generic radio handler class.
Provides programming elements for driving CRS NDR-class radios.
BASIC_DICT_CONTAINER< int, double > NbddcRateSet
A rate set for a NBDDC.
BASIC_DICT_CONTAINER< int, NbddcComponent * > NbddcComponentDict
A dictionary of NBDDC components, keyed by index.
Defines functionality for LibCyberRadio applications.
Definition App.h:24
BASIC_LIST_CONTAINER< double > BasicDoubleList
Type representing a list of doubles.
Definition BasicList.h:29