3#include <NDEVR/Connection.h>
4#include <NDEVR/TranslatedString.h>
36 virtual uint04 rx(
char*,
uint04 size = Constant<uint04>::Max)
final override;
56 virtual void close() final override;
61 virtual
bool isOpen() const final override;
Defines cross-platform DLL export/import macros for the NDEVRNetworkProtocols module.
The equivelent of std::vector but with a bit more control.
Provides the unseen backend logic for setting up, tearing down, and sending data over a specific type...
ConnectionBackend(LogPtr log)
Constructs a ConnectionBackend with the given log.
Stores factories that can be registered for creating Connections of various types by instantiating a ...
A light-weight wrapper that will be a no-op if there is not a valid log reference,...
A ConnectionFactory that enables the creation of a SocketConnection for interfacing with a QAbstractS...
virtual Buffer< ConnectionInfo > availableConnections(const ConnectionSearchParameters ¶ms) override
Enumerates available network connections matching the given search parameters.
virtual ConnectionBackend * createConnection(const ConnectionInfo &request) override
Creates a new SocketConnection backend for the given connection info.
virtual bool handlesType(const StringView &request) const override
Checks whether this factory can create connections for the given type string.
virtual Buffer< ConnectionCategory > availableConnectionCategories() override
Returns the categories of connections this factory can produce.
void handleSocketErrorSlot(int error)
Slot that handles socket error signals and stores the error description.
bool openTCP(const ConnectionInfo &request)
Opens a TCP connection using the given connection info.
virtual uint04 peek(char *, uint04 size) const final override
Peeks at incoming data without consuming it from the socket buffer.
virtual bool waitForConnection(QAbstractSocket *socket, const ConnectionInfo &request)
Blocks until the socket establishes a connection or the request times out.
void setSocket(QAbstractSocket *socket)
Replaces the internal socket with the given QAbstractSocket.
QAbstractSocket * m_socket
The underlying Qt socket (TCP or UDP).
bool openUDP(const ConnectionInfo &request)
Opens a UDP client connection using the given connection info.
virtual bool open(const ConnectionInfo &request) final override
Opens a socket connection using the given connection info (TCP or UDP).
virtual bool isOpen() const final override
Checks whether the socket connection is currently open.
bool openUDPServer(const ConnectionInfo &request)
Opens a UDP server (broadcast listener) using the given connection info.
virtual void close() final override
Closes the socket connection and releases associated resources.
virtual bool setUDPPort(QUdpSocket *udp_port, ConnectionOpenType connect_mode)
Assigns an existing QUdpSocket to this connection.
virtual bool setTCPPort(QTcpSocket *tcp_port, ConnectionOpenType connect_mode)
Assigns an existing QTcpSocket to this connection.
virtual void tx(const StringView &command) final override
Transmits the given command string over the socket.
virtual TranslatedString lastError() const final override
Returns a translated description of the last socket error encountered.
virtual uint04 bytesAvailable() const override
Returns the number of bytes available for reading from the socket.
virtual uint04 rx(char *, uint04 size=Constant< uint04 >::Max) final override
Reads (receives) data from the socket.
uint02 m_broadcast_port
The UDP broadcast port, or Invalid if not broadcasting.
virtual bool waitForReadyRead(const TimeSpan &span) final override
Blocks until data is available to read or the given timeout elapses.
void txInThread(const StringView &data)
Transmits data over the socket from a worker thread context.
QHostAddress m_host_address
The resolved host address for the connection.
SocketConnection(LogPtr log)
Constructs a SocketConnection with the given log for diagnostics.
TranslatedString m_last_error
The last error message from the socket.
The core String View class for the NDEVR API.
Stores a time span, or difference between two times, with an optional start time.
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
The primary namespace for the NDEVR SDK.
uint16_t uint02
-Defines an alias representing a 2 byte, unsigned integer -Can represent exact integer values 0 throu...
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
ConnectionOpenType
Describes how to open a connection.
A structure designed to store information about a specific Connection.
Describes settings for performing a Connection search.
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...