libcyberradio 22.01.24
TransmitterComponent.h
1/***************************************************************************
2 * \file TransmitterComponent.h
3 * \brief Defines the basic transmitter 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_TRANSMITTERCOMPONENT_H
12#define INCLUDED_LIBCYBERRADIO_DRIVER_TRANSMITTERCOMPONENT_H
13
14#include "LibCyberRadio/Driver/CWToneGenComponent.h"
15#include "LibCyberRadio/Driver/RadioComponent.h"
16#include "LibCyberRadio/Common/BasicList.h"
17#include <string>
18
19
23namespace LibCyberRadio
24{
28 namespace Driver
29 {
30 // Forward declaration for RadioHandler
31 class RadioHandler;
32
46 {
47 public:
69 TransmitterComponent(const std::string& name = "TX",
70 int index = 1,
71 RadioHandler* parent = NULL,
72 bool debug = false,
73 double freqRangeMin = 20e6,
74 double freqRangeMax = 6000e6,
75 double freqRes = 1e6,
76 double freqUnits = 1e6,
77 double attRangeMin = 0.0,
78 double attRangeMax = 10.0,
79 double attRes = 1.0,
80 int numToneGen = 0,
81 int toneGenIndexBase = 1,
82 double frequency = 900e6,
83 double attenuation = 0.0);
87 virtual ~TransmitterComponent();
99 // RadioComponent interface
105 virtual bool enable(bool enabled = true);
111 virtual bool setConfiguration(ConfigurationDict& cfg);
116 virtual void queryConfiguration();
117 // TransmitterComponent extensions
122 virtual double getFrequency() const;
128 virtual bool setFrequency(double freq);
133 virtual double getAttenuation() const;
139 virtual bool setAttenuation(double atten);
144 virtual BasicDoubleList getFrequencyRange() const;
149 virtual double getFrequencyRes() const;
154 virtual double getFrequencyUnit() const;
159 virtual BasicDoubleList getAttenuationRange() const;
164 virtual double getAttenuationRes() const;
169 virtual bool supportsCW() const;
175 virtual int getCWNum() const;
180 virtual BasicIntList getCWIndexRange() const;
185 virtual BasicDoubleList getCWFrequencyRange() const;
190 virtual double getCWFrequencyRes() const;
195 virtual BasicDoubleList getCWAmplitudeRange() const;
200 virtual double getCWAmplitudeRes() const;
205 virtual BasicDoubleList getCWPhaseRange() const;
210 virtual double getCWPhaseRes() const;
215 virtual bool supportsCWSweep() const;
225 virtual double getCWSweepStartRes() const;
230 virtual BasicDoubleList getCWSweepStopRange() const;
235 virtual double getCWSweepStopRes() const;
240 virtual BasicDoubleList getCWSweepStepRange() const;
245 virtual double getCWSweepStepRes() const;
255 virtual double getCWSweepDwellRes() const;
262 virtual bool enableCW(int index, bool enabled = true);
268 virtual bool disableCW(int index);
274 virtual ConfigurationDict getCWConfiguration(int index) const;
282 virtual bool setCWConfiguration(int index, ConfigurationDict& cfg);
288 virtual double getCWFrequency(int index) const;
295 virtual bool setCWFrequency(int index, double freq);
301 virtual double getCWAmplitude(int index) const;
308 virtual bool setCWAmplitude(int index, double amp);
314 virtual double getCWPhase(int index) const;
321 virtual bool setCWPhase(int index, double phase);
328 virtual bool supportsCWSweep(int index) const;
335 virtual double getCWSweepStartFrequency(int index) const;
342 virtual double getCWSweepStopFrequency(int index) const;
349 virtual double getCWSweepFrequencyStep(int index) const;
356 virtual double getCWSweepDwellTime(int index) const;
367 virtual bool setCWFrequencySweep(int index, double start, double stop,
368 double step, double dwell);
369
370 protected:
371 // RadioComponent interface
376 virtual void initConfigurationDict();
380 virtual void updateConfigurationDict();
381 // TransmitterComponent extensions
391 virtual bool executeEnableQuery(int index, bool& enabled);
401 virtual bool executeFreqQuery(int index, double& freq);
411 virtual bool executeAttenQuery(int index, double& atten);
418 virtual bool executeEnableCommand(int index, bool& enabled);
425 virtual bool executeFreqCommand(int index, double& freq);
432 virtual bool executeAttenCommand(int index, double& atten);
433
434 protected:
435 // Minimum tunable frequency (Hz)
436 double _freqRangeMin;
437 // Maximum tunable frequency (Hz)
438 double _freqRangeMax;
439 // Frequency resolution (Hz)
440 double _freqRes;
441 // Frequency units (Hz)
442 double _freqUnits;
443 // Minimum attenuation (dB)
444 double _attRangeMin;
445 // Maximum attenuation (dB)
446 double _attRangeMax;
447 // Attenuation resolution
448 double _attRes;
449 // Number of CW tone generators associated with this transmitter
450 int _numToneGen;
451 // Number that tone generator indicates start at
452 int _toneGenIndexBase;
453 // Tuned frequency
454 double _frequency;
455 // Attenuation
456 double _attenuation;
457 // Tone generator dictionary
458 CWToneGenComponentDict _cwToneGens;
459
460 }; // class TransmitterComponent
461
465 typedef BASIC_DICT_CONTAINER<int, TransmitterComponent*> TransmitterComponentDict;
466
467 } // namespace Driver
468
469} // namespace LibCyberRadio
470
471
472#endif // INCLUDED_LIBCYBERRADIO_DRIVER_TRANSMITTERCOMPONENT_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 double getCWSweepStartFrequency(int index) const
Gets the start frequency for a signal sweep for a given CW tone generator.
virtual bool enable(bool enabled=true)
Enables this component.
virtual bool setConfiguration(ConfigurationDict &cfg)
Sets the configuration dictionary for this component.
virtual TransmitterComponent & operator=(const TransmitterComponent &other)
Assignment operator for TransmitterComponent objects.
virtual double getCWFrequency(int index) const
Gets the constant frequency for a given CW tone generator.
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.
TransmitterComponent(const std::string &name="TX", 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=10.0, double attRes=1.0, int numToneGen=0, int toneGenIndexBase=1, double frequency=900e6, double attenuation=0.0)
Constructs a TransmitterComponent object.
virtual BasicDoubleList getFrequencyRange() const
Gets the transmitter center frequency range.
virtual bool setFrequency(double freq)
Sets the transmitter center frequency.
virtual bool executeAttenCommand(int index, double &atten)
Executes the tuner attenuation set command.
virtual double getCWSweepFrequencyStep(int index) const
Gets the frequency step for a signal sweep for a given CW tone generator.
virtual int getCWNum() const
Gets the number of CW tone generators associated with this transmitter.
virtual double getFrequency() const
Gets the transmitter center frequency.
virtual bool executeFreqCommand(int index, double &freq)
Executes the tuner frequency set command.
virtual double getCWSweepDwellRes() const
Gets the CW dwell time resolution.
virtual double getCWSweepStepRes() const
Gets the CW frequency step resolution.
virtual BasicDoubleList getCWPhaseRange() const
Gets the CW phase range.
virtual BasicDoubleList getAttenuationRange() const
Gets the attenuation range.
virtual bool setCWConfiguration(int index, ConfigurationDict &cfg)
Sets the configuration dictionary for a given CW tone generator.
virtual bool disableCW(int index)
Disables a given CW tone generator.
virtual BasicDoubleList getCWSweepStopRange() const
Gets the CW stop frequency range.
virtual bool setCWFrequencySweep(int index, double start, double stop, double step, double dwell)
Sets the parameters for a frequency sweep for a given CW tone generator.
virtual void queryConfiguration()
Tells the component to query its hardware configuration in order to create its configuration dictiona...
virtual ~TransmitterComponent()
Destroys a TransmitterComponent object.
virtual double getCWAmplitude(int index) const
Gets the signal amplitude for a given CW tone generator.
virtual BasicDoubleList getCWAmplitudeRange() const
Gets the CW amplitude range.
virtual double getCWPhase(int index) const
Gets the signal phase for a given CW tone generator.
virtual bool executeFreqQuery(int index, double &freq)
Executes the tuner frequency query command.
virtual void updateConfigurationDict()
Updates the configuration dictionary from component settings.
virtual double getCWSweepStartRes() const
Gets the CW start frequency resolution.
virtual BasicDoubleList getCWSweepStepRange() const
Gets the CW frequency step range.
virtual ConfigurationDict getCWConfiguration(int index) const
Gets the configuration for a given CW tone generator.
virtual double getAttenuationRes() const
Gets the attenuation resolution.
virtual BasicDoubleList getCWSweepStartRange() const
Gets the CW start frequency range.
virtual bool supportsCWSweep() const
Gets whether the transmitter supports CW tone sweeping.
virtual double getCWAmplitudeRes() const
Gets the CW amplitude resolution.
virtual bool setCWPhase(int index, double phase)
Sets the signal phase for a given CW tone generator.
virtual bool supportsCW() const
Gets whether the transmitter supports CW tone generation.
virtual bool enableCW(int index, bool enabled=true)
Enables a given CW tone generator.
virtual double getCWSweepStopFrequency(int index) const
Gets the stop frequency for a signal sweep for a given CW tone generator.
virtual double getCWFrequencyRes() const
Gets the CW frequency resolution.
virtual void initConfigurationDict()
Initializes the configuration dictionary, defining the allowed keys.
virtual BasicDoubleList getCWFrequencyRange() const
Gets the CW frequency range.
virtual double getCWSweepDwellTime(int index) const
Gets the dwell time for a signal sweep for a given CW tone generator.
virtual bool executeEnableQuery(int index, bool &enabled)
Executes the tuner enabled query command.
virtual double getFrequencyUnit() const
Gets the transmitter center frequency units.
virtual bool setCWFrequency(int index, double freq)
Sets the constant frequency for a given CW tone generator.
virtual double getCWSweepStopRes() const
Gets the CW stop frequency resolution.
virtual double getCWPhaseRes() const
Gets the CW phase resolution.
virtual BasicDoubleList getCWSweepDwellRange() const
Gets the CW dwell time range.
virtual bool executeAttenQuery(int index, double &atten)
Executes the tuner attenuation query command.
virtual BasicIntList getCWIndexRange() const
Gets the range of indices for CW tone generators.
virtual bool setCWAmplitude(int index, double amp)
Sets the signal amplitude for a given CW tone generator.
virtual double getFrequencyRes() const
Gets the transmitter center frequency resolution.
Provides programming elements for driving CRS NDR-class radios.
BASIC_DICT_CONTAINER< int, TransmitterComponent * > TransmitterComponentDict
A dictionary of tuner components, keyed by index.
BASIC_DICT_CONTAINER< int, CWToneGenComponent * > CWToneGenComponentDict
A dictionary of CW tone generator components, keyed by index.
Defines functionality for LibCyberRadio applications.
Definition App.h:24
BASIC_LIST_CONTAINER< int > BasicIntList
Type representing a list of integers.
Definition BasicList.h:27
BASIC_LIST_CONTAINER< double > BasicDoubleList
Type representing a list of doubles.
Definition BasicList.h:29