Add nomfreq, freqofs, dlt to PDU metadata

Add Nominal Frequency, Carrier Frequency Offset and Data Link Type (DLT)
tags to PDU.

Signed-off-by: Jonathan Brucker jonathan.brucke@gmail.com
This commit is contained in:
Jonathan Brucker
2016-08-30 16:15:54 +00:00
parent da1b0eb713
commit bef6e3d962
3 changed files with 22 additions and 5 deletions
+12 -1
View File
@@ -24,6 +24,8 @@
using namespace gr::ieee802_11;
#define LINKTYPE_IEEE802_11 105 /* http://www.tcpdump.org/linktypes.html */
class decode_mac_impl : public decode_mac {
public:
@@ -34,6 +36,8 @@ decode_mac_impl(bool log, bool debug) :
d_log(log),
d_debug(debug),
d_snr(0),
d_nom_freq(0.0),
d_freq_offset(0.0),
d_ofdm(BPSK_1_2),
d_frame(d_ofdm, 0),
d_frame_complete(true) {
@@ -70,6 +74,8 @@ int general_work (int noutput_items, gr_vector_int& ninput_items,
int len_data = pmt::to_uint64(pmt::tuple_ref(tuple, 0));
int encoding = pmt::to_uint64(pmt::tuple_ref(tuple, 1));
d_snr = pmt::to_double(pmt::tuple_ref(tuple, 2));
d_nom_freq = pmt::to_double(pmt::tuple_ref(tuple, 3));
d_freq_offset = pmt::to_double(pmt::tuple_ref(tuple, 4));
ofdm_param ofdm = ofdm_param((Encoding)encoding);
frame_param frame = frame_param(ofdm, len_data);
@@ -141,6 +147,9 @@ void decode() {
pmt::pmt_t dict = pmt::make_dict();
dict = pmt::dict_add(dict, pmt::mp("encoding"), enc);
dict = pmt::dict_add(dict, pmt::mp("snr"), pmt::from_double(d_snr));
dict = pmt::dict_add(dict, pmt::mp("nomfreq"), pmt::from_double(d_nom_freq));
dict = pmt::dict_add(dict, pmt::mp("freqofs"), pmt::from_double(d_freq_offset));
dict = pmt::dict_add(dict, pmt::mp("dlt"), pmt::from_long(LINKTYPE_IEEE802_11));
message_port_pub(pmt::mp("out"), pmt::cons(dict, blob));
}
@@ -218,7 +227,9 @@ private:
frame_param d_frame;
ofdm_param d_ofdm;
double d_snr;
double d_snr; // dB
double d_nom_freq; // nominal frequency, Hz
double d_freq_offset; // frequency offset, Hz
viterbi_decoder d_decoder;
uint8_t d_rx_symbols[48 * MAX_SYM];