You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
930 B
45 lines
930 B
#ifndef NETWORKPROVIDER
|
|
#define NETWORKPROVIDER
|
|
|
|
#include <QHostAddress>
|
|
#include <QTcpServer>
|
|
#include "provider/IProvider.h"
|
|
#include "parser/IParser.h"
|
|
#include <QTimer>
|
|
|
|
class NetworkProvider : public QObject, public IDataProvider
|
|
{
|
|
Q_OBJECT
|
|
Q_INTERFACES(IDataProvider)
|
|
|
|
public:
|
|
NetworkProvider(QHostAddress hostAddress, quint16 port);
|
|
void setParser(Parser_ptr parser);
|
|
void pauseServer();
|
|
void resumeServer();
|
|
void stopServer();
|
|
|
|
signals:
|
|
void provided(const Log_ptr log) override;
|
|
|
|
//uncrustify off
|
|
private slots:
|
|
//uncrustify on
|
|
void onErrorOccured(QAbstractSocket::SocketError error);
|
|
void createNewConnection();
|
|
|
|
private:
|
|
bool _isRunning;
|
|
quint16 _port;
|
|
QHostAddress _address;
|
|
QTcpServer _server;
|
|
Parser_ptr _parser;
|
|
|
|
void initServer();
|
|
void resumeConnectedSessions();
|
|
void stopConnectedSessions();
|
|
|
|
QTimer _timer;
|
|
};
|
|
|
|
#endif //NEWTORKPROVIDER
|
|
|