diff --git a/grc/CMakeLists.txt b/grc/CMakeLists.txt
index 5ba10ad..a53db5d 100644
--- a/grc/CMakeLists.txt
+++ b/grc/CMakeLists.txt
@@ -37,5 +37,6 @@ install(FILES
satnogs_whitening.xml
satnogs_udp_msg_sink.xml
satnogs_upsat_transmitter.xml
- satnogs_coarse_doppler_correction_cc.xml DESTINATION share/gnuradio/grc/blocks
+ satnogs_coarse_doppler_correction_cc.xml
+ satnogs_debug_msg_source_raw.xml DESTINATION share/gnuradio/grc/blocks
)
diff --git a/grc/satnogs_debug_msg_source_raw.xml b/grc/satnogs_debug_msg_source_raw.xml
new file mode 100644
index 0000000..3ea8ccd
--- /dev/null
+++ b/grc/satnogs_debug_msg_source_raw.xml
@@ -0,0 +1,41 @@
+
+
+ Debug Message Source Raw
+ satnogs_debug_msg_source_raw
+ satnogs
+ import satnogs
+ satnogs.debug_msg_source_raw($msg, $delay, $repeat)
+
+
+ Message
+ msg
+ [0x33, 0x44, 0x55, 0x66]
+ raw
+
+
+
+ Delay (seconds)
+ delay
+ 0.01
+ real
+
+
+
+ Repeat
+ repeat
+ enum
+
+
+
+
+
+
diff --git a/include/satnogs/CMakeLists.txt b/include/satnogs/CMakeLists.txt
index 23f41a3..3e0ae41 100644
--- a/include/satnogs/CMakeLists.txt
+++ b/include/satnogs/CMakeLists.txt
@@ -49,5 +49,6 @@ install(FILES
upsat_fsk_frame_encoder.h
whitening.h
udp_msg_sink.h
- coarse_doppler_correction_cc.h DESTINATION include/satnogs
+ coarse_doppler_correction_cc.h
+ debug_msg_source_raw.h DESTINATION include/satnogs
)
diff --git a/include/satnogs/debug_msg_source.h b/include/satnogs/debug_msg_source.h
index 1a0312e..ffc366f 100644
--- a/include/satnogs/debug_msg_source.h
+++ b/include/satnogs/debug_msg_source.h
@@ -45,7 +45,6 @@ namespace gr
* @param delay delay in seconds between consecutive messages
* @param repeat if set to yes the block will produce a message every
* \p delay seconds
- * @return
*/
static sptr
make (const std::string &msg, double delay, bool repeat = true);
diff --git a/include/satnogs/debug_msg_source_raw.h b/include/satnogs/debug_msg_source_raw.h
new file mode 100644
index 0000000..0313397
--- /dev/null
+++ b/include/satnogs/debug_msg_source_raw.h
@@ -0,0 +1,59 @@
+/* -*- 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_DEBUG_MSG_SOURCE_RAW_H
+#define INCLUDED_SATNOGS_DEBUG_MSG_SOURCE_RAW_H
+
+#include
+#include
+
+namespace gr
+{
+ namespace satnogs
+ {
+
+ /*!
+ * \brief A block for debug reasons producing specific messages.
+ * The input message can be anything, opposed to the \p debug_msg_source()
+ * block that can accept only string messages.
+ * \ingroup satnogs
+ *
+ */
+ class SATNOGS_API debug_msg_source_raw : virtual public gr::block
+ {
+ public:
+ typedef boost::shared_ptr sptr;
+
+ /**
+ * Debug message source block.
+ * @param msg the message
+ * @param delay delay in seconds between consecutive messages
+ * @param repeat if set to yes the block will produce a message every
+ * \p delay seconds
+ */
+ static sptr
+ make (const std::vector &msg, double delay, bool repeat);
+ };
+
+ } // namespace satnogs
+} // namespace gr
+
+#endif /* INCLUDED_SATNOGS_DEBUG_MSG_SOURCE_RAW_H */
+
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 436577a..176997e 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -47,7 +47,8 @@ list(APPEND satnogs_sources
upsat_fsk_frame_encoder_impl.cc
whitening.cc
udp_msg_sink_impl.cc
- coarse_doppler_correction_cc_impl.cc )
+ coarse_doppler_correction_cc_impl.cc
+ debug_msg_source_raw_impl.cc )
set(satnogs_sources "${satnogs_sources}" PARENT_SCOPE)
if(NOT satnogs_sources)
diff --git a/lib/debug_msg_source_impl.cc b/lib/debug_msg_source_impl.cc
index 41d5b21..f80a36d 100644
--- a/lib/debug_msg_source_impl.cc
+++ b/lib/debug_msg_source_impl.cc
@@ -83,7 +83,7 @@ namespace gr
{
d_running = false;
d_thread->join ();
- delete d_buf;
+ delete[] d_buf;
}
} /* namespace satnogs */
diff --git a/lib/debug_msg_source_raw_impl.cc b/lib/debug_msg_source_raw_impl.cc
new file mode 100644
index 0000000..65fca62
--- /dev/null
+++ b/lib/debug_msg_source_raw_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 "debug_msg_source_raw_impl.h"
+
+namespace gr
+{
+ namespace satnogs
+ {
+
+ debug_msg_source_raw::sptr
+ debug_msg_source_raw::make (const std::vector &msg, double delay,
+ bool repeat)
+ {
+ return gnuradio::get_initial_sptr (
+ new debug_msg_source_raw_impl (msg, delay, repeat));
+ }
+
+ /*
+ * The private constructor
+ */
+ debug_msg_source_raw_impl::debug_msg_source_raw_impl (
+ const std::vector &msg, double delay, bool repeat) :
+ gr::block ("debug_msg_source_raw", gr::io_signature::make (0, 0, 0),
+ gr::io_signature::make (0, 0, 0)),
+ d_buf_len (msg.size ()),
+ d_delay (delay),
+ d_repeat (repeat),
+ d_running (true)
+ {
+ d_buf = new uint8_t[msg.size()];
+ memcpy (d_buf, msg.data(), msg.size());
+ message_port_register_out (pmt::mp ("msg"));
+ boost::shared_ptr (
+ new boost::thread (
+ boost::bind (&debug_msg_source_raw_impl::msg_sender, this)));
+ }
+
+ void
+ debug_msg_source_raw_impl::msg_sender ()
+ {
+ pmt::pmt_t msg = pmt::make_blob (d_buf, d_buf_len);
+ if (d_repeat) {
+ while (d_running) {
+ boost::this_thread::sleep_for (
+ boost::chrono::milliseconds ((size_t) (d_delay * 1e3)));
+ message_port_pub (pmt::mp ("msg"), msg);
+ }
+ }
+ else {
+ boost::this_thread::sleep_for (
+ boost::chrono::milliseconds ((size_t) (d_delay * 1e3)));
+ message_port_pub (pmt::mp ("msg"), msg);
+ }
+ }
+
+ /*
+ * Our virtual destructor.
+ */
+ debug_msg_source_raw_impl::~debug_msg_source_raw_impl ()
+ {
+ d_running = false;
+ d_thread->join ();
+ delete[] d_buf;
+ }
+
+ } /* namespace satnogs */
+} /* namespace gr */
+
diff --git a/lib/debug_msg_source_raw_impl.h b/lib/debug_msg_source_raw_impl.h
new file mode 100644
index 0000000..abc4bec
--- /dev/null
+++ b/lib/debug_msg_source_raw_impl.h
@@ -0,0 +1,55 @@
+/* -*- 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_DEBUG_MSG_SOURCE_RAW_IMPL_H
+#define INCLUDED_SATNOGS_DEBUG_MSG_SOURCE_RAW_IMPL_H
+
+#include
+
+namespace gr
+{
+ namespace satnogs
+ {
+
+ class debug_msg_source_raw_impl : public debug_msg_source_raw
+ {
+ private:
+ const size_t d_buf_len;
+ const double d_delay;
+ const bool d_repeat;
+ bool d_running;
+ boost::shared_ptr d_thread;
+ uint8_t *d_buf;
+
+ void
+ msg_sender ();
+
+
+ public:
+ debug_msg_source_raw_impl (const std::vector &msg, double delay,
+ bool repeat);
+ ~debug_msg_source_raw_impl ();
+ };
+
+ } // namespace satnogs
+} // namespace gr
+
+#endif /* INCLUDED_SATNOGS_DEBUG_MSG_SOURCE_RAW_IMPL_H */
+
diff --git a/swig/satnogs_swig.i b/swig/satnogs_swig.i
index 29442eb..43d4e56 100644
--- a/swig/satnogs_swig.i
+++ b/swig/satnogs_swig.i
@@ -30,6 +30,7 @@
#include "satnogs/whitening.h"
#include "satnogs/udp_msg_sink.h"
#include "satnogs/coarse_doppler_correction_cc.h"
+#include "satnogs/debug_msg_source_raw.h"
%}
@@ -73,3 +74,5 @@ GR_SWIG_BLOCK_MAGIC2(satnogs, upsat_fsk_frame_encoder);
GR_SWIG_BLOCK_MAGIC2(satnogs, udp_msg_sink);
%include "satnogs/coarse_doppler_correction_cc.h"
GR_SWIG_BLOCK_MAGIC2(satnogs, coarse_doppler_correction_cc);
+%include "satnogs/debug_msg_source_raw.h"
+GR_SWIG_BLOCK_MAGIC2(satnogs, debug_msg_source_raw);