From e3483c7451d20b7ed1d8d4865e15751f18cdef78 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 21 Jan 2010 15:30:34 -0800 Subject: Added a usrp device abstration that creates usrp mboards. Added a usrp mboard named test, its empty for now. --- lib/device.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'lib/device.cpp') 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 #include #include +#include using namespace usrp_uhd; -std::vector device::discover(const device_addr_t& hint){ +std::vector device::discover(const device_addr_t & hint = device_addr_t()){ std::vector 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_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 */ } -- cgit v1.2.3