11 #include "LibCyberRadio/Driver/NDR651/DataPort.h" 12 #include "LibCyberRadio/Driver/NDR651/RadioHandler.h" 13 #include "LibCyberRadio/Driver/NDR651/NbddcComponent.h" 14 #include "LibCyberRadio/Driver/NDR651/TransmitterComponent.h" 15 #include "LibCyberRadio/Driver/NDR651/TunerComponent.h" 16 #include "LibCyberRadio/Driver/NDR651/VitaIfSpec.h" 17 #include "LibCyberRadio/Driver/NDR651/WbddcComponent.h" 18 #include "LibCyberRadio/Driver/NDR651/WbddcGroupComponent.h" 19 #include "LibCyberRadio/Driver/NDR651/NbddcGroupComponent.h" 20 #include "LibCyberRadio/Driver/NDR651/DucComponent.h" 21 #include "LibCyberRadio/Common/Pythonesque.h" 35 RadioHandler::RadioHandler(
bool debug) :
64 _connModesSupported.push_back(
"tcp");
65 _defaultDeviceInfo = 8617;
67 for (
int tuner = _tunerIndexBase;
68 tuner < (_tunerIndexBase + _numTuner); tuner++)
71 _tuners[tuner] =
new NDR651::TunerComponent(
80 for (
int wbddc = _wbddcIndexBase;
81 wbddc < (_wbddcIndexBase + _numWbddc); wbddc++)
83 _wbddcs[wbddc] =
new NDR651::WbddcComponent(
94 for (
int nbddc = _nbddcIndexBase;
95 nbddc < (_nbddcIndexBase + _numNbddc); nbddc++)
97 _nbddcs[nbddc] =
new NDR651::NbddcComponent(
110 for (
int tx = _transmitterIndexBase;
111 tx < (_transmitterIndexBase + _numTransmitter); tx++)
113 _txs[tx] =
new NDR651::TransmitterComponent(
121 for (
int duc = _ducIndexBase;
122 duc < (_ducIndexBase + _numDuc); duc++)
124 _ducs[duc] =
new NDR651::DucComponent(
137 for (
int group = _wbddcGroupIndexBase;
138 group < (_wbddcGroupIndexBase + _numWbddcGroups); group++)
140 _wbddcGroups[group] =
new NDR651::WbddcGroupComponent(
146 for (
int group = _nbddcGroupIndexBase;
147 group < (_nbddcGroupIndexBase + _numNbddcGroups); group++)
149 _nbddcGroups[group] =
new NDR651::NbddcGroupComponent(
155 for (
int dataPort = _dataPortIndexBase;
156 dataPort < (_dataPortIndexBase + _numDataPorts); dataPort++)
158 _dataPorts[dataPort] =
new NDR651::DataPort(
177 ::LibCyberRadio::Driver::RadioHandler::operator=(other);
187 this->
debug(
"[NDR651::RadioHandler::queryConfiguration] Called\n");
193 this->
debug(
"[NDR651::RadioHandler::queryConfiguration] Returning\n");
196 bool RadioHandler::queryVersionInfo()
198 this->
debug(
"[NDR651::RadioHandler::queryVersionInfo] Called\n");
200 bool ret = ::LibCyberRadio::Driver::RadioHandler::queryVersionInfo();
210 int stateTracker = -1;
214 for (BasicStringList::iterator it = vec.begin(); it != vec.end(); it++)
217 if ( it->find(
"Unit") == 0 )
219 else if ( it->find(
"Digital Board") == 0 )
221 else if ( it->find(
"Tuner Quad") == 0 )
224 switch( stateTracker )
227 if ( it->find(
" Revision: ") != std::string::npos )
233 if ( ( it->find(
"Tuner Quad") == 0) && ( it->find(
"Not Installed") != std::string::npos) )
235 else if ( it->find(
"Bandwidth: ") == 0 )
238 std::istringstream iss(tmp);
254 _numTuner = std::min(_numTuner, _numTunerBoards * 4);
255 _numWbddc = _numTuner;
256 this->
debug(
"[NDR651::RadioHandler::queryVersionInfo] Number of tuner boards=%d\n", _numTunerBoards);
257 this->
debug(
"[NDR651::RadioHandler::queryVersionInfo] Number of tuners=%d\n", _numTuner);
259 this->
debug(
"[NDR651::RadioHandler::queryVersionInfo] Deallocating nonexistent tuners/WBDDCs\n");
260 TunerComponentDict::iterator it = _tuners.begin();
261 for (; it != _tuners.end(); )
263 if ( it->first >= (_tunerIndexBase + _numTuner) )
265 this->
debug(
"[NDR651::RadioHandler::queryVersionInfo] -- Deallocating tuner=%d\n", it->first);
271 this->
debug(
"[NDR651::RadioHandler::queryVersionInfo] -- OK tuner=%d\n", it->first);
275 WbddcComponentDict::iterator it2 = _wbddcs.begin();
276 for (; it2 != _wbddcs.end(); )
278 if ( it2->first >= (_wbddcIndexBase + _numWbddc) )
280 this->
debug(
"[NDR651::RadioHandler::queryVersionInfo] -- Deallocating WBDDC=%d\n", it2->first);
282 _wbddcs.erase(it2++);
286 this->
debug(
"[NDR651::RadioHandler::queryVersionInfo] -- OK WBDDC=%d\n", it2->first);
291 this->
debug(
"[NDR651::RadioHandler::queryVersionInfo] Max tuner bandwidth=%d MHz\n", _maxTunerBw);
292 for (it = _tuners.begin(); it != _tuners.end(); it++)
294 it->second->setFrequencyRangeMax(_maxTunerBw * 1e6);
299 for (BasicStringStringDict::iterator it = _versionInfo.begin(); it != _versionInfo.end(); it++)
301 this->
debug(
"[NDR651::RadioHandler::queryVersionInfo] %s = \"%s\"\n", it->first.c_str(), it->second.c_str());
304 this->
debug(
"[NDR651::RadioHandler::queryVersionInfo] Returning %s\n",
debugBool(ret));
310 bool RadioHandler::executeQueryIDN(std::string& model,
311 std::string& serialNumber)
313 return ::LibCyberRadio::Driver::RadioHandler::executeQueryIDN(model, serialNumber);
318 bool RadioHandler::executeQueryVER(std::string& softwareVersion,
319 std::string& firmwareVersion,
320 std::string& referenceVersion,
321 std::string& firmwareDate)
324 return ::LibCyberRadio::Driver::RadioHandler::executeQueryVER(softwareVersion,
332 bool RadioHandler::executeQueryHREV(std::string& hardwareInfo)
334 return ::LibCyberRadio::Driver::RadioHandler::executeQueryHREV(hardwareInfo);
virtual void initConfigurationDict()
Initializes the configuration dictionary, defining the allowed keys.
virtual ~RadioHandler()
Destroys a RadioHandler object.
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 void queryConfiguration()
Tells the radio to query its hardware configuration in order to create its configuration dictionary (...
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.
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.
Defines functionality for LibCyberRadio applications.
Radio handler class for the NDR651.
virtual const char * debugBool(bool x)
Gets a debug output string for a Boolean value.
virtual BasicStringList receive(double timeout=-1)
Receives a command response from the radio.
virtual void queryConfiguration()
Tells the radio to query its hardware configuration in order to create its configuration dictionary (...