Implement the 'burst_to_fn_time' block in C++
This commit is contained in:
parent
d222ee58bb
commit
0aafe2856d
|
@ -1,19 +1,17 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<block>
|
<block>
|
||||||
<name>Burst to fn_time</name>
|
<name>Burst to FN time</name>
|
||||||
<key>gsm_burst_to_fn_time</key>
|
<key>gsm_burst_to_fn_time</key>
|
||||||
<import>import grgsm</import>
|
<import>import grgsm</import>
|
||||||
<make>grgsm.burst_to_fn_time()</make>
|
<make>grgsm.gsm_burst_to_fn_time()</make>
|
||||||
|
|
||||||
<sink>
|
<sink>
|
||||||
<name>bursts_in</name>
|
<name>bursts_in</name>
|
||||||
<type>message</type>
|
<type>message</type>
|
||||||
<optional>1</optional>
|
|
||||||
</sink>
|
</sink>
|
||||||
|
|
||||||
<source>
|
<source>
|
||||||
<name>fn_time_out</name>
|
<name>fn_time_out</name>
|
||||||
<type>message</type>
|
<type>message</type>
|
||||||
<optional>1</optional>
|
|
||||||
</source>
|
</source>
|
||||||
</block>
|
</block>
|
||||||
|
|
|
@ -35,6 +35,7 @@ install(FILES
|
||||||
tmsi_dumper.h
|
tmsi_dumper.h
|
||||||
msg_to_tag.h
|
msg_to_tag.h
|
||||||
trx_burst_if.h
|
trx_burst_if.h
|
||||||
|
burst_to_fn_time.h
|
||||||
controlled_fractional_resampler_cc.h
|
controlled_fractional_resampler_cc.h
|
||||||
time_spec.h
|
time_spec.h
|
||||||
fn_time.h DESTINATION include/grgsm/misc_utils
|
fn_time.h DESTINATION include/grgsm/misc_utils
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
/* -*- c++ -*- */
|
||||||
|
/* @file
|
||||||
|
* @author Piotr Krysik <ptrkrysik@gmail.com>
|
||||||
|
* @author Vadim Yanitskiy <axilirator@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_GRGSM_BURST_TO_FN_TIME_H
|
||||||
|
#define INCLUDED_GRGSM_BURST_TO_FN_TIME_H
|
||||||
|
|
||||||
|
#include <grgsm/api.h>
|
||||||
|
#include <gnuradio/block.h>
|
||||||
|
|
||||||
|
namespace gr {
|
||||||
|
namespace gsm {
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief <+description of block+>
|
||||||
|
* \ingroup gsm
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class GRGSM_API burst_to_fn_time : virtual public gr::block
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef boost::shared_ptr<burst_to_fn_time> sptr;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return a shared_ptr to a new instance of grgsm::burst_to_fn_time.
|
||||||
|
*
|
||||||
|
* To avoid accidental use of raw pointers, grgsm::burst_to_fn_time's
|
||||||
|
* constructor is in a private implementation
|
||||||
|
* class. grgsm::burst_to_fn_time::make is the public interface for
|
||||||
|
* creating new instances.
|
||||||
|
*/
|
||||||
|
static sptr make();
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace gsm
|
||||||
|
} // namespace gr
|
||||||
|
|
||||||
|
#endif /* INCLUDED_GRGSM_BURST_TO_FN_TIME_H */
|
|
@ -36,5 +36,6 @@ add_sources(
|
||||||
fn_time.cc
|
fn_time.cc
|
||||||
udp_socket.cc
|
udp_socket.cc
|
||||||
trx_burst_if_impl.cc
|
trx_burst_if_impl.cc
|
||||||
|
burst_to_fn_time_impl.cc
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
/* -*- c++ -*- */
|
||||||
|
/* @file
|
||||||
|
* @author Piotr Krysik <ptrkrysik@gmail.com>
|
||||||
|
* @author Vadim Yanitskiy <axilirator@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_to_fn_time_impl.h"
|
||||||
|
|
||||||
|
namespace gr {
|
||||||
|
namespace gsm {
|
||||||
|
|
||||||
|
burst_to_fn_time::sptr
|
||||||
|
burst_to_fn_time::make(void)
|
||||||
|
{
|
||||||
|
return gnuradio::get_initial_sptr
|
||||||
|
(new burst_to_fn_time_impl());
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The private constructor
|
||||||
|
*/
|
||||||
|
burst_to_fn_time_impl::burst_to_fn_time_impl(void)
|
||||||
|
: gr::block("burst_to_fn_time",
|
||||||
|
gr::io_signature::make(0, 0, 0),
|
||||||
|
gr::io_signature::make(0, 0, 0))
|
||||||
|
{
|
||||||
|
// Register I/O ports
|
||||||
|
message_port_register_in(pmt::mp("bursts_in"));
|
||||||
|
message_port_register_out(pmt::mp("fn_time_out"));
|
||||||
|
|
||||||
|
// Bind a port handler
|
||||||
|
set_msg_handler(pmt::mp("bursts_in"),
|
||||||
|
boost::bind(&burst_to_fn_time_impl::handle_burst, this, _1));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Our virtual destructor.
|
||||||
|
*/
|
||||||
|
burst_to_fn_time_impl::~burst_to_fn_time_impl()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
burst_to_fn_time_impl::handle_burst(pmt::pmt_t msg_in)
|
||||||
|
{
|
||||||
|
// Obtain fn_time tag from message
|
||||||
|
pmt::pmt_t blob = pmt::car(msg_in);
|
||||||
|
pmt::pmt_t fn_time = pmt::dict_ref(blob,
|
||||||
|
pmt::intern("fn_time"), pmt::PMT_NIL);
|
||||||
|
|
||||||
|
// Drop messages without required tag
|
||||||
|
if (fn_time == pmt::PMT_NIL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Compose and send a new message
|
||||||
|
pmt::pmt_t msg_out = pmt::dict_add(pmt::make_dict(),
|
||||||
|
pmt::intern("fn_time"), fn_time);
|
||||||
|
message_port_pub(pmt::mp("fn_time_out"), msg_out);
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace gsm */
|
||||||
|
} /* namespace gr */
|
|
@ -0,0 +1,45 @@
|
||||||
|
/* -*- c++ -*- */
|
||||||
|
/* @file
|
||||||
|
* @author Piotr Krysik <ptrkrysik@gmail.com>
|
||||||
|
* @author Vadim Yanitskiy <axilirator@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_GRGSM_BURST_TO_FN_TIME_IMPL_H
|
||||||
|
#define INCLUDED_GRGSM_BURST_TO_FN_TIME_IMPL_H
|
||||||
|
|
||||||
|
#include <grgsm/misc_utils/burst_to_fn_time.h>
|
||||||
|
|
||||||
|
namespace gr {
|
||||||
|
namespace gsm {
|
||||||
|
|
||||||
|
class burst_to_fn_time_impl : public burst_to_fn_time
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
void handle_burst(pmt::pmt_t msg_in);
|
||||||
|
|
||||||
|
public:
|
||||||
|
burst_to_fn_time_impl(void);
|
||||||
|
~burst_to_fn_time_impl(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace gsm
|
||||||
|
} // namespace gr
|
||||||
|
|
||||||
|
#endif /* INCLUDED_GRGSM_BURST_TO_FN_TIME_IMPL_H */
|
|
@ -58,7 +58,6 @@ from gsm_sdcch8_demapper import gsm_sdcch8_demapper
|
||||||
from gsm_gmsk_mod import gsm_gmsk_mod
|
from gsm_gmsk_mod import gsm_gmsk_mod
|
||||||
from fn_time import *
|
from fn_time import *
|
||||||
from txtime_bursts_tagger import *
|
from txtime_bursts_tagger import *
|
||||||
from burst_to_fn_time import *
|
|
||||||
import arfcn
|
import arfcn
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,5 @@ GR_PYTHON_INSTALL(
|
||||||
clock_offset_corrector_tagged.py
|
clock_offset_corrector_tagged.py
|
||||||
hier_block.py
|
hier_block.py
|
||||||
fn_time.py
|
fn_time.py
|
||||||
burst_to_fn_time.py
|
|
||||||
DESTINATION ${GR_PYTHON_DIR}/grgsm
|
DESTINATION ${GR_PYTHON_DIR}/grgsm
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
"""
|
|
||||||
Embedded Python Blocks:
|
|
||||||
|
|
||||||
Each this file is saved, GRC will instantiate the first class it finds to get
|
|
||||||
ports and parameters of your block. The arguments to __init__ will be the
|
|
||||||
parameters. All of them are required to have default values!
|
|
||||||
"""
|
|
||||||
import numpy as np
|
|
||||||
from gnuradio import gr
|
|
||||||
import pmt
|
|
||||||
|
|
||||||
class burst_to_fn_time(gr.basic_block):
|
|
||||||
def __init__(self): # only default arguments here
|
|
||||||
gr.basic_block.__init__(
|
|
||||||
self,
|
|
||||||
name='Burst to fn_time',
|
|
||||||
in_sig=[],
|
|
||||||
out_sig=[]
|
|
||||||
)
|
|
||||||
self.message_port_register_in(pmt.intern("bursts_in"))
|
|
||||||
self.message_port_register_out(pmt.intern("fn_time_out"))
|
|
||||||
self.set_msg_handler(pmt.intern("bursts_in"), self.convert)
|
|
||||||
|
|
||||||
def convert(self, msg):
|
|
||||||
fn_time = pmt.dict_ref(pmt.car(msg),pmt.intern("fn_time"),pmt.PMT_NIL)
|
|
||||||
fn_time_msg = pmt.dict_add(pmt.make_dict(), pmt.intern("fn_time"), fn_time)
|
|
||||||
if pmt.to_python(fn_time) is not None:
|
|
||||||
self.message_port_pub(pmt.intern("fn_time_out"), fn_time_msg)
|
|
|
@ -74,6 +74,7 @@
|
||||||
#include "grgsm/transmitter/preprocess_tx_burst.h"
|
#include "grgsm/transmitter/preprocess_tx_burst.h"
|
||||||
#include "grgsm/transmitter/gen_test_ab.h"
|
#include "grgsm/transmitter/gen_test_ab.h"
|
||||||
#include "grgsm/misc_utils/trx_burst_if.h"
|
#include "grgsm/misc_utils/trx_burst_if.h"
|
||||||
|
#include "grgsm/misc_utils/burst_to_fn_time.h"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%include "constants.i"
|
%include "constants.i"
|
||||||
|
@ -177,14 +178,14 @@ GR_SWIG_BLOCK_MAGIC2(gsm, message_sink);
|
||||||
//};
|
//};
|
||||||
|
|
||||||
%include "grgsm/misc_utils/fn_time.h"
|
%include "grgsm/misc_utils/fn_time.h"
|
||||||
|
|
||||||
%include "grgsm/transmitter/txtime_setter.h"
|
%include "grgsm/transmitter/txtime_setter.h"
|
||||||
GR_SWIG_BLOCK_MAGIC2(gsm, txtime_setter);
|
GR_SWIG_BLOCK_MAGIC2(gsm, txtime_setter);
|
||||||
%include "grgsm/transmitter/preprocess_tx_burst.h"
|
%include "grgsm/transmitter/preprocess_tx_burst.h"
|
||||||
GR_SWIG_BLOCK_MAGIC2(gsm, preprocess_tx_burst);
|
GR_SWIG_BLOCK_MAGIC2(gsm, preprocess_tx_burst);
|
||||||
|
|
||||||
%include "grgsm/transmitter/gen_test_ab.h"
|
%include "grgsm/transmitter/gen_test_ab.h"
|
||||||
GR_SWIG_BLOCK_MAGIC2(gsm, gen_test_ab);
|
GR_SWIG_BLOCK_MAGIC2(gsm, gen_test_ab);
|
||||||
|
|
||||||
%include "grgsm/misc_utils/trx_burst_if.h"
|
%include "grgsm/misc_utils/trx_burst_if.h"
|
||||||
GR_SWIG_BLOCK_MAGIC2(gsm, trx_burst_if);
|
GR_SWIG_BLOCK_MAGIC2(gsm, trx_burst_if);
|
||||||
|
%include "grgsm/misc_utils/burst_to_fn_time.h"
|
||||||
|
GR_SWIG_BLOCK_MAGIC2(gsm, burst_to_fn_time);
|
||||||
|
|
Loading…
Reference in New Issue