API Documentation
Loading...
Searching...
No Matches
WebSocketConnection.h
Go to the documentation of this file.
1#pragma once
2#include "DLLInfo.h"
3#include <NDEVR/Connection.h>
5class QWebSocket;
6namespace NDEVR
7{
8 /**--------------------------------------------------------------------------------------------------
9 \brief A ConnectionBackend that allows the software to interface with QWebSocket for communicating
10 with WebSocket devices.
11
12 WebSockets is a web technology providing full-duplex communications channels over a single TCP connection.
13 The WebSocket protocol was standardized by the IETF as RFC 6455 in 2011. QWebSocket can both be used in a
14 client application and server application.
15 **/
17 {
18 Q_OBJECT
19 public:
22 virtual uint04 peek(char*, uint04 size) const override;
23 virtual uint04 rx(char*, uint04 size = Constant<uint04>::Max) override;
24 virtual void tx(const String& command) override;
25 virtual bool open(const ConnectionInfo& request) override;
26 virtual void close() override;
27 virtual bool isOpen() const override;
28 virtual uint04 bytesAvailable() const override;
29 virtual TranslatedString lastError() const override;
30 virtual bool setPort(QWebSocket* tcp_port);
31 virtual bool waitForReadyRead(const TimeSpan& span) override;
32 virtual bool waitForConnection(QWebSocket* socket, const ConnectionInfo& request);
33 void setSocket(QWebSocket* socket);
34 protected slots:
35 void handleSocketErrorSlot(int error);
36 void binaryMessageRecieved(const QByteArray& array);
37 void textMessageRecieved(const QString& message);
38 protected:
39 QWebSocket* m_socket = nullptr;
42 };
43 /**--------------------------------------------------------------------------------------------------
44 \brief A ConnectionFactory that enables the creation of a WebSocketConnection for interfacing with
45 a QWebSocket
46 **/
48 {
49 public:
50 virtual bool handlesType(const String& request) const override;
51 virtual ConnectionBackend* createConnection(const ConnectionInfo& request) override;
54 };
55}
#define NDEVR_WEB_SOCKET_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
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
A ConnectionFactory that enables the creation of a WebSocketConnection for interfacing with a QWebSoc...
Definition WebSocketConnection.h:48
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 ConnectionBackend that allows the software to interface with QWebSocket for communicating with WebS...
Definition WebSocketConnection.h:17
virtual void tx(const String &command) override
virtual bool setPort(QWebSocket *tcp_port)
void textMessageRecieved(const QString &message)
WebSocketConnection(ProgressInfo *log)
TranslatedString m_last_error
Definition WebSocketConnection.h:40
virtual void close() override
void binaryMessageRecieved(const QByteArray &array)
virtual bool isOpen() const override
virtual uint04 peek(char *, uint04 size) const override
virtual bool waitForConnection(QWebSocket *socket, const ConnectionInfo &request)
void handleSocketErrorSlot(int error)
virtual uint04 rx(char *, uint04 size=Constant< uint04 >::Max) override
void setSocket(QWebSocket *socket)
String m_data
Definition WebSocketConnection.h:41
virtual TranslatedString lastError() const override
virtual bool waitForReadyRead(const TimeSpan &span) override
virtual uint04 bytesAvailable() const override
virtual bool open(const ConnectionInfo &request) override
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
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