Added msg_to_tag block - currently it does nothing

This commit is contained in:
Piotr Krysik 2016-05-29 13:06:39 +02:00
parent af8ad5dddf
commit c6eb3b5c6a
10 changed files with 277 additions and 2 deletions

View File

@ -24,5 +24,6 @@ add_subdirectory(receiver)
add_subdirectory(flow_control)
add_subdirectory(misc_utils)
install(FILES
gsm_block_tree.xml DESTINATION share/gnuradio/grc/blocks
gsm_block_tree.xml
grgsm_msg_to_tag.xml DESTINATION share/gnuradio/grc/blocks
)

38
grc/grgsm_msg_to_tag.xml Normal file
View File

@ -0,0 +1,38 @@
<?xml version="1.0"?>
<block>
<name>msg_to_tag</name>
<key>grgsm_msg_to_tag</key>
<category>grgsm</category>
<import>import grgsm</import>
<make>grgsm.msg_to_tag()</make>
<!-- Make one 'param' node for every Parameter you want settable from the GUI.
Sub-nodes:
* name
* key (makes the value accessible as $keyname, e.g. in the make node)
* type -->
<param>
<name>...</name>
<key>...</key>
<type>...</type>
</param>
<!-- Make one 'sink' node per input. Sub-nodes:
* name (an identifier for the GUI)
* type
* vlen
* optional (set to 1 for optional inputs) -->
<sink>
<name>in</name>
<type><!-- e.g. int, float, complex, byte, short, xxx_vector, ...--></type>
</sink>
<!-- Make one 'source' node per output. Sub-nodes:
* name (an identifier for the GUI)
* type
* vlen
* optional (set to 1 for optional inputs) -->
<source>
<name>out</name>
<type><!-- e.g. int, float, complex, byte, short, xxx_vector, ...--></type>
</source>
</block>

View File

@ -24,7 +24,7 @@ install(FILES
plotting.hpp
api.h
gsmtap.h
DESTINATION include/grgsm
msg_to_tag.h DESTINATION include/grgsm
)
add_subdirectory(decoding)

View File

@ -0,0 +1,58 @@
/* -*- c++ -*- */
/* @file
* @author Piotr Krysik <ptrkrysik@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_MSG_TO_TAG_H
#define INCLUDED_GRGSM_MSG_TO_TAG_H
#include <grgsm/api.h>
#include <gnuradio/sync_block.h>
namespace gr {
namespace grgsm {
/*!
* \brief <+description of block+>
* \ingroup grgsm
*
*/
class GRGSM_API msg_to_tag : virtual public gr::sync_block
{
public:
typedef boost::shared_ptr<msg_to_tag> sptr;
/*!
* \brief Return a shared_ptr to a new instance of grgsm::msg_to_tag.
*
* To avoid accidental use of raw pointers, grgsm::msg_to_tag's
* constructor is in a private implementation
* class. grgsm::msg_to_tag::make is the public interface for
* creating new instances.
*/
static sptr make();
};
} // namespace grgsm
} // namespace gr
#endif /* INCLUDED_GRGSM_MSG_TO_TAG_H */

View File

@ -65,6 +65,7 @@ list(APPEND grgsm_sources
qa_utils/message_source_impl.cc
qa_utils/message_sink_impl.cc
decryption/decryption_impl.cc
msg_to_tag_impl.cc
)

80
lib/msg_to_tag_impl.cc Normal file
View File

@ -0,0 +1,80 @@
/* -*- c++ -*- */
/* @file
* @author Piotr Krysik <ptrkrysik@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 <gnuradio/msg_queue.h>
#include "msg_to_tag_impl.h"
namespace gr {
namespace grgsm {
msg_to_tag::sptr
msg_to_tag::make()
{
return gnuradio::get_initial_sptr
(new msg_to_tag_impl());
}
// void msg_to_tag_impl::queue_msg(pmt::pmt_t msg){
//
// }
/*
* The private constructor
*/
msg_to_tag_impl::msg_to_tag_impl()
: gr::sync_block("msg_to_tag",
gr::io_signature::make(1, 1, sizeof(gr_complex)),
gr::io_signature::make(1, 1, sizeof(gr_complex)))
{
message_port_register_in(pmt::mp("msg"));
// set_msg_handler(pmt::mp("msg"), boost::bind(&msg_to_tag::queue_msg, this, _1));
}
/*
* Our virtual destructor.
*/
msg_to_tag_impl::~msg_to_tag_impl()
{
}
int
msg_to_tag_impl::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const gr_complex *in = (const gr_complex *) input_items[0];
gr_complex *out = (gr_complex *) output_items[0];
// Do <+signal processing+>
memcpy(out, in, sizeof(gr_complex)*noutput_items);
// Tell runtime system how many output items we produced.
return noutput_items;
}
} /* namespace grgsm */
} /* namespace gr */

50
lib/msg_to_tag_impl.h Normal file
View File

@ -0,0 +1,50 @@
/* -*- c++ -*- */
/* @file
* @author Piotr Krysik <ptrkrysik@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_MSG_TO_TAG_IMPL_H
#define INCLUDED_GRGSM_MSG_TO_TAG_IMPL_H
#include <grgsm/msg_to_tag.h>
namespace gr {
namespace grgsm {
class msg_to_tag_impl : public msg_to_tag
{
private:
// Nothing to declare in this block.
public:
msg_to_tag_impl();
~msg_to_tag_impl();
// Where all the action really happens
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
};
} // namespace grgsm
} // namespace gr
#endif /* INCLUDED_GRGSM_MSG_TO_TAG_IMPL_H */

View File

@ -62,3 +62,4 @@ GR_ADD_TEST(qa_burst_sdcch_subslot_filter ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_S
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)
GR_ADD_TEST(qa_arfcn ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_arfcn.py)
GR_ADD_TEST(qa_msg_to_tag ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_msg_to_tag.py)

43
python/qa_msg_to_tag.py Executable file
View File

@ -0,0 +1,43 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @file
# @author Piotr Krysik <ptrkrysik@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
from gnuradio import blocks
import grgsm_swig as grgsm
class qa_msg_to_tag (gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
def tearDown (self):
self.tb = None
def test_001_t (self):
# set up fg
self.tb.run ()
# check data
if __name__ == '__main__':
gr_unittest.run(qa_msg_to_tag, "qa_msg_to_tag.xml")

View File

@ -37,6 +37,7 @@
#include "grgsm/qa_utils/message_sink.h"
#include "grgsm/misc_utils/message_file_sink.h"
#include "grgsm/misc_utils/message_file_source.h"
#include "grgsm/msg_to_tag.h"
%}
%include "grgsm/receiver/receiver.h"
@ -103,3 +104,5 @@ 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/msg_to_tag.h"
GR_SWIG_BLOCK_MAGIC2(grgsm, msg_to_tag);