|
1 /* |
|
2 * Copyright (c) 2002-2007 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: Offers callback interface to Epg database update* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 #include <e32base.h> |
|
21 #include "IptvDebug.h" |
|
22 #include "CIptvMediaContent.h" |
|
23 #include "CIptvEpgVodMsqQueue.h" |
|
24 #include "CIptvEpgVodCallbackImpl.h" |
|
25 #include "CIptvEpgCategory.h" |
|
26 #include "CIptvEpgContent.h" |
|
27 #include "CIptvEpgDb.h" |
|
28 #include "CIptvEpgSession.h" |
|
29 |
|
30 |
|
31 // ======== MEMBER FUNCTIONS ======== |
|
32 |
|
33 // -------------------------------------------------------------------------- |
|
34 // CIptvEpgVodCallbackImpl::ConstructL |
|
35 // Symbian 2nd phase constructor can leave. |
|
36 // -------------------------------------------------------------------------- |
|
37 // |
|
38 void CIptvEpgVodCallbackImpl::ConstructL() |
|
39 { |
|
40 IPTVLOGSTRING_LOW_LEVEL( "CIptvEpgVodCallbackImpl::ConstructL" ); |
|
41 } |
|
42 |
|
43 // -------------------------------------------------------------------------- |
|
44 // CIptvEpgVodCallbackImpl::NewL |
|
45 // Two-phased constructor. |
|
46 // Create instance of concrete interface implementation |
|
47 // -------------------------------------------------------------------------- |
|
48 // |
|
49 CIptvEpgVodCallbackImpl* CIptvEpgVodCallbackImpl::NewL( |
|
50 CIptvEpgDb& aVodEpgDb, |
|
51 CIptvEpgVodMsqQueue* aMsgQueue, |
|
52 CIptvEpgSession& aSession ) |
|
53 { |
|
54 IPTVLOGSTRING_LOW_LEVEL( "CIptvEpgVodCallbackImpl::NewL" ); |
|
55 |
|
56 CIptvEpgVodCallbackImpl* self = |
|
57 new( ELeave ) CIptvEpgVodCallbackImpl( |
|
58 aVodEpgDb, aMsgQueue, aSession ); |
|
59 CleanupStack::PushL( self ); |
|
60 |
|
61 self->ConstructL(); |
|
62 |
|
63 CleanupStack::Pop( self ); |
|
64 return self; |
|
65 } |
|
66 |
|
67 // -------------------------------------------------------------------------- |
|
68 // CIptvEpgVodCallbackImpl::~CIptvEpgVodCallbackImpl |
|
69 // Destructor |
|
70 // -------------------------------------------------------------------------- |
|
71 // |
|
72 CIptvEpgVodCallbackImpl::~CIptvEpgVodCallbackImpl() |
|
73 { |
|
74 IPTVLOGSTRING_LOW_LEVEL( |
|
75 "CIptvEpgVodCallbackImpl::~CIptvEpgVodCallbackImpl" ); |
|
76 } |
|
77 |
|
78 // -------------------------------------------------------------------------- |
|
79 // CIptvEpgVodCallbackImpl::CIptvEpgVodCallbackImpl |
|
80 // C++ default constructor |
|
81 // -------------------------------------------------------------------------- |
|
82 // |
|
83 CIptvEpgVodCallbackImpl::CIptvEpgVodCallbackImpl( |
|
84 CIptvEpgDb& aVodEpgDb, |
|
85 CIptvEpgVodMsqQueue* aMsgQueue, |
|
86 CIptvEpgSession& aSession ) : |
|
87 iVodEpgDb( aVodEpgDb ), |
|
88 iMsgQueue( aMsgQueue ), |
|
89 iPluginRunning( EFalse ), |
|
90 iSession( aSession ) |
|
91 { |
|
92 IPTVLOGSTRING_LOW_LEVEL( |
|
93 "CIptvEpgVodCallbackImpl::CIptvEpgVodCallbackImpl" ); |
|
94 } |
|
95 |
|
96 // -------------------------------------------------------------------------- |
|
97 // CIptvEpgVodCallbackImpl::ContentUpdateCompletedL |
|
98 // -------------------------------------------------------------------------- |
|
99 // |
|
100 void CIptvEpgVodCallbackImpl::ContentUpdateCompletedL() |
|
101 { |
|
102 IPTVLOGSTRING_LOW_LEVEL( |
|
103 "CIptvEpgVodCallbackImpl::ContentUpdateCompletedL" ); |
|
104 |
|
105 iVodEpgDb.EndUpdateL( iSession ); |
|
106 |
|
107 // Service id = 0 because we dont have to bring this information |
|
108 // over IPC. Service ID is already on the client side. |
|
109 if ( iMsgQueue ) |
|
110 { |
|
111 iMsgQueue->SendMessageToClientL( KIptvContentUpdateCompleted, 0 ); |
|
112 } |
|
113 } |
|
114 |
|
115 // -------------------------------------------------------------------------- |
|
116 // CIptvEpgVodCallbackImpl::Started |
|
117 // From MIptvEpgPluginManager interface |
|
118 // -------------------------------------------------------------------------- |
|
119 // |
|
120 void CIptvEpgVodCallbackImpl::StartedL() |
|
121 { |
|
122 IPTVLOGSTRING_LOW_LEVEL( |
|
123 "CIptvEpgVodCallbackImpl::StartedL -- EPG Plugin STARTED!" ); |
|
124 |
|
125 iPluginRunning = ETrue; |
|
126 iVodEpgDb.StartUpdateL(); |
|
127 } |
|
128 |
|
129 // -------------------------------------------------------------------------- |
|
130 // CIptvEpgVodCallbackImpl::FinishedL |
|
131 // From MIptvEpgPluginManager interface |
|
132 // -------------------------------------------------------------------------- |
|
133 // |
|
134 TInt CIptvEpgVodCallbackImpl::FinishedL( TTime& aUpdateInterval ) |
|
135 { |
|
136 IPTVLOGSTRING_LOW_LEVEL( |
|
137 "CIptvEpgVodCallbackImpl::FinishedL -- EPG Plugin FINISHED!" ); |
|
138 |
|
139 iVodEpgDb.FinishUpdateL(); |
|
140 |
|
141 TInt error = KErrNone; |
|
142 if ( iPluginRunning ) |
|
143 { |
|
144 TInt64 interval = aUpdateInterval.Int64(); |
|
145 if ( interval != 0 ) |
|
146 { |
|
147 TTime time; |
|
148 time.UniversalTime(); |
|
149 iVodEpgDb.SetUpdateTimeToServiceManagerL( time ); |
|
150 error = iVodEpgDb.UpdateServiceInformationL( time, aUpdateInterval ); |
|
151 if ( error != KErrNone ) |
|
152 { |
|
153 IPTVLOGSTRING_LOW_LEVEL( |
|
154 "CIptvEpgVodCallbackImpl::FinishedL -- Failed to update service information" ); |
|
155 } |
|
156 } |
|
157 } |
|
158 |
|
159 iPluginRunning = EFalse; |
|
160 return error; |
|
161 } |
|
162 |
|
163 // -------------------------------------------------------------------------- |
|
164 // CIptvEpgVodCallbackImpl::AddCategory |
|
165 // From MIptvEpgPluginManager interface |
|
166 // -------------------------------------------------------------------------- |
|
167 // |
|
168 TInt CIptvEpgVodCallbackImpl::AddCategoryL( |
|
169 CIptvEpgCategory& aCategory, |
|
170 TUint32& aCategoryKey ) |
|
171 { |
|
172 IPTVLOGSTRING_LOW_LEVEL( "CIptvEpgVodCallbackImpl::AddCategoryL" ); |
|
173 |
|
174 TInt error = iVodEpgDb.AddCategoryL( aCategory, aCategoryKey ); |
|
175 if ( error != KErrNone ) |
|
176 { |
|
177 IPTVLOGSTRING_LOW_LEVEL( |
|
178 "CIptvEpgVodCallbackImpl::AddCategoryL failed!" ); |
|
179 } |
|
180 |
|
181 return error; |
|
182 } |
|
183 |
|
184 // -------------------------------------------------------------------------- |
|
185 // CIptvEpgVodCallbackImpl::AddContentL |
|
186 // From MIptvEpgPluginManager interface |
|
187 // -------------------------------------------------------------------------- |
|
188 // |
|
189 TInt CIptvEpgVodCallbackImpl::AddContentL( |
|
190 CIptvEpgContent& aContent, |
|
191 RPointerArray<CIptvMediaContent> aMediaContents, |
|
192 TUint32& aContentKey ) |
|
193 { |
|
194 IPTVLOGSTRING_LOW_LEVEL( "CIptvEpgVodCallbackImpl::AddContentL" ); |
|
195 |
|
196 TInt error = iVodEpgDb.AddContentL( |
|
197 aContent, aMediaContents, aContentKey ); |
|
198 if ( error != KErrNone ) |
|
199 { |
|
200 IPTVLOGSTRING_LOW_LEVEL( |
|
201 "CIptvEpgVodCallbackImpl::AddContentL failed!" ); |
|
202 } |
|
203 |
|
204 return error; |
|
205 } |
|
206 |
|
207 // -------------------------------------------------------------------------- |
|
208 // CIptvEpgVodCallbackImpl::UpdateServiceThumbnailL |
|
209 // From MIptvEpgPluginManager interface |
|
210 // -------------------------------------------------------------------------- |
|
211 // |
|
212 TInt CIptvEpgVodCallbackImpl::UpdateServiceThumbnailL( |
|
213 TDesC& aIconFilePath, |
|
214 const TBool aGrouped ) |
|
215 { |
|
216 IPTVLOGSTRING_LOW_LEVEL( |
|
217 "CIptvEpgVodCallbackImpl::UpdateServiceThumbnailL" ); |
|
218 iSession.UpdateServiceThumbnailL( aIconFilePath, aGrouped ); |
|
219 |
|
220 return KErrNone; |
|
221 } |
|
222 |
|
223 // -------------------------------------------------------------------------- |
|
224 // CIptvEpgVodCallbackImpl::AddRelationL |
|
225 // From MIptvEpgPluginManager interface |
|
226 // -------------------------------------------------------------------------- |
|
227 // |
|
228 TInt CIptvEpgVodCallbackImpl::AddRelationL( |
|
229 TUint32& aCategoryKey, TUint32& aContentKey ) |
|
230 { |
|
231 IPTVLOGSTRING_LOW_LEVEL( "CIptvEpgVodCallbackImpl::AddRelationL" ); |
|
232 |
|
233 TInt error = iVodEpgDb.AddRelationL( aCategoryKey, aContentKey ); |
|
234 if ( error != KErrNone ) |
|
235 { |
|
236 IPTVLOGSTRING_LOW_LEVEL( |
|
237 "CIptvEpgVodCallbackImpl::AddRelationL failed!" ); |
|
238 } |
|
239 |
|
240 return error; |
|
241 } |
|
242 |
|
243 // -------------------------------------------------------------------------- |
|
244 // CIptvEpgVodCallbackImpl::Error |
|
245 // From MIptvEpgPluginManager interface |
|
246 // -------------------------------------------------------------------------- |
|
247 // |
|
248 void CIptvEpgVodCallbackImpl::ErrorL( TInt aError, TInt aInfo ) |
|
249 { |
|
250 IPTVLOGSTRING_LOW_LEVEL( "CIptvEpgVodCallbackImpl::ErrorL" ); |
|
251 |
|
252 if ( iMsgQueue ) |
|
253 { |
|
254 iMsgQueue->SendMessageToClientL( aError, aInfo ); |
|
255 } |
|
256 } |
|
257 |
|
258 // -------------------------------------------------------------------------- |
|
259 // CIptvEpgVodCallbackImpl::UpdateCategoryIconL |
|
260 // From MIptvEpgPluginManager interface |
|
261 // -------------------------------------------------------------------------- |
|
262 // |
|
263 TInt CIptvEpgVodCallbackImpl::UpdateCategoryIconL( |
|
264 TUint32& aCategoryKey, |
|
265 TUint32& aIconFileId, |
|
266 TDesC& aIconFilePath, TBool aIsUrl ) |
|
267 { |
|
268 IPTVLOGSTRING_LOW_LEVEL( "CIptvEpgVodCallbackImpl::UpdateCategoryIconL" ); |
|
269 |
|
270 TInt error = iVodEpgDb.UpdateCategoryIconL( |
|
271 aCategoryKey, |
|
272 aIconFileId, |
|
273 aIconFilePath, |
|
274 aIsUrl ); |
|
275 if ( error != KErrNone ) |
|
276 { |
|
277 IPTVLOGSTRING_LOW_LEVEL( |
|
278 "CIptvEpgVodCallbackImpl::UpdateCategoryIconL failed!" ); |
|
279 } |
|
280 |
|
281 return error; |
|
282 } |
|
283 |
|
284 // -------------------------------------------------------------------------- |
|
285 // CIptvEpgVodCallbackImpl::UpdateContentIconL |
|
286 // From MIptvEpgPluginManager interface |
|
287 // -------------------------------------------------------------------------- |
|
288 // |
|
289 TInt CIptvEpgVodCallbackImpl::UpdateContentIconL( |
|
290 TUint32& aContentKey, |
|
291 TUint32& aIconFileId, |
|
292 TDesC& aIconFilePath, |
|
293 TBool aIsUrl ) |
|
294 { |
|
295 IPTVLOGSTRING_LOW_LEVEL( "CIptvEpgVodCallbackImpl::UpdateContentIconL" ); |
|
296 |
|
297 TInt error = iVodEpgDb.UpdateContentIconL( |
|
298 aContentKey, aIconFileId, aIconFilePath, aIsUrl ); |
|
299 if ( error != KErrNone ) |
|
300 { |
|
301 IPTVLOGSTRING_LOW_LEVEL( |
|
302 "CIptvEpgVodCallbackImpl::UpdateContentIconL failed!" ); |
|
303 } |
|
304 |
|
305 return error; |
|
306 } |