diff options
Diffstat (limited to 'gsm-tvoid/src/lib/gsm_burst.cc')
-rwxr-xr-x | gsm-tvoid/src/lib/gsm_burst.cc | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/gsm-tvoid/src/lib/gsm_burst.cc b/gsm-tvoid/src/lib/gsm_burst.cc index f367de2..5415b2f 100755 --- a/gsm-tvoid/src/lib/gsm_burst.cc +++ b/gsm-tvoid/src/lib/gsm_burst.cc @@ -9,6 +9,8 @@ #include <memory.h> #include <gsm_burst.h> #include <assert.h> +#include "system.h" +#include "gsmstack.h" gsm_burst::gsm_burst (void) : d_bbuf_pos(0), @@ -67,6 +69,8 @@ gsm_burst::gsm_burst (void) : fprintf(stdout,"\n"); } + /* Initialize GSM Stack */ + GS_new(&d_gs_ctx); } gsm_burst::~gsm_burst () @@ -99,6 +103,16 @@ void gsm_burst::print_bits(const float *data,int length) data[i] < 0 ? fprintf(stdout,"+") : fprintf(stdout,"."); } +void gsm_burst::soft2hardbit(char *dst, const float *data, int len) +{ + for (int i=0; i < len; i++) + { + if (data[i] < 0) + dst[i] = 0; + else + dst[i] = 1; + } +} void gsm_burst::print_burst(void) { @@ -125,13 +139,32 @@ void gsm_burst::print_burst(void) if ( print && (d_print_options & PRINT_BITS) ) { if (d_print_options & PRINT_ALL_BITS) + { print_bits(d_burst_buffer,BBUF_SIZE); - else + } else { + /* 142 useful bits: 2*58 + 26 training */ print_bits(d_burst_buffer + d_burst_start,USEFUL_BITS); + } fprintf(stdout," "); } + /* + * 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(stdout,"%d/%d/%+d/%lu/%lu ", |