fun_ofdm  1.0
802.11a Physical Layer for USRP
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
fun::transmitter Class Reference

The transmitter class is the public interface for the fun_ofdm transmit chain. This is the easiest way to start transmitting 802.11a OFDM frames out of the box. More...

#include <transmitter.h>

Public Member Functions

 transmitter (double freq=5.72e9, double samp_rate=5e6, double tx_gain=20, double tx_amp=1.0, std::string device_addr="")
 Constructor for the transmitter with raw parameters. More...
 
 transmitter (usrp_params params=usrp_params())
 Constructor for the transmitter that uses the usrp_params struct. More...
 
void send_packet (std::vector< unsigned char > payload, Rate phy_rate=RATE_1_2_BPSK)
 Send a single PHY frame at the given PHY Rate. More...
 

Private Attributes

usrp m_usrp
 The usrp object used to send the generated frames over the air. More...
 
frame_builder m_frame_builder
 The frame builder object used to generate the frames. More...
 

Detailed Description

The transmitter class is the public interface for the fun_ofdm transmit chain. This is the easiest way to start transmitting 802.11a OFDM frames out of the box.

Usage: Create a transmitter object with the desired USRP parameters (center frequency, sample rate, transmitter gain, and amplitude). Then to send a packet simply call the transmitter::send_packet() function passing it the desired packet to be transmitted and the desired Physical Layer rate (PHY Rate) to transmit it.

Definition at line 28 of file transmitter.h.

Constructor & Destructor Documentation

fun::transmitter::transmitter ( double  freq = 5.72e9,
double  samp_rate = 5e6,
double  tx_gain = 20,
double  tx_amp = 1.0,
std::string  device_addr = "" 
)

Constructor for the transmitter with raw parameters.

Parameters
freq[Optional] Center frequency
samp_rate[Optional] Sample rate
tx_gain[Optional] Transmit Gain
tx_amp[Optional] Transmit Amplitude
device_addr[Optional] IP address of USRP device

Defaults to:

  • center_freq -> 5.72e9 (5.72 GHz)
  • sample_rate -> 5e6 (5 MHz)
  • tx_gain -> 20
  • device_addr -> "" (empty string will default to letting the UHD api automatically find an available USRP)
  • *Note:
    • rx_gain -> 20 even though it is irrelevant for the transmitter

This constructor shows exactly what parameters need to be set for the transmitter

Definition at line 15 of file transmitter.cpp.

15  :
16  m_usrp(usrp_params(freq, samp_rate, tx_gain, 20, tx_amp, device_addr)),
18  {
19  }
fun::transmitter::transmitter ( usrp_params  params = usrp_params())

Constructor for the transmitter that uses the usrp_params struct.

Parameters
params[Optional] The usrp parameters you want to use for this transmitter

Defaults to:

  • center freq -> 5.72e9 (5.72 GHz)
  • sample rate -> 5e6 (5 MHz)
  • tx gain -> 20
  • rx gain -> 20 (although this is irrelevant for the transmitter)
  • device ip address -> "" (empty string will default to letting the UHD api automatically find an available USRP)

This construct is for those who feel more comfortable using the usrp_params struct

Definition at line 24 of file transmitter.cpp.

24  :
25  m_usrp(params),
27  {
28  }

Member Function Documentation

void fun::transmitter::send_packet ( std::vector< unsigned char >  payload,
Rate  phy_rate = RATE_1_2_BPSK 
)

Send a single PHY frame at the given PHY Rate.

Parameters
payloadThe data to be transmitted (i.e. the MPDU)
phy_rate[Optional] The PHY data rate to transmit at - defaults to 1/2 BPSK

This function uses the usrp::send_burst_sync() function which means that this function blocks until the packet is done transmitting.

Transmits a single frame, blocking until the frame is sent.

Definition at line 33 of file transmitter.cpp.

References fun::frame_builder::build_frame(), m_frame_builder, m_usrp, and fun::usrp::send_burst_sync().

Referenced by main(), and test_tx().

34  {
35  std::vector<std::complex<double> > samples = m_frame_builder.build_frame(payload, phy_rate);
36  m_usrp.send_burst_sync(samples);
37  }

Member Data Documentation

frame_builder fun::transmitter::m_frame_builder
private

The frame builder object used to generate the frames.

Definition at line 79 of file transmitter.h.

Referenced by send_packet().

usrp fun::transmitter::m_usrp
private

The usrp object used to send the generated frames over the air.

Definition at line 77 of file transmitter.h.

Referenced by send_packet().


The documentation for this class was generated from the following files: