From cdd0c993d3af1c4096ec4a194b1a877e349e697d Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Sat, 19 Jan 2019 16:52:20 +0700 Subject: receiver: add public API for multiframe configuration Change-Id: I3a4621852baad254f2bd626251fb7958492f0f32 --- lib/receiver/receiver_config.h | 16 ++++++++++++- lib/receiver/receiver_impl.cc | 54 ++++++++++++++++++++++++++++++++++++++++++ lib/receiver/receiver_impl.h | 13 ++++++++++ 3 files changed, 82 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/receiver/receiver_config.h b/lib/receiver/receiver_config.h index e6ca267..181132a 100644 --- a/lib/receiver/receiver_config.h +++ b/lib/receiver/receiver_config.h @@ -58,6 +58,12 @@ class multiframe_configuration } } + void reset(void) { + fill(d_burst_types.begin(), d_burst_types.end(), empty); + d_burst_types.resize(0); + d_type = unknown; + } + void set_burst_type(int nr, burst_type type) { d_burst_types[nr] = type; } @@ -146,6 +152,10 @@ class channel_configuration } } + multiframe_type get_multiframe_type(int timeslot_nr) { + return d_timeslots_descriptions[timeslot_nr].get_type(); + } + void set_multiframe_type(int timeslot_nr, multiframe_type type) { d_timeslots_descriptions[timeslot_nr].set_type(type); } @@ -157,13 +167,17 @@ class channel_configuration } } + burst_type get_single_burst_type(int timeslot_nr, int burst_nr) { + return d_timeslots_descriptions[timeslot_nr].get_burst_type(burst_nr); + } + void set_single_burst_type(int timeslot_nr, int burst_nr, burst_type b_type) { d_timeslots_descriptions[timeslot_nr].set_burst_type(burst_nr, b_type); } void reset_all(void) { for (int i = 0; i < TS_PER_FRAME; i++) - set_multiframe_type(i, unknown); + d_timeslots_descriptions[i].reset(); } burst_type get_burst_type(burst_counter burst_nr); diff --git a/lib/receiver/receiver_impl.cc b/lib/receiver/receiver_impl.cc index ffaf9ee..94ad422 100644 --- a/lib/receiver/receiver_impl.cc +++ b/lib/receiver/receiver_impl.cc @@ -1132,5 +1132,59 @@ namespace gr { d_state = fcch_search; } + + void + receiver_impl::reset_mf_config(void) + { + d_channel_conf.reset_all(); + } + + multiframe_type + receiver_impl::get_mf_type(int tn) + { + return d_channel_conf.get_multiframe_type(tn); + } + + void + receiver_impl::set_mf_type(int tn, multiframe_type type) + { + d_channel_conf.set_multiframe_type(tn, type); + } + + burst_type + receiver_impl::get_mf_burst_type(int tn, unsigned fn) + { + return d_channel_conf.get_single_burst_type(tn, fn); + } + + void + receiver_impl::set_mf_burst_type(int tn, unsigned fn, burst_type type) + { + d_channel_conf.set_single_burst_type(tn, fn, type); + } + + void + receiver_impl::set_mf_burst_type_mod(int tn, int mod, unsigned fn, burst_type type) + { + multiframe_type mf_type; + unsigned i, mf_len; + + mf_type = d_channel_conf.get_multiframe_type(tn); + switch (mf_type) { + case multiframe_51: + mf_len = 51; break; + case multiframe_26: + mf_len = 26; break; + case unknown: + default: + mf_len = 0; break; + } + + for (i = 0; i < mf_len; i++) { + if (i % mod == fn) + d_channel_conf.set_single_burst_type(tn, i, type); + } + } + } /* namespace gsm */ } /* namespace gr */ diff --git a/lib/receiver/receiver_impl.h b/lib/receiver/receiver_impl.h index a7d7bc2..db3fdab 100644 --- a/lib/receiver/receiver_impl.h +++ b/lib/receiver/receiver_impl.h @@ -222,6 +222,19 @@ namespace gr { virtual void set_cell_allocation(const std::vector &cell_allocation); virtual void set_tseq_nums(const std::vector & tseq_nums); virtual void reset(); + + /* Reset multiframe configuration for all timeslots */ + virtual void reset_mf_config(void); + /* Get multiframe type for a given timeslot */ + virtual multiframe_type get_mf_type(int tn); + /* Set multiframe type for a given timeslot */ + virtual void set_mf_type(int tn, multiframe_type type); + /* Get burst type for a given pair of timeslot and frame number */ + virtual burst_type get_mf_burst_type(int tn, unsigned fn); + /* Set burst type for a given pair of timeslot and frame number */ + virtual void set_mf_burst_type(int tn, unsigned fn, burst_type type); + /* Set burst type for every frame number within a given modulo */ + virtual void set_mf_burst_type_mod(int tn, int mod, unsigned fn, burst_type type); }; } // namespace gsm } // namespace gr -- cgit v1.2.3