diff options
author | Josh Blum <josh@joshknows.com> | 2010-01-21 15:30:34 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-01-21 15:30:34 -0800 |
commit | e3483c7451d20b7ed1d8d4865e15751f18cdef78 (patch) | |
tree | f309a95a1b0ecd3dc3295ebc71ee5ad697c9f7a8 /lib/device.cpp | |
parent | 5b42b774d9ac1e74fb2916bf58085fe19ecb6720 (diff) | |
download | uhd-e3483c7451d20b7ed1d8d4865e15751f18cdef78.tar.gz uhd-e3483c7451d20b7ed1d8d4865e15751f18cdef78.tar.bz2 uhd-e3483c7451d20b7ed1d8d4865e15751f18cdef78.zip |
Added a usrp device abstration that creates usrp mboards.
Added a usrp mboard named test, its empty for now.
Diffstat (limited to 'lib/device.cpp')
-rw-r--r-- | lib/device.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/device.cpp b/lib/device.cpp index fe655ec7a..4f942ebaf 100644 --- a/lib/device.cpp +++ b/lib/device.cpp @@ -2,20 +2,24 @@ // Copyright 2010 Ettus Research LLC // +#include <usrp_uhd/usrp/usrp.hpp> #include <usrp_uhd/device.hpp> #include <boost/format.hpp> +#include <stdexcept> using namespace usrp_uhd; -std::vector<device_addr_t> device::discover(const device_addr_t& hint){ +std::vector<device_addr_t> device::discover(const device_addr_t & hint = device_addr_t()){ std::vector<device_addr_t> device_addrs; if (hint.type == DEVICE_ADDR_TYPE_VIRTUAL){ - //TODO device_addrs.push_back(...); + //make a copy of the hint for virtual testing + device_addr_t virtual_device_addr = hint; + device_addrs.push_back(virtual_device_addr); } return device_addrs; } -device::sptr device::make(const device_addr_t& hint, size_t which){ +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){ @@ -31,10 +35,13 @@ device::sptr device::make(const device_addr_t& hint, size_t which){ )); } //create the new device with the discovered address - return sptr(new device(device_addrs.at(which))); + if (hint.type == DEVICE_ADDR_TYPE_VIRTUAL){ + return sptr(new usrp_uhd::usrp::usrp(device_addrs.at(which))); + } + throw std::runtime_error("cant make a device"); } -device::device(const device_addr_t&){ +device::device(void){ /* NOP */ } |