Merge pull request #20 from GVardakis/next
Added satnogs transmitter hierarchy block
This commit is contained in:
commit
6f4e289518
|
@ -20,7 +20,7 @@ install(FILES
|
|||
satnogs_cw_matched_filter_ff.xml
|
||||
satnogs_morse_decoder.xml
|
||||
satnogs_morse_debug_source.xml
|
||||
satnogs_clear_text_msg_sink.xml
|
||||
satnogs_multi_format_msg_sink.xml
|
||||
satnogs_cw_to_symbol.xml
|
||||
satnogs_afsk_decoder.xml
|
||||
satnogs_sine_matched_filter_ff.xml
|
||||
|
@ -36,5 +36,6 @@ install(FILES
|
|||
satnogs_upsat_fsk_frame_encoder.xml
|
||||
satnogs_whitening.xml
|
||||
satnogs_udp_msg_sink.xml
|
||||
satnogs_transmitter.xml
|
||||
satnogs_coarse_doppler_correction_cc.xml DESTINATION share/gnuradio/grc/blocks
|
||||
)
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<block>
|
||||
<name>Clear Text Message Sink</name>
|
||||
<key>satnogs_clear_text_msg_sink</key>
|
||||
<category>satnogs</category>
|
||||
<import>import satnogs</import>
|
||||
<make>satnogs.clear_text_msg_sink()</make>
|
||||
|
||||
<sink>
|
||||
<name>in</name>
|
||||
<type>message</type>
|
||||
</sink>
|
||||
</block>
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0"?>
|
||||
<block>
|
||||
<name>Multi Format Message Sink</name>
|
||||
<key>satnogs_multi_format_msg_sink</key>
|
||||
<category>satnogs</category>
|
||||
<import>import satnogs</import>
|
||||
<make>satnogs.multi_format_msg_sink($format)</make>
|
||||
|
||||
<param>
|
||||
<name>Output format</name>
|
||||
<key>format</key>
|
||||
<type>enum</type>
|
||||
<option>
|
||||
<name>Clear Text</name>
|
||||
<key>0</key>
|
||||
</option>
|
||||
<option>
|
||||
<name>Hex</name>
|
||||
<key>1</key>
|
||||
</option>
|
||||
<option>
|
||||
<name>Binary</name>
|
||||
<key>2</key>
|
||||
</option>
|
||||
|
||||
</param>
|
||||
<sink>
|
||||
<name>in</name>
|
||||
<type>message</type>
|
||||
</sink>
|
||||
</block>
|
|
@ -0,0 +1,181 @@
|
|||
<block>
|
||||
<name>Satnogs Transmitter</name>
|
||||
<key>satnogs_transmitter</key>
|
||||
<category>satnogs</category>
|
||||
<import>import satnogs</import>
|
||||
|
||||
<make>satnogs.satnogs_transmitter(frame_preamble=$frame_preamble,
|
||||
sync_word=$sync_word,
|
||||
append_crc=$append_crc,
|
||||
whitening=$whitening,
|
||||
manchester=$manchester,
|
||||
msb_first=$msb_first,
|
||||
ax25_format=$ax25_format,
|
||||
dest_addr=$dest_addr,
|
||||
dest_ssid=$dest_ssid,
|
||||
src_addr=$src_addr,
|
||||
src_ssid=$src_ssid,
|
||||
settling_samples=$settling_samples,
|
||||
samps_per_symbol=$interp,
|
||||
interpolation_taps=$taps,
|
||||
samp_rate=$samp_rate,
|
||||
lo_offset=$lo_offset,
|
||||
deviation=$deviation,
|
||||
baud_rate=$baud_rate)</make>
|
||||
|
||||
<param>
|
||||
<name>Frame Preamble</name>
|
||||
<key>frame_preamble</key>
|
||||
<type>raw</type>
|
||||
</param>
|
||||
<param>
|
||||
<name>Synchronization Word</name>
|
||||
<key>sync_word</key>
|
||||
<type>raw</type>
|
||||
</param>
|
||||
<param>
|
||||
<name>Append CRC</name>
|
||||
<key>append_crc</key>
|
||||
<type>enum</type>
|
||||
<option>
|
||||
<name>Yes</name>
|
||||
<key>True</key>
|
||||
</option>
|
||||
<option>
|
||||
<name>No</name>
|
||||
<key>False</key>
|
||||
</option>
|
||||
</param>
|
||||
|
||||
<param>
|
||||
<name>Whitening</name>
|
||||
<key>whitening</key>
|
||||
<type>enum</type>
|
||||
<option>
|
||||
<name>No</name>
|
||||
<key>False</key>
|
||||
</option>
|
||||
<option>
|
||||
<name>Yes</name>
|
||||
<key>True</key>
|
||||
</option>
|
||||
</param>
|
||||
|
||||
<param>
|
||||
<name>Use Manchester Coding</name>
|
||||
<key>manchester</key>
|
||||
<type>enum</type>
|
||||
<option>
|
||||
<name>No</name>
|
||||
<key>False</key>
|
||||
</option>
|
||||
<option>
|
||||
<name>Yes</name>
|
||||
<key>True</key>
|
||||
</option>
|
||||
</param>
|
||||
|
||||
<param>
|
||||
<name>Send MS bit first</name>
|
||||
<key>msb_first</key>
|
||||
<type>enum</type>
|
||||
<option>
|
||||
<name>Yes</name>
|
||||
<key>True</key>
|
||||
</option>
|
||||
<option>
|
||||
<name>No</name>
|
||||
<key>False</key>
|
||||
</option>
|
||||
</param>
|
||||
|
||||
<param>
|
||||
<name>Use AX.25 encapsulation</name>
|
||||
<key>ax25_format</key>
|
||||
<type>enum</type>
|
||||
<option>
|
||||
<name>No</name>
|
||||
<key>False</key>
|
||||
</option>
|
||||
<option>
|
||||
<name>Yes</name>
|
||||
<key>True</key>
|
||||
</option>
|
||||
</param>
|
||||
|
||||
<param>
|
||||
<name>Destination Callsign</name>
|
||||
<key>dest_addr</key>
|
||||
<type>string</type>
|
||||
</param>
|
||||
|
||||
<param>
|
||||
<name>Destination SSID</name>
|
||||
<key>dest_ssid</key>
|
||||
<type>int</type>
|
||||
</param>
|
||||
|
||||
<param>
|
||||
<name>Source Callsign</name>
|
||||
<key>src_addr</key>
|
||||
<type>string</type>
|
||||
</param>
|
||||
|
||||
<param>
|
||||
<name>Source SSID</name>
|
||||
<key>src_ssid</key>
|
||||
<type>int</type>
|
||||
</param>
|
||||
|
||||
<param>
|
||||
<name>Number of zero settling samples</name>
|
||||
<key>settling_samples</key>
|
||||
<value>64</value>
|
||||
<type>int</type>
|
||||
</param>
|
||||
|
||||
<param>
|
||||
<name>FIR filter Interpolation</name>
|
||||
<key>interp</key>
|
||||
<value>1</value>
|
||||
<type>int</type>
|
||||
</param>
|
||||
<param>
|
||||
<name>Interpolation Taps</name>
|
||||
<key>taps</key>
|
||||
<type>real_vector</type>
|
||||
</param>
|
||||
<param>
|
||||
<name>Sampling rate</name>
|
||||
<key>samp_rate</key>
|
||||
<type>real</type>
|
||||
</param>
|
||||
<param>
|
||||
<name>LO offset</name>
|
||||
<key>lo_offset</key>
|
||||
<type>real</type>
|
||||
</param>
|
||||
<param>
|
||||
<name>baud rate</name>
|
||||
<key>baud_rate</key>
|
||||
<type>real</type>
|
||||
</param>
|
||||
<param>
|
||||
<name>Deviation</name>
|
||||
<key>deviation</key>
|
||||
<type>real</type>
|
||||
</param>
|
||||
|
||||
|
||||
<sink>
|
||||
<name>in</name>
|
||||
<type>message</type>
|
||||
</sink>
|
||||
|
||||
<source>
|
||||
<name>out</name>
|
||||
<type>complex</type>
|
||||
</source>
|
||||
|
||||
|
||||
</block>
|
|
@ -30,7 +30,7 @@ install(FILES
|
|||
morse.h
|
||||
morse_decoder.h
|
||||
morse_debug_source.h
|
||||
clear_text_msg_sink.h
|
||||
multi_format_msg_sink.h
|
||||
cw_to_symbol.h
|
||||
afsk_decoder.h
|
||||
sine_matched_filter_ff.h
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_SATNOGS_CLEAR_TEXT_MSG_SINK_H
|
||||
#define INCLUDED_SATNOGS_CLEAR_TEXT_MSG_SINK_H
|
||||
#ifndef INCLUDED_SATNOGS_MULTI_FORMAT_MSG_SINK_H
|
||||
#define INCLUDED_SATNOGS_MULTI_FORMAT_MSG_SINK_H
|
||||
|
||||
#include <satnogs/api.h>
|
||||
#include <gnuradio/block.h>
|
||||
|
@ -37,10 +37,10 @@ namespace gr
|
|||
* \ingroup satnogs
|
||||
*
|
||||
*/
|
||||
class SATNOGS_API clear_text_msg_sink : virtual public gr::block
|
||||
class SATNOGS_API multi_format_msg_sink : virtual public gr::block
|
||||
{
|
||||
public:
|
||||
typedef boost::shared_ptr<clear_text_msg_sink> sptr;
|
||||
typedef boost::shared_ptr<multi_format_msg_sink> sptr;
|
||||
|
||||
/*!
|
||||
* \brief Block accepting clear text messages from various decoders.
|
||||
|
@ -49,11 +49,11 @@ namespace gr
|
|||
*
|
||||
*/
|
||||
static sptr
|
||||
make ();
|
||||
make (size_t format);
|
||||
};
|
||||
|
||||
} // namespace satnogs
|
||||
} // namespace gr
|
||||
|
||||
#endif /* INCLUDED_SATNOGS_CLEAR_TEXT_MSG_SINK_H */
|
||||
#endif /* INCLUDED_SATNOGS_multi_format_MSG_SINK_H */
|
||||
|
|
@ -29,7 +29,7 @@ list(APPEND satnogs_sources
|
|||
morse_tree.cc
|
||||
morse_decoder_impl.cc
|
||||
morse_debug_source_impl.cc
|
||||
clear_text_msg_sink_impl.cc
|
||||
multi_format_msg_sink_impl.cc
|
||||
cw_to_symbol_impl.cc
|
||||
afsk_decoder_impl.cc
|
||||
sine_matched_filter_ff_impl.cc
|
||||
|
|
|
@ -23,37 +23,55 @@
|
|||
#endif
|
||||
|
||||
#include <gnuradio/io_signature.h>
|
||||
#include "clear_text_msg_sink_impl.h"
|
||||
#include "multi_format_msg_sink_impl.h"
|
||||
|
||||
namespace gr {
|
||||
namespace satnogs {
|
||||
|
||||
clear_text_msg_sink::sptr
|
||||
clear_text_msg_sink::make()
|
||||
multi_format_msg_sink::sptr
|
||||
multi_format_msg_sink::make(size_t format)
|
||||
{
|
||||
return gnuradio::get_initial_sptr
|
||||
(new clear_text_msg_sink_impl());
|
||||
(new multi_format_msg_sink_impl(format));
|
||||
}
|
||||
|
||||
void
|
||||
clear_text_msg_sink_impl::msg_handler (pmt::pmt_t msg)
|
||||
multi_format_msg_sink_impl::msg_handler (pmt::pmt_t msg)
|
||||
{
|
||||
std::string s((const char *)pmt::blob_data(msg), pmt::blob_length(msg));
|
||||
std::cout << "Received text sequence:" << s << " " << std::endl;
|
||||
switch(d_format){
|
||||
case 0:
|
||||
std::cout << "Received text sequence:" << s << " " << std::endl;
|
||||
break;
|
||||
case 1:
|
||||
//for(size_t i=0; i< pmt::blob_length(msg); i++)
|
||||
for (size_t i = 0; i < s.length(); ++i)
|
||||
std::cout << "0x" << std::hex<< std::setfill('0') << std::setw(2)<< std::dec <<(int)s[i] << " ";
|
||||
std::cout<<std::endl;
|
||||
break;
|
||||
case 2:
|
||||
for(size_t i=0; i< pmt::blob_length(msg); i++)
|
||||
std::cout<< std::bitset<8>(((uint8_t*)pmt::blob_data(msg))[i]);
|
||||
std::cout<<std::endl;
|
||||
break;
|
||||
default:
|
||||
printf("Invalid format");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The private constructor
|
||||
*/
|
||||
clear_text_msg_sink_impl::clear_text_msg_sink_impl()
|
||||
: gr::block("clear_text_msg_sink",
|
||||
multi_format_msg_sink_impl::multi_format_msg_sink_impl(size_t format)
|
||||
: gr::block("multi_format_msg_sink",
|
||||
gr::io_signature::make(0, 0, 0),
|
||||
gr::io_signature::make(0, 0, 0))
|
||||
gr::io_signature::make(0, 0, 0)),
|
||||
d_format(format)
|
||||
{
|
||||
message_port_register_in(pmt::mp("in"));
|
||||
set_msg_handler (
|
||||
pmt::mp ("in"),
|
||||
boost::bind (&clear_text_msg_sink_impl::msg_handler, this, _1));
|
||||
boost::bind (&multi_format_msg_sink_impl::msg_handler, this, _1));
|
||||
}
|
||||
|
||||
} /* namespace satnogs */
|
|
@ -18,29 +18,31 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_SATNOGS_CLEAR_TEXT_MSG_SINK_IMPL_H
|
||||
#define INCLUDED_SATNOGS_CLEAR_TEXT_MSG_SINK_IMPL_H
|
||||
#ifndef INCLUDED_SATNOGS_MULTI_FORMAT_MSG_SINK_IMPL_H
|
||||
#define INCLUDED_SATNOGS_MULTI_FORMAT_MSG_SINK_IMPL_H
|
||||
|
||||
#include <satnogs/clear_text_msg_sink.h>
|
||||
#include <satnogs/multi_format_msg_sink.h>
|
||||
|
||||
namespace gr
|
||||
{
|
||||
namespace satnogs
|
||||
{
|
||||
|
||||
class clear_text_msg_sink_impl : public clear_text_msg_sink
|
||||
class multi_format_msg_sink_impl : public multi_format_msg_sink
|
||||
{
|
||||
private:
|
||||
void
|
||||
msg_handler(pmt::pmt_t msg);
|
||||
|
||||
size_t d_format;
|
||||
|
||||
public:
|
||||
clear_text_msg_sink_impl ();
|
||||
multi_format_msg_sink_impl (size_t format);
|
||||
|
||||
};
|
||||
|
||||
} // namespace satnogs
|
||||
} // namespace gr
|
||||
|
||||
#endif /* INCLUDED_SATNOGS_CLEAR_TEXT_MSG_SINK_IMPL_H */
|
||||
#endif /* INCLUDED_SATNOGS_multi_format_MSG_SINK_IMPL_H */
|
||||
|
|
@ -31,6 +31,7 @@ endif()
|
|||
GR_PYTHON_INSTALL(
|
||||
FILES
|
||||
__init__.py
|
||||
satnogs_transmitter.py
|
||||
DESTINATION ${GR_PYTHON_DIR}/satnogs
|
||||
)
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ description here (python/__init__.py).
|
|||
try:
|
||||
# this might fail if the module is python-only
|
||||
from satnogs_swig import *
|
||||
from satnogs_transmitter import *
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
|
|
@ -0,0 +1,111 @@
|
|||
#! /usr/bin/python
|
||||
|
||||
import satnogs
|
||||
import satnogs_swig
|
||||
import math
|
||||
from gnuradio import blocks
|
||||
from gnuradio import filter
|
||||
from gnuradio import analog
|
||||
from gnuradio import gr
|
||||
from gnuradio.filter import firdes
|
||||
from gnuradio.gr.runtime_swig import sizeof_gr_complex
|
||||
|
||||
|
||||
class satnogs_transmitter(gr.hier_block2):
|
||||
|
||||
def __init__(self,
|
||||
frame_preamble,
|
||||
sync_word,
|
||||
append_crc,
|
||||
whitening,
|
||||
manchester,
|
||||
msb_first,
|
||||
ax25_format,
|
||||
dest_addr,
|
||||
dest_ssid,
|
||||
src_addr,
|
||||
src_ssid,
|
||||
settling_samples,
|
||||
samps_per_symbol,
|
||||
interpolation_taps,
|
||||
samp_rate,
|
||||
lo_offset,
|
||||
deviation,
|
||||
baud_rate):
|
||||
gr.hier_block2.__init__(self, "satnogs_transmitter",
|
||||
gr.io_signature(0 , 0 , 0),
|
||||
# Output 0: The complex TX signal for the SDR device
|
||||
# Output 1: The constellation output for the vector analyzer
|
||||
gr.io_signature(1, 1, sizeof_gr_complex))
|
||||
self.frame_preamble = frame_preamble
|
||||
self.sync_word = sync_word
|
||||
self.append_crc = append_crc
|
||||
self.whitening = whitening
|
||||
self.manchester = manchester
|
||||
self.msb_first = msb_first
|
||||
self.ax25_format = ax25_format
|
||||
self.dest_addr = dest_addr
|
||||
self.dest_ssid = dest_ssid
|
||||
self.src_addr = src_addr
|
||||
self.src_ssid = src_ssid
|
||||
self.settling_samples = settling_samples
|
||||
self.samps_per_symbol = samps_per_symbol
|
||||
self.interpolation_taps = interpolation_taps
|
||||
self.samp_rate = samp_rate
|
||||
self.lo_offset = lo_offset
|
||||
self.deviation=deviation
|
||||
self.baud_rate=baud_rate
|
||||
self.message_port_register_hier_out("in")
|
||||
|
||||
|
||||
self.modulation_index = self.deviation/(self.baud_rate / 2.0)
|
||||
self.sensitivity = (math.pi*self.modulation_index) / self.samps_per_symbol
|
||||
self.resampling_rate = self.samp_rate / (self.baud_rate*self.samps_per_symbol )
|
||||
self.par_taps = filter.firdes.low_pass_2(32, 32, 0.8, 0.1, 60)
|
||||
self.num_filters = 32
|
||||
|
||||
#=================================================================
|
||||
# TX Related blocks
|
||||
#=================================================================
|
||||
|
||||
self.fsk_frame_encoder = satnogs_swig.upsat_fsk_frame_encoder(self.frame_preamble,
|
||||
self.sync_word,
|
||||
self.append_crc,
|
||||
self.whitening,
|
||||
self.manchester,
|
||||
self.msb_first,
|
||||
self.ax25_format,
|
||||
self.dest_addr,
|
||||
self.dest_ssid,
|
||||
self.src_addr,
|
||||
self.src_ssid,
|
||||
self.settling_samples
|
||||
)
|
||||
|
||||
self.interp_fir_filter = filter.interp_fir_filter_fff(self.samps_per_symbol,
|
||||
self.interpolation_taps
|
||||
)
|
||||
|
||||
self.frequency_modulator = analog.frequency_modulator_fc(self.sensitivity)
|
||||
self.signal_source = analog.sig_source_c(self.samp_rate,
|
||||
102,
|
||||
self.lo_offset,
|
||||
1,
|
||||
0)
|
||||
self.polyphase_arbitrary_resampler = filter.pfb_arb_resampler_ccf(self.resampling_rate,
|
||||
self.par_taps,
|
||||
self.num_filters)
|
||||
self.multiply = blocks.multiply_cc(1)
|
||||
|
||||
#=================================================================
|
||||
# Connections
|
||||
#=================================================================
|
||||
self.msg_connect((self, "in"), (self.fsk_frame_encoder, "pdu"))
|
||||
self.connect((self.fsk_frame_encoder, 0), (self.interp_fir_filter, 0))
|
||||
self.connect((self.interp_fir_filter, 0), (self.frequency_modulator, 0))
|
||||
self.connect((self.frequency_modulator, 0), (self.polyphase_arbitrary_resampler, 0))
|
||||
self.connect((self.signal_source, 0) , (self.multiply, 0))
|
||||
self.connect((self.polyphase_arbitrary_resampler, 0) , (self.multiply, 1))
|
||||
self.connect((self.multiply, 0), self)
|
||||
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
#include "satnogs/morse_tree.h"
|
||||
#include "satnogs/morse_decoder.h"
|
||||
#include "satnogs/morse_debug_source.h"
|
||||
#include "satnogs/clear_text_msg_sink.h"
|
||||
#include "satnogs/multi_format_msg_sink.h"
|
||||
#include "satnogs/cw_to_symbol.h"
|
||||
#include "satnogs/afsk_decoder.h"
|
||||
#include "satnogs/sine_matched_filter_ff.h"
|
||||
|
@ -40,8 +40,8 @@ GR_SWIG_BLOCK_MAGIC2(satnogs, cw_matched_filter_ff);
|
|||
GR_SWIG_BLOCK_MAGIC2(satnogs, morse_decoder);
|
||||
%include "satnogs/morse_debug_source.h"
|
||||
GR_SWIG_BLOCK_MAGIC2(satnogs, morse_debug_source);
|
||||
%include "satnogs/clear_text_msg_sink.h"
|
||||
GR_SWIG_BLOCK_MAGIC2(satnogs, clear_text_msg_sink);
|
||||
%include "satnogs/multi_format_msg_sink.h"
|
||||
GR_SWIG_BLOCK_MAGIC2(satnogs, multi_format_msg_sink);
|
||||
%include "satnogs/cw_to_symbol.h"
|
||||
GR_SWIG_BLOCK_MAGIC2(satnogs, cw_to_symbol);
|
||||
%include "satnogs/afsk_decoder.h"
|
||||
|
|
Loading…
Reference in New Issue