diff --git a/apps/flowgraphs/upsat_transceiver_cli.grc b/apps/flowgraphs/upsat_transceiver_cli.grc
index 1e23a31..b42130d 100644
--- a/apps/flowgraphs/upsat_transceiver_cli.grc
+++ b/apps/flowgraphs/upsat_transceiver_cli.grc
@@ -66,7 +66,7 @@
run_options
- prompt
+ run
run
@@ -313,7 +313,7 @@ TX sampling rate
_coordinate
- (672, 917)
+ (760, 885)
_rotation
@@ -341,7 +341,7 @@ TX sampling rate
_coordinate
- (672, 805)
+ (760, 773)
_rotation
@@ -1100,7 +1100,7 @@ we shift the LO a little further
_coordinate
- (360, 774)
+ (864, 774)
_rotation
@@ -3958,7 +3958,7 @@ we shift the LO a little further
_coordinate
- (560, 902)
+ (648, 870)
_rotation
@@ -4009,7 +4009,7 @@ we shift the LO a little further
_coordinate
- (1176, 568)
+ (1176, 592)
_rotation
@@ -4045,7 +4045,7 @@ we shift the LO a little further
- satnogs_multi_format_msg_sink
+ satnogs_qb50_deframer
alias
@@ -4060,11 +4060,11 @@ we shift the LO a little further
_enabled
- 1
+ True
_coordinate
- (920, 684)
+ (968, 624)
_rotation
@@ -4072,11 +4072,19 @@ we shift the LO a little further
id
- satnogs_multi_format_msg_sink_0_0
+ satnogs_qb50_deframer_0
- format
- 1
+ maxoutbuf
+ 0
+
+
+ minoutbuf
+ 0
+
+
+ wod_ssid
+ 0xe
@@ -4099,7 +4107,7 @@ we shift the LO a little further
_coordinate
- (936, 598)
+ (728, 670)
_rotation
@@ -4122,6 +4130,49 @@ we shift the LO a little further
send_port
+
+ satnogs_udp_msg_sink
+
+ alias
+
+
+
+ comment
+
+
+
+ affinity
+
+
+
+ _enabled
+ 1
+
+
+ _coordinate
+ (728, 598)
+
+
+ _rotation
+ 180
+
+
+ id
+ satnogs_udp_msg_sink_0_0_0
+
+
+ addr
+ dest_addr
+
+
+ mtu
+ 1500
+
+
+ port
+ wod_port
+
+
satnogs_udp_msg_source
@@ -4321,7 +4372,7 @@ similar to produce dynamic payloads.
_coordinate
- (560, 806)
+ (648, 774)
_rotation
@@ -4348,6 +4399,49 @@ similar to produce dynamic payloads.
usrpb200
+
+ parameter
+
+ alias
+
+
+
+ comment
+
+
+
+ _enabled
+ True
+
+
+ _coordinate
+ (352, 846)
+
+
+ _rotation
+ 0
+
+
+ id
+ wod_port
+
+
+ label
+
+
+
+ short_id
+
+
+
+ type
+ intx
+
+
+ value
+ 5023
+
+
analog_frequency_modulator_fc_0
pfb_arb_resampler_xxx_0
@@ -4416,14 +4510,20 @@ similar to produce dynamic payloads.
satnogs_ax25_decoder_bm_0
- satnogs_multi_format_msg_sink_0_0
+ satnogs_qb50_deframer_0
pdu
in
- satnogs_ax25_decoder_bm_0
+ satnogs_qb50_deframer_0
satnogs_udp_msg_sink_0_0
- pdu
+ out
+ in
+
+
+ satnogs_qb50_deframer_0
+ satnogs_udp_msg_sink_0_0_0
+ wod
in
diff --git a/apps/flowgraphs/upsat_transceiver_cli.py b/apps/flowgraphs/upsat_transceiver_cli.py
index c2d74b5..838c671 100755
--- a/apps/flowgraphs/upsat_transceiver_cli.py
+++ b/apps/flowgraphs/upsat_transceiver_cli.py
@@ -5,7 +5,7 @@
# Title: Upsat Transceiver Cli
# Author: Manolis Surligas (surligas@gmail.com)
# Description: SATNOGS transceiver for UPSAT satellite
-# Generated: Sun Jul 24 21:44:09 2016
+# Generated: Wed Jul 27 17:36:54 2016
##################################################
from gnuradio import analog
@@ -27,7 +27,7 @@ import time
class upsat_transceiver_cli(gr.top_block):
- def __init__(self, bind_addr="0.0.0.0", dest_addr="127.0.0.1", lo_offset=100e3, recv_port=16886, rx_sdr_device="usrpb200", send_port=5022, tx_sdr_device="usrpb200"):
+ def __init__(self, bind_addr="0.0.0.0", dest_addr="127.0.0.1", recv_port=16886, send_port=5022, tx_sdr_device="usrpb200", rx_sdr_device="usrpb200", lo_offset=100e3, wod_port=5023):
gr.top_block.__init__(self, "Upsat Transceiver Cli")
##################################################
@@ -35,11 +35,12 @@ class upsat_transceiver_cli(gr.top_block):
##################################################
self.bind_addr = bind_addr
self.dest_addr = dest_addr
- self.lo_offset = lo_offset
self.recv_port = recv_port
- self.rx_sdr_device = rx_sdr_device
self.send_port = send_port
self.tx_sdr_device = tx_sdr_device
+ self.rx_sdr_device = rx_sdr_device
+ self.lo_offset = lo_offset
+ self.wod_port = wod_port
##################################################
# Variables
@@ -66,8 +67,9 @@ class upsat_transceiver_cli(gr.top_block):
##################################################
self.satnogs_upsat_fsk_frame_encoder_0 = satnogs.upsat_fsk_frame_encoder([0x33]*8 , [0x7A, 0x0E], False, False, False, True, True, "ABCD", 0, "ON02GR", 0, 64)
self.satnogs_udp_msg_source_0 = satnogs.udp_msg_source(bind_addr, recv_port, 1500)
+ self.satnogs_udp_msg_sink_0_0_0 = satnogs.udp_msg_sink(dest_addr, wod_port, 1500)
self.satnogs_udp_msg_sink_0_0 = satnogs.udp_msg_sink(dest_addr, send_port, 1500)
- self.satnogs_multi_format_msg_sink_0_0 = satnogs.multi_format_msg_sink(1)
+ self.satnogs_qb50_deframer_0 = satnogs.qb50_deframer(0xe)
self.satnogs_ax25_decoder_bm_0 = satnogs.ax25_decoder_bm('GND', 0, False, True, 256)
self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_ccf(
samp_rate_tx / (baud_rate * samples_per_symbol_tx),
@@ -111,8 +113,9 @@ class upsat_transceiver_cli(gr.top_block):
##################################################
# Connections
##################################################
- self.msg_connect((self.satnogs_ax25_decoder_bm_0, 'pdu'), (self.satnogs_multi_format_msg_sink_0_0, 'in'))
- self.msg_connect((self.satnogs_ax25_decoder_bm_0, 'pdu'), (self.satnogs_udp_msg_sink_0_0, 'in'))
+ self.msg_connect((self.satnogs_ax25_decoder_bm_0, 'pdu'), (self.satnogs_qb50_deframer_0, 'in'))
+ self.msg_connect((self.satnogs_qb50_deframer_0, 'out'), (self.satnogs_udp_msg_sink_0_0, 'in'))
+ self.msg_connect((self.satnogs_qb50_deframer_0, 'wod'), (self.satnogs_udp_msg_sink_0_0_0, 'in'))
self.msg_connect((self.satnogs_udp_msg_source_0, 'msg'), (self.satnogs_upsat_fsk_frame_encoder_0, 'pdu'))
self.connect((self.analog_frequency_modulator_fc_0, 0), (self.pfb_arb_resampler_xxx_0, 0))
self.connect((self.analog_quadrature_demod_cf_0_0, 0), (self.digital_clock_recovery_mm_xx_0, 0))
@@ -138,34 +141,12 @@ class upsat_transceiver_cli(gr.top_block):
def set_dest_addr(self, dest_addr):
self.dest_addr = dest_addr
- def get_lo_offset(self):
- return self.lo_offset
-
- def set_lo_offset(self, lo_offset):
- self.lo_offset = lo_offset
- self.analog_sig_source_x_0.set_frequency(self.lo_offset )
- self.osmosdr_sink_0.set_center_freq(self.tx_frequency - self.lo_offset, 0)
- self.osmosdr_source_0.set_center_freq(self.rx_frequency - self.lo_offset, 0)
- self.freq_xlating_fir_filter_xxx_0.set_center_freq(self.lo_offset)
-
def get_recv_port(self):
return self.recv_port
def set_recv_port(self, recv_port):
self.recv_port = recv_port
- def get_rx_sdr_device(self):
- return self.rx_sdr_device
-
- def set_rx_sdr_device(self, rx_sdr_device):
- self.rx_sdr_device = rx_sdr_device
- self.set_samp_rate_rx(satnogs.hw_rx_settings[self.rx_sdr_device]['samp_rate'])
- self.set_samp_rate_tx(satnogs.hw_tx_settings[self.rx_sdr_device]['samp_rate'])
- self.osmosdr_source_0.set_gain(satnogs.hw_rx_settings[self.rx_sdr_device]['rf_gain'], 0)
- self.osmosdr_source_0.set_if_gain(satnogs.hw_rx_settings[self.rx_sdr_device]['if_gain'], 0)
- self.osmosdr_source_0.set_bb_gain(satnogs.hw_rx_settings[self.rx_sdr_device]['bb_gain'], 0)
- self.osmosdr_source_0.set_antenna(satnogs.hw_rx_settings[self.rx_sdr_device]['antenna'], 0)
-
def get_send_port(self):
return self.send_port
@@ -182,6 +163,34 @@ class upsat_transceiver_cli(gr.top_block):
self.osmosdr_sink_0.set_bb_gain(satnogs.hw_tx_settings[self.tx_sdr_device]['bb_gain'], 0)
self.osmosdr_sink_0.set_antenna(satnogs.hw_tx_settings[self.tx_sdr_device]['antenna'], 0)
+ def get_rx_sdr_device(self):
+ return self.rx_sdr_device
+
+ def set_rx_sdr_device(self, rx_sdr_device):
+ self.rx_sdr_device = rx_sdr_device
+ self.osmosdr_source_0.set_gain(satnogs.hw_rx_settings[self.rx_sdr_device]['rf_gain'], 0)
+ self.osmosdr_source_0.set_if_gain(satnogs.hw_rx_settings[self.rx_sdr_device]['if_gain'], 0)
+ self.osmosdr_source_0.set_bb_gain(satnogs.hw_rx_settings[self.rx_sdr_device]['bb_gain'], 0)
+ self.osmosdr_source_0.set_antenna(satnogs.hw_rx_settings[self.rx_sdr_device]['antenna'], 0)
+ self.set_samp_rate_tx(satnogs.hw_tx_settings[self.rx_sdr_device]['samp_rate'])
+ self.set_samp_rate_rx(satnogs.hw_rx_settings[self.rx_sdr_device]['samp_rate'])
+
+ def get_lo_offset(self):
+ return self.lo_offset
+
+ def set_lo_offset(self, lo_offset):
+ self.lo_offset = lo_offset
+ self.analog_sig_source_x_0.set_frequency(self.lo_offset )
+ self.freq_xlating_fir_filter_xxx_0.set_center_freq(self.lo_offset)
+ self.osmosdr_sink_0.set_center_freq(self.tx_frequency - self.lo_offset, 0)
+ self.osmosdr_source_0.set_center_freq(self.rx_frequency - self.lo_offset, 0)
+
+ def get_wod_port(self):
+ return self.wod_port
+
+ def set_wod_port(self, wod_port):
+ self.wod_port = wod_port
+
def get_samples_per_symbol_tx(self):
return self.samples_per_symbol_tx
@@ -235,9 +244,9 @@ class upsat_transceiver_cli(gr.top_block):
def set_baud_rate(self, baud_rate):
self.baud_rate = baud_rate
self.set_modulation_index(self.deviation / (self.baud_rate / 2.0))
- self.pfb_arb_resampler_xxx_0.set_rate(self.samp_rate_tx / (self.baud_rate * self.samples_per_symbol_tx))
self.analog_quadrature_demod_cf_0_0.set_gain(((self.first_stage_samp_rate_rx) / self.baud_rate)/(math.pi*self.modulation_index))
self.digital_clock_recovery_mm_xx_0.set_omega(self.first_stage_samp_rate_rx/self.baud_rate)
+ self.pfb_arb_resampler_xxx_0.set_rate(self.samp_rate_tx / (self.baud_rate * self.samples_per_symbol_tx))
def get_tx_frequency(self):
return self.tx_frequency
@@ -259,9 +268,9 @@ class upsat_transceiver_cli(gr.top_block):
def set_samp_rate_tx(self, samp_rate_tx):
self.samp_rate_tx = samp_rate_tx
self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate_tx)
- self.pfb_arb_resampler_xxx_0.set_rate(self.samp_rate_tx / (self.baud_rate * self.samples_per_symbol_tx))
self.osmosdr_sink_0.set_sample_rate(self.samp_rate_tx)
self.osmosdr_sink_0.set_bandwidth(self.samp_rate_tx, 0)
+ self.pfb_arb_resampler_xxx_0.set_rate(self.samp_rate_tx / (self.baud_rate * self.samples_per_symbol_tx))
def get_rx_frequency(self):
return self.rx_frequency
@@ -302,21 +311,24 @@ def argument_parser():
parser.add_option(
"", "--dest-addr", dest="dest_addr", type="string", default="127.0.0.1",
help="Set dest_addr [default=%default]")
- parser.add_option(
- "", "--lo-offset", dest="lo_offset", type="eng_float", default=eng_notation.num_to_str(100e3),
- help="Set lo_offset [default=%default]")
parser.add_option(
"", "--recv-port", dest="recv_port", type="intx", default=16886,
help="Set recv_port [default=%default]")
- parser.add_option(
- "", "--rx-sdr-device", dest="rx_sdr_device", type="string", default="usrpb200",
- help="Set rx_sdr_device [default=%default]")
parser.add_option(
"", "--send-port", dest="send_port", type="intx", default=5022,
help="Set send_port [default=%default]")
parser.add_option(
"", "--tx-sdr-device", dest="tx_sdr_device", type="string", default="usrpb200",
help="Set tx_sdr_device [default=%default]")
+ parser.add_option(
+ "", "--rx-sdr-device", dest="rx_sdr_device", type="string", default="usrpb200",
+ help="Set rx_sdr_device [default=%default]")
+ parser.add_option(
+ "", "--lo-offset", dest="lo_offset", type="eng_float", default=eng_notation.num_to_str(100e3),
+ help="Set lo_offset [default=%default]")
+ parser.add_option(
+ "", "--wod-port", dest="wod_port", type="intx", default=5023,
+ help="Set wod_port [default=%default]")
return parser
@@ -324,13 +336,8 @@ def main(top_block_cls=upsat_transceiver_cli, options=None):
if options is None:
options, _ = argument_parser().parse_args()
- tb = top_block_cls(bind_addr=options.bind_addr, dest_addr=options.dest_addr, lo_offset=options.lo_offset, recv_port=options.recv_port, rx_sdr_device=options.rx_sdr_device, send_port=options.send_port, tx_sdr_device=options.tx_sdr_device)
+ tb = top_block_cls(bind_addr=options.bind_addr, dest_addr=options.dest_addr, recv_port=options.recv_port, send_port=options.send_port, tx_sdr_device=options.tx_sdr_device, rx_sdr_device=options.rx_sdr_device, lo_offset=options.lo_offset, wod_port=options.wod_port)
tb.start()
- try:
- raw_input('Press Enter to quit: ')
- except EOFError:
- pass
- tb.stop()
tb.wait()
diff --git a/apps/flowgraphs/upsat_transceiver_qt.grc b/apps/flowgraphs/upsat_transceiver_qt.grc
index 7a9f0bd..da1f596 100644
--- a/apps/flowgraphs/upsat_transceiver_qt.grc
+++ b/apps/flowgraphs/upsat_transceiver_qt.grc
@@ -1067,6 +1067,49 @@ is too great and becomes a bottlneck.
1
+
+ parameter
+
+ alias
+
+
+
+ comment
+
+
+
+ _enabled
+ True
+
+
+ _coordinate
+ (208, 918)
+
+
+ _rotation
+ 0
+
+
+ id
+ dest_addr
+
+
+ label
+
+
+
+ short_id
+
+
+
+ type
+ string
+
+
+ value
+ 127.0.0.1
+
+
digital_binary_slicer_fb
@@ -4278,7 +4321,42 @@ is too great and becomes a bottlneck.
_coordinate
- (928, 860)
+ (1056, 916)
+
+
+ _rotation
+ 0
+
+
+ id
+ satnogs_multi_format_msg_sink_0_0_0
+
+
+ format
+ 1
+
+
+
+ satnogs_qb50_deframer
+
+ alias
+
+
+
+ comment
+
+
+
+ affinity
+
+
+
+ _enabled
+ True
+
+
+ _coordinate
+ (1024, 792)
_rotation
@@ -4286,11 +4364,19 @@ is too great and becomes a bottlneck.
id
- satnogs_multi_format_msg_sink_0_0
+ satnogs_qb50_deframer_0
- format
- 1
+ maxoutbuf
+ 0
+
+
+ minoutbuf
+ 0
+
+
+ wod_ssid
+ 0xe
@@ -4313,7 +4399,7 @@ is too great and becomes a bottlneck.
_coordinate
- (928, 766)
+ (744, 862)
_rotation
@@ -4321,11 +4407,11 @@ is too great and becomes a bottlneck.
id
- satnogs_udp_msg_sink_0_0
+ satnogs_udp_msg_sink_0_0_0
addr
- "10.0.10.10"
+ dest_addr
mtu
@@ -4333,7 +4419,50 @@ is too great and becomes a bottlneck.
port
- 5021
+ send_port
+
+
+
+ satnogs_udp_msg_sink
+
+ alias
+
+
+
+ comment
+
+
+
+ affinity
+
+
+
+ _enabled
+ 1
+
+
+ _coordinate
+ (744, 774)
+
+
+ _rotation
+ 180
+
+
+ id
+ satnogs_udp_msg_sink_0_0_0_0
+
+
+ addr
+ dest_addr
+
+
+ mtu
+ 1500
+
+
+ port
+ wod_port
@@ -4476,6 +4605,92 @@ similar to produce dynamic payloads.
False
+
+ parameter
+
+ alias
+
+
+
+ comment
+
+
+
+ _enabled
+ True
+
+
+ _coordinate
+ (24, 918)
+
+
+ _rotation
+ 0
+
+
+ id
+ send_port
+
+
+ label
+
+
+
+ short_id
+
+
+
+ type
+ intx
+
+
+ value
+ 5022
+
+
+
+ parameter
+
+ alias
+
+
+
+ comment
+
+
+
+ _enabled
+ True
+
+
+ _coordinate
+ (112, 918)
+
+
+ _rotation
+ 0
+
+
+ id
+ wod_port
+
+
+ label
+
+
+
+ short_id
+
+
+
+ type
+ intx
+
+
+ value
+ 5023
+
+
analog_frequency_modulator_fc_0
pfb_arb_resampler_xxx_0
@@ -4544,13 +4759,7 @@ similar to produce dynamic payloads.
satnogs_ax25_decoder_bm_0
- satnogs_multi_format_msg_sink_0_0
- pdu
- in
-
-
- satnogs_ax25_decoder_bm_0
- satnogs_udp_msg_sink_0_0
+ satnogs_qb50_deframer_0
pdu
in
@@ -4560,6 +4769,30 @@ similar to produce dynamic payloads.
msg
pdu
+
+ satnogs_qb50_deframer_0
+ satnogs_multi_format_msg_sink_0_0_0
+ out
+ in
+
+
+ satnogs_qb50_deframer_0
+ satnogs_udp_msg_sink_0_0_0
+ out
+ in
+
+
+ satnogs_qb50_deframer_0
+ satnogs_multi_format_msg_sink_0_0_0
+ wod
+ in
+
+
+ satnogs_qb50_deframer_0
+ satnogs_udp_msg_sink_0_0_0_0
+ wod
+ in
+
satnogs_udp_msg_source_0
satnogs_upsat_fsk_frame_encoder_0
diff --git a/grc/CMakeLists.txt b/grc/CMakeLists.txt
index 0b5878d..4546851 100644
--- a/grc/CMakeLists.txt
+++ b/grc/CMakeLists.txt
@@ -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
)
diff --git a/grc/satnogs_qb50_deframer.xml b/grc/satnogs_qb50_deframer.xml
new file mode 100644
index 0000000..fba319a
--- /dev/null
+++ b/grc/satnogs_qb50_deframer.xml
@@ -0,0 +1,31 @@
+
+
+ QB50 AX.25 Deframer
+ satnogs_qb50_deframer
+ satnogs
+ import satnogs
+ satnogs.qb50_deframer($wod_ssid)
+
+
+ WOD SSID
+ wod_ssid
+ 0xe
+ int
+
+
+
+ in
+ message
+
+
+
+
+
+
+
diff --git a/include/satnogs/CMakeLists.txt b/include/satnogs/CMakeLists.txt
index 151ef6d..c31ecee 100644
--- a/include/satnogs/CMakeLists.txt
+++ b/include/satnogs/CMakeLists.txt
@@ -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
)
diff --git a/include/satnogs/ax25.h b/include/satnogs/ax25.h
index d61ed6c..7b867ff 100644
--- a/include/satnogs/ax25.h
+++ b/include/satnogs/ax25.h
@@ -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,
diff --git a/include/satnogs/qb50_deframer.h b/include/satnogs/qb50_deframer.h
new file mode 100644
index 0000000..5a9bf3b
--- /dev/null
+++ b/include/satnogs/qb50_deframer.h
@@ -0,0 +1,57 @@
+/* -*- 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_QB50_DEFRAMER_H
+#define INCLUDED_SATNOGS_QB50_DEFRAMER_H
+
+#include
+#include
+
+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 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 */
+
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index ed48f3b..1a8d27d 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -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)
diff --git a/lib/ax25_decoder_bm_impl.cc b/lib/ax25_decoder_bm_impl.cc
index 3765680..087c2ad 100644
--- a/lib/ax25_decoder_bm_impl.cc
+++ b/lib/ax25_decoder_bm_impl.cc
@@ -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 (
diff --git a/lib/qb50_deframer_impl.cc b/lib/qb50_deframer_impl.cc
new file mode 100644
index 0000000..8bea79e
--- /dev/null
+++ b/lib/qb50_deframer_impl.cc
@@ -0,0 +1,95 @@
+/* -*- 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 "qb50_deframer_impl.h"
+#include
+
+namespace gr
+{
+ namespace satnogs
+ {
+
+ qb50_deframer::sptr
+ qb50_deframer::make (uint8_t wod_ssid)
+ {
+ return gnuradio::get_initial_sptr (new qb50_deframer_impl (wod_ssid));
+ }
+
+ void
+ qb50_deframer_impl::msg_handler (pmt::pmt_t msg)
+ {
+ const uint8_t *frame;
+ uint8_t dest_ssid;
+ size_t frame_len;
+
+ frame = (const uint8_t *) pmt::blob_data(msg);
+ frame_len = pmt::blob_length(msg);
+
+ if(frame_len < AX25_MIN_ADDR_LEN){
+ LOG_ERROR("Invalid AX.25 frame size");
+ return;
+ }
+
+ /*
+ * Get the destination SSID and decide in which port the frame should
+ * be forwarded. Also skip the leading headers and leave only the payload
+ */
+ dest_ssid = ax25_get_dest_ssid(frame);
+ if(dest_ssid == d_wod_ssid){
+ message_port_pub (
+ pmt::mp ("wod"),
+ pmt::make_blob (frame + AX25_MIN_ADDR_LEN + 2,
+ frame_len - AX25_MIN_ADDR_LEN - 2));
+ }
+ else{
+ message_port_pub (
+ pmt::mp ("out"),
+ pmt::make_blob (frame + AX25_MIN_ADDR_LEN + 2,
+ frame_len - AX25_MIN_ADDR_LEN - 2));
+ }
+ }
+
+ /*
+ * The private constructor
+ */
+ qb50_deframer_impl::qb50_deframer_impl(uint8_t wod_ssid)
+ : gr::block("qb50_deframer",
+ gr::io_signature::make(0, 0, 0),
+ gr::io_signature::make(0, 0, 0)),
+ d_wod_ssid(wod_ssid)
+ {
+ message_port_register_in(pmt::mp("in"));
+ message_port_register_out(pmt::mp("out"));
+ message_port_register_out(pmt::mp("wod"));
+
+ set_msg_handler (
+ pmt::mp ("in"),
+ boost::bind (&qb50_deframer_impl::msg_handler, this, _1));
+ }
+
+
+ } /* namespace satnogs */
+} /* namespace gr */
+
diff --git a/lib/qb50_deframer_impl.h b/lib/qb50_deframer_impl.h
new file mode 100644
index 0000000..bad2c74
--- /dev/null
+++ b/lib/qb50_deframer_impl.h
@@ -0,0 +1,46 @@
+/* -*- 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_QB50_DEFRAMER_IMPL_H
+#define INCLUDED_SATNOGS_QB50_DEFRAMER_IMPL_H
+
+#include
+
+namespace gr
+{
+ namespace satnogs
+ {
+
+ class qb50_deframer_impl : public qb50_deframer
+ {
+ private:
+ const uint8_t d_wod_ssid;
+
+ void msg_handler(pmt::pmt_t msg);
+
+ public:
+ qb50_deframer_impl (uint8_t wod_ssid);
+ };
+
+ } // namespace satnogs
+} // namespace gr
+
+#endif /* INCLUDED_SATNOGS_QB50_DEFRAMER_IMPL_H */
+
diff --git a/swig/satnogs_swig.i b/swig/satnogs_swig.i
index ac44530..d9ffd36 100644
--- a/swig/satnogs_swig.i
+++ b/swig/satnogs_swig.i
@@ -30,6 +30,7 @@
#include "satnogs/debug_msg_source_raw.h"
#include "satnogs/ax25_encoder_mb.h"
#include "satnogs/ax25_decoder_bm.h"
+#include "satnogs/qb50_deframer.h"
%}
@@ -75,3 +76,5 @@ GR_SWIG_BLOCK_MAGIC2(satnogs, debug_msg_source_raw);
GR_SWIG_BLOCK_MAGIC2(satnogs, ax25_encoder_mb);
%include "satnogs/ax25_decoder_bm.h"
GR_SWIG_BLOCK_MAGIC2(satnogs, ax25_decoder_bm);
+%include "satnogs/qb50_deframer.h"
+GR_SWIG_BLOCK_MAGIC2(satnogs, qb50_deframer);