86 delete iProfile; |
86 delete iProfile; |
87 iSyncMLSession.Close(); |
87 iSyncMLSession.Close(); |
88 } |
88 } |
89 |
89 |
90 // ------------------------------------------------------------------------------ |
90 // ------------------------------------------------------------------------------ |
91 // CIAUpdateFWSyncAppEngine::DeleteProfileL |
91 // CIAUpdateFWSyncAppEngine::SetObserver |
92 // ------------------------------------------------------------------------------ |
92 // ------------------------------------------------------------------------------ |
93 // |
93 // |
94 void CIAUpdateFWSyncAppEngine::DeleteProfileL( TInt aProfileId ) |
94 void CIAUpdateFWSyncAppEngine::SetObserver( MIAUpdateFWUpdateObserver* aObserver ) |
95 { |
95 { |
96 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncAppEngine::DeleteProfileL:" ); |
96 if ( iSyncHandler ) |
97 |
97 { |
98 delete iProfile; |
98 iSyncHandler->SetUpdateObserver( aObserver ); |
99 iProfile = NULL; |
99 } |
100 iSyncMLSession.DeleteProfileL( aProfileId ); |
100 } |
101 } |
|
102 |
101 |
103 // ------------------------------------------------------------------------------ |
|
104 // CIAUpdateFWSyncAppEngine::CreateProfileL |
|
105 // ------------------------------------------------------------------------------ |
|
106 // |
|
107 TInt CIAUpdateFWSyncAppEngine::CreateProfileL() |
|
108 { |
|
109 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncAppEngine::CreateProfileL:" ); |
|
110 |
|
111 delete iProfile; |
|
112 iProfile = NULL; |
|
113 iProfile = CIAUpdateFWSyncProfile::NewL( KIAUpdateUiUid, &iSyncMLSession ); |
|
114 return iProfile->CreateL(); |
|
115 } |
|
116 |
102 |
117 // ------------------------------------------------------------------------------ |
103 // ------------------------------------------------------------------------------ |
118 // CIAUpdateFWSyncAppEngine::Profile |
104 // CIAUpdateFWSyncAppEngine::Profile |
119 // ------------------------------------------------------------------------------ |
105 // ------------------------------------------------------------------------------ |
120 // |
106 // |
123 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncAppEngine::Profile:" ); |
109 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncAppEngine::Profile:" ); |
124 |
110 |
125 return iProfile; |
111 return iProfile; |
126 } |
112 } |
127 |
113 |
128 // ------------------------------------------------------------------------------ |
|
129 // CIAUpdateFWSyncAppEngine::CreateCopyProfileL |
|
130 // ------------------------------------------------------------------------------ |
|
131 // |
|
132 CIAUpdateFWSyncProfile* CIAUpdateFWSyncAppEngine::CreateCopyProfileL( TInt aProfileId ) |
|
133 { |
|
134 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncAppEngine::CreateCopyProfileL:" ); |
|
135 |
|
136 delete iProfile; |
|
137 iProfile = NULL; |
|
138 iProfile = CIAUpdateFWSyncProfile::NewL( KIAUpdateUiUid, &iSyncMLSession ); |
|
139 |
|
140 iProfile->CreateCopyL( aProfileId ); |
|
141 return iProfile; |
|
142 } |
|
143 |
|
144 // ----------------------------------------------------------------------------- |
|
145 // CIAUpdateFWSyncAppEngine::Session |
|
146 // ----------------------------------------------------------------------------- |
|
147 // |
|
148 RSyncMLSession* CIAUpdateFWSyncAppEngine::Session() |
|
149 { |
|
150 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncAppEngine::Session:" ); |
|
151 |
|
152 return &iSyncMLSession; |
|
153 } |
|
154 |
|
155 // ----------------------------------------------------------------------------- |
114 // ----------------------------------------------------------------------------- |
156 // CIAUpdateFWSyncAppEngine::OpenL |
115 // CIAUpdateFWSyncAppEngine::OpenL |
157 // ----------------------------------------------------------------------------- |
116 // ----------------------------------------------------------------------------- |
158 // |
117 // |
159 CIAUpdateFWSyncProfile* CIAUpdateFWSyncAppEngine::OpenProfileL( TInt aProfileId, |
118 CIAUpdateFWSyncProfile* CIAUpdateFWSyncAppEngine::OpenProfileL( TInt aProfileId, |
161 { |
120 { |
162 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncAppEngine::OpenL:" ); |
121 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncAppEngine::OpenL:" ); |
163 |
122 |
164 delete iProfile; |
123 delete iProfile; |
165 iProfile = NULL; |
124 iProfile = NULL; |
166 iProfile = CIAUpdateFWSyncProfile::NewL( KIAUpdateUiUid, &iSyncMLSession ); |
125 iProfile = CIAUpdateFWSyncProfile::NewL( &iSyncMLSession ); |
167 iProfile->OpenL( aProfileId, aOpenMode ); |
126 iProfile->OpenL( aProfileId, aOpenMode ); |
168 return iProfile; |
127 return iProfile; |
169 } |
128 } |
170 |
129 |
171 // ----------------------------------------------------------------------------- |
130 // ----------------------------------------------------------------------------- |
172 // CIAUpdateFWSyncAppEngine::Close |
131 // CIAUpdateFWSyncAppEngine::CloseProfile |
173 // ----------------------------------------------------------------------------- |
132 // ----------------------------------------------------------------------------- |
174 // |
133 // |
175 void CIAUpdateFWSyncAppEngine::CloseProfile() |
134 void CIAUpdateFWSyncAppEngine::CloseProfile() |
176 { |
135 { |
177 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncAppEngine::Close:" ); |
136 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncAppEngine::CloseProfile:" ); |
178 |
137 |
179 delete iProfile; |
138 delete iProfile; |
180 iProfile = NULL; |
139 iProfile = NULL; |
181 } |
140 } |
182 |
141 |
194 iSyncHandler->SynchronizeL( aServerName, |
153 iSyncHandler->SynchronizeL( aServerName, |
195 aProfileId, |
154 aProfileId, |
196 aConnectionBearer, |
155 aConnectionBearer, |
197 aUseFotaProgressNote); |
156 aUseFotaProgressNote); |
198 } |
157 } |
199 |
|
200 // ----------------------------------------------------------------------------- |
|
201 // CIAUpdateFWSyncAppEngine::SynchronizeL |
|
202 // ----------------------------------------------------------------------------- |
|
203 // |
|
204 void CIAUpdateFWSyncAppEngine::SynchronizeL( TDesC& aServerName, |
|
205 TInt aProfileId, |
|
206 TInt aJobId, |
|
207 TInt aConnectionBearer, |
|
208 const TBool aUseFotaProgressNote ) |
|
209 { |
|
210 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncAppEngine::SynchronizeL:" ); |
|
211 |
158 |
212 iSyncHandler->SynchronizeL( aServerName, |
|
213 aProfileId, |
|
214 aJobId, |
|
215 aConnectionBearer, |
|
216 aUseFotaProgressNote ); |
|
217 } |
|
218 |
|
219 |
|
220 // ----------------------------------------------------------------------------- |
|
221 // CIAUpdateFWSyncAppEngine::ServerIdFoundL |
|
222 // ----------------------------------------------------------------------------- |
|
223 // |
|
224 TBool CIAUpdateFWSyncAppEngine::ServerIdFoundL( const TDesC& aServerId, |
|
225 const TInt aProfileId ) |
|
226 { |
|
227 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncAppEngine::ServerIdFoundL:" ); |
|
228 |
|
229 RArray<TSmlProfileId> arr; |
|
230 iSyncMLSession.ListProfilesL( arr, ESmlDevMan ); |
|
231 TBool ret = EFalse; |
|
232 CleanupClosePushL(arr); |
|
233 |
|
234 for ( TInt index = 0; index < arr.Count(); index++ ) |
|
235 { |
|
236 TRAPD( error, OpenProfileL( arr[index], ESmlOpenRead ) ); |
|
237 if ( error == KErrNone ) |
|
238 { |
|
239 if ( aProfileId != Profile()->ProfileId() ) |
|
240 { |
|
241 TBuf<KNSmlMaxItemLength> buf; |
|
242 Profile()->GetServerId( buf ); |
|
243 if ( buf.Compare( aServerId ) == 0 ) |
|
244 { |
|
245 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncAppEngine::ServerIdFoundL: Match" ); |
|
246 ret = ETrue; |
|
247 CloseProfile(); |
|
248 break; |
|
249 } |
|
250 } |
|
251 CloseProfile(); |
|
252 } |
|
253 } |
|
254 CleanupStack::PopAndDestroy( &arr ); |
|
255 return ret; |
|
256 } |
|
257 |
|
258 // ----------------------------------------------------------------------------- |
|
259 // CIAUpdateFWSyncAppEngine::Compare |
|
260 // ----------------------------------------------------------------------------- |
|
261 // |
|
262 TInt CIAUpdateFWSyncAppEngine::Compare( const TDesC& aLeft, const TDesC& aRight ) |
|
263 { |
|
264 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncAppEngine::Compare:" ); |
|
265 |
|
266 // Empty Name() is always greater than non-empty Name() |
|
267 if (aLeft.Length() == 0 && aRight.Length() == 0) |
|
268 { |
|
269 return 0; |
|
270 } |
|
271 if (aLeft.Length() == 0) |
|
272 { |
|
273 return 1; |
|
274 } |
|
275 if (aRight.Length() == 0) |
|
276 { |
|
277 return -1; |
|
278 } |
|
279 |
|
280 // None of the Name()s was empty, use TDesC::CompareC to do the comparison. |
|
281 // This is from cntmodel. |
|
282 TCollationMethod collateMethod; |
|
283 // get the standard method |
|
284 collateMethod = *Mem::CollationMethodByIndex(0); |
|
285 // dont ignore punctuation and spaces |
|
286 collateMethod.iFlags |= TCollationMethod::EIgnoreNone; |
|
287 TInt comparison( aLeft.CompareC(aRight, 3, &collateMethod) ); |
|
288 return comparison; |
|
289 } |
|
290 |
|
291 // ----------------------------------------------------------------------------- |
|
292 // CIAUpdateFWSyncAppEngine::SyncRunning |
|
293 // ----------------------------------------------------------------------------- |
|
294 // |
|
295 TBool CIAUpdateFWSyncAppEngine::SyncRunning() |
|
296 { |
|
297 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncAppEngine::SyncRunning:" ); |
|
298 |
|
299 return iSyncHandler->SyncRunning(); |
|
300 } |
|
301 |
|
302 // ----------------------------------------------------------------------------- |
|
303 // CIAUpdateFWSyncAppEngine::CancelSyncL |
|
304 // ----------------------------------------------------------------------------- |
|
305 // |
|
306 void CIAUpdateFWSyncAppEngine::CancelSyncL() |
|
307 { |
|
308 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncAppEngine::CancelSyncL()" ); |
|
309 iSyncHandler->CancelSynchronizeL(); |
|
310 } |
|
311 |
159 |
312 // ----------------------------------------------------------------------------- |
160 // ----------------------------------------------------------------------------- |
313 // CIAUpdateFWSyncAppEngine::SyncCompleted |
161 // CIAUpdateFWSyncAppEngine::SyncCompleted |
314 // ----------------------------------------------------------------------------- |
162 // ----------------------------------------------------------------------------- |
315 // |
163 // |
316 void CIAUpdateFWSyncAppEngine::SyncCompleted( TNSmlStatus /*aStatus*/ ) |
164 void CIAUpdateFWSyncAppEngine::SyncCompleted( TNSmlStatus /*aStatus*/ ) |
317 { |
165 { |
318 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncAppEngine::SyncCompleted:" ); |
166 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncAppEngine::SyncCompleted:" ); |
319 |
|
320 /*if( iSyncObserver ) |
|
321 { |
|
322 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncAppEngine::SyncCompleted: inform observer" ); |
|
323 |
|
324 iSyncObserver->SyncComplete( aStatus ); |
|
325 } */ |
|
326 } |
167 } |
327 |
168 |
328 // ----------------------------------------------------------------------------- |
169 |
329 // CIAUpdateFWSyncAppEngine::RequestSyncStatus |
|
330 // ----------------------------------------------------------------------------- |
|
331 // |
|
332 /*void CIAUpdateFWSyncAppEngine::RequestSyncStatus( |
|
333 MNSmlDMSyncObserver* aSyncObserver ) |
|
334 { |
|
335 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncAppEngine::RequestSyncStatus:" ); |
|
336 |
|
337 if( aSyncObserver ) |
|
338 { |
|
339 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncAppEngine::RequestSyncStatus: added observer" ); |
|
340 iSyncObserver = aSyncObserver; |
|
341 } |
|
342 }*/ |
|
343 |
170 |
344 // End of File |
171 // End of File |