harbour-seaprint/src/ippdiscovery.h

57 lines
1.3 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)
Q_INVOKABLE void discover();
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();
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:
static IppDiscovery* m_Instance;
IppDiscovery();
~IppDiscovery();
IppDiscovery(const IppDiscovery &);
IppDiscovery& operator=(const IppDiscovery &);
void sendQuery(quint16 qtype, QStringList addr);
QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) override;
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