PicoScenes API Docs
 
Loading...
Searching...
No Matches
AbstractFrontEnd Class Referenceabstract

The shared abstract frontend interface for both SDR and NIC. More...

#include <AbstractFrontEnd.hxx>

Inheritance diagram for AbstractFrontEnd:
Collaboration diagram for AbstractFrontEnd:

Public Member Functions

 AbstractFrontEnd (const std::string &referredInterfaceName)
 Create AbstractFrontEnd object according to the user-specified frontend name referredInterfaceName.
 
virtual int startTx ()
 Activate internal Tx service loop.
 
virtual int stopTx ()
 De-activate Tx service loop.
 
virtual bool isTxServiceStarted () const
 Returns whether Tx service is started.
 
virtual int pauseTx ()
 Pause Tx service loop.
 
virtual int resumeTx ()
 Resume Tx service loop.
 
virtual int transmit (const ModularPicoScenesTxFrame &frame)=0
 
virtual int transmitFramesInBatch (const std::vector< const ModularPicoScenesTxFrame * > &frames, uint32_t repeat)=0
 Transmit frames in batch with precise inter-frame timing.
 
virtual int transmitFramesInBatch (const std::vector< ModularPicoScenesTxFrame > &frames, const uint32_t repeat)
 
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 startRx ()=0
 Activiate the Rx service loop.
 
virtual int stopRx ()=0
 De-activate the Rx service loop, set rxServiceStarted to false.
 
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.
 
virtual void printStatus ()=0
 Print a status string to command line.
 
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 ExtraInfo buildExtraInfo ()=0
 Build an ExtraInfo object describing the current frontend status.
 
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.
 
virtual std::tuple< double, double, double > getChannelAndBandwidth ()=0
 Get the <contorlfreq-bandwidth-centerfreq> channel parameter.
 
virtual int setChannelAndBandwidth (double control, double bw, double center)=0
 Set the <contorlfreq-bandwidth-centerfreq> channel parameter.
 
virtual int setChannelAndBandwidth (std::optional< double > control, std::optional< double > bw, std::optional< double > center)=0
 Set the <contorlfreq-bandwidth-centerfreq> channel parameter, but with optional.
 
virtual double getCarrierFrequency ()=0
 Get the RF carrier frequency.
 
virtual void setCarrierFrequency (double carrierFrequency)=0
 Get the RF carrier frequency.
 
virtual double getSamplingRate ()=0
 Get the baseband sampling rate.
 
virtual void setSamplingRate (double samplingRate)=0
 set sampling rate (in Hz)
 
virtual double getControlChannelFrequency ()=0
 Get the control channel frequency of <contorlfreq-bandwidth-centerfreq> channel parameter.
 
virtual void setControlChannelFrequency (double controlFrequency)=0
 Get the control channel frequency of <contorlfreq-bandwidth-centerfreq> channel parameter.
 
virtual double getRxChannelBandwidth ()=0
 Get the 802.11 Channel Bandwidth parameter (20e6/40e6/80e6/160e6/320e6) of the Rx path.
 
virtual void setRxChannelBandwidth (double rxcbw)=0
 Set the Rx channel bandwidth parameter of the <contorlfreq-bandwidth-centerfreq> channel parameters.
 
virtual double getTxpower ()=0
 get the transmission power (Tx power)
 
virtual void setTxpower (double txpower)=0
 Set the Tx power (in dB)
 
virtual double getRxGain ()=0
 Get the total Rx gain. However, currently only QCA9300 and SDR frontend support this method.
 
virtual void setRxGain (double rxGain)=0
 Set the total Rx gain. However, currently only QCA9300 and SDR frontend support this method.
 
virtual void setRxGain (double rxGain, uint8_t channel)=0
 Set the Rx gain for the specified channel. However, currently only QCA9300 and SDR frontend support this method.
 
virtual uint8_t getTxChainMask ()=0
 Get the Tx chain mask.
 
virtual void setTxChainMask (uint8_t txChainMask)=0
 Set Tx chain mask. Setting Tx chain mask means to use only the selected Tx chain for signal transmission.
 
virtual uint8_t getRxChainMask ()=0
 Get Rx chain mask.
 
virtual void setRxChainMask (uint8_t rxChainMask)=0
 Set Rx chain mask. Setting Rx chain mask means to use only the selected Rx chains for signal reception.
 
virtual std::vector< size_t > getTxChannels ()=0
 Get the numbers of the active Tx channels, starting from 0.
 
virtual void setTxChannels (const std::vector< size_t > &txChannels)=0
 This methods is fundamentally.
 
void setNumTxChannels (const uint8_t numTxChannels)
 Set the number of Tx channels, the active channels start from 0.
 
virtual std::vector< size_t > getRxChannels ()=0
 Get the number of the active Rx channels, starting from 0.
 
virtual void setRxChannels (const std::vector< size_t > &rxChannels)=0
 Set the number of the active Rx channels, starting 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 uint16_t getChannelFlags ()=0
 Get the old ChannelFlags descriptor.
 
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 ()
 

Protected Attributes

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

The shared abstract frontend interface for both SDR and NIC.

Definition at line 19 of file AbstractFrontEnd.hxx.

Constructor & Destructor Documentation

◆ AbstractFrontEnd()

AbstractFrontEnd::AbstractFrontEnd ( const std::string &  referredInterfaceName)
explicit

Create AbstractFrontEnd object according to the user-specified frontend name referredInterfaceName.

Note
For plugin developers, all types of frontend should only be obtained via FrontEndFactory::getFrontEndInstance method. Developer should NEVER invoke this method of AbstractFrontEnd or its subclasses directly!
Parameters
referredInterfaceNameuser supplied frontend name, e.g., phy0 / usrp192.168.10.2 / 3 / hackrf0 / virtualsdr0

◆ ~AbstractFrontEnd()

virtual AbstractFrontEnd::~AbstractFrontEnd ( )
virtualdefault

Member Function Documentation

◆ getFrontEndSubtype()

PicoScenesDeviceSubtype AbstractFrontEnd::getFrontEndSubtype ( ) const

Return the PicoScenesDeviceType subtype of this frontend.

Returns

Referenced by AbstractSDRFrontEnd::transmit().

◆ getFrontEndType()

PicoScenesDeviceType AbstractFrontEnd::getFrontEndType ( ) const

Return the PicoScenesDeviceType of this frontend.

Returns

Referenced by AbstractSDRFrontEnd::transmitFramesInBatch().

◆ getMacAddressPhy()

const std::array< uint8_t, 6 > & AbstractFrontEnd::getMacAddressPhy ( ) const

Return the MAC address of this frontend. For SDR frontend, this method should generate a pseudo-MAC address.

◆ getPhyId()

const std::string & AbstractFrontEnd::getPhyId ( ) const

Return the PhyId for NIC frontend. This is a undefined behavior for SDR frontend.

◆ getReferredInterfaceName()

const std::string & AbstractFrontEnd::getReferredInterfaceName ( ) const

Get the user-specified frontend name.

Referenced by AbstractSDRFrontEnd::buildExtraInfo(), AbstractSDRFrontEnd::getChannelAndBandwidth(), AbstractSDRFrontEnd::getChannelFlags(), AbstractSDRFrontEnd::getClockSource(), AbstractSDRFrontEnd::getClockSources(), AbstractSDRFrontEnd::getControlChannelFrequency(), AbstractSDRFrontEnd::getFilterBandwidth(), AbstractSDRFrontEnd::getMasterClockRate(), AbstractSDRFrontEnd::getRxAntennas(), AbstractSDRFrontEnd::getRxChannelBandwidth(), AbstractSDRFrontEnd::getRxGain(), AbstractSDRFrontEnd::getSamplingRate(), AbstractSDRFrontEnd::getSDRFrontEndTime(), AbstractSDRFrontEnd::getTimeSource(), AbstractSDRFrontEnd::getTimeSources(), AbstractSDRFrontEnd::getTxAntennas(), AbstractSDRFrontEnd::getTxpower(), AbstractSDRFrontEnd::printStatus(), VirtualSDRFrontEnd::printStatus(), AbstractSDRFrontEnd::setCarrierFrequencyOffset4RxDecoding(), AbstractSDRFrontEnd::setCarrierFrequencyOffset4TxEncoding(), AbstractSDRFrontEnd::setChannelAndBandwidth(), AbstractSDRFrontEnd::setChannelAndBandwidth(), AbstractSDRFrontEnd::setClockSource(), AbstractSDRFrontEnd::setClockSources(), AbstractSDRFrontEnd::setControlChannelFrequency(), AbstractSDRFrontEnd::setFilterBandwidth(), MAC80211CSIExtractableFrontEnd::setFrameTypeFilter(), AbstractSDRFrontEnd::setMasterClockRate(), AbstractSDRFrontEnd::setNumThreads4RxDecoding(), AbstractSDRFrontEnd::setRxAntennas(), AbstractSDRFrontEnd::setRxChannelBandwidth(), AbstractSDRFrontEnd::setRxChannelBandwidthMode(), AbstractSDRFrontEnd::setRxChannels(), AbstractSDRFrontEnd::setRxGain(), AbstractSDRFrontEnd::setRxGain(), AbstractSDRFrontEnd::setRxIQMismatch(), AbstractSDRFrontEnd::setRxOfdmSymbolOffset(), AbstractSDRFrontEnd::setRxResampleBypassFIR(), AbstractSDRFrontEnd::setRxResampleRatio(), AbstractSDRFrontEnd::setRxSensitivity(), AbstractSDRFrontEnd::setSamplingFrequencyOffset4RxDecoding(), AbstractSDRFrontEnd::setSamplingFrequencyOffset4TxEncoding(), AbstractSDRFrontEnd::setTimeSource(), AbstractSDRFrontEnd::setTimeSources(), AbstractSDRFrontEnd::setTxAntennas(), AbstractSDRFrontEnd::setTxChannels(), AbstractSDRFrontEnd::setTxIQMismatch(), AbstractSDRFrontEnd::setTxpower(), AbstractSDRFrontEnd::setTxResampleRatio(), MAC80211CSIExtractableFrontEnd::startRx(), AbstractSDRFrontEnd::transmit(), and AbstractSDRFrontEnd::transmitFramesInBatch().

◆ getUserSpecifiedTxParameters()

◆ initializeTxFrame()

ModularPicoScenesTxFrame AbstractFrontEnd::initializeTxFrame ( )
overridevirtual

◆ isTxServiceStarted()

virtual bool AbstractFrontEnd::isTxServiceStarted ( ) const
virtual

Returns whether Tx service is started.

◆ pauseRx()

virtual int AbstractFrontEnd::pauseRx ( )
virtual

Pause the Rx service loop, set rxPaused to true.

Returns

◆ pauseTx()

virtual int AbstractFrontEnd::pauseTx ( )
virtual

Pause Tx service loop.

◆ printStatus()

virtual void AbstractFrontEnd::printStatus ( )
pure virtual

Print a status string to command line.

Implemented in AbstractSDRFrontEnd, MAC80211InjectionOnlyFrontEnd, and VirtualSDRFrontEnd.

◆ registerRxHandle()

void AbstractFrontEnd::registerRxHandle ( const std::function< void(const ModularPicoScenesRxFrame &)> &  rxHandle)

Register a handler for the received ModularPicoScenesRxFrame frames.

Note
This method set/or replace the AbstractFrontEnd::rxHandle field, the plugin developers should NEVER touch this thing.
Parameters
rxHandle

◆ resumeRx()

virtual int AbstractFrontEnd::resumeRx ( )
virtual

Resuase the paused Rx service loop, set rxPaused to false.

Returns

◆ resumeTx()

virtual int AbstractFrontEnd::resumeTx ( )
virtual

Resume Tx service loop.

◆ setReferredInterfaceName()

void AbstractFrontEnd::setReferredInterfaceName ( const std::string &  name)

Set the user-specified frontend name.

Parameters
name

◆ startRx()

virtual int AbstractFrontEnd::startRx ( )
pure virtual

Activiate the Rx service loop.

the internal service loop performs four things:

  1. setup a ModularPicoScenesRxFrame queue to hold all received frames, set rxServiceStarted to true;
  2. use a while( rxServiceStarted ) loop to fetch the ModularPicoScenesRxFrame frame from NIC or SDR frontend and added them to the buffer;
  3. for each ModularPicoScenesRxFrame frame of the queue, invoke the frame handler (AbstractFrontEnd::rxHandle) to process the frame;
  4. After the process, pop the frame from the queue;
Note
this method is not a blocking method. It starts the Rx service loop in another thread and returns 0 immediately.

Implemented in MAC80211CSIExtractableFrontEnd, and MAC80211InjectionOnlyFrontEnd.

◆ startTx()

virtual int AbstractFrontEnd::startTx ( )
virtual

Activate internal Tx service loop.

Reimplemented in MAC80211InjectionOnlyFrontEnd.

Referenced by AbstractSDRFrontEnd::transmit(), and AbstractSDRFrontEnd::transmitFramesInBatch().

◆ stopRx()

virtual int AbstractFrontEnd::stopRx ( )
pure virtual

De-activate the Rx service loop, set rxServiceStarted to false.

Returns

Implemented in MAC80211InjectionOnlyFrontEnd.

◆ stopTx()

virtual int AbstractFrontEnd::stopTx ( )
virtual

De-activate Tx service loop.

Reimplemented in MAC80211InjectionOnlyFrontEnd.

◆ transmit()

virtual int AbstractFrontEnd::transmit ( const ModularPicoScenesTxFrame &  frame)
pure virtual

◆ transmitFramesInBatch() [1/3]

virtual int AbstractFrontEnd::transmitFramesInBatch ( const std::vector< const ModularPicoScenesTxFrame * > &  frames,
uint32_t  repeat 
)
pure virtual

Transmit frames in batch with precise inter-frame timing.

Implemented in AbstractSDRFrontEnd, and MAC80211InjectionOnlyFrontEnd.

Referenced by transmitFramesInBatch(), and transmitFramesInBatch().

◆ transmitFramesInBatch() [2/3]

virtual int AbstractFrontEnd::transmitFramesInBatch ( const std::vector< ModularPicoScenesTxFrame > &  frames,
const uint32_t  repeat 
)
inlinevirtual

Reimplemented in MAC80211InjectionOnlyFrontEnd.

Definition at line 61 of file AbstractFrontEnd.hxx.

References transmitFramesInBatch().

◆ transmitFramesInBatch() [3/3]

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 AbstractFrontEnd::transmitFramesInBatch ( Frames &&...  frames)
inline

Definition at line 73 of file AbstractFrontEnd.hxx.

References transmitFramesInBatch().

Member Data Documentation

◆ frontEndSubtype

PicoScenesDeviceSubtype AbstractFrontEnd::frontEndSubtype = PicoScenesDeviceSubtype::Unknown
protected

frontend subtype

Definition at line 189 of file AbstractFrontEnd.hxx.

◆ frontEndType

PicoScenesDeviceType AbstractFrontEnd::frontEndType = PicoScenesDeviceType::Unknown
protected

frontend type

Definition at line 188 of file AbstractFrontEnd.hxx.

◆ macAddress_PHY

std::array<uint8_t, 6> AbstractFrontEnd::macAddress_PHY {0, 0, 0, 0, 0, 0}
protected

macAddress of the frontend

Definition at line 187 of file AbstractFrontEnd.hxx.

◆ phyId

std::string AbstractFrontEnd::phyId
protected

phyId

Definition at line 186 of file AbstractFrontEnd.hxx.

◆ referredInterfaceName

std::string AbstractFrontEnd::referredInterfaceName
protected

the user specified frontend name

Definition at line 185 of file AbstractFrontEnd.hxx.

◆ rxHandle

std::function<void(const ModularPicoScenesRxFrame &)> AbstractFrontEnd::rxHandle = nullptr
protected

The Rx frame handler.

Definition at line 197 of file AbstractFrontEnd.hxx.

◆ rxPaused

bool AbstractFrontEnd::rxPaused = false
protected

indicate whether Rx service loop is paused

Definition at line 198 of file AbstractFrontEnd.hxx.

◆ rxServiceStarted

bool AbstractFrontEnd::rxServiceStarted = false
protected

indicate whether Rx service loop is running

Definition at line 199 of file AbstractFrontEnd.hxx.

Referenced by MAC80211CSIExtractableFrontEnd::startRx().

◆ txPauseCV

std::condition_variable AbstractFrontEnd::txPauseCV
protected

Definition at line 194 of file AbstractFrontEnd.hxx.

◆ txPaused

bool AbstractFrontEnd::txPaused = false
protected

indicate whether Tx serivce is paused

Definition at line 195 of file AbstractFrontEnd.hxx.

◆ txPauseMutex

std::mutex AbstractFrontEnd::txPauseMutex
protected

Definition at line 193 of file AbstractFrontEnd.hxx.

◆ txServiceStarted

bool AbstractFrontEnd::txServiceStarted = false
protected

indicate whether Tx service is running

Definition at line 191 of file AbstractFrontEnd.hxx.

Referenced by AbstractSDRFrontEnd::transmit(), and AbstractSDRFrontEnd::transmitFramesInBatch().

◆ userSpecifiedTxParameters


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