|
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: CVideoChLastWatchedUpdater class definition* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <e32std.h> |
|
21 #include <e32def.h> |
|
22 #include <e32cmn.h> |
|
23 |
|
24 #include <videoplayercustommessage.h> |
|
25 |
|
26 #include <vcxmyvideosdefs.h> |
|
27 #include <vcxmyvideosuids.h> |
|
28 #include <mpxcommandgeneraldefs.h> |
|
29 |
|
30 #include "IptvDebug.h" |
|
31 // #include "iptvlastwatchedapi.h" |
|
32 // #include "iptvlastwatcheddata.h" |
|
33 #include "videochlastwatchedupdater.h" |
|
34 #include "videochpublishabledata.h" |
|
35 #include "videochpublisher.h" |
|
36 #include "vcxnsmediatorids.h" |
|
37 #include "videochmcategorylistener.h" |
|
38 |
|
39 // ============================ MEMBER FUNCTIONS ============================== |
|
40 |
|
41 // ---------------------------------------------------------------------------- |
|
42 // Constructor |
|
43 // ---------------------------------------------------------------------------- |
|
44 // |
|
45 CVcxNsChLastWatchedUpdater::CVcxNsChLastWatchedUpdater( CVcxNsChPublishableData* aPublishableData, |
|
46 CVcxNsChPublisher* aPublisher ) : |
|
47 iPublishableData( aPublishableData ), |
|
48 iPublisher( aPublisher ) |
|
49 { |
|
50 } |
|
51 |
|
52 // ---------------------------------------------------------------------------- |
|
53 // Symbian 2nd phase constructor can leave. |
|
54 // ---------------------------------------------------------------------------- |
|
55 // |
|
56 void CVcxNsChLastWatchedUpdater::ConstructL() |
|
57 { |
|
58 IPTVLOGSTRING_LOW_LEVEL("CVcxNsChLastWatchedUpdater::ConstructL IN"); |
|
59 |
|
60 |
|
61 TVersion mediatorVcxNsPlayerVersion = TVersion( KVcxNsMediatorPlayerVersion, 0, 0 ); |
|
62 TUid domain = KVcxNsVideoCenterMediatorDomain; |
|
63 TUid category = KVcxNsPlayerGeneralCategory; |
|
64 iMPlayerCategoryListener = CVcxNsChMCategoryListener::NewL( this, |
|
65 domain, |
|
66 category, |
|
67 mediatorVcxNsPlayerVersion ); |
|
68 |
|
69 iMPlayerCategoryListener->RegisterAndSubscribeL( KVcxNsMediatorEventPlayerLastWatch ); |
|
70 iMPlayerCategoryListener->RegisterAndSubscribeL( KVcxNsMediatorEventPreloadedLastWatch ); |
|
71 |
|
72 domain = KVcxNsVideoCenterMediatorDomain; |
|
73 category = KVcxNsIPTVGeneralCategory; |
|
74 TVersion mediatorVcxNsIPTVVersion = TVersion( KVcxNsMediatorIPTVVersion, 0, 0 ); |
|
75 iMIPTVCategoryListener = CVcxNsChMCategoryListener::NewL( this, |
|
76 domain, |
|
77 category, |
|
78 mediatorVcxNsIPTVVersion ); |
|
79 iMIPTVCategoryListener->RegisterAndSubscribeL( KVcxNsMediatorEventIPTVLastWatch ); |
|
80 |
|
81 IPTVLOGSTRING_LOW_LEVEL("CVcxNsChLastWatchedUpdater::ConstructL OUT"); |
|
82 } |
|
83 |
|
84 // ---------------------------------------------------------------------------- |
|
85 // Two-phased constructor. |
|
86 // ---------------------------------------------------------------------------- |
|
87 // |
|
88 CVcxNsChLastWatchedUpdater* CVcxNsChLastWatchedUpdater::NewL( |
|
89 CVcxNsChPublishableData* aPublishableData, |
|
90 CVcxNsChPublisher* aPublisher ) |
|
91 { |
|
92 |
|
93 CVcxNsChLastWatchedUpdater* self = new ( ELeave ) CVcxNsChLastWatchedUpdater( |
|
94 aPublishableData, |
|
95 aPublisher ); |
|
96 CleanupStack::PushL( self ); |
|
97 self->ConstructL(); |
|
98 CleanupStack::Pop( self ); |
|
99 return self; |
|
100 } |
|
101 |
|
102 // --------------------------------------------------------------------------- |
|
103 // Destructor |
|
104 // --------------------------------------------------------------------------- |
|
105 // |
|
106 CVcxNsChLastWatchedUpdater::~CVcxNsChLastWatchedUpdater() |
|
107 { |
|
108 delete iMPlayerCategoryListener; |
|
109 delete iMIPTVCategoryListener; |
|
110 } |
|
111 |
|
112 // ---------------------------------------------------------------------------- |
|
113 // |
|
114 // ---------------------------------------------------------------------------- |
|
115 // |
|
116 void CVcxNsChLastWatchedUpdater::MediatorEventL( TUid aDomain, |
|
117 TUid aCategory, |
|
118 TInt aEventId, |
|
119 const TDesC8& aData ) |
|
120 { |
|
121 IPTVLOGSTRING_LOW_LEVEL("CVcxNsChLastWatchedUpdater::MediatorEventL IN"); |
|
122 |
|
123 if( aDomain == KVcxNsVideoCenterMediatorDomain ) |
|
124 { |
|
125 |
|
126 if( aCategory == KVcxNsPlayerGeneralCategory && |
|
127 aEventId == KVcxNsMediatorEventPlayerLastWatch ) |
|
128 { |
|
129 // get data and publish to menu |
|
130 TVideoPlayerCustomMessage* message = new (ELeave) TVideoPlayerCustomMessage; |
|
131 CleanupStack::PushL( message ); |
|
132 TPckg< TVideoPlayerCustomMessage > paramsPckg( *message ); |
|
133 |
|
134 paramsPckg.Copy( aData ); |
|
135 |
|
136 // save last watched name |
|
137 iPublishableData->SetDataL( EVCxNsCPContentLastWatched, |
|
138 TPtrC8( KTvVideoName ), |
|
139 message->iName ); |
|
140 |
|
141 // save last watched path |
|
142 iPublishableData->SetDataL( EVCxNsCPContentLastWatched, |
|
143 TPtrC8( KTvVideoPath ), |
|
144 message->iContent ); |
|
145 |
|
146 // save possible icon |
|
147 iPublishableData->SetDataL( EVCxNsCPContentLastWatched, |
|
148 TPtrC8( KTvVideoIconPath ), |
|
149 message->iIcon ); |
|
150 |
|
151 // save last watched content type, all other than IPTV |
|
152 // can use "last watched" content type |
|
153 iPublishableData->SetDataL( EVCxNsCPContentLastWatched, |
|
154 TPtrC8( KTvVideoLastWatchedType ), |
|
155 EVCxNsCPContentLastWatched ); |
|
156 |
|
157 CleanupStack::PopAndDestroy( message ); |
|
158 |
|
159 } |
|
160 else if( aCategory == KVcxNsPlayerGeneralCategory && |
|
161 aEventId == KVcxNsMediatorEventPreloadedLastWatch ) |
|
162 { |
|
163 WritePreloadedToLastWatchedL(); |
|
164 |
|
165 TPtrC name = |
|
166 iPublishableData->GetDesCDataL( EVCxNsCPContentPreloaded, |
|
167 TPtrC8( KTvVideoName ) ); |
|
168 // save last watched name |
|
169 iPublishableData->SetDataL( EVCxNsCPContentLastWatched, |
|
170 TPtrC8( KTvVideoName ), |
|
171 name ); |
|
172 |
|
173 TPtrC iconPath = |
|
174 iPublishableData->GetDesCDataL( EVCxNsCPContentPreloaded, |
|
175 TPtrC8( KTvVideoIconPath ) ); |
|
176 // save possible icon |
|
177 iPublishableData->SetDataL( EVCxNsCPContentLastWatched, |
|
178 TPtrC8( KTvVideoIconPath ), |
|
179 iconPath ); |
|
180 |
|
181 // save last watched content type, all other than IPTV |
|
182 // can use "last watched" content type |
|
183 iPublishableData->SetDataL( EVCxNsCPContentLastWatched, |
|
184 TPtrC8( KTvVideoLastWatchedType ), |
|
185 EVCxNsCPContentLastWatched ); |
|
186 } |
|
187 else if( aCategory == KVcxNsIPTVGeneralCategory && |
|
188 aEventId == KVcxNsMediatorEventIPTVLastWatch ) |
|
189 { |
|
190 TIPTVMediatorMsg message; |
|
191 TPckg< TIPTVMediatorMsg > paramsPckg( message ); |
|
192 paramsPckg.Copy( aData ); |
|
193 |
|
194 // save last watched name |
|
195 iPublishableData->SetDataL( EVCxNsCPContentLastWatched, |
|
196 TPtrC8( KTvVideoName ), |
|
197 message.iChannelName ); |
|
198 |
|
199 |
|
200 // save possible icon |
|
201 iPublishableData->SetDataL( EVCxNsCPContentLastWatched, |
|
202 TPtrC8( KTvVideoIconPath ), |
|
203 message.iIconPath ); |
|
204 |
|
205 |
|
206 // save last watched type |
|
207 iPublishableData->SetDataL( EVCxNsCPContentLastWatched, |
|
208 TPtrC8( KTvVideoLastWatchedType ), |
|
209 EVCxNsCPContentIPTV ); |
|
210 } |
|
211 // publish data |
|
212 iPublisher->PublishContentL( EVCxNsCPContentLastWatched ); |
|
213 } |
|
214 |
|
215 IPTVLOGSTRING_LOW_LEVEL("CVcxNsChLastWatchedUpdater::MediatorEventL OUT"); |
|
216 } |
|
217 |
|
218 // ---------------------------------------------------------------------------- |
|
219 // |
|
220 // ---------------------------------------------------------------------------- |
|
221 // |
|
222 void CVcxNsChLastWatchedUpdater:: WritePreloadedToLastWatchedL() |
|
223 { |
|
224 /* |
|
225 CIptvLastWatchedData* data = CIptvLastWatchedData::NewL(); |
|
226 CleanupStack::PushL(data); |
|
227 |
|
228 TPtrC name = |
|
229 iPublishableData->GetDesCDataL( EVCxNsCPContentPreloaded, |
|
230 TPtrC8( KTvVideoName ) ); |
|
231 TPtrC path = |
|
232 iPublishableData->GetDesCDataL( EVCxNsCPContentPreloaded, |
|
233 TPtrC8( KTvVideoPath ) ); |
|
234 TPtrC iconPath = |
|
235 iPublishableData->GetDesCDataL( EVCxNsCPContentPreloaded, |
|
236 TPtrC8( KTvVideoIconPath ) ); |
|
237 |
|
238 data->SetIconPathL( iconPath ); |
|
239 data->SetNameL( name ); |
|
240 data->SetUriL( path ); |
|
241 data->SetContentType( KViaPlayerContentTypeFile ); |
|
242 data->SetMpxId( KIdUndefined ); |
|
243 |
|
244 |
|
245 iPublishableData->LastWatchedApi().SetLastWatchedDataL( *data ); |
|
246 CleanupStack::PopAndDestroy(data); |
|
247 */ |
|
248 } |