2019-12-01 22:27:00 +03:00
|
|
|
#ifndef IPPDISCOVERY_H
|
|
|
|
#define IPPDISCOVERY_H
|
|
|
|
#include <QStringListModel>
|
2020-01-05 20:41:24 +03:00
|
|
|
#include <QQuickImageProvider>
|
2019-12-01 22:27:00 +03:00
|
|
|
#include <QUdpSocket>
|
2020-01-05 20:41:24 +03:00
|
|
|
#include <QMutex>
|
|
|
|
#include <QImageReader>
|
|
|
|
#include <QtNetwork>
|
|
|
|
#include <QNetworkAccessManager>
|
|
|
|
#include <QEventLoop>
|
2019-12-01 22:27:00 +03:00
|
|
|
#include "bytestream.h"
|
|
|
|
|
2020-01-05 20:41:24 +03:00
|
|
|
class IppDiscovery : public QStringListModel, public QQuickImageProvider
|
2019-12-01 22:27:00 +03:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2020-01-05 20:41:24 +03:00
|
|
|
static IppDiscovery* instance();
|
|
|
|
|
2019-12-01 22:27:00 +03:00
|
|
|
Q_PROPERTY(QStringList favourites MEMBER _favourites NOTIFY favouritesChanged)
|
|
|
|
Q_INVOKABLE void discover();
|
2020-01-02 23:28:35 +03:00
|
|
|
Q_INVOKABLE void reset();
|
2019-12-01 22:27:00 +03:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void favouritesChanged();
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void readPendingDatagrams();
|
2020-01-02 23:58:50 +03:00
|
|
|
void update();
|
2020-01-05 20:41:24 +03:00
|
|
|
void ignoreKnownSslErrors(QNetworkReply *reply, const QList<QSslError> &errors);
|
2020-01-02 23:58:50 +03:00
|
|
|
|
2019-12-01 22:27:00 +03:00
|
|
|
protected:
|
|
|
|
private:
|
2020-01-05 20:41:24 +03:00
|
|
|
static IppDiscovery* m_Instance;
|
|
|
|
|
|
|
|
IppDiscovery();
|
|
|
|
~IppDiscovery();
|
|
|
|
IppDiscovery(const IppDiscovery &);
|
|
|
|
IppDiscovery& operator=(const IppDiscovery &);
|
|
|
|
|
2020-01-02 23:05:04 +03:00
|
|
|
void sendQuery(quint16 qtype, QStringList addr);
|
|
|
|
|
2020-01-05 20:41:24 +03:00
|
|
|
QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) override;
|
|
|
|
|
2020-01-02 23:05:04 +03:00
|
|
|
QStringList _ipp;
|
|
|
|
QMap<QString,QString> _rps;
|
|
|
|
QMap<QString,quint16> _ports;
|
|
|
|
QMap<QString,QString> _targets;
|
|
|
|
|
|
|
|
QMultiMap<QString,QString> _AAs;
|
|
|
|
QMultiMap<QString,QString> _AAAAs;
|
|
|
|
|
2019-12-01 22:27:00 +03:00
|
|
|
QStringList _favourites;
|
|
|
|
QUdpSocket* socket;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // IPPDISCOVERY_H
|