summaryrefslogtreecommitdiff
path: root/gsm-tvoid
diff options
context:
space:
mode:
Diffstat (limited to 'gsm-tvoid')
-rwxr-xr-xgsm-tvoid/src/lib/gsm.i6
-rwxr-xr-xgsm-tvoid/src/lib/gsm_burst.cc11
-rwxr-xr-xgsm-tvoid/src/lib/gsm_burst.h15
-rwxr-xr-xgsm-tvoid/src/python/gsm_scan.py51
4 files changed, 55 insertions, 28 deletions
diff --git a/gsm-tvoid/src/lib/gsm.i b/gsm-tvoid/src/lib/gsm.i
index 3925d12..76eb189 100755
--- a/gsm-tvoid/src/lib/gsm.i
+++ b/gsm-tvoid/src/lib/gsm.i
@@ -41,6 +41,9 @@
#define CLK_CORR_TRACK 0x00000010 //adjust timing based on correlation offsets
+#define BURST_CB_ADJ_OFFSET 1
+#define BURST_CB_TUNE 2
+
//EQ options
enum EQ_TYPE {
EQ_NONE,
@@ -71,6 +74,8 @@ public:
long d_unknown_count;
long d_total_count;
+ long next_arfcn;
+
int sync_state();
float last_freq_offset(void);
double mean_freq_offset(void);
@@ -78,6 +83,7 @@ public:
//Methods
void full_reset(void);
+
protected:
gsm_burst(gr_feval_ll *);
};
diff --git a/gsm-tvoid/src/lib/gsm_burst.cc b/gsm-tvoid/src/lib/gsm_burst.cc
index 6bec32c..162e12b 100755
--- a/gsm-tvoid/src/lib/gsm_burst.cc
+++ b/gsm-tvoid/src/lib/gsm_burst.cc
@@ -647,6 +647,10 @@ int gsm_burst::get_burst(void)
d_fcch_count++;
calc_freq_offset();
+ if (p_tuner) {
+ p_tuner->calleval(BURST_CB_ADJ_OFFSET);
+ }
+
d_ts = 0;
break;
case PARTIAL_SCH:
@@ -693,13 +697,6 @@ int gsm_burst::get_burst(void)
if (got_burst) {
d_total_count++;
- //do callback
- if (p_tuner) {
- //p_tuner->eval(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 f1b45a6..080899a 100755
--- a/gsm-tvoid/src/lib/gsm_burst.h
+++ b/gsm-tvoid/src/lib/gsm_burst.h
@@ -70,6 +70,10 @@ enum EQ_TYPE {
EQ_VITERBI
};
+#define BURST_CB_ADJ_OFFSET 1
+#define BURST_CB_TUNE 2
+
+
class gsm_burst;
class gsm_burst
@@ -167,12 +171,17 @@ public:
unsigned long d_print_options;
EQ_TYPE d_equalizer_type;
- int sync_state() { return d_sync_state;}
- float last_freq_offset() {return d_freq_offset;}
- double mean_freq_offset(void);
//Methods
void full_reset(void);
+
+ int sync_state() { return d_sync_state;}
+
+ //Frequency
+ float last_freq_offset() {return d_freq_offset;}
+ double mean_freq_offset(void);
+
+ long next_arfcn;
};
diff --git a/gsm-tvoid/src/python/gsm_scan.py b/gsm-tvoid/src/python/gsm_scan.py
index dc3894b..3e9ac83 100755
--- a/gsm-tvoid/src/python/gsm_scan.py
+++ b/gsm-tvoid/src/python/gsm_scan.py
@@ -27,20 +27,31 @@ import wx
import gsm
-#class gsm_tuner(gsm.gsm_tuner_callback):
-class tune(gr.feval_ll):
+class burst_callback(gr.feval_ll):
def __init__(self, fg):
- gr.feval_dd.__init__(self)
+ gr.feval_ll.__init__(self)
self.fg = fg
def eval(self, x):
try:
- #print "tune: ", x, "\n";
- self.fg.cb_count += 1
+ #print "burst_callback: ", x, "\n";
+ if gsm.BURST_CB_ADJ_OFFSET == x:
+ #TODO: rework so this will work on file input
+ 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)
+
+ elif gsm.BURST_CB_TUNE == x:
+ self.fg.set_channel(self.fg.burst.next_arfcn)
+
return 0
except Exception, e:
- print "tune: Exception: ", e
+ print "burst_callback: Exception: ", e
def pick_subdevice(u):
@@ -92,7 +103,7 @@ class app_flow_graph(stdgui.gui_flow_graph):
stdgui.gui_flow_graph.__init__(self)
#testing
- self.cb_count = 0
+ self.status_msg = "Started."
self.frame = frame
self.panel = panel
@@ -238,12 +249,11 @@ class app_flow_graph(stdgui.gui_flow_graph):
self.connect(self.u, self.input_fft_scope)
#create a tuner callback
- self.tuner = tune(self)
- #self._tuner = tune()
+ self.burst_cb = burst_callback(self)
# Setup flow based on decoder selection
if options.decoder.count("c"):
- self.burst = gsm.burst_cf(self.tuner,input_rate)
+ self.burst = gsm.burst_cf(self.burst_cb,input_rate)
self.connect(self.filter, self.burst)
elif options.decoder.count("f"):
@@ -260,7 +270,7 @@ class app_flow_graph(stdgui.gui_flow_graph):
gain_mu,
0.3) #omega_relative_limit,
- self.burst = gsm.burst_ff(self.tuner)
+ self.burst = gsm.burst_ff(self.burst_cb)
self.connect(self.filter, self.demod, self.clocker, self.burst)
if self.scopes.count("d"):
@@ -365,8 +375,8 @@ class app_flow_graph(stdgui.gui_flow_graph):
##########################
#set burst tuning callback
- #self.tuner = gsm_tuner()
- #self.burst.set_tuner_callback(self.tuner)
+ #self.burst_cb = gsm_tuner()
+ #self.burst.set_tuner_callback(self.burst_cb)
# connect the primary path after source
self.v2s = gr.vector_to_stream(gr.sizeof_float,142) #burst output is 142 (USEFUL_BITS)
@@ -456,10 +466,10 @@ class app_flow_graph(stdgui.gui_flow_graph):
r = self.u.tune(0, self.subdev, freq)
if r:
- self._set_status_msg('%f' % (freq/1e6))
+ self.status_msg = '%f' % (freq/1e6)
return True
else:
- self._set_status_msg("Failed to set frequency (%f)" % (freq/1e6))
+ self.status_msg = "Failed to set frequency (%f)" % (freq/1e6)
return False
def set_gain(self, gain):
@@ -471,6 +481,8 @@ class app_flow_graph(stdgui.gui_flow_graph):
def set_channel(self, chan):
+ self.arfcn = chan
+
if not self.using_usrp:
return False
@@ -479,15 +491,19 @@ class app_flow_graph(stdgui.gui_flow_graph):
if freq:
self.set_freq(freq)
else:
- self._set_status_msg("Invalid Channel")
+ self.status_msg = "Invalid Channel"
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
print "======== STATS ========="
- print 'freq_offset: ',self.burst.mean_freq_offset()
+ print 'freq_offset: ',self.offset
+ print 'mean_offset: ',self.burst.mean_freq_offset()
print 'sync_loss_count:',self.burst.d_sync_loss_count
print 'total_bursts: ',n_total
print 'fcch_count: ',self.burst.d_fcch_count
@@ -499,7 +515,6 @@ class app_flow_graph(stdgui.gui_flow_graph):
print 'known_count: ',n_known
if n_total:
print '%known: ', 100.0 * n_known / n_total
- print 'CB count: ',self.cb_count
print ""
def on_tick(self, evt):
personal git repositories of Harald Welte. Your mileage may vary