Log Viewer
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.
 
 

52 lines
1.1 KiB

#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;
void clientConnected();
void clientDisconnected();
void clientError(QString error);
//uncrustify off
private slots:
//uncrustify on
void onErrorOccured(QAbstractSocket::SocketError error);
void createNewConnection();
void onReadyRead();
void onClientDisconnected();
void onSocketError(QAbstractSocket::SocketError socketError);
private:
bool _isRunning;
quint16 _port;
QHostAddress _address;
QTcpServer _server;
Parser_ptr _parser;
void initServer();
void resumeConnectedSessions();
void stopConnectedSessions();
QTimer _timer;
};
#endif //NEWTORKPROVIDER