diff --git a/grc/CMakeLists.txt b/grc/CMakeLists.txt index 427bf5d..94d4e32 100644 --- a/grc/CMakeLists.txt +++ b/grc/CMakeLists.txt @@ -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 diff --git a/grc/satnogs_json_to_ecss_src.xml b/grc/satnogs_json_to_ecss_src.xml new file mode 100644 index 0000000..3a3e716 --- /dev/null +++ b/grc/satnogs_json_to_ecss_src.xml @@ -0,0 +1,19 @@ + + + JSON to ECSS + satnogs_json_to_ecss_src + satnogs + import satnogs + satnogs.json_to_ecss_src() + + + + in + message + + + + out + message + + diff --git a/include/satnogs/CMakeLists.txt b/include/satnogs/CMakeLists.txt index ae33d99..104307a 100644 --- a/include/satnogs/CMakeLists.txt +++ b/include/satnogs/CMakeLists.txt @@ -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 diff --git a/include/satnogs/CMakeLists.txt.orig b/include/satnogs/CMakeLists.txt.orig deleted file mode 100644 index 06fb026..0000000 --- a/include/satnogs/CMakeLists.txt.orig +++ /dev/null @@ -1,49 +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. - -######################################################################## -# 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 -) diff --git a/include/satnogs/json_to_ecss_src.h b/include/satnogs/json_to_ecss_src.h new file mode 100644 index 0000000..2883b6e --- /dev/null +++ b/include/satnogs/json_to_ecss_src.h @@ -0,0 +1,56 @@ +/* -*- c++ -*- */ +/* + * gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module + * + * Copyright (C) 2016, Libre Space Foundation + * + * 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 . + */ + +#ifndef INCLUDED_SATNOGS_JSON_TO_ECSS_SRC_H +#define INCLUDED_SATNOGS_JSON_TO_ECSS_SRC_H + +#include +#include + +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 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 */ + diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 6ee4c92..b8401cf 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -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 diff --git a/lib/json_to_ecss_src_impl.cc b/lib/json_to_ecss_src_impl.cc new file mode 100644 index 0000000..5041a15 --- /dev/null +++ b/lib/json_to_ecss_src_impl.cc @@ -0,0 +1,91 @@ +/* -*- c++ -*- */ +/* + * gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module + * + * Copyright (C) 2016, Libre Space Foundation + * + * 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 . + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include "json_to_ecss_src_impl.h" + +#include +#include + +#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 = "<