File indexing completed on 2024-05-12 12:45:28
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 UPNPDEVICEDESCRIPTION_H 0008 #define UPNPDEVICEDESCRIPTION_H 0009 0010 #include "upnplibqt_export.h" 0011 0012 #include <QPointer> 0013 #include <QVector> 0014 0015 #include <memory> 0016 0017 class UpnpServiceDescription; 0018 class UpnpDeviceDescriptionPrivate; 0019 0020 /** 0021 * @brief The UpnpDeviceDescription class includes the full description of an UPnP device 0022 * 0023 * It provides a way to store all data about a device and to query them. 0024 */ 0025 class UPNPLIBQT_EXPORT UpnpDeviceDescription 0026 { 0027 0028 public: 0029 UpnpDeviceDescription(); 0030 0031 UpnpDeviceDescription(const UpnpDeviceDescription &other); 0032 0033 UpnpDeviceDescription(UpnpDeviceDescription &&other) noexcept; 0034 0035 ~UpnpDeviceDescription(); 0036 0037 UpnpDeviceDescription &operator=(const UpnpDeviceDescription &other); 0038 0039 UpnpDeviceDescription &operator=(UpnpDeviceDescription &&other) noexcept; 0040 0041 [[nodiscard]] UpnpServiceDescription serviceById(const QString &serviceId) const; 0042 0043 [[nodiscard]] const UpnpServiceDescription &serviceByIndex(int serviceIndex) const; 0044 0045 [[nodiscard]] UpnpServiceDescription &serviceByIndex(int serviceIndex); 0046 0047 [[nodiscard]] const QList<UpnpServiceDescription> &services() const; 0048 0049 [[nodiscard]] QList<UpnpServiceDescription> &services(); 0050 0051 [[nodiscard]] QList<QString> servicesName() const; 0052 0053 /** 0054 * @brief setUDN will set the UDN (i.e. Unique Device Name) of this device 0055 * 0056 * setUDN will set the UDN (i.e. Unique Device Name) of this device. It is required. 0057 * Universally-unique identifier for the device, whether 0058 * root or embedded. Must be the same over time for a specific device instance (i.e., 0059 * must survive reboots). Must match the value of the NT header in device discovery 0060 * messages. Must match the prefix of the USN header in all discovery messages. Must 0061 * begin with uuid: followed by a UUID suffix specified by a UPnP vendor. Single URI. 0062 * 0063 * @param value will be the new UDN of this device 0064 */ 0065 void setUDN(const QString &value); 0066 0067 /** 0068 * @brief UDN will return the UDN (i.e. Unique Device Name) of this device 0069 * 0070 * UDN will return the UDN (i.e. Unique Device Name) of this device It is required. 0071 * Universally-unique identifier for the device, whether 0072 * root or embedded. Must be the same over time for a specific device instance (i.e., 0073 * must survive reboots). Must match the value of the NT header in device discovery 0074 * messages. Must match the prefix of the USN header in all discovery messages. Must 0075 * begin with uuid: followed by a UUID suffix specified by a UPnP vendor. Single URI. 0076 */ 0077 [[nodiscard]] const QString &UDN() const; 0078 0079 /** 0080 * @brief setUPC: Set Universal Product Code 0081 * Setting UPC is optional. 12-digit, all-numeric code that identifies the consumer package. 0082 * Managed by the Uniform Code Council. Specified by UPnP vendor. Single UPC. 0083 * 0084 * @param value will be the new UPC of this device 0085 */ 0086 void setUPC(const QString &value); 0087 0088 /** 0089 * @brief UPC: Get Universal Product Code 0090 * UPC is optional. 12-digit, all-numeric code that identifies the consumer package. 0091 * Managed by the Uniform Code Council. Specified by UPnP vendor. Single UPC. 0092 */ 0093 [[nodiscard]] const QString &UPC() const; 0094 0095 void setDeviceType(const QString &value); 0096 0097 [[nodiscard]] const QString &deviceType() const; 0098 0099 void setFriendlyName(const QString &value); 0100 0101 [[nodiscard]] const QString &friendlyName() const; 0102 0103 void setManufacturer(const QString &value); 0104 0105 [[nodiscard]] const QString &manufacturer() const; 0106 0107 void setManufacturerURL(const QUrl &value); 0108 0109 [[nodiscard]] const QUrl &manufacturerURL() const; 0110 0111 void setModelDescription(const QString &value); 0112 0113 [[nodiscard]] const QString &modelDescription() const; 0114 0115 void setModelName(const QString &value); 0116 0117 [[nodiscard]] const QString &modelName() const; 0118 0119 void setModelNumber(const QString &value); 0120 0121 [[nodiscard]] const QString &modelNumber() const; 0122 0123 void setModelURL(const QUrl &value); 0124 0125 [[nodiscard]] const QUrl &modelURL() const; 0126 0127 void setSerialNumber(const QString &value); 0128 0129 [[nodiscard]] const QString &serialNumber() const; 0130 0131 void setURLBase(const QString &value); 0132 0133 [[nodiscard]] const QString &URLBase() const; 0134 0135 void setCacheControl(int value); 0136 0137 [[nodiscard]] int cacheControl() const; 0138 0139 void setLocationUrl(const QUrl &value); 0140 0141 [[nodiscard]] const QUrl &locationUrl() const; 0142 0143 int addService(UpnpServiceDescription newService); 0144 0145 private: 0146 std::unique_ptr<UpnpDeviceDescriptionPrivate> d; 0147 }; 0148 0149 Q_DECLARE_METATYPE(UpnpDeviceDescription) 0150 0151 #endif