diff options
author | Piotr Krysik <ptrkrysik@gmail.com> | 2018-04-17 09:10:33 +0200 |
---|---|---|
committer | Piotr Krysik <ptrkrysik@gmail.com> | 2018-04-17 09:10:33 +0200 |
commit | 2471052cfe724699c8bd2d4fec20d7f194cf6bb9 (patch) | |
tree | 494bfac4ec79a65f87bf970ab766d52b50a05af3 /lib | |
parent | 2ece45f5169a0aa2db90f3a9eae4a4892a9cde79 (diff) | |
parent | 012323230549af786f04fd94fc85ab7fbfa7a53d (diff) |
Merge branch 'fixeria/trx' of https://github.com/axilirator/gr-gsm into fixeria_trx
# Resolved conflicts:
# apps/grgsm_trx
# python/trx/radio_if.py
# swig/grgsm_swig.i
Diffstat (limited to 'lib')
-rw-r--r-- | lib/misc_utils/CMakeLists.txt | 1 | ||||
-rw-r--r-- | lib/misc_utils/burst_to_fn_time_impl.cc | 84 | ||||
-rw-r--r-- | lib/misc_utils/burst_to_fn_time_impl.h | 45 | ||||
-rw-r--r-- | lib/transmitter/txtime_setter_impl.cc | 9 |
4 files changed, 134 insertions, 5 deletions
diff --git a/lib/misc_utils/CMakeLists.txt b/lib/misc_utils/CMakeLists.txt index e0fc818..c81a92d 100644 --- a/lib/misc_utils/CMakeLists.txt +++ b/lib/misc_utils/CMakeLists.txt @@ -37,5 +37,6 @@ add_sources( fn_time.cc udp_socket.cc trx_burst_if_impl.cc + burst_to_fn_time_impl.cc ) diff --git a/lib/misc_utils/burst_to_fn_time_impl.cc b/lib/misc_utils/burst_to_fn_time_impl.cc new file mode 100644 index 0000000..3e587f0 --- /dev/null +++ b/lib/misc_utils/burst_to_fn_time_impl.cc @@ -0,0 +1,84 @@ +/* -*- c++ -*- */ +/* @file + * @author Piotr Krysik <ptrkrysik@gmail.com> + * @author Vadim Yanitskiy <axilirator@gmail.com> + * @section LICENSE + * + * Gr-gsm is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * Gr-gsm is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with gr-gsm; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gnuradio/io_signature.h> +#include "burst_to_fn_time_impl.h" + +namespace gr { + namespace gsm { + + burst_to_fn_time::sptr + burst_to_fn_time::make(void) + { + return gnuradio::get_initial_sptr + (new burst_to_fn_time_impl()); + } + + /* + * The private constructor + */ + burst_to_fn_time_impl::burst_to_fn_time_impl(void) + : gr::block("burst_to_fn_time", + gr::io_signature::make(0, 0, 0), + gr::io_signature::make(0, 0, 0)) + { + // Register I/O ports + message_port_register_in(pmt::mp("bursts_in")); + message_port_register_out(pmt::mp("fn_time_out")); + + // Bind a port handler + set_msg_handler(pmt::mp("bursts_in"), + boost::bind(&burst_to_fn_time_impl::handle_burst, this, _1)); + } + + /* + * Our virtual destructor. + */ + burst_to_fn_time_impl::~burst_to_fn_time_impl() + { + } + + void + burst_to_fn_time_impl::handle_burst(pmt::pmt_t msg_in) + { + // Obtain fn_time tag from message + pmt::pmt_t blob = pmt::car(msg_in); + pmt::pmt_t fn_time = pmt::dict_ref(blob, + pmt::intern("fn_time"), pmt::PMT_NIL); + + // Drop messages without required tag + if (fn_time == pmt::PMT_NIL) + return; + + // Compose and send a new message + pmt::pmt_t msg_out = pmt::dict_add(pmt::make_dict(), + pmt::intern("fn_time"), fn_time); + message_port_pub(pmt::mp("fn_time_out"), msg_out); + } + + } /* namespace gsm */ +} /* namespace gr */ diff --git a/lib/misc_utils/burst_to_fn_time_impl.h b/lib/misc_utils/burst_to_fn_time_impl.h new file mode 100644 index 0000000..e96c2bb --- /dev/null +++ b/lib/misc_utils/burst_to_fn_time_impl.h @@ -0,0 +1,45 @@ +/* -*- c++ -*- */ +/* @file + * @author Piotr Krysik <ptrkrysik@gmail.com> + * @author Vadim Yanitskiy <axilirator@gmail.com> + * @section LICENSE + * + * Gr-gsm is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * Gr-gsm is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with gr-gsm; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef INCLUDED_GRGSM_BURST_TO_FN_TIME_IMPL_H +#define INCLUDED_GRGSM_BURST_TO_FN_TIME_IMPL_H + +#include <grgsm/misc_utils/burst_to_fn_time.h> + +namespace gr { + namespace gsm { + + class burst_to_fn_time_impl : public burst_to_fn_time + { + private: + void handle_burst(pmt::pmt_t msg_in); + + public: + burst_to_fn_time_impl(void); + ~burst_to_fn_time_impl(void); + }; + + } // namespace gsm +} // namespace gr + +#endif /* INCLUDED_GRGSM_BURST_TO_FN_TIME_IMPL_H */ diff --git a/lib/transmitter/txtime_setter_impl.cc b/lib/transmitter/txtime_setter_impl.cc index 33bc994..3c07cc6 100644 --- a/lib/transmitter/txtime_setter_impl.cc +++ b/lib/transmitter/txtime_setter_impl.cc @@ -90,15 +90,14 @@ namespace gr { void txtime_setter_impl::process_fn_time_reference(pmt::pmt_t msg) { - pmt::pmt_t not_found = pmt::intern("not_found"); pmt::pmt_t fn_time, time_hint; fn_time = pmt::dict_ref(msg, - pmt::intern("fn_time"), not_found); + pmt::intern("fn_time"), pmt::PMT_NIL); time_hint = pmt::dict_ref(msg, - pmt::intern("fn_time"), not_found); + pmt::intern("time_hint"), pmt::PMT_NIL); - if (fn_time != not_found) { + if (fn_time != pmt::PMT_NIL) { uint32_t fn_ref = static_cast<uint32_t> (pmt::to_uint64(pmt::car(pmt::car(fn_time)))); uint32_t ts = static_cast<uint32_t> @@ -109,7 +108,7 @@ namespace gr { pmt::cdr(pmt::cdr(fn_time))); set_fn_time_reference(fn_ref, ts, time_secs, time_fracs); - } else if (time_hint != not_found) { + } else if (time_hint != pmt::PMT_NIL) { set_time_hint(pmt::to_uint64(pmt::car(fn_time)), pmt::to_double(pmt::cdr(fn_time))); } |