diff options
Diffstat (limited to 'gr-uhd/swig')
-rw-r--r-- | gr-uhd/swig/__init__.py | 8 | ||||
-rw-r--r-- | gr-uhd/swig/uhd_swig.i | 4 |
2 files changed, 10 insertions, 2 deletions
diff --git a/gr-uhd/swig/__init__.py b/gr-uhd/swig/__init__.py index 7ed689ec0..1f82b4a26 100644 --- a/gr-uhd/swig/__init__.py +++ b/gr-uhd/swig/__init__.py @@ -32,9 +32,13 @@ def _prepare_uhd_swig(): #Make the python tune request object inherit from float #so that it can be passed in GRC as a frequency parameter. #The type checking in GRC will accept the tune request. + #Also use kwargs to construct individual struct elements. class tune_request_t(uhd_swig.tune_request_t, float): - def __new__(self, *args): return float.__new__(self) + def __new__(self, *args, **kwargs): return float.__new__(self) def __float__(self): return self.target_freq + def __init__(self, *args, **kwargs): + super(tune_request_t, self).__init__(*args) + for key, val in kwargs.iteritems(): setattr(self, key, val) setattr(uhd_swig, 'tune_request_t', tune_request_t) #Make the python tune request object inherit from string @@ -60,7 +64,7 @@ def _prepare_uhd_swig(): if attr.endswith('_t'): setattr(uhd_swig, attr[:-2], myobj) #Cast constructor args (FIXME swig handle overloads?) - for attr in ('usrp_source', 'usrp_sink'): + for attr in ('usrp_source', 'usrp_sink', 'amsg_source'): def constructor_factory(old_constructor): def constructor_interceptor(*args, **kwargs): args = list(args) diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index 9bdb962c9..b58fe9e18 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -55,6 +55,7 @@ %{ #include <gr_uhd_usrp_source.h> #include <gr_uhd_usrp_sink.h> +#include <gr_uhd_amsg_source.h> %} //////////////////////////////////////////////////////////////////////// @@ -114,6 +115,9 @@ GR_SWIG_BLOCK_MAGIC(uhd,usrp_source) GR_SWIG_BLOCK_MAGIC(uhd,usrp_sink) %include <gr_uhd_usrp_sink.h> +GR_SWIG_BLOCK_MAGIC(uhd,amsg_source) +%include <gr_uhd_amsg_source.h> + //////////////////////////////////////////////////////////////////////// // helpful constants //////////////////////////////////////////////////////////////////////// |