libcyberradio 22.01.24
WbddcComponent.h
1/***************************************************************************
2 * \file WbddcComponent.h
3 * \brief Defines the basic WBDDC 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_WBDDCCOMPONENT_H
12#define INCLUDED_LIBCYBERRADIO_DRIVER_WBDDCCOMPONENT_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> WbddcRateSet;
37
59 {
60 public:
96 WbddcComponent(const std::string& name = "WBDDC",
97 int index = 1,
98 RadioHandler* parent = NULL,
99 bool debug = false,
100 bool tunable = false,
101 bool selectableSource = false,
102 bool selectableDataPort = false,
103 bool agc = 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 ~WbddcComponent();
123 WbddcComponent(const WbddcComponent& other);
129 virtual WbddcComponent& operator=(const WbddcComponent& other);
130 // RadioComponent interface
136 virtual bool enable(bool enabled = true);
142 virtual bool setConfiguration(ConfigurationDict& cfg);
147 virtual void queryConfiguration();
148 // WbddcComponent extensions
154 virtual double getFrequency() const;
161 virtual bool setFrequency(double freq);
167 virtual BasicDoubleList getFrequencyRange() const;
173 virtual double getFrequencyRes() const;
179 virtual double getFrequencyUnit() const;
184 virtual bool isAgcSupported() const;
189 virtual bool isTunable() const;
195 virtual bool isSourceSelectable() const;
201 virtual int getSource() const;
208 virtual bool setSource(int source);
213 virtual int getRateIndex() const;
219 virtual bool setRateIndex(int index);
224 virtual int getUdpDestination() const;
230 virtual bool setUdpDestination(int dest);
235 virtual int getVitaEnable() const;
241 virtual bool setVitaEnable(int enable);
246 virtual unsigned int getStreamId() const;
252 virtual bool setStreamId(unsigned int sid);
258 virtual int getDataPort() const;
265 virtual bool setDataPort(int port);
270 virtual WbddcRateSet getRateSet() const;
276 virtual bool setRateSet(const WbddcRateSet& set);
282 virtual BasicDoubleList getRateList() const;
283
284 protected:
285 // RadioComponent interface
290 virtual void initConfigurationDict();
294 virtual void updateConfigurationDict();
295 // WbddcComponent extensions
309 virtual bool executeWbddcQuery(int index,
310 int& rateIndex,
311 int& udpDestination,
312 bool& enabled,
313 int& vitaEnable,
314 unsigned int& streamId);
325 virtual bool executeWbddcCommand(int index,
326 int& rateIndex,
327 int& udpDestination,
328 bool& enabled,
329 int& vitaEnable,
330 unsigned int& streamId);
341 virtual bool executeFreqQuery(int index, double& freq);
349 virtual bool executeFreqCommand(int index, double& freq);
360 virtual bool executeSourceQuery(int index, int& source);
368 virtual bool executeSourceCommand(int index, int& source);
379 virtual bool executeDataPortQuery(int index, int& dataPort);
387 virtual bool executeDataPortCommand(int index, int& dataPort);
388
389 protected:
390 // Whether or not WBDDC is tunable
391 bool _tunable;
392 // Whether or not WBDDC supports selectable source
393 bool _selectableSource;
394 // Whether or not radio uses data ports
395 bool _selectableDataPort;
396 // Whether or not WBDDC supports AGC
397 bool _agc;
398 // Minimum tunable frequency (Hz)
399 double _freqRangeMin;
400 // Maximum tunable frequency (Hz)
401 double _freqRangeMax;
402 // Frequency resolution (Hz)
403 double _freqRes;
404 // Frequency units (Hz)
405 double _freqUnits;
406 // Source
407 int _source;
408 // Data port
409 int _dataPort;
410 // Tuned frequency
411 double _frequency;
412 // Rate index
413 int _rateIndex;
414 // UDP destination
415 int _udpDestination;
416 // VITA 49 framing setting
417 int _vitaEnable;
418 // VITA 49 stream ID
419 unsigned int _streamId;
420 // Rate set
421 WbddcRateSet _rateSet;
422
423 }; // class WbddcComponent
424
428 typedef BASIC_DICT_CONTAINER<int, WbddcComponent*> WbddcComponentDict;
429
430 } // namespace Driver
431
432} // namespace LibCyberRadio
433
434
435#endif // INCLUDED_LIBCYBERRADIO_DRIVER_WBDDCCOMPONENT_H
virtual int debug(const char *format,...)
Outputs debug information.
A configuration dictionary.
RadioComponent(const std::string &name="<unknown>", int index=0, RadioHandler *parent=NULL, bool debug=false)
Constructs a RadioComponent object.
Generic radio handler class.
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 WBDDC's source (which tuner is supplying the signal).
virtual bool executeSourceQuery(int index, int &source)
Executes the WBDDC source query command.
virtual WbddcComponent & operator=(const WbddcComponent &other)
Assignment operator for WbddcComponent objects.
virtual int getUdpDestination() const
Gets the WBDDC's UDP destination.
virtual BasicDoubleList getFrequencyRange() const
Gets the tunable frequency range.
virtual bool setVitaEnable(int enable)
Sets the WBDDC's VITA 49 setting.
virtual bool executeWbddcCommand(int index, int &rateIndex, int &udpDestination, bool &enabled, int &vitaEnable, unsigned int &streamId)
Executes the WBDDC configuration set command.
virtual bool setFrequency(double freq)
Sets the WBDDC tuned frequency.
virtual bool executeSourceCommand(int index, int &source)
Executes the WBDDC source set command.
virtual bool isAgcSupported() const
Gets whether or not the WBDDC supports AGC.
virtual int getDataPort() const
Gets the WBDDC'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 executeWbddcQuery(int index, int &rateIndex, int &udpDestination, bool &enabled, int &vitaEnable, unsigned int &streamId)
Executes the WBDDC configuration query command.
virtual bool executeFreqCommand(int index, double &freq)
Executes the WBDDC frequency set command.
virtual unsigned int getStreamId() const
Gets the WBDDC's VITA 49 stream ID.
virtual bool isSourceSelectable() const
Gets whether or not the WBDDC supports selectable source.
virtual int getRateIndex() const
Gets the WBDDC's rate index.
virtual bool setUdpDestination(int dest)
Sets the WBDDC's UDP destination.
virtual bool setRateSet(const WbddcRateSet &set)
Sets the WBDDC rate set.
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 WBDDC's data port.
virtual bool executeFreqQuery(int index, double &freq)
Executes the WBDDC frequency query command.
virtual bool setStreamId(unsigned int sid)
Sets the WBDDC's VITA 49 stream ID.
virtual WbddcRateSet getRateSet() const
Gets the WBDDC's rate set.
virtual void updateConfigurationDict()
Updates the configuration dictionary from component settings.
WbddcComponent(const std::string &name="WBDDC", int index=1, RadioHandler *parent=NULL, bool debug=false, bool tunable=false, bool selectableSource=false, bool selectableDataPort=false, bool agc=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 WbddcComponent object.
virtual bool isTunable() const
Gets whether or not the WBDDC is tunable.
virtual ~WbddcComponent()
Destroys a WbddcComponent object.
virtual bool setRateIndex(int index)
Sets the WBDDC's rate index.
virtual void initConfigurationDict()
Initializes the configuration dictionary, defining the allowed keys.
virtual bool executeDataPortQuery(int index, int &dataPort)
Executes the WBDDC data port query command.
virtual double getFrequencyUnit() const
Gets the tuned frequency units.
virtual int getVitaEnable() const
Gets the WBDDC's VITA 49 setting.
virtual bool setSource(int source)
Sets the WBDDC's source (which tuner is supplying the signal).
virtual bool executeDataPortCommand(int index, int &dataPort)
Executes the WBDDC data port set command.
virtual double getFrequencyRes() const
Gets the tuned frequency resolution.
Provides programming elements for driving CRS NDR-class radios.
BASIC_DICT_CONTAINER< int, WbddcComponent * > WbddcComponentDict
A dictionary of WBDDC components, keyed by index.
BASIC_DICT_CONTAINER< int, double > WbddcRateSet
A rate set for a WBDDC.
Defines functionality for LibCyberRadio applications.
Definition App.h:24
BASIC_LIST_CONTAINER< double > BasicDoubleList
Type representing a list of doubles.
Definition BasicList.h:29