Added Extract CSI block.
This block takes PDU messages as input, looks for a "csi" entry in the meta dictionary, and if found outputs a complex CSI vector on a stream output. The meta is also sent along as stream tags.
This commit is contained in:
@@ -22,6 +22,7 @@ install(FILES
|
||||
ieee802_11_chunks_to_symbols.block.yml
|
||||
ieee802_11_decode_mac.block.yml
|
||||
ieee802_11_ether_encap.block.yml
|
||||
ieee802_11_extract_csi.block.yml
|
||||
ieee802_11_frame_equalizer.block.yml
|
||||
ieee802_11_mac.block.yml
|
||||
ieee802_11_mapper.block.yml
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
id: ieee802_11_extract_csi
|
||||
label: Extract CSI
|
||||
category: '[IEEE802.11]'
|
||||
|
||||
templates:
|
||||
imports: import ieee802_11
|
||||
make: ieee802_11.extract_csi()
|
||||
|
||||
inputs:
|
||||
- label: pdu in
|
||||
domain: message
|
||||
optional: false
|
||||
|
||||
outputs:
|
||||
- label: csi out
|
||||
domain: stream
|
||||
dtype: complex
|
||||
vlen: 52
|
||||
optional: false
|
||||
|
||||
file_format: 1
|
||||
@@ -25,6 +25,7 @@ list(APPEND include_sources
|
||||
constellations.h
|
||||
decode_mac.h
|
||||
ether_encap.h
|
||||
extract_csi.h
|
||||
frame_equalizer.h
|
||||
mac.h
|
||||
mapper.h
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2021 Anton Ottosson.
|
||||
*
|
||||
* This 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, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This software 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 software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_IEEE802_11_EXTRACT_CSI_H
|
||||
#define INCLUDED_IEEE802_11_EXTRACT_CSI_H
|
||||
|
||||
#include <ieee802_11/api.h>
|
||||
#include <gnuradio/sync_block.h>
|
||||
|
||||
namespace gr {
|
||||
namespace ieee802_11 {
|
||||
|
||||
class IEEE802_11_API extract_csi : virtual public gr::sync_block
|
||||
{
|
||||
public:
|
||||
typedef boost::shared_ptr<extract_csi> sptr;
|
||||
static sptr make();
|
||||
};
|
||||
|
||||
} // namespace ieee802_11
|
||||
} // namespace gr
|
||||
|
||||
#endif /* INCLUDED_IEEE802_11_EXTRACT_CSI_H */
|
||||
|
||||
@@ -39,6 +39,7 @@ list(APPEND ieee802_11_sources
|
||||
equalizer/lms.cc
|
||||
equalizer/sta.cc
|
||||
ether_encap_impl.cc
|
||||
extract_csi_impl.cc
|
||||
frame_equalizer_impl.cc
|
||||
mac.cc
|
||||
mapper.cc
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2021 Anton Ottosson.
|
||||
*
|
||||
* This 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, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This software 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 software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <gnuradio/io_signature.h>
|
||||
#include "extract_csi_impl.h"
|
||||
|
||||
namespace gr {
|
||||
namespace ieee802_11 {
|
||||
|
||||
extract_csi::sptr
|
||||
extract_csi::make()
|
||||
{
|
||||
return gnuradio::get_initial_sptr
|
||||
(new extract_csi_impl());
|
||||
}
|
||||
|
||||
|
||||
extract_csi_impl::extract_csi_impl()
|
||||
: gr::sync_block("extract_csi",
|
||||
gr::io_signature::make(0, 0, 0),
|
||||
gr::io_signature::make(1, 1, 52 * sizeof(gr_complex)))
|
||||
{
|
||||
message_port_register_in(pmt::mp("pdu in"));
|
||||
}
|
||||
|
||||
extract_csi_impl::~extract_csi_impl()
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
extract_csi_impl::work(int noutput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items)
|
||||
{
|
||||
pmt::pmt_t pdu(delete_head_nowait(pmt::mp("pdu in")));
|
||||
|
||||
if (pdu.get() == NULL) return 0;
|
||||
|
||||
if (!pmt::is_pair(pdu) || !pmt::is_dict(pmt::car(pdu)))
|
||||
throw std::runtime_error("received a malformed pdu message");
|
||||
|
||||
d_meta = pmt::car(pdu);
|
||||
|
||||
if (!pmt::dict_has_key(d_meta, pmt::mp("csi"))) return 0;
|
||||
|
||||
d_csi = pmt::c32vector_elements(pmt::dict_ref(d_meta, pmt::mp("csi"), pmt::PMT_NIL));
|
||||
|
||||
gr_complex* out = (gr_complex*) output_items[0];
|
||||
|
||||
std::copy(d_csi.begin(), d_csi.end(), out);
|
||||
|
||||
pmt::pmt_t keys(pmt::dict_keys(d_meta));
|
||||
for (int i = 0; i < pmt::length(keys); i++) {
|
||||
pmt::pmt_t k(pmt::nth(i, keys));
|
||||
pmt::pmt_t v(pmt::dict_ref(d_meta, k, pmt::PMT_NIL));
|
||||
add_item_tag(0, nitems_written(0), k, v, alias_pmt());
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
} /* namespace ieee802_11 */
|
||||
} /* namespace gr */
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2021 Anton Ottosson.
|
||||
*
|
||||
* This 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, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This software 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 software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_IEEE802_11_EXTRACT_CSI_IMPL_H
|
||||
#define INCLUDED_IEEE802_11_EXTRACT_CSI_IMPL_H
|
||||
|
||||
#include <ieee802_11/extract_csi.h>
|
||||
|
||||
namespace gr {
|
||||
namespace ieee802_11 {
|
||||
|
||||
class extract_csi_impl : public extract_csi
|
||||
{
|
||||
private:
|
||||
pmt::pmt_t d_meta;
|
||||
std::vector<gr_complex> d_csi;
|
||||
|
||||
public:
|
||||
extract_csi_impl();
|
||||
~extract_csi_impl();
|
||||
|
||||
int work(
|
||||
int noutput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items
|
||||
);
|
||||
};
|
||||
|
||||
} // namespace ieee802_11
|
||||
} // namespace gr
|
||||
|
||||
#endif /* INCLUDED_IEEE802_11_EXTRACT_CSI_IMPL_H */
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "ieee802_11/constellations.h"
|
||||
#include "ieee802_11/decode_mac.h"
|
||||
#include "ieee802_11/ether_encap.h"
|
||||
#include "ieee802_11/extract_csi.h"
|
||||
#include "ieee802_11/frame_equalizer.h"
|
||||
#include "ieee802_11/mac.h"
|
||||
#include "ieee802_11/mapper.h"
|
||||
@@ -48,6 +49,7 @@
|
||||
%include "ieee802_11/constellations.h"
|
||||
%include "ieee802_11/decode_mac.h"
|
||||
%include "ieee802_11/ether_encap.h"
|
||||
%include "ieee802_11/extract_csi.h"
|
||||
%include "ieee802_11/frame_equalizer.h"
|
||||
%include "ieee802_11/mac.h"
|
||||
%include "ieee802_11/mapper.h"
|
||||
@@ -59,6 +61,7 @@
|
||||
GR_SWIG_BLOCK_MAGIC2(ieee802_11, chunks_to_symbols);
|
||||
GR_SWIG_BLOCK_MAGIC2(ieee802_11, decode_mac);
|
||||
GR_SWIG_BLOCK_MAGIC2(ieee802_11, ether_encap);
|
||||
GR_SWIG_BLOCK_MAGIC2(ieee802_11, extract_csi);
|
||||
GR_SWIG_BLOCK_MAGIC2(ieee802_11, frame_equalizer);
|
||||
GR_SWIG_BLOCK_MAGIC2(ieee802_11, mac);
|
||||
GR_SWIG_BLOCK_MAGIC2(ieee802_11, mapper);
|
||||
|
||||
Reference in New Issue
Block a user