From 0112d661bef0dac798858bf90eaae6d5393622d6 Mon Sep 17 00:00:00 2001
From: Josh Morman <mormjb@gmail.com>
Date: Thu, 23 Apr 2020 10:44:55 -0400
Subject: qtgui: add pybind11 bindings

---
 gr-qtgui/python/qtgui/bindings/sink_c_python.cc | 111 ++++++++++++++++++++++++
 1 file changed, 111 insertions(+)
 create mode 100644 gr-qtgui/python/qtgui/bindings/sink_c_python.cc

(limited to 'gr-qtgui/python/qtgui/bindings/sink_c_python.cc')

diff --git a/gr-qtgui/python/qtgui/bindings/sink_c_python.cc b/gr-qtgui/python/qtgui/bindings/sink_c_python.cc
new file mode 100644
index 0000000000..67efaed3db
--- /dev/null
+++ b/gr-qtgui/python/qtgui/bindings/sink_c_python.cc
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2020 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ *
+ */
+
+/* This file is automatically generated using bindtool */
+
+#include <pybind11/complex.h>
+#include <pybind11/pybind11.h>
+#include <pybind11/stl.h>
+
+namespace py = pybind11;
+
+#include <gnuradio/qtgui/utils.h>
+#include <qwt_legend.h>
+#include <qwt_painter.h>
+#include <qwt_plot.h>
+#include <qwt_plot_canvas.h>
+#include <qwt_plot_curve.h>
+#include <qwt_plot_magnifier.h>
+#include <qwt_plot_marker.h>
+#include <qwt_plot_panner.h>
+#include <qwt_plot_zoomer.h>
+#include <qwt_scale_engine.h>
+#include <qwt_scale_widget.h>
+#include <qwt_symbol.h>
+
+#include <gnuradio/qtgui/sink_c.h>
+// pydoc.h is automatically generated in the build directory
+#include <sink_c_pydoc.h>
+
+void bind_sink_c(py::module& m)
+{
+
+    using sink_c = ::gr::qtgui::sink_c;
+
+
+    py::class_<sink_c, gr::block, gr::basic_block, std::shared_ptr<sink_c>>(
+        m, "sink_c", D(sink_c))
+
+        .def(py::init(&sink_c::make),
+             py::arg("fftsize"),
+             py::arg("wintype"),
+             py::arg("fc"),
+             py::arg("bw"),
+             py::arg("name"),
+             py::arg("plotfreq"),
+             py::arg("plotwaterfall"),
+             py::arg("plottime"),
+             py::arg("plotconst"),
+             py::arg("parent") = NULL,
+             D(sink_c, make))
+
+
+        .def("exec_", &sink_c::exec_, D(sink_c, exec_))
+
+
+        .def("qwidget", &sink_c::qwidget, D(sink_c, qwidget))
+
+
+        // .def("pyqwidget",&sink_c::pyqwidget,
+        //     D(sink_c,pyqwidget)
+        // )
+        // For the sip conversion to python to work, the widget object
+        // needs to be explicitly converted to Long
+        .def(
+            "pyqwidget",
+            [](std::shared_ptr<sink_c> p) { return PyLong_AsLong(p->pyqwidget()); },
+            D(sink_c, pyqwidget))
+
+
+        .def("set_fft_size",
+             &sink_c::set_fft_size,
+             py::arg("fftsize"),
+             D(sink_c, set_fft_size))
+
+
+        .def("fft_size", &sink_c::fft_size, D(sink_c, fft_size))
+
+
+        .def("set_frequency_range",
+             &sink_c::set_frequency_range,
+             py::arg("centerfreq"),
+             py::arg("bandwidth"),
+             D(sink_c, set_frequency_range))
+
+
+        .def("set_fft_power_db",
+             &sink_c::set_fft_power_db,
+             py::arg("min"),
+             py::arg("max"),
+             D(sink_c, set_fft_power_db))
+
+
+        .def("enable_rf_freq",
+             &sink_c::enable_rf_freq,
+             py::arg("en"),
+             D(sink_c, enable_rf_freq))
+
+
+        .def("set_update_time",
+             &sink_c::set_update_time,
+             py::arg("t"),
+             D(sink_c, set_update_time))
+
+        ;
+}
-- 
cgit v1.2.3