Commit ca49f817 authored by Manolis Surligas's avatar Manolis Surligas

Add morse decoder block.

The morse decoder is not yet functional. The decoding is performed
using a binary tree. Left child, corresponds to a received dot whereas
right to a received dash.
parent b4dd0f1e
...@@ -17,5 +17,6 @@ ...@@ -17,5 +17,6 @@
# the Free Software Foundation, Inc., 51 Franklin Street, # the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA. # Boston, MA 02110-1301, USA.
install(FILES install(FILES
satnogs_cw_matched_filter_ff.xml DESTINATION share/gnuradio/grc/blocks satnogs_cw_matched_filter_ff.xml
satnogs_morse_decoder.xml DESTINATION share/gnuradio/grc/blocks
) )
<?xml version="1.0"?>
<block>
<name>morse_decoder</name>
<key>satnogs_morse_decoder</key>
<category>satnogs</category>
<import>import satnogs</import>
<make>satnogs.morse_decoder()</make>
<sink>
<name>in</name>
<type>message</type>
</sink>
</block>
...@@ -22,5 +22,7 @@ ...@@ -22,5 +22,7 @@
######################################################################## ########################################################################
install(FILES install(FILES
api.h api.h
cw_matched_filter_ff.h DESTINATION include/satnogs cw_matched_filter_ff.h
morse_decoder.h
morse_tree.h DESTINATION include/satnogs
) )
/* -*- c++ -*- */
/*
* gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
*
* Copyright (C) 2016, Libre Space Foundation <http://librespacefoundation.org/>
*
* This program 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 of the License, or
* (at your option) any later version.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef INCLUDED_SATNOGS_MORSE_DECODER_H
#define INCLUDED_SATNOGS_MORSE_DECODER_H
#include <satnogs/api.h>
#include <satnogs/morse_tree.h>
namespace gr {
namespace satnogs {
/*!
* \brief Morse code decoder block.
*
* This block received messages from the previous blocks
* and try to decode the dot and dashes into clear text.
*/
class SATNOGS_API morse_decoder
{
public:
morse_decoder();
~morse_decoder();
private:
morse_tree d_morse_tree;
};
} // namespace satnogs
} // namespace gr
#endif /* INCLUDED_SATNOGS_MORSE_DECODER_H */
/* -*- c++ -*- */
/*
* gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
*
* Copyright (C) 2016, Libre Space Foundation <http://librespacefoundation.org/>
*
* This program 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 of the License, or
* (at your option) any later version.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef INCLUDED_SATNOGS_MORSE_TREE_H
#define INCLUDED_SATNOGS_MORSE_TREE_H
#include <satnogs/api.h>
namespace gr {
namespace satnogs {
/*!
* \brief Binary tree node containing the corresponding character
*/
class tree_node
{
private:
const char d_char;
tree_node *d_left;
tree_node *d_right;
public:
tree_node (char c);
void
set_left_child (tree_node *child);
void
set_right_child (tree_node *child);
tree_node*
get_left_child();
tree_node*
get_right_child();
};
/*!
* \brief A Binary tree representation of the Morse coding scheme.
* Left transitions occur when a dot is received, whereas right transitions
* are perfromed during the reception of a dash.
*
* The tree follows the ITU International Morse code representation
* ITU-R M.1677-1
*/
class SATNOGS_API morse_tree
{
public:
morse_tree();
~morse_tree();
void reset();
private:
tree_node *d_root;
tree_node *d_current;
void construct_tree();
void delete_tree(tree_node *node);
};
} // namespace satnogs
} // namespace gr
#endif /* INCLUDED_SATNOGS_MORSE_TREE_H */
...@@ -25,7 +25,9 @@ include(GrPlatform) #define LIB_SUFFIX ...@@ -25,7 +25,9 @@ include(GrPlatform) #define LIB_SUFFIX
include_directories(${Boost_INCLUDE_DIR}) include_directories(${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIRS}) link_directories(${Boost_LIBRARY_DIRS})
list(APPEND satnogs_sources list(APPEND satnogs_sources
cw_matched_filter_ff_impl.cc ) cw_matched_filter_ff_impl.cc
morse_decoder.cc
morse_tree.cc )
set(satnogs_sources "${satnogs_sources}" PARENT_SCOPE) set(satnogs_sources "${satnogs_sources}" PARENT_SCOPE)
if(NOT satnogs_sources) if(NOT satnogs_sources)
......
/* -*- c++ -*- */
/*
* gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
*
* Copyright (C) 2016, Libre Space Foundation <http://librespacefoundation.org/>
*
* This program 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 of the License, or
* (at your option) any later version.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gnuradio/io_signature.h>
#include <satnogs/morse_decoder.h>
namespace gr {
namespace satnogs {
morse_decoder::morse_decoder() :
d_morse_tree()
{
}
morse_decoder::~morse_decoder()
{
}
} /* namespace satnogs */
} /* namespace gr */
This diff is collapsed.
...@@ -9,7 +9,11 @@ ...@@ -9,7 +9,11 @@
%{ %{
#include "satnogs/cw_matched_filter_ff.h" #include "satnogs/cw_matched_filter_ff.h"
#include "satnogs/morse_decoder.h"
#include "satnogs/morse_tree.h"
%} %}
%include "satnogs/cw_matched_filter_ff.h" %include "satnogs/cw_matched_filter_ff.h"
GR_SWIG_BLOCK_MAGIC2(satnogs, cw_matched_filter_ff); GR_SWIG_BLOCK_MAGIC2(satnogs, cw_matched_filter_ff);
%include "satnogs/morse_decoder.h"
%include "satnogs/morse_tree.h"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment