aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2017-10-17 08:24:25 +0700
committerPiotr Krysik <ptrkrysik@users.noreply.github.com>2017-11-05 17:33:26 +0100
commite601c366bd179f908d4f34da9fe535c2606cac32 (patch)
tree6ac7846752a17c375abda18bb97e08166c784522
parentba7ad29638ecb08af8c7a38dc98c8da715a5fcde (diff)
Refactor the 'TRX Burst Interface' block
The following changes were made: - Both implementation and headers were merged with misc_utils - Fixed namespace mess: was gr::grgsm, became gr::gsm - More accurate class name was chosen: "trx_burst_if"
-rw-r--r--grc/CMakeLists.txt1
-rw-r--r--grc/misc_utils/CMakeLists.txt1
-rw-r--r--grc/misc_utils/gsm_trx_burst_if.xml (renamed from grc/trx_interface/gsm_trx.xml)6
-rw-r--r--grc/trx_interface/CMakeLists.txt22
-rw-r--r--include/grgsm/CMakeLists.txt1
-rw-r--r--include/grgsm/misc_utils/CMakeLists.txt1
-rw-r--r--include/grgsm/misc_utils/trx_burst_if.h (renamed from include/grgsm/trx_interface/trx.h)16
-rw-r--r--lib/CMakeLists.txt1
-rw-r--r--lib/misc_utils/CMakeLists.txt2
-rw-r--r--lib/misc_utils/trx_burst_if_impl.cc (renamed from lib/trx_interface/trx_impl.cc)34
-rw-r--r--lib/misc_utils/trx_burst_if_impl.h (renamed from lib/trx_interface/trx_impl.h)16
-rw-r--r--lib/misc_utils/udp_socket.cc (renamed from lib/trx_interface/udp_socket.cc)0
-rw-r--r--lib/misc_utils/udp_socket.h (renamed from lib/trx_interface/udp_socket.h)0
-rw-r--r--lib/trx_interface/CMakeLists.txt23
-rw-r--r--swig/grgsm_swig.i6
15 files changed, 44 insertions, 86 deletions
diff --git a/grc/CMakeLists.txt b/grc/CMakeLists.txt
index 26a91d5..c3646a2 100644
--- a/grc/CMakeLists.txt
+++ b/grc/CMakeLists.txt
@@ -23,7 +23,6 @@ add_subdirectory(demapping)
add_subdirectory(receiver)
add_subdirectory(flow_control)
add_subdirectory(misc_utils)
-add_subdirectory(trx_interface)
add_subdirectory(transmitter)
install(FILES
gsm_block_tree.xml DESTINATION share/gnuradio/grc/blocks
diff --git a/grc/misc_utils/CMakeLists.txt b/grc/misc_utils/CMakeLists.txt
index adb90d3..9407caf 100644
--- a/grc/misc_utils/CMakeLists.txt
+++ b/grc/misc_utils/CMakeLists.txt
@@ -31,6 +31,7 @@ install(FILES
gsm_burst_file_source.xml
gsm_message_file_sink.xml
gsm_message_file_source.xml
+ gsm_trx_burst_if.xml
gsm_msg_to_tag.xml
gsm_controlled_fractional_resampler_cc.xml DESTINATION share/gnuradio/grc/blocks
)
diff --git a/grc/trx_interface/gsm_trx.xml b/grc/misc_utils/gsm_trx_burst_if.xml
index cbe268c..d3dab5c 100644
--- a/grc/trx_interface/gsm_trx.xml
+++ b/grc/misc_utils/gsm_trx_burst_if.xml
@@ -1,9 +1,9 @@
<?xml version="1.0"?>
<block>
- <name>TRX Interface</name>
- <key>grgsm_trx_interface</key>
+ <name>TRX Burst Interface</name>
+ <key>grgsm_trx_burst_if</key>
<import>import grgsm</import>
- <make>grgsm.trx($remote_addr, $base_port)</make>
+ <make>grgsm.trx_burst_if($remote_addr, $base_port)</make>
<param>
<name>base_port</name>
diff --git a/grc/trx_interface/CMakeLists.txt b/grc/trx_interface/CMakeLists.txt
deleted file mode 100644
index 752b7a7..0000000
--- a/grc/trx_interface/CMakeLists.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-# 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_trx.xml DESTINATION share/gnuradio/grc/blocks
-)
diff --git a/include/grgsm/CMakeLists.txt b/include/grgsm/CMakeLists.txt
index 59034dc..0b58018 100644
--- a/include/grgsm/CMakeLists.txt
+++ b/include/grgsm/CMakeLists.txt
@@ -36,4 +36,3 @@ add_subdirectory(misc_utils)
add_subdirectory(qa_utils)
add_subdirectory(flow_control)
add_subdirectory(transmitter)
-add_subdirectory(trx_interface)
diff --git a/include/grgsm/misc_utils/CMakeLists.txt b/include/grgsm/misc_utils/CMakeLists.txt
index 978695e..8ac1f52 100644
--- a/include/grgsm/misc_utils/CMakeLists.txt
+++ b/include/grgsm/misc_utils/CMakeLists.txt
@@ -34,6 +34,7 @@ install(FILES
message_printer.h
tmsi_dumper.h
msg_to_tag.h
+ trx_burst_if.h
controlled_fractional_resampler_cc.h
time_spec.h
fn_time.h DESTINATION include/grgsm/misc_utils
diff --git a/include/grgsm/trx_interface/trx.h b/include/grgsm/misc_utils/trx_burst_if.h
index c55bf36..18ceef1 100644
--- a/include/grgsm/trx_interface/trx.h
+++ b/include/grgsm/misc_utils/trx_burst_if.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef INCLUDED_GRGSM_TRX_H
-#define INCLUDED_GRGSM_TRX_H
+#ifndef INCLUDED_GRGSM_TRX_BURST_IF_H
+#define INCLUDED_GRGSM_TRX_BURST_IF_H
#include <grgsm/api.h>
#include <gnuradio/sync_block.h>
@@ -34,17 +34,17 @@ namespace gr {
* \ingroup grgsm
*
*/
- class GRGSM_API trx : virtual public gr::block
+ class GRGSM_API trx_burst_if : virtual public gr::block
{
public:
- typedef boost::shared_ptr<trx> sptr;
+ typedef boost::shared_ptr<trx_burst_if> sptr;
/*!
- * \brief Return a shared_ptr to a new instance of grgsm::trx.
+ * \brief Return a shared_ptr to a new instance of grgsm::trx_burst_if.
*
- * To avoid accidental use of raw pointers, grgsm::trx's
+ * To avoid accidental use of raw pointers, grgsm::trx_burst_if's
* constructor is in a private implementation
- * class. grgsm::trx::make is the public interface for
+ * class. grgsm::trx_burst_if::make is the public interface for
* creating new instances.
*/
static sptr make(
@@ -59,5 +59,5 @@ namespace gr {
} // namespace gsm
} // namespace gr
-#endif /* INCLUDED_GRGSM_TRX_H */
+#endif /* INCLUDED_GRGSM_TRX_BURST_IF_H */
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 60758a1..9ca7b88 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -71,7 +71,6 @@ add_subdirectory(misc_utils)
add_subdirectory(qa_utils)
add_subdirectory(receiver)
add_subdirectory(transmitter)
-add_subdirectory(trx_interface)
########################################################################
# Setup library
diff --git a/lib/misc_utils/CMakeLists.txt b/lib/misc_utils/CMakeLists.txt
index 81f2ca8..370f11c 100644
--- a/lib/misc_utils/CMakeLists.txt
+++ b/lib/misc_utils/CMakeLists.txt
@@ -34,5 +34,7 @@ add_sources(
tmsi_dumper_impl.cc
time_spec.cc
fn_time.cc
+ udp_socket.cc
+ trx_burst_if_impl.cc
)
diff --git a/lib/trx_interface/trx_impl.cc b/lib/misc_utils/trx_burst_if_impl.cc
index 8c348ac..432ad2f 100644
--- a/lib/trx_interface/trx_impl.cc
+++ b/lib/misc_utils/trx_burst_if_impl.cc
@@ -28,7 +28,7 @@
#include <boost/lexical_cast.hpp>
#include "udp_socket.h"
-#include "trx_impl.h"
+#include "trx_burst_if_impl.h"
#define BURST_SIZE 148
#define DATA_IF_MTU 160
@@ -46,22 +46,24 @@ static uint8_t rach_synch_seq[] = {
namespace gr {
namespace gsm {
- trx::sptr
- trx::make(
+ trx_burst_if::sptr
+ trx_burst_if::make(
const std::string &remote_addr,
const std::string &base_port)
{
int base_port_int = boost::lexical_cast<int> (base_port);
return gnuradio::get_initial_sptr
- (new trx_impl(remote_addr, base_port_int));
+ (new trx_burst_if_impl(remote_addr, base_port_int));
}
/*
* The private constructor
*/
- trx_impl::trx_impl(const std::string &remote_addr, int base_port)
- : gr::block("trx",
+ trx_burst_if_impl::trx_burst_if_impl(
+ const std::string &remote_addr,
+ int base_port
+ ) : gr::block("trx_burst_if",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(0, 0, 0))
{
@@ -70,7 +72,7 @@ namespace gr {
// Bind a port handler
set_msg_handler(pmt::mp("bursts"),
- boost::bind(&trx_impl::handle_dl_burst, this, _1));
+ boost::bind(&trx_burst_if_impl::handle_dl_burst, this, _1));
// Prepare port numbers
std::string clck_src_port = boost::lexical_cast<std::string> (base_port + 0);
@@ -86,7 +88,7 @@ namespace gr {
// Bind DATA interface handler
d_data_sock->udp_rx_handler = boost::bind(
- &trx_impl::handle_ul_burst, this, _1, _2);
+ &trx_burst_if_impl::handle_ul_burst, this, _1, _2);
// Init timeslot filter
d_ts_filter_tn = -1;
@@ -95,7 +97,7 @@ namespace gr {
/*
* Our virtual destructor.
*/
- trx_impl::~trx_impl()
+ trx_burst_if_impl::~trx_burst_if_impl()
{
// Release all UDP sockets and free memory
delete d_data_sock;
@@ -106,13 +108,13 @@ namespace gr {
* Timeslot filter API (getter and setter)
*/
void
- trx_impl::ts_filter_set_tn(int tn)
+ trx_burst_if_impl::ts_filter_set_tn(int tn)
{
d_ts_filter_tn = (tn >= 0 && tn <= 7) ? tn : -1;
}
int
- trx_impl::ts_filter_get_tn(void)
+ trx_burst_if_impl::ts_filter_get_tn(void)
{
return d_ts_filter_tn;
}
@@ -120,7 +122,7 @@ namespace gr {
/*
* Check if burst is a RACH burst
*/
- bool trx_impl::detect_rach(uint8_t *burst)
+ bool trx_burst_if_impl::detect_rach(uint8_t *burst)
{
// Compare synchronization sequence
for (int i = 0; i < 41; i++)
@@ -139,7 +141,7 @@ namespace gr {
* Create an UDP payload with clock indication
*/
void
- trx_impl::clck_ind_send(uint32_t frame_nr)
+ trx_burst_if_impl::clck_ind_send(uint32_t frame_nr)
{
char buf[20];
size_t n;
@@ -153,7 +155,7 @@ namespace gr {
* and some channel data.
*/
void
- trx_impl::burst_pack(pmt::pmt_t msg, uint8_t *buf)
+ trx_burst_if_impl::burst_pack(pmt::pmt_t msg, uint8_t *buf)
{
pmt::pmt_t header_plus_burst = pmt::cdr(msg);
@@ -200,7 +202,7 @@ namespace gr {
}
void
- trx_impl::handle_dl_burst(pmt::pmt_t msg)
+ trx_burst_if_impl::handle_dl_burst(pmt::pmt_t msg)
{
// 8 bytes of header + 148 bytes of burst
// + two unused, but required bytes
@@ -219,7 +221,7 @@ namespace gr {
}
void
- trx_impl::handle_ul_burst(uint8_t *payload, size_t len)
+ trx_burst_if_impl::handle_ul_burst(uint8_t *payload, size_t len)
{
// Check length according to the protocol
if (len != 154)
diff --git a/lib/trx_interface/trx_impl.h b/lib/misc_utils/trx_burst_if_impl.h
index 6fecf17..23d2264 100644
--- a/lib/trx_interface/trx_impl.h
+++ b/lib/misc_utils/trx_burst_if_impl.h
@@ -20,18 +20,18 @@
*
*/
-#ifndef INCLUDED_GRGSM_TRX_IMPL_H
-#define INCLUDED_GRGSM_TRX_IMPL_H
-
+#ifndef INCLUDED_GRGSM_TRX_BURST_IF_IMPL_H
+#define INCLUDED_GRGSM_TRX_BURST_IF_IMPL_H
+
#include <stddef.h>
#include <grgsm/gsmtap.h>
-#include <grgsm/trx_interface/trx.h>
+#include <grgsm/misc_utils/trx_burst_if.h>
namespace gr {
namespace gsm {
- class trx_impl : public trx
+ class trx_burst_if_impl : public trx_burst_if
{
private:
udp_socket *d_data_sock;
@@ -43,8 +43,8 @@ namespace gr {
void burst_pack(pmt::pmt_t msg, uint8_t *buf);
public:
- trx_impl(const std::string &remote_addr, int base_port);
- ~trx_impl();
+ trx_burst_if_impl(const std::string &remote_addr, int base_port);
+ ~trx_burst_if_impl();
/* Timeslot filter API */
void ts_filter_set_tn(int tn);
@@ -57,5 +57,5 @@ namespace gr {
} // namespace gsm
} // namespace gr
-#endif /* INCLUDED_GRGSM_TRX_IMPL_H */
+#endif /* INCLUDED_GRGSM_TRX_BURST_IF_IMPL_H */
diff --git a/lib/trx_interface/udp_socket.cc b/lib/misc_utils/udp_socket.cc
index 5c689c7..5c689c7 100644
--- a/lib/trx_interface/udp_socket.cc
+++ b/lib/misc_utils/udp_socket.cc
diff --git a/lib/trx_interface/udp_socket.h b/lib/misc_utils/udp_socket.h
index 15b2c66..15b2c66 100644
--- a/lib/trx_interface/udp_socket.h
+++ b/lib/misc_utils/udp_socket.h
diff --git a/lib/trx_interface/CMakeLists.txt b/lib/trx_interface/CMakeLists.txt
deleted file mode 100644
index 12767b9..0000000
--- a/lib/trx_interface/CMakeLists.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-# 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.
-
-add_sources(
- trx_impl.cc
- udp_socket.cc
-)
diff --git a/swig/grgsm_swig.i b/swig/grgsm_swig.i
index 64c1024..4901b44 100644
--- a/swig/grgsm_swig.i
+++ b/swig/grgsm_swig.i
@@ -67,10 +67,10 @@
#include "grgsm/misc_utils/message_file_source.h"
#include "grgsm/misc_utils/msg_to_tag.h"
#include "grgsm/misc_utils/controlled_fractional_resampler_cc.h"
-#include "grgsm/trx_interface/trx.h"
//#include "grgsm/misc_utils/time_spec.h"
#include "grgsm/misc_utils/fn_time.h"
#include "grgsm/transmitter/txtime_setter.h"
+#include "grgsm/misc_utils/trx_burst_if.h"
%}
%include "constants.i"
@@ -140,6 +140,8 @@ GR_SWIG_BLOCK_MAGIC2(gsm, msg_to_tag);
GR_SWIG_BLOCK_MAGIC2(gsm, controlled_fractional_resampler_cc);
%include "grgsm/misc_utils/extract_cmc.h"
GR_SWIG_BLOCK_MAGIC2(gsm, extract_cmc);
+%include "grgsm/misc_utils/trx_burst_if.h"
+GR_SWIG_BLOCK_MAGIC2(gsm, trx_burst_if);
%include "grgsm/qa_utils/burst_sink.h"
@@ -150,8 +152,6 @@ GR_SWIG_BLOCK_MAGIC2(gsm, burst_source);
GR_SWIG_BLOCK_MAGIC2(gsm, message_source);
%include "grgsm/qa_utils/message_sink.h"
GR_SWIG_BLOCK_MAGIC2(gsm, message_sink);
-%include "grgsm/trx_interface/trx.h"
-GR_SWIG_BLOCK_MAGIC2(gsm, trx);
//#pragma SWIG nowarn=319
//%include "grgsm/misc_utils/time_spec.h"