diff --git a/lib/decode_mac.cc b/lib/decode_mac.cc index 5dff67e..1a58a83 100644 --- a/lib/decode_mac.cc +++ b/lib/decode_mac.cc @@ -70,12 +70,12 @@ int general_work (int noutput_items, gr_vector_int& ninput_items, } d_frame_complete = false; - pmt::pmt_t tuple = tags[0].value; - 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)); + pmt::pmt_t dict = tags[0].value; + int len_data = pmt::to_uint64(pmt::dict_ref(dict, pmt::mp("frame_bytes"), pmt::from_uint64(MAX_PSDU_SIZE+1))); + int encoding = pmt::to_uint64(pmt::dict_ref(dict, pmt::mp("encoding"), pmt::from_uint64(0))); + d_snr = pmt::to_double(pmt::dict_ref(dict, pmt::mp("snr"), pmt::from_double(0))); + d_nom_freq = pmt::to_double(pmt::dict_ref(dict, pmt::mp("freq"), pmt::from_double(0))); + d_freq_offset = pmt::to_double(pmt::dict_ref(dict, pmt::mp("freq_offset"), pmt::from_double(0))); ofdm_param ofdm = ofdm_param((Encoding)encoding); frame_param frame = frame_param(ofdm, len_data); diff --git a/lib/frame_equalizer_impl.cc b/lib/frame_equalizer_impl.cc index 6b85e66..f5c5b40 100644 --- a/lib/frame_equalizer_impl.cc +++ b/lib/frame_equalizer_impl.cc @@ -209,15 +209,16 @@ frame_equalizer_impl::general_work (int noutput_items, if(decode_signal_field(out + o * 48)) { - // TODO: it would better to use pmt::dict instead of raw list of numbers + pmt::pmt_t dict = pmt::make_dict(); + dict = pmt::dict_add(dict, pmt::mp("frame_bytes"), pmt::from_uint64(d_frame_bytes)); + dict = pmt::dict_add(dict, pmt::mp("encoding"), pmt::from_uint64(d_frame_encoding)); + dict = pmt::dict_add(dict, pmt::mp("snr"), pmt::from_double(d_equalizer->get_snr())); + dict = pmt::dict_add(dict, pmt::mp("freq"), pmt::from_double(d_freq)); + dict = pmt::dict_add(dict, pmt::mp("freq_offset"), pmt::from_double(d_freq_offset_from_synclong)); add_item_tag(0, nitems_written(0) + o, pmt::string_to_symbol("wifi_start"), - pmt::make_tuple(pmt::from_uint64(d_frame_bytes), - pmt::from_uint64(d_frame_encoding), - pmt::from_double(d_equalizer->get_snr()), - pmt::from_double(d_freq), // nominal frequency - pmt::from_double(d_freq_offset_from_synclong)), - pmt::string_to_symbol(name())); + dict, + pmt::string_to_symbol(alias())); } }