Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
ClientConnection.h
Go to the documentation of this file.
1#pragma once
2#include <QIODevice>
7
8namespace sf
9{
10
15 : public QObject
16 , protected InformationTypes
17{
18 public:
31
35 explicit ClientConnection(QIODevice* ioDevice, QObject* parent = nullptr);
36
42 bool process();
43
44 void setState(EState state);
45
46 private:
47 bool sendPingPong(int counter);
48
49 // Holds the IO device reference.
50 QIODevice* _ioDevice;
51 // Holds the variable client instances which are served.
52 VariableTypes::PtrVector _listVariable;
53 // Holds the result-data client instances which are served.
54 ResultDataTypes::PtrVector _listResultData;
55 // Holds the current state of the connection.
56 EState _curState{sNone};
57 // Holds the previous state of the connection.
58 EState _prevState{sNone};
59 //
60 InformationPacket::Header _headerRead;
61 DynamicBuffer _bufferRead;
62 DynamicBuffer _bufferWrite;
63 //
64 BufferChopper bufChopper{16};
65};
66
67}// namespace sf
Class handling the connection exchanging data using a QIODevice.
Definition ClientConnection.h:17
ClientConnection(QIODevice *ioDevice, QObject *parent=nullptr)
Constructor for passing a socket descriptor.
bool process()
Non blocking method which processes data incoming and outgoing data from the IO device.
EState
Definition ClientConnection.h:20
@ sWaitForRead
Definition ClientConnection.h:28
@ sError
Definition ClientConnection.h:21
@ sHeaderRead
Definition ClientConnection.h:23
@ sNone
Definition ClientConnection.h:22
@ sPayloadProcess
Definition ClientConnection.h:25
@ sDisconnect
Definition ClientConnection.h:29
@ sBufferWrite
Definition ClientConnection.h:26
@ sIdle
Definition ClientConnection.h:27
@ sPayloadRead
Definition ClientConnection.h:24
void setState(EState state)
Base class for all generic information objects to be able to put them in a typed list together.
Definition InformationBase.h:25
Definition Application.h:10
TDynamicBuffer< Allocator > DynamicBuffer
Actual specialized dynamic buffer type using the default allocator.
Definition TDynamicBuffer.h:540