-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9fc5da4
commit eda5b6b
Showing
14 changed files
with
303 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
id: UTAT_HERON_variable_filter | ||
label: Variable Filter | ||
category: '[UTAT]/Utilities' | ||
|
||
templates: | ||
imports: from gnuradio import UTAT_HERON | ||
make: UTAT_HERON.variable_filter(${variable_name}) | ||
|
||
# Make one 'parameters' list entry for every parameter you want settable from the GUI. | ||
# Keys include: | ||
# * id (makes the value accessible as keyname, e.g. in the make entry) | ||
# * label (label shown in the GUI) | ||
# * dtype (e.g. int, float, complex, byte, short, xxx_vector, ...) | ||
# * default | ||
parameters: | ||
- id: variable_name | ||
label: Variable Name | ||
dtype: string | ||
default: freq | ||
#- id: ... | ||
# label: ... | ||
# dtype: ... | ||
|
||
# Make one 'inputs' list entry per input and one 'outputs' list entry per output. | ||
# Keys include: | ||
# * label (an identifier for the GUI) | ||
# * domain (optional - stream or message. Default is stream) | ||
# * dtype (e.g. int, float, complex, byte, short, xxx_vector, ...) | ||
# * vlen (optional - data stream vector length. Default is 1) | ||
# * optional (optional - set to 1 for optional inputs. Default is 0) | ||
inputs: | ||
- id: in | ||
label: in | ||
domain: message | ||
dtype: message | ||
|
||
outputs: | ||
- id: out | ||
label: out | ||
domain: message | ||
dtype: message | ||
|
||
# 'file_format' specifies the version of the GRC yml format used in the file | ||
# and should usually not be changed. | ||
file_format: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* -*- c++ -*- */ | ||
/* | ||
* Copyright 2023 University of Toronto Aerospace Team. | ||
* | ||
* SPDX-License-Identifier: GPL-3.0-or-later | ||
*/ | ||
|
||
#ifndef INCLUDED_UTAT_HERON_VARIABLE_FILTER_H | ||
#define INCLUDED_UTAT_HERON_VARIABLE_FILTER_H | ||
|
||
#include <gnuradio/UTAT_HERON/api.h> | ||
#include <gnuradio/block.h> | ||
|
||
namespace gr { | ||
namespace UTAT_HERON { | ||
|
||
/*! | ||
* \brief <+description of block+> | ||
* \ingroup UTAT_HERON | ||
* | ||
*/ | ||
class UTAT_HERON_API variable_filter : virtual public gr::block | ||
{ | ||
public: | ||
typedef std::shared_ptr<variable_filter> sptr; | ||
|
||
/*! | ||
* \brief Return a shared_ptr to a new instance of UTAT_HERON::variable_filter. | ||
* | ||
* To avoid accidental use of raw pointers, UTAT_HERON::variable_filter's | ||
* constructor is in a private implementation | ||
* class. UTAT_HERON::variable_filter::make is the public interface for | ||
* creating new instances. | ||
*/ | ||
static sptr make(const std::string& variable_name); | ||
}; | ||
|
||
} // namespace UTAT_HERON | ||
} // namespace gr | ||
|
||
#endif /* INCLUDED_UTAT_HERON_VARIABLE_FILTER_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* -*- c++ -*- */ | ||
/* | ||
* Copyright 2023 University of Toronto Aerospace Team. | ||
* | ||
* SPDX-License-Identifier: GPL-3.0-or-later | ||
*/ | ||
|
||
#include "variable_filter_impl.h" | ||
#include <gnuradio/io_signature.h> | ||
#include <functional> | ||
|
||
namespace gr { | ||
namespace UTAT_HERON { | ||
|
||
variable_filter::sptr variable_filter::make(const std::string& variable_name) | ||
{ | ||
return gnuradio::make_block_sptr<variable_filter_impl>(variable_name); | ||
} | ||
|
||
|
||
/* | ||
* The private constructor | ||
*/ | ||
variable_filter_impl::variable_filter_impl(const std::string& variable_name) | ||
: gr::block("variable_filter", | ||
gr::io_signature::make(0,0,0), | ||
gr::io_signature::make(0,0,0)) | ||
{ | ||
auto var_name = pmt::intern(variable_name); | ||
auto in_port = pmt::intern("in"); | ||
auto out_port = pmt::intern("out"); | ||
message_port_register_in(in_port); | ||
message_port_register_out(out_port); | ||
set_msg_handler(in_port, [=](const pmt::pmt_t& msg){ | ||
try{ | ||
if(pmt::eqv(var_name, pmt::car(msg))) | ||
message_port_pub(out_port, msg); | ||
}catch(pmt::wrong_type&){ | ||
d_logger->alert("bad variable message"); | ||
} | ||
}); | ||
} | ||
|
||
/* | ||
* Our virtual destructor. | ||
*/ | ||
variable_filter_impl::~variable_filter_impl() {} | ||
|
||
void variable_filter_impl::forecast(int noutput_items, | ||
gr_vector_int& ninput_items_required) | ||
{} | ||
|
||
int variable_filter_impl::general_work(int noutput_items, | ||
gr_vector_int& ninput_items, | ||
gr_vector_const_void_star& input_items, | ||
gr_vector_void_star& output_items) | ||
{ | ||
return 0; | ||
} | ||
|
||
} /* namespace UTAT_HERON */ | ||
} /* namespace gr */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* -*- c++ -*- */ | ||
/* | ||
* Copyright 2023 University of Toronto Aerospace Team. | ||
* | ||
* SPDX-License-Identifier: GPL-3.0-or-later | ||
*/ | ||
|
||
#ifndef INCLUDED_UTAT_HERON_VARIABLE_FILTER_IMPL_H | ||
#define INCLUDED_UTAT_HERON_VARIABLE_FILTER_IMPL_H | ||
|
||
#include <gnuradio/UTAT_HERON/variable_filter.h> | ||
|
||
namespace gr { | ||
namespace UTAT_HERON { | ||
|
||
class variable_filter_impl : public variable_filter | ||
{ | ||
private: | ||
|
||
public: | ||
variable_filter_impl(const std::string& variable_name); | ||
~variable_filter_impl(); | ||
|
||
// Where all the action really happens | ||
void forecast(int noutput_items, gr_vector_int& ninput_items_required); | ||
|
||
int general_work(int noutput_items, | ||
gr_vector_int& ninput_items, | ||
gr_vector_const_void_star& input_items, | ||
gr_vector_void_star& output_items); | ||
}; | ||
|
||
} // namespace UTAT_HERON | ||
} // namespace gr | ||
|
||
#endif /* INCLUDED_UTAT_HERON_VARIABLE_FILTER_IMPL_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
python/UTAT_HERON/bindings/docstrings/variable_filter_pydoc_template.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright 2023 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, UTAT_HERON, __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_UTAT_HERON_variable_filter = R"doc()doc"; | ||
|
||
|
||
static const char* __doc_gr_UTAT_HERON_variable_filter_make = R"doc()doc"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright 2023 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(variable_filter.h) */ | ||
/* BINDTOOL_HEADER_FILE_HASH(766845e61a49b7b901968168b8cc740f) */ | ||
/***********************************************************************************/ | ||
|
||
#include <pybind11/complex.h> | ||
#include <pybind11/pybind11.h> | ||
#include <pybind11/stl.h> | ||
|
||
namespace py = pybind11; | ||
|
||
#include <gnuradio/UTAT_HERON/variable_filter.h> | ||
// pydoc.h is automatically generated in the build directory | ||
#include <variable_filter_pydoc.h> | ||
|
||
void bind_variable_filter(py::module& m) | ||
{ | ||
|
||
using variable_filter = gr::UTAT_HERON::variable_filter; | ||
|
||
|
||
py::class_<variable_filter, | ||
gr::block, | ||
gr::basic_block, | ||
std::shared_ptr<variable_filter>>(m, "variable_filter", D(variable_filter)) | ||
|
||
.def(py::init(&variable_filter::make), | ||
py::arg("variable_name"), | ||
D(variable_filter, make)) | ||
|
||
|
||
; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Copyright 2023 University of Toronto Aerospace Team. | ||
# | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
# | ||
|
||
from gnuradio import gr, gr_unittest | ||
# from gnuradio import blocks | ||
try: | ||
from gnuradio.UTAT_HERON import variable_filter | ||
except ImportError: | ||
import os | ||
import sys | ||
dirname, filename = os.path.split(os.path.abspath(__file__)) | ||
sys.path.append(os.path.join(dirname, "bindings")) | ||
from gnuradio.UTAT_HERON import variable_filter | ||
|
||
class qa_variable_filter(gr_unittest.TestCase): | ||
|
||
def setUp(self): | ||
self.tb = gr.top_block() | ||
|
||
def tearDown(self): | ||
self.tb = None | ||
|
||
def test_instance(self): | ||
# FIXME: Test will fail until you pass sensible arguments to the constructor | ||
instance = variable_filter() | ||
|
||
def test_001_descriptive_test_name(self): | ||
# set up fg | ||
self.tb.run() | ||
# check data | ||
|
||
|
||
if __name__ == '__main__': | ||
gr_unittest.run(qa_variable_filter) |