diff options
author | Piotr Krysik <perper@o2.pl> | 2009-04-08 16:35:59 +0200 |
---|---|---|
committer | Piotr Krysik <perper@o2.pl> | 2009-04-08 16:35:59 +0200 |
commit | deb7ffac0f3d8af59fddae0c9d08a3b0654206d1 (patch) | |
tree | 36e6c189de471ea98699bf65acdbfee1f8b79280 /src/lib | |
parent | ab5cd655f7ca398e9d92fde4faf291b0d7e6fb0d (diff) |
Added FCCH search function from tvoid
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/gsm_receiver_cf.cc | 49 | ||||
-rw-r--r-- | src/lib/gsm_receiver_cf.h | 28 |
2 files changed, 60 insertions, 17 deletions
diff --git a/src/lib/gsm_receiver_cf.cc b/src/lib/gsm_receiver_cf.cc index 821c929..e478c66 100644 --- a/src/lib/gsm_receiver_cf.cc +++ b/src/lib/gsm_receiver_cf.cc @@ -68,11 +68,52 @@ gsm_receiver_cf::general_work (int noutput_items, out[i] = in[i] * in[i]; } - // Tell runtime system how many input items we consumed on - // each input stream. - consume_each (noutput_items); - // Tell runtime system how many output items we produced. return noutput_items; } + + +bool gsm_receiver_cf::get_fcch_burst() +{ + int hit_count = 0; + int miss_count = 0; + int start_pos = -1; +/* + for ( int i=0; i < BBUF_SIZE; i++ ) { + if ( d_burst_buffer[i] > 0 ) { + if ( ! hit_count++ ) + start_pos = i; + } else { + if ( hit_count >= FCCH_HITS_NEEDED ) { + break; + } else + if ( ++miss_count > FCCH_MAX_MISSES ) { + start_pos = -1; + hit_count = miss_count = 0; + } + } + } + + //Do we have a match? + if ( start_pos >= 0 ) { + //Is it within range? (we know it's long enough then too) + if ( start_pos < 2*MAX_CORR_DIST ) { + d_burst_start = start_pos; + d_bbuf_pos = 0; //load buffer from start + return FCCH; + + } else { + //TODO: don't shift a tiny amount + shift_burst( start_pos - MAX_CORR_DIST ); + } + } else { + //Didn't find anything + d_burst_start = MAX_CORR_DIST; + d_bbuf_pos = 0; //load buffer from start + } + + return UNKNOWN; +*/ +} + diff --git a/src/lib/gsm_receiver_cf.h b/src/lib/gsm_receiver_cf.h index 3b4ffc6..7067fb2 100644 --- a/src/lib/gsm_receiver_cf.h +++ b/src/lib/gsm_receiver_cf.h @@ -47,28 +47,30 @@ typedef boost::shared_ptr<gsm_receiver_cf> gsm_receiver_cf_sptr; * constructor is private. howto_make_square_ff is the public * interface for creating new instances. */ -gsm_receiver_cf_sptr gsm_make_receiver_cf (); +gsm_receiver_cf_sptr gsm_make_receiver_cf(); /*! - * \brief square a stream of floats. + * \brief Receives fcch * \ingroup block - * - * \sa howto_square2_ff for a version that subclasses gr_sync_block. + * \sa */ + class gsm_receiver_cf : public gr_block { -private: - friend gsm_receiver_cf_sptr gsm_make_receiver_cf (); - gsm_receiver_cf (); + private: + friend gsm_receiver_cf_sptr gsm_make_receiver_cf(); + + gsm_receiver_cf(); + bool get_fcch_burst(); - public: - ~gsm_receiver_cf (); + public: + ~gsm_receiver_cf(); - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); + int general_work( int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items ); }; #endif /* INCLUDED_GSM_RECEIVER_CF_H */ |