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";
129 enabled = (boost::lexical_cast<
int>(vec[1]) == 1);
143 if ( (_parent != NULL) && (_parent->
isConnected()) )
145 std::ostringstream oss;
146 oss <<
"FRQ? " << index <<
"\n";
155 freq = boost::lexical_cast<
int>(vec[1]) * _freqUnits;
168 if ( (_parent != NULL) && (_parent->
isConnected()) )
170 std::ostringstream oss;
171 oss <<
"ATT? " << index <<
"\n";
180 atten = boost::lexical_cast<
double>(vec[1]);
200 if ( (_parent != NULL) && (_parent->
isConnected()) )
202 std::ostringstream oss;
203 oss <<
"TADJ? " << index <<
"\n";
212 timingAdj = boost::lexical_cast<
int>(vec[1]);
virtual void updateConfigurationDict()
Updates the configuration dictionary from component settings.
virtual bool setConfigurationValueToDbl(const std::string &key, const double value)
Sets a named configuration value to a double value.
virtual bool executeFilterQuery(int index, int &filter)
Executes the tuner filter query command.
virtual bool executeAttenQuery(int index, double &atten)
Executes the tuner attenuation query command.
virtual bool isConnected() const
Gets whether or not the handler is connected.
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.
virtual bool executeFreqQuery(int index, double &freq)
Executes the tuner frequency query command.
virtual TunerComponent & operator=(const TunerComponent &other)
Assignment operator for TunerComponent objects.
Tuner component class for the NDR472.
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.
virtual bool executeEnableQuery(int index, bool &enabled)
Executes the tuner enabled query command.
Generic radio handler class.
virtual int debug(const char *format,...)
Outputs debug information.
BASIC_LIST_CONTAINER< std::string > BasicStringList
Type representing a list of strings.
virtual ~TunerComponent()
Destroys a TunerComponent object.
virtual void initConfigurationDict()
Initializes the configuration dictionary, defining the allowed keys.
Defines functionality for LibCyberRadio applications.
virtual std::string getLastCommandErrorInfo() const
Gets the error message from the last command attempted.
virtual bool executeTimingAdjustmentQuery(int index, int &timingAdj)
Executes the tuner timing adjustment query.
virtual void updateConfigurationDict()
Updates the configuration dictionary from component settings.
virtual BasicStringList sendCommand(const std::string &cmdString, double timeout=-1)
Sends a command to the radio.
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 void initConfigurationDict()
Initializes the configuration dictionary, defining the allowed keys.
virtual void queryConfiguration()
Tells the component to query its hardware configuration in order to create its configuration dictiona...
virtual bool executeFilterCommand(int index, int &filter)
Executes the tuner filter set command.
virtual bool setConfigurationValueToInt(const std::string &key, const int value)
Sets a named configuration value to an integer value.