|
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 the License "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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef C_VCXNSSERVICEPROVIDER_H |
|
22 #define C_VCXNSSERVICEPROVIDER_H |
|
23 |
|
24 // INCLUDES |
|
25 #include "CIptvUtil.h" |
|
26 #include <e32base.h> |
|
27 #include <f32file.h> |
|
28 |
|
29 #include "vcxnsserviceproviderif.h" |
|
30 #include "vcxnsserviceproviderobserver.h" |
|
31 #include "vcxnsservice.h" |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 class MVcxNsServiceProviderObserver; |
|
35 class CVcxNsUiEngine; |
|
36 |
|
37 // CLASS DECLARATION |
|
38 |
|
39 /** |
|
40 * Class CVcxNsServiceProvider handles application services. |
|
41 * |
|
42 * @lib vcxnsuiengine.lib |
|
43 */ |
|
44 class CVcxNsServiceProvider : public CBase, |
|
45 public MVcxNsServiceProviderIf |
|
46 { |
|
47 |
|
48 public: |
|
49 |
|
50 /** |
|
51 * Constructor |
|
52 * @param aUiEngine Reference to UI engine interface. |
|
53 * @return Pointer to CVcxNsServiceProvider object. |
|
54 */ |
|
55 static CVcxNsServiceProvider* NewL( CVcxNsUiEngine& aUiEngine ); |
|
56 |
|
57 virtual ~CVcxNsServiceProvider(); |
|
58 |
|
59 /** |
|
60 * RegisterObserver. |
|
61 * @param aObserver Observer |
|
62 */ |
|
63 void RegisterObserver( MVcxNsServiceProviderObserver* aObserver ); |
|
64 |
|
65 /** |
|
66 * DeRegisterObserver. |
|
67 * @param aObserver Observer |
|
68 */ |
|
69 void DeRegisterObserver( MVcxNsServiceProviderObserver* aObserver ); |
|
70 |
|
71 /** |
|
72 * Gets all subscribed services. |
|
73 * |
|
74 * @return Vod services. |
|
75 */ |
|
76 RPointerArray<CVcxNsService>& GetSubscribedServicesL(); |
|
77 |
|
78 /** |
|
79 * Gets all services under active service group. |
|
80 * @return Group service list for active service group. |
|
81 */ |
|
82 RPointerArray<CVcxNsService>& GetActiveGroupListL( ); |
|
83 |
|
84 /** |
|
85 * Opens selected service. |
|
86 * |
|
87 * @param aIndex Index of the service to be opened. |
|
88 */ |
|
89 void OpenServiceL( TInt aIndex ); |
|
90 |
|
91 /** |
|
92 * Open service with given service id. |
|
93 * |
|
94 * @param aServiceId Id of service to open |
|
95 */ |
|
96 void OpenServiceL( TUint32 aServiceId ); |
|
97 |
|
98 /** |
|
99 * Get highlight index for category list. |
|
100 * |
|
101 * @return Current highlight index in category list. |
|
102 * If service is not categorised, |
|
103 * then returns highlight for content list. |
|
104 */ |
|
105 TInt GetCurrentHighlight(); |
|
106 |
|
107 /** |
|
108 * Set highlight index for category list. |
|
109 * @param aIndex Index to save |
|
110 */ |
|
111 void SetCurrentHighlight( TInt aIndex ); |
|
112 |
|
113 /** |
|
114 * Remove service |
|
115 * @param aIndex Index of the service to be removed |
|
116 */ |
|
117 void RemoveServiceL( TInt aIndex ); |
|
118 |
|
119 /** |
|
120 * Get pointer to service data |
|
121 * @param aIndex Index of the service in list |
|
122 * @return Pointer to service data. |
|
123 * NULL returned, if service data not found |
|
124 */ |
|
125 CVcxNsService* GetServiceData( TInt aIndex ); |
|
126 |
|
127 /** |
|
128 * Get service data |
|
129 * @param aServiceId Service Id |
|
130 * @return Service data |
|
131 */ |
|
132 CVcxNsService* GetServiceDataById( TUint32 aServiceId ); |
|
133 |
|
134 /** |
|
135 * Return pointer to active service data |
|
136 * @return Pointer to active service data. |
|
137 * NULL returned, if service data not found |
|
138 */ |
|
139 CVcxNsService* GetActiveServiceData(); |
|
140 |
|
141 /** |
|
142 * Reset all the service data. |
|
143 */ |
|
144 void RemoveServiceData(); |
|
145 |
|
146 /** |
|
147 * Handle the back command by choosing new application state. |
|
148 * @return Was the back event consumed. If EFalse, |
|
149 * the back event should be handled by caller. |
|
150 */ |
|
151 TBool HandleBack(); |
|
152 |
|
153 /** |
|
154 * Start ecg update for all visible feeds. |
|
155 */ |
|
156 void RefreshAllServicesL(); |
|
157 |
|
158 /** |
|
159 * Open video directory |
|
160 */ |
|
161 void OpenVideoDirectoryL(); |
|
162 |
|
163 /** |
|
164 * Manage account for selected service. |
|
165 * @param aSelected Selected item index |
|
166 */ |
|
167 void ManageAccountL( TInt aSelected ); |
|
168 |
|
169 /** |
|
170 * Save authentication data for service. |
|
171 * This handles data for active service. |
|
172 * @param aUserName username |
|
173 * @param aPasswd passwd |
|
174 */ |
|
175 void SetAuthenticationDataL( const TDesC& aUserName, |
|
176 const TDesC& aPasswd ); |
|
177 |
|
178 /** |
|
179 * Notify service has been added. |
|
180 * |
|
181 * @param aIndex Added item's index |
|
182 */ |
|
183 void ServiceAdded( TInt aIndex ); |
|
184 |
|
185 /** |
|
186 * Service update notification. |
|
187 * |
|
188 * @param aIndex Updated item's index |
|
189 */ |
|
190 void ServiceUpdated( TInt aIndex ); |
|
191 |
|
192 /** |
|
193 * View needs to be refreshed. |
|
194 */ |
|
195 void RefreshView(); |
|
196 |
|
197 /** |
|
198 * Application state needs to be updated. |
|
199 */ |
|
200 void HandleAppStateChangedL(); |
|
201 |
|
202 /** |
|
203 * Update a service status by it's id |
|
204 * @param aServiceId service id |
|
205 * @param aStatus status |
|
206 */ |
|
207 void UpdateServiceUpdateStatusL( TUint32 aServiceId, |
|
208 CVcxNsService::TServiceUpdateStatus aStatus ); |
|
209 |
|
210 /** |
|
211 * Start ecg update for next pending service |
|
212 */ |
|
213 void RefreshNextPendingService(); |
|
214 |
|
215 /** |
|
216 * Call update for the service list item with given ID. |
|
217 * @param aServiceId service id |
|
218 */ |
|
219 void UpdateService( TUint aServiceId ); |
|
220 |
|
221 /** |
|
222 * Update service's thumbnailpath from smdb. |
|
223 * @param aServiceId Service Id |
|
224 */ |
|
225 void ReloadThumbnailPathL( TUint aServiceId ); |
|
226 |
|
227 /** |
|
228 * Checks if feed has more details than just name |
|
229 * |
|
230 * @param aSelected Index of selected item |
|
231 * @return Does the feed have other details than just name |
|
232 */ |
|
233 TBool HasFeedDetails( TInt aSelected ); |
|
234 |
|
235 /** |
|
236 * Get list index for defined service id. |
|
237 * @param aServiceId Service id |
|
238 * @return Service's index with given ID. |
|
239 */ |
|
240 TInt ServiceIndex( TUint32 aServiceId ); |
|
241 |
|
242 /** |
|
243 * Moves a service from given position to another. |
|
244 * |
|
245 * @param aSourceIndex where from move the service |
|
246 * @param aTargetIndex where to move the service. |
|
247 * @return error code |
|
248 */ |
|
249 TInt MoveServiceL( TInt aSourceIndex, TInt aTargetIndex ); |
|
250 |
|
251 /** |
|
252 * Check if item has account management uri. |
|
253 * @param aSelected Index of selected item. |
|
254 * @return ETrue if account management uri available. |
|
255 */ |
|
256 TBool HasAccountManagementUri( TInt aSelected ); |
|
257 |
|
258 /** |
|
259 * Update service data in ui engine cache |
|
260 * @param aServiceId Service id of updated service |
|
261 */ |
|
262 void UpdateServiceInCacheL( TUint32 aServiceId ); |
|
263 |
|
264 /** |
|
265 * Cancel update queue. |
|
266 */ |
|
267 void CancelUpdateQueue(); |
|
268 |
|
269 private: |
|
270 |
|
271 /** |
|
272 * Constructor |
|
273 * @param aUiEngine Reference to UI engine interface. |
|
274 */ |
|
275 CVcxNsServiceProvider( CVcxNsUiEngine& aUiEngine ); |
|
276 |
|
277 /** |
|
278 * Constructor. |
|
279 */ |
|
280 void ConstructL(); |
|
281 |
|
282 /** |
|
283 * Check, that the file with given path actually exists. |
|
284 * @param File path to check |
|
285 * @return Do the file with given path exist. |
|
286 */ |
|
287 TBool EnsureFileExists( const TDesC& aPath ); |
|
288 |
|
289 /** |
|
290 * Start manual update for service. |
|
291 * @param aServiceId Service id |
|
292 */ |
|
293 void StartManualUpdateL( TUint32 aServiceId ); |
|
294 |
|
295 /** |
|
296 * Start manual update for service. |
|
297 * @param aService Service data |
|
298 */ |
|
299 void UpdateServiceL( CVcxNsService& aService ); |
|
300 |
|
301 /** |
|
302 * Set service back to queue to wait for update. |
|
303 * @param aServiceId Service id. |
|
304 */ |
|
305 void SetBackToUpdateQueue( TUint32 aServiceId ); |
|
306 |
|
307 /** |
|
308 * Get grouped services. |
|
309 * @param aGroupId Id of service group |
|
310 * @return Grouped service list. |
|
311 */ |
|
312 RPointerArray<CVcxNsService>& GetGroupedServicesL( TUint32 aGroupId ); |
|
313 |
|
314 /** |
|
315 * Open selected group service. |
|
316 * |
|
317 * @param aIndex List index from customized service view. |
|
318 */ |
|
319 void OpenServiceFromGroupL( TInt aIndex ); |
|
320 |
|
321 /** |
|
322 * Open link to browser. |
|
323 * @param aUri Link to open in browser. |
|
324 */ |
|
325 void OpenToBrowserL( const TDesC& aUri ); |
|
326 |
|
327 /** |
|
328 * Open link to player. |
|
329 * |
|
330 * @param aUri Link to open in player. |
|
331 * Leaves with KErrArgument if not rtsp link. |
|
332 */ |
|
333 void OpenToPlayerL( const TDesC& aName, const TDesC& aUri ); |
|
334 |
|
335 /** |
|
336 * Opens a video service |
|
337 * |
|
338 * @param aServiceId Service Id to open. |
|
339 * @param aIndex Service's Index to open. |
|
340 */ |
|
341 void OpenVideoServiceL( TUint32 aServiceId, TInt aIndex ); |
|
342 |
|
343 private: |
|
344 |
|
345 // Data |
|
346 |
|
347 /** |
|
348 * Array of service event observers. Not Own. |
|
349 */ |
|
350 RPointerArray<MVcxNsServiceProviderObserver> iServiceObservers; |
|
351 |
|
352 /** |
|
353 * UI engine. |
|
354 */ |
|
355 CVcxNsUiEngine& iUiEngine; |
|
356 |
|
357 /** |
|
358 * Service list. |
|
359 */ |
|
360 RPointerArray<CVcxNsService> iServiceList; |
|
361 |
|
362 /** |
|
363 * RFs. |
|
364 */ |
|
365 RFs iFs; |
|
366 |
|
367 /** |
|
368 * Ids of services in update queue. |
|
369 * This array should only have contents when user has |
|
370 * selected refresh for all feeds. |
|
371 */ |
|
372 RArray<TUint32> iUpdateQueue; |
|
373 }; |
|
374 |
|
375 #endif // C_VCXNSSERVICEPROVIDER_H |