HiveMind
Classes | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
TCPServer Class Reference

#include <TCPServer.h>

Inheritance diagram for TCPServer:
Inheritance graph
Collaboration diagram for TCPServer:
Collaboration graph

Classes

struct  m_address
 

Public Member Functions

 TCPServer (ILogger &logger)
 
 ~TCPServer () override
 
bool openSocket (int port)
 opens the socket on a certain port More...
 
bool send (const uint8_t *buffer, uint16_t length) override
 
bool receive (uint8_t *buffer, uint16_t length) override
 
bool isConnected () const override
 Tells if interface is connected and functionning. More...
 
void close ()
 
ConnectionType getType () const override
 Tells the type of the connection interface. More...
 
- Public Member Functions inherited from ICommInterface
virtual ~ICommInterface ()=default
 

Private Member Functions

void closeClient ()
 
void waitForClient ()
 

Static Private Member Functions

static void listenTask (void *param)
 

Private Attributes

ILoggerm_logger
 
bool m_connected
 
BaseTask< configMINIMAL_STACK_SIZE *2 > m_listenTask
 
int m_serverFd {}
 
int m_port
 
std::optional< int > m_clientFd
 
int m_addressLength {}
 

Constructor & Destructor Documentation

◆ TCPServer()

TCPServer::TCPServer ( ILogger logger)

◆ ~TCPServer()

TCPServer::~TCPServer ( )
override
Here is the call graph for this function:

Member Function Documentation

◆ close()

void TCPServer::close ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ closeClient()

void TCPServer::closeClient ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getType()

ConnectionType TCPServer::getType ( ) const
overridevirtual

Tells the type of the connection interface.

Returns
the type of connection

Implements ICommInterface.

◆ isConnected()

bool TCPServer::isConnected ( ) const
overridevirtual

Tells if interface is connected and functionning.

Returns
true if connected, false otherwise

Implements ICommInterface.

◆ listenTask()

void TCPServer::listenTask ( void *  param)
staticprivate
Here is the call graph for this function:

◆ openSocket()

bool TCPServer::openSocket ( int  port)

opens the socket on a certain port

Returns
true if the socket could be opened, binded and then listen to the port, false if not
Here is the call graph for this function:
Here is the caller graph for this function:

◆ receive()

bool TCPServer::receive ( uint8_t *  buffer,
uint16_t  length 
)
override

◆ send()

bool TCPServer::send ( const uint8_t *  buffer,
uint16_t  length 
)
override

◆ waitForClient()

void TCPServer::waitForClient ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_addressLength

int TCPServer::m_addressLength {}
private

◆ m_clientFd

std::optional<int> TCPServer::m_clientFd
private

◆ m_connected

bool TCPServer::m_connected
private

◆ m_listenTask

BaseTask<configMINIMAL_STACK_SIZE * 2> TCPServer::m_listenTask
private

◆ m_logger

ILogger& TCPServer::m_logger
private

◆ m_port

int TCPServer::m_port
private

◆ m_serverFd

int TCPServer::m_serverFd {}
private

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