commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r9453 - gnuradio/branches/features/gr-usrp2/gr-usrp2/s


From: eb
Subject: [Commit-gnuradio] r9453 - gnuradio/branches/features/gr-usrp2/gr-usrp2/src
Date: Fri, 29 Aug 2008 18:58:33 -0600 (MDT)

Author: eb
Date: 2008-08-29 18:58:33 -0600 (Fri, 29 Aug 2008)
New Revision: 9453

Modified:
   gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2.i
   gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_source_32fc.cc
   gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_source_32fc.h
Log:
pythonic interface for set_center_freq

Modified: gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2.i
===================================================================
--- gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2.i    2008-08-29 
23:11:08 UTC (rev 9452)
+++ gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2.i    2008-08-30 
00:58:33 UTC (rev 9453)
@@ -31,6 +31,8 @@
 #include "usrp2_source_32fc.h"
 %}
 
+%include <usrp2/tune_result.h>
+
 #if 0
 // ----------------------------------------------------------------
 
@@ -84,19 +86,35 @@
 
 usrp2_source_32fc_sptr
 usrp2_make_source_32fc(const std::string &ifc="eth0",
-                   const std::string &mac="") 
+                      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);
+                   const std::string &mac);
 
 public:
   ~usrp2_source_32fc();
 
   bool set_gain(double gain);
-  //bool set_center_freq(double frequency, usrp2::tune_result r);
+  %rename(_real_set_center_freq) set_center_freq;
+  bool set_center_freq(double frequency, usrp2::tune_result *r);
   bool set_decim(int decimation_factor);
 };
+
+// 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
+
+%}

Modified: gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_source_32fc.cc
===================================================================
--- gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_source_32fc.cc       
2008-08-29 23:11:08 UTC (rev 9452)
+++ gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_source_32fc.cc       
2008-08-30 00:58:33 UTC (rev 9453)
@@ -36,7 +36,7 @@
 }
 
 usrp2_source_32fc::usrp2_source_32fc(const std::string &interface,
-                              const std::string &mac_addr) 
+                                    const std::string &mac_addr) 
   throw (std::runtime_error)
   : usrp2_source_base("usrp2_source_32fc",
                      gr_make_io_signature(1, 1, sizeof(gr_complex)),

Modified: gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_source_32fc.h
===================================================================
--- gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_source_32fc.h        
2008-08-29 23:11:08 UTC (rev 9452)
+++ gnuradio/branches/features/gr-usrp2/gr-usrp2/src/usrp2_source_32fc.h        
2008-08-30 00:58:33 UTC (rev 9453)
@@ -30,7 +30,7 @@
 
 usrp2_source_32fc_sptr
 usrp2_make_source_32fc(const std::string &ifc="eth0",
-                   const std::string &mac="") 
+                      const std::string &mac="")
   throw (std::runtime_error);
 
 class usrp2_source_32fc : public usrp2_source_base {
@@ -38,11 +38,11 @@
 private:
   friend usrp2_source_32fc_sptr
   usrp2_make_source_32fc(const std::string &ifc,
-                     const std::string &mac) throw (std::runtime_error);
+                        const std::string &mac) throw (std::runtime_error);
   
 protected:
   usrp2_source_32fc(const std::string &ifc="eth0",
-                const std::string &mac="") throw (std::runtime_error);
+                   const std::string &mac="") throw (std::runtime_error);
 
 public:
   ~usrp2_source_32fc();





reply via email to

[Prev in Thread] Current Thread [Next in Thread]