cs: coding style
This commit is contained in:
@@ -25,17 +25,15 @@
|
|||||||
#include <gnuradio/sync_block.h>
|
#include <gnuradio/sync_block.h>
|
||||||
|
|
||||||
namespace gr {
|
namespace gr {
|
||||||
namespace ieee802_11 {
|
namespace ieee802_11 {
|
||||||
|
|
||||||
class IEEE802_11_API extract_csi : virtual public gr::sync_block
|
class IEEE802_11_API extract_csi : virtual public gr::sync_block {
|
||||||
{
|
public:
|
||||||
public:
|
|
||||||
typedef boost::shared_ptr<extract_csi> sptr;
|
typedef boost::shared_ptr<extract_csi> sptr;
|
||||||
static sptr make();
|
static sptr make();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ieee802_11
|
} // namespace ieee802_11
|
||||||
} // namespace gr
|
} // namespace gr
|
||||||
|
|
||||||
#endif /* INCLUDED_IEEE802_11_EXTRACT_CSI_H */
|
#endif /* INCLUDED_IEEE802_11_EXTRACT_CSI_H */
|
||||||
|
|
||||||
|
|||||||
+20
-27
@@ -26,47 +26,41 @@
|
|||||||
#include "extract_csi_impl.h"
|
#include "extract_csi_impl.h"
|
||||||
|
|
||||||
namespace gr {
|
namespace gr {
|
||||||
namespace ieee802_11 {
|
namespace ieee802_11 {
|
||||||
|
|
||||||
extract_csi::sptr
|
extract_csi::sptr extract_csi::make() {
|
||||||
extract_csi::make()
|
return gnuradio::get_initial_sptr(new extract_csi_impl());
|
||||||
{
|
}
|
||||||
return gnuradio::get_initial_sptr
|
|
||||||
(new extract_csi_impl());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
extract_csi_impl::extract_csi_impl()
|
extract_csi_impl::extract_csi_impl()
|
||||||
: gr::sync_block("extract_csi",
|
: gr::sync_block("extract_csi", gr::io_signature::make(0, 0, 0),
|
||||||
gr::io_signature::make(0, 0, 0),
|
gr::io_signature::make(1, 1, 52 * sizeof(gr_complex))) {
|
||||||
gr::io_signature::make(1, 1, 52 * sizeof(gr_complex)))
|
|
||||||
{
|
|
||||||
message_port_register_in(pmt::mp("pdu in"));
|
message_port_register_in(pmt::mp("pdu in"));
|
||||||
}
|
}
|
||||||
|
|
||||||
extract_csi_impl::~extract_csi_impl()
|
extract_csi_impl::~extract_csi_impl() {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int extract_csi_impl::work(int noutput_items,
|
||||||
extract_csi_impl::work(int noutput_items,
|
|
||||||
gr_vector_const_void_star &input_items,
|
gr_vector_const_void_star &input_items,
|
||||||
gr_vector_void_star &output_items)
|
gr_vector_void_star &output_items) {
|
||||||
{
|
|
||||||
pmt::pmt_t pdu(delete_head_nowait(pmt::mp("pdu in")));
|
pmt::pmt_t pdu(delete_head_nowait(pmt::mp("pdu in")));
|
||||||
|
|
||||||
if (pdu.get() == NULL) return 0;
|
if (pdu.get() == NULL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (!pmt::is_pair(pdu) || !pmt::is_dict(pmt::car(pdu)))
|
if (!pmt::is_pair(pdu) || !pmt::is_dict(pmt::car(pdu)))
|
||||||
throw std::runtime_error("received a malformed pdu message");
|
throw std::runtime_error("received a malformed pdu message");
|
||||||
|
|
||||||
d_meta = pmt::car(pdu);
|
d_meta = pmt::car(pdu);
|
||||||
|
|
||||||
if (!pmt::dict_has_key(d_meta, pmt::mp("csi"))) return 0;
|
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));
|
d_csi = pmt::c32vector_elements(
|
||||||
|
pmt::dict_ref(d_meta, pmt::mp("csi"), pmt::PMT_NIL));
|
||||||
|
|
||||||
gr_complex* out = (gr_complex*) output_items[0];
|
gr_complex *out = (gr_complex *)output_items[0];
|
||||||
|
|
||||||
std::copy(d_csi.begin(), d_csi.end(), out);
|
std::copy(d_csi.begin(), d_csi.end(), out);
|
||||||
|
|
||||||
@@ -78,8 +72,7 @@ namespace gr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace ieee802_11 */
|
} /* namespace ieee802_11 */
|
||||||
} /* namespace gr */
|
} /* namespace gr */
|
||||||
|
|
||||||
|
|||||||
+8
-13
@@ -24,27 +24,22 @@
|
|||||||
#include <ieee802_11/extract_csi.h>
|
#include <ieee802_11/extract_csi.h>
|
||||||
|
|
||||||
namespace gr {
|
namespace gr {
|
||||||
namespace ieee802_11 {
|
namespace ieee802_11 {
|
||||||
|
|
||||||
class extract_csi_impl : public extract_csi
|
class extract_csi_impl : public extract_csi {
|
||||||
{
|
private:
|
||||||
private:
|
|
||||||
pmt::pmt_t d_meta;
|
pmt::pmt_t d_meta;
|
||||||
std::vector<gr_complex> d_csi;
|
std::vector<gr_complex> d_csi;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
extract_csi_impl();
|
extract_csi_impl();
|
||||||
~extract_csi_impl();
|
~extract_csi_impl();
|
||||||
|
|
||||||
int work(
|
int work(int noutput_items, gr_vector_const_void_star &input_items,
|
||||||
int noutput_items,
|
gr_vector_void_star &output_items);
|
||||||
gr_vector_const_void_star &input_items,
|
};
|
||||||
gr_vector_void_star &output_items
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace ieee802_11
|
} // namespace ieee802_11
|
||||||
} // namespace gr
|
} // namespace gr
|
||||||
|
|
||||||
#endif /* INCLUDED_IEEE802_11_EXTRACT_CSI_IMPL_H */
|
#endif /* INCLUDED_IEEE802_11_EXTRACT_CSI_IMPL_H */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user