Scanframe Modular Application
0.1.0
Loading...
Searching...
No Matches
SocketClient.h
Go to the documentation of this file.
1
#pragma once
2
#include <QAbstractSocket>
3
#include <QMutex>
4
#include <QThread>
5
#include <QWaitCondition>
6
#include <
ami/service/ClientConnection.h
>
7
#include <
misc/gen/Condition.h
>
8
#include <
misc/gen/Sync.h
>
9
#include <
misc/qt/QtSync.h
>
10
11
namespace
sf
12
{
13
14
class
SocketClient
15
:
public
QThread
16
,
protected
QtSync
17
{
18
public
:
19
explicit
SocketClient
(QObject* parent);
20
21
~SocketClient
()
override
;
22
23
void
connectHost
(
const
QString& hostName,
int
portNumber);
24
25
private
:
26
void
run()
override
;
27
28
void
handleError(QAbstractSocket::SocketError socketError)
const
;
29
30
QString _hostName;
31
int
_portNumber{0};
32
// Timeout in milliseconds.
33
int
_waitTimeout{5000};
34
// Mutex for the condition.
35
QMutex _mutex;
36
//
37
QAbstractSocket* _socket{
nullptr
};
38
//
39
QWaitCondition _waitCondition;
40
//
41
ClientConnection* _connection;
42
43
// LLDB Crashes and GDB freezes when this MACRO is in top of the class.
44
Q_OBJECT
45
};
46
47
}
// namespace sf
ClientConnection.h
Condition.h
QtSync.h
Sync.h
sf::QtSync::QtSync
QtSync()=default
Only by inheritance is allowed to create this instance.
sf::SocketClient::~SocketClient
~SocketClient() override
sf::SocketClient::connectHost
void connectHost(const QString &hostName, int portNumber)
sf::SocketClient::SocketClient
SocketClient(QObject *parent)
sf
Definition
Application.h:10
src
com
ami
service
SocketClient.h
Generated by
1.16.1