delete old wave demo blocks

This commit is contained in:
Bastian Bloessl
2013-10-15 17:42:19 +02:00
parent b24e628f31
commit 34c0f66f3f
11 changed files with 0 additions and 430 deletions
-19
View File
@@ -1,19 +0,0 @@
<?xml version="1.0"?>
<block>
<name>WAVE LLC</name>
<key>ieee802_11_wave_llc</key>
<category>IEEE802.11</category>
<import>import ieee802_11</import>
<make>ieee802_11.wave_llc()</make>
<sink>
<name>in</name>
<type>message</type>
</sink>
<source>
<name>out</name>
<type>message</type>
</source>
</block>
-28
View File
@@ -1,28 +0,0 @@
<?xml version="1.0"?>
<block>
<name>WAVE Short Message</name>
<key>ieee802_11_wave_short_message</key>
<category>IEEE802.11</category>
<import>import ieee802_11</import>
<make>ieee802_11.wave_short_message($version)</make>
<callback>set_version($version)</callback>
<param>
<name>Version</name>
<key>version</key>
<value>0</value>
<type>int</type>
</param>
<sink>
<name>in</name>
<type>message</type>
</sink>
<source>
<name>out</name>
<type>message</type>
</source>
</block>
-2
View File
@@ -81,8 +81,6 @@ list(APPEND include_sources
ofdm_preamble.h
ofdm_sync_long.h
ofdm_sync_short.h
wave_llc.h
wave_short_message.h
)
install(
-38
View File
@@ -1,38 +0,0 @@
/*
* Copyright (C) 2013 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_WAVE_LLC_H
#define INCLUDED_IEEE802_11_WAVE_LLC_H
#include <ieee802-11/api.h>
#include <gnuradio/block.h>
namespace gr {
namespace ieee802_11 {
class IEEE802_11_API wave_llc : virtual public block
{
public:
typedef boost::shared_ptr<wave_llc> sptr;
static sptr make();
};
} // namespace ieee802_11
} // namespace gr
#endif /* INCLUDED_IEEE802_11_WAVE_LLC_H */
-39
View File
@@ -1,39 +0,0 @@
/*
* Copyright (C) 2013 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_WAVE_SHORT_MESSAGE_H
#define INCLUDED_IEEE802_11_WAVE_SHORT_MESSAGE_H
#include <ieee802-11/api.h>
#include <gnuradio/block.h>
namespace gr {
namespace ieee802_11 {
class IEEE802_11_API wave_short_message : virtual public block
{
public:
virtual void set_version(int version) = 0;
typedef boost::shared_ptr<wave_short_message> sptr;
static sptr make(int version);
};
} // namespace ieee802_11
} // namespace gr
#endif /* INCLUDED_IEEE802_11_WAVE_SHORT_MESSAGE_H */
-2
View File
@@ -114,8 +114,6 @@ list(APPEND gr_ieee802_11_sources
ofdm_sync_long.cc
ofdm_sync_short.cc
utils.cc
wave_llc_impl.cc
wave_short_message_impl.cc
)
list(APPEND gr_ieee802_11_libs
-79
View File
@@ -1,79 +0,0 @@
/*
* Copyright (C) 2013 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 "wave_llc_impl.h"
#include <gnuradio/io_signature.h>
#include <gnuradio/block_detail.h>
#include <string.h>
using namespace gr::ieee802_11;
wave_llc_impl::wave_llc_impl() :
block("wave_llc",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(0, 0, 0)) {
message_port_register_out(pmt::mp("out"));
message_port_register_in(pmt::mp("in"));
set_msg_handler(pmt::mp("in"), boost::bind(&wave_llc_impl::make_frame, this, _1));
d_header[0] = 0xaa;
d_header[1] = 0xaa;
d_header[2] = 0x03;
d_header[3] = 0x00;
d_header[4] = 0x00;
d_header[5] = 0x00;
d_header[6] = 0x88;
d_header[7] = 0xdc;
}
void
wave_llc_impl::make_frame (pmt::pmt_t msg) {
if(pmt::is_eof_object(msg)) {
message_port_pub(pmt::mp("out"), pmt::PMT_EOF);
detail().get()->set_done(true);
return;
} else if(pmt::is_pair(msg)) {
msg = pmt::cdr(msg);
} else if(pmt::is_blob(msg)) {
} else {
throw std::invalid_argument("wave_llc expects PDU or blob input");
}
size_t data_len = pmt::blob_length(msg);
char *buf = reinterpret_cast<char *>(std::malloc(
sizeof(d_header) + data_len));
std::memcpy(buf, d_header, sizeof(d_header));
std::memcpy(buf + sizeof(d_header), pmt::blob_data(msg), data_len);
pmt::pmt_t llc_msg = pmt::make_blob(buf, sizeof(d_header) + data_len);
message_port_pub(pmt::mp("out"), llc_msg);
std::free(buf);
}
wave_llc::sptr
wave_llc::make() {
return gnuradio::get_initial_sptr(new wave_llc_impl());
}
-41
View File
@@ -1,41 +0,0 @@
/*
* Copyright (C) 2013 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_WAVE_LLC_IMPL_H
#define INCLUDED_IEEE802_11_WAVE_LLC_IMPL_H
#include <ieee802-11/wave_llc.h>
namespace gr {
namespace ieee802_11 {
class wave_llc_impl : public wave_llc {
public:
wave_llc_impl();
private:
void make_frame (pmt::pmt_t msg);
char d_header[8];
};
} // namespace ieee802_11
} // namespace gr
#endif /* INCLUDED_IEEE802_11_WAVE_LLC_IMPL_H */
-114
View File
@@ -1,114 +0,0 @@
/*
* Copyright (C) 2013 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 "wave_short_message_impl.h"
#include <gnuradio/io_signature.h>
#include <gnuradio/block_detail.h>
#include <string.h>
using namespace gr::ieee802_11;
wave_short_message_impl::wave_short_message_impl(int version) :
block("wave_short_message",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(0, 0, 0)),
d_version(version) {
message_port_register_out(pmt::mp("out"));
message_port_register_in(pmt::mp("in"));
set_msg_handler(pmt::mp("in"), boost::bind(&wave_short_message_impl::make_frame, this, _1));
hdr0.version = 0x00;
hdr0.security = 0x00;
hdr0.channel = 0x04;
hdr0.rate = 0x01;
hdr0.power = 0x40;
hdr0.app_class = 0x00;
hdr0.acm_length = 0x00;
hdr2.version = 0x02;
hdr2.psid = 0x55;
hdr2.wsm_id = 0x80;
}
void
wave_short_message_impl::make_frame (pmt::pmt_t msg) {
if(pmt::is_eof_object(msg)) {
message_port_pub(pmt::mp("out"), pmt::PMT_EOF);
detail().get()->set_done(true);
return;
} else if(pmt::is_symbol(msg)) {
std::string s = pmt::symbol_to_string(msg);
msg = pmt::make_blob(s.data(), s.size());
} else if(!pmt::is_blob(msg)) {
throw std::invalid_argument("WSM input has to be a blob");
}
uint16_t data_len = pmt::blob_length(msg);
pmt::pmt_t wsm;
char *buf;
switch(d_version) {
case 0:
hdr0.length = data_len;
buf = reinterpret_cast<char*>(std::malloc(data_len + sizeof(wave_hdr_v0)));
std::memcpy(buf, &hdr0, sizeof(wave_hdr_v0));
std::memcpy(buf + sizeof(wave_hdr_v0), pmt::blob_data(msg), data_len);
wsm = pmt::make_blob(buf, data_len + sizeof(wave_hdr_v0));
break;
case 2:
hdr2.length = (data_len << 8) + (data_len >> 8);
buf = reinterpret_cast<char*>(std::malloc(data_len + sizeof(wave_hdr_v2)));
std::memcpy(buf, &hdr2, sizeof(wave_hdr_v2));
std::memcpy(buf + sizeof(wave_hdr_v2), pmt::blob_data(msg), data_len);
wsm = pmt::make_blob(buf, data_len + sizeof(wave_hdr_v2));
break;
default:
throw std::invalid_argument("wrong version of WSM set");
break;
}
std::free(buf);
message_port_pub(pmt::mp("out"), wsm);
}
void
wave_short_message_impl::set_version(int version) {
if(!(version == 0 || version == 2)) {
throw std::invalid_argument("wrong version of WSM set");
}
d_version = version;
}
wave_short_message::sptr
wave_short_message::make(int version) {
return gnuradio::get_initial_sptr(new wave_short_message_impl(version));
}
-62
View File
@@ -1,62 +0,0 @@
/*
* Copyright (C) 2013 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_WAVE_SHORT_MESSAGE_IMPL_H
#define INCLUDED_IEEE802_11_WAVE_SHORT_MESSAGE_IMPL_H
#include <ieee802-11/wave_short_message.h>
namespace gr {
namespace ieee802_11 {
struct wave_hdr_v0 {
uint8_t version;
uint8_t security;
uint8_t channel;
uint8_t rate;
uint8_t power;
uint8_t app_class;
uint8_t acm_length;
uint16_t length;
}__attribute__((packed));
struct wave_hdr_v2 {
uint8_t version;
uint8_t psid;
uint8_t wsm_id;
uint16_t length;
}__attribute__((packed));
class wave_short_message_impl : public wave_short_message {
public:
wave_short_message_impl(int version);
private:
void make_frame (pmt::pmt_t msg);
void set_version(int version);
wave_hdr_v0 hdr0;
wave_hdr_v2 hdr2;
int d_version;
};
} // namespace ieee802_11
} // namespace gr
#endif /* INCLUDED_IEEE802_11_WAVE_SHORT_MESSAGE_IMPL_H */
-6
View File
@@ -35,8 +35,6 @@
#include "ieee802-11/ofdm_preamble.h"
#include "ieee802-11/ofdm_sync_long.h"
#include "ieee802-11/ofdm_sync_short.h"
#include "ieee802-11/wave_llc.h"
#include "ieee802-11/wave_short_message.h"
%}
%include "ieee802-11/ether_encap.h"
@@ -53,8 +51,6 @@
%include "ieee802-11/ofdm_preamble.h"
%include "ieee802-11/ofdm_sync_long.h"
%include "ieee802-11/ofdm_sync_short.h"
%include "ieee802-11/wave_llc.h"
%include "ieee802-11/wave_short_message.h"
GR_SWIG_BLOCK_MAGIC2(ieee802_11, ether_encap);
GR_SWIG_BLOCK_MAGIC2(ieee802_11, moving_average_cc);
@@ -70,6 +66,4 @@ GR_SWIG_BLOCK_MAGIC2(ieee802_11, ofdm_pilot);
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_short);
GR_SWIG_BLOCK_MAGIC2(ieee802_11, wave_llc);
GR_SWIG_BLOCK_MAGIC2(ieee802_11, wave_short_message);