2
* Copyright (C) 2011 Tuomo Penttinen, all rights reserved.
4
* Author: Tuomo Penttinen <tp@herqq.org>
6
* This file is part of Herqq UPnP Av (HUPnPAv) library.
8
* Herqq UPnP Av is free software: you can redistribute it and/or modify
9
* it under the terms of the GNU 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 Av 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 General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with Herqq UPnP Av. If not, see <http://www.gnu.org/licenses/>.
22
#ifndef HAV_CONTROLPOINT_CONFIGURATION_H_
23
#define HAV_CONTROLPOINT_CONFIGURATION_H_
25
#include <HUpnpAv/HUpnpAv>
26
#include <HUpnpCore/HClonable>
39
class HAvControlPointConfigurationPrivate;
42
* Class for specifying initialization information to HAvControlPoint instances.
44
* \brief This class is used to pass initialization information for HAvControlPoint
45
* instances. The use of this is optional and an HAvControlPoint instance is
46
* perfectly functional with the default configuration.
48
* However, you can configure an HAvControlPoint in following ways:
49
* - Define what UPnP A/V device types the control point should look for.
50
* - Define whether an HAvControlPoint should subscribe to events when a
51
* device has been discovered by using setSubscribeToEvents().
52
* By default an HAvControlPoint instances subscribes to all events.
53
* - Set the timeout request for event subscriptions with setDesiredSubscriptionTimeout().
54
* The default is 30 minutes.
55
* - Specify whether an HAvControlPoint should perform initial discovery upon
56
* startup using setAutoDiscovery(). The default is yes.
57
* - Specify the network addresses an HAvControlPoint should use in its operations
58
* with setNetworkAddressesToUse().
59
* The default is the first found interface that is up. Non-loopback interfaces
60
* have preference, but if none are found the loopback is used. However, in this
61
* case UDP multicast is not available.
63
* \headerfile hav_controlpoint_configuration.h HAvControlPointConfiguration
65
* \ingroup hupnp_av_cp
69
* \remarks This class is not thread-safe.
71
class H_UPNP_AV_EXPORT HAvControlPointConfiguration :
74
H_DISABLE_COPY(HAvControlPointConfiguration)
75
H_DECLARE_PRIVATE(HAvControlPointConfiguration)
79
// Documented in HClonable
80
virtual void doClone(HClonable*) const;
82
// Documented in HClonable
83
virtual HAvControlPointConfiguration* newInstance() const;
85
HAvControlPointConfigurationPrivate* h_ptr;
90
* \brief This enumeration is used to specify the device types the HAvControlPoint
91
* should search and use.
93
enum InterestingDeviceType
96
* No device types should be accepted.
101
* Media Renderers should be accepted.
103
MediaRenderer = 0x01,
106
* Media Servers should be accepted.
111
* All device types should be accepted.
113
* \remarks This is the default value.
118
Q_DECLARE_FLAGS(InterestingDeviceTypes, InterestingDeviceType)
121
* \brief Creates a new instance.
123
* Creates a new instance with default values.
125
HAvControlPointConfiguration();
128
* \brief Destroys the instance.
130
virtual ~HAvControlPointConfiguration();
133
* \brief Returns a deep copy of the instance.
135
* \return a deep copy of the instance.
138
* \li The ownership of the returned object is transferred to the caller.
140
virtual HAvControlPointConfiguration* clone() const;
143
* \brief Returns the device types the HAvControlPoint should search, accept and
146
* \return The device types the HAvControlPoint should search, accept and
149
* \sa setInterestingDeviceTypes()
151
InterestingDeviceTypes interestingDeviceTypes() const;
154
* \brief Indicates whether the control point should run discovery upon
157
* \return \e true in case the the control point should run discovery upon
158
* initialization. This is the default value.
160
* \remarks if the discovery is not performed the control point will be
161
* unaware of UPnP devices that are already active in the network until they
162
* re-advertise themselves.
164
* \sa setAutoDiscovery()
166
bool autoDiscovery() const;
169
* \brief Returns the network addresses a control point should use in its
172
* \return The network addresses a control point should use in its
175
* \sa setNetworkAddressesToUse()
177
QList<QHostAddress> networkAddressesToUse() const;
180
* \brief Indicates whether to automatically subscribe to all events on all services
181
* of a device when a new device is added into the control of an HAvControlPoint.
183
* \return \e true in case the HAvControlPoint instance should subscribe to all
184
* events of all services of a newly added device.
186
* \sa setSubscribeToEvents()
188
bool subscribeToEvents() const;
191
* \brief Returns the subscription timeout a control point requests when it subscribes
192
* to an evented service.
194
* The default value is 30 minutes.
196
* \return The subscription timeout in seconds a control point requests
197
* when it subscribes to an evented service.
199
* \sa setDesiredSubscriptionTimeout()
201
qint32 desiredSubscriptionTimeout() const;
204
* \brief Sets the device types the HAvControlPoint should search, accept and
207
* \param types specifies the device types the HAvControlPoint should
208
* search, accept and use.
210
* \sa interestingDeviceTypes()
212
void setInterestingDeviceTypes(InterestingDeviceTypes types) const;
215
* Defines whether a control point should automatically subscribe to all
216
* events on all services of a device when a new device is added
217
* into the control of an HAvControlPoint.
219
* \param subscribeAutomatically when \e true an HAvControlPoint instance
220
* should by default subscribe to all events of all services of a newly added
223
* \sa subscribeToEvents()
225
void setSubscribeToEvents(bool subscribeAutomatically);
228
* \brief Sets the subscription timeout a control point requests when it subscribes
229
* to an evented service.
231
* Values less than or equal to zero are rejected and instead the default value
232
* is used. The default value is 30 minutes.
234
* \param timeout specifies the requested timeout in seconds.
236
* \sa desiredSubscriptionTimeout()
238
void setDesiredSubscriptionTimeout(qint32 timeout);
241
* Defines whether the control point should perform discovery upon
244
* \param arg when \e true an HAvControlPoint instance will perform discovery
245
* when it is initialized. This is the default.
247
* \remarks if the discovery is not performed the control point will be
248
* unaware of UPnP devices that are already active in the network until they
249
* re-advertise themselves.
251
* \sa autoDiscovery()
253
void setAutoDiscovery(bool arg);
256
* Defines the network addresses the control point should use in its
259
* \param addresses specifies the network addresses the control point
260
* should use in its operations.
262
* \return \e true in case the provided addresses are valid and can be
265
* \sa networkAddressesToUse()
267
bool setNetworkAddressesToUse(const QList<QHostAddress>& addresses);
270
Q_DECLARE_OPERATORS_FOR_FLAGS(HAvControlPointConfiguration::InterestingDeviceTypes)
276
#endif /* HAV_CONTROLPOINT_CONFIGURATION_H_ */