From a1bbd2b44b311dd741ab6349b1c13b263f5436ba Mon Sep 17 00:00:00 2001 From: Bastian Bloessl Date: Mon, 19 Jul 2021 09:36:07 +0200 Subject: [PATCH] python bindings --- python/bindings/CMakeLists.txt | 14 ++- python/bindings/burst_tagger_python.cc | 61 +++++++++ python/bindings/channel_model_python.cc | 117 ++++++++++++++++++ .../docstrings/burst_tagger_pydoc_template.h | 27 ++++ .../docstrings/channel_model_pydoc_template.h | 54 ++++++++ .../packet_dropper_pydoc_template.h | 27 ++++ .../docstrings/packet_pad2_pydoc_template.h | 27 ++++ .../docstrings/packet_pad_pydoc_template.h | 27 ++++ .../pad_tagged_stream_pydoc_template.h | 27 ++++ .../periodic_msg_source_pydoc_template.h | 51 ++++++++ ...andom_periodic_msg_source_pydoc_template.h | 51 ++++++++ .../docstrings/rtt_measure_pydoc_template.h | 27 ++++ .../wireshark_connector_pydoc_template.h | 27 ++++ python/bindings/packet_dropper_python.cc | 61 +++++++++ python/bindings/packet_pad2_python.cc | 64 ++++++++++ python/bindings/packet_pad_python.cc | 64 ++++++++++ python/bindings/pad_tagged_stream_python.cc | 61 +++++++++ python/bindings/periodic_msg_source_python.cc | 108 ++++++++++++++++ python/bindings/python_bindings.cc | 21 +++- .../random_periodic_msg_source_python.cc | 109 ++++++++++++++++ python/bindings/rtt_measure_python.cc | 60 +++++++++ python/bindings/wireshark_connector_python.cc | 68 ++++++++++ 22 files changed, 1151 insertions(+), 2 deletions(-) create mode 100644 python/bindings/burst_tagger_python.cc create mode 100644 python/bindings/channel_model_python.cc create mode 100644 python/bindings/docstrings/burst_tagger_pydoc_template.h create mode 100644 python/bindings/docstrings/channel_model_pydoc_template.h create mode 100644 python/bindings/docstrings/packet_dropper_pydoc_template.h create mode 100644 python/bindings/docstrings/packet_pad2_pydoc_template.h create mode 100644 python/bindings/docstrings/packet_pad_pydoc_template.h create mode 100644 python/bindings/docstrings/pad_tagged_stream_pydoc_template.h create mode 100644 python/bindings/docstrings/periodic_msg_source_pydoc_template.h create mode 100644 python/bindings/docstrings/random_periodic_msg_source_pydoc_template.h create mode 100644 python/bindings/docstrings/rtt_measure_pydoc_template.h create mode 100644 python/bindings/docstrings/wireshark_connector_pydoc_template.h create mode 100644 python/bindings/packet_dropper_python.cc create mode 100644 python/bindings/packet_pad2_python.cc create mode 100644 python/bindings/packet_pad_python.cc create mode 100644 python/bindings/pad_tagged_stream_python.cc create mode 100644 python/bindings/periodic_msg_source_python.cc create mode 100644 python/bindings/random_periodic_msg_source_python.cc create mode 100644 python/bindings/rtt_measure_python.cc create mode 100644 python/bindings/wireshark_connector_python.cc diff --git a/python/bindings/CMakeLists.txt b/python/bindings/CMakeLists.txt index bbf78da..9203ce6 100644 --- a/python/bindings/CMakeLists.txt +++ b/python/bindings/CMakeLists.txt @@ -29,7 +29,19 @@ include(GrPybind) ######################################################################## list(APPEND foo_python_files - python_bindings.cc) + python_bindings.cc + + burst_tagger_python.cc + channel_model_python.cc + packet_dropper_python.cc + packet_pad2_python.cc + packet_pad_python.cc + pad_tagged_stream_python.cc + periodic_msg_source_python.cc + random_periodic_msg_source_python.cc + rtt_measure_python.cc + wireshark_connector_python.cc + ) GR_PYBIND_MAKE_OOT(foo ../.. diff --git a/python/bindings/burst_tagger_python.cc b/python/bindings/burst_tagger_python.cc new file mode 100644 index 0000000..dca4bcf --- /dev/null +++ b/python/bindings/burst_tagger_python.cc @@ -0,0 +1,61 @@ +/* + * Copyright 2021 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 and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(burst_tagger.h) */ +/* BINDTOOL_HEADER_FILE_HASH(c99561501264e56677e8f0631b47434d) */ +/***********************************************************************************/ + +#include +#include +#include + +namespace py = pybind11; + +#include +// pydoc.h is automatically generated in the build directory +#include + +void bind_burst_tagger(py::module& m) +{ + + using burst_tagger = ::gr::foo::burst_tagger; + + + py::class_>(m, "burst_tagger", D(burst_tagger)) + + .def(py::init(&burst_tagger::make), + py::arg("tag_name"), + py::arg("mult"), + D(burst_tagger,make) + ) + + + + + ; + + + + +} + + + + + + + + diff --git a/python/bindings/channel_model_python.cc b/python/bindings/channel_model_python.cc new file mode 100644 index 0000000..c5f57e0 --- /dev/null +++ b/python/bindings/channel_model_python.cc @@ -0,0 +1,117 @@ +/* + * Copyright 2021 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 and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(channel_model.h) */ +/* BINDTOOL_HEADER_FILE_HASH(2d1fbde4f2f01f74496f71008f2acb85) */ +/***********************************************************************************/ + +#include +#include +#include + +namespace py = pybind11; + +#include +// pydoc.h is automatically generated in the build directory +#include + +void bind_channel_model(py::module& m) +{ + + using channel_model = ::gr::foo::channel_model; + + + py::class_>(m, "channel_model", D(channel_model)) + + .def(py::init(&channel_model::make), + py::arg("noise_voltage") = 0., + py::arg("frequency_offset") = 0., + py::arg("epsilon") = 1., + py::arg("taps") = std::vector(1, 1), + py::arg("noise_seed") = 0, + py::arg("block_tags") = false, + D(channel_model,make) + ) + + + + + + + .def("set_noise_voltage",&channel_model::set_noise_voltage, + py::arg("noise_voltage"), + D(channel_model,set_noise_voltage) + ) + + + + .def("set_frequency_offset",&channel_model::set_frequency_offset, + py::arg("frequency_offset"), + D(channel_model,set_frequency_offset) + ) + + + + .def("set_taps",&channel_model::set_taps, + py::arg("taps"), + D(channel_model,set_taps) + ) + + + + .def("set_timing_offset",&channel_model::set_timing_offset, + py::arg("epsilon"), + D(channel_model,set_timing_offset) + ) + + + + .def("noise_voltage",&channel_model::noise_voltage, + D(channel_model,noise_voltage) + ) + + + + .def("frequency_offset",&channel_model::frequency_offset, + D(channel_model,frequency_offset) + ) + + + + .def("taps",&channel_model::taps, + D(channel_model,taps) + ) + + + + .def("timing_offset",&channel_model::timing_offset, + D(channel_model,timing_offset) + ) + + ; + + + + +} + + + + + + + + diff --git a/python/bindings/docstrings/burst_tagger_pydoc_template.h b/python/bindings/docstrings/burst_tagger_pydoc_template.h new file mode 100644 index 0000000..3ce11ae --- /dev/null +++ b/python/bindings/docstrings/burst_tagger_pydoc_template.h @@ -0,0 +1,27 @@ +/* + * Copyright 2021 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr,foo, __VA_ARGS__ ) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + + + static const char *__doc_gr_foo_burst_tagger = R"doc()doc"; + + + static const char *__doc_gr_foo_burst_tagger_burst_tagger = R"doc()doc"; + + + static const char *__doc_gr_foo_burst_tagger_make = R"doc()doc"; + + diff --git a/python/bindings/docstrings/channel_model_pydoc_template.h b/python/bindings/docstrings/channel_model_pydoc_template.h new file mode 100644 index 0000000..c84d259 --- /dev/null +++ b/python/bindings/docstrings/channel_model_pydoc_template.h @@ -0,0 +1,54 @@ +/* + * Copyright 2021 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr,foo, __VA_ARGS__ ) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + + + static const char *__doc_gr_foo_channel_model = R"doc()doc"; + + + static const char *__doc_gr_foo_channel_model_channel_model_0 = R"doc()doc"; + + + static const char *__doc_gr_foo_channel_model_channel_model_1 = R"doc()doc"; + + + static const char *__doc_gr_foo_channel_model_make = R"doc()doc"; + + + static const char *__doc_gr_foo_channel_model_set_noise_voltage = R"doc()doc"; + + + static const char *__doc_gr_foo_channel_model_set_frequency_offset = R"doc()doc"; + + + static const char *__doc_gr_foo_channel_model_set_taps = R"doc()doc"; + + + static const char *__doc_gr_foo_channel_model_set_timing_offset = R"doc()doc"; + + + static const char *__doc_gr_foo_channel_model_noise_voltage = R"doc()doc"; + + + static const char *__doc_gr_foo_channel_model_frequency_offset = R"doc()doc"; + + + static const char *__doc_gr_foo_channel_model_taps = R"doc()doc"; + + + static const char *__doc_gr_foo_channel_model_timing_offset = R"doc()doc"; + + diff --git a/python/bindings/docstrings/packet_dropper_pydoc_template.h b/python/bindings/docstrings/packet_dropper_pydoc_template.h new file mode 100644 index 0000000..36990bc --- /dev/null +++ b/python/bindings/docstrings/packet_dropper_pydoc_template.h @@ -0,0 +1,27 @@ +/* + * Copyright 2021 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr,foo, __VA_ARGS__ ) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + + + static const char *__doc_gr_foo_packet_dropper = R"doc()doc"; + + + static const char *__doc_gr_foo_packet_dropper_packet_dropper = R"doc()doc"; + + + static const char *__doc_gr_foo_packet_dropper_make = R"doc()doc"; + + diff --git a/python/bindings/docstrings/packet_pad2_pydoc_template.h b/python/bindings/docstrings/packet_pad2_pydoc_template.h new file mode 100644 index 0000000..77303e3 --- /dev/null +++ b/python/bindings/docstrings/packet_pad2_pydoc_template.h @@ -0,0 +1,27 @@ +/* + * Copyright 2021 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr,foo, __VA_ARGS__ ) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + + + static const char *__doc_gr_foo_packet_pad2 = R"doc()doc"; + + + static const char *__doc_gr_foo_packet_pad2_packet_pad2 = R"doc()doc"; + + + static const char *__doc_gr_foo_packet_pad2_make = R"doc()doc"; + + diff --git a/python/bindings/docstrings/packet_pad_pydoc_template.h b/python/bindings/docstrings/packet_pad_pydoc_template.h new file mode 100644 index 0000000..8a62bf7 --- /dev/null +++ b/python/bindings/docstrings/packet_pad_pydoc_template.h @@ -0,0 +1,27 @@ +/* + * Copyright 2021 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr,foo, __VA_ARGS__ ) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + + + static const char *__doc_gr_foo_packet_pad = R"doc()doc"; + + + static const char *__doc_gr_foo_packet_pad_packet_pad = R"doc()doc"; + + + static const char *__doc_gr_foo_packet_pad_make = R"doc()doc"; + + diff --git a/python/bindings/docstrings/pad_tagged_stream_pydoc_template.h b/python/bindings/docstrings/pad_tagged_stream_pydoc_template.h new file mode 100644 index 0000000..ff603aa --- /dev/null +++ b/python/bindings/docstrings/pad_tagged_stream_pydoc_template.h @@ -0,0 +1,27 @@ +/* + * Copyright 2021 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr,foo, __VA_ARGS__ ) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + + + static const char *__doc_gr_foo_pad_tagged_stream = R"doc()doc"; + + + static const char *__doc_gr_foo_pad_tagged_stream_pad_tagged_stream = R"doc()doc"; + + + static const char *__doc_gr_foo_pad_tagged_stream_make = R"doc()doc"; + + diff --git a/python/bindings/docstrings/periodic_msg_source_pydoc_template.h b/python/bindings/docstrings/periodic_msg_source_pydoc_template.h new file mode 100644 index 0000000..575ed48 --- /dev/null +++ b/python/bindings/docstrings/periodic_msg_source_pydoc_template.h @@ -0,0 +1,51 @@ +/* + * Copyright 2021 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr,foo, __VA_ARGS__ ) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + + + static const char *__doc_gr_foo_periodic_msg_source = R"doc()doc"; + + + static const char *__doc_gr_foo_periodic_msg_source_periodic_msg_source_0 = R"doc()doc"; + + + static const char *__doc_gr_foo_periodic_msg_source_periodic_msg_source_1 = R"doc()doc"; + + + static const char *__doc_gr_foo_periodic_msg_source_make = R"doc()doc"; + + + static const char *__doc_gr_foo_periodic_msg_source_set_nmsg = R"doc()doc"; + + + static const char *__doc_gr_foo_periodic_msg_source_get_nmsg = R"doc()doc"; + + + static const char *__doc_gr_foo_periodic_msg_source_set_delay = R"doc()doc"; + + + static const char *__doc_gr_foo_periodic_msg_source_get_delay = R"doc()doc"; + + + static const char *__doc_gr_foo_periodic_msg_source_start_tx = R"doc()doc"; + + + static const char *__doc_gr_foo_periodic_msg_source_stop_tx = R"doc()doc"; + + + static const char *__doc_gr_foo_periodic_msg_source_is_running = R"doc()doc"; + + diff --git a/python/bindings/docstrings/random_periodic_msg_source_pydoc_template.h b/python/bindings/docstrings/random_periodic_msg_source_pydoc_template.h new file mode 100644 index 0000000..f64f99f --- /dev/null +++ b/python/bindings/docstrings/random_periodic_msg_source_pydoc_template.h @@ -0,0 +1,51 @@ +/* + * Copyright 2021 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr,foo, __VA_ARGS__ ) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + + + static const char *__doc_gr_foo_random_periodic_msg_source = R"doc()doc"; + + + static const char *__doc_gr_foo_random_periodic_msg_source_random_periodic_msg_source_0 = R"doc()doc"; + + + static const char *__doc_gr_foo_random_periodic_msg_source_random_periodic_msg_source_1 = R"doc()doc"; + + + static const char *__doc_gr_foo_random_periodic_msg_source_make = R"doc()doc"; + + + static const char *__doc_gr_foo_random_periodic_msg_source_set_nmsg = R"doc()doc"; + + + static const char *__doc_gr_foo_random_periodic_msg_source_get_nmsg = R"doc()doc"; + + + static const char *__doc_gr_foo_random_periodic_msg_source_set_delay = R"doc()doc"; + + + static const char *__doc_gr_foo_random_periodic_msg_source_get_delay = R"doc()doc"; + + + static const char *__doc_gr_foo_random_periodic_msg_source_start_tx = R"doc()doc"; + + + static const char *__doc_gr_foo_random_periodic_msg_source_stop_tx = R"doc()doc"; + + + static const char *__doc_gr_foo_random_periodic_msg_source_is_running = R"doc()doc"; + + diff --git a/python/bindings/docstrings/rtt_measure_pydoc_template.h b/python/bindings/docstrings/rtt_measure_pydoc_template.h new file mode 100644 index 0000000..b0cfbef --- /dev/null +++ b/python/bindings/docstrings/rtt_measure_pydoc_template.h @@ -0,0 +1,27 @@ +/* + * Copyright 2021 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr,foo, __VA_ARGS__ ) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + + + static const char *__doc_gr_foo_rtt_measure = R"doc()doc"; + + + static const char *__doc_gr_foo_rtt_measure_rtt_measure = R"doc()doc"; + + + static const char *__doc_gr_foo_rtt_measure_make = R"doc()doc"; + + diff --git a/python/bindings/docstrings/wireshark_connector_pydoc_template.h b/python/bindings/docstrings/wireshark_connector_pydoc_template.h new file mode 100644 index 0000000..0ffe355 --- /dev/null +++ b/python/bindings/docstrings/wireshark_connector_pydoc_template.h @@ -0,0 +1,27 @@ +/* + * Copyright 2021 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr,foo, __VA_ARGS__ ) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + + + static const char *__doc_gr_foo_wireshark_connector = R"doc()doc"; + + + static const char *__doc_gr_foo_wireshark_connector_wireshark_connector = R"doc()doc"; + + + static const char *__doc_gr_foo_wireshark_connector_make = R"doc()doc"; + + diff --git a/python/bindings/packet_dropper_python.cc b/python/bindings/packet_dropper_python.cc new file mode 100644 index 0000000..0fac18f --- /dev/null +++ b/python/bindings/packet_dropper_python.cc @@ -0,0 +1,61 @@ +/* + * Copyright 2021 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 and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(packet_dropper.h) */ +/* BINDTOOL_HEADER_FILE_HASH(c324ec3cc59fd3973f47d4c8193587cb) */ +/***********************************************************************************/ + +#include +#include +#include + +namespace py = pybind11; + +#include +// pydoc.h is automatically generated in the build directory +#include + +void bind_packet_dropper(py::module& m) +{ + + using packet_dropper = ::gr::foo::packet_dropper; + + + py::class_>(m, "packet_dropper", D(packet_dropper)) + + .def(py::init(&packet_dropper::make), + py::arg("drop_rate"), + py::arg("seed"), + D(packet_dropper,make) + ) + + + + + ; + + + + +} + + + + + + + + diff --git a/python/bindings/packet_pad2_python.cc b/python/bindings/packet_pad2_python.cc new file mode 100644 index 0000000..cfb81c5 --- /dev/null +++ b/python/bindings/packet_pad2_python.cc @@ -0,0 +1,64 @@ +/* + * Copyright 2021 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 and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(packet_pad2.h) */ +/* BINDTOOL_HEADER_FILE_HASH(b2e434a4d5f7a750e8183bd819862469) */ +/***********************************************************************************/ + +#include +#include +#include + +namespace py = pybind11; + +#include +// pydoc.h is automatically generated in the build directory +#include + +void bind_packet_pad2(py::module& m) +{ + + using packet_pad2 = ::gr::foo::packet_pad2; + + + py::class_>(m, "packet_pad2", D(packet_pad2)) + + .def(py::init(&packet_pad2::make), + py::arg("debug") = false, + py::arg("delay") = false, + py::arg("delay_sec") = 0.01, + py::arg("pad_front") = 0, + py::arg("pad_tail") = 0, + D(packet_pad2,make) + ) + + + + + ; + + + + +} + + + + + + + + diff --git a/python/bindings/packet_pad_python.cc b/python/bindings/packet_pad_python.cc new file mode 100644 index 0000000..b0b44f4 --- /dev/null +++ b/python/bindings/packet_pad_python.cc @@ -0,0 +1,64 @@ +/* + * Copyright 2021 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 and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(packet_pad.h) */ +/* BINDTOOL_HEADER_FILE_HASH(80e623b2c0e35d7918618f96aff3c11c) */ +/***********************************************************************************/ + +#include +#include +#include + +namespace py = pybind11; + +#include +// pydoc.h is automatically generated in the build directory +#include + +void bind_packet_pad(py::module& m) +{ + + using packet_pad = ::gr::foo::packet_pad; + + + py::class_>(m, "packet_pad", D(packet_pad)) + + .def(py::init(&packet_pad::make), + py::arg("debug") = false, + py::arg("delay") = false, + py::arg("delay_sec") = 0.01, + py::arg("pad_front") = 0, + py::arg("pad_tail") = 0, + D(packet_pad,make) + ) + + + + + ; + + + + +} + + + + + + + + diff --git a/python/bindings/pad_tagged_stream_python.cc b/python/bindings/pad_tagged_stream_python.cc new file mode 100644 index 0000000..0a73e4a --- /dev/null +++ b/python/bindings/pad_tagged_stream_python.cc @@ -0,0 +1,61 @@ +/* + * Copyright 2021 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 and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(pad_tagged_stream.h) */ +/* BINDTOOL_HEADER_FILE_HASH(7a558a15cd1883b28237a8c9f3d5419f) */ +/***********************************************************************************/ + +#include +#include +#include + +namespace py = pybind11; + +#include +// pydoc.h is automatically generated in the build directory +#include + +void bind_pad_tagged_stream(py::module& m) +{ + + using pad_tagged_stream = ::gr::foo::pad_tagged_stream; + + + py::class_>(m, "pad_tagged_stream", D(pad_tagged_stream)) + + .def(py::init(&pad_tagged_stream::make), + py::arg("buffer_size"), + py::arg("len_tag_name"), + D(pad_tagged_stream,make) + ) + + + + + ; + + + + +} + + + + + + + + diff --git a/python/bindings/periodic_msg_source_python.cc b/python/bindings/periodic_msg_source_python.cc new file mode 100644 index 0000000..7b513f4 --- /dev/null +++ b/python/bindings/periodic_msg_source_python.cc @@ -0,0 +1,108 @@ +/* + * Copyright 2021 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 and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(periodic_msg_source.h) */ +/* BINDTOOL_HEADER_FILE_HASH(3aa9b26f640e6e96cbfa5450af8f4ac7) */ +/***********************************************************************************/ + +#include +#include +#include + +namespace py = pybind11; + +#include +// pydoc.h is automatically generated in the build directory +#include + +void bind_periodic_msg_source(py::module& m) +{ + + using periodic_msg_source = ::gr::foo::periodic_msg_source; + + + py::class_>(m, "periodic_msg_source", D(periodic_msg_source)) + + .def(py::init(&periodic_msg_source::make), + py::arg("msg"), + py::arg("interval"), + py::arg("num_msg") = -1, + py::arg("quit") = true, + py::arg("debug") = false, + D(periodic_msg_source,make) + ) + + + + + + + .def("set_nmsg",&periodic_msg_source::set_nmsg, + py::arg("nmsg"), + D(periodic_msg_source,set_nmsg) + ) + + + + .def("get_nmsg",&periodic_msg_source::get_nmsg, + D(periodic_msg_source,get_nmsg) + ) + + + + .def("set_delay",&periodic_msg_source::set_delay, + py::arg("delay"), + D(periodic_msg_source,set_delay) + ) + + + + .def("get_delay",&periodic_msg_source::get_delay, + D(periodic_msg_source,get_delay) + ) + + + + .def("start_tx",&periodic_msg_source::start_tx, + D(periodic_msg_source,start_tx) + ) + + + + .def("stop_tx",&periodic_msg_source::stop_tx, + D(periodic_msg_source,stop_tx) + ) + + + + .def("is_running",&periodic_msg_source::is_running, + D(periodic_msg_source,is_running) + ) + + ; + + + + +} + + + + + + + + diff --git a/python/bindings/python_bindings.cc b/python/bindings/python_bindings.cc index 1653abd..fce529c 100644 --- a/python/bindings/python_bindings.cc +++ b/python/bindings/python_bindings.cc @@ -21,9 +21,18 @@ namespace py = pybind11; // Please do not delete /**************************************/ // BINDING_FUNCTION_PROTOTYPES( +void bind_burst_tagger(py::module& m); +void bind_channel_model(py::module& m); +void bind_packet_dropper(py::module& m); +void bind_packet_pad2(py::module& m); +void bind_packet_pad(py::module& m); +void bind_pad_tagged_stream(py::module& m); +void bind_periodic_msg_source(py::module& m); +void bind_random_periodic_msg_source(py::module& m); +void bind_rtt_measure(py::module& m); +void bind_wireshark_connector(py::module& m); // ) END BINDING_FUNCTION_PROTOTYPES - // We need this hack because import_array() returns NULL // for newer Python versions. // This function is also necessary because it ensures access to the C API @@ -49,5 +58,15 @@ PYBIND11_MODULE(foo_python, m) // Please do not delete /**************************************/ // BINDING_FUNCTION_CALLS( + bind_burst_tagger(m); + bind_channel_model(m); + bind_packet_dropper(m); + bind_packet_pad2(m); + bind_packet_pad(m); + bind_pad_tagged_stream(m); + bind_periodic_msg_source(m); + bind_random_periodic_msg_source(m); + bind_rtt_measure(m); + bind_wireshark_connector(m); // ) END BINDING_FUNCTION_CALLS } diff --git a/python/bindings/random_periodic_msg_source_python.cc b/python/bindings/random_periodic_msg_source_python.cc new file mode 100644 index 0000000..be70bcf --- /dev/null +++ b/python/bindings/random_periodic_msg_source_python.cc @@ -0,0 +1,109 @@ +/* + * Copyright 2021 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 and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(random_periodic_msg_source.h) */ +/* BINDTOOL_HEADER_FILE_HASH(0a96820144211e87383cb24fd175ffdf) */ +/***********************************************************************************/ + +#include +#include +#include + +namespace py = pybind11; + +#include +// pydoc.h is automatically generated in the build directory +#include + +void bind_random_periodic_msg_source(py::module& m) +{ + + using random_periodic_msg_source = ::gr::foo::random_periodic_msg_source; + + + py::class_>(m, "random_periodic_msg_source", D(random_periodic_msg_source)) + + .def(py::init(&random_periodic_msg_source::make), + py::arg("msg_len"), + py::arg("interval"), + py::arg("num_msg") = 1, + py::arg("quit") = true, + py::arg("debug") = false, + py::arg("seed") = 0, + D(random_periodic_msg_source,make) + ) + + + + + + + .def("set_nmsg",&random_periodic_msg_source::set_nmsg, + py::arg("nmsg"), + D(random_periodic_msg_source,set_nmsg) + ) + + + + .def("get_nmsg",&random_periodic_msg_source::get_nmsg, + D(random_periodic_msg_source,get_nmsg) + ) + + + + .def("set_delay",&random_periodic_msg_source::set_delay, + py::arg("delay"), + D(random_periodic_msg_source,set_delay) + ) + + + + .def("get_delay",&random_periodic_msg_source::get_delay, + D(random_periodic_msg_source,get_delay) + ) + + + + .def("start_tx",&random_periodic_msg_source::start_tx, + D(random_periodic_msg_source,start_tx) + ) + + + + .def("stop_tx",&random_periodic_msg_source::stop_tx, + D(random_periodic_msg_source,stop_tx) + ) + + + + .def("is_running",&random_periodic_msg_source::is_running, + D(random_periodic_msg_source,is_running) + ) + + ; + + + + +} + + + + + + + + diff --git a/python/bindings/rtt_measure_python.cc b/python/bindings/rtt_measure_python.cc new file mode 100644 index 0000000..d3d2d79 --- /dev/null +++ b/python/bindings/rtt_measure_python.cc @@ -0,0 +1,60 @@ +/* + * Copyright 2021 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 and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(rtt_measure.h) */ +/* BINDTOOL_HEADER_FILE_HASH(30ed3e91a71527c380abe7384d62fcea) */ +/***********************************************************************************/ + +#include +#include +#include + +namespace py = pybind11; + +#include +// pydoc.h is automatically generated in the build directory +#include + +void bind_rtt_measure(py::module& m) +{ + + using rtt_measure = ::gr::foo::rtt_measure; + + + py::class_>(m, "rtt_measure", D(rtt_measure)) + + .def(py::init(&rtt_measure::make), + py::arg("interval"), + D(rtt_measure,make) + ) + + + + + ; + + + + +} + + + + + + + + diff --git a/python/bindings/wireshark_connector_python.cc b/python/bindings/wireshark_connector_python.cc new file mode 100644 index 0000000..b269e8a --- /dev/null +++ b/python/bindings/wireshark_connector_python.cc @@ -0,0 +1,68 @@ +/* + * Copyright 2021 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 and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(wireshark_connector.h) */ +/* BINDTOOL_HEADER_FILE_HASH(10414a436e555bc27b41e65120989433) */ +/***********************************************************************************/ + +#include +#include +#include + +namespace py = pybind11; + +#include +// pydoc.h is automatically generated in the build directory +#include + +void bind_wireshark_connector(py::module& m) +{ + + using wireshark_connector = ::gr::foo::wireshark_connector; + + + py::class_>(m, "wireshark_connector", D(wireshark_connector)) + + .def(py::init(&wireshark_connector::make), + py::arg("type"), + py::arg("debug") = false, + D(wireshark_connector,make) + ) + + + + + ; + + py::enum_<::gr::foo::LinkType>(m,"LinkType") + .value("WIFI", ::gr::foo::WIFI) // 127 + .value("ZIGBEE", ::gr::foo::ZIGBEE) // 195 + .export_values() + ; + + py::implicitly_convertible(); + + + +} + + + + + + + +