|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: implements a session towards a media server |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 #ifndef C_UPNPAVBROWSINGSESSIONIMPL_H |
|
24 #define C_UPNPAVBROWSINGSESSIONIMPL_H |
|
25 |
|
26 // INCLUDE FILES |
|
27 #include <e32std.h> |
|
28 #include <e32base.h> |
|
29 |
|
30 #include "upnpavbrowsingsession.h" |
|
31 #include "upnpavdeviceobserver.h" |
|
32 #include "upnpavbrowserespparams.h" |
|
33 |
|
34 // FORWARD DECLARATIONS |
|
35 class CUpnpAVDevice; |
|
36 class MUPnPAVBrowsingSessionObserver; |
|
37 class RUPnPAVControllerClient; |
|
38 //class CUPnPXMLParser; |
|
39 class CUPnPAVDeviceActive; |
|
40 |
|
41 /** |
|
42 * AV Controller browsing session implementation. |
|
43 * |
|
44 * This class implements the browsing interface of AV Controller. Includes |
|
45 * operations to search, browse, copy, create container, delete object and |
|
46 * to get search capabilities. |
|
47 * |
|
48 * @lib upnpavcontrollerclient.lib |
|
49 * @since S60 v3.1 |
|
50 */ |
|
51 class CUPnPAVBrowsingSessionImpl : public CActive, |
|
52 public MUPnPAVBrowsingSession, |
|
53 public MUPnPAVDeviceObserver |
|
54 { |
|
55 |
|
56 private: |
|
57 |
|
58 /** |
|
59 * Defines internal state of operation |
|
60 */ |
|
61 enum TPendingOperation |
|
62 { |
|
63 ENone = 0, |
|
64 EBrowseSize, |
|
65 ESearchSize, |
|
66 EGetSearchCapabilities, |
|
67 ECreateContainer, |
|
68 EDeleteObject, |
|
69 EStartMediaServer |
|
70 }; |
|
71 |
|
72 public: |
|
73 |
|
74 /** |
|
75 * Static constructor |
|
76 * |
|
77 * @param aServer handle to AV Controller server |
|
78 * @param aDevice target device |
|
79 * @return a new browsing session implementation instance |
|
80 */ |
|
81 static CUPnPAVBrowsingSessionImpl* NewL( RUPnPAVControllerClient& |
|
82 aServer, const CUpnpAVDevice& aDevice ); |
|
83 |
|
84 /** |
|
85 * Destructor |
|
86 */ |
|
87 virtual ~CUPnPAVBrowsingSessionImpl(); |
|
88 |
|
89 private: |
|
90 |
|
91 /** |
|
92 * 2nd phase construct |
|
93 */ |
|
94 CUPnPAVBrowsingSessionImpl( RUPnPAVControllerClient& aServer ); |
|
95 |
|
96 /** |
|
97 * 2nd phase construct |
|
98 */ |
|
99 void ConstructL(); |
|
100 |
|
101 protected: // From CActive |
|
102 |
|
103 void RunL(); |
|
104 |
|
105 void DoCancel(); |
|
106 |
|
107 TInt RunError( TInt aError ); |
|
108 |
|
109 protected: // From MUPnPAVBrowser |
|
110 |
|
111 /** |
|
112 * See upnpavbrowsingsession.h |
|
113 */ |
|
114 void SetObserver( MUPnPAVBrowsingSessionObserver& aObserver); |
|
115 |
|
116 /** |
|
117 * See upnpavbrowsingsession.h |
|
118 */ |
|
119 void RemoveObserver(); |
|
120 |
|
121 /** |
|
122 * See upnpavbrowsingsession.h |
|
123 */ |
|
124 MUPnPAVBrowsingSessionObserver* Observer() const; |
|
125 |
|
126 |
|
127 /** |
|
128 * See upnpavbrowsingsession.h |
|
129 */ |
|
130 const CUpnpAVDevice& Device() const; |
|
131 |
|
132 /** |
|
133 * See upnpavbrowsingsession.h |
|
134 */ |
|
135 void ReserveLocalMSServicesL(); |
|
136 |
|
137 /** |
|
138 * See upnpavbrowsingsession.h |
|
139 */ |
|
140 void CancelReserveLocalMSServicesL(); |
|
141 |
|
142 /** |
|
143 * See upnpavbrowsingsession.h |
|
144 */ |
|
145 void ReleaseLocalMSServicesL(); |
|
146 |
|
147 /** |
|
148 * See upnpavbrowsingsession.h |
|
149 */ |
|
150 void BrowseL( const TDesC8& aId, |
|
151 const TDesC8& aFilter, |
|
152 TBrowseFlag aBrowseFlag, |
|
153 TInt aStartIndex, |
|
154 TInt aRequestedCount, |
|
155 const TDesC8& aSortCriteria ); |
|
156 |
|
157 /** |
|
158 * See upnpavbrowsingsession.h |
|
159 */ |
|
160 void CancelBrowse(); |
|
161 |
|
162 /** |
|
163 * See upnpavbrowsingsession.h |
|
164 */ |
|
165 void SearchL( const TDesC8& aId, |
|
166 const TDesC8& aSearchCriteria, |
|
167 const TDesC8& aFilter, |
|
168 TInt aStartIndex, |
|
169 TInt aRequestedCount, |
|
170 const TDesC8& aSortCriteria ); |
|
171 |
|
172 /** |
|
173 * See upnpavbrowsingsession.h |
|
174 */ |
|
175 void CancelSearch(); |
|
176 |
|
177 /** |
|
178 * See upnpavbrowsingsession.h |
|
179 */ |
|
180 void GetSearchCapabilitiesL(); |
|
181 |
|
182 /** |
|
183 * See upnpavbrowsingsession.h |
|
184 */ |
|
185 void CreateContainerL( const TDesC8& aTitle, const TDesC8& aParentId, |
|
186 TContainerType aContainerType ); |
|
187 |
|
188 /** |
|
189 * See upnpavbrowsingsession.h |
|
190 */ |
|
191 void DeleteObjectL( const TDesC8& aId ); |
|
192 |
|
193 public: // From MUPnPAVDeviceObserver |
|
194 |
|
195 /** |
|
196 * See upnpavdeviceobserver.h |
|
197 */ |
|
198 void UPnPDeviceDiscovered( const CUpnpAVDevice& aDevice ); |
|
199 |
|
200 /** |
|
201 * See upnpavdeviceobserver.h |
|
202 */ |
|
203 void UPnPDeviceDisappeared( const CUpnpAVDevice& aDevice ); |
|
204 |
|
205 /** |
|
206 * See upnpavdeviceobserver.h |
|
207 */ |
|
208 void WLANConnectionLost(); |
|
209 |
|
210 private: // Internal methods |
|
211 |
|
212 /** |
|
213 * Handles browse |
|
214 */ |
|
215 void BrowseSizeCompletedL(); |
|
216 |
|
217 /** |
|
218 * Handles browse |
|
219 */ |
|
220 void BrowseResultCompletedL(); |
|
221 |
|
222 /** |
|
223 * Handles search |
|
224 */ |
|
225 void SearchSizeCompletedL(); |
|
226 |
|
227 /** |
|
228 * Handles search |
|
229 */ |
|
230 void SearchResultCompletedL(); |
|
231 |
|
232 /** |
|
233 * Handles search capabilities |
|
234 */ |
|
235 void SearchCapabilitiesCompletedL(); |
|
236 |
|
237 /** |
|
238 * Handles create container |
|
239 */ |
|
240 void CreateContainerCompletedL(); |
|
241 |
|
242 /** |
|
243 * Handles delete object |
|
244 */ |
|
245 void DeleteObjectCompletedL(); |
|
246 |
|
247 /** |
|
248 * Handles media server start |
|
249 */ |
|
250 void StartMediaServerCompleteL(); |
|
251 |
|
252 /** |
|
253 * Reset |
|
254 */ |
|
255 void ResetL(); |
|
256 |
|
257 private: |
|
258 |
|
259 MUPnPAVBrowsingSessionObserver* iObserver; // not owned |
|
260 |
|
261 RUPnPAVControllerClient& iServer; // not owned |
|
262 |
|
263 CUpnpAVDevice* iDevice; // owned |
|
264 |
|
265 // Buffer to pass data to server |
|
266 HBufC8* iBuffer; // owned |
|
267 TPtr8 iBufferPtr; |
|
268 |
|
269 // Buffer to pass data to server |
|
270 HBufC8* iBuffer2; // owned |
|
271 TPtr8 iBufferPtr2; |
|
272 |
|
273 // Buffer to pass data to server |
|
274 HBufC8* iBuffer3; // owned |
|
275 TPtr8 iBufferPtr3; |
|
276 |
|
277 //CUPnPXMLParser* iParser; // owned |
|
278 |
|
279 CUPnPAVDeviceActive* iDeviceActive; // owned |
|
280 |
|
281 TInt iRespBufSize; |
|
282 TPckg<TInt> iRespBufSizePkg; |
|
283 |
|
284 // TInt iRespBufSize; |
|
285 // TPckg<TInt> iRespBufSizePkg; |
|
286 |
|
287 TUpnpAVBrowseRespParams iRespParams; |
|
288 TPckg<TUpnpAVBrowseRespParams> iRespParamsPkg; |
|
289 |
|
290 TPendingOperation iPendingOperation; |
|
291 |
|
292 TBool iAlive; |
|
293 |
|
294 TBool iMediaServerResourceReserved; |
|
295 |
|
296 }; |
|
297 |
|
298 |
|
299 #endif // C_UPNPAVBROWSERIMPL_H |