diff options
author | Josh Blum <josh@joshknows.com> | 2010-01-21 19:05:30 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-01-21 19:05:30 -0800 |
commit | 069a7ce0570001ea3d9512a11d238ea4d6773f1d (patch) | |
tree | cf38f9c1745d0054d8775551b1caedf5522f55b2 /lib/device.cpp | |
parent | e3483c7451d20b7ed1d8d4865e15751f18cdef78 (diff) | |
download | uhd-069a7ce0570001ea3d9512a11d238ea4d6773f1d.tar.gz uhd-069a7ce0570001ea3d9512a11d238ea4d6773f1d.tar.bz2 uhd-069a7ce0570001ea3d9512a11d238ea4d6773f1d.zip |
Added more to the mboard test and the usrp device.
Diffstat (limited to 'lib/device.cpp')
-rw-r--r-- | lib/device.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/device.cpp b/lib/device.cpp index 4f942ebaf..cd1055d76 100644 --- a/lib/device.cpp +++ b/lib/device.cpp @@ -21,12 +21,14 @@ std::vector<device_addr_t> device::discover(const device_addr_t & hint = device_ device::sptr device::make(const device_addr_t & hint, size_t which){ std::vector<device_addr_t> device_addrs = discover(hint); + //check that we found any devices if (device_addrs.size() == 0){ throw std::runtime_error(str( boost::format("No devices found for %s") % hint.to_string() )); } + //check that the which index is valid if (device_addrs.size() <= which){ throw std::runtime_error(str( @@ -34,8 +36,10 @@ device::sptr device::make(const device_addr_t & hint, size_t which){ % which % hint.to_string() )); } + //create the new device with the discovered address - if (hint.type == DEVICE_ADDR_TYPE_VIRTUAL){ + //TODO only a usrp device will be made (until others are supported) + if (true){ return sptr(new usrp_uhd::usrp::usrp(device_addrs.at(which))); } throw std::runtime_error("cant make a device"); |