Commit 5659dc6b authored by Manolis Surligas's avatar Manolis Surligas

Merge branch 'vardakis/json_to_ecss' of...

Merge branch 'vardakis/json_to_ecss' of https://github.com/GVardakis/gr-satnogs into GVardakis-vardakis/json_to_ecss
parents 97b141d2 1b0791e9
......@@ -28,6 +28,7 @@ install(FILES
satnogs_ax25_decoder_b.xml
satnogs_udp_msg_source.xml
satnogs_debug_msg_source.xml
satnogs_json_to_ecss_src.xml
satnogs_tcp_rigctl_msg_source.xml
satnogs_frame_encoder.xml
satnogs_doppler_correction_cc.xml DESTINATION share/gnuradio/grc/blocks
......
<?xml version="1.0"?>
<block>
<name>JSON to ECSS</name>
<key>satnogs_json_to_ecss_src</key>
<category>satnogs</category>
<import>import satnogs</import>
<make>satnogs.json_to_ecss_src()</make>
<sink>
<name>in</name>
<type>message</type>
</sink>
<source>
<name>out</name>
<type>message</type>
</source>
</block>
......@@ -39,6 +39,7 @@ install(FILES
ax25_decoder_b.h
udp_msg_source.h
debug_msg_source.h
json_to_ecss_src.h
tcp_rigctl_msg_source.h
frame_encoder.h
doppler_correction_cc.h
......
# 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 public header files
########################################################################
install(FILES
api.h
ax25.h
config.h
cw_matched_filter_ff.h
log.h
morse_tree.h
morse.h
morse_decoder.h
morse_debug_source.h
clear_text_msg_sink.h
cw_to_symbol.h
afsk_decoder.h
sine_matched_filter_ff.h
utils.h
ax25_encoder_bf.h
ax25_decoder_b.h
udp_msg_source.h
debug_msg_source.h
tc_tm.h
<<<<<<< HEAD
frame_encoder.h DESTINATION include/satnogs
=======
tcp_rigctl_msg_source.h
doppler_correction_cc.h DESTINATION include/satnogs
>>>>>>> e2426243126ea374540c7ac95c53b7ba8983a0b1
)
/* -*- 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_JSON_TO_ECSS_SRC_H
#define INCLUDED_SATNOGS_JSON_TO_ECSS_SRC_H
#include <satnogs/api.h>
#include <gnuradio/sync_block.h>
namespace gr {
namespace satnogs {
/*!
* \brief <+description of block+>
* \ingroup satnogs
*
*/
class SATNOGS_API json_to_ecss_src : virtual public gr::block
{
public:
typedef boost::shared_ptr<json_to_ecss_src> sptr;
/*!
* \brief Return a shared_ptr to a new instance of satnogs::json_to_ecss_src.
*
* To avoid accidental use of raw pointers, satnogs::json_to_ecss_src's
* constructor is in a private implementation
* class. satnogs::json_to_ecss_src::make is the public interface for
* creating new instances.
*/
static sptr make();
};
} // namespace satnogs
} // namespace gr
#endif /* INCLUDED_SATNOGS_JSON_TO_ECSS_SRC_H */
......@@ -38,6 +38,7 @@ list(APPEND satnogs_sources
udp_msg_source_impl.cc
debug_msg_source_impl.cc
tcp_rigctl_msg_source_impl.cc
json_to_ecss_src_impl.cc
doppler_correction_cc_impl.cc
frame_encoder_impl.cc
doppler_fit.cc
......
/* -*- 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 "json_to_ecss_src_impl.h"
#include <sstream>
#include <map>
#define BUFFER_SIZE 2048
namespace gr {
namespace satnogs {
json_to_ecss_src::sptr
json_to_ecss_src::make()
{
return gnuradio::get_initial_sptr
(new json_to_ecss_src_impl());
}
/*
* The private constructor
*/
json_to_ecss_src_impl::json_to_ecss_src_impl()
: gr::block("json_to_ecss_src",
gr::io_signature::make (0, 0, 0),
gr::io_signature::make (0, 0, 0)),
is_running(true),
d_in_port(pmt::mp("in")),
d_out_port(pmt::mp("out"))
{
message_port_register_out(d_out_port);
message_port_register_in(d_in_port);
d_buf = (uint8_t*)malloc(BUFFER_SIZE * sizeof(uint8_t));
new boost::thread (
boost::bind (&json_to_ecss_src_impl::json_accepter, this));
}
/*
* Our virtual destructor.
*/
json_to_ecss_src_impl::~json_to_ecss_src_impl()
{
is_running = false;
}
void
json_to_ecss_src_impl::json_accepter(){
pmt::pmt_t message;
size_t length;
while(is_running){
message = delete_head_blocking(d_in_port,0);
length = blob_length(message);
d_buf = (uint8_t*)blob_data(message);
std::istringstream ss(std::string(d_buf, d_buf + length));
ptree tree;
read_json(ss,tree);
BOOST_FOREACH(const ptree::value_type &v, tree) {
std::cout<<"First = "<<v.first << "Second = "<<v.second.data()<<std::endl ;
}
}
}
} /* namespace satnogs */
} /* namespace gr */
/* -*- 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_JSON_TO_ECSS_SRC_IMPL_H
#define INCLUDED_SATNOGS_JSON_TO_ECSS_SRC_IMPL_H
#include <satnogs/json_to_ecss_src.h>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
using boost::property_tree::ptree;
using boost::property_tree::read_json;
namespace gr {
namespace satnogs {
class json_to_ecss_src_impl : public json_to_ecss_src
{
private:
// Nothing to declare in this block.
bool is_running;
pmt::pmt_t d_in_port;
pmt::pmt_t d_out_port;
uint8_t* d_buf;
void json_accepter();
public:
json_to_ecss_src_impl();
~json_to_ecss_src_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 satnogs
} // namespace gr
#endif /* INCLUDED_SATNOGS_JSON_TO_ECSS_SRC_IMPL_H */
......@@ -110,7 +110,7 @@ namespace gr
else{
perror("UDP recvfrom");
close(sock);
delete buf;
delete[] buf;
exit(EXIT_FAILURE);
}
}
......
......@@ -22,6 +22,7 @@
#include "satnogs/udp_msg_source.h"
#include "satnogs/debug_msg_source.h"
#include "satnogs/tcp_rigctl_msg_source.h"
#include "satnogs/json_to_ecss_src.h"
#include "satnogs/doppler_correction_cc.h"
#include "satnogs/frame_encoder.h"
%}
......@@ -52,6 +53,8 @@ GR_SWIG_BLOCK_MAGIC2(satnogs, udp_msg_source);
GR_SWIG_BLOCK_MAGIC2(satnogs, debug_msg_source);
%include "satnogs/tcp_rigctl_msg_source.h"
GR_SWIG_BLOCK_MAGIC2(satnogs, tcp_rigctl_msg_source);
%include "satnogs/json_to_ecss_src.h"
GR_SWIG_BLOCK_MAGIC2(satnogs, json_to_ecss_src);
%include "satnogs/frame_encoder.h"
GR_SWIG_BLOCK_MAGIC2(satnogs, frame_encoder);
%include "satnogs/doppler_correction_cc.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