harbour-seaprint/src/ippdiscovery.h

71 lines
1.6 KiB
C
Raw Normal View History

2019-12-01 22:27:00 +03:00
#ifndef IPPDISCOVERY_H
#define IPPDISCOVERY_H
#include <QStringListModel>
#include <QQuickImageProvider>
2019-12-01 22:27:00 +03:00
#include <QUdpSocket>
#include <QMutex>
#include <QImageReader>
#include <QtNetwork>
#include <QNetworkAccessManager>
#include <QEventLoop>
2019-12-01 22:27:00 +03:00
#include "bytestream.h"
class IppDiscovery : public QStringListModel, public QQuickImageProvider
2019-12-01 22:27:00 +03:00
{
Q_OBJECT
public:
static IppDiscovery* instance();
2019-12-01 22:27:00 +03:00
Q_PROPERTY(QStringList favourites MEMBER _favourites NOTIFY favouritesChanged)
2021-06-19 19:16:42 +03:00
2019-12-01 22:27:00 +03:00
Q_INVOKABLE void discover();
Q_INVOKABLE void reset();
2019-12-01 22:27:00 +03:00
2022-01-15 00:44:55 +03:00
void resolve(QUrl& url);
2019-12-01 22:27:00 +03:00
signals:
void favouritesChanged();
2021-06-19 19:16:42 +03:00
void ignoreSslErrorsChanged();
2019-12-01 22:27:00 +03:00
public slots:
void readPendingDatagrams();
2021-06-19 19:16:42 +03:00
void cleanUpdate();
2020-01-02 23:58:50 +03:00
void update();
2019-12-01 22:27:00 +03:00
protected:
private:
static IppDiscovery* m_Instance;
2021-06-19 19:16:42 +03:00
quint16 _transactionid;
IppDiscovery();
~IppDiscovery();
IppDiscovery(const IppDiscovery &);
IppDiscovery& operator=(const IppDiscovery &);
void sendQuery(quint16 qtype, QStringList addr);
2021-06-19 19:16:42 +03:00
void sendQuery(quint16 qtype, QStringList prefixes, QStringList suffixes);
void updateAndQueryPtrs(QStringList& ptrs, QStringList new_ptrs);
QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) override;
QStringList _ipp;
2021-06-19 19:16:42 +03:00
QStringList _ipps;
QMap<QString,QString> _rps;
QMap<QString,quint16> _ports;
QMap<QString,QString> _targets;
QMultiMap<QString,QString> _AAs;
QMultiMap<QString,QString> _AAAAs;
2021-06-19 19:16:42 +03:00
QMap<QString, QTime> _outstandingQueries;
2019-12-01 22:27:00 +03:00
QStringList _favourites;
QUdpSocket* socket;
};
#endif // IPPDISCOVERY_H