aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2015-04-01 19:26:34 +0200
committerHarald Welte <laforge@gnumonks.org>2015-04-01 19:26:34 +0200
commit0315330e353740ebb7fbbd9b537c0097365242ed (patch)
tree4b9b8c731d11dec4745daec0d531d4983d5c117f
parentefc57bf72df2b33fbaaccd58e65ac3a63a62e533 (diff)
add lead-in symbols
-rw-r--r--gr-adsbtx/grc/adsbtx_AdsbEncoder.xml8
-rw-r--r--gr-adsbtx/include/adsbtx/AdsbEncoder.h2
-rw-r--r--gr-adsbtx/lib/AdsbEncoder_impl.cc17
-rw-r--r--gr-adsbtx/lib/AdsbEncoder_impl.h5
4 files changed, 21 insertions, 11 deletions
diff --git a/gr-adsbtx/grc/adsbtx_AdsbEncoder.xml b/gr-adsbtx/grc/adsbtx_AdsbEncoder.xml
index d9261eb..a1b1cb1 100644
--- a/gr-adsbtx/grc/adsbtx_AdsbEncoder.xml
+++ b/gr-adsbtx/grc/adsbtx_AdsbEncoder.xml
@@ -4,7 +4,13 @@
<key>AdsbEncoder</key>
<category>adsbtx</category>
<import>import adsbtx</import>
- <make>adsbtx.AdsbEncoder()</make>
+ <make>adsbtx.AdsbEncoder($num_lead_in_syms)</make>
+ <param>
+ <name>Number of Lead-In Symbols</name>
+ <key>num_lead_in_syms</key>
+ <value>256</value>
+ <type>int</type>
+ </param>
<sink>
<name>pdus</name>
<type>message</type>
diff --git a/gr-adsbtx/include/adsbtx/AdsbEncoder.h b/gr-adsbtx/include/adsbtx/AdsbEncoder.h
index 1136d7d..aa2ca3b 100644
--- a/gr-adsbtx/include/adsbtx/AdsbEncoder.h
+++ b/gr-adsbtx/include/adsbtx/AdsbEncoder.h
@@ -40,7 +40,7 @@ namespace gr {
public:
typedef boost::shared_ptr<AdsbEncoder> sptr;
- static sptr make(void);
+ static sptr make(unsigned int num_lead_in_syms);
};
} // namespace adsbtx
diff --git a/gr-adsbtx/lib/AdsbEncoder_impl.cc b/gr-adsbtx/lib/AdsbEncoder_impl.cc
index 63c4ac8..9af8415 100644
--- a/gr-adsbtx/lib/AdsbEncoder_impl.cc
+++ b/gr-adsbtx/lib/AdsbEncoder_impl.cc
@@ -50,32 +50,32 @@ namespace gr {
namespace adsbtx {
AdsbEncoder::sptr
- AdsbEncoder::make()
+ AdsbEncoder::make(unsigned int num_lead_in_syms)
{
return gnuradio::get_initial_sptr
- (new AdsbEncoder_impl());
+ (new AdsbEncoder_impl(num_lead_in_syms));
}
/*
* The private constructor
*/
- AdsbEncoder_impl::AdsbEncoder_impl()
+ AdsbEncoder_impl::AdsbEncoder_impl(unsigned int num_lead_in_syms)
: block("ADS-B Payload to Symbols Encoder",
io_signature::make(0, 0, 0),
- io_signature::make(0, 0, 0))
+ io_signature::make(0, 0, 0)),
+ d_num_lead_in_syms(num_lead_in_syms)
{
message_port_register_out(pmt::mp("pdus"));
message_port_register_in(pmt::mp("pdus"));
set_msg_handler(pmt::mp("pdus"), boost::bind(&AdsbEncoder_impl::handle_msg, this, _1));
-#if 0
+
if (d_num_lead_in_syms) {
/* round up to the next byte boundary */
if (d_num_lead_in_syms % 8)
d_num_lead_in_syms += d_num_lead_in_syms % 8;
/* empty vector for lead-in */
- d_lead_in_bytes = pmt::make_u8vector(d_num_lead_in_syms/8, 0);
+ d_lead_in_bytes = pmt::make_u8vector(d_num_lead_in_syms, 0);
}
-#endif
}
@@ -231,6 +231,9 @@ AdsbEncoder_impl::handle_msg(pmt::pmt_t pdu)
if (rc < 0)
return;
+ if (d_lead_in_bytes)
+ message_port_pub(pmt::mp("pdus"), pmt::cons(meta, d_lead_in_bytes));
+
pmt::pmt_t outpdu_bytes = make_pdu_vector(blocks::pdu::byte_t, outbuf, rc);
message_port_pub(pmt::mp("pdus"), pmt::cons(meta, outpdu_bytes));
diff --git a/gr-adsbtx/lib/AdsbEncoder_impl.h b/gr-adsbtx/lib/AdsbEncoder_impl.h
index e99835a..0e841a9 100644
--- a/gr-adsbtx/lib/AdsbEncoder_impl.h
+++ b/gr-adsbtx/lib/AdsbEncoder_impl.h
@@ -32,10 +32,11 @@ namespace gr {
class AdsbEncoder_impl : public AdsbEncoder
{
private:
-
+ unsigned int d_num_lead_in_syms;
+ pmt::pmt_t d_lead_in_bytes;
public:
- AdsbEncoder_impl(void);
+ AdsbEncoder_impl(unsigned int num_lead_in_syms);
~AdsbEncoder_impl(void);
// Where all the action really happens