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

Interface class for UDP service. More...

#include <UDPService.hxx>

Public Member Functions

virtual size_t sendData (const uint8_t *data, uint32_t bufferLength, const std::string &targetIP, uint16_t targetPort, std::optional< uint16_t > sourcePort=std::nullopt)=0
 Sends data over UDP.
 

Static Public Member Functions

static std::shared_ptr< UDPServicegetInstance (const std::string &name)
 Gets the singleton instance of UDPService.
 

Detailed Description

Interface class for UDP service.

The UDPService class provides an interface for sending and receiving data over UDP. It is designed to be extended by concrete implementations that handle the specifics of UDP communication.

Definition at line 19 of file UDPService.hxx.

Member Function Documentation

◆ getInstance()

static std::shared_ptr< UDPService > UDPService::getInstance ( const std::string &  name)
static

Gets the singleton instance of UDPService.

Parameters
nameThe name of the service instance.
Returns
A shared pointer to the UDPService instance.

◆ sendData()

virtual size_t UDPService::sendData ( const uint8_t *  data,
uint32_t  bufferLength,
const std::string &  targetIP,
uint16_t  targetPort,
std::optional< uint16_t >  sourcePort = std::nullopt 
)
pure virtual

Sends data over UDP.

Parameters
dataPointer to the data to send.
bufferLengthLength of the data buffer.
targetIPThe target IP address.
targetPortThe target port number.
sourcePortOptional source port number. If not specified, a random port is used.
Returns
The number of bytes sent.

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