diff options
author | Sylvain Munaut <tnt@246tNt.com> | 2015-03-29 20:56:29 +0200 |
---|---|---|
committer | Sylvain Munaut <tnt@246tNt.com> | 2015-04-04 13:54:30 +0200 |
commit | a2a370a46eedaf22b0b81cb473828fe47ff17d3c (patch) | |
tree | 3e23963abf8adf1cb50229d188eb705104fff93e | |
parent | 0803baa9eac94f1566394715a49569ebacd2164a (diff) |
gr-gmr1: Add a tag with the time of RACH and write it to file
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
-rw-r--r-- | gr-gmr1/lib/rach_detect_fft_impl.cc | 9 | ||||
-rw-r--r-- | gr-gmr1/lib/rach_file_sink_impl.cc | 9 |
2 files changed, 18 insertions, 0 deletions
diff --git a/gr-gmr1/lib/rach_detect_fft_impl.cc b/gr-gmr1/lib/rach_detect_fft_impl.cc index ab28105..62b183f 100644 --- a/gr-gmr1/lib/rach_detect_fft_impl.cc +++ b/gr-gmr1/lib/rach_detect_fft_impl.cc @@ -38,6 +38,7 @@ namespace gr { static const pmt::pmt_t SOB_KEY = pmt::string_to_symbol("sob"); static const pmt::pmt_t EOB_KEY = pmt::string_to_symbol("eob"); static const pmt::pmt_t FREQ_KEY = pmt::string_to_symbol("freq"); +static const pmt::pmt_t TIME_KEY = pmt::string_to_symbol("time"); rach_detect_fft::sptr @@ -262,6 +263,14 @@ rach_detect_fft_impl::general_work( FREQ_KEY, pmt::from_double(phase_inc) ); + + /* Burst first sample index */ + add_item_tag( + 0, + this->nitems_written(0), + TIME_KEY, + pmt::from_uint64(nitems_read(0)) + ); } this->d_r.rotateN( diff --git a/gr-gmr1/lib/rach_file_sink_impl.cc b/gr-gmr1/lib/rach_file_sink_impl.cc index 43695e3..0051966 100644 --- a/gr-gmr1/lib/rach_file_sink_impl.cc +++ b/gr-gmr1/lib/rach_file_sink_impl.cc @@ -22,6 +22,7 @@ #include "config.h" #endif +#include <inttypes.h> #include <string.h> #include <cstdio> @@ -114,6 +115,7 @@ rach_file_sink_impl::send_pdu(pmt::pmt_t pdu) { static const pmt::pmt_t key_sb_mask = pmt::string_to_symbol("sb_mask"); static const pmt::pmt_t key_freq = pmt::string_to_symbol("freq"); + static const pmt::pmt_t key_time = pmt::string_to_symbol("time"); pmt::pmt_t meta = pmt::car(pdu); pmt::pmt_t vector = pmt::cdr(pdu); @@ -127,6 +129,13 @@ rach_file_sink_impl::send_pdu(pmt::pmt_t pdu) !dict_has_key(meta, key_freq)) throw std::runtime_error("Invalid RACH PDU"); + /* If we have time, start with it */ + if (dict_has_key(meta, key_freq)) + { + uint64_t time = pmt::to_uint64(pmt::dict_ref(meta, key_time, pmt::PMT_NIL)); + fprintf(this->d_fh, "%" PRIu64 " ", time); + } + /* Grab SB_Mask & freq */ uint8_t sb_mask = pmt::to_long(pmt::dict_ref(meta, key_sb_mask, pmt::PMT_NIL)); double freq = pmt::to_double(pmt::dict_ref(meta, key_freq, pmt::PMT_NIL)); |