-
Notifications
You must be signed in to change notification settings - Fork 0
/
ftpactivebinarydatain.h
88 lines (82 loc) · 2.05 KB
/
ftpactivebinarydatain.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#ifndef FTPACTIVEBINARYDATAIN_H
#define FTPACTIVEBINARYDATAIN_H
#include <QTcpServer>
#include <QTcpSocket>
#include <QFile>
#include <QDataStream>
#include <QByteArray>
/**
* @brief Класс обеспечивает передачу бинарных данных в активном режиме от клиента серверу
*
*/
class FTPActiveBinaryDataIn : public QTcpSocket
{
Q_OBJECT
public:
/**
* @brief Конструктор класса
*
* @param aLocalAdress адрес локального сокета
* @param aLocalPort порт локального сокета
* @param parent родительский объект
*/
explicit FTPActiveBinaryDataIn(QHostAddress aLocalAdress, int aLocalPort,QObject *parent = 0);
/**
* @brief Деструктор класса
*
*/
~FTPActiveBinaryDataIn();
/**
* @brief Устанавливает файл, в который необходимо сохранить принятые данные
*
* @param aFile Файл
*/
bool setSaveFile(QFile *aFile);
/**
* @brief Прерывание соединения
*
*/
void abortConnection();
signals:
/**
* @brief Сигнал высылается после того, как произошла ошибка во время сохранения файла
*
*/
void errorStoreDataInFileSignal();
/**
* @brief Сигнал высылается после успешного приёма и сохранения файла
*
*/
void storeDataInFileCompleteSuccessfulSignal();
/**
* @brief Сигнал высылается после обрыва соединения
*
*/
void connectionCloseByClientSignal();
/**
* @brief Сигнал высылается после того, как соединение было успешно прервано
*
*/
void abortCommandCompleteSignal();
public slots:
private slots:
/**
* @brief Слот для чтения входящих данных
*
*/
void readIncomingData();
/**
* @brief слот для обработки ситуации закрытия соединения клиентом
*
*/
void connectionCloseByClientSlot();
/**
* @brief слот для обработки ситуации обрыва соединения сервером
*
*/
void abortConnectionSlot();
private:
QFile *file; /**< TODO Сохраняемый файл */
QDataStream *writeStream; /**< TODO Поток для сохранения */
};
#endif // FTPACTIVEBINARYDATAIN_H