summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortvoid <tvoid@lesaige.com>2008-04-07 20:34:29 -0600
committertvoid <tvoid@lesaige.com>2008-04-07 20:34:29 -0600
commit57ad579c4c247125be2f3bd430734902a27cc869 (patch)
treeff59cd13418df970cb459e79467a1e5f790a3342
parent0be80293cac0d50ff5e6f8c757a9424501af3c60 (diff)
parentc26f4b9bd2b00279b6f0f0bbf027c72cafaae5b6 (diff)
Merge branch 'master' into callback-test
-rwxr-xr-xgsm-tvoid/src/lib/gsm.i2
-rwxr-xr-xgsm-tvoid/src/lib/gsm_burst.cc43
-rwxr-xr-xgsm-tvoid/src/lib/gsm_burst.h13
-rwxr-xr-xgsm-tvoid/src/lib/gsm_burst_cf.cc3
-rwxr-xr-xgsm-tvoid/src/lib/gsm_burst_ff.cc5
-rwxr-xr-xgsm-tvoid/src/python/gsm_scan.py37
6 files changed, 53 insertions, 50 deletions
diff --git a/gsm-tvoid/src/lib/gsm.i b/gsm-tvoid/src/lib/gsm.i
index 76eb189..9d653ac 100755
--- a/gsm-tvoid/src/lib/gsm.i
+++ b/gsm-tvoid/src/lib/gsm.i
@@ -31,6 +31,8 @@
#define PRINT_DUMMY 0x00000100
#define PRINT_NORMAL 0x00000200
+#define PRINT_GSM_DECODE 0x00000400
+
#define PRINT_HEX 0x00001000
//Timing/clock options
diff --git a/gsm-tvoid/src/lib/gsm_burst.cc b/gsm-tvoid/src/lib/gsm_burst.cc
index 162e12b..4203f26 100755
--- a/gsm-tvoid/src/lib/gsm_burst.cc
+++ b/gsm-tvoid/src/lib/gsm_burst.cc
@@ -14,21 +14,16 @@
gsm_burst::gsm_burst (gr_feval_ll *t) :
+ p_tuner(t),
d_clock_options(DEFAULT_CLK_OPTS),
d_print_options(0),
d_equalizer_type(EQ_FIXED_DFE)
{
- fprintf(stderr,"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);
- //p_stat_func = 0;
- //stat_func_data = 0;
-
- //p_callback = 0;
- p_tuner = t;
-
full_reset();
//encode sync bits
@@ -228,22 +223,26 @@ void gsm_burst::print_burst(void)
fprintf(stderr," ");
}
- /*
- * Pass information to GSM stack. GSM stack will try to extract
- * information (fn, layer 2 messages, ...)
- */
-
- char buf[156];
- /* In hardbits include the 3 trial bits */
- /* FIXME: access burst has 8 trail bits? what is d_burst_start
- * set to? make sure we start at the right position here.
- */
- soft2hardbit(buf, d_burst_buffer + d_burst_start - 3, 156);
- /* GS_process will differentially decode the data and then
- * extract SCH infos (and later bcch infos).
- */
- GS_process(&d_gs_ctx, d_ts, d_burst_type, buf);
+ if ( PRINT_GSM_DECODE == d_print_options ) {
+
+ /*
+ * Pass information to GSM stack. GSM stack will try to extract
+ * information (fn, layer 2 messages, ...)
+ */
+
+ char buf[156];
+ /* In hardbits include the 3 trial bits */
+ /* FIXME: access burst has 8 trail bits? what is d_burst_start
+ * set to? make sure we start at the right position here.
+ */
+ soft2hardbit(buf, d_burst_buffer + d_burst_start - 3, 156);
+ /* GS_process will differentially decode the data and then
+ * extract SCH infos (and later bcch infos).
+ */
+ GS_process(&d_gs_ctx, d_ts, d_burst_type, buf);
+ }
+
if (print) {
fprintf(stderr,"%d/%d/%+d/%lu/%lu ",
diff --git a/gsm-tvoid/src/lib/gsm_burst.h b/gsm-tvoid/src/lib/gsm_burst.h
index 080899a..f1fb26e 100755
--- a/gsm-tvoid/src/lib/gsm_burst.h
+++ b/gsm-tvoid/src/lib/gsm_burst.h
@@ -29,6 +29,8 @@
#define PRINT_DUMMY 0x00000100
#define PRINT_NORMAL 0x00000200
+#define PRINT_GSM_DECODE 0x00000400
+
#define PRINT_HEX 0x00001000
//Timing/clock options
@@ -144,17 +146,6 @@ protected:
public:
~gsm_burst ();
- //Set status callback function, needed for quick tune()
- //void py_set_status_callback(PyObject *pyfunc);
- //void set_status_callback(PSTAT_FUNC func, void *clientdata);
-
- //void set_tuner_callback(gr_feval_ll *t);
-
- //use swig directors to privide a python override
- //virtual void notify_status(int status);
-
- //void set_tuner_callback(gsm_tuner_callback *f);
-
////// General Stats
//TODO: Maybe there should be a burst_stats class?
long d_sync_loss_count;
diff --git a/gsm-tvoid/src/lib/gsm_burst_cf.cc b/gsm-tvoid/src/lib/gsm_burst_cf.cc
index 45b8e3a..08ff7ba 100755
--- a/gsm-tvoid/src/lib/gsm_burst_cf.cc
+++ b/gsm-tvoid/src/lib/gsm_burst_cf.cc
@@ -20,16 +20,15 @@ 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_ll *t, float sample_rate) :
+ gsm_burst(t),
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))),
- gsm_burst(t),
d_clock_counter(0.0),
d_last_sample(0.0,0.0),
d_interp(new gri_mmse_fir_interpolator_cc())
{
- printf("gsm_burst_cf: enter constructor\n");
//clocking parameters
d_sample_interval = 1.0 / sample_rate;
diff --git a/gsm-tvoid/src/lib/gsm_burst_ff.cc b/gsm-tvoid/src/lib/gsm_burst_ff.cc
index 57f104a..d73e73d 100755
--- a/gsm-tvoid/src/lib/gsm_burst_ff.cc
+++ b/gsm-tvoid/src/lib/gsm_burst_ff.cc
@@ -20,12 +20,11 @@ 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_ll *t) :
+ gsm_burst(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))),
- gsm_burst(t)
+ gr_make_io_signature (MIN_OUT, MAX_OUT, USEFUL_BITS * sizeof (float)))
{
- printf("gsm_burst_ff: enter constructor\n");
set_history(1);
diff --git a/gsm-tvoid/src/python/gsm_scan.py b/gsm-tvoid/src/python/gsm_scan.py
index 3e9ac83..cc3c2d6 100755
--- a/gsm-tvoid/src/python/gsm_scan.py
+++ b/gsm-tvoid/src/python/gsm_scan.py
@@ -31,7 +31,7 @@ class burst_callback(gr.feval_ll):
def __init__(self, fg):
gr.feval_ll.__init__(self)
self.fg = fg
-
+
def eval(self, x):
try:
#print "burst_callback: ", x, "\n";
@@ -40,7 +40,7 @@ class burst_callback(gr.feval_ll):
last_offset = self.fg.burst.last_freq_offset()
if last_offset < 200.0:
return 0
-
+
self.fg.offset -= last_offset
print "burst_callback: ADJ_OFFSET:", last_offset, " ARFCN: ", self.fg.arfcn, "\n";
self.fg.set_channel(self.fg.arfcn)
@@ -49,10 +49,10 @@ class burst_callback(gr.feval_ll):
self.fg.set_channel(self.fg.burst.next_arfcn)
return 0
-
+
except Exception, e:
print "burst_callback: Exception: ", e
-
+
def pick_subdevice(u):
if u.db[0][0].dbid() >= 0:
@@ -97,7 +97,6 @@ def get_freq_from_arfcn(chan,region):
return freq * 1e6
-
class app_flow_graph(stdgui.gui_flow_graph):
def __init__(self, frame, panel, vbox, argv):
stdgui.gui_flow_graph.__init__(self)
@@ -117,7 +116,8 @@ class app_flow_graph(stdgui.gui_flow_graph):
help="What to print on console. [default=%default]\n" +
"(n)othing, (e)verything, (s)tatus, (a)ll Types, (k)nown, (u)nknown, \n" +
"TS(0), (F)CCH, (S)CH, (N)ormal, (D)ummy\n" +
- "Usefull (b)its, All TS (B)its, (C)orrelation bits, he(x) burst data")
+ "Usefull (b)its, All TS (B)its, (C)orrelation bits, he(x) burst data, \n" +
+ "(d)ecoded hex for gsmdecode")
#decoder options
@@ -354,10 +354,13 @@ class app_flow_graph(stdgui.gui_flow_graph):
popts |= gsm.PRINT_SCH
if options.print_console.count('N'):
- popts |= gsm.PRINT_SCH
+ popts |= gsm.PRINT_NORMAL
if options.print_console.count('D'):
- popts |= gsm.PRINT_SCH
+ popts |= gsm.PRINT_DUMMY
+
+ if options.print_console.count('d'):
+ popts |= gsm.PRINT_GSM_DECODE
if options.print_console.count('C'):
popts |= gsm.PRINT_BITS | gsm.PRINT_CORR_BITS
@@ -370,6 +373,11 @@ class app_flow_graph(stdgui.gui_flow_graph):
elif options.print_console.count('b'):
popts |= gsm.PRINT_BITS
+
+ if options.print_console.count('d'):
+ popts |= gsm.PRINT_GSM_DECODE
+
+ #TODO: should warn if PRINT_GSM_DECODE is combined with other flags (will corrupt output for gsmdecode)
self.burst.d_print_options = popts
@@ -409,6 +417,9 @@ class app_flow_graph(stdgui.gui_flow_graph):
self.t1.Start(5000,0)
self.frame.Bind(wx.EVT_TIMER, self.on_tick)
+ #bind the idle routing for message_queue processing
+ self.frame.Bind(wx.EVT_IDLE, self.on_idle)
+
def _set_status_msg(self, msg):
self.frame.GetStatusBar().SetStatusText(msg, 0)
@@ -454,7 +465,7 @@ class app_flow_graph(stdgui.gui_flow_graph):
callback=self.set_channel)
vbox.Add(hbox, 0, wx.EXPAND)
-
+
def set_freq(self, freq):
@@ -495,8 +506,6 @@ class app_flow_graph(stdgui.gui_flow_graph):
def print_stats(self):
- self._set_status_msg(self.status_msg)
-
n_total = self.burst.d_total_count
n_unknown = self.burst.d_unknown_count
n_known = n_total - n_unknown
@@ -523,7 +532,11 @@ class app_flow_graph(stdgui.gui_flow_graph):
if self.print_status:
self.print_stats()
-
+
+ def on_idle(self, event):
+ self._set_status_msg(self.status_msg)
+ #print "Idle.\n";
+
def main ():
app = stdgui.stdapp(app_flow_graph, "GSM Scanner", nstatus=1)
app.MainLoop()
personal git repositories of Harald Welte. Your mileage may vary