2
* Copyright (C) 2010, 2011 Tuomo Penttinen, all rights reserved.
4
* Author: Tuomo Penttinen <tp@herqq.org>
6
* This file is part of Herqq UPnP (HUPnP) library.
8
* Herqq UPnP is free software: you can redistribute it and/or modify
9
* it under the terms of the GNU Lesser General Public License as published by
10
* the Free Software Foundation, either version 3 of the License, or
11
* (at your option) any later version.
13
* Herqq UPnP is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU Lesser General Public License for more details.
18
* You should have received a copy of the GNU Lesser General Public License
19
* along with Herqq UPnP. If not, see <http://www.gnu.org/licenses/>.
22
#ifndef HCLIENTDEVICE_ADAPTER_H_
23
#define HCLIENTDEVICE_ADAPTER_H_
25
#include <HUpnpCore/HUpnp>
27
#include <QtCore/QObject>
35
class HClientDeviceAdapterPrivate;
38
* This is an abstract base class for classes that compose HClientDevice instances
39
* and provide alternate interfaces for interacting with HClientDevices.
41
* \headerfile hclientdevice_adapter.h HClientDeviceAdapter
43
* \ingroup hupnp_devicemodel
45
* \remarks This class is not thread-safe.
47
class H_UPNP_CORE_EXPORT HClientDeviceAdapter :
51
H_DISABLE_COPY(HClientDeviceAdapter)
55
HClientDeviceAdapterPrivate* h_ptr;
58
* \brief Creates a new instance.
60
* \param deviceType specifies the UPnP device type this adapter can handle.
61
* Note, every HClientDevice to be associated with this adapter has to be
62
* of the specified device type.
64
* \param parent specifies the parent \c QObject.
66
HClientDeviceAdapter(const HResourceType& deviceType, QObject* parent = 0);
72
HClientDeviceAdapterPrivate& dd, QObject* parent = 0);
75
* Prepares the instance to be associated with the specified HClientDevice.
77
* \param device specifies the device to be associated.
79
* \return \e true if the instance was successfully prepared to be used
80
* with the specified HClientDevice. If \e false is returned the specified
81
* HClientDevice was not associated with this instance and
82
* isReady() will return \e false.
84
virtual bool prepareDevice(HClientDevice* device);
87
* \brief Specifies the device model info provider the adapter should use to validate
88
* HClientDevice instances with which this instance is associated.
90
* \param infoProvider specifies the device model info provider to be used.
92
void setDeviceModelInfoProvider(const HDeviceModelInfoProvider&);
95
* \brief Returns the device model info provider the adapter uses to validate
96
* HClientDevice instances with which this instance is associated.
98
* \return The device model info provider the adapter uses to validate
99
* HClientDevice instances with which this instance is associated.
101
const HDeviceModelInfoProvider* deviceModelInfoProvider() const;
104
* Specifies a human readable error description.
106
* \param arg specifies a human readable error description.
108
* \sa lastErrorDescription()
110
void setLastErrorDescription(const QString& arg);
115
* \brief Destroys the instance.
117
virtual ~HClientDeviceAdapter() = 0;
120
* \brief This enumeration specifies the different methods of validating
121
* HClientDevice instances.
126
* Only the device type should be checked to be correct.
133
* The device type is checked and the device should be validated
134
* using the deviceModelInfoProvider().
140
* Associates the specified \c HClientDevice with this instance.
142
* \param device specifies the HClientDevice to be associated with this instance.
144
* \return \e true in case the \c device was successfully associated with
149
bool setDevice(HClientDevice* device, ValidationType vt = FullValidation);
152
* \brief Returns a human readable description of the last error occurred.
154
* \return a human readable description of the last error occurred.
156
QString lastErrorDescription() const;
159
* \brief Returns the \c HClientDevice associated with this instance.
161
* \return The \c HClientDevice associated with this instance, if any.
162
* A null pointer is returned in case setDevice() has not been called
167
HClientDevice* device() const;
170
* \brief Indicates if the object is ready to be used.
172
* \return \e true if the object is ready to be used.
174
bool isReady() const;
177
* \brief Returns the device type this adapter abstracts.
179
* \return The device type this adapter abstracts.
181
const HResourceType& deviceType() const;
187
#endif /* HCLIENTDEVICE_ADAPTER_H_ */