Commit a92eb283 authored by Manolis Surligas's avatar Manolis Surligas

Add the QB50 deframer block

The block is able to separate WOD AX.25 frames from normal ones. 
parent 6a063956
......@@ -66,7 +66,7 @@
</param>
<param>
<key>run_options</key>
<value>prompt</value>
<value>run</value>
</param>
<param>
<key>run</key>
......@@ -313,7 +313,7 @@ TX sampling rate</value>
</param>
<param>
<key>_coordinate</key>
<value>(672, 917)</value>
<value>(760, 885)</value>
</param>
<param>
<key>_rotation</key>
......@@ -341,7 +341,7 @@ TX sampling rate</value>
</param>
<param>
<key>_coordinate</key>
<value>(672, 805)</value>
<value>(760, 773)</value>
</param>
<param>
<key>_rotation</key>
......@@ -1100,7 +1100,7 @@ we shift the LO a little further</value>
</param>
<param>
<key>_coordinate</key>
<value>(360, 774)</value>
<value>(864, 774)</value>
</param>
<param>
<key>_rotation</key>
......@@ -3958,7 +3958,7 @@ we shift the LO a little further</value>
</param>
<param>
<key>_coordinate</key>
<value>(560, 902)</value>
<value>(648, 870)</value>
</param>
<param>
<key>_rotation</key>
......@@ -4009,7 +4009,7 @@ we shift the LO a little further</value>
</param>
<param>
<key>_coordinate</key>
<value>(1176, 568)</value>
<value>(1176, 592)</value>
</param>
<param>
<key>_rotation</key>
......@@ -4045,7 +4045,7 @@ we shift the LO a little further</value>
</param>
</block>
<block>
<key>satnogs_multi_format_msg_sink</key>
<key>satnogs_qb50_deframer</key>
<param>
<key>alias</key>
<value></value>
......@@ -4060,11 +4060,11 @@ we shift the LO a little further</value>
</param>
<param>
<key>_enabled</key>
<value>1</value>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(920, 684)</value>
<value>(968, 624)</value>
</param>
<param>
<key>_rotation</key>
......@@ -4072,11 +4072,19 @@ we shift the LO a little further</value>
</param>
<param>
<key>id</key>
<value>satnogs_multi_format_msg_sink_0_0</value>
<value>satnogs_qb50_deframer_0</value>
</param>
<param>
<key>format</key>
<value>1</value>
<key>maxoutbuf</key>
<value>0</value>
</param>
<param>
<key>minoutbuf</key>
<value>0</value>
</param>
<param>
<key>wod_ssid</key>
<value>0xe</value>
</param>
</block>
<block>
......@@ -4099,7 +4107,7 @@ we shift the LO a little further</value>
</param>
<param>
<key>_coordinate</key>
<value>(936, 598)</value>
<value>(728, 670)</value>
</param>
<param>
<key>_rotation</key>
......@@ -4122,6 +4130,49 @@ we shift the LO a little further</value>
<value>send_port</value>
</param>
</block>
<block>
<key>satnogs_udp_msg_sink</key>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>1</value>
</param>
<param>
<key>_coordinate</key>
<value>(728, 598)</value>
</param>
<param>
<key>_rotation</key>
<value>180</value>
</param>
<param>
<key>id</key>
<value>satnogs_udp_msg_sink_0_0_0</value>
</param>
<param>
<key>addr</key>
<value>dest_addr</value>
</param>
<param>
<key>mtu</key>
<value>1500</value>
</param>
<param>
<key>port</key>
<value>wod_port</value>
</param>
</block>
<block>
<key>satnogs_udp_msg_source</key>
<param>
......@@ -4321,7 +4372,7 @@ similar to produce dynamic payloads.</value>
</param>
<param>
<key>_coordinate</key>
<value>(560, 806)</value>
<value>(648, 774)</value>
</param>
<param>
<key>_rotation</key>
......@@ -4348,6 +4399,49 @@ similar to produce dynamic payloads.</value>
<value>usrpb200</value>
</param>
</block>
<block>
<key>parameter</key>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(352, 846)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>wod_port</value>
</param>
<param>
<key>label</key>
<value></value>
</param>
<param>
<key>short_id</key>
<value></value>
</param>
<param>
<key>type</key>
<value>intx</value>
</param>
<param>
<key>value</key>
<value>5023</value>
</param>
</block>
<connection>
<source_block_id>analog_frequency_modulator_fc_0</source_block_id>
<sink_block_id>pfb_arb_resampler_xxx_0</sink_block_id>
......@@ -4416,14 +4510,20 @@ similar to produce dynamic payloads.</value>
</connection>
<connection>
<source_block_id>satnogs_ax25_decoder_bm_0</source_block_id>
<sink_block_id>satnogs_multi_format_msg_sink_0_0</sink_block_id>
<sink_block_id>satnogs_qb50_deframer_0</sink_block_id>
<source_key>pdu</source_key>
<sink_key>in</sink_key>
</connection>
<connection>
<source_block_id>satnogs_ax25_decoder_bm_0</source_block_id>
<source_block_id>satnogs_qb50_deframer_0</source_block_id>
<sink_block_id>satnogs_udp_msg_sink_0_0</sink_block_id>
<source_key>pdu</source_key>
<source_key>out</source_key>
<sink_key>in</sink_key>
</connection>
<connection>
<source_block_id>satnogs_qb50_deframer_0</source_block_id>
<sink_block_id>satnogs_udp_msg_sink_0_0_0</sink_block_id>
<source_key>wod</source_key>
<sink_key>in</sink_key>
</connection>
<connection>
......
This diff is collapsed.
......@@ -1067,6 +1067,49 @@ is too great and becomes a bottlneck.</value>
<value>1</value>
</param>
</block>
<block>
<key>parameter</key>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(208, 918)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>dest_addr</value>
</param>
<param>
<key>label</key>
<value></value>
</param>
<param>
<key>short_id</key>
<value></value>
</param>
<param>
<key>type</key>
<value>string</value>
</param>
<param>
<key>value</key>
<value>127.0.0.1</value>
</param>
</block>
<block>
<key>digital_binary_slicer_fb</key>
<param>
......@@ -4278,21 +4321,64 @@ is too great and becomes a bottlneck.</value>
</param>
<param>
<key>_coordinate</key>
<value>(928, 860)</value>
<value>(1056, 916)</value>
</param>
<param>
<key>_rotation</key>
<value>180</value>
<value>0</value>
</param>
<param>
<key>id</key>
<value>satnogs_multi_format_msg_sink_0_0</value>
<value>satnogs_multi_format_msg_sink_0_0_0</value>
</param>
<param>
<key>format</key>
<value>1</value>
</param>
</block>
<block>
<key>satnogs_qb50_deframer</key>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(1024, 792)</value>
</param>
<param>
<key>_rotation</key>
<value>180</value>
</param>
<param>
<key>id</key>
<value>satnogs_qb50_deframer_0</value>
</param>
<param>
<key>maxoutbuf</key>
<value>0</value>
</param>
<param>
<key>minoutbuf</key>
<value>0</value>
</param>
<param>
<key>wod_ssid</key>
<value>0xe</value>
</param>
</block>
<block>
<key>satnogs_udp_msg_sink</key>
<param>
......@@ -4313,7 +4399,7 @@ is too great and becomes a bottlneck.</value>
</param>
<param>
<key>_coordinate</key>
<value>(928, 766)</value>
<value>(744, 862)</value>
</param>
<param>
<key>_rotation</key>
......@@ -4321,11 +4407,11 @@ is too great and becomes a bottlneck.</value>
</param>
<param>
<key>id</key>
<value>satnogs_udp_msg_sink_0_0</value>
<value>satnogs_udp_msg_sink_0_0_0</value>
</param>
<param>
<key>addr</key>
<value>"10.0.10.10"</value>
<value>dest_addr</value>
</param>
<param>
<key>mtu</key>
......@@ -4333,7 +4419,50 @@ is too great and becomes a bottlneck.</value>
</param>
<param>
<key>port</key>
<value>5021</value>
<value>send_port</value>
</param>
</block>
<block>
<key>satnogs_udp_msg_sink</key>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>1</value>
</param>
<param>
<key>_coordinate</key>
<value>(744, 774)</value>
</param>
<param>
<key>_rotation</key>
<value>180</value>
</param>
<param>
<key>id</key>
<value>satnogs_udp_msg_sink_0_0_0_0</value>
</param>
<param>
<key>addr</key>
<value>dest_addr</value>
</param>
<param>
<key>mtu</key>
<value>1500</value>
</param>
<param>
<key>port</key>
<value>wod_port</value>
</param>
</block>
<block>
......@@ -4476,6 +4605,92 @@ similar to produce dynamic payloads.</value>
<value>False</value>
</param>
</block>
<block>
<key>parameter</key>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(24, 918)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>send_port</value>
</param>
<param>
<key>label</key>
<value></value>
</param>
<param>
<key>short_id</key>
<value></value>
</param>
<param>
<key>type</key>
<value>intx</value>
</param>
<param>
<key>value</key>
<value>5022</value>
</param>
</block>
<block>
<key>parameter</key>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(112, 918)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>wod_port</value>
</param>
<param>
<key>label</key>
<value></value>
</param>
<param>
<key>short_id</key>
<value></value>
</param>
<param>
<key>type</key>
<value>intx</value>
</param>
<param>
<key>value</key>
<value>5023</value>
</param>
</block>
<connection>
<source_block_id>analog_frequency_modulator_fc_0</source_block_id>
<sink_block_id>pfb_arb_resampler_xxx_0</sink_block_id>
......@@ -4544,13 +4759,7 @@ similar to produce dynamic payloads.</value>
</connection>
<connection>
<source_block_id>satnogs_ax25_decoder_bm_0</source_block_id>
<sink_block_id>satnogs_multi_format_msg_sink_0_0</sink_block_id>
<source_key>pdu</source_key>
<sink_key>in</sink_key>
</connection>
<connection>
<source_block_id>satnogs_ax25_decoder_bm_0</source_block_id>
<sink_block_id>satnogs_udp_msg_sink_0_0</sink_block_id>
<sink_block_id>satnogs_qb50_deframer_0</sink_block_id>
<source_key>pdu</source_key>
<sink_key>in</sink_key>
</connection>
......@@ -4560,6 +4769,30 @@ similar to produce dynamic payloads.</value>
<source_key>msg</source_key>
<sink_key>pdu</sink_key>
</connection>
<connection>
<source_block_id>satnogs_qb50_deframer_0</source_block_id>
<sink_block_id>satnogs_multi_format_msg_sink_0_0_0</sink_block_id>
<source_key>out</source_key>
<sink_key>in</sink_key>
</connection>
<connection>
<source_block_id>satnogs_qb50_deframer_0</source_block_id>
<sink_block_id>satnogs_udp_msg_sink_0_0_0</sink_block_id>
<source_key>out</source_key>
<sink_key>in</sink_key>
</connection>
<connection>
<source_block_id>satnogs_qb50_deframer_0</source_block_id>
<sink_block_id>satnogs_multi_format_msg_sink_0_0_0</sink_block_id>
<source_key>wod</source_key>
<sink_key>in</sink_key>
</connection>
<connection>
<source_block_id>satnogs_qb50_deframer_0</source_block_id>
<sink_block_id>satnogs_udp_msg_sink_0_0_0_0</sink_block_id>
<source_key>wod</source_key>
<sink_key>in</sink_key>
</connection>
<connection>
<source_block_id>satnogs_udp_msg_source_0</source_block_id>
<sink_block_id>satnogs_upsat_fsk_frame_encoder_0</sink_block_id>
......
......@@ -37,5 +37,6 @@ install(FILES
satnogs_coarse_doppler_correction_cc.xml
satnogs_debug_msg_source_raw.xml
satnogs_ax25_encoder_mb.xml
satnogs_ax25_decoder_bm.xml DESTINATION share/gnuradio/grc/blocks
satnogs_ax25_decoder_bm.xml
satnogs_qb50_deframer.xml DESTINATION share/gnuradio/grc/blocks
)
<?xml version="1.0"?>
<block>
<name>QB50 AX.25 Deframer</name>
<key>satnogs_qb50_deframer</key>
<category>satnogs</category>
<import>import satnogs</import>
<make>satnogs.qb50_deframer($wod_ssid)</make>
<param>
<name>WOD SSID</name>
<key>wod_ssid</key>
<value>0xe</value>
<type>int</type>
</param>
<sink>
<name>in</name>
<type>message</type>
</sink>
<source>
<name>out</name>
<type>message</type>
</source>
<source>
<name>wod</name>
<type>message</type>
</source>
</block>
......@@ -49,5 +49,6 @@ install(FILES
coarse_doppler_correction_cc.h
debug_msg_source_raw.h
ax25_encoder_mb.h
ax25_decoder_bm.h DESTINATION include/satnogs
ax25_decoder_bm.h
qb50_deframer.h DESTINATION include/satnogs
)
......@@ -133,6 +133,19 @@ namespace gr
return AX25_MIN_ADDR_LEN;
}
/**
* Gets the destination SSID of an AX.25 frame
* @param in the AX.25 frame buffer
* @return the destination SSID
*/
static inline uint8_t
ax25_get_dest_ssid(const uint8_t *in)
{
uint8_t ret;
ret = in[AX25_CALLSIGN_MAX_LEN];
return (ret >> 1) & 0b1111;
}
static inline size_t
ax25_prepare_frame (uint8_t *out, const uint8_t *info, size_t info_len,
ax25_frame_type_t type, uint8_t *addr, size_t addr_len,
......
/* -*- 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_QB50_DEFRAMER_H
#define INCLUDED_SATNOGS_QB50_DEFRAMER_H
#include <satnogs/api.h>
#include <gnuradio/block.h>
namespace gr
{
namespace satnogs
{
/*!
* \brief Parses the received AX.25 and separates the
* telecommand and control frames from the WOD frames.
* \ingroup satnogs
*
*/
class SATNOGS_API qb50_deframer : virtual public gr::block
{
public:
typedef boost::shared_ptr<qb50_deframer> sptr;
/*!
* \brief Parses the received AX.25 and separates the
* telecommand and control frames from the WOD frames.
*
* @param wod_ssid the SSID that separates the WOD frames from the others
*/
static sptr
make (uint8_t wod_ssid);
};
} // namespace satnogs
} // namespace gr
#endif /* INCLUDED_SATNOGS_QB50_DEFRAMER_H */
......@@ -47,7 +47,8 @@ list(APPEND satnogs_sources
coarse_doppler_correction_cc_impl.cc
debug_msg_source_raw_impl.cc
ax25_encoder_mb_impl.cc
ax25_decoder_bm_impl.cc )
ax25_decoder_bm_impl.cc
qb50_deframer_impl.cc )
set(satnogs_sources "${satnogs_sources}" PARENT_SCOPE)
if(NOT satnogs_sources)
......
......@@ -313,13 +313,10 @@ namespace gr
| d_frame_buffer[d_received_bytes - 2];
if (fcs == recv_fcs) {
/*
* FIXME: Skip the right amount of header bytes based on the frame type
*/
message_port_pub (
pmt::mp ("pdu"),
pmt::make_blob (d_frame_buffer + AX25_MIN_ADDR_LEN + 2,
d_received_bytes - AX25_MIN_ADDR_LEN - 2 - sizeof(uint16_t)));
pmt::make_blob (d_frame_buffer,
d_received_bytes - sizeof(uint16_t)));
}
else {
message_port_pub (
......
/* -*- 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/>.
*/