From 7a6d8fc1da77e11decd341e81ab6d65e46ae2eed Mon Sep 17 00:00:00 2001 From: tvoid Date: Mon, 7 Apr 2008 17:50:59 -0600 Subject: working callback --- gsm-tvoid/src/lib/gsm.i | 14 +++---- gsm-tvoid/src/lib/gsm_burst.cc | 78 ++++----------------------------------- gsm-tvoid/src/lib/gsm_burst.h | 26 ++----------- gsm-tvoid/src/lib/gsm_burst_cf.cc | 4 +- gsm-tvoid/src/lib/gsm_burst_cf.h | 6 +-- gsm-tvoid/src/lib/gsm_burst_ff.cc | 4 +- gsm-tvoid/src/lib/gsm_burst_ff.h | 6 +-- 7 files changed, 25 insertions(+), 113 deletions(-) mode change 100644 => 100755 gsm-tvoid/src/lib/gsm_burst_cf.cc mode change 100644 => 100755 gsm-tvoid/src/lib/gsm_burst_cf.h mode change 100644 => 100755 gsm-tvoid/src/lib/gsm_burst_ff.cc mode change 100644 => 100755 gsm-tvoid/src/lib/gsm_burst_ff.h (limited to 'gsm-tvoid/src/lib') diff --git a/gsm-tvoid/src/lib/gsm.i b/gsm-tvoid/src/lib/gsm.i index a362421..3925d12 100755 --- a/gsm-tvoid/src/lib/gsm.i +++ b/gsm-tvoid/src/lib/gsm.i @@ -76,31 +76,27 @@ public: double mean_freq_offset(void); //Methods - //void set_tuner_callback(gsm_tuner_callback *); - //void set_tuner_callback(gr_feval_dd *); - void full_reset(void); protected: -// gsm_tuner_callback *p_tuner; - gsm_burst(gr_feval_dd *); + gsm_burst(gr_feval_ll *); }; GR_SWIG_BLOCK_MAGIC(gsm,burst_ff); -gsm_burst_ff_sptr gsm_make_burst_ff (gr_feval_dd *); +gsm_burst_ff_sptr gsm_make_burst_ff (gr_feval_ll *); class gsm_burst_ff : public gr_block, public gsm_burst { private: - gsm_burst_ff (gr_feval_dd *); + gsm_burst_ff (gr_feval_ll *); }; GR_SWIG_BLOCK_MAGIC(gsm,burst_cf); -gsm_burst_cf_sptr gsm_make_burst_cf (gr_feval_dd *,float); +gsm_burst_cf_sptr gsm_make_burst_cf (gr_feval_ll *,float); class gsm_burst_cf : public gr_block, public gsm_burst { private: - gsm_burst_cf (gr_feval_dd *,float); + gsm_burst_cf (gr_feval_ll *,float); }; diff --git a/gsm-tvoid/src/lib/gsm_burst.cc b/gsm-tvoid/src/lib/gsm_burst.cc index ff5fac1..6bec32c 100755 --- a/gsm-tvoid/src/lib/gsm_burst.cc +++ b/gsm-tvoid/src/lib/gsm_burst.cc @@ -12,75 +12,14 @@ #include "system.h" #include "gsmstack.h" -/* -void do_tuner_callback(gsm_tuner_callback *t, double f) -{ - if (t) t->do_tune(f); -} - -//this should be overridden by a python class -void gsm_tuner_callback::tune(double x) { - printf("t1: %f\n",x); -} - -void gsm_tuner_callback::do_tune(double x) { - printf("do_"); - tune(x); -} - - -void gsm_burst::set_tuner_callback(gsm_tuner_callback *f) { - printf("set_tuner_callback: %8.8x\n",(unsigned int)f); - p_tuner = f; -} -*/ - -/* -void gsm_burst::set_tuner_callback(gr_feval_dd *t) { - p_tuner = t; -} -*/ - -/* -void gsm_burst::set_status_callback(PSTAT_FUNC func, void *clientdata) { - p_stat_func = func; - stat_func_data = clientdata; -} - -void gsm_burst::py_set_status_callback(PyObject *pyfunc) { - //set_status_callback(PythonCallBack, (void *) pyfunc); - stat_func_data = (void *) pyfunc; - Py_INCREF(pyfunc); -} -*/ - - -/* -static void PythonCallBack(int a, void *clientdata) -{ - PyObject *func, *arglist, *result; -// long int dres = 0; - - func = (PyObject *) clientdata; // Get Python function - arglist = Py_BuildValue("(i)",a); // Build argument list - result = PyEval_CallObject(func,arglist); // Call Python - Py_DECREF(arglist); // Trash arglist -// if (result) { // If no errors, return double -// dres = PyInt_AsLong(result); -// } - Py_XDECREF(result); -// return dres; -} -*/ - -gsm_burst::gsm_burst (gr_feval_dd *t) : +gsm_burst::gsm_burst (gr_feval_ll *t) : d_clock_options(DEFAULT_CLK_OPTS), d_print_options(0), d_equalizer_type(EQ_FIXED_DFE) { - printf("gsm_burst: enter constructor (t=%8.8x)\n",(unsigned int)t); + fprintf(stderr,"gsm_burst: enter constructor (t=%8.8x)\n",(unsigned int)t); // M_PI = M_PI; //4.0 * atan(1.0); @@ -755,15 +694,12 @@ int gsm_burst::get_burst(void) if (got_burst) { d_total_count++; //do callback - //do_tuner_callback(p_tuner,1.0); - //if (p_callback) - if (p_tuner) + if (p_tuner) { //p_tuner->eval(1.0); - p_tuner->calleval(1.0); - //p_tuner->do_tune(1.0); - //PythonCallBack(STAT_GOT_BURST,stat_func_data); - //(*p_stat_func)(STAT_GOT_BURST,stat_func_data); - //p_callback->(1.0); + long in=1; + long out = -1; + out = p_tuner->calleval(in); + } //print info print_burst(); diff --git a/gsm-tvoid/src/lib/gsm_burst.h b/gsm-tvoid/src/lib/gsm_burst.h index b5313c4..f1b45a6 100755 --- a/gsm-tvoid/src/lib/gsm_burst.h +++ b/gsm-tvoid/src/lib/gsm_burst.h @@ -8,7 +8,6 @@ #include "gsm_constants.h" #include -//#include //for callback testing #include #include "gsmstack.h" @@ -71,28 +70,13 @@ enum EQ_TYPE { EQ_VITERBI }; -//typedef void (*PSTAT_FUNC)(int, void *); -//#define STAT_GOT_BURST 1 -//double gr_feval_callback(gr_feval_dd *f, double x); - -/* -class gsm_tuner_callback { -protected: - virtual void tune(double x); - -public: - virtual void do_tune(double x); -}; -*/ -//void do_tuner_callback(gsm_tuner_callback *t, double f); - class gsm_burst; class gsm_burst { protected: - gsm_burst(gr_feval_dd *t); + gsm_burst(gr_feval_ll *t); //Burst Buffer: Storage for burst data float d_burst_buffer[BBUF_SIZE]; @@ -129,11 +113,7 @@ protected: double d_freq_off_sum; double d_freq_off_weight; - //PSTAT_FUNC p_stat_func; - //void *stat_func_data; - - gr_feval_dd *p_tuner; - //gsm_tuner_callback *p_tuner; + gr_feval_ll *p_tuner; //////// Methods int get_burst(void); @@ -164,7 +144,7 @@ public: //void py_set_status_callback(PyObject *pyfunc); //void set_status_callback(PSTAT_FUNC func, void *clientdata); - //void set_tuner_callback(gr_feval_dd *t); + //void set_tuner_callback(gr_feval_ll *t); //use swig directors to privide a python override //virtual void notify_status(int status); diff --git a/gsm-tvoid/src/lib/gsm_burst_cf.cc b/gsm-tvoid/src/lib/gsm_burst_cf.cc old mode 100644 new mode 100755 index f08424d..45b8e3a --- a/gsm-tvoid/src/lib/gsm_burst_cf.cc +++ b/gsm-tvoid/src/lib/gsm_burst_cf.cc @@ -9,7 +9,7 @@ #include #include -gsm_burst_cf_sptr gsm_make_burst_cf (gr_feval_dd *t,float sample_rate) +gsm_burst_cf_sptr gsm_make_burst_cf (gr_feval_ll *t,float sample_rate) { return gsm_burst_cf_sptr (new gsm_burst_cf (t,sample_rate)); } @@ -19,7 +19,7 @@ static const int MAX_IN = 1; // maximum number of input streams static const int MIN_OUT = 1; // minimum number of output streams static const int MAX_OUT = 1; // maximum number of output streams -gsm_burst_cf::gsm_burst_cf (gr_feval_dd *t, float sample_rate) : +gsm_burst_cf::gsm_burst_cf (gr_feval_ll *t, float sample_rate) : gr_block ( "burst_cf", gr_make_io_signature (MIN_IN, MAX_IN, sizeof (gr_complex)), gr_make_io_signature (MIN_OUT, MAX_OUT, USEFUL_BITS * sizeof (float))), diff --git a/gsm-tvoid/src/lib/gsm_burst_cf.h b/gsm-tvoid/src/lib/gsm_burst_cf.h old mode 100644 new mode 100755 index fe742c4..2b806e0 --- a/gsm-tvoid/src/lib/gsm_burst_cf.h +++ b/gsm-tvoid/src/lib/gsm_burst_cf.h @@ -8,7 +8,7 @@ class gsm_burst_cf; typedef boost::shared_ptr gsm_burst_cf_sptr; -gsm_burst_cf_sptr gsm_make_burst_cf(gr_feval_dd *,float); +gsm_burst_cf_sptr gsm_make_burst_cf(gr_feval_ll *,float); class gri_mmse_fir_interpolator_cc; @@ -16,8 +16,8 @@ class gsm_burst_cf : public gr_block, public gsm_burst { private: - friend gsm_burst_cf_sptr gsm_make_burst_cf(gr_feval_dd *,float); - gsm_burst_cf(gr_feval_dd *,float); + friend gsm_burst_cf_sptr gsm_make_burst_cf(gr_feval_ll *,float); + gsm_burst_cf(gr_feval_ll *,float); //clocking parameters float d_relative_sample_rate; diff --git a/gsm-tvoid/src/lib/gsm_burst_ff.cc b/gsm-tvoid/src/lib/gsm_burst_ff.cc old mode 100644 new mode 100755 index 25f9421..57f104a --- a/gsm-tvoid/src/lib/gsm_burst_ff.cc +++ b/gsm-tvoid/src/lib/gsm_burst_ff.cc @@ -9,7 +9,7 @@ #include #include -gsm_burst_ff_sptr gsm_make_burst_ff (gr_feval_dd *t) +gsm_burst_ff_sptr gsm_make_burst_ff (gr_feval_ll *t) { return gsm_burst_ff_sptr (new gsm_burst_ff(t)); } @@ -19,7 +19,7 @@ static const int MAX_IN = 1; // maximum number of input streams static const int MIN_OUT = 1; // minimum number of output streams static const int MAX_OUT = 1; // maximum number of output streams -gsm_burst_ff::gsm_burst_ff (gr_feval_dd *t) : +gsm_burst_ff::gsm_burst_ff (gr_feval_ll *t) : gr_block( "burst_ff", gr_make_io_signature (MIN_IN, MAX_IN, sizeof (float)), gr_make_io_signature (MIN_OUT, MAX_OUT, USEFUL_BITS * sizeof (float))), diff --git a/gsm-tvoid/src/lib/gsm_burst_ff.h b/gsm-tvoid/src/lib/gsm_burst_ff.h old mode 100644 new mode 100755 index 30047f2..8ca61ef --- a/gsm-tvoid/src/lib/gsm_burst_ff.h +++ b/gsm-tvoid/src/lib/gsm_burst_ff.h @@ -8,14 +8,14 @@ class gsm_burst_ff; typedef boost::shared_ptr gsm_burst_ff_sptr; -gsm_burst_ff_sptr gsm_make_burst_ff(gr_feval_dd *); +gsm_burst_ff_sptr gsm_make_burst_ff(gr_feval_ll *); class gsm_burst_ff : public gr_block, public gsm_burst { private: - friend gsm_burst_ff_sptr gsm_make_burst_ff(gr_feval_dd *); - gsm_burst_ff(gr_feval_dd *t); + friend gsm_burst_ff_sptr gsm_make_burst_ff(gr_feval_ll *); + gsm_burst_ff(gr_feval_ll *t); public: ~gsm_burst_ff (); -- cgit v1.2.3