1 /* |
|
2 * Copyright (c) 2008 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: Definition for MediaServant Source devices setting item |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_MSSETTINGITEMSOURCEDEV_H |
|
20 #define C_MSSETTINGITEMSOURCEDEV_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <AknProgressDialog.h> |
|
24 #include "upnpavdeviceobserver.h" |
|
25 #include <AknWaitNoteWrapper.h> //MAknBackgroundProcess |
|
26 #include "mssettingitems.h" |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CMSMultiselectionPopup; |
|
30 class MUPnPAVController; |
|
31 class CMSEngine; |
|
32 |
|
33 /** |
|
34 * CMSSettingItemDevices class. |
|
35 * |
|
36 * Class searches devices and shows them to user |
|
37 * |
|
38 * @since S60 5.1 |
|
39 */ |
|
40 NONSHARABLE_CLASS( CMSSettingItemDevices ): public CMSTextSettingItem, |
|
41 public MAknBackgroundProcess, |
|
42 public MProgressDialogCallback, |
|
43 public MUPnPAVDeviceObserver |
|
44 { |
|
45 |
|
46 public: // Constructor and destructor |
|
47 |
|
48 /** |
|
49 * NewL |
|
50 * 2-phase constructor. |
|
51 * |
|
52 * @since S60 v5.1 |
|
53 * @param aIdentifier, setting item identifier |
|
54 * @param aText, setting item text |
|
55 * @param aMSEngine, application engine |
|
56 * @param aStoredServers, stored servers |
|
57 * @param aUploadCapabilitySupport, upload capability support |
|
58 * @return CMSSettingItemDevices*, the new CMSSettingItemDevices object |
|
59 */ |
|
60 static CMSSettingItemDevices* NewL( |
|
61 TInt aIdentifier, |
|
62 TDes& aText, |
|
63 CMSEngine& aMSEngine, |
|
64 RPointerArray<CCmMediaServerFull>& aStoredServers, |
|
65 TBool aUploadCapabilitySupport = EFalse ); |
|
66 |
|
67 /** |
|
68 * NewLC |
|
69 * 2-phase constructor. |
|
70 * |
|
71 * @since S60 v5.1 |
|
72 * @param aIdentifier, setting item identifier |
|
73 * @param aText, setting item text |
|
74 * @param aMSEngine, application engine |
|
75 * @param aStoredServers, stored servers |
|
76 * @param aUploadCapabilitySupport, upload capability support |
|
77 * @return CMSSettingItemDevices*, the new CMSSettingItemDevices object |
|
78 */ |
|
79 static CMSSettingItemDevices* NewLC( |
|
80 TInt aIdentifier, |
|
81 TDes& aText, |
|
82 CMSEngine& aMSEngine, |
|
83 RPointerArray<CCmMediaServerFull>& aStoredServers, |
|
84 TBool aUploadCapabilitySupport = EFalse ); |
|
85 |
|
86 /** |
|
87 * Destructor. |
|
88 */ |
|
89 virtual ~CMSSettingItemDevices(); |
|
90 |
|
91 |
|
92 public:// from MAknBackgroundProcess |
|
93 |
|
94 /** |
|
95 * Completes one cycle of the process. |
|
96 */ |
|
97 void StepL(); |
|
98 |
|
99 /** |
|
100 * Return true when the process is done. |
|
101 */ |
|
102 TBool IsProcessDone() const; |
|
103 |
|
104 /** |
|
105 * Handles error occurred in StepL. |
|
106 */ |
|
107 TInt CycleError( TInt aError ); |
|
108 |
|
109 protected: |
|
110 |
|
111 // From base class CAknTextSettingItem |
|
112 |
|
113 /** |
|
114 * From CAknTextSettingItem |
|
115 * See base class definition |
|
116 */ |
|
117 void EditItemL( TBool aCalledFromMenu ); |
|
118 |
|
119 // From base class MProgressDialogCallback |
|
120 |
|
121 /** |
|
122 * From MProgressDialogCallback |
|
123 * See base class definition |
|
124 */ |
|
125 void DialogDismissedL( TInt aButtonId ); |
|
126 |
|
127 // From base class MUPnPAVDeviceObserver |
|
128 |
|
129 /** |
|
130 * From MUPnPAVDeviceObserver |
|
131 * See base class definition |
|
132 */ |
|
133 void UPnPDeviceDiscovered( const CUpnpAVDevice& aDevice ); |
|
134 |
|
135 /** |
|
136 * From MUPnPAVDeviceObserver |
|
137 * See base class definition |
|
138 */ |
|
139 void UPnPDeviceDiscoveredL( const CUpnpAVDevice& aDevice ); |
|
140 |
|
141 /** |
|
142 * From MUPnPAVDeviceObserver |
|
143 * See base class definition |
|
144 */ |
|
145 void UPnPDeviceDisappeared( const CUpnpAVDevice& aDevice ); |
|
146 |
|
147 /** |
|
148 * From MUPnPAVDeviceObserver |
|
149 * See base class definition |
|
150 */ |
|
151 void WLANConnectionLost(); |
|
152 |
|
153 private: |
|
154 |
|
155 /** |
|
156 * Shows error note |
|
157 * @since S60 5.1 |
|
158 * @param aTextResource, error text resource |
|
159 */ |
|
160 void ShowErrorNoteL( TInt aTextResource ); |
|
161 |
|
162 /** |
|
163 * Sets servers activity |
|
164 * @since S60 5.1 |
|
165 */ |
|
166 void SetServersActivity(); |
|
167 |
|
168 /** |
|
169 * Reads source devices and set item text |
|
170 * @since S60 5.1 |
|
171 */ |
|
172 void ReadServerListL(); |
|
173 |
|
174 /** |
|
175 * Sets correct text for settings page |
|
176 * @since S60 5.1 |
|
177 */ |
|
178 void SetSettingItemTextL(); |
|
179 |
|
180 /** |
|
181 * Returns number of selected servers in active servers list. |
|
182 * @since S60 5.1 |
|
183 * @return number of selected servers |
|
184 */ |
|
185 TInt CountSelectedItems() const; |
|
186 |
|
187 /** |
|
188 * Creates AV controller. |
|
189 * @since S60 5.1 |
|
190 * @return operation success. KErrNone if succesfull |
|
191 */ |
|
192 TInt CreateAvcontrollerL(); |
|
193 |
|
194 /** |
|
195 * Cancels devices search operation. |
|
196 * @since S60 5.1 |
|
197 */ |
|
198 void CancelDeviceSearch(); |
|
199 |
|
200 /** |
|
201 * Fetches devices from AVController and calls |
|
202 * DeviceDiscovered-callback for each of them. |
|
203 * @since S60 5.1 |
|
204 */ |
|
205 void FetchAlreadyDiscoveredDevicesL(); |
|
206 |
|
207 /** |
|
208 * Creates AVController, fetches devices from it and calls |
|
209 * DeviceDiscovered-callback for each of them. Starts wait note if no |
|
210 * devices are already discovered. |
|
211 * |
|
212 * @since S60 5.1 |
|
213 * @return TInt system wide error code. KErrNone if successful. |
|
214 */ |
|
215 TInt CreateAvcAndFetchDevicesL(); |
|
216 |
|
217 /** |
|
218 * Constructor. |
|
219 */ |
|
220 CMSSettingItemDevices( TInt aIdentifier, |
|
221 TDes& aText, |
|
222 CMSEngine& aMSEngine, |
|
223 RPointerArray<CCmMediaServerFull>& aStoredServers, |
|
224 TBool aUploadCapabilitySupport ); |
|
225 |
|
226 /** |
|
227 * ConstructL |
|
228 * Second phase constructor. |
|
229 */ |
|
230 void ConstructL(); |
|
231 |
|
232 private: |
|
233 |
|
234 /** |
|
235 * The internal phases of wait note when creating AvC |
|
236 */ |
|
237 enum TCreateAvCState |
|
238 { |
|
239 EPhaseNotActive, |
|
240 EPhaseProcessing, |
|
241 EPhaseCompleted |
|
242 }; |
|
243 |
|
244 /** |
|
245 * Id list of selected servers |
|
246 */ |
|
247 CArrayFix<TInt>* iSelectedServers; // owned |
|
248 |
|
249 /** |
|
250 * Flag for indicating user cancel |
|
251 */ |
|
252 TBool iUserCancelledSearch; |
|
253 |
|
254 /** |
|
255 * Device selection dialog |
|
256 */ |
|
257 CMSMultiselectionPopup* iDevSelectionDlg; // owned |
|
258 |
|
259 /** |
|
260 * application engine |
|
261 */ |
|
262 CMSEngine& iMSEngine; |
|
263 |
|
264 /** |
|
265 * Servers to be shown to user |
|
266 */ |
|
267 RPointerArray<CCmMediaServerFull> iServerList; // not owned |
|
268 |
|
269 /** |
|
270 * searched servers list |
|
271 */ |
|
272 RPointerArray<CCmMediaServerFull>& iStoredServers; // not owned |
|
273 |
|
274 /** |
|
275 * Indicates if upload capability is needed |
|
276 */ |
|
277 TBool iUploadCapabilitySupport; |
|
278 |
|
279 /** |
|
280 * Server name string (external set) |
|
281 */ |
|
282 HBufC* iSettingText; // ownded |
|
283 |
|
284 /** |
|
285 * Wait dialog shown on device search |
|
286 */ |
|
287 CAknWaitDialog* iWaitDialog; // owned |
|
288 |
|
289 /** |
|
290 * Wait scheduler |
|
291 */ |
|
292 CActiveSchedulerWait iWait; |
|
293 |
|
294 /** |
|
295 * AV controller for device search |
|
296 */ |
|
297 MUPnPAVController* iAvController; // owned |
|
298 |
|
299 /** |
|
300 * Current state of creating AvC |
|
301 */ |
|
302 TCreateAvCState iCreateAvCState; |
|
303 |
|
304 }; |
|
305 |
|
306 #endif // C_MSSETTINGITEMSOURCEDEV_H |
|
307 |
|
308 // End of File |
|