diff options
-rw-r--r-- | Transceiver52M/UHDDevice.cpp | 10 | ||||
-rw-r--r-- | Transceiver52M/USRPDevice.cpp | 2 | ||||
-rw-r--r-- | Transceiver52M/USRPDevice.h | 2 | ||||
-rw-r--r-- | Transceiver52M/USRPping.cpp | 2 | ||||
-rw-r--r-- | Transceiver52M/radioDevice.h | 3 | ||||
-rw-r--r-- | Transceiver52M/runTransceiver.cpp | 13 |
6 files changed, 22 insertions, 10 deletions
diff --git a/Transceiver52M/UHDDevice.cpp b/Transceiver52M/UHDDevice.cpp index 1bc0519..78e9e57 100644 --- a/Transceiver52M/UHDDevice.cpp +++ b/Transceiver52M/UHDDevice.cpp @@ -151,7 +151,7 @@ public: uhd_device(double rate, bool skip_rx); ~uhd_device(); - bool open(); + bool open(const std::string &args); bool start(); bool stop(); void restart(uhd::time_spec_t ts); @@ -422,16 +422,16 @@ bool uhd_device::parse_dev_type() return true; } -bool uhd_device::open() +bool uhd_device::open(const std::string &args) { // Register msg handler uhd::msg::register_handler(&uhd_msg_handler); // Find UHD devices - uhd::device_addr_t args(""); - uhd::device_addrs_t dev_addrs = uhd::device::find(args); + uhd::device_addr_t addr(args); + uhd::device_addrs_t dev_addrs = uhd::device::find(addr); if (dev_addrs.size() == 0) { - LOG(ALERT) << "No UHD devices found"; + LOG(ALERT) << "No UHD devices found with address '" << args << "'"; return false; } diff --git a/Transceiver52M/USRPDevice.cpp b/Transceiver52M/USRPDevice.cpp index d9eefc8..237c5f1 100644 --- a/Transceiver52M/USRPDevice.cpp +++ b/Transceiver52M/USRPDevice.cpp @@ -75,7 +75,7 @@ USRPDevice::USRPDevice (double _desiredSampleRate, bool skipRx) #endif } -bool USRPDevice::open() +bool USRPDevice::open(const std::string &) { writeLock.unlock(); diff --git a/Transceiver52M/USRPDevice.h b/Transceiver52M/USRPDevice.h index 700f1ca..b88afcb 100644 --- a/Transceiver52M/USRPDevice.h +++ b/Transceiver52M/USRPDevice.h @@ -115,7 +115,7 @@ private: USRPDevice (double _desiredSampleRate, bool skipRx); /** Instantiate the USRP */ - bool open(); + bool open(const std::string &); /** Start the USRP */ bool start(); diff --git a/Transceiver52M/USRPping.cpp b/Transceiver52M/USRPping.cpp index 62f7de6..9c09e2a 100644 --- a/Transceiver52M/USRPping.cpp +++ b/Transceiver52M/USRPping.cpp @@ -43,7 +43,7 @@ int main(int argc, char *argv[]) { RadioDevice *usrp = RadioDevice::make(52.0e6/192.0); - usrp->open(); + usrp->open(""); TIMESTAMP timestamp; diff --git a/Transceiver52M/radioDevice.h b/Transceiver52M/radioDevice.h index 47012a1..f7dcb03 100644 --- a/Transceiver52M/radioDevice.h +++ b/Transceiver52M/radioDevice.h @@ -15,6 +15,7 @@ #ifndef __RADIO_DEVICE_H__ #define __RADIO_DEVICE_H__ +#include <string> #ifdef HAVE_CONFIG_H #include "config.h" @@ -33,7 +34,7 @@ class RadioDevice { static RadioDevice *make(double desiredSampleRate, bool skipRx = false); /** Initialize the USRP */ - virtual bool open()=0; + virtual bool open(const std::string &args)=0; /** Start the USRP */ virtual bool start()=0; diff --git a/Transceiver52M/runTransceiver.cpp b/Transceiver52M/runTransceiver.cpp index 1b8df36..b95c28e 100644 --- a/Transceiver52M/runTransceiver.cpp +++ b/Transceiver52M/runTransceiver.cpp @@ -57,6 +57,17 @@ static void ctrlCHandler(int signo) int main(int argc, char *argv[]) { + std::string deviceArgs; + + if (argc == 3) + { + deviceArgs = std::string(argv[2]); + } + else + { + deviceArgs = ""; + } + if ( signal( SIGINT, ctrlCHandler ) == SIG_ERR ) { cerr << "Couldn't install signal handler for SIGINT" << endl; @@ -79,7 +90,7 @@ int main(int argc, char *argv[]) int mOversamplingRate = numARFCN/2 + numARFCN; RadioDevice *usrp = RadioDevice::make(DEVICERATE); - if (!usrp->open()) { + if (!usrp->open(deviceArgs)) { LOG(ALERT) << "Transceiver exiting..." << std::endl; return EXIT_FAILURE; } |