aboutsummaryrefslogtreecommitdiffstats
path: root/lib
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 /lib
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"
Diffstat (limited to 'lib')
-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
7 files changed, 28 insertions, 48 deletions
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
-)