fun_ofdm  1.0
802.11a Physical Layer for USRP
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
ppdu.h
Go to the documentation of this file.
1 
10 #ifndef PPDU_H
11 #define PPDU_H
12 
13 #include <complex>
14 #include <vector>
15 #include "rates.h"
16 
17 #define MAX_FRAME_SIZE 2000
18 
19 namespace fun
20 {
25  struct plcp_header
26  {
28  int length;
30  unsigned short service;
31 
42  {
44  length = 0;
45  num_symbols = 0;
46  service = 0;
47  }
48 
54  plcp_header(Rate _rate, int _length)
55  {
56  rate = _rate;
57  length = _length;
58  service = 0;
59  }
60 
67  plcp_header(Rate _rate, int _length, int _num_symbols)
68  {
69  rate = _rate;
70  length = _length;
71  num_symbols = _num_symbols;
72  service = 0;
73  }
74 
75  };
76 
85  class ppdu
86  {
87  public:
88 
89  /****************
90  * Constructors *
91  ****************/
92 
96  ppdu();
97 
103  ppdu(Rate rate, int length);
104 
110  ppdu(std::vector<unsigned char> payload, Rate rate);
111 
112  /******************
113  * Public Members *
114  ******************/
115 
120  std::vector<std::complex<double> > encode();
121 
130  bool decode_header(std::vector<std::complex<double> > samples);
131 
140  bool decode_data(std::vector<std::complex<double> > samples);
141 
142 
143  Rate get_rate(){return header.rate;}
144  int get_length(){return header.length;}
146  std::vector<unsigned char> get_payload(){return payload;}
147 
148  private:
149 
151  std::vector<unsigned char> payload;
152 
158  std::vector<std::complex<double> > encoder_header();
159 
165  std::vector<std::complex<double> > encode_data();
166 
167  };
168 
169 }
170 
171 
172 #endif // PPDU_H