File indexing completed on 2024-04-28 04:44:20
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 UPNPABSTRACTDEVICE_H 0008 #define UPNPABSTRACTDEVICE_H 0009 0010 #include "upnplibqt_export.h" 0011 0012 #include <QList> 0013 #include <QObject> 0014 #include <QPointer> 0015 0016 #include <memory> 0017 0018 class UpnpAbstractService; 0019 class UpnpAbstractDevicePrivate; 0020 class QIODevice; 0021 struct UpnpSearchQuery; 0022 class UpnpSsdpEngine; 0023 class UpnpDeviceDescription; 0024 class UpnpServiceDescription; 0025 0026 /** 0027 * @brief The UpnpAbstractDevice is the base class to implement a wrapper around an UPnP device 0028 * 0029 * It can be derived into a subclass to implement support for a specific device type or can be used directly to interact with a device. 0030 */ 0031 class UPNPLIBQT_EXPORT UpnpAbstractDevice : public QObject 0032 { 0033 Q_OBJECT 0034 0035 Q_PROPERTY(UpnpDeviceDescription description 0036 READ description 0037 WRITE setDescription 0038 NOTIFY descriptionChanged) 0039 0040 public: 0041 explicit UpnpAbstractDevice(QObject *parent = nullptr); 0042 0043 ~UpnpAbstractDevice() override; 0044 0045 [[nodiscard]] UpnpServiceDescription serviceDescriptionById(const QString &serviceId) const; 0046 0047 [[nodiscard]] UpnpServiceDescription serviceDescriptionByIndex(int serviceIndex) const; 0048 0049 [[nodiscard]] const QList<UpnpServiceDescription> &services() const; 0050 0051 [[nodiscard]] QVector<QString> servicesName() const; 0052 0053 void setDescription(UpnpDeviceDescription value); 0054 0055 [[nodiscard]] UpnpDeviceDescription& description(); 0056 0057 [[nodiscard]] const UpnpDeviceDescription &description() const; 0058 0059 [[nodiscard]] int cacheControl() const; 0060 0061 [[nodiscard]] std::unique_ptr<QIODevice> buildAndGetXmlDescription(); 0062 0063 Q_SIGNALS: 0064 0065 void descriptionChanged(); 0066 0067 public Q_SLOTS: 0068 0069 void newSearchQuery(UpnpSsdpEngine *engine, const UpnpSearchQuery &searchQuery); 0070 0071 protected: 0072 int addService(const UpnpServiceDescription &newService); 0073 0074 private: 0075 std::unique_ptr<UpnpAbstractDevicePrivate> d; 0076 }; 0077 0078 #endif // UPNPABSTRACTDEVICE_H