API Documentation
Loading...
Searching...
No Matches
SocketIODriver.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Hardware
28File: SocketIODriver
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <QIODevice>
35#include <NDEVR/Connection.h>
39
40namespace NDEVR
41{
42 class TimeSpan;
43 class SocketIOChannel;
44 /**--------------------------------------------------------------------------------------------------
45 \brief A ConnectionBackend that allows the software to interface with SocketIO for communicating
46 with across networks.
47 **/
49 {
50 public:
53 ~SocketIODriver() = default;
54 SocketIODriver(const SocketIODriver& other) = delete;
55 SocketIODriver(SocketIODriver&& other) = delete;
56 SocketIODriver& operator=(const SocketIODriver& other) = delete;
58
59 virtual uint04 peek(char* s, uint04 size = Constant<uint04>::Max) const override;
60 virtual uint04 rx(char* s, uint04 max_size = Constant<uint04>::Max) override;
61 virtual void tx(const String& command) override;
62 virtual bool open(const ConnectionInfo& request) override;
63 virtual void close() override;
64 virtual bool isOpen() const override;
65 virtual bool waitForReadyRead(const TimeSpan& span) override;
66 virtual TranslatedString lastError() const override;
67 virtual uint04 bytesAvailable() const override;
68 private:
70 QByteArray m_channel_write_buffer;
71 QByteArray m_channel_read_buffer;
72 Dictionary<int, unsigned int> m_received_bytes;
73 std::mutex m_critical_section;//critical section for this object only
74 bool m_is_open = false;
75 };
76 /**--------------------------------------------------------------------------------------------------
77 \brief A ConnectionFactory that enables the creation of a SocketIODriver for interfacing with
78 a SocketIO
79 **/
81 {
82 public:
83 virtual bool handlesType(const String& request) const override;
84 virtual ConnectionBackend* createConnection(const ConnectionInfo& request) override;
87 };
88}
89
#define SOCKET_IO_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 hash-based key-value store, useful for quick associative lookups. Key features include:
Definition Dictionary.h:61
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Definition Pointer.hpp:320
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 SocketIODriver for interfacing with a SocketIO.
Definition SocketIODriver.h:81
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 SocketIO for communicating with across...
Definition SocketIODriver.h:49
virtual void tx(const String &command) override
virtual uint04 rx(char *s, uint04 max_size=Constant< uint04 >::Max) override
SocketIODriver & operator=(const SocketIODriver &other)=delete
virtual void close() override
SocketIODriver(DynamicPointer< SocketIOChannel > socket, ProgressInfo *log=nullptr)
virtual bool isOpen() const override
SocketIODriver(const SocketIODriver &other)=delete
SocketIODriver(ProgressInfo *log=nullptr)
SocketIODriver & operator=(SocketIODriver &&other)=delete
SocketIODriver(SocketIODriver &&other)=delete
virtual TranslatedString lastError() const override
virtual bool waitForReadyRead(const TimeSpan &span) override
virtual uint04 bytesAvailable() const override
virtual uint04 peek(char *s, uint04 size=Constant< uint04 >::Max) const override
virtual bool open(const ConnectionInfo &request) 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
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