Adds usrp2.sink_32fc, usrp2.sink_16sc, refactoring, cleanup
[debian/gnuradio] / gr-usrp2 / src / usrp2_base.cc
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2008 Free Software Foundation, Inc.
4  * 
5  * This file is part of GNU Radio
6  * 
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  * 
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING.  If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22
23 #ifdef HAVE_CONFIG_H
24 #include "config.h"
25 #endif
26
27 #include <usrp2_base.h>
28 #include <gr_io_signature.h>
29 #include <iostream>
30
31 usrp2_base::usrp2_base(const char *name,
32                        gr_io_signature_sptr input_signature,
33                        gr_io_signature_sptr output_signature,
34                        const std::string &ifc,
35                        const std::string &mac) 
36   throw (std::runtime_error)
37   : gr_sync_block(name,
38                   input_signature,
39                   output_signature),
40     d_u2(usrp2::usrp2::sptr())
41 {
42   d_u2 = usrp2::usrp2::make(ifc, mac);
43   if (!d_u2)
44     throw std::runtime_error("Unable to initialize USRP2!");
45 }
46
47 usrp2_base::~usrp2_base ()
48 {
49   // NOP
50 }
51
52 std::string
53 usrp2_base::mac_addr() const
54 {
55   return d_u2->mac_addr();
56 }
57
58 bool
59 usrp2_base::start()
60 {
61   // Default implementation is NOP
62   return true;
63 }
64
65 bool
66 usrp2_base::stop()
67 {
68   // Default implementation is NOP
69   return true;
70 }