libcyberradio  22.01.24
NbddcComponent.cpp
1 /***************************************************************************
2  * \file NbddcComponent.cpp
3  * \brief Defines the basic NBDDC interface for an NDR-class radio.
4  * \author NH
5  * \author DA
6  * \author MN
7  * \copyright (c) 2017 CyberRadio Solutions, Inc. All rights reserved.
8  *
9  ***************************************************************************/
10 
11 #include "LibCyberRadio/Driver/RadioHandler.h"
12 #include "LibCyberRadio/Driver/NbddcComponent.h"
13 #include "LibCyberRadio/Common/Pythonesque.h"
14 #include <boost/lexical_cast.hpp>
15 #include <sstream>
16 #include <iomanip>
17 
18 
19 namespace LibCyberRadio
20 {
21  namespace Driver
22  {
23 
25  const std::string& name,
26  int index,
27  RadioHandler* parent,
28  bool debug,
29  bool nbddcCommandSetsFreq,
30  bool nbddcCommandSetsSource,
31  bool selectableDataPort,
32  double freqRangeMin,
33  double freqRangeMax,
34  double freqRes,
35  double freqUnits,
36  int source,
37  int dataPort,
38  double frequency,
39  int rateIndex,
40  int udpDestination,
41  int vitaEnable,
42  unsigned int streamId) :
43  RadioComponent(name, index, parent, debug),
44  _nbddcCommandSetsFreq(nbddcCommandSetsFreq),
45  _nbddcCommandSetsSource(nbddcCommandSetsSource),
46  _selectableDataPort(selectableDataPort),
47  _freqRangeMin(freqRangeMin),
48  _freqRangeMax(freqRangeMax),
49  _freqRes(freqRes),
50  _freqUnits(freqUnits),
51  _source(source),
52  _dataPort(dataPort),
53  _frequency(frequency),
54  _rateIndex(rateIndex),
55  _udpDestination(udpDestination),
56  _vitaEnable(vitaEnable),
57  _streamId(streamId)
58  {
60  }
61 
63  {
64  }
65 
67  RadioComponent(other),
68  _nbddcCommandSetsFreq(other._nbddcCommandSetsFreq),
69  _nbddcCommandSetsSource(other._nbddcCommandSetsSource),
70  _selectableDataPort(other._selectableDataPort),
71  _freqRangeMin(other._freqRangeMin),
72  _freqRangeMax(other._freqRangeMax),
73  _freqRes(other._freqRes),
74  _freqUnits(other._freqUnits),
75  _source(other._source),
76  _dataPort(other._dataPort),
77  _frequency(other._frequency),
78  _rateIndex(other._rateIndex),
79  _udpDestination(other._udpDestination),
80  _vitaEnable(other._vitaEnable),
81  _streamId(other._streamId)
82  {
83  }
84 
86  {
88  if ( this != &other )
89  {
90  _nbddcCommandSetsFreq = other._nbddcCommandSetsFreq;
91  _nbddcCommandSetsSource = other._nbddcCommandSetsSource;
92  _selectableDataPort = other._selectableDataPort;
93  _freqRangeMin = other._freqRangeMin;
94  _freqRangeMax = other._freqRangeMax;
95  _freqRes = other._freqRes;
96  _freqUnits = other._freqUnits;
97  _source = other._source;
98  _dataPort = other._dataPort;
99  _frequency = other._frequency;
100  _rateIndex = other._rateIndex;
101  _udpDestination = other._udpDestination;
102  _vitaEnable = other._vitaEnable;
103  _streamId = other._streamId;
104  }
105  return *this;
106  }
107 
108  bool NbddcComponent::enable(bool enabled)
109  {
110  bool ret = false;
111  if ( _config.hasKey("enable") )
112  {
113  int adjRateIndex = _rateIndex;
114  int adjUdpDest = _udpDestination;
115  int adjVita = _vitaEnable;
116  unsigned int adjStream = _streamId;
117  bool adjEnabled = enabled;
118  double adjFreq = _frequency;
119  int adjSource = _source;
120  ret = executeNbddcCommand(_index, adjRateIndex, adjUdpDest, adjEnabled,
121  adjVita, adjStream, adjFreq, adjSource);
122  if ( ret )
123  {
124  _enabled = adjEnabled;
126  }
127  }
128  return ret;
129  }
130 
132  {
133  // Call the "grandparent" version of this method instead of the
134  // parent version. We want the normalization, but not the
135  // automatic enabling.
136  bool ret = Configurable::setConfiguration(cfg);
137  // Use the keys provided in the *incoming* dictionary to determine
138  // what needs to be changed via hardware calls.
139  int adjRateIndex = _rateIndex;
140  int adjUdpDest = _udpDestination;
141  int adjVita = _vitaEnable;
142  unsigned int adjStream = _streamId;
143  bool adjEnabled = _enabled;
144  double adjFreq = _frequency;
145  int adjSource = _source;
146  int adjDataPort = _dataPort;
147  bool ddcCmdNeedsExecuting = false;
148  bool freqCmdNeedsExecuting = false;
149  bool srcCmdNeedsExecuting = false;
150  bool dpCmdNeedsExecuting = false;
151  if ( cfg.hasKey("enable") && _config.hasKey("enable") )
152  {
153  adjEnabled = getConfigurationValueAsBool("enable");
154  ddcCmdNeedsExecuting = true;
155  }
156  if ( cfg.hasKey("rateIndex") && _config.hasKey("rateIndex") )
157  {
158  adjRateIndex = getConfigurationValueAsInt("rateIndex");
159  ddcCmdNeedsExecuting = true;
160  }
161  if ( cfg.hasKey("udpDestination") && _config.hasKey("udpDestination") )
162  {
163  adjUdpDest = getConfigurationValueAsInt("udpDestination");
164  ddcCmdNeedsExecuting = true;
165  }
166  if ( cfg.hasKey("vitaEnable") && _config.hasKey("vitaEnable") )
167  {
168  adjVita = getConfigurationValueAsInt("vitaEnable");
169  ddcCmdNeedsExecuting = true;
170  }
171  if ( cfg.hasKey("streamId") && _config.hasKey("streamId") )
172  {
173  adjStream = getConfigurationValueAsUInt("streamId");
174  ddcCmdNeedsExecuting = true;
175  }
176  if ( cfg.hasKey("frequency") && _config.hasKey("frequency") )
177  {
178  adjFreq = getConfigurationValueAsDbl("frequency");
179  if ( _nbddcCommandSetsFreq )
180  ddcCmdNeedsExecuting = true;
181  else
182  freqCmdNeedsExecuting = true;
183  }
184  if ( cfg.hasKey("source") && _config.hasKey("source") )
185  {
186  adjSource = getConfigurationValueAsInt("source");
187  if ( _nbddcCommandSetsSource )
188  ddcCmdNeedsExecuting = true;
189  else
190  srcCmdNeedsExecuting = true;
191  }
192  if ( cfg.hasKey("dataPort") && _config.hasKey("dataPort") )
193  {
194  adjDataPort = getConfigurationValueAsInt("dataPort");
195  if ( _selectableDataPort )
196  dpCmdNeedsExecuting = true;
197  }
198  if ( ddcCmdNeedsExecuting )
199  {
200  ret &= executeNbddcCommand(_index, adjRateIndex, adjUdpDest,
201  adjEnabled, adjVita, adjStream,
202  adjFreq, adjSource);
203  }
204  if ( freqCmdNeedsExecuting )
205  {
206  ret &= executeFreqCommand(_index, adjFreq);
207  }
208  if ( srcCmdNeedsExecuting )
209  {
210  ret &= executeSourceCommand(_index, adjSource);
211  }
212  if ( dpCmdNeedsExecuting )
213  {
214  ret &= executeDataPortCommand(_index, adjDataPort);
215  }
216  if ( ret )
217  {
218  _rateIndex = adjRateIndex;
219  _udpDestination = adjUdpDest;
220  _vitaEnable = adjVita;
221  _streamId = adjStream;
222  _enabled = adjEnabled;
223  _frequency = adjFreq;
224  _source = adjSource;
225  _dataPort = adjDataPort;
227  }
228  return ret;
229  }
230 
232  {
233  this->debug("[queryConfiguration] Called\n");
234  if ( _config.hasKey("enable") &&
235  _config.hasKey("rateIndex") &&
236  _config.hasKey("udpDestination") &&
237  _config.hasKey("vitaEnable") &&
238  _config.hasKey("streamId") &&
239  (!_nbddcCommandSetsFreq || _config.hasKey("frequency")) &&
240  (!_nbddcCommandSetsSource || _config.hasKey("source"))
241  )
242  {
243  executeNbddcQuery(_index, _rateIndex, _udpDestination, _enabled,
244  _vitaEnable, _streamId, _frequency, _source);
245  }
246  if ( !_nbddcCommandSetsFreq && _config.hasKey("frequency") )
247  {
248  executeFreqQuery(_index, _frequency);
249  }
250  if ( !_nbddcCommandSetsSource && _config.hasKey("source") )
251  {
252  executeSourceQuery(_index, _source);
253  }
254  if ( _selectableDataPort && _config.hasKey("dataPort") )
255  {
256  executeDataPortQuery(_index, _dataPort);
257  }
259  }
260 
262  {
263  return _frequency;
264  }
265 
267  {
268  bool ret = false;
269  if ( _config.hasKey("frequency") )
270  {
271  double adjFreq = freq;
272  if ( _nbddcCommandSetsFreq )
273  {
274  int adjRateIndex = _rateIndex;
275  int adjUdpDest = _udpDestination;
276  int adjVita = _vitaEnable;
277  unsigned int adjStream = _streamId;
278  bool adjEnabled = _enabled;
279  int adjSource = _source;
280  ret = executeNbddcCommand(_index, adjRateIndex, adjUdpDest, adjEnabled,
281  adjVita, adjStream, adjFreq, adjSource);
282  }
283  else
284  {
285  ret = executeFreqCommand(_index, adjFreq);
286  }
287  if ( ret )
288  {
289  _frequency = adjFreq;
291  }
292  }
293  return ret;
294  }
295 
297  {
298  BasicDoubleList ret;
299  ret.push_back(_freqRangeMin);
300  ret.push_back(_freqRangeMax);
301  return ret;
302  }
303 
305  {
306  return _freqRes;
307  }
308 
310  {
311  return _freqUnits;
312  }
313 
315  {
316  return _source;
317  }
318 
319  bool NbddcComponent::setSource(int source)
320  {
321  bool ret = false;
322  if ( _config.hasKey("source") )
323  {
324  int adjSource = source;
325  if ( _nbddcCommandSetsSource )
326  {
327  int adjRateIndex = _rateIndex;
328  int adjUdpDest = _udpDestination;
329  int adjVita = _vitaEnable;
330  unsigned int adjStream = _streamId;
331  bool adjEnabled = _enabled;
332  double adjFreq = _frequency;
333  ret = executeNbddcCommand(_index, adjRateIndex, adjUdpDest, adjEnabled,
334  adjVita, adjStream, adjFreq, adjSource);
335  }
336  else
337  {
338  ret = executeSourceCommand(_index, adjSource);
339  }
340  if ( ret )
341  {
342  _source = adjSource;
344  }
345  }
346  return ret;
347  }
348 
350  {
351  return _rateIndex;
352  }
353 
355  {
356  bool ret = false;
357  if ( _config.hasKey("rateIndex") )
358  {
359  int adjRateIndex = index;
360  int adjUdpDest = _udpDestination;
361  int adjVita = _vitaEnable;
362  unsigned int adjStream = _streamId;
363  bool adjEnabled = _enabled;
364  double adjFreq = _frequency;
365  int adjSource = _source;
366  ret = executeNbddcCommand(_index, adjRateIndex, adjUdpDest,
367  adjEnabled, adjVita, adjStream,
368  adjFreq, adjSource);
369  if ( ret )
370  {
371  _rateIndex = adjRateIndex;
373  }
374  }
375  return ret;
376  }
377 
379  {
380  return _udpDestination;
381  }
382 
384  {
385  bool ret = false;
386  if ( _config.hasKey("udpDestination") )
387  {
388  int adjRateIndex = _rateIndex;
389  int adjUdpDest = dest;
390  int adjVita = _vitaEnable;
391  unsigned int adjStream = _streamId;
392  bool adjEnabled = _enabled;
393  double adjFreq = _frequency;
394  int adjSource = _source;
395  ret = executeNbddcCommand(_index, adjRateIndex, adjUdpDest,
396  adjEnabled, adjVita, adjStream,
397  adjFreq, adjSource);
398  if ( ret )
399  {
400  _udpDestination = adjUdpDest;
402  }
403  }
404  return ret;
405  }
406 
408  {
409  return _vitaEnable;
410  }
411 
413  {
414  bool ret = false;
415  if ( _config.hasKey("vitaEnable") )
416  {
417  int adjRateIndex = _rateIndex;
418  int adjUdpDest = _udpDestination;
419  int adjVita = enable;
420  unsigned int adjStream = _streamId;
421  bool adjEnabled = _enabled;
422  double adjFreq = _frequency;
423  int adjSource = _source;
424  ret = executeNbddcCommand(_index, adjRateIndex, adjUdpDest,
425  adjEnabled, adjVita, adjStream,
426  adjFreq, adjSource);
427  if ( ret )
428  {
429  _vitaEnable = adjVita;
431  }
432  }
433  return ret;
434  }
435 
436  unsigned int NbddcComponent::getStreamId() const
437  {
438  return _streamId;
439  }
440 
441  bool NbddcComponent::setStreamId(unsigned int sid)
442  {
443  bool ret = false;
444  if ( _config.hasKey("streamId") )
445  {
446  int adjRateIndex = _rateIndex;
447  int adjUdpDest = _udpDestination;
448  int adjVita = _vitaEnable;
449  unsigned int adjStream = sid;
450  bool adjEnabled = _enabled;
451  double adjFreq = _frequency;
452  int adjSource = _source;
453  ret = executeNbddcCommand(_index, adjRateIndex, adjUdpDest,
454  adjEnabled, adjVita, adjStream,
455  adjFreq, adjSource);
456  if ( ret )
457  {
458  _streamId = adjStream;
460  }
461  }
462  return ret;
463  }
464 
466  {
467  return _dataPort;
468  }
469 
471  {
472  bool ret = false;
473  if ( _selectableDataPort && _config.hasKey("dataPort") )
474  {
475  int adjDataPort = port;
476  ret = executeDataPortCommand(_index, adjDataPort);
477  if ( ret )
478  {
479  _dataPort = adjDataPort;
481  }
482  }
483  return ret;
484  }
485 
487  {
488  return _rateSet;
489  }
490 
492  {
493  _rateSet = set;
494  return true;
495  }
496 
498  {
499  BasicDoubleList ret;
500  for (NbddcRateSet::const_iterator it = _rateSet.begin(); it != _rateSet.end(); it++)
501  {
502  ret.push_back(it->second);
503  }
504  return ret;
505  }
506 
508  {
509  _config.clear();
511  _config["rateIndex"] = "";
512  _config["udpDestination"] = "";
513  _config["vitaEnable"] = "";
514  _config["streamId"] = "";
515  _config["frequency"] = "";
516  _config["source"] = "";
517  if ( _selectableDataPort )
518  {
519  _config["dataPort"] = "";
520  }
521  }
522 
524  {
525  this->debug("[NbddcComponent::updateConfigurationDict] Called\n");
527  if ( _config.hasKey("rateIndex") )
528  setConfigurationValueToInt("rateIndex", _rateIndex);
529  if ( _config.hasKey("udpDestination") )
530  setConfigurationValueToInt("udpDestination", _udpDestination);
531  if ( _config.hasKey("vitaEnable") )
532  setConfigurationValueToInt("vitaEnable", _vitaEnable);
533  if ( _config.hasKey("streamId") )
534  setConfigurationValueToUInt("streamId", _streamId);
535  if ( _config.hasKey("frequency") )
536  setConfigurationValueToDbl("frequency", _frequency);
537  if ( _config.hasKey("source") )
538  setConfigurationValueToInt("source", _source);
539  if ( _selectableDataPort && _config.hasKey("dataPort") )
540  {
541  setConfigurationValueToInt("dataPort", _dataPort);
542  }
543  this->debug("[NbddcComponent::updateConfigurationDict] Returning\n");
544  }
545 
546  // Default implementation uses the NDR308 syntax.
547  // NBDDC? <index>
549  int& rateIndex,
550  int& udpDestination,
551  bool& enabled,
552  int& vitaEnable,
553  unsigned int& streamId,
554  double& frequency,
555  int& source)
556  {
557  bool ret = false;
558  if ( (_parent != NULL) && (_parent->isConnected()) )
559  {
560  std::ostringstream oss;
561  oss << "NBDDC? " << index << "\n";
562  BasicStringList rsp = _parent->sendCommand(oss.str(), 2.0);
563  if ( _parent->getLastCommandErrorInfo() == "" )
564  {
566  Pythonesque::Replace(rsp.front(), "NBDDC ", ""),
567  ", ");
568  // vec[0] = Index
569  // vec[1] = Frequency
570  // vec[2] = Rate index
571  frequency = boost::lexical_cast<double>(vec[1]);
572  rateIndex = boost::lexical_cast<int>(vec[2]);
573  udpDestination = boost::lexical_cast<int>(vec[3]);
574  enabled = (boost::lexical_cast<int>(vec[4]) == 1);
575  vitaEnable = boost::lexical_cast<int>(vec[5]);
576  streamId = boost::lexical_cast<unsigned int>(vec[6]);
577  // NDR308 doesn't use NBDDC command to set the data source
578  ret = true;
579  }
580  }
581  return ret;
582  }
583 
584  // Default implementation uses the NDR308 syntax.
585  // NBDDC <index>, <frequency>, <rate index>, <udp dest>, <enable>,
586  // <vita enable>, <stream id>
588  int& rateIndex,
589  int& udpDestination,
590  bool& enabled,
591  int& vitaEnable,
592  unsigned int& streamId,
593  double& frequency,
594  int& source)
595  {
596  bool ret = false;
597  if ( (_parent != NULL) && (_parent->isConnected()) )
598  {
599  std::ostringstream oss;
600  oss << "NBDDC " << index
601  << ", " << frequency
602  << ", " << rateIndex
603  << ", " << udpDestination
604  << ", " << (enabled ? 1 : 0)
605  << ", " << vitaEnable
606  << ", " << streamId
607  << "\n";
608  BasicStringList rsp = _parent->sendCommand(oss.str(), 2.0);
609  if ( _parent->getLastCommandErrorInfo() == "" )
610  {
611  ret = true;
612  }
613  }
614  return ret;
615  }
616 
617  // Default implementation returns false, since it is based on
618  // the NDR308, which does not support tunable NBDDCs.
619  bool NbddcComponent::executeFreqQuery(int index, double& freq)
620  {
621  return false;
622  }
623 
624  // Default implementation returns false, since it is based on
625  // the NDR308, which does not support tunable NBDDCs.
626  bool NbddcComponent::executeFreqCommand(int index, double& freq)
627  {
628  return false;
629  }
630 
631  // Default implementation is based on the NDR308, which sets
632  // NBDDC source through the NBSS command.
633  bool NbddcComponent::executeSourceQuery(int index, int& source)
634  {
635  bool ret = false;
636  if ( (_parent != NULL) && (_parent->isConnected()) )
637  {
638  std::ostringstream oss;
639  oss << "NBSS? " << index << "\n";
640  BasicStringList rsp = _parent->sendCommand(oss.str(), 2.0);
641  if ( _parent->getLastCommandErrorInfo() == "" )
642  {
644  Pythonesque::Replace(rsp.front(), "NBSS ", ""),
645  ", ");
646  // vec[0] = Index
647  // vec[1] = Source
648  source = boost::lexical_cast<int>(vec[1]);
649  ret = true;
650  }
651  }
652  return ret;
653  }
654 
655  // Default implementation is based on the NDR308, which sets
656  // NBDDC source through the NBSS command.
657  bool NbddcComponent::executeSourceCommand(int index, int& source)
658  {
659  bool ret = false;
660  if ( (_parent != NULL) && (_parent->isConnected()) )
661  {
662  std::ostringstream oss;
663  oss << "NBSS " << index
664  << ", " << source
665  << "\n";
666  BasicStringList rsp = _parent->sendCommand(oss.str(), 2.0);
667  if ( _parent->getLastCommandErrorInfo() == "" )
668  {
669  ret = true;
670  }
671  }
672  return ret;
673  }
674 
675  // Default implementation uses the NDR308 syntax.
676  // NBDP? <index>
677  bool NbddcComponent::executeDataPortQuery(int index, int& dataPort)
678  {
679  bool ret = false;
680  if ( (_parent != NULL) && (_parent->isConnected()) )
681  {
682  std::ostringstream oss;
683  oss << "NBDP? " << index << "\n";
684  BasicStringList rsp = _parent->sendCommand(oss.str(), 2.0);
685  if ( _parent->getLastCommandErrorInfo() == "" )
686  {
688  Pythonesque::Replace(rsp.front(), "NBDP ", ""),
689  ", ");
690  // vec[0] = Index
691  // vec[1] = Data Port
692  dataPort = boost::lexical_cast<int>(vec[1]);
693  ret = true;
694  }
695  }
696  return ret;
697  }
698 
699  // Default implementation uses the NDR308 syntax.
700  // NBDP <index>, <data port>
701  bool NbddcComponent::executeDataPortCommand(int index, int& dataPort)
702  {
703  bool ret = false;
704  if ( (_parent != NULL) && (_parent->isConnected()) )
705  {
706  std::ostringstream oss;
707  oss << "NBDP " << index
708  << ", " << dataPort
709  << "\n";
710  BasicStringList rsp = _parent->sendCommand(oss.str(), 2.0);
711  if ( _parent->getLastCommandErrorInfo() == "" )
712  {
713  ret = true;
714  }
715  }
716  return ret;
717  }
718 
719  } // namespace Driver
720 
721 } // namespace LibCyberRadio
722 
virtual void updateConfigurationDict()
Updates the configuration dictionary from component settings.
virtual bool getConfigurationValueAsBool(const std::string &key) const
Gets a named configuration value as a Boolean.
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 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 int getRateIndex() const
Gets the NBDDC&#39;s rate index.
virtual int getDataPort() const
Gets the NBDDC&#39;s data port.
virtual bool setConfigurationValueToDbl(const std::string &key, const double value)
Sets a named configuration value to a double value.
virtual void queryConfiguration()
Tells the component to query its hardware configuration in order to create its configuration dictiona...
virtual bool setVitaEnable(int enable)
Sets the NBDDC&#39;s VITA 49 setting.
Base hardware component class.
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 hasKey(const std::string &key) const
Determines if the dictionary has the given key.
BASIC_LIST_CONTAINER< double > BasicDoubleList
Type representing a list of doubles.
Definition: BasicList.h:29
virtual double getFrequencyRes() const
Gets the tuned frequency resolution.
virtual int getConfigurationValueAsInt(const std::string &key) const
Gets a named configuration value as an integer value.
BASIC_DICT_CONTAINER< int, double > NbddcRateSet
A rate set for a NBDDC.
virtual double getFrequencyUnit() const
Gets the tuned frequency units.
virtual bool setUdpDestination(int dest)
Sets the NBDDC&#39;s UDP destination.
virtual int getUdpDestination() const
Gets the NBDDC&#39;s UDP destination.
virtual bool isConnected() const
Gets whether or not the handler is connected.
virtual RadioComponent & operator=(const RadioComponent &other)
Assignment operator for RadioComponent objects.
static std::string Replace(const std::string &str, const std::string &oldstr, const std::string &newstr, int count=INT_MAX)
Replaces occurrences of one substring with another within the given string.
Definition: Pythonesque.cpp:62
virtual BasicDoubleList getRateList() const
Gets the list of allowed sample rates, based on the rate set.
virtual bool executeSourceCommand(int index, int &source)
Executes the NBDDC source set command.
virtual unsigned int getStreamId() const
Gets the NBDDC&#39;s VITA 49 stream ID.
static BasicStringList Split(const std::string &str, const std::string &sep, int maxsplit=INT_MAX)
Splits the given string into a list of string tokens.
Definition: Pythonesque.cpp:77
virtual bool setDataPort(int port)
Sets the NBDDC&#39;s data port.
virtual int getSource() const
Gets the NBDDC&#39;s source (which tuner is supplying the signal).
virtual bool setConfigurationValueToUInt(const std::string &key, const unsigned int value)
Sets a named configuration value to an unsigned integer value.
virtual bool setRateIndex(int index)
Sets the NBDDC&#39;s rate index.
virtual int getVitaEnable() const
Gets the NBDDC&#39;s VITA 49 setting.
Generic radio handler class.
Definition: RadioHandler.h:54
virtual int debug(const char *format,...)
Outputs debug information.
Definition: Debuggable.cpp:95
BASIC_LIST_CONTAINER< std::string > BasicStringList
Type representing a list of strings.
Definition: BasicList.h:25
virtual void updateConfigurationDict()
Updates the configuration dictionary from component settings.
virtual bool executeDataPortCommand(int index, int &dataPort)
Executes the NBDDC data port set command.
virtual void initConfigurationDict()
Initializes the configuration dictionary, defining the allowed keys.
virtual void initConfigurationDict()
Initializes the configuration dictionary, defining the allowed keys.
virtual BasicDoubleList getFrequencyRange() const
Gets the tunable frequency range.
Defines functionality for LibCyberRadio applications.
Definition: App.h:23
virtual NbddcComponent & operator=(const NbddcComponent &other)
Assignment operator for NbddcComponent objects.
virtual bool enable(bool enabled=true)
Enables this component.
A configuration dictionary.
Definition: Configurable.h:51
virtual ~NbddcComponent()
Destroys a NbddcComponent object.
virtual double getFrequency() const
Gets the tuned frequency.
virtual std::string getLastCommandErrorInfo() const
Gets the error message from the last command attempted.
Base NBDDC component class.
virtual bool setStreamId(unsigned int sid)
Sets the NBDDC&#39;s VITA 49 stream ID.
virtual bool executeDataPortQuery(int index, int &dataPort)
Executes the NBDDC data port query command.
virtual NbddcRateSet getRateSet() const
Gets the NBDDC&#39;s rate set.
virtual bool setSource(int source)
Sets the NBDDC&#39;s source (which tuner is supplying the signal).
virtual bool setConfiguration(ConfigurationDict &cfg)
Sets the configuration dictionary for this object.
virtual bool setFrequency(double freq)
Sets the NBDDC tuned frequency.
virtual bool setConfiguration(ConfigurationDict &cfg)
Sets the configuration dictionary for this component.
virtual BasicStringList sendCommand(const std::string &cmdString, double timeout=-1)
Sends a command to the radio.
virtual bool setRateSet(const NbddcRateSet &set)
Sets the NBDDC rate set.
virtual double getConfigurationValueAsDbl(const std::string &key) const
Gets a named configuration value as a double value.
virtual unsigned int getConfigurationValueAsUInt(const std::string &key) const
Gets a named configuration value as an unsigned integer value.
virtual bool executeFreqCommand(int index, double &freq)
Executes the NBDDC frequency set command.
virtual bool executeSourceQuery(int index, int &source)
Executes the NBDDC source query command.
virtual bool executeFreqQuery(int index, double &freq)
Executes the NBDDC frequency query command.
virtual bool setConfigurationValueToInt(const std::string &key, const int value)
Sets a named configuration value to an integer value.