aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorpiotr <Piotr Krysik pkrysik@elka.pw.edu.pl>2014-08-06 15:20:33 +0200
committerpiotr <Piotr Krysik pkrysik@elka.pw.edu.pl>2014-08-06 15:20:33 +0200
commitd6d6687691d5c5c9b2e2d7270cdcf23cdaaaa902 (patch)
tree449856551633054d6fe9c19240676c442bc71cb8 /lib
parent82c774f7726cb585bd6febc02c4d7abb251416bb (diff)
Removed redundant state from the receiver
Diffstat (limited to 'lib')
-rw-r--r--lib/receiver/receiver_impl.cc37
-rw-r--r--lib/receiver/receiver_impl.h4
2 files changed, 9 insertions, 32 deletions
diff --git a/lib/receiver/receiver_impl.cc b/lib/receiver/receiver_impl.cc
index c333ccf..f1382ed 100644
--- a/lib/receiver/receiver_impl.cc
+++ b/lib/receiver/receiver_impl.cc
@@ -72,7 +72,7 @@ receiver_impl::receiver_impl(feval_dd * tuner, int osr, int arfcn)
d_counter(0),
d_fcch_start_pos(0),
d_freq_offset_setting(0),
- d_state(first_fcch_search),
+ d_state(fcch_search),
d_burst_nr(osr),
d_failed_sch(0),
d_arfcn((int)(arfcn)),
@@ -135,36 +135,20 @@ receiver_impl::work(int noutput_items,
switch (d_state)
{
//bootstrapping
- case first_fcch_search:
- DCOUT("FCCH search");
- double freq_offset_tmp;
- if (find_fcch_burst(input, noutput_items, freq_offset_tmp)) //find frequency correction burst in the input buffer
- {
- pmt::pmt_t msg = pmt::make_tuple(pmt::mp("freq_offset"),pmt::from_double(freq_offset_tmp-d_freq_offset_setting),pmt::mp("first_fcch_search"));
- message_port_pub(pmt::mp("measurements"), msg);
-
- d_state = next_fcch_search;
- }
- else
- {
- d_state = first_fcch_search;
- }
- break;
-
- case next_fcch_search: //this state is used because it takes some time (a bunch of buffered samples)
+ case fcch_search: //this state is used because it takes some time (a bunch of buffered samples)
{
- DCOUT("NEXT FCCH search");
+ DCOUT("FCCH search");
double freq_offset_tmp;
if (find_fcch_burst(input, noutput_items,freq_offset_tmp))
{
- pmt::pmt_t msg = pmt::make_tuple(pmt::mp("freq_offset"),pmt::from_double(freq_offset_tmp-d_freq_offset_setting),pmt::mp("next_fcch_search"));
+ pmt::pmt_t msg = pmt::make_tuple(pmt::mp("freq_offset"),pmt::from_double(freq_offset_tmp-d_freq_offset_setting),pmt::mp("fcch_search"));
message_port_pub(pmt::mp("measurements"), msg);
d_state = sch_search;
}
else
{
- d_state = next_fcch_search;
+ d_state = fcch_search;
}
break;
}
@@ -193,7 +177,7 @@ receiver_impl::work(int noutput_items,
}
else
{
- d_state = next_fcch_search; //if there is error in the sch burst go back to fcch search phase
+ d_state = fcch_search; //if there is error in the sch burst go back to fcch search phase
}
}
else
@@ -239,11 +223,6 @@ receiver_impl::work(int noutput_items,
int t1, t2, t3, d_ncc, d_bcc;
burst_start = get_sch_chan_imp_resp(input, &channel_imp_resp[0]); //get channel impulse response
- if(d_prev_burst_start != burst_start){
- d_prev_burst_start = burst_start;
- DCOUT("burst start" << burst_start);
- }
-
detect_burst(input, &channel_imp_resp[0], burst_start, output_binary); //MLSE detection of bits
send_burst(d_burst_nr, output_binary, b_type);
if (decode_sch(&output_binary[3], &t1, &t2, &t3, &d_ncc, &d_bcc) == 0) //and decode SCH data
@@ -260,7 +239,7 @@ receiver_impl::work(int noutput_items,
d_failed_sch++;
if (d_failed_sch >= MAX_SCH_ERRORS)
{
- d_state = next_fcch_search;
+ d_state = fcch_search;
pmt::pmt_t msg = pmt::make_tuple(pmt::mp("freq_offset"),pmt::from_double(0.0),pmt::mp("sync_loss"));
message_port_pub(pmt::mp("measurements"), msg);
DCOUT("Re-Synchronization!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
@@ -850,7 +829,7 @@ void receiver_impl::set_arfcn(int arfcn) //!!
void receiver_impl::reset()
{
- d_state = first_fcch_search;
+ d_state = fcch_search;
}
} /* namespace gsm */
diff --git a/lib/receiver/receiver_impl.h b/lib/receiver/receiver_impl.h
index 76ad40b..de0042d 100644
--- a/lib/receiver/receiver_impl.h
+++ b/lib/receiver/receiver_impl.h
@@ -34,7 +34,6 @@ namespace gr {
class receiver_impl : public receiver
{
private:
- int d_prev_burst_start; //!!
/**@name Configuration of the receiver */
//@{
const int d_OSR; ///< oversampling ratio
@@ -60,7 +59,6 @@ namespace gr {
/**@name Variables used to store result of the find_fcch_burst fuction */
//@{
unsigned d_fcch_start_pos; ///< position of the first sample of the fcch burst
-// float d_freq_offset; ///< frequency offset of the received signal
float d_freq_offset_setting; ///< frequency offset set in frequency shifter located upstream
//@}
std::list<double> d_freq_offset_vals;
@@ -74,7 +72,7 @@ namespace gr {
/**@name Internal state of the gsm receiver */
//@{
enum states {
- first_fcch_search, next_fcch_search, sch_search, // synchronization search part
+ fcch_search, sch_search, // synchronization search part
synchronized // receiver is synchronized in this state
} d_state;
//@}