libcyberradio 22.01.24
TunerComponent.h
1/***************************************************************************
2 * \file TunerComponent.h
3 * \brief Defines the basic tuner 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_TUNERCOMPONENT_H
12#define INCLUDED_LIBCYBERRADIO_DRIVER_TUNERCOMPONENT_H
13
14#include "LibCyberRadio/Driver/RadioComponent.h"
15#include "LibCyberRadio/Common/BasicList.h"
16#include <string>
17
18
22namespace LibCyberRadio
23{
27 namespace Driver
28 {
29 // Forward declaration for RadioHandler
30 class RadioHandler;
31
47 {
48 public:
68 TunerComponent(const std::string& name = "TUNER",
69 int index = 1,
70 RadioHandler* parent = NULL,
71 bool debug = false,
72 double freqRangeMin = 20e6,
73 double freqRangeMax = 6000e6,
74 double freqRes = 1e6,
75 double freqUnits = 1e6,
76 double attRangeMin = 0.0,
77 double attRangeMax = 30.0,
78 double attRes = 1.0,
79 bool agc = false,
80 double frequency = 800e6,
81 double attenuation = 0.0,
82 int filter = 0);
86 virtual ~TunerComponent();
91 TunerComponent(const TunerComponent& other);
97 virtual TunerComponent& operator=(const TunerComponent& other);
98 // RadioComponent interface
104 virtual bool enable(bool enabled = true);
110 virtual bool setConfiguration(ConfigurationDict& cfg);
115 virtual void queryConfiguration();
116 // TunerComponent extensions
121 virtual double getFrequency() const;
127 virtual bool setFrequency(double freq);
132 virtual double getAttenuation() const;
138 virtual bool setAttenuation(double atten);
143 virtual int getFilter() const;
149 virtual bool setFilter(int filter);
154 virtual int getTimingAdjustment() const;
160 virtual bool setTimingAdjustment(int timingAdj);
165 virtual BasicDoubleList getFrequencyRange() const;
170 virtual double getFrequencyRes() const;
175 virtual double getFrequencyUnit() const;
180 virtual BasicDoubleList getAttenuationRange() const;
185 virtual double getAttenuationRes() const;
190 virtual bool isAgcSupported() const;
196 virtual bool setFrequencyRangeMax(double freq);
197
198 protected:
199 // RadioComponent interface
204 virtual void initConfigurationDict();
208 virtual void updateConfigurationDict();
209 // TunerComponent extensions
219 virtual bool executeEnableQuery(int index, bool& enabled);
229 virtual bool executeFreqQuery(int index, double& freq);
239 virtual bool executeAttenQuery(int index, double& atten);
249 virtual bool executeFilterQuery(int index, int& filter);
259 virtual bool executeTimingAdjustmentQuery(int index, int& timingAdj);
266 virtual bool executeEnableCommand(int index, bool& enabled);
273 virtual bool executeFreqCommand(int index, double& freq);
280 virtual bool executeAttenCommand(int index, double& atten);
287 virtual bool executeFilterCommand(int index, int& filter);
294 virtual bool executeTimingAdjustmentCommand(int index, int& timingAdj);
295
296 protected:
297 // Minimum tunable frequency (Hz)
298 double _freqRangeMin;
299 // Maximum tunable frequency (Hz)
300 double _freqRangeMax;
301 // Frequency resolution (Hz)
302 double _freqRes;
303 // Frequency units (Hz)
304 double _freqUnits;
305 // Minimum attenuation (dB)
306 double _attRangeMin;
307 // Maximum attenuation (dB)
308 double _attRangeMax;
309 // Attenuation resolution
310 double _attRes;
311 // Whether or not WBDDC supports AGC
312 bool _agc;
313 // Tuned frequency
314 double _frequency;
315 // Attenuation
316 double _attenuation;
317 // Filter setting
318 int _filter;
319 // Timing adjustment
320 int _timingAdj;
321
322 }; // class TunerComponent
323
327 typedef BASIC_DICT_CONTAINER<int, TunerComponent*> TunerComponentDict;
328
329 } // namespace Driver
330
331} // namespace LibCyberRadio
332
333
334#endif // INCLUDED_LIBCYBERRADIO_DRIVER_TUNERCOMPONENT_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 int getTimingAdjustment() const
Gets the timing adjustment setting.
virtual bool setConfiguration(ConfigurationDict &cfg)
Sets the configuration dictionary for this component.
virtual int getFilter() const
Gets the filter setting.
TunerComponent(const std::string &name="TUNER", int index=1, RadioHandler *parent=NULL, bool debug=false, double freqRangeMin=20e6, double freqRangeMax=6000e6, double freqRes=1e6, double freqUnits=1e6, double attRangeMin=0.0, double attRangeMax=30.0, double attRes=1.0, bool agc=false, double frequency=800e6, double attenuation=0.0, int filter=0)
Constructs a TunerComponent object.
virtual double getAttenuation() const
Gets the attenuation.
virtual bool setAttenuation(double atten)
Sets the attenuation.
virtual bool executeEnableCommand(int index, bool &enabled)
Executes the tuner enable command.
virtual BasicDoubleList getFrequencyRange() const
Gets the tunable frequency range.
virtual bool setFrequency(double freq)
Sets the tuned frequency.
virtual bool executeAttenCommand(int index, double &atten)
Executes the tuner attenuation set command.
virtual bool isAgcSupported() const
Gets whether or not the tuner supports AGC.
virtual double getFrequency() const
Gets the tuned frequency.
virtual bool executeFreqCommand(int index, double &freq)
Executes the tuner frequency set command.
virtual bool executeTimingAdjustmentCommand(int index, int &timingAdj)
Executes the tuner timing adjustment command.
virtual BasicDoubleList getAttenuationRange() const
Gets the attenuation range.
virtual TunerComponent & operator=(const TunerComponent &other)
Assignment operator for TunerComponent objects.
virtual void queryConfiguration()
Tells the component to query its hardware configuration in order to create its configuration dictiona...
virtual bool setTimingAdjustment(int timingAdj)
Sets the timing adjustment setting.
virtual bool executeFreqQuery(int index, double &freq)
Executes the tuner frequency query command.
virtual bool executeFilterQuery(int index, int &filter)
Executes the tuner filter query command.
virtual void updateConfigurationDict()
Updates the configuration dictionary from component settings.
virtual double getAttenuationRes() const
Gets the attenuation resolution.
virtual bool setFrequencyRangeMax(double freq)
Sets the maximum end of the tunable frequency range.
virtual bool setFilter(int filter)
Sets the filter setting.
virtual void initConfigurationDict()
Initializes the configuration dictionary, defining the allowed keys.
virtual bool executeEnableQuery(int index, bool &enabled)
Executes the tuner enabled query command.
virtual bool executeTimingAdjustmentQuery(int index, int &timingAdj)
Executes the tuner timing adjustment query.
virtual double getFrequencyUnit() const
Gets the tuned frequency units.
virtual ~TunerComponent()
Destroys a TunerComponent object.
virtual bool executeFilterCommand(int index, int &filter)
Executes the tuner filter set command.
virtual bool executeAttenQuery(int index, double &atten)
Executes the tuner attenuation query command.
virtual double getFrequencyRes() const
Gets the tuned frequency resolution.
Provides programming elements for driving CRS NDR-class radios.
BASIC_DICT_CONTAINER< int, TunerComponent * > TunerComponentDict
A dictionary of tuner 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