PicoScenes API Docs
 
Loading...
Searching...
No Matches
MAC80211InjectionOnlyFrontEnd Class Reference

Frontend class for MAC80211-based devices supporting frame injection. More...

#include <MAC80211InjectionOnlyFrontEnd.hxx>

Inheritance diagram for MAC80211InjectionOnlyFrontEnd:
Collaboration diagram for MAC80211InjectionOnlyFrontEnd:

Public Member Functions

int startTx () override
 Start transmission service.
 
int stopTx () override
 Stop transmission service.
 
int startRx () override
 Start reception service.
 
int stopRx () override
 Stop reception service.
 
int transmit (const ModularPicoScenesTxFrame &frame) override
 Transmit a single frame.
 
int transmitFramesInBatch (const std::vector< const ModularPicoScenesTxFrame * > &frames, uint32_t repeat) override
 Transmit multiple frames in batch mode.
 
int transmitFramesInBatch (const std::vector< ModularPicoScenesTxFrame > &frames, uint32_t repeat) override
 Transmit multiple frames in batch mode (vector version)
 
 ~MAC80211InjectionOnlyFrontEnd () override
 Destructor.
 
const std::string & getDevId () const
 Get device interface identifier.
 
const std::string & getMonId () const
 Get monitor interface identifier.
 
uint16_t getPhyIdNumber () const
 Get physical interface number.
 
const std::string & getPhyPath () const
 Get physical interface path.
 
const std::array< uint8_t, 6 > & getMacAddressMon () const
 Get monitor interface MAC address.
 
const std::array< uint8_t, 6 > & getMacAddressDev () const
 Get device interface MAC address.
 
std::tuple< double, double, double > getChannelAndBandwidth () override
 Get current channel and bandwidth configuration.
 
int setChannelAndBandwidth (double control, double bw, double center) override
 Set channel and bandwidth configuration.
 
int setChannelAndBandwidth (std::optional< double > control, std::optional< double > bw, std::optional< double > center) override
 Set channel and bandwidth with optional parameters.
 
double getCarrierFrequency () override
 Get carrier frequency.
 
void setCarrierFrequency (double carrierFrequency) override
 Set carrier frequency.
 
double getSamplingRate () override
 Get sampling rate.
 
void setSamplingRate (double samplingRate) override
 Set sampling rate.
 
double getControlChannelFrequency () override
 Get control channel frequency.
 
void setControlChannelFrequency (double controlFrequency) override
 Set control channel frequency.
 
double getRxChannelBandwidth () override
 Get receive channel bandwidth.
 
void setRxChannelBandwidth (double rxcbw) override
 Set receive channel bandwidth.
 
double getTxpower () override
 Get transmit power.
 
void setTxpower (double txpower) override
 Set transmit power.
 
double getRxGain () override
 Get receive gain.
 
void setRxGain (double rxGain) override
 Set receive gain.
 
void setRxGain (double rxGain, uint8_t channel) override
 Set receive gain for specific channel.
 
uint8_t getTxChainMask () override
 Get transmit chain mask.
 
void setTxChainMask (uint8_t txChainMask) override
 Set transmit chain mask.
 
uint8_t getRxChainMask () override
 Get receive chain mask.
 
void setRxChainMask (uint8_t rxChainMask) override
 Set receive chain mask.
 
std::vector< size_t > getTxChannels () override
 Get active transmit channels.
 
void setTxChannels (const std::vector< size_t > &txChannels) override
 Set active transmit channels.
 
std::vector< size_t > getRxChannels () override
 Get active receive channels.
 
void setRxChannels (const std::vector< size_t > &rxChannels) override
 Set active receive channels.
 
uint16_t getChannelFlags () override
 Get channel flags.
 
ExtraInfo buildExtraInfo () override
 Build extra information about the frontend.
 
const std::vector< double > & getSystemSupportedFrequencies () const
 Get system supported frequencies.
 
bool isMAC80211SupportedCarrierFrequency (double frequency) const
 Check if frequency is supported by MAC80211.
 
void printStatus () override
 Print current frontend status.
 
- Public Member Functions inherited from AbstractFrontEnd
 AbstractFrontEnd (const std::string &referredInterfaceName)
 Create AbstractFrontEnd object according to the user-specified frontend name referredInterfaceName.
 
virtual bool isTxServiceStarted () const
 Returns whether Tx service is started.
 
virtual int pauseTx ()
 Pause Tx service loop.
 
virtual int resumeTx ()
 Resume Tx service loop.
 
template<int repeat = 1, typename ... Frames, typename = std::enable_if_t<(std::is_same_v<std::remove_cvref_t<Frames>, ModularPicoScenesTxFrame *> &&...) || (std::is_same_v<std::remove_cvref_t<Frames>, ModularPicoScenesTxFrame> &&...) || ((std::is_same_v<std::remove_cvref_t<Frames>, std::shared_ptr<ModularPicoScenesTxFrame>> || std::is_same_v<std::remove_cvref_t<Frames>, std::unique_ptr<ModularPicoScenesTxFrame>>) &&...)>>
int transmitFramesInBatch (Frames &&... frames)
 
virtual int pauseRx ()
 Pause the Rx service loop, set rxPaused to true.
 
virtual int resumeRx ()
 Resuase the paused Rx service loop, set rxPaused to false.
 
void registerRxHandle (const std::function< void(const ModularPicoScenesRxFrame &)> &rxHandle)
 Register a handler for the received ModularPicoScenesRxFrame frames.
 
const std::string & getReferredInterfaceName () const
 Get the user-specified frontend name.
 
void setReferredInterfaceName (const std::string &name)
 Set the user-specified frontend name.
 
const std::string & getPhyId () const
 Return the PhyId for NIC frontend. This is a undefined behavior for SDR frontend.
 
PicoScenesDeviceType getFrontEndType () const
 Return the PicoScenesDeviceType of this frontend.
 
PicoScenesDeviceSubtype getFrontEndSubtype () const
 Return the PicoScenesDeviceType subtype of this frontend.
 
const std::array< uint8_t, 6 > & getMacAddressPhy () const
 Return the MAC address of this frontend. For SDR frontend, this method should generate a pseudo-MAC address.
 
PicoScenesFrameTxParameters & getUserSpecifiedTxParameters ()
 
ModularPicoScenesTxFrame initializeTxFrame () override
 
virtual ~AbstractFrontEnd ()=default
 
- Public Member Functions inherited from FrontEndConfigurations
virtual ~FrontEndConfigurations ()=default
 
virtual bool isHardwareSupportedPreset (const std::string &presetName)=0
 Check if a preset configuration is supported by the hardware.
 
virtual void applyPreset (const std::string &presetName, bool skipChangeRate=false)=0
 Apply a preset configuration to the frontend hardware.
 
void setNumTxChannels (const uint8_t numTxChannels)
 Set the number of Tx channels, the active channels start from 0.
 
void setNumRxChannels (const uint8_t numRxChannels)
 Set the number of Rx channels, the active channels start from 0.
 
std::vector< size_t > getAllChannels ()
 
virtual void setSourceMACAddressFilter (const std::vector< std::array< uint8_t, 6 > > &addresses)
 Set the SOURCE addresses that will be blocked by the frontend.
 
virtual void setDestinationMACAddressFilter (const std::vector< std::array< uint8_t, 6 > > &addresses)
 Set the DESTINATION addresses that will be blocked by the frontend.
 
virtual uint16_t getAndIncreasePerFrontEndTxFrameSequenceNumber ()
 

Static Public Member Functions

static bool isMAC80211CompatibleFrontEnd (const std::string &referredInterfaceName)
 Check if a given interface is compatible with MAC80211.
 

Protected Member Functions

 MAC80211InjectionOnlyFrontEnd (const std::string &referredName)
 Protected constructor.
 

Protected Attributes

std::string devId
 Device interface identifier.
 
std::string monId
 Monitor interface identifier.
 
uint16_t phyIdNumber = 0
 Physical interface number.
 
std::string phyPath
 Path to physical interface.
 
std::shared_ptr< uint8_t > txContext
 Transmission context.
 
std::array< uint8_t, 6 > macAddress_MON {0, 0, 0, 0, 0, 0}
 Monitor interface MAC address.
 
std::array< uint8_t, 6 > macAddress_DEV {0, 0, 0, 0, 0, 0}
 Device interface MAC address.
 
std::vector< double > systemSupportedFrequencies
 List of supported frequencies.
 
- Protected Attributes inherited from AbstractFrontEnd
std::string referredInterfaceName
 the user specified frontend name
 
std::string phyId
 phyId
 
std::array< uint8_t, 6 > macAddress_PHY {0, 0, 0, 0, 0, 0}
 macAddress of the frontend
 
PicoScenesDeviceType frontEndType = PicoScenesDeviceType::Unknown
 frontend type
 
PicoScenesDeviceSubtype frontEndSubtype = PicoScenesDeviceSubtype::Unknown
 frontend subtype
 
bool txServiceStarted = false
 indicate whether Tx service is running
 
PicoScenesFrameTxParameters userSpecifiedTxParameters
 user-specified Tx parameters
 
std::mutex txPauseMutex
 
std::condition_variable txPauseCV
 
bool txPaused = false
 indicate whether Tx serivce is paused
 
std::function< void(const ModularPicoScenesRxFrame &)> rxHandle = nullptr
 The Rx frame handler.
 
bool rxPaused = false
 indicate whether Rx service loop is paused
 
bool rxServiceStarted = false
 indicate whether Rx service loop is running
 
- Protected Attributes inherited from FrontEndConfigurations
std::vector< std::array< uint8_t, 6 > > sourceAddressFilterList
 the source addresses to be filtered
 
std::vector< std::array< uint8_t, 6 > > destinationAddressFilterList
 the destination addressed to be filtered
 
uint16_t currentTxSequenceNumber {0}
 current Tx sequence number
 

Detailed Description

Frontend class for MAC80211-based devices supporting frame injection.

This class implements basic frame injection capabilities for MAC80211 devices. It provides functionality for:

  • Frame transmission and reception
  • Channel configuration
  • Device identification and management
  • Hardware parameter control

Definition at line 22 of file MAC80211InjectionOnlyFrontEnd.hxx.

Constructor & Destructor Documentation

◆ ~MAC80211InjectionOnlyFrontEnd()

MAC80211InjectionOnlyFrontEnd::~MAC80211InjectionOnlyFrontEnd ( )
override

Destructor.

◆ MAC80211InjectionOnlyFrontEnd()

MAC80211InjectionOnlyFrontEnd::MAC80211InjectionOnlyFrontEnd ( const std::string &  referredName)
explicitprotected

Protected constructor.

Parameters
referredNameName of the interface

Member Function Documentation

◆ buildExtraInfo()

ExtraInfo MAC80211InjectionOnlyFrontEnd::buildExtraInfo ( )
overridevirtual

Build extra information about the frontend.

Returns
ExtraInfo Object containing additional frontend information

Implements FrontEndConfigurations.

◆ getCarrierFrequency()

double MAC80211InjectionOnlyFrontEnd::getCarrierFrequency ( )
overridevirtual

Get carrier frequency.

Returns
double Current carrier frequency

Implements FrontEndConfigurations.

◆ getChannelAndBandwidth()

std::tuple< double, double, double > MAC80211InjectionOnlyFrontEnd::getChannelAndBandwidth ( )
overridevirtual

Get current channel and bandwidth configuration.

Returns
std::tuple<double, double, double> Control frequency, bandwidth, and center frequency

Implements FrontEndConfigurations.

◆ getChannelFlags()

uint16_t MAC80211InjectionOnlyFrontEnd::getChannelFlags ( )
overridevirtual

Get channel flags.

Returns
uint16_t Current channel flags

Implements FrontEndConfigurations.

◆ getControlChannelFrequency()

double MAC80211InjectionOnlyFrontEnd::getControlChannelFrequency ( )
overridevirtual

Get control channel frequency.

Returns
double Current control channel frequency

Implements FrontEndConfigurations.

◆ getDevId()

const std::string & MAC80211InjectionOnlyFrontEnd::getDevId ( ) const

Get device interface identifier.

Returns
const std::string& Device interface ID

◆ getMacAddressDev()

const std::array< uint8_t, 6 > & MAC80211InjectionOnlyFrontEnd::getMacAddressDev ( ) const

Get device interface MAC address.

Returns
const std::array<uint8_t, 6>& MAC address

◆ getMacAddressMon()

const std::array< uint8_t, 6 > & MAC80211InjectionOnlyFrontEnd::getMacAddressMon ( ) const

Get monitor interface MAC address.

Returns
const std::array<uint8_t, 6>& MAC address

◆ getMonId()

const std::string & MAC80211InjectionOnlyFrontEnd::getMonId ( ) const

Get monitor interface identifier.

Returns
const std::string& Monitor interface ID

◆ getPhyIdNumber()

uint16_t MAC80211InjectionOnlyFrontEnd::getPhyIdNumber ( ) const

Get physical interface number.

Returns
uint16_t Physical interface number

◆ getPhyPath()

const std::string & MAC80211InjectionOnlyFrontEnd::getPhyPath ( ) const

Get physical interface path.

Returns
const std::string& Physical interface path

◆ getRxChainMask()

uint8_t MAC80211InjectionOnlyFrontEnd::getRxChainMask ( )
overridevirtual

Get receive chain mask.

Returns
uint8_t Current receive chain mask

Implements FrontEndConfigurations.

◆ getRxChannelBandwidth()

double MAC80211InjectionOnlyFrontEnd::getRxChannelBandwidth ( )
overridevirtual

Get receive channel bandwidth.

Returns
double Current receive channel bandwidth

Implements FrontEndConfigurations.

◆ getRxChannels()

std::vector< size_t > MAC80211InjectionOnlyFrontEnd::getRxChannels ( )
overridevirtual

Get active receive channels.

Returns
std::vector<size_t> List of active receive channels

Implements FrontEndConfigurations.

◆ getRxGain()

double MAC80211InjectionOnlyFrontEnd::getRxGain ( )
overridevirtual

Get receive gain.

Returns
double Current receive gain

Implements FrontEndConfigurations.

◆ getSamplingRate()

double MAC80211InjectionOnlyFrontEnd::getSamplingRate ( )
overridevirtual

Get sampling rate.

Returns
double Current sampling rate

Implements FrontEndConfigurations.

◆ getSystemSupportedFrequencies()

const std::vector< double > & MAC80211InjectionOnlyFrontEnd::getSystemSupportedFrequencies ( ) const

Get system supported frequencies.

Returns
const std::vector<double>& List of supported frequencies

◆ getTxChainMask()

uint8_t MAC80211InjectionOnlyFrontEnd::getTxChainMask ( )
overridevirtual

Get transmit chain mask.

Returns
uint8_t Current transmit chain mask

Implements FrontEndConfigurations.

◆ getTxChannels()

std::vector< size_t > MAC80211InjectionOnlyFrontEnd::getTxChannels ( )
overridevirtual

Get active transmit channels.

Returns
std::vector<size_t> List of active transmit channels

Implements FrontEndConfigurations.

◆ getTxpower()

double MAC80211InjectionOnlyFrontEnd::getTxpower ( )
overridevirtual

Get transmit power.

Returns
double Current transmit power

Implements FrontEndConfigurations.

◆ isMAC80211CompatibleFrontEnd()

static bool MAC80211InjectionOnlyFrontEnd::isMAC80211CompatibleFrontEnd ( const std::string &  referredInterfaceName)
static

Check if a given interface is compatible with MAC80211.

Parameters
referredInterfaceNameName of the interface to check
Returns
true if interface is MAC80211 compatible, false otherwise

◆ isMAC80211SupportedCarrierFrequency()

bool MAC80211InjectionOnlyFrontEnd::isMAC80211SupportedCarrierFrequency ( double  frequency) const

Check if frequency is supported by MAC80211.

Parameters
frequencyFrequency to check
Returns
bool true if supported, false otherwise

◆ printStatus()

void MAC80211InjectionOnlyFrontEnd::printStatus ( )
overridevirtual

Print current frontend status.

Implements AbstractFrontEnd.

◆ setCarrierFrequency()

void MAC80211InjectionOnlyFrontEnd::setCarrierFrequency ( double  carrierFrequency)
overridevirtual

Set carrier frequency.

Parameters
carrierFrequencyNew carrier frequency

Implements FrontEndConfigurations.

◆ setChannelAndBandwidth() [1/2]

int MAC80211InjectionOnlyFrontEnd::setChannelAndBandwidth ( double  control,
double  bw,
double  center 
)
overridevirtual

Set channel and bandwidth configuration.

Parameters
controlControl channel frequency
bwChannel bandwidth
centerCenter frequency
Returns
Status code (0 for success)

Implements FrontEndConfigurations.

◆ setChannelAndBandwidth() [2/2]

int MAC80211InjectionOnlyFrontEnd::setChannelAndBandwidth ( std::optional< double >  control,
std::optional< double >  bw,
std::optional< double >  center 
)
overridevirtual

Set channel and bandwidth with optional parameters.

Parameters
controlOptional control channel frequency
bwOptional channel bandwidth
centerOptional center frequency
Returns
Status code (0 for success)

Implements FrontEndConfigurations.

◆ setControlChannelFrequency()

void MAC80211InjectionOnlyFrontEnd::setControlChannelFrequency ( double  controlFrequency)
overridevirtual

Set control channel frequency.

Parameters
controlFrequencyNew control channel frequency

Implements FrontEndConfigurations.

◆ setRxChainMask()

void MAC80211InjectionOnlyFrontEnd::setRxChainMask ( uint8_t  rxChainMask)
overridevirtual

Set receive chain mask.

Parameters
rxChainMaskNew receive chain mask

Implements FrontEndConfigurations.

◆ setRxChannelBandwidth()

void MAC80211InjectionOnlyFrontEnd::setRxChannelBandwidth ( double  rxcbw)
overridevirtual

Set receive channel bandwidth.

Parameters
rxcbwNew receive channel bandwidth

Implements FrontEndConfigurations.

◆ setRxChannels()

void MAC80211InjectionOnlyFrontEnd::setRxChannels ( const std::vector< size_t > &  rxChannels)
overridevirtual

Set active receive channels.

Parameters
rxChannelsList of channels to activate

Implements FrontEndConfigurations.

◆ setRxGain() [1/2]

void MAC80211InjectionOnlyFrontEnd::setRxGain ( double  rxGain)
overridevirtual

Set receive gain.

Parameters
rxGainNew receive gain

Implements FrontEndConfigurations.

◆ setRxGain() [2/2]

void MAC80211InjectionOnlyFrontEnd::setRxGain ( double  rxGain,
uint8_t  channel 
)
overridevirtual

Set receive gain for specific channel.

Parameters
rxGainNew receive gain
channelChannel number

Implements FrontEndConfigurations.

◆ setSamplingRate()

void MAC80211InjectionOnlyFrontEnd::setSamplingRate ( double  samplingRate)
overridevirtual

Set sampling rate.

Parameters
samplingRateNew sampling rate

Implements FrontEndConfigurations.

◆ setTxChainMask()

void MAC80211InjectionOnlyFrontEnd::setTxChainMask ( uint8_t  txChainMask)
overridevirtual

Set transmit chain mask.

Parameters
txChainMaskNew transmit chain mask

Implements FrontEndConfigurations.

◆ setTxChannels()

void MAC80211InjectionOnlyFrontEnd::setTxChannels ( const std::vector< size_t > &  txChannels)
overridevirtual

Set active transmit channels.

Parameters
txChannelsList of channels to activate

Implements FrontEndConfigurations.

◆ setTxpower()

void MAC80211InjectionOnlyFrontEnd::setTxpower ( double  txpower)
overridevirtual

Set transmit power.

Parameters
txpowerNew transmit power

Implements FrontEndConfigurations.

◆ startRx()

int MAC80211InjectionOnlyFrontEnd::startRx ( )
overridevirtual

Start reception service.

Returns
Status code (0 for success)

Implements AbstractFrontEnd.

◆ startTx()

int MAC80211InjectionOnlyFrontEnd::startTx ( )
overridevirtual

Start transmission service.

Returns
Status code (0 for success)

Reimplemented from AbstractFrontEnd.

◆ stopRx()

int MAC80211InjectionOnlyFrontEnd::stopRx ( )
overridevirtual

Stop reception service.

Returns
Status code (0 for success)

Implements AbstractFrontEnd.

◆ stopTx()

int MAC80211InjectionOnlyFrontEnd::stopTx ( )
overridevirtual

Stop transmission service.

Returns
Status code (0 for success)

Reimplemented from AbstractFrontEnd.

◆ transmit()

int MAC80211InjectionOnlyFrontEnd::transmit ( const ModularPicoScenesTxFrame &  frame)
overridevirtual

Transmit a single frame.

Parameters
frameFrame to transmit
Returns
Status code (0 for success)

Implements AbstractFrontEnd.

◆ transmitFramesInBatch() [1/2]

int MAC80211InjectionOnlyFrontEnd::transmitFramesInBatch ( const std::vector< const ModularPicoScenesTxFrame * > &  frames,
uint32_t  repeat 
)
overridevirtual

Transmit multiple frames in batch mode.

Parameters
framesVector of frame pointers to transmit
repeatNumber of times to repeat transmission
Returns
Status code (0 for success)

Implements AbstractFrontEnd.

◆ transmitFramesInBatch() [2/2]

int MAC80211InjectionOnlyFrontEnd::transmitFramesInBatch ( const std::vector< ModularPicoScenesTxFrame > &  frames,
uint32_t  repeat 
)
overridevirtual

Transmit multiple frames in batch mode (vector version)

Parameters
framesVector of frames to transmit
repeatNumber of times to repeat transmission
Returns
Status code (0 for success)

Reimplemented from AbstractFrontEnd.

Member Data Documentation

◆ devId

std::string MAC80211InjectionOnlyFrontEnd::devId
protected

Device interface identifier.

Definition at line 308 of file MAC80211InjectionOnlyFrontEnd.hxx.

◆ macAddress_DEV

std::array<uint8_t, 6> MAC80211InjectionOnlyFrontEnd::macAddress_DEV {0, 0, 0, 0, 0, 0}
protected

Device interface MAC address.

Definition at line 315 of file MAC80211InjectionOnlyFrontEnd.hxx.

◆ macAddress_MON

std::array<uint8_t, 6> MAC80211InjectionOnlyFrontEnd::macAddress_MON {0, 0, 0, 0, 0, 0}
protected

Monitor interface MAC address.

Definition at line 314 of file MAC80211InjectionOnlyFrontEnd.hxx.

◆ monId

std::string MAC80211InjectionOnlyFrontEnd::monId
protected

Monitor interface identifier.

Definition at line 309 of file MAC80211InjectionOnlyFrontEnd.hxx.

◆ phyIdNumber

uint16_t MAC80211InjectionOnlyFrontEnd::phyIdNumber = 0
protected

Physical interface number.

Definition at line 310 of file MAC80211InjectionOnlyFrontEnd.hxx.

◆ phyPath

std::string MAC80211InjectionOnlyFrontEnd::phyPath
protected

Path to physical interface.

Definition at line 311 of file MAC80211InjectionOnlyFrontEnd.hxx.

◆ systemSupportedFrequencies

std::vector<double> MAC80211InjectionOnlyFrontEnd::systemSupportedFrequencies
protected

List of supported frequencies.

Definition at line 317 of file MAC80211InjectionOnlyFrontEnd.hxx.

◆ txContext

std::shared_ptr<uint8_t> MAC80211InjectionOnlyFrontEnd::txContext
protected

Transmission context.

Definition at line 312 of file MAC80211InjectionOnlyFrontEnd.hxx.


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