API Documentation
Loading...
Searching...
No Matches
SocketConnection.h
Go to the documentation of this file.
1#pragma once
2#include "DLLInfo.h"
3#include <NDEVR/Connection.h>
5namespace NDEVR
6{
7 /**--------------------------------------------------------------------------------------------------
8 \brief A core ConnectionBackend for QAbstractSocket supporting TCP and UDP connections.
9 **/
11 {
12 public:
15 virtual uint04 peek(char*, uint04 size) const final override;
16 virtual uint04 rx(char*, uint04 size = Constant<uint04>::Max) final override;
17 virtual void tx(const String& command) final override;
18 virtual bool open(const ConnectionInfo& request) final override;
19 virtual void close() final override;
20 virtual bool isOpen() const final override;
21 virtual uint04 bytesAvailable() const override;
22 virtual TranslatedString lastError() const final override;
23 virtual bool setTCPPort(QTcpSocket* tcp_port, ConnectionOpenType connect_mode);
24 virtual bool setUDPPort(QUdpSocket* udp_port, ConnectionOpenType connect_mode);
25 virtual bool waitForReadyRead(const TimeSpan& span) final override;
26 virtual bool waitForConnection(QAbstractSocket* socket, const ConnectionInfo& request);
27 void setSocket(QAbstractSocket* socket);
28 bool openUDP(const ConnectionInfo& request);
29 bool openUDPServer(const ConnectionInfo& request);
30 bool openTCP(const ConnectionInfo& request);
31 protected slots:
32 void handleSocketErrorSlot(int error);
33 protected:
34 QAbstractSocket* m_socket = nullptr;
35 TranslatedString m_last_error;
36 uint02 m_broadcast_port = Constant<uint02>::Invalid;
37 };
38 /**--------------------------------------------------------------------------------------------------
39 \brief A ConnectionFactory that enables the creation of a SocketConnection for interfacing with
40 a QAbstractSocket
41 **/
43 {
44 public:
45 virtual bool handlesType(const String& request) const override;
46 virtual ConnectionBackend* createConnection(const ConnectionInfo& request) override;
49 };
50}
#define NDEVR_NETWORK_PROTOCOLS_API
Definition DLLInfo.h:55
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
Provides the unseen backend logic for setting up, tearing down, and sending data over a specific type...
Definition Connection.h:153
Stores factories that can be registered for creating Connections of various types.
Definition Connection.h:177
A light-weight base class for Log that allows processes to update, without the need for additional in...
Definition ProgressInfo.hpp:48
A ConnectionFactory that enables the creation of a SocketConnection for interfacing with a QAbstractS...
Definition SocketConnection.h:43
virtual Buffer< ConnectionInfo > availableConnections(const ConnectionSearchParamaters &params) override
virtual Buffer< ConnectionCategory > availableConnectionCatagories() override
virtual bool handlesType(const String &request) const override
virtual ConnectionBackend * createConnection(const ConnectionInfo &request) override
A core ConnectionBackend for QAbstractSocket supporting TCP and UDP connections.
Definition SocketConnection.h:11
virtual bool open(const ConnectionInfo &request) final override
virtual uint04 rx(char *, uint04 size=Constant< uint04 >::Max) final override
SocketConnection(ProgressInfo *log)
virtual void close() final override
virtual void tx(const String &command) final override
virtual uint04 peek(char *, uint04 size) const final override
The core String class for the NDEVR API.
Definition String.h:69
Stores a time span, or difference between two times, with an optional start time.
Definition TimeSpan.h:46
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
Definition TranslatedString.h:13
Definition ACIColor.h:37
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96
uint16_t uint02
-Defines an alias representing a 2 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:88
ConnectionOpenType
Describes how to open a connection.
Definition Connection.h:76
A structure designed to store information about a specific Connection.
Definition Connection.h:97
Describes settings for performing a Connection search.
Definition Connection.h:136
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
Definition BaseValues.hpp:233