|
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include <s32mem.h> |
|
17 #include <vtzrules.h> |
|
18 #include <tzupdate.h> |
|
19 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
20 #include <tzusernames.h>//new file added for CTzUserNames which is publishedPartner |
|
21 #include <tzuserdefineddata.h> //new file added for CTzUserData which is publishedPartner |
|
22 #endif |
|
23 #include <tzlocalizedcityrecord.h> |
|
24 #include <tzlocalizedtimezonerecord.h> |
|
25 #include "timezonesession.h" |
|
26 #include "timezoneserver.h" |
|
27 |
|
28 CTzServerSession* CTzServerSession::NewL() |
|
29 { |
|
30 CTzServerSession* self = new (ELeave) CTzServerSession(); |
|
31 CleanupStack::PushL(self); |
|
32 self->ConstructL(); |
|
33 CleanupStack::Pop(); |
|
34 return self; |
|
35 } |
|
36 |
|
37 CTzServerSession::~CTzServerSession() |
|
38 { |
|
39 if (iPendingRequest) |
|
40 { |
|
41 iClientMessage.Complete(KErrCancel); |
|
42 iPendingRequest = EFalse; |
|
43 } |
|
44 |
|
45 TzServer()->SessionClosed(); |
|
46 |
|
47 delete iTzUserDataCache; |
|
48 |
|
49 iCitiesResultCache.ResetAndDestroy(); |
|
50 iCitiesResultCache.Close(); |
|
51 delete iTimeZoneResultCache; |
|
52 delete iCityResultCache; |
|
53 } |
|
54 |
|
55 CTzServerSession::CTzServerSession() |
|
56 { |
|
57 } |
|
58 |
|
59 void CTzServerSession::ConstructL() |
|
60 { |
|
61 iTzUserDataCache = CTzUserDataCache::NewL(); |
|
62 } |
|
63 |
|
64 // completes a pending client notifier |
|
65 void CTzServerSession::NotifyTZStatusChange(RTz::TTzChanges aChange, const TAny* aRequester) |
|
66 { |
|
67 if (static_cast<const CTzServerSession*>(aRequester) == this) |
|
68 { |
|
69 // no need informing the client making the change |
|
70 // he should look after him self |
|
71 return; |
|
72 } |
|
73 |
|
74 if (iPendingRequest) |
|
75 { |
|
76 iClientMessage.Complete(aChange); |
|
77 iPendingRequest = EFalse; |
|
78 } |
|
79 } |
|
80 |
|
81 // |
|
82 // Registers to receive notification to time and zone changes in the |
|
83 // Server |
|
84 TInt CTzServerSession::doRegisterTzChangeNotifier(const RMessage2& aMessage) |
|
85 { |
|
86 if (!iPendingRequest) |
|
87 { |
|
88 iClientMessage = aMessage; |
|
89 iPendingRequest = ETrue; |
|
90 } |
|
91 else |
|
92 { |
|
93 // the same client already requested such notice |
|
94 // Panic the client |
|
95 iPendingRequest = EFalse; |
|
96 aMessage.Panic(KTimeZoneServerName, RTz::EPanicNotificationRequestPending); |
|
97 |
|
98 return (KErrCancel); |
|
99 } |
|
100 |
|
101 return KRequestPending; |
|
102 } |
|
103 |
|
104 // |
|
105 // Cancels request to receive notification to time and zone changes in the |
|
106 // Server |
|
107 TInt CTzServerSession::doCancelRequestForTzChangeNoticeL(const RMessage2& /* aMessage */) |
|
108 { |
|
109 if (iPendingRequest) |
|
110 { |
|
111 iPendingRequest = EFalse; |
|
112 iClientMessage.Complete(KErrCancel); |
|
113 } |
|
114 else |
|
115 { |
|
116 User::Leave(KErrNotFound); |
|
117 } |
|
118 |
|
119 return KErrNone; |
|
120 } |
|
121 |
|
122 |
|
123 TInt CTzServerSession::doSetTimeZoneL(const RMessage2& aMessage) |
|
124 { |
|
125 CBufFlat* buffer = CBufFlat::NewL(KMaxTimeZoneIdSize); |
|
126 CleanupStack::PushL(buffer); |
|
127 |
|
128 // Read from client message buffer |
|
129 // reserve the full space |
|
130 buffer->ExpandL(0, KMaxTimeZoneIdSize); |
|
131 TPtr8 bufferPtr(buffer->Ptr(0) ); |
|
132 aMessage.ReadL(0, bufferPtr); |
|
133 |
|
134 RBufReadStream readStream; |
|
135 readStream.Open(*buffer); |
|
136 |
|
137 CTzId* zoneId = NULL; |
|
138 TRAPD(err, zoneId = CTzId::NewL(readStream)); |
|
139 |
|
140 // Panic the client if it sent invalid data that would cause the server to panic. |
|
141 if (err == KErrArgument) |
|
142 { |
|
143 CleanupStack::PopAndDestroy(buffer); |
|
144 aMessage.Panic(KTimeZoneServerName, RTz::EPanicInvalidArgument); |
|
145 return KRequestPending; |
|
146 } |
|
147 else |
|
148 { |
|
149 User::LeaveIfError(err); |
|
150 } |
|
151 |
|
152 CleanupStack::PushL(zoneId); |
|
153 const CTzId& KInZoneId = TzServer()->TimeZoneManager().SetTimeZoneL(*zoneId, this, ETrue); |
|
154 CleanupStack::PopAndDestroy(zoneId); |
|
155 |
|
156 // return the new setting |
|
157 buffer->Reset(); |
|
158 RBufWriteStream writeStream; |
|
159 writeStream.Open(*buffer); |
|
160 KInZoneId.ExternalizeL(writeStream); |
|
161 writeStream.CommitL(); |
|
162 writeStream.Close(); |
|
163 |
|
164 // Write to client message buffer |
|
165 aMessage.WriteL(1, buffer->Ptr(0)); |
|
166 |
|
167 CleanupStack::PopAndDestroy(buffer); |
|
168 |
|
169 return (KErrNone); |
|
170 } |
|
171 |
|
172 TInt CTzServerSession::doIsDaylightSavingOnL(const RMessage2& aMessage) |
|
173 { |
|
174 CBufFlat* buffer = CBufFlat::NewL(KMaxTimeZoneIdSize); |
|
175 CleanupStack::PushL(buffer); |
|
176 // Read from client message buffer |
|
177 // reserve the full space |
|
178 buffer->ExpandL(0, KMaxTimeZoneIdSize); |
|
179 TPtr8 bufferPtr(buffer->Ptr(0) ); |
|
180 aMessage.ReadL(0, bufferPtr); |
|
181 |
|
182 TPckgBuf<TTime> timeBuffer; |
|
183 aMessage.ReadL(1, timeBuffer); |
|
184 |
|
185 TTime time(timeBuffer()); |
|
186 |
|
187 RBufReadStream readStream; |
|
188 readStream.Open(*buffer); |
|
189 |
|
190 CTzId* zoneId = NULL; |
|
191 TRAPD(err, zoneId = CTzId::NewL(readStream)); |
|
192 |
|
193 // Panic the client if it sent invalid data that would cause the server to panic. |
|
194 if (err == KErrArgument) |
|
195 { |
|
196 CleanupStack::PopAndDestroy(buffer); |
|
197 aMessage.Panic( KTimeZoneServerName, RTz::EPanicInvalidArgument ); |
|
198 return KRequestPending; |
|
199 } |
|
200 else |
|
201 { |
|
202 User::LeaveIfError(err); |
|
203 } |
|
204 |
|
205 CleanupStack::PushL(zoneId); |
|
206 |
|
207 if( time == Time::NullTTime()) |
|
208 { |
|
209 time.UniversalTime(); |
|
210 } |
|
211 |
|
212 TInt isDaylightSavingOn = TzServer()->TimeZoneManager().IsDaylightSavingOnL(*zoneId, time); |
|
213 CleanupStack::PopAndDestroy(zoneId); |
|
214 // Write to client message buffer |
|
215 TPckg<TInt> response(isDaylightSavingOn); |
|
216 aMessage.WriteL(2, response); |
|
217 CleanupStack::PopAndDestroy(buffer); |
|
218 return (KErrNone); |
|
219 } |
|
220 |
|
221 TInt CTzServerSession::doGetLocalTimeZoneIdL(const RMessage2& aMessage) |
|
222 { |
|
223 const CTzId& KZoneId = TzServer()->TimeZoneManager().GetTimeZoneIdL(); |
|
224 |
|
225 CBufFlat* buffer = CBufFlat::NewL(KMaxTimeZoneIdSize); |
|
226 CleanupStack::PushL(buffer); |
|
227 |
|
228 RBufWriteStream writeStream; |
|
229 writeStream.Open(*buffer); |
|
230 |
|
231 KZoneId.ExternalizeL(writeStream); |
|
232 |
|
233 writeStream.CommitL(); |
|
234 writeStream.Close(); |
|
235 |
|
236 // Write to client message buffer |
|
237 aMessage.WriteL(0, buffer->Ptr(0)); |
|
238 |
|
239 CleanupStack::PopAndDestroy(buffer); |
|
240 return (KErrNone); |
|
241 |
|
242 } |
|
243 |
|
244 TInt CTzServerSession::doGetLocalEncodedTimeZoneRulesL(const RMessage2& aMessage) |
|
245 { |
|
246 TPckgBuf<TInt> rulesSizeBuffer; |
|
247 aMessage.ReadL(0, rulesSizeBuffer); |
|
248 |
|
249 // Check if rules size buffer is valid. Panic the client if it sent |
|
250 // invalid data that would cause the server to panic. |
|
251 TInt size = rulesSizeBuffer(); |
|
252 const TInt KMaxSize = KMaxTInt / 2; |
|
253 if (size <= 0 || size >= KMaxSize) |
|
254 { |
|
255 aMessage.Panic( KTimeZoneServerName, RTz::EPanicInvalidArgument ); |
|
256 return KRequestPending; |
|
257 } |
|
258 |
|
259 CBufFlat* buffer = CBufFlat::NewL(rulesSizeBuffer()); |
|
260 CleanupStack::PushL(buffer); |
|
261 |
|
262 const CTzRules& KRules = TzServer()->TimeZoneManager().GetEncodedTimeZoneRulesL(); |
|
263 |
|
264 // Externalise rules |
|
265 RBufWriteStream writeStream; |
|
266 writeStream.Open(*buffer); |
|
267 |
|
268 TRAPD(err, KRules.ExternalizeL(writeStream)); |
|
269 // If the stream contains invalid data that would cause the server to panic |
|
270 // then panic the client. |
|
271 if (err == KErrArgument) |
|
272 { |
|
273 CleanupStack::PopAndDestroy(buffer); |
|
274 aMessage.Panic( KTimeZoneServerName, RTz::EPanicInvalidArgument ); |
|
275 return KRequestPending; |
|
276 } |
|
277 else |
|
278 { |
|
279 User::LeaveIfError(err); |
|
280 } |
|
281 |
|
282 writeStream.CommitL(); |
|
283 writeStream.Close(); |
|
284 |
|
285 // Write to client message buffer |
|
286 aMessage.WriteL(1, buffer->Ptr(0)); |
|
287 |
|
288 CleanupStack::PopAndDestroy(buffer); |
|
289 return KErrNone; |
|
290 } |
|
291 |
|
292 TInt CTzServerSession::doGetLocalEncodedTimeZoneRulesSizeL(const RMessage2& aMessage) |
|
293 { |
|
294 TPckgBuf<TTime> startTimeBuffer; |
|
295 aMessage.ReadL(0, startTimeBuffer); |
|
296 |
|
297 TPckgBuf<TTime> endTimeBuffer; |
|
298 aMessage.ReadL(1, endTimeBuffer); |
|
299 |
|
300 TPckgBuf<TTzTimeReference> timeRefBuffer; |
|
301 aMessage.ReadL(2, timeRefBuffer); |
|
302 |
|
303 TInt rulesSize = TzServer()->TimeZoneManager().GetEncodedTimeZoneRulesSizeL(startTimeBuffer(), endTimeBuffer(), |
|
304 timeRefBuffer()); |
|
305 |
|
306 // Write to client message buffer |
|
307 TPckgBuf<TInt> rulesSizeBuffer(rulesSize); |
|
308 aMessage.WriteL(3, rulesSizeBuffer); |
|
309 |
|
310 return KErrNone; |
|
311 } |
|
312 |
|
313 TInt CTzServerSession::doGetForeignEncodedTimeZoneRulesL(const RMessage2& aMessage) |
|
314 { |
|
315 TPckgBuf<TInt> rulesSizeBuffer; |
|
316 aMessage.ReadL(0, rulesSizeBuffer); |
|
317 |
|
318 // Check if rules size buffer is invalid. Panic the client if it sent |
|
319 // invalid data that would cause the server to panic. |
|
320 TInt size = rulesSizeBuffer(); |
|
321 const TInt KMaxSize = KMaxTInt/2; |
|
322 if (size <= 0 || size >= KMaxSize) |
|
323 { |
|
324 aMessage.Panic( KTimeZoneServerName, RTz::EPanicInvalidArgument ); |
|
325 return KRequestPending; |
|
326 } |
|
327 |
|
328 CBufFlat* buffer = CBufFlat::NewL(rulesSizeBuffer()); |
|
329 CleanupStack::PushL(buffer); |
|
330 |
|
331 const CTzRules& KRules = TzServer()->TimeZoneManager().GetForeignEncodedTimeZoneRulesL(); |
|
332 |
|
333 // Externalise rules |
|
334 RBufWriteStream writeStream; |
|
335 writeStream.Open(*buffer); |
|
336 // If the stream contains invalid data that would cause the server to panic |
|
337 // then panic the client. |
|
338 TRAPD(err, KRules.ExternalizeL(writeStream)); |
|
339 if (err == KErrArgument) |
|
340 { |
|
341 CleanupStack::PopAndDestroy(buffer); |
|
342 aMessage.Panic( KTimeZoneServerName, RTz::EPanicInvalidArgument ); |
|
343 return KRequestPending; |
|
344 } |
|
345 else |
|
346 { |
|
347 User::LeaveIfError(err); |
|
348 } |
|
349 |
|
350 writeStream.CommitL(); |
|
351 writeStream.Close(); |
|
352 |
|
353 // Write to client message buffer |
|
354 aMessage.WriteL(1, buffer->Ptr(0)); |
|
355 |
|
356 CleanupStack::PopAndDestroy(buffer); |
|
357 return KErrNone; |
|
358 } |
|
359 |
|
360 TInt CTzServerSession::doGetForeignEncodedTimeZoneRulesSizeL(const RMessage2& aMessage) |
|
361 { |
|
362 TPckgBuf<TTime> startTimeBuffer; |
|
363 aMessage.ReadL(0, startTimeBuffer); |
|
364 |
|
365 TPckgBuf<TTime> endTimeBuffer; |
|
366 aMessage.ReadL(1, endTimeBuffer); |
|
367 |
|
368 // Read from client message buffer |
|
369 // reserve the full space |
|
370 CBufFlat* buffer = CBufFlat::NewL(KMaxTimeZoneIdSize + sizeof(TTzTimeReference)); |
|
371 CleanupStack::PushL(buffer); |
|
372 |
|
373 buffer->ExpandL(0, KMaxTimeZoneIdSize + sizeof(TTzTimeReference)); |
|
374 TPtr8 bufferPtr(buffer->Ptr(0) ); |
|
375 aMessage.ReadL(2, bufferPtr); |
|
376 |
|
377 RBufReadStream readStream; |
|
378 readStream.Open(*buffer); |
|
379 |
|
380 CTzId* zoneId = NULL; |
|
381 TRAPD(err, zoneId = CTzId::NewL(readStream)); |
|
382 // If the stream contains invalid data that would cause the server to panic |
|
383 // then panic the client. |
|
384 if (err == KErrArgument) |
|
385 { |
|
386 CleanupStack::PopAndDestroy(buffer); |
|
387 aMessage.Panic( KTimeZoneServerName, RTz::EPanicInvalidArgument ); |
|
388 return KRequestPending; |
|
389 } |
|
390 else |
|
391 { |
|
392 User::LeaveIfError(err); |
|
393 } |
|
394 |
|
395 CleanupStack::PushL(zoneId); |
|
396 |
|
397 TTzTimeReference timeRef(static_cast<TTzTimeReference>(readStream.ReadInt8L() ) ); |
|
398 TPckgBuf<TTzTimeReference> timeRefBuffer(timeRef); |
|
399 |
|
400 TInt rulesSize = TzServer()->TimeZoneManager().GetForeignEncodedTimeZoneRulesSizeL(*zoneId, startTimeBuffer(), |
|
401 endTimeBuffer(), timeRefBuffer()); |
|
402 |
|
403 |
|
404 // Write to client message buffer |
|
405 TPckgBuf<TInt> rulesSizeBuffer(rulesSize); |
|
406 aMessage.WriteL(3, rulesSizeBuffer); |
|
407 |
|
408 CleanupStack::PopAndDestroy(2,buffer); |
|
409 return KErrNone; |
|
410 } |
|
411 |
|
412 TInt CTzServerSession::doConvertLocalZoneTimeL(const RMessage2& aMessage) |
|
413 { |
|
414 TPckgBuf<TTime> timeBuffer; |
|
415 aMessage.ReadL(0, timeBuffer); |
|
416 |
|
417 TPckgBuf<TTzTimeReference> timerRefBuffer; |
|
418 aMessage.ReadL(1, timerRefBuffer); |
|
419 |
|
420 TTime time(timeBuffer()); |
|
421 TzServer()->TimeZoneManager().ConvertL(time, timerRefBuffer()); |
|
422 |
|
423 // Write to client message buffer |
|
424 TPckg<TTime> timeInBuffer(time); |
|
425 aMessage.WriteL(2, timeInBuffer); |
|
426 |
|
427 return (KErrNone); |
|
428 } |
|
429 |
|
430 |
|
431 TInt CTzServerSession::doConvertForeignZoneTimeL(const RMessage2& aMessage) |
|
432 { |
|
433 TPckgBuf<TTime> timeBuffer; |
|
434 aMessage.ReadL(0, timeBuffer); |
|
435 |
|
436 TPckgBuf<TTzTimeReference> timerRefBuffer; |
|
437 aMessage.ReadL(1, timerRefBuffer); |
|
438 |
|
439 // Read from client message buffer |
|
440 // reserve the full space |
|
441 CBufFlat* buffer = CBufFlat::NewL(KMaxTimeZoneIdSize); |
|
442 CleanupStack::PushL(buffer); |
|
443 |
|
444 buffer->ExpandL(0, KMaxTimeZoneIdSize); |
|
445 TPtr8 bufferPtr(buffer->Ptr(0) ); |
|
446 aMessage.ReadL(2, bufferPtr); |
|
447 |
|
448 RBufReadStream readStream; |
|
449 readStream.Open(*buffer); |
|
450 |
|
451 CTzId* zoneId = NULL; |
|
452 TRAPD(err, zoneId = CTzId::NewL(readStream)); |
|
453 // If the stream contains invalid data that would cause the server to panic |
|
454 // then panic the client. |
|
455 if (err == KErrArgument) |
|
456 { |
|
457 CleanupStack::PopAndDestroy(buffer); |
|
458 aMessage.Panic( KTimeZoneServerName, RTz::EPanicInvalidArgument ); |
|
459 return KRequestPending; |
|
460 } |
|
461 else |
|
462 { |
|
463 User::LeaveIfError(err); |
|
464 } |
|
465 |
|
466 CleanupStack::PushL(zoneId); |
|
467 |
|
468 TTime time(timeBuffer() ); |
|
469 TzServer()->TimeZoneManager().ConvertL(*zoneId, time, timerRefBuffer()); |
|
470 |
|
471 // Write to client message buffer |
|
472 TPckg<TTime> timeInBuffer(time); |
|
473 aMessage.WriteL(3, timeInBuffer); |
|
474 |
|
475 CleanupStack::PopAndDestroy(2); |
|
476 return (KErrNone); |
|
477 } |
|
478 |
|
479 /** |
|
480 Retrieves UTC offset for a number of time zone ids |
|
481 */ |
|
482 TInt CTzServerSession::doGetOffsetsForTimeZoneIdsL(const RMessage2& aMessage) const |
|
483 { |
|
484 TInt bufferSize = aMessage.Int0(); |
|
485 |
|
486 // If buffer size invalid then panic client. |
|
487 const TInt KMaxSize = KMaxTInt / 4; |
|
488 if (bufferSize <= 0 || bufferSize > KMaxSize) |
|
489 { |
|
490 aMessage.Panic( KTimeZoneServerName, RTz::EPanicInvalidArgument ); |
|
491 return KRequestPending; |
|
492 } |
|
493 |
|
494 CBufFlat* idBuf = CBufFlat::NewL(bufferSize); |
|
495 CleanupStack::PushL(idBuf); |
|
496 idBuf->ExpandL(0,bufferSize); |
|
497 TPtr8 bufferPtr = idBuf->Ptr(0); |
|
498 aMessage.ReadL(1, bufferPtr); |
|
499 |
|
500 CTzConfigAgent& configAgent = TzServer()->TimeZoneManager(); |
|
501 configAgent.GetOffsetsForTimeZoneIdsL(*idBuf); |
|
502 |
|
503 // Write to client message buffer |
|
504 aMessage.WriteL(1, idBuf->Ptr(0)); |
|
505 |
|
506 CleanupStack::PopAndDestroy(idBuf); |
|
507 |
|
508 return KErrNone; |
|
509 } |
|
510 |
|
511 /** |
|
512 Sets the configuration of the UTC Offset auto-update functionality. |
|
513 |
|
514 @param aMessage The client-server message parameter. |
|
515 @return An error code. |
|
516 @internalComponent |
|
517 @capability ECapabilityWriteDeviceData Write Device Data capability is needed |
|
518 to be able to set the UTC Offset auto-update configuration. This prevents |
|
519 non-system applications from altering the settings. |
|
520 */ |
|
521 TInt CTzServerSession::doSetAutoUpdateBehaviorL(const RMessage2& aMessage) |
|
522 { |
|
523 // Configuration value is stored in message slot zero. |
|
524 TzServer()->TimeZoneManager().SetAutoUpdateBehaviorL(aMessage.Int0()); |
|
525 return KErrNone; |
|
526 } |
|
527 /** |
|
528 Retrieves the auto update value |
|
529 */ |
|
530 TInt CTzServerSession::doAutoUpdateSettingL(const RMessage2& aMessage) |
|
531 { |
|
532 TInt autoUpdate = TzServer()->TimeZoneManager().AutoUpdateSetting(); |
|
533 // Write to client message buffer |
|
534 TPckg<TInt> response(autoUpdate); |
|
535 aMessage.WriteL(0, response); |
|
536 return (KErrNone); |
|
537 } |
|
538 |
|
539 TInt CTzServerSession::doNotifyHomeTimeZoneChanged(const RMessage2& aMessage) |
|
540 { |
|
541 NTzUpdate::TTimeZoneChange change; |
|
542 change.iNewTimeZoneId = aMessage.Int0(); |
|
543 change.iOldTimeZoneId = aMessage.Int1(); |
|
544 |
|
545 TPckgBuf<NTzUpdate::TTimeZoneChange> changeBuf(change); |
|
546 return RProperty::Set(NTzUpdate::KPropertyCategory, NTzUpdate::EHomeTimeZoneId, changeBuf); |
|
547 } |
|
548 |
|
549 TInt CTzServerSession::doSetHomeTimeL(const RMessage2& aMessage) |
|
550 { |
|
551 TPckgBuf<TTime> homeTimeBuffer; |
|
552 aMessage.ReadL(0, homeTimeBuffer); |
|
553 return TzServer()->TimeZoneManager().SetHomeTimeL(homeTimeBuffer()); |
|
554 } |
|
555 |
|
556 TInt CTzServerSession::doSetUnknownZoneTimeL(const RMessage2& aMessage) |
|
557 { |
|
558 TPckgBuf<TTime> utcTimeBuffer; |
|
559 TPckgBuf<TInt> utcOffset; |
|
560 TPckgBuf<TBool> persist; |
|
561 aMessage.ReadL(0, utcTimeBuffer); |
|
562 aMessage.ReadL(1, utcOffset); |
|
563 aMessage.ReadL(2, persist); |
|
564 |
|
565 return TzServer()->TimeZoneManager().SetUnknownTimeZoneTimeL(utcTimeBuffer(),utcOffset(),persist()); |
|
566 } |
|
567 |
|
568 /** |
|
569 * Creates user defined time zone |
|
570 * Arguments: 0 : Input - Buffer Size |
|
571 * 1 : Input - Data Buffer contains time zone info |
|
572 * 2 : Output - ID of the time zone created |
|
573 */ |
|
574 TInt CTzServerSession::doCreateUserTimeZoneL(const RMessage2& aMessage) |
|
575 { |
|
576 const TInt buffersize = aMessage.Int0(); |
|
577 |
|
578 CBufFlat* buffer = CBufFlat::NewL(buffersize); |
|
579 CleanupStack::PushL(buffer); |
|
580 |
|
581 buffer->ExpandL(0, buffersize); |
|
582 TPtr8 bufferPtr(buffer->Ptr(0) ); |
|
583 aMessage.ReadL(1, bufferPtr); |
|
584 |
|
585 RBufReadStream readStream; |
|
586 CleanupClosePushL(readStream); |
|
587 readStream.Open(*buffer); |
|
588 |
|
589 CTzRules* rules = NULL; |
|
590 TRAPD(err, rules = CTzRules::NewL(readStream)); |
|
591 |
|
592 // Panic the client if it sent invalid data that would cause the server to panic. |
|
593 if (err == KErrArgument) |
|
594 { |
|
595 CleanupStack::PopAndDestroy(2, buffer); |
|
596 aMessage.Panic(KTimeZoneServerName, RTz::EPanicInvalidArgument); |
|
597 return KRequestPending; |
|
598 } |
|
599 else |
|
600 { |
|
601 User::LeaveIfError(err); |
|
602 } |
|
603 |
|
604 CleanupStack::PushL(rules); |
|
605 |
|
606 CTzUserNames* names = CTzUserNames::NewL(readStream); |
|
607 CleanupStack::PushL(names); |
|
608 TInt id = TzServer()->UserTimeZoneDb().CreateTzL(*rules, *names); |
|
609 CleanupStack::PopAndDestroy(4, buffer); |
|
610 TPckgBuf<TInt> idBuffer(id); |
|
611 aMessage.WriteL(2, idBuffer); |
|
612 return KErrNone; |
|
613 } |
|
614 |
|
615 /** |
|
616 * Update a user defined time zone |
|
617 * Arguments: 0 : Input - Size of data buffer |
|
618 * 1 : Input - Data buffer contained time zone info |
|
619 * 2 : Input - ID of thetTime zone to be updated |
|
620 */ |
|
621 TInt CTzServerSession::doUpdateUserTimeZoneL(const RMessage2& aMessage) |
|
622 { |
|
623 const TInt buffersize = aMessage.Int0(); |
|
624 |
|
625 CBufFlat* buffer = CBufFlat::NewL(buffersize); |
|
626 CleanupStack::PushL(buffer); |
|
627 |
|
628 buffer->ExpandL(0, buffersize); |
|
629 TPtr8 bufferPtr(buffer->Ptr(0) ); |
|
630 aMessage.ReadL(1, bufferPtr); |
|
631 |
|
632 RBufReadStream readStream; |
|
633 CleanupClosePushL(readStream); |
|
634 readStream.Open(*buffer); |
|
635 |
|
636 CTzRules* rules = NULL; |
|
637 TRAPD(err, rules = CTzRules::NewL(readStream)); |
|
638 |
|
639 // Panic the client if it sent invalid data that would cause the server to panic. |
|
640 if (err == KErrArgument) |
|
641 { |
|
642 CleanupStack::PopAndDestroy(2, buffer); |
|
643 aMessage.Panic(KTimeZoneServerName, RTz::EPanicInvalidArgument); |
|
644 return KRequestPending; |
|
645 } |
|
646 else |
|
647 { |
|
648 User::LeaveIfError(err); |
|
649 } |
|
650 |
|
651 CleanupStack::PushL(rules); |
|
652 |
|
653 CTzUserNames* names = CTzUserNames::NewL(readStream);; |
|
654 CleanupStack::PushL(names); |
|
655 |
|
656 const TInt id = aMessage.Int2(); |
|
657 |
|
658 TzServer()->UserTimeZoneDb().UpdateTzL(id, *rules, *names); |
|
659 CleanupStack::PopAndDestroy(4, buffer); |
|
660 return KErrNone; |
|
661 } |
|
662 |
|
663 /** |
|
664 * Delete a user defined time zone |
|
665 * Arguments: 0 : Input - Time Zone ID |
|
666 */ |
|
667 TInt CTzServerSession::doDeleteUserTimeZoneL(const RMessage2& aMessage) |
|
668 { |
|
669 const TInt id = aMessage.Int0(); |
|
670 TzServer()->UserTimeZoneDb().DeleteTzL(id); |
|
671 return KErrNone; |
|
672 } |
|
673 |
|
674 /** |
|
675 * Gets the size of user defined time zone names |
|
676 * Arguments: 0 : Input - Time Zone ID |
|
677 * 1 : Output - size of time zone names |
|
678 */ |
|
679 TInt CTzServerSession::doGetUserTimeZoneNamesSizeL(const RMessage2& aMessage) |
|
680 { |
|
681 const TInt id = aMessage.Int0(); |
|
682 TInt sizeOfNames = 0; |
|
683 //ReadTzNamesL leaves if there is not a names found |
|
684 CTzUserNames* names = TzServer()->UserTimeZoneDb().ReadTzNamesL(id); |
|
685 iTzUserDataCache->SetNames(names); |
|
686 sizeOfNames = iTzUserDataCache->SizeOfNames(); |
|
687 // Write to client message buffer |
|
688 TPckgBuf<TInt> nameSizeBuffer(sizeOfNames); |
|
689 aMessage.WriteL(1, nameSizeBuffer); |
|
690 |
|
691 return KErrNone; |
|
692 } |
|
693 |
|
694 /** |
|
695 * Gets user defined time zone names |
|
696 * Arguments: 0 : Output - Data buffer contained time zone name |
|
697 */ |
|
698 TInt CTzServerSession::doGetUserTimeZoneNamesL(const RMessage2& aMessage) |
|
699 { |
|
700 TInt size = iTzUserDataCache->SizeOfNames(); |
|
701 CBufFlat* buffer = CBufFlat::NewL(size); |
|
702 CleanupStack::PushL(buffer); |
|
703 buffer->ExpandL(0,size); |
|
704 |
|
705 RBufWriteStream writeStream; |
|
706 CleanupClosePushL(writeStream); |
|
707 writeStream.Open(*buffer); |
|
708 const CTzUserNames& names = iTzUserDataCache->GetNames(); |
|
709 writeStream << names; |
|
710 writeStream.CommitL(); |
|
711 aMessage.WriteL(0, buffer->Ptr(0)); |
|
712 CleanupStack::PopAndDestroy(2, buffer); |
|
713 return KErrNone; |
|
714 } |
|
715 |
|
716 /** |
|
717 * Gets the size of user defined time zone Ids |
|
718 * Arguments: 0 : Output - Size of time zone IDs |
|
719 */ |
|
720 TInt CTzServerSession::doGetUserTimeZoneIdsSizeL(const RMessage2& aMessage) |
|
721 { |
|
722 RArray<TUint32> ids; |
|
723 CleanupClosePushL(ids); |
|
724 TzServer()->UserTimeZoneDb().ReadTzIdsL(ids); |
|
725 iTzUserDataCache->SetIdsL(ids); |
|
726 CleanupStack::PopAndDestroy(&ids); |
|
727 |
|
728 TInt idsSize = iTzUserDataCache->SizeOfIds(); |
|
729 // Write to client message buffer |
|
730 TPckgBuf<TInt> idsSizeBuffer(idsSize); |
|
731 aMessage.WriteL(0, idsSizeBuffer); |
|
732 return KErrNone; |
|
733 } |
|
734 |
|
735 /** |
|
736 * Gets the user defined time zone Ids |
|
737 * Arguments: 0 : Output - Data buffer contained time zone IDs |
|
738 */ |
|
739 TInt CTzServerSession::doGetUserTimeZoneIdsL(const RMessage2& aMessage) |
|
740 { |
|
741 CBufFlat* buffer = CBufFlat::NewL(iTzUserDataCache->SizeOfIds()); |
|
742 CleanupStack::PushL(buffer); |
|
743 buffer->ExpandL(0,iTzUserDataCache->SizeOfIds()); |
|
744 |
|
745 RBufWriteStream writeStream; |
|
746 CleanupClosePushL(writeStream); |
|
747 writeStream.Open(*buffer); |
|
748 TArray<TUint32> ids = iTzUserDataCache->GetIds(); |
|
749 TInt count = ids.Count(); |
|
750 writeStream.WriteInt16L(count); |
|
751 for (TInt ii=0; ii<count; ++ii) |
|
752 { |
|
753 writeStream.WriteUint32L((ids)[ii]); |
|
754 } |
|
755 writeStream.CommitL(); |
|
756 aMessage.WriteL(0, buffer->Ptr(0)); |
|
757 CleanupStack::PopAndDestroy(2, buffer); |
|
758 return KErrNone; |
|
759 } |
|
760 |
|
761 TInt CTzServerSession::doGetHeapSizeL(const RMessage2& aMessage) |
|
762 { |
|
763 TInt reply = User::Heap().Count(); |
|
764 TInt sizeInBytes; |
|
765 reply = User::AllocSize(sizeInBytes); |
|
766 TPckg<TInt> heapCellsBuffer(reply); |
|
767 TPckg<TInt> heapsizeBuffer(sizeInBytes); |
|
768 aMessage.WriteL(0, heapCellsBuffer); |
|
769 aMessage.WriteL(1, heapsizeBuffer); |
|
770 return reply; |
|
771 } |
|
772 |
|
773 TInt CTzServerSession::doLocalizationReadCitiesSizeL(const RMessage2& aMessage) |
|
774 { |
|
775 iCitiesResultCache.ResetAndDestroy(); |
|
776 TzServer()->LocalizationDb().ReadCitiesL(iCitiesResultCache); |
|
777 TInt resultSize = CTzLocalizedCityRecord::ExternalizeSize(iCitiesResultCache); |
|
778 |
|
779 // Write to client message buffer |
|
780 TPckgBuf<TInt> resultSizeBuffer(resultSize); |
|
781 aMessage.WriteL(0, resultSizeBuffer); |
|
782 |
|
783 return KErrNone; |
|
784 } |
|
785 |
|
786 TInt CTzServerSession::doLocalizationReadCitiesTzIdSizeL(const RMessage2& aMessage) |
|
787 { |
|
788 iCitiesResultCache.ResetAndDestroy(); |
|
789 TzServer()->LocalizationDb().ReadCitiesL(iCitiesResultCache, aMessage.Int1()); |
|
790 TInt resultSize = CTzLocalizedCityRecord::ExternalizeSize(iCitiesResultCache); |
|
791 |
|
792 // Write to client message buffer |
|
793 TPckgBuf<TInt> resultSizeBuffer(resultSize); |
|
794 aMessage.WriteL(0, resultSizeBuffer); |
|
795 |
|
796 return KErrNone; |
|
797 } |
|
798 |
|
799 TInt CTzServerSession::doLocalizationReadCitiesInGroupSizeL(const RMessage2& aMessage) |
|
800 { |
|
801 iCitiesResultCache.ResetAndDestroy(); |
|
802 TzServer()->LocalizationDb().ReadCitiesInGroupL(iCitiesResultCache, aMessage.Int1()); |
|
803 TInt resultSize = CTzLocalizedCityRecord::ExternalizeSize(iCitiesResultCache); |
|
804 |
|
805 // Write to client message buffer |
|
806 TPckgBuf<TInt> resultSizeBuffer(resultSize); |
|
807 aMessage.WriteL(0, resultSizeBuffer); |
|
808 |
|
809 return KErrNone; |
|
810 } |
|
811 |
|
812 TInt CTzServerSession::doLocalizationReadCitiesL(const RMessage2& aMessage) |
|
813 { |
|
814 TInt maxSize = aMessage.GetDesLengthL(0); |
|
815 CBufFlat* buffer = CBufFlat::NewL(maxSize); |
|
816 CleanupStack::PushL(buffer); |
|
817 |
|
818 RBufWriteStream writeStream; |
|
819 writeStream.Open(*buffer); |
|
820 CleanupClosePushL(writeStream); |
|
821 CTzLocalizedCityRecord::ExternalizeL(iCitiesResultCache, writeStream); |
|
822 writeStream.CommitL(); |
|
823 iCitiesResultCache.ResetAndDestroy(); |
|
824 CleanupStack::PopAndDestroy(&writeStream); |
|
825 |
|
826 // Write to client message buffer |
|
827 aMessage.WriteL(0, buffer->Ptr(0)); |
|
828 |
|
829 CleanupStack::PopAndDestroy(buffer); |
|
830 |
|
831 return KErrNone; |
|
832 } |
|
833 |
|
834 TInt CTzServerSession::doLocalizationReadFrequentlyUsedZoneSizeL(const RMessage2& aMessage) |
|
835 { |
|
836 delete iTimeZoneResultCache; |
|
837 iTimeZoneResultCache = 0; |
|
838 iTimeZoneResultCache = TzServer()->LocalizationDb().ReadFrequentlyUsedZoneL(aMessage.Int1()); |
|
839 TInt resultSize = iTimeZoneResultCache->ExternalizeSize(); |
|
840 |
|
841 // Write to client message buffer |
|
842 TPckgBuf<TInt> resultSizeBuffer(resultSize); |
|
843 aMessage.WriteL(0, resultSizeBuffer); |
|
844 |
|
845 return KErrNone; |
|
846 } |
|
847 |
|
848 TInt CTzServerSession::doLocalizationReadFrequentlyUsedZoneL(const RMessage2& aMessage) |
|
849 { |
|
850 TInt maxSize = aMessage.GetDesLengthL(0); |
|
851 CBufFlat* buffer = CBufFlat::NewL(maxSize); |
|
852 CleanupStack::PushL(buffer); |
|
853 |
|
854 RBufWriteStream writeStream; |
|
855 writeStream.Open(*buffer); |
|
856 CleanupClosePushL(writeStream); |
|
857 iTimeZoneResultCache->ExternalizeL(writeStream); |
|
858 writeStream.CommitL(); |
|
859 delete iTimeZoneResultCache; |
|
860 iTimeZoneResultCache = 0; |
|
861 CleanupStack::PopAndDestroy(&writeStream); |
|
862 |
|
863 // Write to client message buffer |
|
864 aMessage.WriteL(0, buffer->Ptr(0)); |
|
865 |
|
866 CleanupStack::PopAndDestroy(buffer); |
|
867 |
|
868 return KErrNone; |
|
869 } |
|
870 |
|
871 TInt CTzServerSession::doLocalizationReadCachedTimeZoneCitySizeL(const RMessage2& aMessage) |
|
872 { |
|
873 delete iCityResultCache; |
|
874 iCityResultCache = 0; |
|
875 iCityResultCache = TzServer()->LocalizationDb().ReadCachedTimeZoneCityL(aMessage.Int1()); |
|
876 TInt resultSize = iCityResultCache->ExternalizeSize(); |
|
877 |
|
878 // Write to client message buffer |
|
879 TPckgBuf<TInt> resultSizeBuffer(resultSize); |
|
880 aMessage.WriteL(0, resultSizeBuffer); |
|
881 |
|
882 return KErrNone; |
|
883 } |
|
884 |
|
885 TInt CTzServerSession::doLocalizationReadCachedTimeZoneCityL(const RMessage2& aMessage) |
|
886 { |
|
887 TInt maxSize = aMessage.GetDesLengthL(0); |
|
888 CBufFlat* buffer = CBufFlat::NewL(maxSize); |
|
889 CleanupStack::PushL(buffer); |
|
890 |
|
891 RBufWriteStream writeStream; |
|
892 writeStream.Open(*buffer); |
|
893 CleanupClosePushL(writeStream); |
|
894 iCityResultCache->ExternalizeL(writeStream); |
|
895 writeStream.CommitL(); |
|
896 delete iCityResultCache; |
|
897 iCityResultCache = 0; |
|
898 CleanupStack::PopAndDestroy(&writeStream); |
|
899 |
|
900 // Write to client message buffer |
|
901 aMessage.WriteL(0, buffer->Ptr(0)); |
|
902 |
|
903 CleanupStack::PopAndDestroy(buffer); |
|
904 |
|
905 return KErrNone; |
|
906 } |
|
907 |
|
908 TInt CTzServerSession::doLocalizationOpenDbL() |
|
909 { |
|
910 TzServer()->LocalizationDb().OpenDbL(); |
|
911 return KErrNone; |
|
912 } |
|
913 |
|
914 TInt CTzServerSession::doLocalizationCloseDb() |
|
915 { |
|
916 TzServer()->LocalizationDb().CloseDb(); |
|
917 return KErrNone; |
|
918 } |
|
919 |
|
920 TInt CTzServerSession::doLocalizationWriteCityL(const RMessage2& aMessage) |
|
921 { |
|
922 TInt length=aMessage.GetDesLengthL(0); |
|
923 HBufC* const cityName=HBufC::NewLC(length); |
|
924 TPtr cityNamePtr(cityName->Des()); |
|
925 aMessage.ReadL(0, cityNamePtr); |
|
926 |
|
927 TzServer()->LocalizationDb().WriteCityL(*cityName, (TUint16)aMessage.Int1(), aMessage.Int2(), aMessage.Int3()); |
|
928 |
|
929 CleanupStack::PopAndDestroy(cityName); |
|
930 |
|
931 return KErrNone; |
|
932 } |
|
933 |
|
934 TInt CTzServerSession::doLocalizationDeleteCityL(const RMessage2& aMessage) |
|
935 { |
|
936 TInt length=aMessage.GetDesLengthL(0); |
|
937 HBufC* const cityName=HBufC::NewLC(length); |
|
938 TPtr cityNamePtr(cityName->Des()); |
|
939 aMessage.ReadL(0, cityNamePtr); |
|
940 |
|
941 TzServer()->LocalizationDb().DeleteCityL(*cityName, (TUint16)aMessage.Int1()); |
|
942 |
|
943 CleanupStack::PopAndDestroy(cityName); |
|
944 |
|
945 return KErrNone; |
|
946 } |
|
947 |
|
948 TInt CTzServerSession::doLocalizationWriteFrequentlyUsedZoneL(const RMessage2& aMessage) |
|
949 { |
|
950 TInt length=aMessage.GetDesLengthL(0); |
|
951 CBufFlat* buffer = CBufFlat::NewL(length); |
|
952 CleanupStack::PushL(buffer); |
|
953 buffer->ExpandL(0,length); |
|
954 TPtr8 des(buffer->Ptr(0)); |
|
955 aMessage.ReadL(0,des); |
|
956 RBufReadStream readStream; |
|
957 readStream.Open(*buffer); |
|
958 CleanupClosePushL(readStream); |
|
959 CTzLocalizedTimeZoneRecord* timeZone = CTzLocalizedTimeZoneRecord::NewLC(readStream); |
|
960 CTzLocalizedCityRecord* city = CTzLocalizedCityRecord::NewLC(readStream); |
|
961 TInt frequentlyUsedZone = readStream.ReadInt32L(); |
|
962 |
|
963 TzServer()->LocalizationDb().WriteFrequentlyUsedZoneL(*timeZone, *city, frequentlyUsedZone); |
|
964 |
|
965 CleanupStack::PopAndDestroy(city); |
|
966 CleanupStack::PopAndDestroy(timeZone); |
|
967 CleanupStack::PopAndDestroy(&readStream); |
|
968 CleanupStack::PopAndDestroy(buffer); |
|
969 |
|
970 return KErrNone; |
|
971 } |
|
972 |
|
973 TInt CTzServerSession::doLocalizationWriteAllFrequentlyUsedZonesL(const RMessage2& aMessage) |
|
974 { |
|
975 TInt length=aMessage.GetDesLengthL(0); |
|
976 CBufFlat* buffer = CBufFlat::NewL(length); |
|
977 CleanupStack::PushL(buffer); |
|
978 buffer->ExpandL(0,length); |
|
979 TPtr8 des(buffer->Ptr(0)); |
|
980 aMessage.ReadL(0,des); |
|
981 RBufReadStream readStream; |
|
982 readStream.Open(*buffer); |
|
983 CleanupClosePushL(readStream); |
|
984 RPointerArray<CTzLocalizedTimeZoneRecord> timeZones; |
|
985 CleanupStack::PushL(TCleanupItem(CleanupTimeZonePointerArray,&timeZones)); |
|
986 CTzLocalizedTimeZoneRecord::InternalizeL(readStream, timeZones); |
|
987 RPointerArray<CTzLocalizedCityRecord> cities; |
|
988 CleanupStack::PushL(TCleanupItem(CleanupCityPointerArray,&cities)); |
|
989 CTzLocalizedCityRecord::InternalizeL(readStream, cities); |
|
990 |
|
991 TzServer()->LocalizationDb().WriteAllFrequentlyUsedZonesL(timeZones, cities); |
|
992 |
|
993 CleanupStack::PopAndDestroy(); // cities |
|
994 CleanupStack::PopAndDestroy(); // timeZones |
|
995 CleanupStack::PopAndDestroy(&readStream); |
|
996 CleanupStack::PopAndDestroy(buffer); |
|
997 |
|
998 return KErrNone; |
|
999 } |
|
1000 |
|
1001 TInt CTzServerSession::doSwiObsBeginL(const RMessage2& /*aMessage*/) |
|
1002 { |
|
1003 TzServer()->SwiObserver().BeginL(); |
|
1004 return KErrNone; |
|
1005 } |
|
1006 |
|
1007 TInt CTzServerSession::doSwiObsFileChangedL(const RMessage2& aMessage) |
|
1008 { |
|
1009 TzServer()->SwiObserver().FileChangedL((RTz::TSWIObserverFilterIndex)aMessage.Int0()); |
|
1010 return KErrNone; |
|
1011 } |
|
1012 |
|
1013 TInt CTzServerSession::doSwiObsEndL(const RMessage2& /*aMessage*/) |
|
1014 { |
|
1015 TzServer()->SwiObserver().EndL(); |
|
1016 return KErrNone; |
|
1017 } |
|
1018 |
|
1019 void CTzServerSession::ServiceL(const RMessage2& aMessage) |
|
1020 { |
|
1021 TInt reply = KErrNone; |
|
1022 switch(aMessage.Function()) |
|
1023 { |
|
1024 #if defined(_DEBUG) |
|
1025 case CTzServer::ESrvOpcodeResourceCount: |
|
1026 reply = doGetHeapSizeL(aMessage); |
|
1027 break; |
|
1028 case CTzServer::ESrvOpcodeSetHeapFailure: |
|
1029 User::__DbgSetAllocFail(RHeap::EUser,(RAllocator::TAllocFail)aMessage.Int0(),aMessage.Int1()); |
|
1030 break; |
|
1031 case CTzServer::ESrvOpcodeResetHeap: |
|
1032 User::__DbgSetAllocFail(FALSE,RAllocator::ENone,1); |
|
1033 iTzUserDataCache->Reset(); |
|
1034 TzServer()->TimeZoneManager().ResetForeignTimeZoneRulesCache(); |
|
1035 break; |
|
1036 #endif |
|
1037 case CTzServer::EConvertLocalZoneTime: |
|
1038 reply = doConvertLocalZoneTimeL(aMessage); |
|
1039 break; |
|
1040 case CTzServer::EConvertForeignZoneTime: |
|
1041 reply = doConvertForeignZoneTimeL(aMessage); |
|
1042 break; |
|
1043 case CTzServer::ESetTimeZone: |
|
1044 reply = doSetTimeZoneL(aMessage); |
|
1045 break; |
|
1046 case CTzServer::ENotifyHomeTimeZoneChanged: |
|
1047 reply = doNotifyHomeTimeZoneChanged(aMessage); |
|
1048 break; |
|
1049 case CTzServer::EGetLocalTimeZoneId: |
|
1050 reply = doGetLocalTimeZoneIdL(aMessage); |
|
1051 break; |
|
1052 case CTzServer::EGetLocalEncodedTimeZoneRules: |
|
1053 reply = doGetLocalEncodedTimeZoneRulesL(aMessage); |
|
1054 break; |
|
1055 case CTzServer::EGetLocalOlsenEncodedTimeZoneRules: |
|
1056 reply = KErrNotSupported; |
|
1057 break; |
|
1058 case CTzServer::EGetLocalEncodedTimeZoneRulesSize: |
|
1059 reply = doGetLocalEncodedTimeZoneRulesSizeL(aMessage); |
|
1060 break; |
|
1061 case CTzServer::EGetLocalOlsenEncodedTimeZoneRulesSize: |
|
1062 reply = KErrNotSupported; |
|
1063 break; |
|
1064 case CTzServer::EGetForeignEncodedTimeZoneRules: |
|
1065 reply = doGetForeignEncodedTimeZoneRulesL(aMessage); |
|
1066 break; |
|
1067 case CTzServer::EGetForeignEncodedTimeZoneRulesSize: |
|
1068 reply = doGetForeignEncodedTimeZoneRulesSizeL(aMessage); |
|
1069 break; |
|
1070 case CTzServer::ERegisterTimeChangeNotifier: |
|
1071 reply = doRegisterTzChangeNotifier(aMessage); |
|
1072 break; |
|
1073 case CTzServer::ECancelRequestforNotice: |
|
1074 reply = doCancelRequestForTzChangeNoticeL(aMessage); |
|
1075 break; |
|
1076 case CTzServer::EGetOffsetsForTimeZoneIds: |
|
1077 reply = doGetOffsetsForTimeZoneIdsL(aMessage); |
|
1078 break; |
|
1079 case CTzServer::EEnableAutoUpdate: |
|
1080 reply = doSetAutoUpdateBehaviorL(aMessage); |
|
1081 break; |
|
1082 case CTzServer::EIsDaylightSavingOn: |
|
1083 reply = doIsDaylightSavingOnL(aMessage); |
|
1084 break; |
|
1085 case CTzServer::EAutoUpdate: |
|
1086 reply = doAutoUpdateSettingL(aMessage); |
|
1087 break; |
|
1088 case CTzServer::ESetHomeTime: |
|
1089 reply = doSetHomeTimeL(aMessage); |
|
1090 break; |
|
1091 case CTzServer::ESetUnknownZoneTime: |
|
1092 reply = doSetUnknownZoneTimeL(aMessage); |
|
1093 break; |
|
1094 case CTzServer::EGetUserTimeZoneNames: |
|
1095 reply = doGetUserTimeZoneNamesL(aMessage); |
|
1096 break; |
|
1097 case CTzServer::EGetUserTimeZoneNamesSize: |
|
1098 reply = doGetUserTimeZoneNamesSizeL(aMessage); |
|
1099 break; |
|
1100 case CTzServer::EGetUserTimeZoneIds: |
|
1101 reply = doGetUserTimeZoneIdsL(aMessage); |
|
1102 break; |
|
1103 case CTzServer::EGetUserTimeZoneIdsSize: |
|
1104 reply = doGetUserTimeZoneIdsSizeL(aMessage); |
|
1105 break; |
|
1106 case CTzServer::ECreateUserTimeZone: |
|
1107 reply = doCreateUserTimeZoneL(aMessage); |
|
1108 break; |
|
1109 case CTzServer::EUpdateUserTimeZone: |
|
1110 reply = doUpdateUserTimeZoneL(aMessage); |
|
1111 break; |
|
1112 case CTzServer::EDeleteUserTimeZone: |
|
1113 reply = doDeleteUserTimeZoneL(aMessage); |
|
1114 break; |
|
1115 case CTzServer::ELocalizationReadCitiesSize: |
|
1116 reply = doLocalizationReadCitiesSizeL(aMessage); |
|
1117 break; |
|
1118 case CTzServer::ELocalizationReadCitiesTzIdSize: |
|
1119 reply = doLocalizationReadCitiesTzIdSizeL(aMessage); |
|
1120 break; |
|
1121 case CTzServer::ELocalizationReadCitiesInGroupSize: |
|
1122 reply = doLocalizationReadCitiesInGroupSizeL(aMessage); |
|
1123 break; |
|
1124 case CTzServer::ELocalizationReadCities: |
|
1125 reply = doLocalizationReadCitiesL(aMessage); |
|
1126 break; |
|
1127 case CTzServer::ELocalizationReadFrequentlyUsedZoneSize: |
|
1128 reply = doLocalizationReadFrequentlyUsedZoneSizeL(aMessage); |
|
1129 break; |
|
1130 case CTzServer::ELocalizationReadFrequentlyUsedZone: |
|
1131 reply = doLocalizationReadFrequentlyUsedZoneL(aMessage); |
|
1132 break; |
|
1133 case CTzServer::ELocalizationReadCachedTimeZoneCitySize: |
|
1134 reply = doLocalizationReadCachedTimeZoneCitySizeL(aMessage); |
|
1135 break; |
|
1136 case CTzServer::ELocalizationReadCachedTimeZoneCity: |
|
1137 reply = doLocalizationReadCachedTimeZoneCityL(aMessage); |
|
1138 break; |
|
1139 case CTzServer::ELocalizationOpenDb: |
|
1140 reply = doLocalizationOpenDbL(); |
|
1141 break; |
|
1142 case CTzServer::ELocalizationCloseDb: |
|
1143 reply = doLocalizationCloseDb(); |
|
1144 break; |
|
1145 case CTzServer::ELocalizationWriteCity: |
|
1146 reply = doLocalizationWriteCityL(aMessage); |
|
1147 break; |
|
1148 case CTzServer::ELocalizationDeleteCity: |
|
1149 reply = doLocalizationDeleteCityL(aMessage); |
|
1150 break; |
|
1151 case CTzServer::ELocalizationWriteFrequentlyUsedZone: |
|
1152 reply = doLocalizationWriteFrequentlyUsedZoneL(aMessage); |
|
1153 break; |
|
1154 case CTzServer::ELocalizationWriteAllFrequentlyUsedZones: |
|
1155 reply = doLocalizationWriteAllFrequentlyUsedZonesL(aMessage); |
|
1156 break; |
|
1157 case CTzServer::ESwiObsBegin: |
|
1158 reply = doSwiObsBeginL(aMessage); |
|
1159 break; |
|
1160 case CTzServer::ESwiObsFileChanged: |
|
1161 reply = doSwiObsFileChangedL(aMessage); |
|
1162 break; |
|
1163 case CTzServer::ESwiObsEnd: |
|
1164 reply = doSwiObsEndL(aMessage); |
|
1165 break; |
|
1166 default: |
|
1167 reply = KErrNotFound; |
|
1168 break; |
|
1169 } |
|
1170 |
|
1171 if (reply != KRequestPending) |
|
1172 { |
|
1173 aMessage.Complete(reply); |
|
1174 } |
|
1175 |
|
1176 #if defined(_DEBUG) |
|
1177 User::Heap().Check(); |
|
1178 #endif |
|
1179 } |
|
1180 |
|
1181 const CTzServer* CTzServerSession::TzServer() const |
|
1182 { |
|
1183 return static_cast<const CTzServer*>(Server()); |
|
1184 } |
|
1185 |
|
1186 void CTzServerSession::CleanupTimeZonePointerArray(TAny* aArray) |
|
1187 { |
|
1188 RPointerArray<CTzLocalizedTimeZoneRecord>* array = static_cast<RPointerArray<CTzLocalizedTimeZoneRecord>* >(aArray); |
|
1189 if (array) |
|
1190 { |
|
1191 array->ResetAndDestroy(); |
|
1192 array->Close(); |
|
1193 } |
|
1194 } |
|
1195 |
|
1196 void CTzServerSession::CleanupCityPointerArray(TAny* aArray) |
|
1197 { |
|
1198 RPointerArray<CTzLocalizedCityRecord>* array = static_cast<RPointerArray<CTzLocalizedCityRecord>* >(aArray); |
|
1199 if (array) |
|
1200 { |
|
1201 array->ResetAndDestroy(); |
|
1202 array->Close(); |
|
1203 } |
|
1204 } |