SoundBand/Sync/LocalScanner.h

52 lines
1.2 KiB
C
Raw Normal View History

2017-11-22 22:34:55 +03:00
#ifndef LocalServers_H
#define LocalServers_H
#include <QNetworkInterface>
#include <QHostInfo>
#include <QList>
#include <QTimer>
#include "ETcpSocket.h"
2017-11-26 19:19:43 +03:00
/**
* @brief The LocalScanner class
* The principle of operation of a local scanner.
* The local scanner gets its address on the local network,
* the resulting address is converted into a subnet mask.
* Then it checks for the presence of addresses in the range of the received mask.
* The available addresses are added to the list.
*/
2017-11-22 22:34:55 +03:00
class LocalScanner:public QObject{
Q_OBJECT
private:
QList<ETcpSocket*> socets;
QList<ETcpSocket*> results;
QTimer wiat;
void clear();
void clearSocets();
private slots:
void scaned_();
void connected(ETcpSocket *);
public:
2017-11-26 19:19:43 +03:00
/**
* @brief scane - start scaning
*/
2017-11-27 19:43:11 +03:00
void scane(int port);
2017-11-26 19:19:43 +03:00
/**
* @brief setInterval - set a new waiting interval
* @param msec
*/
2017-11-22 22:34:55 +03:00
void setInterval(int msec);
2017-11-26 19:19:43 +03:00
/**
* @brief thisAdress - return addres of local network
* @return addres
*/
2017-12-03 18:19:49 +03:00
static QHostAddress thisAddress();
2017-11-22 22:34:55 +03:00
LocalScanner();
~LocalScanner();
signals:
2017-11-26 19:19:43 +03:00
/**
* @brief scaned - sigbal if all done
*/
2017-11-22 22:34:55 +03:00
void scaned(QList<ETcpSocket*>*);
};
#endif // LocalServers_H