17 |
17 |
18 |
18 |
19 #include <liwservicehandler.h> |
19 #include <liwservicehandler.h> |
20 #include <liwvariant.h> |
20 #include <liwvariant.h> |
21 #include <liwgenericparam.h> |
21 #include <liwgenericparam.h> |
|
22 #include <S32MEM.H> |
22 #include "sapidata.h" |
23 #include "sapidata.h" |
23 #include "sapidataobserver.h" |
24 #include "sapidataobserver.h" |
24 #include "sapidatapluginconst.h" |
25 #include "sapidatapluginconst.h" |
25 // --------------------------------------------------------------------------- |
26 // --------------------------------------------------------------------------- |
26 // Constructor |
27 // Constructor |
54 |
55 |
55 // Fill in input list for RequestNotification command |
56 // Fill in input list for RequestNotification command |
56 inParamList->AppendL(TLiwGenericParam(KType,TLiwVariant(aRegistry))); |
57 inParamList->AppendL(TLiwGenericParam(KType,TLiwVariant(aRegistry))); |
57 inParamList->AppendL(TLiwGenericParam(KFilter ,TLiwVariant(aFilter))); |
58 inParamList->AppendL(TLiwGenericParam(KFilter ,TLiwVariant(aFilter))); |
58 |
59 |
59 iError = KErrNone; |
60 TRAP_IGNORE( iInterface->ExecuteCmdL(KRequestNotification, |
60 TRAP( iError, iInterface->ExecuteCmdL( |
|
61 KRequestNotification, |
|
62 *inParamList, |
61 *inParamList, |
63 *outParamList, |
62 *outParamList, |
64 0, |
63 0, |
65 this ) ); |
64 this ) ); |
66 |
65 |
79 CLiwGenericParamList* inParamList = CLiwGenericParamList::NewL(); |
78 CLiwGenericParamList* inParamList = CLiwGenericParamList::NewL(); |
80 CleanupStack::PushL( inParamList ); |
79 CleanupStack::PushL( inParamList ); |
81 CLiwGenericParamList* outParamList = CLiwGenericParamList::NewL(); |
80 CLiwGenericParamList* outParamList = CLiwGenericParamList::NewL(); |
82 CleanupStack::PushL( outParamList ); |
81 CleanupStack::PushL( outParamList ); |
83 |
82 |
84 TInt err(KErrNone); |
83 TRAP_IGNORE( iInterface->ExecuteCmdL( KRequestNotification, |
85 TRAP(err, iInterface->ExecuteCmdL( |
|
86 KRequestNotification, |
|
87 *inParamList, |
84 *inParamList, |
88 *outParamList, |
85 *outParamList, |
89 KLiwOptCancel, |
86 KLiwOptCancel, |
90 this )); |
87 this )); |
91 |
88 |
127 CLiwGenericParamList& aEventParamList, |
124 CLiwGenericParamList& aEventParamList, |
128 const CLiwGenericParamList& /*aInParamList*/ ) |
125 const CLiwGenericParamList& /*aInParamList*/ ) |
129 { |
126 { |
130 |
127 |
131 // Is plugin active to refresh the published data |
128 // Is plugin active to refresh the published data |
132 iError = aErrorCode; |
|
133 TInt count(0); |
129 TInt count(0); |
134 TInt pos(0); |
130 TInt pos(0); |
135 const TLiwGenericParam* param(NULL); |
131 const TLiwGenericParam* param(NULL); |
136 CLiwDefaultList* listOfMaps = CLiwDefaultList::NewLC(); |
132 CLiwDefaultList* listOfMaps = CLiwDefaultList::NewLC(); |
137 param = aEventParamList.FindFirst(pos,KChangeInfo); |
133 param = aEventParamList.FindFirst(pos,KChangeInfo); |
176 { |
172 { |
177 iData->UpdatePublisherStatusL( *publisher ); |
173 iData->UpdatePublisherStatusL( *publisher ); |
178 } |
174 } |
179 } |
175 } |
180 else if ( iData->IsPluginActive() ) |
176 else if ( iData->IsPluginActive() ) |
181 { |
177 { |
182 // notification from content registry |
178 // notification from content registry |
183 found = map->FindL( KContentType, variant ); |
179 found = map->FindL( KContentType, variant ); |
184 if (found) |
180 if( found ) |
185 { |
181 { |
186 contentType = variant.AsDes().AllocLC(); |
182 contentType = variant.AsDes().AllocLC(); |
187 } |
183 } |
188 variant.Reset(); |
184 variant.Reset(); |
189 found = map->FindL( KContentId, variant ); |
185 |
190 if (found) |
186 // content id |
191 { |
187 found = map->FindL( KContentId, variant ); |
192 contentId = variant.AsDes().AllocLC(); |
188 if( found ) |
193 } |
189 { |
194 variant.Reset(); |
190 contentId = variant.AsDes().AllocLC(); |
195 iData->RefreshL( *publisher, *contentType, *contentId, *operation ); |
191 } |
196 |
192 variant.Reset(); |
197 if ( contentId ) |
193 |
198 { |
194 // Data map. Optional. |
199 CleanupStack::PopAndDestroy( contentId ); |
195 CLiwDefaultMap* dataMap = NULL; |
200 } |
196 |
201 if ( contentType ) |
197 found = map->FindL( KDataMap, variant); |
202 { |
198 if( found ) |
203 CleanupStack::PopAndDestroy( contentType ); |
199 { |
204 } |
200 TPtrC8 data = variant.AsData(); |
205 } |
201 RDesReadStream datastrm ( data ); |
|
202 CleanupClosePushL( datastrm ); |
|
203 dataMap = CLiwDefaultMap::NewLC( datastrm ); |
|
204 // There is no CLiwDefaultMap::NewL( RReadStream ) |
|
205 // so, must do some work with cleanup stack here. |
|
206 CleanupStack::Pop( dataMap ); |
|
207 CleanupStack::PopAndDestroy(); // datastrm |
|
208 dataMap->PushL(); |
|
209 } |
|
210 |
|
211 iData->RefreshL( *publisher, |
|
212 *contentType, |
|
213 *contentId, |
|
214 *operation, |
|
215 dataMap ); |
|
216 |
|
217 if( dataMap ) |
|
218 { |
|
219 CleanupStack::PopAndDestroy( dataMap ); |
|
220 } |
|
221 |
|
222 if( contentId ) |
|
223 { |
|
224 CleanupStack::PopAndDestroy( contentId ); |
|
225 } |
|
226 |
|
227 if( contentType ) |
|
228 { |
|
229 CleanupStack::PopAndDestroy( contentType ); |
|
230 } |
|
231 } |
206 else |
232 else |
207 { |
233 { |
208 // remember update if plugin is in suspend mode |
234 // remember update if plugin is in suspend mode |
209 iData->SetUpdateNeeded( ETrue ); |
235 iData->SetUpdateNeeded( ETrue ); |
210 } |
236 } |