11#include "LibCyberRadio/Driver/NDR308TS/RadioHandler.h"
12#include "LibCyberRadio/Driver/NDR308TS/DataPort.h"
13#include "LibCyberRadio/Driver/NDR308TS/NbddcComponent.h"
14#include "LibCyberRadio/Driver/NDR308TS/TunerComponent.h"
15#include "LibCyberRadio/Driver/NDR308TS/VitaIfSpec.h"
16#include "LibCyberRadio/Driver/NDR308TS/WbddcComponent.h"
17#include "LibCyberRadio/Driver/NDR308TS/WbddcGroupComponent.h"
18#include "LibCyberRadio/Driver/NDR308TS/NbddcGroupComponent.h"
19#include "LibCyberRadio/Common/Pythonesque.h"
33 RadioHandler::RadioHandler(
bool debug) :
61 initConfigurationDict();
62 _connModesSupported.push_back(
"tcp");
63 _defaultDeviceInfo = 8617;
65 for (
int tuner = _tunerIndexBase;
66 tuner < (_tunerIndexBase + _numTuner); tuner++)
69 _tuners[tuner] =
new NDR308TS::TunerComponent(
78 for (
int wbddc = _wbddcIndexBase;
79 wbddc < (_wbddcIndexBase + _numWbddc); wbddc++)
81 _wbddcs[wbddc] =
new NDR308TS::WbddcComponent(
92 for (
int nbddc = _nbddcIndexBase;
93 nbddc < (_nbddcIndexBase + _numNbddc); nbddc++)
95 _nbddcs[nbddc] =
new NDR308TS::NbddcComponent(
108 for (
int group = _wbddcGroupIndexBase;
109 group < (_wbddcGroupIndexBase + _numWbddcGroups); group++)
111 _wbddcGroups[group] =
new NDR308TS::WbddcGroupComponent(
117 for (
int group = _nbddcGroupIndexBase;
118 group < (_nbddcGroupIndexBase + _numNbddcGroups); group++)
120 _nbddcGroups[group] =
new NDR308TS::NbddcGroupComponent(
126 for (
int dataPort = _dataPortIndexBase;
127 dataPort < (_dataPortIndexBase + _numDataPorts); dataPort++)
129 _dataPorts[dataPort] =
new NDR308TS::DataPort(
148 ::LibCyberRadio::Driver::RadioHandler::operator=(other);
158 this->
debug(
"[NDR308TS::RadioHandler::queryConfiguration] Called\n");
164 this->
debug(
"[NDR308TS::RadioHandler::queryConfiguration] Returning\n");
167 bool RadioHandler::queryVersionInfo()
169 this->
debug(
"[NDR308TS::RadioHandler::queryVersionInfo] Called\n");
171 bool ret = ::LibCyberRadio::Driver::RadioHandler::queryVersionInfo();
181 int stateTracker = -1;
185 for (BasicStringList::iterator it = vec.begin(); it != vec.end(); it++)
188 if ( it->find(
"Unit") == 0 )
190 else if ( it->find(
"Digital Board") == 0 )
192 else if ( it->find(
"Tuner Quad") == 0 )
195 switch( stateTracker )
198 if ( it->find(
" Revision: ") != std::string::npos )
204 if ( ( it->find(
"Tuner Quad") == 0) && ( it->find(
"Not Installed") != std::string::npos) )
206 else if ( it->find(
"Bandwidth: ") == 0 )
209 std::istringstream iss(tmp);
225 _numTuner = std::min(_numTuner, _numTunerBoards * 4);
226 _numWbddc = _numTuner;
227 this->
debug(
"[NDR308TS::RadioHandler::queryVersionInfo] Number of tuner boards=%d\n", _numTunerBoards);
228 this->
debug(
"[NDR308TS::RadioHandler::queryVersionInfo] Number of tuners=%d\n", _numTuner);
230 this->
debug(
"[NDR308TS::RadioHandler::queryVersionInfo] Deallocating nonexistent tuners/WBDDCs\n");
231 TunerComponentDict::iterator it = _tuners.begin();
232 for (; it != _tuners.end(); )
234 if ( it->first >= (_tunerIndexBase + _numTuner) )
236 this->
debug(
"[NDR308TS::RadioHandler::queryVersionInfo] -- Deallocating tuner=%d\n", it->first);
242 this->
debug(
"[NDR308TS::RadioHandler::queryVersionInfo] -- OK tuner=%d\n", it->first);
246 WbddcComponentDict::iterator it2 = _wbddcs.begin();
247 for (; it2 != _wbddcs.end(); )
249 if ( it2->first >= (_wbddcIndexBase + _numWbddc) )
251 this->
debug(
"[NDR308TS::RadioHandler::queryVersionInfo] -- Deallocating WBDDC=%d\n", it2->first);
253 _wbddcs.erase(it2++);
257 this->
debug(
"[NDR308TS::RadioHandler::queryVersionInfo] -- OK WBDDC=%d\n", it2->first);
262 this->
debug(
"[NDR308TS::RadioHandler::queryVersionInfo] Max tuner bandwidth=%d MHz\n", _maxTunerBw);
263 for (it = _tuners.begin(); it != _tuners.end(); it++)
265 it->second->setFrequencyRangeMax(_maxTunerBw * 1e6);
270 for (BasicStringStringDict::iterator it = _versionInfo.begin(); it != _versionInfo.end(); it++)
272 this->
debug(
"[NDR308TS::RadioHandler::queryVersionInfo] %s = \"%s\"\n", it->first.c_str(), it->second.c_str());
275 this->
debug(
"[NDR308TS::RadioHandler::queryVersionInfo] Returning %s\n",
debugBool(ret));
281 bool RadioHandler::executeQueryIDN(std::string& model,
282 std::string& serialNumber)
284 return ::LibCyberRadio::Driver::RadioHandler::executeQueryIDN(model, serialNumber);
289 bool RadioHandler::executeQueryVER(std::string& softwareVersion,
290 std::string& firmwareVersion,
291 std::string& referenceVersion,
292 std::string& firmwareDate)
295 return ::LibCyberRadio::Driver::RadioHandler::executeQueryVER(softwareVersion,
303 bool RadioHandler::executeQueryHREV(std::string& hardwareInfo)
305 return ::LibCyberRadio::Driver::RadioHandler::executeQueryHREV(hardwareInfo);
virtual const char * debugBool(bool x)
Gets a debug output string for a Boolean value.
virtual int debug(const char *format,...)
Outputs debug information.
Radio handler class for the NDR308-TS.
virtual void queryConfiguration()
Tells the radio to query its hardware configuration in order to create its configuration dictionary (...
virtual ~RadioHandler()
Destroys a RadioHandler object.
VITA interface specification for the NDR308-TS.
Generic radio handler class.
virtual RadioHandler & operator=(const RadioHandler &other)
Assignment operator for RadioHandler objects.
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.
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 NDR308-TS 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.