Merged origin/flow-control-100 into dev, fixed conflicts

This commit is contained in:
Roman Khassraf 2015-08-05 13:02:12 +02:00
commit 98da635ccc
28 changed files with 1908 additions and 3 deletions

View File

@ -21,6 +21,7 @@ add_subdirectory(decoding)
add_subdirectory(decryption)
add_subdirectory(demapping)
add_subdirectory(receiver)
add_subdirectory(flow_control)
add_subdirectory(misc_utils)
install(FILES
gsm_block_tree.xml DESTINATION share/gnuradio/grc/blocks

View File

@ -0,0 +1,25 @@
# Copyright 2011,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
install(FILES
gsm_burst_timeslot_splitter.xml
gsm_burst_fnr_filter.xml
gsm_dummy_burst_filter.xml
gsm_burst_sdcch_subslot_splitter.xml DESTINATION share/gnuradio/grc/blocks
)

View File

@ -0,0 +1,42 @@
<?xml version="1.0"?>
<block>
<name>Burst framenumber filter</name>
<key>gsm_burst_fnr_filter</key>
<import>import grgsm</import>
<make>grgsm.burst_fnr_filter($mode, $fnr)</make>
<param>
<name>Mode</name>
<key>mode</key>
<type>enum</type>
<option>
<name>Less or equal</name>
<key>grgsm.FILTER_LESS_OR_EQUAL</key>
</option>
<option>
<name>Greater or equal</name>
<key>grgsm.FILTER_GREATER_OR_EQUAL</key>
</option>
</param>
<param>
<name>Framenumber</name>
<key>fnr</key>
<value>1500123</value>
<type>int</type>
</param>
<sink>
<name>in</name>
<type>message</type>
</sink>
<source>
<name>out</name>
<type>message</type>
<optional>1</optional>
</source>
<doc>
Burst framenumber filter forwards only blocks with a framenumber satisfying the configured mode, i.e. if mode is "Less or equal", then only bursts with a smaller or equal framenumber are forwarded.
</doc>
</block>

View File

@ -0,0 +1,44 @@
<?xml version="1.0"?>
<block>
<name>Burst SDCCH subslot splitter</name>
<key>gsm_burst_sdcch_subslot_splitter</key>
<import>import grgsm</import>
<make>grgsm.burst_sdcch_subslot_splitter(
#if int($ports())==4 #
grgsm.SPLITTER_SDCCH4
#else
grgsm.SPLITTER_SDCCH8
#end if
)</make>
<param>
<name>Mode</name>
<key>ports</key>
<type>enum</type>
<option>
<name>SDCCH/8</name>
<key>8</key>
</option>
<option>
<name>SDCCH/4</name>
<key>4</key>
</option>
</param>
<sink>
<name>in</name>
<type>message</type>
</sink>
<source>
<name>out</name>
<type>message</type>
<nports>$ports</nports>
<optional>1</optional>
</source>
<doc>
Burst SDCCH subslot splitter distributes bursts to eight different output ports depending on the subslots to which the bursts belong.
This means subslot 0 bursts are sent to port out0, subslot 1 bursts on port out1, and so on.
</doc>
</block>

View File

@ -0,0 +1,24 @@
<?xml version="1.0"?>
<block>
<name>Burst timeslot splitter</name>
<key>gsm_burst_timeslot_splitter</key>
<import>import grgsm</import>
<make>grgsm.burst_timeslot_splitter()</make>
<sink>
<name>in</name>
<type>message</type>
</sink>
<source>
<name>out</name>
<type>message</type>
<nports>8</nports>
<optional>1</optional>
</source>
<doc>
Burst timeslot splitter distributes bursts to eight different output ports depending on the timeslots of the bursts.
This means timeslot 0 bursts are sent to port out0, timeslot 1 bursts on port out1, and so on.
</doc>
</block>

View File

@ -0,0 +1,24 @@
<?xml version="1.0"?>
<block>
<name>Dummy burst filter</name>
<key>gsm_dummy_burst_filter</key>
<import>import grgsm</import>
<make>grgsm.dummy_burst_filter()</make>
<sink>
<name>in</name>
<type>message</type>
</sink>
<source>
<name>out</name>
<type>message</type>
<optional>1</optional>
</source>
<doc>
This block filters dummy bursts.
For more information on dummy bursts, see GSM 05.02.
</doc>
</block>

View File

@ -37,6 +37,13 @@
<block>gsm_control_channels_decoder</block>
<block>gsm_tch_f_decoder</block>
</cat>
<cat>
<name>Flow control</name>
<block>gsm_burst_timeslot_splitter</block>
<block>gsm_burst_sdcch_subslot_splitter</block>
<block>gsm_burst_fnr_filter</block>
<block>gsm_dummy_burst_filter</block>
</cat>
<cat>
<name>Utilities</name>
<block>gsm_bursts_printer</block>

View File

@ -33,3 +33,4 @@ add_subdirectory(demapping)
add_subdirectory(receiver)
add_subdirectory(misc_utils)
add_subdirectory(qa_utils)
add_subdirectory(flow_control)

View File

@ -0,0 +1,28 @@
# Copyright 2011,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
########################################################################
# Install public header files
########################################################################
install(FILES
burst_timeslot_splitter.h
burst_sdcch_subslot_splitter.h
burst_fnr_filter.h
dummy_burst_filter.h DESTINATION include/grgsm/flow_control
)

View File

@ -0,0 +1,64 @@
/* -*- c++ -*- */
/*
* @file
* @author Roman Khassraf <rkhassraf@gmail.com>
* @section LICENSE
*
* Gr-gsm is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* Gr-gsm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with gr-gsm; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_GSM_BURST_FNR_FILTER_H
#define INCLUDED_GSM_BURST_FNR_FILTER_H
#include <grgsm/api.h>
#include <gnuradio/block.h>
namespace gr {
namespace gsm {
enum filter_mode
{
FILTER_LESS_OR_EQUAL,
FILTER_GREATER_OR_EQUAL
};
/*!
* \brief <+description of block+>
* \ingroup gsm
*
*/
class GSM_API burst_fnr_filter : virtual public gr::block
{
public:
typedef boost::shared_ptr<burst_fnr_filter> sptr;
/*!
* \brief Return a shared_ptr to a new instance of gsm::burst_fnr_filter.
*
* To avoid accidental use of raw pointers, gsm::burst_fnr_filter's
* constructor is in a private implementation
* class. gsm::burst_fnr_filter::make is the public interface for
* creating new instances.
*/
static sptr make(filter_mode mode, unsigned int fnr);
};
} // namespace gsm
} // namespace gr
#endif /* INCLUDED_GSM_BURST_FNR_FILTER_H */

View File

@ -0,0 +1,61 @@
/* -*- c++ -*- */
/* @file
* @author Roman Khassraf <rkhassraf@gmail.com>
* @section LICENSE
*
* Gr-gsm is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* Gr-gsm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with gr-gsm; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef INCLUDED_GSM_BURST_SDCCH_SUBSLOT_SPLITTER_H
#define INCLUDED_GSM_BURST_SDCCH_SUBSLOT_SPLITTER_H
#include <grgsm/api.h>
#include <gnuradio/block.h>
namespace gr {
namespace gsm {
enum splitter_mode
{
SPLITTER_SDCCH8,
SPLITTER_SDCCH4
};
/*!
* \brief <+description of block+>
* \ingroup gsm
*
*/
class GSM_API burst_sdcch_subslot_splitter : virtual public gr::block
{
public:
typedef boost::shared_ptr<burst_sdcch_subslot_splitter> sptr;
/*!
* \brief Return a shared_ptr to a new instance of grgsm::burst_sdcch_subslot_splitter.
*
* To avoid accidental use of raw pointers, grgsm::burst_sdcch_subslot_splitter's
* constructor is in a private implementation
* class. grgsm::burst_sdcch_subslot_splitter::make is the public interface for
* creating new instances.
*/
static sptr make(splitter_mode mode);
};
} // namespace gsm
} // namespace gr
#endif /* INCLUDED_GSM_BURST_SDCCH_SUBSLOT_SPLITTER_H */

View File

@ -0,0 +1,55 @@
/* -*- c++ -*- */
/* @file
* @author Roman Khassraf <rkhassraf@gmail.com>
* @section LICENSE
*
* Gr-gsm is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* Gr-gsm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with gr-gsm; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef INCLUDED_GSM_BURST_TIMESLOT_SPLITTER_H
#define INCLUDED_GSM_BURST_TIMESLOT_SPLITTER_H
#include <grgsm/api.h>
#include <gnuradio/block.h>
namespace gr {
namespace gsm {
/*!
* \brief <+description of block+>
* \ingroup gsm
*
*/
class GSM_API burst_timeslot_splitter : virtual public gr::block
{
public:
typedef boost::shared_ptr<burst_timeslot_splitter> sptr;
/*!
* \brief Return a shared_ptr to a new instance of grgsm::burst_timeslot_splitter.
*
* To avoid accidental use of raw pointers, grgsm::burst_timeslot_splitter's
* constructor is in a private implementation
* class. grgsm::burst_timeslot_splitter::make is the public interface for
* creating new instances.
*/
static sptr make();
};
} // namespace gsm
} // namespace gr
#endif /* INCLUDED_GSM_BURST_TIMESLOT_SPLITTER_H */

View File

@ -0,0 +1,55 @@
/* -*- c++ -*- */
/* @file
* @author Roman Khassraf <rkhassraf@gmail.com>
* @section LICENSE
*
* Gr-gsm is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* Gr-gsm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with gr-gsm; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef INCLUDED_GSM_DUMMY_BURST_FILTER_H
#define INCLUDED_GSM_DUMMY_BURST_FILTER_H
#include <grgsm/api.h>
#include <gnuradio/block.h>
namespace gr {
namespace gsm {
/*!
* \brief <+description of block+>
* \ingroup gsm
*
*/
class GSM_API dummy_burst_filter : virtual public gr::block
{
public:
typedef boost::shared_ptr<dummy_burst_filter> sptr;
/*!
* \brief Return a shared_ptr to a new instance of grgsm::dummy_burst_filter.
*
* To avoid accidental use of raw pointers, grgsm::dummy_burst_filter's
* constructor is in a private implementation
* class. grgsm::dummy_burst_filter::make is the public interface for
* creating new instances.
*/
static sptr make();
};
} // namespace gsm
} // namespace gr
#endif /* INCLUDED_GSM_DUMMY_BURST_FILTER_H */

View File

@ -46,6 +46,10 @@ list(APPEND grgsm_sources
decoding/GSM660Tables.cpp
decoding/GSM503Tables.cpp
decoding/ViterbiR204.cpp
flow_control/burst_timeslot_splitter_impl.cc
flow_control/burst_sdcch_subslot_splitter_impl.cc
flow_control/burst_fnr_filter_impl.cc
flow_control/dummy_burst_filter_impl.cc
misc_utils/controlled_rotator_cc_impl.cc
misc_utils/controlled_const_source_f_impl.cc
misc_utils/message_printer_impl.cc

View File

@ -0,0 +1,79 @@
/* -*- c++ -*- */
/* @file
* @author Roman Khassraf <rkhassraf@gmail.com>
* @section LICENSE
*
* Gr-gsm is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* Gr-gsm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with gr-gsm; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gnuradio/io_signature.h>
#include "burst_fnr_filter_impl.h"
#include <stdio.h>
#include <grgsm/endian.h>
#include <grgsm/gsmtap.h>
namespace gr {
namespace gsm {
burst_fnr_filter::sptr
burst_fnr_filter::make(filter_mode mode, unsigned int fnr)
{
return gnuradio::get_initial_sptr
(new burst_fnr_filter_impl(mode, fnr));
}
/*
* The private constructor
*/
burst_fnr_filter_impl::burst_fnr_filter_impl(filter_mode mode, unsigned int fnr)
: gr::block("burst_fnr_filter",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(0, 0, 0)),
d_mode(mode),
d_framenr(fnr)
{
message_port_register_in(pmt::mp("in"));
message_port_register_out(pmt::mp("out"));
set_msg_handler(pmt::mp("in"), boost::bind(&burst_fnr_filter_impl::process_burst, this, _1));
}
/*
* Our virtual destructor.
*/
burst_fnr_filter_impl::~burst_fnr_filter_impl() {}
void burst_fnr_filter_impl::process_burst(pmt::pmt_t msg)
{
pmt::pmt_t header_plus_burst = pmt::cdr(msg);
gsmtap_hdr * header = (gsmtap_hdr *)pmt::blob_data(header_plus_burst);
unsigned int frame_nr = be32toh(header->frame_number);
if ((d_mode == FILTER_LESS_OR_EQUAL && frame_nr <= d_framenr)
|| d_mode == FILTER_GREATER_OR_EQUAL && frame_nr >= d_framenr)
{
message_port_pub(pmt::mp("out"), msg);
}
}
} /* namespace gsm */
} /* namespace gr */

View File

@ -0,0 +1,46 @@
/* -*- c++ -*- */
/* @file
* @author Roman Khassraf <rkhassraf@gmail.com>
* @section LICENSE
*
* Gr-gsm is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* Gr-gsm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with gr-gsm; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef INCLUDED_GSM_BURST_FNR_FILTER_IMPL_H
#define INCLUDED_GSM_BURST_FNR_FILTER_IMPL_H
#include <grgsm/flow_control/burst_fnr_filter.h>
namespace gr {
namespace gsm {
class burst_fnr_filter_impl : public burst_fnr_filter
{
private:
unsigned int d_framenr;
filter_mode d_mode;
public:
burst_fnr_filter_impl(filter_mode mode, unsigned int fnr);
~burst_fnr_filter_impl();
void process_burst(pmt::pmt_t msg);
};
} // namespace gsm
} // namespace gr
#endif /* INCLUDED_GSM_BURST_FNR_FILTER_IMPL_H */

View File

@ -0,0 +1,135 @@
/* -*- c++ -*- */
/* @file
* @author Roman Khassraf <rkhassraf@gmail.com>
* @section LICENSE
*
* Gr-gsm is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* Gr-gsm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with gr-gsm; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gnuradio/io_signature.h>
#include "burst_sdcch_subslot_splitter_impl.h"
#include <stdio.h>
#include <grgsm/endian.h>
#include <grgsm/gsmtap.h>
namespace gr {
namespace gsm {
burst_sdcch_subslot_splitter::sptr
burst_sdcch_subslot_splitter::make(splitter_mode mode)
{
return gnuradio::get_initial_sptr
(new burst_sdcch_subslot_splitter_impl(mode));
}
/*
* The private constructor
*/
burst_sdcch_subslot_splitter_impl::burst_sdcch_subslot_splitter_impl(splitter_mode mode)
: gr::block("burst_sdcch_subslot_splitter",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(0, 0, 0)),
d_mode(mode)
{
message_port_register_in(pmt::mp("in"));
message_port_register_out(pmt::mp("out0"));
message_port_register_out(pmt::mp("out1"));
message_port_register_out(pmt::mp("out2"));
message_port_register_out(pmt::mp("out3"));
if (d_mode == SPLITTER_SDCCH8)
{
message_port_register_out(pmt::mp("out4"));
message_port_register_out(pmt::mp("out5"));
message_port_register_out(pmt::mp("out6"));
message_port_register_out(pmt::mp("out7"));
}
set_msg_handler(pmt::mp("in"), boost::bind(&burst_sdcch_subslot_splitter_impl::process_burst, this, _1));
}
/*
* Our virtual destructor.
*/
burst_sdcch_subslot_splitter_impl::~burst_sdcch_subslot_splitter_impl() {}
void burst_sdcch_subslot_splitter_impl::process_burst(pmt::pmt_t msg)
{
pmt::pmt_t header_plus_burst = pmt::cdr(msg);
gsmtap_hdr * header = (gsmtap_hdr *)pmt::blob_data(header_plus_burst);
uint32_t frame_nr = be32toh(header->frame_number);
uint32_t fn_mod102 = frame_nr % 102;
int8_t subslot;
if (d_mode == SPLITTER_SDCCH8)
{
subslot = d_subslots_sdcch8[fn_mod102];
}
else if (d_mode == SPLITTER_SDCCH4)
{
subslot = d_subslots_sdcch4[fn_mod102];
}
if ((subslot == -1) || (d_mode == SPLITTER_SDCCH4 && subslot > 3))
{
return;
}
std::string port("out");
switch (subslot)
{
case 0:
port.append("0");
break;
case 1:
port.append("1");
break;
case 2:
port.append("2");
break;
case 3:
port.append("3");
break;
case 4:
port.append("4");
break;
case 5:
port.append("5");
break;
case 6:
port.append("6");
break;
case 7:
port.append("7");
break;
default:
port.append("0");
break;
}
message_port_pub(pmt::mp(port), msg);
}
} /* namespace gsm */
} /* namespace gr */

View File

@ -0,0 +1,54 @@
/* -*- c++ -*- */
/* @file
* @author Roman Khassraf <rkhassraf@gmail.com>
* @section LICENSE
*
* Gr-gsm is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* Gr-gsm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with gr-gsm; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef INCLUDED_GSM_BURST_SDCCH_SUBSLOT_SPLITTER_IMPL_H
#define INCLUDED_GSM_BURST_SDCCH_SUBSLOT_SPLITTER_IMPL_H
#include <grgsm/flow_control/burst_sdcch_subslot_splitter.h>
namespace gr {
namespace gsm {
class burst_sdcch_subslot_splitter_impl : public burst_sdcch_subslot_splitter
{
private:
// hardcoded subslots of the channels, both SDCCH and the associated SACCH
// -1 means that the particular position in the frame is not SDCCH
const int8_t d_subslots_sdcch4[102] = {
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1
};
const int8_t d_subslots_sdcch8[102] = {
0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1,-1,
0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,-1,-1,-1
};
splitter_mode d_mode;
public:
burst_sdcch_subslot_splitter_impl(splitter_mode mode);
~burst_sdcch_subslot_splitter_impl();
void process_burst(pmt::pmt_t msg);
};
} // namespace gsm
} // namespace gr
#endif /* INCLUDED_GSM_BURST_SDCCH_SUBSLOT_SPLITTER_IMPL_H */

View File

@ -0,0 +1,114 @@
/* -*- c++ -*- */
/* @file
* @author Roman Khassraf <rkhassraf@gmail.com>
* @section LICENSE
*
* Gr-gsm is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* Gr-gsm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with gr-gsm; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gnuradio/io_signature.h>
#include "burst_timeslot_splitter_impl.h"
#include <stdio.h>
#include <grgsm/endian.h>
#include <grgsm/gsmtap.h>
namespace gr {
namespace gsm {
burst_timeslot_splitter::sptr
burst_timeslot_splitter::make()
{
return gnuradio::get_initial_sptr
(new burst_timeslot_splitter_impl());
}
/*
* The private constructor
*/
burst_timeslot_splitter_impl::burst_timeslot_splitter_impl()
: gr::block("burst_timeslot_splitter",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(0, 0, 0))
{
message_port_register_in(pmt::mp("in"));
message_port_register_out(pmt::mp("out0"));
message_port_register_out(pmt::mp("out1"));
message_port_register_out(pmt::mp("out2"));
message_port_register_out(pmt::mp("out3"));
message_port_register_out(pmt::mp("out4"));
message_port_register_out(pmt::mp("out5"));
message_port_register_out(pmt::mp("out6"));
message_port_register_out(pmt::mp("out7"));
set_msg_handler(pmt::mp("in"), boost::bind(&burst_timeslot_splitter_impl::process_burst, this, _1));
}
/*
* Our virtual destructor.
*/
burst_timeslot_splitter_impl::~burst_timeslot_splitter_impl() {}
void burst_timeslot_splitter_impl::process_burst(pmt::pmt_t msg)
{
pmt::pmt_t header_plus_burst = pmt::cdr(msg);
gsmtap_hdr * header = (gsmtap_hdr *)pmt::blob_data(header_plus_burst);
unsigned int timeslot = header->timeslot;
std::string port("out");
switch (timeslot)
{
case 0:
port.append("0");
break;
case 1:
port.append("1");
break;
case 2:
port.append("2");
break;
case 3:
port.append("3");
break;
case 4:
port.append("4");
break;
case 5:
port.append("5");
break;
case 6:
port.append("6");
break;
case 7:
port.append("7");
break;
default:
port.append("0");
break;
}
message_port_pub(pmt::mp(port), msg);
}
} /* namespace gsm */
} /* namespace gr */

View File

@ -0,0 +1,43 @@
/* -*- c++ -*- */
/* @file
* @author Roman Khassraf <rkhassraf@gmail.com>
* @section LICENSE
*
* Gr-gsm is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* Gr-gsm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with gr-gsm; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef INCLUDED_GSM_BURST_TIMESLOT_SPLITTER_IMPL_H
#define INCLUDED_GSM_BURST_TIMESLOT_SPLITTER_IMPL_H
#include <grgsm/flow_control/burst_timeslot_splitter.h>
namespace gr {
namespace gsm {
class burst_timeslot_splitter_impl : public burst_timeslot_splitter
{
public:
burst_timeslot_splitter_impl();
~burst_timeslot_splitter_impl();
void process_burst(pmt::pmt_t msg);
};
} // namespace gsm
} // namespace gr
#endif /* INCLUDED_GSM_BURST_TIMESLOT_SPLITTER_IMPL_H */

View File

@ -0,0 +1,105 @@
/* -*- c++ -*- */
/* @file
* @author Roman Khassraf <rkhassraf@gmail.com>
* @section LICENSE
*
* Gr-gsm is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* Gr-gsm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with gr-gsm; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gnuradio/io_signature.h>
#include "dummy_burst_filter_impl.h"
#include <stdio.h>
#include <grgsm/endian.h>
#include <grgsm/gsmtap.h>
namespace gr {
namespace gsm {
// dummy burst defined in gsm 05.02, section 5.2.6
const int8_t dummy_burst_filter_impl::d_dummy_burst[] = {0,0,0,
1,1,1,1,1,0,1,1,0,1,1,1,0,1,1,0,
0,0,0,0,1,0,1,0,0,1,0,0,1,1,1,0,
0,0,0,0,1,0,0,1,0,0,0,1,0,0,0,0,
0,0,0,1,1,1,1,1,0,0,0,1,1,1,0,0,
0,1,0,1,1,1,0,0,0,1,0,1,1,1,0,0,
0,1,0,1,0,1,1,1,0,1,0,0,1,0,1,0,
0,0,1,1,0,0,1,1,0,0,1,1,1,0,0,1,
1,1,1,0,1,0,0,1,1,1,1,1,0,0,0,1,
0,0,1,0,1,1,1,1,1,0,1,0,1,0,
0,0,0 };
dummy_burst_filter::sptr
dummy_burst_filter::make()
{
return gnuradio::get_initial_sptr
(new dummy_burst_filter_impl());
}
/*
* The private constructor
*/
dummy_burst_filter_impl::dummy_burst_filter_impl()
: gr::block("dummy_burst_filter",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(0, 0, 0))
{
message_port_register_in(pmt::mp("in"));
message_port_register_out(pmt::mp("out"));
set_msg_handler(pmt::mp("in"), boost::bind(&dummy_burst_filter_impl::process_burst, this, _1));
}
/*
* Our virtual destructor.
*/
dummy_burst_filter_impl::~dummy_burst_filter_impl() {}
void dummy_burst_filter_impl::process_burst(pmt::pmt_t msg)
{
pmt::pmt_t header_plus_burst = pmt::cdr(msg);
int8_t * burst = (int8_t *)(pmt::blob_data(header_plus_burst)) + sizeof(gsmtap_hdr);
size_t burst_len = pmt::blob_length(header_plus_burst) - sizeof(gsmtap_hdr);
if (!is_dummy_burst(burst, burst_len))
{
message_port_pub(pmt::mp("out"), msg);
}
}
bool dummy_burst_filter_impl::is_dummy_burst(int8_t *burst, size_t burst_len)
{
if (burst_len != DUMMY_BURST_LEN)
{
return false;
}
for (int i=0; i<DUMMY_BURST_LEN; i++)
{
if (burst[i] != d_dummy_burst[i])
{
return false;
}
}
return true;
}
} /* namespace gsm */
} /* namespace gr */

View File

@ -0,0 +1,48 @@
/* -*- c++ -*- */
/* @file
* @author Roman Khassraf <rkhassraf@gmail.com>
* @section LICENSE
*
* Gr-gsm is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* Gr-gsm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with gr-gsm; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef INCLUDED_GSM_DUMMY_BURST_FILTER_IMPL_H
#define INCLUDED_GSM_DUMMY_BURST_FILTER_IMPL_H
#define DUMMY_BURST_LEN 148
#include <grgsm/flow_control/dummy_burst_filter.h>
namespace gr {
namespace gsm {
class dummy_burst_filter_impl : public dummy_burst_filter
{
private:
bool is_dummy_burst(int8_t *burst, size_t burst_len);
static const int8_t d_dummy_burst[];
public:
dummy_burst_filter_impl();
~dummy_burst_filter_impl();
void process_burst(pmt::pmt_t msg);
};
} // namespace gsm
} // namespace gr
#endif /* INCLUDED_GSM_DUMMY_BURST_FILTER_IMPL_H */

View File

@ -49,5 +49,7 @@ set(GR_TEST_PYTHON_DIRS ${CMAKE_BINARY_DIR}/swig)
GR_ADD_TEST(qa_decryption ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_decryption.py)
GR_ADD_TEST(qa_burst_printer ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_burst_printer.py)
GR_ADD_TEST(qa_message_printer ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_message_printer.py)
#GR_ADD_TEST(qa_receiver ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_receiver.py)
#GR_ADD_TEST(qa_receiver_hier ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_receiver_hier.py)
GR_ADD_TEST(qa_burst_timeslot_splitter ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_burst_timeslot_splitter.py)
GR_ADD_TEST(qa_burst_sdcch_subslot_splitter ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_burst_sdcch_subslot_splitter.py)
GR_ADD_TEST(qa_burst_fnr_filter ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_burst_fnr_filter.py)
GR_ADD_TEST(qa_dummy_burst_filter ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_dummy_burst_filter.py)

168
python/qa_burst_fnr_filter.py Executable file
View File

@ -0,0 +1,168 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @file
# @author Roman Khassraf <rkhassraf@gmail.com>
# @section LICENSE
#
# Gr-gsm is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# Gr-gsm is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with gr-gsm; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
#
#
from gnuradio import gr, gr_unittest, blocks
import grgsm
import pmt
class qa_burst_fnr_filter (gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
def tearDown (self):
self.tb = None
def test_001_less_or_equal (self):
"""
filter mode less_or_equal, limiting frame number 1500123
25 random framenumbers, timeslots and bursts as input
"""
framenumbers_input = [1259192, 1076346, 1076242, 235879, 1259218, 2194302, 2714322, 1588, 1259244, 1563637, 1435624, 1928543, 503726, 1571144, 2658397, 1807445, 869789, 624070, 2005511, 1306953, 2284894, 1600339, 551375, 1259270, 1500123]
timeslots_input = [6, 3, 4, 3, 5, 3, 2, 7, 1, 6, 0, 7, 2, 3, 2, 0, 7, 1, 0, 6, 0, 6, 5, 7, 0]
bursts_input = [
"0001100001000111100111101111100101000100101011000010011110011101001111101100010100111111100000110100011111101011101100100111110011000100010001010000",
"0001000101000000001001111110000110010110110111110111101000001101001111101100010100111111001110001001110101110001010001000111011010010001011011000000",
"0001001101101101000111001000101011001101001110110001001100111101001111101100010100111111111001001010011010011111010010010101011001001011011100110000",
"0000010010100000001001101010100001011100010001101100111111101101001111101100010100111111101101001110100010101110010110101111100010010000110010110000",
"0000010101010110010011110101010101101100000000001000100100101010000111011101001000011101011101110000101011001111000100001000000000001110010001111000",
"0001000000000010111010100000010101000010001010111010000000011010000111011101001000011101000000100010111110101000000001000000000010111010100000000000",
"0001010101111111111010000001010101011111111111101000000001001010000111011101001000011101010111111111111010101000000001010101011011101010000001000000",
"0000000000111110101010100001000000100010101110101010000101001010000111011101001000011101001010001111101010001000010000000000101110101010100000010000",
"0000010000000010000001001000011001010010000011000101000000001010000111011101001000011101010100100000000001001000001000000100100011000101001000111000",
"0001010100110111100000110111100110010100011100011000110110001010000111011101001000011101011111111001111001101010010100000000011111001101000111110000",
"0001100110000001011110001000001100101001010100111111000100111010000111011101001000011101000011010010001010111101000100110011111010100010010101000000",
"0000010101100101010110000011010000000000000010111001110110101010000111011101001000011101000001000100100001111001100011000101010001110001010100111000",
"0001000100000011001010111001111100011010000000000000001001001010000111011101001000011101010110000101111010011001110110001001011010101000011110110000",
"0001100001000111111111100001011000000011010110111010110000111010000111011101001000011101100010111100100101110001101000110100110000001010101110011000",
"0000000100111011000000000010100100001100101010000000010010101010000111011101001000011101000110110001110110000100110100110110011001100100000101100000",
"0000100101111010011110111010100111010100011011011101100111001010000111011101001000011101010000111010000110100000001000010011101011001001110100011000",
"0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
"0000110101000011011010110000110011010000000001001010110010001010000111011101001000011101010000011000111001101110000000110010100001101110101000100000",
"0000001000010001011111111111101010100000010101011101101010101010000111011101001000011101100010010101010101011110101010101000010001011101111010101000",
"0000101110101111011001011001000011110010100010011100110010001010000111011101001000011101100000001110000100010100110111001001100010101101100010101000",
"0001100010000001000111011100101101101010100001111101001000101010000111011101001000011101111010000011010110010111011111010010001000001101100011111000",
"0001011101101101011100001111001100010001000011011001101110011010000111011101001000011101010010111011100111000001011100100001111010100101111000100000",
"0000001000100011000000000000110100000000010000001010100100001010000111011101001000011101000010010000000000001001000001011000000001010000000100010000",
"0000100000110001000000000100000110001011100001001000000000001010000111011101001000011101001010010001010000000111010000000011000001000000000101010000",
"0000100000110001000000000101000100001010100001001000000000001010000111011101001000011101001010010001101011001011101111101000010001000000000101010000"
]
bursts_expected = [
"0001100001000111100111101111100101000100101011000010011110011101001111101100010100111111100000110100011111101011101100100111110011000100010001010000",
"0001000101000000001001111110000110010110110111110111101000001101001111101100010100111111001110001001110101110001010001000111011010010001011011000000",
"0001001101101101000111001000101011001101001110110001001100111101001111101100010100111111111001001010011010011111010010010101011001001011011100110000",
"0000010010100000001001101010100001011100010001101100111111101101001111101100010100111111101101001110100010101110010110101111100010010000110010110000",
"0000010101010110010011110101010101101100000000001000100100101010000111011101001000011101011101110000101011001111000100001000000000001110010001111000",
"0000000000111110101010100001000000100010101110101010000101001010000111011101001000011101001010001111101010001000010000000000101110101010100000010000",
"0000010000000010000001001000011001010010000011000101000000001010000111011101001000011101010100100000000001001000001000000100100011000101001000111000",
"0001100110000001011110001000001100101001010100111111000100111010000111011101001000011101000011010010001010111101000100110011111010100010010101000000",
"0001000100000011001010111001111100011010000000000000001001001010000111011101001000011101010110000101111010011001110110001001011010101000011110110000",
"0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
"0000110101000011011010110000110011010000000001001010110010001010000111011101001000011101010000011000111001101110000000110010100001101110101000100000",
"0000101110101111011001011001000011110010100010011100110010001010000111011101001000011101100000001110000100010100110111001001100010101101100010101000",
"0000001000100011000000000000110100000000010000001010100100001010000111011101001000011101000010010000000000001001000001011000000001010000000100010000",
"0000100000110001000000000100000110001011100001001000000000001010000111011101001000011101001010010001010000000111010000000011000001000000000101010000",
"0000100000110001000000000101000100001010100001001000000000001010000111011101001000011101001010010001101011001011101111101000010001000000000101010000"
]
fnr_filter = grgsm.burst_fnr_filter(grgsm.FILTER_LESS_OR_EQUAL, 1500123)
src = grgsm.burst_source_qa(framenumbers_input, timeslots_input, bursts_input)
sink = grgsm.burst_sink_qa()
self.tb.msg_connect(src, "out", fnr_filter, "in")
self.tb.msg_connect(fnr_filter, "out", sink, "in")
self.tb.run ()
bursts_result = list(sink.get_burst_data())
self.assertEqual(bursts_expected, bursts_result)
def test_002_greater_or_equal (self):
"""
filter mode greater_or_equal, limiting frame number 1500123
25 random framenumbers, timeslots and bursts as input
"""
framenumbers_input = [1259192, 1076346, 1076242, 235879, 1259218, 2194302, 2714322, 1588, 1259244, 1563637, 1435624, 1928543, 503726, 1571144, 2658397, 1807445, 869789, 624070, 2005511, 1306953, 2284894, 1600339, 551375, 1259270, 1500123]
timeslots_input = [6, 3, 4, 3, 5, 3, 2, 7, 1, 6, 0, 7, 2, 3, 2, 0, 7, 1, 0, 6, 0, 6, 5, 7, 0]
bursts_input = [
"0001100001000111100111101111100101000100101011000010011110011101001111101100010100111111100000110100011111101011101100100111110011000100010001010000",
"0001000101000000001001111110000110010110110111110111101000001101001111101100010100111111001110001001110101110001010001000111011010010001011011000000",
"0001001101101101000111001000101011001101001110110001001100111101001111101100010100111111111001001010011010011111010010010101011001001011011100110000",
"0000010010100000001001101010100001011100010001101100111111101101001111101100010100111111101101001110100010101110010110101111100010010000110010110000",
"0000010101010110010011110101010101101100000000001000100100101010000111011101001000011101011101110000101011001111000100001000000000001110010001111000",
"0001000000000010111010100000010101000010001010111010000000011010000111011101001000011101000000100010111110101000000001000000000010111010100000000000",
"0001010101111111111010000001010101011111111111101000000001001010000111011101001000011101010111111111111010101000000001010101011011101010000001000000",
"0000000000111110101010100001000000100010101110101010000101001010000111011101001000011101001010001111101010001000010000000000101110101010100000010000",
"0000010000000010000001001000011001010010000011000101000000001010000111011101001000011101010100100000000001001000001000000100100011000101001000111000",
"0001010100110111100000110111100110010100011100011000110110001010000111011101001000011101011111111001111001101010010100000000011111001101000111110000",
"0001100110000001011110001000001100101001010100111111000100111010000111011101001000011101000011010010001010111101000100110011111010100010010101000000",
"0000010101100101010110000011010000000000000010111001110110101010000111011101001000011101000001000100100001111001100011000101010001110001010100111000",
"0001000100000011001010111001111100011010000000000000001001001010000111011101001000011101010110000101111010011001110110001001011010101000011110110000",
"0001100001000111111111100001011000000011010110111010110000111010000111011101001000011101100010111100100101110001101000110100110000001010101110011000",
"0000000100111011000000000010100100001100101010000000010010101010000111011101001000011101000110110001110110000100110100110110011001100100000101100000",
"0000100101111010011110111010100111010100011011011101100111001010000111011101001000011101010000111010000110100000001000010011101011001001110100011000",
"0001111101101110110000010100100111000001001000100000001111100011100010111000101110001010111010010100011001100111001111010011111000100101111101010000",
"0000110101000011011010110000110011010000000001001010110010001010000111011101001000011101010000011000111001101110000000110010100001101110101000100000",
"0000001000010001011111111111101010100000010101011101101010101010000111011101001000011101100010010101010101011110101010101000010001011101111010101000",
"0000101110101111011001011001000011110010100010011100110010001010000111011101001000011101100000001110000100010100110111001001100010101101100010101000",
"0001100010000001000111011100101101101010100001111101001000101010000111011101001000011101111010000011010110010111011111010010001000001101100011111000",
"0001011101101101011100001111001100010001000011011001101110011010000111011101001000011101010010111011100111000001011100100001111010100101111000100000",
"0000001000100011000000000000110100000000010000001010100100001010000111011101001000011101000010010000000000001001000001011000000001010000000100010000",
"0000100000110001000000000100000110001011100001001000000000001010000111011101001000011101001010010001010000000111010000000011000001000000000101010000",
"0000100000110001000000000101000100001010100001001000000000001010000111011101001000011101001010010001101011001011101111101000010001000000000101010000"
]
bursts_expected = [
"0001000000000010111010100000010101000010001010111010000000011010000111011101001000011101000000100010111110101000000001000000000010111010100000000000",
"0001010101111111111010000001010101011111111111101000000001001010000111011101001000011101010111111111111010101000000001010101011011101010000001000000",
"0001010100110111100000110111100110010100011100011000110110001010000111011101001000011101011111111001111001101010010100000000011111001101000111110000",
"0000010101100101010110000011010000000000000010111001110110101010000111011101001000011101000001000100100001111001100011000101010001110001010100111000",
"0001100001000111111111100001011000000011010110111010110000111010000111011101001000011101100010111100100101110001101000110100110000001010101110011000",
"0000000100111011000000000010100100001100101010000000010010101010000111011101001000011101000110110001110110000100110100110110011001100100000101100000",
"0000100101111010011110111010100111010100011011011101100111001010000111011101001000011101010000111010000110100000001000010011101011001001110100011000",
"0000001000010001011111111111101010100000010101011101101010101010000111011101001000011101100010010101010101011110101010101000010001011101111010101000",
"0001100010000001000111011100101101101010100001111101001000101010000111011101001000011101111010000011010110010111011111010010001000001101100011111000",
"0001011101101101011100001111001100010001000011011001101110011010000111011101001000011101010010111011100111000001011100100001111010100101111000100000",
"0000100000110001000000000101000100001010100001001000000000001010000111011101001000011101001010010001101011001011101111101000010001000000000101010000"
]
fnr_filter = grgsm.burst_fnr_filter(grgsm.FILTER_GREATER_OR_EQUAL, 1500123)
src = grgsm.burst_source_qa(framenumbers_input, timeslots_input, bursts_input)
sink = grgsm.burst_sink_qa()
self.tb.msg_connect(src, "out", fnr_filter, "in")
self.tb.msg_connect(fnr_filter, "out", sink, "in")
self.tb.run ()
bursts_result = list(sink.get_burst_data())
self.assertEqual(bursts_expected, bursts_result)
if __name__ == '__main__':
gr_unittest.run(qa_burst_fnr_filter, "qa_burst_fnr_filter.xml")

View File

@ -0,0 +1,401 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @file
# @author Roman Khassraf <rkhassraf@gmail.com>
# @section LICENSE
#
# Gr-gsm is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# Gr-gsm is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with gr-gsm; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
#
#
from gnuradio import gr, gr_unittest, blocks
import grgsm
import pmt
class qa_burst_sdcch_subslot_splitter (gr_unittest.TestCase):
# 102 random bursts as test input
bursts_input = [
'0000111100101011111011010010011001000100001001110110000110110001011011101111000100101111111000110000001111111111000111100100011111010100010011111000',
'0001111110000000110110101010001000101000001101111100101100110010001111011010001000111100001010011101000111010111000100000111001111110011000011011000',
'0001101110111011011011011010000001011011001011000100100110010101001111101100010100111110110011001100100011111010110111011001000111101011100001111000',
'0000001011100110100011110111010101111000011111001011010011110000110101110010000011010110010011111001000110001111111010111011011001101010001100110000',
'0001011001110011011101111111100110110111011101001110111110000101001111101100010100111110001111100000000110001000010000010111111011110101100000111000',
'0001110110011011010011100010101010000100011000001111110101111101001111101100010100111110100001001101000100000001011001010110011111100010001111001000',
'0001101100101101011110011001110110011100001100100100100110000010001111011010001000111101101101001100100001110001011001000001100000011111101000011000',
'0000101100001011101001010001111001000000010100000111100110101000110101110010000011010110110000110010100011001111101101101001110111101001000011111000',
'0000011011010111011111101100010100110110000001100011100001010001011011101111000100101110001110000011001100100101111000001010000101010000110101110000',