Add beta and csi to decode_mac PDU output.

Also changed to using `std::vector<gr_complex>` type because it was becoming more and more inconvenient to use c-style arrays.
This commit is contained in:
Anton Ottosson
2021-07-09 21:54:38 +02:00
parent 4a3f387d6d
commit 228d1b1bcc
4 changed files with 15 additions and 8 deletions
+6 -1
View File
@@ -76,7 +76,8 @@ int general_work (int noutput_items, gr_vector_int& ninput_items,
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)));
d_beta = pmt::to_double(pmt::dict_ref(dict, pmt::mp("beta"), pmt::from_double(0)));
d_csi = pmt::c32vector_elements(pmt::dict_ref(dict, pmt::mp("csi"), pmt::make_c32vector(52, 0)));
ofdm_param ofdm = ofdm_param((Encoding)encoding);
frame_param frame = frame_param(ofdm, len_data);
@@ -149,6 +150,8 @@ void decode() {
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("beta"), pmt::from_double(d_beta));
dict = pmt::dict_add(dict, pmt::mp("csi"), pmt::init_c32vector(52, d_csi));
dict = pmt::dict_add(dict, pmt::mp("dlt"), pmt::from_long(LINKTYPE_IEEE802_11));
message_port_pub(pmt::mp("out"), pmt::cons(dict, blob));
}
@@ -230,6 +233,8 @@ private:
double d_snr; // dB
double d_nom_freq; // nominal frequency, Hz
double d_freq_offset; // frequency offset, Hz
double d_beta;
std::vector<gr_complex> d_csi;
viterbi_decoder d_decoder;
uint8_t d_rx_symbols[48 * MAX_SYM];
+4 -5
View File
@@ -41,15 +41,14 @@ const gr_complex base::POLARITY[127] = {
-1,-1,-1,-1,-1, 1,-1, 1, 1,-1, 1,-1, 1, 1, 1,-1,
-1, 1,-1,-1,-1, 1, 1, 1,-1,-1,-1,-1,-1,-1,-1 };
const gr_complex* base::get_csi() {
static gr_complex csi[52];
int j = 0;
std::vector<gr_complex> base::get_csi() {
std::vector<gr_complex> csi;
csi.reserve(52);
for (int i = 0; i < 64; i++) {
if ((i == 32) || (i < 6) || (i > 58)) {
continue;
}
csi[j] = d_H[i];
j++;
csi.push_back(d_H[i]);
}
return csi;
}
+1 -1
View File
@@ -33,7 +33,7 @@ public:
static const gr_complex POLARITY[127];
const gr_complex* get_csi();
std::vector<gr_complex> get_csi();
protected:
static const gr_complex LONG[64];
+4 -1
View File
@@ -218,7 +218,10 @@ frame_equalizer_impl::general_work (int noutput_items,
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));
dict = pmt::dict_add(dict, pmt::mp("beta"), pmt::from_double(beta));
dict = pmt::dict_add(dict, pmt::mp("csi"), pmt::init_c32vector(52, d_equalizer->get_csi()));
std::vector<gr_complex> csi = d_equalizer->get_csi();
dict = pmt::dict_add(dict, pmt::mp("csi"), pmt::init_c32vector(csi.size(), csi));
add_item_tag(0, nitems_written(0) + o,
pmt::string_to_symbol("wifi_start"),
dict,