1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
/* -*- c++ -*- */
/*
* Copyright 2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* GNU Radio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
%feature("autodoc", "1"); // generate python docstrings
%include "exception.i"
%import "gnuradio.i" // the common stuff
%{
#include <gnuradio_swig_bug_workaround.h>
//#include "usrp2_sink_32fc.h"
#include "usrp2_source_16sc.h"
#include "usrp2_source_32fc.h"
%}
%include <usrp2/tune_result.h>
#if 0
// ----------------------------------------------------------------
class usrp2_sink_base : public gr_sync_block {
protected:
usrp2_sink_base(const std::string &name,
gr_io_signature_sptr input_signature)
throw (std::runtime_error);
public:
~usrp2_sink_base();
};
// ----------------------------------------------------------------
GR_SWIG_BLOCK_MAGIC(usrp2,sink_32fc)
usrp2_sink_32fc_sptr
usrp2_make_sink_32fc() throw (std::runtime_error);
class usrp2_sink_32fc : public usrp2_sink_base {
protected:
usrp2_sink_32fc();
public:
~usrp2_sink_32fc();
};
#endif
// ----------------------------------------------------------------
class usrp2_source_base : public gr_sync_block {
protected:
usrp2_source_base(const char *name,
gr_io_signature_sptr output_signature)
throw (std::runtime_error);
public:
~usrp2_source_base();
};
// ----------------------------------------------------------------
GR_SWIG_BLOCK_MAGIC(usrp2,source_32fc)
usrp2_source_32fc_sptr
usrp2_make_source_32fc(const std::string ifc, const std::string mac)
throw (std::runtime_error);
class usrp2_source_32fc : public usrp2_source_base {
protected:
usrp2_source_32fc(const std::string &ifc, const std::string &mac);
public:
~usrp2_source_32fc();
bool set_gain(double gain);
%rename(_real_set_center_freq) set_center_freq;
bool set_center_freq(double frequency, usrp2::tune_result *r);
bool set_decim(int decimation_factor);
std::string mac_addr();
};
// ----------------------------------------------------------------
GR_SWIG_BLOCK_MAGIC(usrp2,source_16sc)
usrp2_source_16sc_sptr
usrp2_make_source_16sc(const std::string ifc, const std::string mac)
throw (std::runtime_error);
class usrp2_source_16sc : public usrp2_source_base {
protected:
usrp2_source_16sc(const std::string &ifc, const std::string &mac);
public:
~usrp2_source_16sc();
bool set_gain(double gain);
%rename(_real_set_center_freq) set_center_freq;
bool set_center_freq(double frequency, usrp2::tune_result *r);
bool set_decim(int decimation_factor);
std::string mac_addr();
};
// ----------------------------------------------------------------
// create a more pythonic interface
%pythoncode %{
def __set_center_freq(self, freq):
tr = tune_result()
r = self._real_set_center_freq(freq, tr)
if r:
return tr
else:
return None
usrp2_source_32fc_sptr.set_center_freq = __set_center_freq
usrp2_source_16sc_sptr.set_center_freq = __set_center_freq
%}
|