Added reset to the receiver, computation of power and function for setting arfcn of the receiver
diff --git a/include/gsm/receiver.h b/include/gsm/receiver.h
index c94720d..d5bfa41 100644
--- a/include/gsm/receiver.h
+++ b/include/gsm/receiver.h
@@ -49,6 +49,9 @@
* creating new instances.
*/
static sptr make(feval_dd * tuner, int osr, int arfcn);
+
+ virtual void set_arfcn(int arfcn) = 0;
+ virtual void reset() = 0;
};
} // namespace gsm
diff --git a/lib/receiver/receiver_impl.cc b/lib/receiver/receiver_impl.cc
index f718f99..500113e 100644
--- a/lib/receiver/receiver_impl.cc
+++ b/lib/receiver/receiver_impl.cc
@@ -92,6 +92,8 @@
configure_receiver(); //configure the receiver - tell it where to find which burst type
}
+
+
/*
* Our virtual destructor.
*/
@@ -191,12 +193,12 @@
unsigned char output_binary[BURST_SIZE];
burst_type b_type = d_channel_conf.get_burst_type(d_burst_nr); //get burst type for given burst number
- double signal_pwr=0;
+ double signal_pwr = 0;
for(int ii=0;ii<noutput_items;ii++)
{
signal_pwr += abs(input[ii])*abs(input[ii]);
}
- d_signal_dbm=static_cast<int8_t>(round(20*log10(signal_pwr)));
+ d_signal_dbm=static_cast<int8_t>(round(10*log10(signal_pwr/50/noutput_items)));
switch (b_type)
{
@@ -248,7 +250,7 @@
d_freq_offset_vals.clear();
d_freq_offset=0;
//set_frequency(0);
- DCOUT("Re-Synchronization!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+ COUT("Re-Synchronization!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
}
}
}
@@ -796,7 +798,7 @@
pmt::pmt_t header_blob=pmt::make_blob(tap_header.get(),sizeof(gsmtap_hdr));
pmt::pmt_t burst_binary_blob=pmt::make_blob(burst_binary,BURST_SIZE);
pmt::pmt_t msg = pmt::cons(header_blob, burst_binary_blob);
-
+
message_port_pub(pmt::mp("bursts"), msg);
}
@@ -840,6 +842,16 @@
d_channel_conf.set_burst_types(TIMESLOT7, TEST51, sizeof(TEST51) / sizeof(unsigned), dummy_or_normal);
}
+void receiver_impl::set_arfcn(int arfcn) //!!
+{
+ d_arfcn = arfcn;
+// std::cout << "set arfcn:"<<arfcn << std::endl;
+}
+
+void receiver_impl::reset()
+{
+ d_state = first_fcch_search;
+}
} /* namespace gsm */
} /* namespace gr */
diff --git a/lib/receiver/receiver_impl.h b/lib/receiver/receiver_impl.h
index 200a951..d3083b2 100644
--- a/lib/receiver/receiver_impl.h
+++ b/lib/receiver/receiver_impl.h
@@ -199,14 +199,18 @@
*
*/
void configure_receiver();
-
+
+
+
public:
- receiver_impl(feval_dd * tuner, int osr, int arfcn);
+ receiver_impl(feval_dd * tuner, int osr, int arfcn);
~receiver_impl();
// void forecast(int noutput_items, gr_vector_int &ninput_items_required);
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
+ virtual void set_arfcn(int arfcn);
+ virtual void reset();
};
} // namespace gsm
} // namespace gr
diff --git a/python/receiver_hier.py b/python/receiver_hier.py
old mode 100755
new mode 100644
index eb58663..6a0b77f
--- a/python/receiver_hier.py
+++ b/python/receiver_hier.py
@@ -41,7 +41,6 @@
# self.connect(self, self.interpolator, self.receiver, self)
self.msg_connect(self.receiver, "bursts", weakref.proxy(self), "bursts")
-
def _set_filter(self):
filter_cutoff = 125e3
filter_t_width = 10e3
@@ -64,5 +63,10 @@
def set_timing(self, timing_offset):
pass
-
-
+
+ def set_arfcn(self,arfcn):
+ self.receiver.set_arfcn(arfcn)
+
+ def reset(self):
+ self.receiver.reset()
+