File indexing completed on 2024-05-12 12:45:29
0001 /* 0002 SPDX-FileCopyrightText: 2015 (c) Matthieu Gallien <matthieu_gallien@yahoo.fr> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #ifndef UPNPEVENTSUBSCRIBER_H 0008 #define UPNPEVENTSUBSCRIBER_H 0009 0010 #include "upnplibqt_export.h" 0011 0012 #include <QNetworkReply> 0013 0014 #include <QObject> 0015 #include <QString> 0016 #include <QUrl> 0017 0018 #include <memory> 0019 0020 class UpnpEventSubscriberPrivate; 0021 class UpnpAbstractService; 0022 0023 /** 0024 * @brief The UpnpEventSubscriber class is used to implement event notifications for services 0025 * 0026 * A service provides a notification facility for subscribers to know when variable changes. The \class UpnpEventSubscriber provides the mechanism to implement that notification facility. 0027 */ 0028 class UpnpEventSubscriber : public QObject 0029 { 0030 Q_OBJECT 0031 0032 public: 0033 explicit UpnpEventSubscriber(QObject *parent = nullptr); 0034 0035 ~UpnpEventSubscriber() override; 0036 0037 void setSecondTimeout(int newValue); 0038 0039 [[nodiscard]] int secondTimeout() const; 0040 0041 void setCallback(const QUrl &callbackAddress); 0042 0043 [[nodiscard]] const QUrl &callback() const; 0044 0045 [[nodiscard]] const QString &uuid() const; 0046 0047 void setUpnpService(UpnpAbstractService *service); 0048 0049 public Q_SLOTS: 0050 0051 void sendEventNotification(); 0052 0053 void notifyPropertyChange(const QString &serviceId, const QByteArray &propertyName); 0054 0055 private Q_SLOTS: 0056 0057 void eventingFinished(); 0058 0059 void eventingInErrorFinished(QNetworkReply::NetworkError code); 0060 0061 private: 0062 std::unique_ptr<UpnpEventSubscriberPrivate> d; 0063 }; 0064 0065 #endif // UPNPEVENTSUBSCRIBER_H