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

Abstract base class for Network Interface Card (NIC) operations. More...

#include <AbstractNIC.hxx>

Inheritance diagram for AbstractNIC:
Collaboration diagram for AbstractNIC:

Public Member Functions

virtual void startTxService ()=0
 Start the transmission service.
 
virtual void stopTxService ()=0
 Stop the transmission service.
 
virtual void pauseTx ()=0
 Temporarily pause transmission.
 
virtual void resumeTx ()=0
 Resume paused transmission.
 
virtual bool isTxServiceStarted () const =0
 Check if transmission service is running.
 
virtual int transmitPicoScenesFrame (const ModularPicoScenesTxFrame &frame)=0
 Transmit a single PicoScenes frame.
 
virtual int transmitPicoScenesFrameSync (const ModularPicoScenesTxFrame &frame)=0
 Transmit a frame synchronously.
 
virtual int transmitFramesInBatch (const std::vector< ModularPicoScenesTxFrame > &frames, uint16_t numRepeats)=0
 Transmit multiple frames in batch mode.
 
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)
 Template method for batch transmission of frames.
 
virtual ModularPicoScenesTxFrame initializeTxFrame ()
 Initialize a new transmission frame.
 
virtual void startRxService ()=0
 Start the reception service.
 
virtual void stopRxService ()=0
 Stop the reception service.
 
virtual void pauseRx ()=0
 Temporarily pause reception.
 
virtual void resumeRx ()=0
 Resume paused reception.
 
virtual bool isRxServiceStarted () const =0
 Check if reception service is running.
 
virtual std::optional< ModularPicoScenesRxFrame > syncRxConditionally (const std::function< bool(const ModularPicoScenesRxFrame &)> &condition, const std::chrono::milliseconds &maxWait_ms, std::optional< std::string > conditionaName=std::nullopt)=0
 Wait for a frame that matches specific conditions.
 
virtual std::optional< ModularPicoScenesRxFrame > syncRxWaitTaskId (uint16_t taskid, uint32_t maxWait_ms)=0
 Wait for a frame with specific task ID.
 
virtual void registerTaskIdHandler (uint16_t taskId, const std::function< bool(const ModularPicoScenesRxFrame &)> &handle)=0
 Register a handler for specific task ID.
 
virtual std::function< bool(const ModularPicoScenesRxFrame &)> getHandlerForFrameType (uint8_t frameType)=0
 Get handler for specific frame type.
 
virtual void unregisterTaskIdHandler (uint16_t taskId)=0
 Unregister handler for specific task ID.
 
virtual bool checkTaskIdHandlerExist (uint16_t taskId)=0
 Check if handler exists for specific task ID.
 
virtual void registerFrameTypeHandler (uint8_t frameType, const std::function< bool(const ModularPicoScenesRxFrame &)> &handle)=0
 Register handler for specific frame type.
 
virtual std::function< bool(const ModularPicoScenesRxFrame &)> getHandlerForTaskId (uint16_t taskId)=0
 Get handler for specific task ID.
 
virtual void unregisterFrameTypeHandler (uint8_t frameType)=0
 Unregister handler for specific frame type.
 
virtual bool checkFrameTypeHandlerExist (uint8_t frameType)=0
 Check if handler exists for specific frame type.
 
virtual void registerGeneralHandler (const std::string &handlerKeyName, const std::function< bool(const ModularPicoScenesRxFrame &)> &handle)=0
 Register a general handler.
 
virtual std::function< bool(const ModularPicoScenesRxFrame &)> getGeneralHandler (const std::string &handlerKeyName)=0
 Get general handler by name.
 
virtual void unregisterGeneralHandler (const std::string &handlerKeyName)=0
 Unregister general handler.
 
virtual bool checkGeneralHandlerExist (const std::string &handlerKeyName)=0
 Check if general handler exists.
 
const std::string & getReferredInterfaceName () const
 Get the interface name.
 
const std::string & getPhyId () const
 Get the physical interface ID.
 
const std::shared_ptr< AbstractFrontEnd > & getFrontEnd () const
 Get the front end interface.
 
virtual const PicoScenesFrameTxParameters & getUserSpecifiedTxParameters () const =0
 This methods returns the PicoScenesFrameTxParameters object created by the user specified Tx parameters.
.
 
virtual PicoScenesFrameTxParameters & getUserSpecifiedTxParameters ()=0
 This methods returns the PicoScenesFrameTxParameters object created by the user specified Tx parameters.
.
 
PicoScenesDeviceType getDeviceType () const
 Get the device type.
 
std::shared_ptr< AbstractHALConfigurationgetConfiguration () const
 Get the HAL configuration.
 
template<typename FrontEndT , class = std::enable_if_t<std::is_base_of_v<AbstractFrontEnd, FrontEndT>>>
std::shared_ptr< FrontEndT > getTypedFrontEnd () const
 Get typed front end instance.
 
const std::shared_ptr< PicoScenesPluginManager > & getPluginManager () const
 Get the plugin manager.
 
virtual void installPlugins () const =0
 Install plugins for this NIC.
 
std::vector< std::shared_ptr< po::options_description > > getAllNICOptions ()
 Get all NIC options.
 

Protected Member Functions

 AbstractNIC (const std::string &referredInterfaceName)
 Protected constructor.
 

Protected Attributes

std::string referredInterfaceName
 Interface name reference.
 
std::string phyId
 Physical interface identifier.
 
PicoScenesDeviceType deviceType = PicoScenesDeviceType::Unknown
 Type of the device (NIC/SDR)
 
std::shared_ptr< AbstractHALConfigurationconfiguration
 Hardware abstraction layer configuration.
 
std::shared_ptr< AbstractFrontEndfrontEnd
 Frontend interface for hardware interaction.
 
std::shared_ptr< PicoScenesPluginManagerpluginManager
 Plugin manager for extending functionality.
 

Detailed Description

Abstract base class for Network Interface Card (NIC) operations.

This class provides a common interface for different types of network interface cards, including both traditional Wi-Fi NICs and Software Defined Radio (SDR) devices. It manages transmission (Tx) and reception (Rx) services, frame handling, and plugin support.

Definition at line 28 of file AbstractNIC.hxx.

Constructor & Destructor Documentation

◆ AbstractNIC()

AbstractNIC::AbstractNIC ( const std::string &  referredInterfaceName)
explicitprotected

Protected constructor.

Parameters
referredInterfaceNameName of the interface to manage

Member Function Documentation

◆ checkFrameTypeHandlerExist()

virtual bool AbstractNIC::checkFrameTypeHandlerExist ( uint8_t  frameType)
pure virtual

Check if handler exists for specific frame type.

Parameters
frameTypeFrame type to check
Returns
true if handler exists, false otherwise

◆ checkGeneralHandlerExist()

virtual bool AbstractNIC::checkGeneralHandlerExist ( const std::string &  handlerKeyName)
pure virtual

Check if general handler exists.

Parameters
handlerKeyNameName of the handler to check
Returns
true if handler exists, false otherwise

◆ checkTaskIdHandlerExist()

virtual bool AbstractNIC::checkTaskIdHandlerExist ( uint16_t  taskId)
pure virtual

Check if handler exists for specific task ID.

Parameters
taskIdTask ID to check
Returns
true if handler exists, false otherwise

◆ getAllNICOptions()

std::vector< std::shared_ptr< po::options_description > > AbstractNIC::getAllNICOptions ( )

Get all NIC options.

Returns
Vector of option descriptions

◆ getConfiguration()

std::shared_ptr< AbstractHALConfiguration > AbstractNIC::getConfiguration ( ) const

Get the HAL configuration.

Returns
Shared pointer to HAL configuration

◆ getDeviceType()

PicoScenesDeviceType AbstractNIC::getDeviceType ( ) const

Get the device type.

Returns
Device type enumeration value

◆ getFrontEnd()

const std::shared_ptr< AbstractFrontEnd > & AbstractNIC::getFrontEnd ( ) const

Get the front end interface.

Returns
Shared pointer to the front end interface

◆ getGeneralHandler()

virtual std::function< bool(const ModularPicoScenesRxFrame &)> AbstractNIC::getGeneralHandler ( const std::string &  handlerKeyName)
pure virtual

Get general handler by name.

Parameters
handlerKeyNameName of the handler
Returns
Handler function

◆ getHandlerForFrameType()

virtual std::function< bool(const ModularPicoScenesRxFrame &)> AbstractNIC::getHandlerForFrameType ( uint8_t  frameType)
pure virtual

Get handler for specific frame type.

Parameters
frameTypeType of frame
Returns
Handler function for the specified frame type

◆ getHandlerForTaskId()

virtual std::function< bool(const ModularPicoScenesRxFrame &)> AbstractNIC::getHandlerForTaskId ( uint16_t  taskId)
pure virtual

Get handler for specific task ID.

Parameters
taskIdTask ID to get handler for
Returns
Handler function for the specified task ID

◆ getPhyId()

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

Get the physical interface ID.

Returns
Reference to the physical interface ID

◆ getPluginManager()

const std::shared_ptr< PicoScenesPluginManager > & AbstractNIC::getPluginManager ( ) const

Get the plugin manager.

Returns
Shared pointer to plugin manager

◆ getReferredInterfaceName()

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

Get the interface name.

Returns
Reference to the interface name

Referenced by getTypedFrontEnd().

◆ getTypedFrontEnd()

template<typename FrontEndT , class = std::enable_if_t<std::is_base_of_v<AbstractFrontEnd, FrontEndT>>>
std::shared_ptr< FrontEndT > AbstractNIC::getTypedFrontEnd ( ) const
inline

Get typed front end instance.

Template Parameters
FrontEndTType of front end to get
Returns
Shared pointer to typed front end instance

Definition at line 304 of file AbstractNIC.hxx.

References getReferredInterfaceName(), and FrontEndFactory::getTypedFrontEndInstance().

◆ getUserSpecifiedTxParameters() [1/2]

virtual const PicoScenesFrameTxParameters & AbstractNIC::getUserSpecifiedTxParameters ( ) const
pure virtual

This methods returns the PicoScenesFrameTxParameters object created by the user specified Tx parameters.
.

The user specified Tx parameters in CLI are parsed and interpreted into a PicoScenesFrameTxParameters object. To make this object available to upper-level plugins, it is store in the NIC/SDR's AbstractNIC object.
Plugin developers can access the user specified Tx parameters via this method.

◆ getUserSpecifiedTxParameters() [2/2]

virtual PicoScenesFrameTxParameters & AbstractNIC::getUserSpecifiedTxParameters ( )
pure virtual

This methods returns the PicoScenesFrameTxParameters object created by the user specified Tx parameters.
.

The user specified Tx parameters in CLI are parsed and interpreted into a PicoScenesFrameTxParameters object. To make this object available to upper-level plugins, it is store in the NIC/SDR's AbstractNIC object.
Plugin developers can access the user specified Tx parameters via this method.

◆ initializeTxFrame()

virtual ModularPicoScenesTxFrame AbstractNIC::initializeTxFrame ( )
inlinevirtual

Initialize a new transmission frame.

Returns
Initialized ModularPicoScenesTxFrame object
See also
AbstractFrontEnd::initializeTxFrame

Definition at line 108 of file AbstractNIC.hxx.

References frontEnd.

◆ installPlugins()

virtual void AbstractNIC::installPlugins ( ) const
pure virtual

Install plugins for this NIC.

◆ isRxServiceStarted()

virtual bool AbstractNIC::isRxServiceStarted ( ) const
pure virtual

Check if reception service is running.

Returns
true if service is active, false otherwise

◆ isTxServiceStarted()

virtual bool AbstractNIC::isTxServiceStarted ( ) const
pure virtual

Check if transmission service is running.

Returns
true if service is active, false otherwise

◆ pauseRx()

virtual void AbstractNIC::pauseRx ( )
pure virtual

Temporarily pause reception.

◆ pauseTx()

virtual void AbstractNIC::pauseTx ( )
pure virtual

Temporarily pause transmission.

◆ registerFrameTypeHandler()

virtual void AbstractNIC::registerFrameTypeHandler ( uint8_t  frameType,
const std::function< bool(const ModularPicoScenesRxFrame &)> &  handle 
)
pure virtual

Register handler for specific frame type.

Parameters
frameTypeType of frame
handleHandler function

◆ registerGeneralHandler()

virtual void AbstractNIC::registerGeneralHandler ( const std::string &  handlerKeyName,
const std::function< bool(const ModularPicoScenesRxFrame &)> &  handle 
)
pure virtual

Register a general handler.

Parameters
handlerKeyNameName of the handler
handleHandler function

◆ registerTaskIdHandler()

virtual void AbstractNIC::registerTaskIdHandler ( uint16_t  taskId,
const std::function< bool(const ModularPicoScenesRxFrame &)> &  handle 
)
pure virtual

Register a handler for specific task ID.

Parameters
taskIdTask ID to handle
handleHandler function

◆ resumeRx()

virtual void AbstractNIC::resumeRx ( )
pure virtual

Resume paused reception.

◆ resumeTx()

virtual void AbstractNIC::resumeTx ( )
pure virtual

Resume paused transmission.

◆ startRxService()

virtual void AbstractNIC::startRxService ( )
pure virtual

Start the reception service.

◆ startTxService()

virtual void AbstractNIC::startTxService ( )
pure virtual

Start the transmission service.

◆ stopRxService()

virtual void AbstractNIC::stopRxService ( )
pure virtual

Stop the reception service.

◆ stopTxService()

virtual void AbstractNIC::stopTxService ( )
pure virtual

Stop the transmission service.

◆ syncRxConditionally()

virtual std::optional< ModularPicoScenesRxFrame > AbstractNIC::syncRxConditionally ( const std::function< bool(const ModularPicoScenesRxFrame &)> &  condition,
const std::chrono::milliseconds &  maxWait_ms,
std::optional< std::string >  conditionaName = std::nullopt 
)
pure virtual

Wait for a frame that matches specific conditions.

Parameters
conditionFunction defining the matching condition
maxWait_msMaximum time to wait in milliseconds
conditionaNameOptional name for the condition
Returns
Optional containing the received frame if found

◆ syncRxWaitTaskId()

virtual std::optional< ModularPicoScenesRxFrame > AbstractNIC::syncRxWaitTaskId ( uint16_t  taskid,
uint32_t  maxWait_ms 
)
pure virtual

Wait for a frame with specific task ID.

Parameters
taskidTask ID to wait for
maxWait_msMaximum time to wait in milliseconds
Returns
Optional containing the received frame if found

◆ transmitFramesInBatch() [1/2]

virtual int AbstractNIC::transmitFramesInBatch ( const std::vector< ModularPicoScenesTxFrame > &  frames,
uint16_t  numRepeats 
)
pure virtual

Transmit multiple frames in batch mode.

Parameters
framesVector of frames to transmit
numRepeatsNumber of times to repeat the transmission
Returns
Status code indicating success or failure

Referenced by transmitFramesInBatch().

◆ transmitFramesInBatch() [2/2]

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

Template method for batch transmission of frames.

Template Parameters
repeatNumber of times to repeat the transmission
FramesVariable number of frame parameters
Parameters
framesFrames to transmit
Returns
Status code indicating success or failure

Definition at line 90 of file AbstractNIC.hxx.

References transmitFramesInBatch().

◆ transmitPicoScenesFrame()

virtual int AbstractNIC::transmitPicoScenesFrame ( const ModularPicoScenesTxFrame &  frame)
pure virtual

Transmit a single PicoScenes frame.

Parameters
frameThe frame to transmit
Returns
Status code indicating success or failure

◆ transmitPicoScenesFrameSync()

virtual int AbstractNIC::transmitPicoScenesFrameSync ( const ModularPicoScenesTxFrame &  frame)
pure virtual

Transmit a frame synchronously.

Parameters
frameThe frame to transmit
Returns
Status code indicating success or failure

◆ unregisterFrameTypeHandler()

virtual void AbstractNIC::unregisterFrameTypeHandler ( uint8_t  frameType)
pure virtual

Unregister handler for specific frame type.

Parameters
frameTypeFrame type to unregister

◆ unregisterGeneralHandler()

virtual void AbstractNIC::unregisterGeneralHandler ( const std::string &  handlerKeyName)
pure virtual

Unregister general handler.

Parameters
handlerKeyNameName of the handler to unregister

◆ unregisterTaskIdHandler()

virtual void AbstractNIC::unregisterTaskIdHandler ( uint16_t  taskId)
pure virtual

Unregister handler for specific task ID.

Parameters
taskIdTask ID to unregister

Member Data Documentation

◆ configuration

std::shared_ptr<AbstractHALConfiguration> AbstractNIC::configuration
protected

Hardware abstraction layer configuration.

Definition at line 344 of file AbstractNIC.hxx.

◆ deviceType

PicoScenesDeviceType AbstractNIC::deviceType = PicoScenesDeviceType::Unknown
protected

Type of the device (NIC/SDR)

Definition at line 339 of file AbstractNIC.hxx.

◆ frontEnd

std::shared_ptr<AbstractFrontEnd> AbstractNIC::frontEnd
protected

Frontend interface for hardware interaction.

Definition at line 349 of file AbstractNIC.hxx.

Referenced by initializeTxFrame().

◆ phyId

std::string AbstractNIC::phyId
protected

Physical interface identifier.

Definition at line 334 of file AbstractNIC.hxx.

◆ pluginManager

std::shared_ptr<PicoScenesPluginManager> AbstractNIC::pluginManager
protected

Plugin manager for extending functionality.

Definition at line 354 of file AbstractNIC.hxx.

◆ referredInterfaceName

std::string AbstractNIC::referredInterfaceName
protected

Interface name reference.

Definition at line 329 of file AbstractNIC.hxx.


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