From 9fff25f4e5da179ea29ff44278e0415a337870cb Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 12 Feb 2010 18:07:55 -0800 Subject: Added a templated dictionary class because its more useful than map. Made the device addrs into a string:string dict. If its all strings we dont have to change the top level caller for new product. Created shared_iovec class to manage memory for device recvs. Work on the bro/dude control protocol for usrp2. --- lib/usrp/usrp.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'lib/usrp/usrp.cpp') diff --git a/lib/usrp/usrp.cpp b/lib/usrp/usrp.cpp index c49a63d49..68b423538 100644 --- a/lib/usrp/usrp.cpp +++ b/lib/usrp/usrp.cpp @@ -16,6 +16,7 @@ // #include +#include #include #include #include @@ -32,22 +33,28 @@ static void send_raw_default(const std::vector &){ throw std::runtime_error("No callback registered for send raw"); } -static boost::asio::const_buffer recv_raw_default(void){ +static uhd::shared_iovec recv_raw_default(void){ throw std::runtime_error("No callback registered for recv raw"); } /*********************************************************************** * the usrp device wrapper **********************************************************************/ -usrp::usrp(const device_addr_t & device_addr){ +usrp::usrp(const device_addr_t &device_addr){ //set the default callbacks, the code below should replace them _send_raw_cb = boost::bind(&send_raw_default, _1); _recv_raw_cb = boost::bind(&recv_raw_default); //create mboard based on the device addr - if (device_addr.type == DEVICE_ADDR_TYPE_VIRTUAL){ + if (not device_addr.has_key("type")){ + //TODO nothing + } + else if (device_addr["type"] == "test"){ _mboards[""] = mboard::base::sptr(new mboard::test(device_addr)); } + else if (device_addr["type"] == "udp"){ + _mboards[""] = mboard::base::sptr(new mboard::usrp2(device_addr)); + } } usrp::~usrp(void){ @@ -87,6 +94,6 @@ void usrp::send_raw(const std::vector &buffs){ return _send_raw_cb(buffs); } -boost::asio::const_buffer usrp::recv_raw(void){ +uhd::shared_iovec usrp::recv_raw(void){ return _recv_raw_cb(); } -- cgit v1.2.3