diff options
author | Jacob Gilbert <jacob.gilbert@protonmail.com> | 2021-09-22 08:40:13 -0600 |
---|---|---|
committer | mormj <34754695+mormj@users.noreply.github.com> | 2021-09-22 15:58:02 -0400 |
commit | f8149c16c2d08c2debfcb913ebfec511c2fcb6da (patch) | |
tree | c9862661aac9540c1faadfbb350623b995613e86 | |
parent | 7e73e94efcea3d52e3e9402da4e0cec7364ab8d1 (diff) |
pdu: add samp_rate key
This was omitted accidentally, but is necessary in general for
correct processing of PDU data
Signed-off-by: Jacob Gilbert <jacob.gilbert@protonmail.com>
-rw-r--r-- | gnuradio-runtime/include/gnuradio/pdu.h | 1 | ||||
-rw-r--r-- | gnuradio-runtime/lib/pdu.cc | 5 | ||||
-rw-r--r-- | gnuradio-runtime/python/gnuradio/gr/bindings/docstrings/pdu_pydoc_template.h | 3 | ||||
-rw-r--r-- | gnuradio-runtime/python/gnuradio/gr/bindings/pdu_python.cc | 5 | ||||
-rw-r--r-- | gr-pdu/lib/tags_to_pdu_impl.cc | 2 |
5 files changed, 15 insertions, 1 deletions
diff --git a/gnuradio-runtime/include/gnuradio/pdu.h b/gnuradio-runtime/include/gnuradio/pdu.h index bab3564789..d94dde8bb8 100644 --- a/gnuradio-runtime/include/gnuradio/pdu.h +++ b/gnuradio-runtime/include/gnuradio/pdu.h @@ -19,6 +19,7 @@ namespace gr { namespace metadata_keys { GR_RUNTIME_API const pmt::pmt_t pdu_num(); GR_RUNTIME_API const pmt::pmt_t rx_time(); +GR_RUNTIME_API const pmt::pmt_t sample_rate(); GR_RUNTIME_API const pmt::pmt_t sys_time(); GR_RUNTIME_API const pmt::pmt_t tx_eob(); GR_RUNTIME_API const pmt::pmt_t tx_time(); diff --git a/gnuradio-runtime/lib/pdu.cc b/gnuradio-runtime/lib/pdu.cc index 79a6de6c79..0533d9d3a8 100644 --- a/gnuradio-runtime/lib/pdu.cc +++ b/gnuradio-runtime/lib/pdu.cc @@ -27,6 +27,11 @@ const pmt::pmt_t rx_time() static const pmt::pmt_t val = pmt::mp("rx_time"); return val; } +const pmt::pmt_t sample_rate() +{ + static const pmt::pmt_t val = pmt::mp("sample_rate"); + return val; +} const pmt::pmt_t sys_time() { static const pmt::pmt_t val = pmt::mp("sys_time"); diff --git a/gnuradio-runtime/python/gnuradio/gr/bindings/docstrings/pdu_pydoc_template.h b/gnuradio-runtime/python/gnuradio/gr/bindings/docstrings/pdu_pydoc_template.h index 282d505b40..2d77c4758f 100644 --- a/gnuradio-runtime/python/gnuradio/gr/bindings/docstrings/pdu_pydoc_template.h +++ b/gnuradio-runtime/python/gnuradio/gr/bindings/docstrings/pdu_pydoc_template.h @@ -21,6 +21,9 @@ static const char* __doc_gr_metadata_keys_pdu_num = R"doc()doc"; static const char* __doc_gr_metadata_keys_rx_time = R"doc()doc"; +static const char* __doc_gr_metadata_keys_sample_rate = R"doc()doc"; + + static const char* __doc_gr_metadata_keys_sys_time = R"doc()doc"; diff --git a/gnuradio-runtime/python/gnuradio/gr/bindings/pdu_python.cc b/gnuradio-runtime/python/gnuradio/gr/bindings/pdu_python.cc index 674c633ccf..256cd308d0 100644 --- a/gnuradio-runtime/python/gnuradio/gr/bindings/pdu_python.cc +++ b/gnuradio-runtime/python/gnuradio/gr/bindings/pdu_python.cc @@ -14,7 +14,7 @@ /* BINDTOOL_GEN_AUTOMATIC(0) */ /* BINDTOOL_USE_PYGCCXML(0) */ /* BINDTOOL_HEADER_FILE(pdu.h) */ -/* BINDTOOL_HEADER_FILE_HASH(6772caeddffe60c0c16148f68d21654f) */ +/* BINDTOOL_HEADER_FILE_HASH(a347d61f9dff47c4bfcc26d89ad69a0c) */ /***********************************************************************************/ #include <pybind11/complex.h> @@ -52,6 +52,9 @@ void bind_pdu(py::module& m) "rx_time", &::gr::metadata_keys::rx_time, D(metadata_keys, rx_time)); m_metadata_keys.def( + "sample_rate", &::gr::metadata_keys::sample_rate, D(metadata_keys, sample_rate)); + + m_metadata_keys.def( "sys_time", &::gr::metadata_keys::sys_time, D(metadata_keys, sys_time)); m_metadata_keys.def("tx_eob", &::gr::metadata_keys::tx_eob, D(metadata_keys, tx_eob)); diff --git a/gr-pdu/lib/tags_to_pdu_impl.cc b/gr-pdu/lib/tags_to_pdu_impl.cc index a98a1771f6..ff02d69450 100644 --- a/gr-pdu/lib/tags_to_pdu_impl.cc +++ b/gr-pdu/lib/tags_to_pdu_impl.cc @@ -157,6 +157,8 @@ void tags_to_pdu_impl<T>::publish_message() pmt::make_tuple(pmt::from_uint64(int_seconds), pmt::from_double(frac_seconds)); d_meta_dict = pmt::dict_add(d_meta_dict, metadata_keys::rx_time(), time_tuple); d_meta_dict = pmt::dict_add( + d_meta_dict, metadata_keys::sample_rate(), pmt::from_double(d_samp_rate)); + d_meta_dict = pmt::dict_add( d_meta_dict, metadata_keys::pdu_num(), pmt::from_uint64(d_burst_counter)); if (d_wall_clock_time) { double t_now((boost::get_system_time() - d_epoch).total_microseconds() / |