NDEVR
API Documentation
AdaptiveTCPServer.h
1#pragma once
2#include <NDEVR/NDEVRCommunicationLogic.h>
3#include <NDEVR/Buffer.h>
4#include <NDEVR/QueueBuffer.h>
5#include <NDEVR/Dictionary.h>
6#include <NDEVR/UUID.h>
7#include <QTcpServer>
8#include <QTcpSocket>
9#include <QElapsedTimer>
10#include <QTimer>
11#include <QMap>
12namespace NDEVR
13{
17 class AdaptiveTCPServer : public QTcpServer, public NDEVRCommunicationLogic
18 {
19 Q_OBJECT
20 public:
23 explicit AdaptiveTCPServer(QObject* parent = nullptr);
26 void start(quint16 port);
27 virtual uint08 rx(void* socket, NDEVRDataPacket& packet) override;
28 virtual uint08 tx(void* socket, NDEVRDataPacket& packet, uint08 size) override;
29 uint08 bytesAvailable(void* socket) override;
30 virtual void wait(const TimeSpan& span, LogPtr log = nullptr) override;
31 void* connectTo(const NDEVRServerInfo& server);
32 virtual void disconnectFrom(void* socket);
33 virtual bool isOpen(void* socket = nullptr) const override;
34 private slots:
36 void onConnectionReadyRead();
38 void onSendTick();
39 protected:
42 void incomingConnection(qintptr socketDescriptor) override;
43 private:
44 QTimer m_send_timer;
45 };
46}
void start(quint16 port)
Starts listening on the specified port.
void incomingConnection(qintptr socketDescriptor) override
Handles a new incoming TCP connection.
AdaptiveTCPServer(QObject *parent=nullptr)
Constructs the TCP server.
A light-weight wrapper that will be a no-op if there is not a valid log reference,...
Stores a time span, or difference between two times, with an optional start time.
Definition TimeSpan.h:46
The primary namespace for the NDEVR SDK.
uint64_t uint08
-Defines an alias representing an 8 byte, unsigned integer
Contains the address, credentials, and security flag needed to connect to an NDEVR server.