add edca block
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,37 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<block>
|
||||||
|
<name>WiFi EDCA</name>
|
||||||
|
<key>ieee802_11_wifi_edca</key>
|
||||||
|
<category>IEEE802.11</category>
|
||||||
|
<import>import ieee802_11</import>
|
||||||
|
<make>ieee802_11.wifi_edca($cw_min, $aifsn)</make>
|
||||||
|
|
||||||
|
<param>
|
||||||
|
<name>CW min</name>
|
||||||
|
<key>cw_min</key>
|
||||||
|
<value>[15, 15, 7, 3]</value>
|
||||||
|
<type>int_vector</type>
|
||||||
|
</param>
|
||||||
|
|
||||||
|
<param>
|
||||||
|
<name>AIFSN [slots]</name>
|
||||||
|
<key>aifsn</key>
|
||||||
|
<value>[9, 6, 3, 2]</value>
|
||||||
|
<type>int_vector</type>
|
||||||
|
</param>
|
||||||
|
|
||||||
|
<check>len($cw_min) == len($aifsn)</check>
|
||||||
|
|
||||||
|
<sink>
|
||||||
|
<name>ac in</name>
|
||||||
|
<type>message</type>
|
||||||
|
<nports>len($cw_min)</nports>
|
||||||
|
<optional>1</optional>
|
||||||
|
</sink>
|
||||||
|
|
||||||
|
<source>
|
||||||
|
<name>mac out</name>
|
||||||
|
<type>message</type>
|
||||||
|
</source>
|
||||||
|
</block>
|
||||||
@@ -81,6 +81,7 @@ list(APPEND include_sources
|
|||||||
ofdm_preamble.h
|
ofdm_preamble.h
|
||||||
ofdm_sync_long.h
|
ofdm_sync_long.h
|
||||||
ofdm_sync_short.h
|
ofdm_sync_short.h
|
||||||
|
wifi_edca.h
|
||||||
wifi_signal_field.h
|
wifi_signal_field.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014 Bastian Bloessl <bloessl@ccs-labs.org>
|
||||||
|
*
|
||||||
|
* This program 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 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program 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 program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#ifndef INCLUDED_IEEE802_11_WIFI_EDCA_H
|
||||||
|
#define INCLUDED_IEEE802_11_WIFI_EDCA_H
|
||||||
|
|
||||||
|
#include <ieee802-11/api.h>
|
||||||
|
#include <gnuradio/block.h>
|
||||||
|
|
||||||
|
namespace gr {
|
||||||
|
namespace ieee802_11 {
|
||||||
|
|
||||||
|
class IEEE802_11_API wifi_edca : virtual public block
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef boost::shared_ptr<wifi_edca> sptr;
|
||||||
|
static sptr make(std::vector<uint16_t>cw_min, std::vector<uint16_t>aifsn);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace ieee802_11
|
||||||
|
} // namespace gr
|
||||||
|
|
||||||
|
#endif /* INCLUDED_IEEE802_11_WIFI_EDCA_H */
|
||||||
@@ -107,6 +107,7 @@ list(APPEND gr_ieee802_11_sources
|
|||||||
ofdm_sync_long.cc
|
ofdm_sync_long.cc
|
||||||
ofdm_sync_short.cc
|
ofdm_sync_short.cc
|
||||||
utils.cc
|
utils.cc
|
||||||
|
wifi_edca.cc
|
||||||
wifi_signal_field_impl.cc
|
wifi_signal_field_impl.cc
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014 Bastian Bloessl <bloessl@ccs-labs.org>
|
||||||
|
*
|
||||||
|
* This program 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 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program 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 program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#include <ieee802-11/wifi_edca.h>
|
||||||
|
|
||||||
|
#include <gnuradio/io_signature.h>
|
||||||
|
#include <gnuradio/block_detail.h>
|
||||||
|
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
|
#include <boost/crc.hpp>
|
||||||
|
#include <iostream>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
|
using namespace gr::ieee802_11;
|
||||||
|
|
||||||
|
class wifi_edca_impl : public wifi_edca {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
wifi_edca_impl(std::vector<uint16_t> cw_min, std::vector<uint16_t>aifsn) :
|
||||||
|
block("wifi_edca",
|
||||||
|
gr::io_signature::make(0, 0, 0),
|
||||||
|
gr::io_signature::make(0, 0, 0)),
|
||||||
|
m_cw_min(cw_min), m_aifsn(aifsn)
|
||||||
|
{
|
||||||
|
|
||||||
|
assert(cw_min.size() == aifsn.size());
|
||||||
|
|
||||||
|
message_port_register_out(pmt::mp("mac out"));
|
||||||
|
|
||||||
|
for(int i = 0; i < cw_min.size(); i++) {
|
||||||
|
std::stringstream sstm;
|
||||||
|
sstm << "ac in" << i;
|
||||||
|
message_port_register_in(pmt::mp(sstm.str()));
|
||||||
|
set_msg_handler(pmt::mp(sstm.str()), boost::bind(&wifi_edca_impl::ac_in, this, _1, i));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ac_in (pmt::pmt_t msg, int i) {
|
||||||
|
std::cout << "ac " << i << std::endl;
|
||||||
|
message_port_pub(pmt::mp("mac out"), msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<uint16_t>m_cw_min;
|
||||||
|
std::vector<uint16_t>m_aifsn;
|
||||||
|
};
|
||||||
|
|
||||||
|
wifi_edca::sptr
|
||||||
|
wifi_edca::make(std::vector<uint16_t>cw_min, std::vector<uint16_t> aifsn) {
|
||||||
|
return gnuradio::get_initial_sptr(new wifi_edca_impl(cw_min, aifsn));
|
||||||
|
}
|
||||||
|
|
||||||
@@ -38,6 +38,7 @@
|
|||||||
#include "ieee802-11/ofdm_preamble.h"
|
#include "ieee802-11/ofdm_preamble.h"
|
||||||
#include "ieee802-11/ofdm_sync_long.h"
|
#include "ieee802-11/ofdm_sync_long.h"
|
||||||
#include "ieee802-11/ofdm_sync_short.h"
|
#include "ieee802-11/ofdm_sync_short.h"
|
||||||
|
#include "ieee802-11/wifi_edca.h"
|
||||||
#include "ieee802-11/wifi_signal_field.h"
|
#include "ieee802-11/wifi_signal_field.h"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
@@ -57,6 +58,7 @@
|
|||||||
%include "ieee802-11/ofdm_preamble.h"
|
%include "ieee802-11/ofdm_preamble.h"
|
||||||
%include "ieee802-11/ofdm_sync_long.h"
|
%include "ieee802-11/ofdm_sync_long.h"
|
||||||
%include "ieee802-11/ofdm_sync_short.h"
|
%include "ieee802-11/ofdm_sync_short.h"
|
||||||
|
%include "ieee802-11/wifi_edca.h"
|
||||||
%include "ieee802-11/wifi_signal_field.h"
|
%include "ieee802-11/wifi_signal_field.h"
|
||||||
|
|
||||||
GR_SWIG_BLOCK_MAGIC2(ieee802_11, chunks_to_symbols);
|
GR_SWIG_BLOCK_MAGIC2(ieee802_11, chunks_to_symbols);
|
||||||
@@ -73,6 +75,7 @@ GR_SWIG_BLOCK_MAGIC2(ieee802_11, ofdm_parse_mac);
|
|||||||
GR_SWIG_BLOCK_MAGIC2(ieee802_11, ofdm_preamble);
|
GR_SWIG_BLOCK_MAGIC2(ieee802_11, ofdm_preamble);
|
||||||
GR_SWIG_BLOCK_MAGIC2(ieee802_11, ofdm_sync_long);
|
GR_SWIG_BLOCK_MAGIC2(ieee802_11, ofdm_sync_long);
|
||||||
GR_SWIG_BLOCK_MAGIC2(ieee802_11, ofdm_sync_short);
|
GR_SWIG_BLOCK_MAGIC2(ieee802_11, ofdm_sync_short);
|
||||||
|
GR_SWIG_BLOCK_MAGIC2(ieee802_11, wifi_edca);
|
||||||
|
|
||||||
%template(wifi_signal_field_sptr) boost::shared_ptr<gr::ieee802_11::wifi_signal_field>;
|
%template(wifi_signal_field_sptr) boost::shared_ptr<gr::ieee802_11::wifi_signal_field>;
|
||||||
%pythoncode %{
|
%pythoncode %{
|
||||||
|
|||||||
Reference in New Issue
Block a user