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 HCONNECTIONMANAGER_H_
23
#define HCONNECTIONMANAGER_H_
25
#include <HUpnpAv/HConnectionManagerInfo>
27
#include <HUpnpCore/HClientServiceAdapter>
38
class HConnectionManagerAdapterPrivate;
41
* \brief This is a convenience class for using a ConnectionManager service.
43
* This class that provides a simple asynchronous API for
44
* accessing server-side ConnectionManager service from the client-side.
45
* The class can be instantiated with a HClientService that
46
* provides the mandatory functionality of a ConnectionManager.
48
* For more information,
49
* see <a href=http://upnp.org/specs/av/UPnP-av-ConnectionManager-v2-Service.pdf>
50
* UPnP ConnectionManager:2 specification</a>.
52
* \headerfile hconnectionmanager.h HConnectionManagerAdapter
54
* \ingroup hupnp_av_cm
56
* \remarks This class is not thread-safe.
58
class H_UPNP_AV_EXPORT HConnectionManagerAdapter :
59
public HClientServiceAdapter
62
H_DISABLE_COPY(HConnectionManagerAdapter)
63
H_DECLARE_PRIVATE(HConnectionManagerAdapter)
67
void sourceProtocolInfoChanged_(
68
const Herqq::Upnp::HClientStateVariable* source,
69
const Herqq::Upnp::HStateVariableEvent& event);
71
void sinkProtocolInfoChanged_(
72
const Herqq::Upnp::HClientStateVariable* source,
73
const Herqq::Upnp::HStateVariableEvent& event);
75
void currentConnectionIDsChanged_(
76
const Herqq::Upnp::HClientStateVariable* source,
77
const Herqq::Upnp::HStateVariableEvent& event);
81
virtual bool prepareService(HClientService* service);
86
* \brief Creates a new instance.
88
* \param parent specifies the \c QObject parent.
90
HConnectionManagerAdapter(QObject* parent = 0);
93
* \brief Destroys the instance.
95
virtual ~HConnectionManagerAdapter();
98
* \brief Retrieves the protocol related information this instance supports in its
101
* \return The ID used to identify the asynchronous operation. The returned
102
* object is null, i.e. HClientAdapterOp<HProtocolInfoResult>::isNull() returns
103
* \e true in case the object is not ready for use.
105
* \remarks This is an asynchronous method.
107
* \sa isReady(), getProtocolInfoCompleted()
109
HClientAdapterOp<HProtocolInfoResult> getProtocolInfo();
112
* \brief Prepares the device for the purpose of sending or receiving data.
114
* \param remoteProtocolInfo specifies the protocol-related information
115
* that \b must be used to transfer the content.
117
* \param peerConnectionManager specifies the ConnectionManager service on
118
* the other side of the connection.
120
* \param peerConnectionId specifies the ID of the connection the peer
121
* ConnectionManager has allocated for this connection. This can be set to
122
* \c -1 if the ID is not known. This is the case if the peer does not
123
* implement this action or prepareForConnection() has not been invoked on
124
* that ConnectionManager yet.
126
* \param direction specifies the direction to which data will be sent
127
* using the new connection.
129
* \return The ID used to identify the asynchronous operation. The returned
130
* object is invalid in case the object is not ready for use or the target
131
* UPnP device does not support this optional action.
133
* \remarks This is an asynchronous method.
135
* \sa isReady(), prepareForConnectionCompleted()
137
HClientAdapterOp<HPrepareForConnectionResult> prepareForConnection(
138
const HProtocolInfo& remoteProtocolInfo,
139
const HConnectionManagerId& peerConnectionManager,
140
qint32 peerConnectionId,
141
HConnectionManagerInfo::Direction direction);
144
* \brief Informs the device that a previously \e prepared connection is no longer
147
* \param connectionId specifies the ID of the connection.
149
* \return The ID used to identify the asynchronous operation. The returned
150
* object is invalid in case the object is not ready for use or the target
151
* UPnP device does not support this optional action.
153
* \remarks This is an asynchronous method.
155
* \sa isReady(), connectionCompleteCompleted()
157
HClientAdapterOpNull connectionComplete(qint32 connectionId);
160
* \brief Returns the IDs of currently active connections.
162
* \return The ID used to identify the asynchronous operation. The returned
163
* object is invalid in case the object is not ready for use.
165
* \remarks This is an asynchronous method.
167
* \sa isReady(), getCurrentConnectionIDsCompleted()
169
HClientAdapterOp<QList<quint32> > getCurrentConnectionIDs();
172
* \brief Returns information of the specified connection.
174
* \param connectionId specifies the connection.
176
* \return The ID used to identify the asynchronous operation. The returned
177
* object is invalid in case the object is not ready for use.
179
* \remarks This is an asynchronous method.
181
* \sa isReady(), getCurrentConnectionInfoCompleted()
183
HClientAdapterOp<HConnectionInfo> getCurrentConnectionInfo(qint32 connectionId);
188
* \brief This signal is emitted when getProtocolInfo() has completed.
190
* \param source specifies the HConnectionManagerAdapter instance that
193
* \param op specifies the asynchronous operation previously started by
196
* \sa getProtocolInfo()
198
void getProtocolInfoCompleted(
199
Herqq::Upnp::Av::HConnectionManagerAdapter* source,
200
const Herqq::Upnp::HClientAdapterOp<Herqq::Upnp::Av::HProtocolInfoResult>& op);
203
* \brief This signal is emitted when prepareForConnection() has completed.
205
* \param source specifies the HConnectionManagerAdapter instance that
208
* \param op specifies the asynchronous operation previously started by
209
* prepareForConnection().
211
* \sa prepareForConnection()
213
void prepareForConnectionCompleted(
214
Herqq::Upnp::Av::HConnectionManagerAdapter* source,
215
const Herqq::Upnp::HClientAdapterOp<Herqq::Upnp::Av::HPrepareForConnectionResult>& op);
218
* \brief This signal is emitted when connectionComplete() has completed.
220
* \param source specifies the HConnectionManagerAdapter instance that
223
* \param op specifies the asynchronous operation previously started by
224
* connectionComplete().
226
* \sa connectionComplete()
228
void connectionCompleteCompleted(
229
Herqq::Upnp::Av::HConnectionManagerAdapter* source,
230
const Herqq::Upnp::HClientAdapterOpNull& op);
233
* \brief This signal is emitted when getCurrentConnectionIDs() has completed.
235
* \param source specifies the HConnectionManagerAdapter instance that
238
* \param op specifies the asynchronous operation previously started by
239
* getCurrentConnectionIDs().
241
* \sa getCurrentConnectionIDs()
243
void getCurrentConnectionIDsCompleted(
244
Herqq::Upnp::Av::HConnectionManagerAdapter* source,
245
const Herqq::Upnp::HClientAdapterOp<QList<quint32> >& op);
248
* \brief This signal is emitted when getCurrentConnectionInfo() has completed.
250
* \param source specifies the HConnectionManagerAdapter instance that
253
* \param op specifies the asynchronous operation previously started by
254
* getCurrentConnectionInfo().
256
* \sa getCurrentConnectionInfo()
258
void getCurrentConnectionInfoCompleted(
259
Herqq::Upnp::Av::HConnectionManagerAdapter* source,
260
const Herqq::Upnp::HClientAdapterOp<Herqq::Upnp::Av::HConnectionInfo>& op);
263
* \brief This signal is emitted when the SourceProtocolInfo state variable
264
* changes at the server side.
266
* \param source specifies the HConnectionManagerAdapter instance that
269
* \param newValue specifies the new value of the SourceProtocolInfo state
272
* \sa sinkProtocolInfoChanged()
274
void sourceProtocolInfoChanged(
275
Herqq::Upnp::Av::HConnectionManagerAdapter* source,
276
const Herqq::Upnp::Av::HProtocolInfos& newValue);
279
* \brief This signal is emitted when the SinkProtocolInfo state variable
280
* changes at the server side.
282
* \param source specifies the HConnectionManagerAdapter instance that
285
* \param newValue specifies the new value of the SinkProtocolInfo state
288
* \sa sourceProtocolInfoChanged()
290
void sinkProtocolInfoChanged(
291
Herqq::Upnp::Av::HConnectionManagerAdapter* source,
292
const Herqq::Upnp::Av::HProtocolInfos& newValue);
295
* \brief This signal is emitted when the CurrentConnectionIDs state variable
296
* changes at the server-side.
298
* \param source specifies the HConnectionManagerAdapter instance that
301
* \param currentIds specifies the currently active connection ID values.
303
void currentConnectionIdsChanged(
304
Herqq::Upnp::Av::HConnectionManagerAdapter* source,
305
const QList<quint32>& currentIds);
312
#endif /* HCONNECTIONMANAGER_H_ */