11#include "LibCyberRadio/Driver/NDR472/TunerComponent.h"
12#include "LibCyberRadio/Driver/RadioHandler.h"
13#include "LibCyberRadio/Common/Pythonesque.h"
14#include <boost/lexical_cast.hpp>
15#include <boost/format.hpp>
33 (boost::format(
"NDR472-TUNER%02d") % \
65 ::LibCyberRadio::Driver::TunerComponent::operator=(other);
75 this->
debug(
"[NDR472::TunerComponent::initConfigurationDict] Called\n");
80 _config[
"frequency"] =
"";
81 _config[
"attenuation"] =
"";
82 _config[
"timingAdj"] =
"";
83 this->
debug(
"[NDR472::TunerComponent::initConfigurationDict] Returning\n");
89 this->
debug(
"[NDR472::TunerComponent::updateConfigurationDict] Called\n");
97 this->
debug(
"[NDR472::TunerComponent::updateConfigurationDict] Returning\n");
103 this->
debug(
"[NDR472::TunerComponent::queryConfiguration] Called\n");
109 this->
debug(
"[NDR472::TunerComponent::queryConfiguration] Returning\n");
117 if ( (_parent != NULL) && (_parent->isConnected()) )
119 std::ostringstream oss;
120 oss <<
"TPWR? " << index <<
"\n";
122 if ( _parent->getLastCommandErrorInfo() ==
"" )
129 enabled = (boost::lexical_cast<int>(vec[1]) == 1);
143 if ( (_parent != NULL) && (_parent->isConnected()) )
145 std::ostringstream oss;
146 oss <<
"FRQ? " << index <<
"\n";
148 if ( _parent->getLastCommandErrorInfo() ==
"" )
155 freq = boost::lexical_cast<int>(vec[1]) * _freqUnits;
168 if ( (_parent != NULL) && (_parent->isConnected()) )
170 std::ostringstream oss;
171 oss <<
"ATT? " << index <<
"\n";
173 if ( _parent->getLastCommandErrorInfo() ==
"" )
180 atten = boost::lexical_cast<double>(vec[1]);
200 if ( (_parent != NULL) && (_parent->isConnected()) )
202 std::ostringstream oss;
203 oss <<
"TADJ? " << index <<
"\n";
205 if ( _parent->getLastCommandErrorInfo() ==
"" )
212 timingAdj = boost::lexical_cast<int>(vec[1]);
virtual int debug(const char *format,...)
Outputs debug information.
virtual bool setConfigurationValueToInt(const std::string &key, const int value)
Sets a named configuration value to an integer value.
virtual bool setConfigurationValueToDbl(const std::string &key, const double value)
Sets a named configuration value to a double value.
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 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 void initConfigurationDict()
Initializes the configuration dictionary, defining the allowed keys.
TunerComponent(int index=1, ::LibCyberRadio::Driver::RadioHandler *parent=NULL, bool debug=false, double frequency=800e6, double attenuation=0.0, int filter=0)
Constructs a TunerComponent object.
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 ~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 void updateConfigurationDict()
Updates the configuration dictionary from component settings.
virtual void initConfigurationDict()
Initializes the configuration dictionary, defining the allowed keys.
Generic radio handler class.
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.
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.
Provides programming elements for driving NDR472 radios.
Provides programming elements for driving CRS NDR-class radios.
Defines functionality for LibCyberRadio applications.
BASIC_LIST_CONTAINER< std::string > BasicStringList
Type representing a list of strings.