libcyberradio  22.01.24
CWToneGenComponent.h
1 /***************************************************************************
2  * \file CWToneGenComponent.h
3  * \brief Defines the basic continuous-wave (CW) tone generator interface
4  * for an NDR-class radio.
5  * \author DA
6  * \author NH
7  * \author MN
8  * \copyright (c) 2017 CyberRadio Solutions, Inc. All rights reserved.
9  *
10  ***************************************************************************/
11 
12 #ifndef INCLUDED_LIBCYBERRADIO_DRIVER_CWTONEGENCOMPONENT_H
13 #define INCLUDED_LIBCYBERRADIO_DRIVER_CWTONEGENCOMPONENT_H
14 
15 #include "LibCyberRadio/Driver/RadioComponent.h"
16 #include "LibCyberRadio/Common/BasicDict.h"
17 #include "LibCyberRadio/Common/BasicList.h"
18 #include <string>
19 
20 
24 namespace LibCyberRadio
25 {
29  namespace Driver
30  {
31  // Forward declaration for RadioHandler
32  class RadioHandler;
33 
44  {
45  public:
86  CWToneGenComponent(const std::string& name = "CWTONE",
87  int index = 0,
88  RadioHandler* parent = NULL,
89  bool debug = false,
90  int txIndex = 0,
91  double freqRangeMin = 0.0,
92  double freqRangeMax = 0.0,
93  double freqRes = 0.0,
94  double freqUnits = 0.0,
95  double ampRangeMin = 0.0,
96  double ampRangeMax = 0.0,
97  double ampRes = 0.0,
98  double phaseRangeMin = 0.0,
99  double phaseRangeMax = 0.0,
100  double phaseRes = 0.0,
101  double sweepStartRangeMin = 0.0,
102  double sweepStartRangeMax = 0.0,
103  double sweepStartRes = 0.0,
104  double sweepStopRangeMin = 0.0,
105  double sweepStopRangeMax = 0.0,
106  double sweepStopRes = 0.0,
107  double sweepStepRangeMin = 0.0,
108  double sweepStepRangeMax = 0.0,
109  double sweepStepRes = 0.0,
110  double dwellTimeRangeMin = 0.0,
111  double dwellTimeRangeMax = 0.0,
112  double dwellTimeRes = 0.0,
113  double frequency = 0.0,
114  double amplitude = 0.0,
115  double phase = 0.0,
116  double sweepStart = 0.0,
117  double sweepStop = 0.0,
118  double sweepStep = 0.0,
119  double dwellTime = 0.0
120  );
124  virtual ~CWToneGenComponent();
135  virtual CWToneGenComponent& operator=(const CWToneGenComponent& other);
136  // RadioComponent interface
142  virtual bool enable(bool enabled = true);
148  virtual bool setConfiguration(ConfigurationDict& cfg);
153  virtual void queryConfiguration();
154  // CWToneGenComponent extensions
159  virtual BasicDoubleList getFrequencyRange() const;
164  virtual double getFrequencyRes() const;
169  virtual BasicDoubleList getAmplitudeRange() const;
174  virtual double getAmplitudeRes() const;
179  virtual BasicDoubleList getPhaseRange() const;
184  virtual double getPhaseRes() const;
189  virtual BasicDoubleList getSweepStartRange() const;
194  virtual double getSweepStartRes() const;
199  virtual BasicDoubleList getSweepStopRange() const;
204  virtual double getSweepStopRes() const;
209  virtual BasicDoubleList getSweepStepRange() const;
214  virtual double getSweepStepRes() const;
219  virtual BasicDoubleList getDwellTimeRange() const;
224  virtual double getDwellTimeRes() const;
229  virtual double getFrequency() const;
235  virtual bool setFrequency(double freq);
240  virtual double getAmplitude() const;
246  virtual bool setAmplitude(double amp);
251  virtual double getPhase() const;
257  virtual bool setPhase(double phase);
262  virtual bool supportsSweep() const;
267  virtual double getSweepStartFrequency() const;
272  virtual double getSweepStopFrequency() const;
277  virtual double getSweepFrequencyStep() const;
282  virtual double getSweepDwellTime() const;
291  virtual bool setFrequencySweep(double start, double stop, double step, double dwell);
292 
293  protected:
294  // RadioComponent interface
299  virtual void initConfigurationDict();
303  virtual void updateConfigurationDict();
304  // CWToneGenComponent extensions
317  virtual bool executeToneQuery(int index,
318  int txIndex,
319  double& freq,
320  double& amp,
321  double& phase);
331  virtual bool executeToneCommand(int index,
332  int txIndex,
333  double& freq,
334  double& amp,
335  double& phase);
349  virtual bool executeSweepQuery(int index,
350  int txIndex,
351  double& sweepStart,
352  double& sweepStop,
353  double& sweepStep,
354  double& dwellTime);
365  virtual bool executeSweepCommand(int index,
366  int txIndex,
367  double& sweepStart,
368  double& sweepStop,
369  double& sweepStep,
370  double& dwellTime);
371 
372  protected:
373  // Transmitter index
374  int _txIndex;
375  // Min frequency
376  double _freqRangeMin;
377  // Max frequency
378  double _freqRangeMax;
379  // Frequency resolution
380  double _freqRes;
381  // Frequency units
382  double _freqUnits;
383  // Min amplitude
384  double _ampRangeMin;
385  // Max amplitude
386  double _ampRangeMax;
387  // Amplitude resolution
388  double _ampRes;
389  // Min phase
390  double _phaseRangeMin;
391  // Max phase
392  double _phaseRangeMax;
393  // Phase resolution
394  double _phaseRes;
395  // Min sweep start
396  double _sweepStartRangeMin;
397  // Max sweep start
398  double _sweepStartRangeMax;
399  // Sweep start resolution
400  double _sweepStartRes;
401  // Min sweep stop
402  double _sweepStopRangeMin;
403  // Max sweep stop
404  double _sweepStopRangeMax;
405  // Sweep stop resolution
406  double _sweepStopRes;
407  // Min sweep step
408  double _sweepStepRangeMin;
409  // Max sweep step
410  double _sweepStepRangeMax;
411  // Sweep step resolution
412  double _sweepStepRes;
413  // Min dwell time
414  double _dwellTimeRangeMin;
415  // Max dwell time
416  double _dwellTimeRangeMax;
417  // Dwell time resolution
418  double _dwellTimeRes;
419  // Constant frequency (Hz)
420  double _frequency;
421  // Amplitude (scale units)
422  double _amplitude;
423  // Phase (degrees)
424  double _phase;
425  // Frequency sweep start (Hz)
426  double _sweepStart;
427  // Frequency sweep stop (Hz)
428  double _sweepStop;
429  // Frequency sweep step (Hz)
430  double _sweepStep;
431  // Dwell time (ADC samples)
432  double _dwellTime;
433 
434  }; // class CWToneGenComponent
435 
439  typedef BASIC_DICT_CONTAINER<int, CWToneGenComponent*> CWToneGenComponentDict;
440 
441  } // namespace Driver
442 
443 } // namespace LibCyberRadio
444 
445 
446 #endif // INCLUDED_LIBCYBERRADIO_DRIVER_CWTONEGENCOMPONENT_H
virtual BasicDoubleList getSweepStopRange() const
Gets the sweep stop range.
virtual double getFrequencyRes() const
Gets the frequency resolution.
virtual BasicDoubleList getSweepStartRange() const
Gets the sweep start range.
BASIC_DICT_CONTAINER< int, CWToneGenComponent * > CWToneGenComponentDict
A dictionary of CW tone generator components, keyed by index.
virtual double getSweepStartFrequency() const
Gets the start frequency for a signal sweep.
Base hardware component class.
BASIC_LIST_CONTAINER< double > BasicDoubleList
Type representing a list of doubles.
Definition: BasicList.h:29
virtual double getFrequency() const
Gets the constant frequency.
virtual double getSweepStopFrequency() const
Gets the stop frequency for a signal sweep.
virtual bool setPhase(double phase)
Sets the signal phase.
virtual double getSweepStartRes() const
Gets the sweep start resolution.
CWToneGenComponent(const std::string &name="CWTONE", int index=0, RadioHandler *parent=NULL, bool debug=false, int txIndex=0, double freqRangeMin=0.0, double freqRangeMax=0.0, double freqRes=0.0, double freqUnits=0.0, double ampRangeMin=0.0, double ampRangeMax=0.0, double ampRes=0.0, double phaseRangeMin=0.0, double phaseRangeMax=0.0, double phaseRes=0.0, double sweepStartRangeMin=0.0, double sweepStartRangeMax=0.0, double sweepStartRes=0.0, double sweepStopRangeMin=0.0, double sweepStopRangeMax=0.0, double sweepStopRes=0.0, double sweepStepRangeMin=0.0, double sweepStepRangeMax=0.0, double sweepStepRes=0.0, double dwellTimeRangeMin=0.0, double dwellTimeRangeMax=0.0, double dwellTimeRes=0.0, double frequency=0.0, double amplitude=0.0, double phase=0.0, double sweepStart=0.0, double sweepStop=0.0, double sweepStep=0.0, double dwellTime=0.0)
Constructs a CWToneGenComponent object.
virtual BasicDoubleList getFrequencyRange() const
Gets the frequency range.
virtual bool setFrequencySweep(double start, double stop, double step, double dwell)
Sets the parameters for a frequency sweep.
virtual bool executeSweepQuery(int index, int txIndex, double &sweepStart, double &sweepStop, double &sweepStep, double &dwellTime)
Executes the CW sweep query command.
virtual double getAmplitude() const
Gets the signal amplitude.
virtual double getSweepFrequencyStep() const
Gets the frequency step for a signal sweep.
virtual CWToneGenComponent & operator=(const CWToneGenComponent &other)
Assignment operator for CWToneGenComponent objects.
virtual double getDwellTimeRes() const
Gets the dwell time resolution.
Generic radio handler class.
Definition: RadioHandler.h:54
virtual int debug(const char *format,...)
Outputs debug information.
Definition: Debuggable.cpp:95
virtual BasicDoubleList getSweepStepRange() const
Gets the sweep step range.
virtual void updateConfigurationDict()
Updates the configuration dictionary from component settings.
virtual bool executeToneQuery(int index, int txIndex, double &freq, double &amp, double &phase)
Executes the CW tone query command.
virtual bool supportsSweep() const
Gets whether or not the generator supports signal sweeps.
virtual BasicDoubleList getPhaseRange() const
Gets the phase range.
Defines functionality for LibCyberRadio applications.
Definition: App.h:23
virtual double getSweepDwellTime() const
Gets the dwell time for a signal sweep.
A configuration dictionary.
Definition: Configurable.h:51
virtual double getAmplitudeRes() const
Gets the amplitude resolution.
virtual bool setConfiguration(ConfigurationDict &cfg)
Sets the configuration dictionary for this component.
virtual bool executeSweepCommand(int index, int txIndex, double &sweepStart, double &sweepStop, double &sweepStep, double &dwellTime)
Executes the CW sweep set command.
virtual BasicDoubleList getDwellTimeRange() const
Gets the dwell time range.
virtual double getPhaseRes() const
Gets the phase resolution.
virtual double getSweepStopRes() const
Gets the sweep stop resolution.
virtual void initConfigurationDict()
Initializes the configuration dictionary, defining the allowed keys.
virtual double getPhase() const
Gets the signal phase.
virtual ~CWToneGenComponent()
Destroys a CWToneGenComponent object.
virtual bool setFrequency(double freq)
Sets the constant frequency.
virtual double getSweepStepRes() const
Gets the sweep step resolution.
virtual bool setAmplitude(double amp)
Sets the signal amplitude.
virtual bool enable(bool enabled=true)
Enables this component.
Base continuous-wave (CW) tone generator component class.
virtual BasicDoubleList getAmplitudeRange() const
Gets the amplitude range.
virtual void queryConfiguration()
Tells the component to query its hardware configuration in order to create its configuration dictiona...
virtual bool executeToneCommand(int index, int txIndex, double &freq, double &amp, double &phase)
Executes the CW tone set command.