aboutsummaryrefslogtreecommitdiffstats
path: root/Transceiver52M/runTransceiver.cpp
diff options
context:
space:
mode:
authorThomas Tsou <tom@tsou.cc>2013-04-08 14:41:11 -0400
committerAlexander Chemeris <Alexander.Chemeris@gmail.com>2013-06-24 01:46:34 +0400
commit03669856b74bd1e82a3986a5e05154fec88942ac (patch)
tree9b551232c252925a767c684a0e2eef2cac1ffe7c /Transceiver52M/runTransceiver.cpp
parent5d0e392b216c3c4e3d6d701650cb13e50e19c35a (diff)
Transceiver52M: Set resampling option automatically based on device
Remove the built time resampling selection and link both options. Move the normal push/pullBuffer() calls back to the base class and overload them in the inherited resampling class. USRP2/N2xx devices are the only devices that require resampling so return that resampling is necessary on the device open(), which is the point at which the device type will be known. Signed-off-by: Thomas Tsou <tom@tsou.cc>
Diffstat (limited to 'Transceiver52M/runTransceiver.cpp')
-rw-r--r--Transceiver52M/runTransceiver.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/Transceiver52M/runTransceiver.cpp b/Transceiver52M/runTransceiver.cpp
index 6b35797..e61ba34 100644
--- a/Transceiver52M/runTransceiver.cpp
+++ b/Transceiver52M/runTransceiver.cpp
@@ -84,7 +84,8 @@ int main(int argc, char *argv[])
srandom(time(NULL));
RadioDevice *usrp = RadioDevice::make(SAMPSPERSYM);
- if (!usrp->open(deviceArgs)) {
+ int radioType = usrp->open(deviceArgs);
+ if (radioType < 0) {
LOG(ALERT) << "Transceiver exiting..." << std::endl;
return EXIT_FAILURE;
}
@@ -102,7 +103,19 @@ int main(int argc, char *argv[])
LOG(INFO) << "transceiver using transmit antenna " << usrp->getRxAntenna();
LOG(INFO) << "transceiver using receive antenna " << usrp->getTxAntenna();
- RadioInterface* radio = new RadioInterface(usrp, 3, SAMPSPERSYM, false);
+ RadioInterface* radio;
+ switch (radioType) {
+ case RadioDevice::NORMAL:
+ radio = new RadioInterface(usrp, 3, SAMPSPERSYM, false);
+ break;
+ case RadioDevice::RESAMP:
+ radio = new RadioInterfaceResamp(usrp, 3, SAMPSPERSYM, false);
+ break;
+ default:
+ LOG(ALERT) << "Unsupported configuration";
+ return EXIT_FAILURE;
+ }
+
Transceiver *trx = new Transceiver(gConfig.getNum("TRX.Port"),gConfig.getStr("TRX.IP").c_str(),SAMPSPERSYM,GSM::Time(3,0),radio);
trx->receiveFIFO(radio->receiveFIFO());