tzservices/tzserver/Client/Source/timezone.cpp
changeset 81 676b6116ca93
parent 0 2e3d3ce01487
equal deleted inserted replaced
78:175a0d824084 81:676b6116ca93
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    24 #include "tzrules.h"
    24 #include "tzrules.h"
    25 #include <s32mem.h>
    25 #include <s32mem.h>
    26 #include <vtzrules.h>
    26 #include <vtzrules.h>
    27 #include <tzupdate.h>
    27 #include <tzupdate.h>
    28 #include "tzruleholder.h"
    28 #include "tzruleholder.h"
       
    29 #include "OstTraceDefinitions.h"
       
    30 #ifdef OST_TRACE_COMPILER_IN_USE
       
    31 #include "timezoneTraces.h"
       
    32 #endif
       
    33 
    29 
    34 
    30 const TInt KNumConnectRetries = 5;
    35 const TInt KNumConnectRetries = 5;
    31 
    36 
    32 // Define server name
    37 // Define server name
    33 _LIT(KServerCode,"TZSERVER");
    38 _LIT(KServerCode,"TZSERVER");
    43 // 
    48 // 
    44 //Start the server process/thread which lives in an EPOCEXE object
    49 //Start the server process/thread which lives in an EPOCEXE object
    45 //
    50 //
    46 TInt RTz::StartServer()
    51 TInt RTz::StartServer()
    47 	{
    52 	{
       
    53     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, RTZ_STARTSERVER_ENTRY, "RTz::StartServer Entry" );
       
    54     
    48 	const TInt KIntServerType = 0x10004019;
    55 	const TInt KIntServerType = 0x10004019;
    49 	const TUidType serverUid(KNullUid,TUid::Uid(KIntServerType));
    56 	const TUidType serverUid(KNullUid,TUid::Uid(KIntServerType));
    50 	
    57 	
    51 	TRequestStatus started(KRequestPending);
    58 	TRequestStatus started(KRequestPending);
    52 	TRendezvous rendezvous;
    59 	TRendezvous rendezvous;
    58 						TPtrC(reinterpret_cast<TText*>(&rendezvous),
    65 						TPtrC(reinterpret_cast<TText*>(&rendezvous),
    59 						sizeof(rendezvous)/sizeof(TText)),serverUid);
    66 						sizeof(rendezvous)/sizeof(TText)),serverUid);
    60 
    67 
    61 	if (err != KErrNone)
    68 	if (err != KErrNone)
    62 		{
    69 		{
       
    70 	    OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, RTZ_STARTSERVER_EXIT, "RTz::StartServer Exit;err=%d", err );
       
    71 	    
    63 		return err;
    72 		return err;
    64 		}
    73 		}
    65 
    74 
    66 	server.SetPriority(EPriorityHigh);
    75 	server.SetPriority(EPriorityHigh);
    67 
    76 
    76 		server.Resume();	// logon OK - start the server
    85 		server.Resume();	// logon OK - start the server
    77 		}
    86 		}
    78 	User::WaitForRequest(stat);		// wait for start or death
    87 	User::WaitForRequest(stat);		// wait for start or death
    79 	server.Close();
    88 	server.Close();
    80 	return stat.Int();
    89 	return stat.Int();
       
    90 	
    81 	}
    91 	}
    82 
    92 
    83 /**
    93 /**
    84 Retrieves the time zone rules for the current home time zone.
    94 Retrieves the time zone rules for the current home time zone.
    85 
    95 
    89 ETzUtcTimeReference to generate from UTC, ETzWallTimeReference to generate from local time.
    99 ETzUtcTimeReference to generate from UTC, ETzWallTimeReference to generate from local time.
    90 @return Pointer to the time zone rules generated.
   100 @return Pointer to the time zone rules generated.
    91 */
   101 */
    92 EXPORT_C CTzRules* RTz::GetTimeZoneRulesL(const TTime& aStartTime, const TTime& aEndTime, TTzTimeReference aTimeRef) const
   102 EXPORT_C CTzRules* RTz::GetTimeZoneRulesL(const TTime& aStartTime, const TTime& aEndTime, TTzTimeReference aTimeRef) const
    93 	{
   103 	{
       
   104     OstTraceDefExt5( OST_TRACE_CATEGORY_DEBUG,TRACE_FLOW_PARAM, RTZ_GETTIMEZONERULESL_ENTRY, "RTz::GetTimeZoneRulesL Entry;Startdate:Year=%d;Month=%d;Day=%d;Hour=%d;Min=%d", aStartTime.DateTime().Year(), aStartTime.DateTime().Month(), aStartTime.DateTime().Day(), aStartTime.DateTime().Hour(), aStartTime.DateTime().Minute() );
       
   105     OstTraceDefExt5( OST_TRACE_CATEGORY_DEBUG,TRACE_FLOW_PARAM, RTZ_GETTIMEZONERULESL_ENTRY_PARAM, "Parameters cont..;Sec=%d;End date:Year=%d;month=%d;Day=%d;Hour=%d", aStartTime.DateTime().Second(), aEndTime.DateTime().Year(), aEndTime.DateTime().Month(), aEndTime.DateTime().Day(), aEndTime.DateTime().Hour() );
       
   106     OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, RTZ_GETTIMEZONERULESL_ENTRY_PARAM2, "parameters  cont..;Min=%d;Sec=%d;aTimeRef=%u", aEndTime.DateTime().Minute(), aEndTime.DateTime().Second(), aTimeRef );
       
   107     
    94 	TInt rulesSize = 0;
   108 	TInt rulesSize = 0;
    95 	TPckg<TTime> startTimeBuffer(aStartTime);
   109 	TPckg<TTime> startTimeBuffer(aStartTime);
    96 	TPckg<TTime> endTimeBuffer(aEndTime);
   110 	TPckg<TTime> endTimeBuffer(aEndTime);
    97 	TPckg<TTzTimeReference> timeRefBuffer(aTimeRef);
   111 	TPckg<TTzTimeReference> timeRefBuffer(aTimeRef);
    98 	TPckg<TInt> rulesSizeBuffer(rulesSize);
   112 	TPckg<TInt> rulesSizeBuffer(rulesSize);
    99 	TIpcArgs args(&startTimeBuffer, &endTimeBuffer, &timeRefBuffer, &rulesSizeBuffer);
   113 	TIpcArgs args(&startTimeBuffer, &endTimeBuffer, &timeRefBuffer, &rulesSizeBuffer);
       
   114 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, RTZ_GETTIMEZONERULESL_SEND_RECEIVE4, "RTz::GetTimeZoneRulesL:CTzServer::EGetLocalEncodedTimeZoneRulesSize" );
       
   115 	
   100 	const TInt result = SendReceive(CTzServer::EGetLocalEncodedTimeZoneRulesSize, args);
   116 	const TInt result = SendReceive(CTzServer::EGetLocalEncodedTimeZoneRulesSize, args);
   101 	User::LeaveIfError(result);
   117 	User::LeaveIfError(result);
   102 	
   118 	
   103 	// prepare buffer for tz rules	
   119 	// prepare buffer for tz rules	
   104 	CBufFlat* inBuffer = CBufFlat::NewL(rulesSize);
   120 	CBufFlat* inBuffer = CBufFlat::NewL(rulesSize);
   106 	inBuffer->ExpandL(0, rulesSize);
   122 	inBuffer->ExpandL(0, rulesSize);
   107 	TPtr8 inPtr(inBuffer->Ptr(0) );
   123 	TPtr8 inPtr(inBuffer->Ptr(0) );
   108 	
   124 	
   109 	// get the rules
   125 	// get the rules
   110 	TIpcArgs args2(&rulesSizeBuffer,&inPtr);
   126 	TIpcArgs args2(&rulesSizeBuffer,&inPtr);
       
   127 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, RTZ_GETTIMEZONERULESL_SEND_RECEIVE3, "RTz::GetTimeZoneRulesL" );
       
   128 	
   111 	const TInt result2 = SendReceive(CTzServer::EGetLocalEncodedTimeZoneRules, args2);
   129 	const TInt result2 = SendReceive(CTzServer::EGetLocalEncodedTimeZoneRules, args2);
   112 	User::LeaveIfError(result2);
   130 	User::LeaveIfError(result2);
   113 	
   131 	
   114 	RBufReadStream readStream;
   132 	RBufReadStream readStream;
   115 	readStream.Open(*inBuffer);
   133 	readStream.Open(*inBuffer);
   116 	
   134 	
   117 	CTzRules* rules = CTzRules::NewL(readStream);
   135 	CTzRules* rules = CTzRules::NewL(readStream);
   118 	
   136 	
   119 	CleanupStack::PopAndDestroy(inBuffer); // pop #1
   137 	CleanupStack::PopAndDestroy(inBuffer); // pop #1
       
   138 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, RTZ_GETTIMEZONERULESL_EXIT, "RTz::GetTimeZoneRulesL Exit" );
       
   139 	
   120 	return rules;
   140 	return rules;
   121 	}
   141 	}
   122 	
   142 	
   123 /**
   143 /**
   124 Retrieves the time zone rules for a specified time zone.
   144 Retrieves the time zone rules for a specified time zone.
   130 ETzUtcTimeReference to generate from UTC, ETzWallTimeReference to generate from local time.
   150 ETzUtcTimeReference to generate from UTC, ETzWallTimeReference to generate from local time.
   131 @return Pointer to the time zone rules generated.
   151 @return Pointer to the time zone rules generated.
   132 */
   152 */
   133 EXPORT_C CTzRules* RTz::GetTimeZoneRulesL(const CTzId& aZone, const TTime& aStartTime, const TTime& aEndTime, TTzTimeReference aTimeRef) const
   153 EXPORT_C CTzRules* RTz::GetTimeZoneRulesL(const CTzId& aZone, const TTime& aStartTime, const TTime& aEndTime, TTzTimeReference aTimeRef) const
   134 	{
   154 	{
       
   155     OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, RTZ_GETTIMEZONERULESL_ENTRY_OVERLOADED, "RTz::GetTimeZoneRulesL Entry;Time zone numerid id=%u", aZone.TimeZoneNumericID() );
       
   156     OstTraceDefExt5(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, RTZ_GETTIMEZONERULESL_ENTRY_Overload_PARAM, "Parameters cont..Startdate:Year=%d;Month=%d;Day=%d;Hour=%d;Min=%d", aStartTime.DateTime().Year(), aStartTime.DateTime().Month(), aStartTime.DateTime().Day(), aStartTime.DateTime().Hour(), aStartTime.DateTime().Minute());
       
   157     OstTraceDefExt5(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, RTZ_GETTIMEZONERULESL_Entry_OVERLOAD_PARAM, "Parameters cont..;Sec=%d;End date:Year=%d;month=%d;Day=%d;Hour=%d", aStartTime.DateTime().Second(), aEndTime.DateTime().Year(), aEndTime.DateTime().Month(), aEndTime.DateTime().Day(), aEndTime.DateTime().Hour());
       
   158     OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, RTZ_GETTIMEZONERULESL_Entry_OVERLOAD_PARAM2, "Parameters cont..;Min=%d;Sec=%d;aTimeRef=%u", aEndTime.DateTime().Minute(), aEndTime.DateTime().Second(), aTimeRef );
       
   159     
   135 	TInt rulesSize = 0;
   160 	TInt rulesSize = 0;
   136 	TPckg<TTime> startTimeBuffer(aStartTime);
   161 	TPckg<TTime> startTimeBuffer(aStartTime);
   137 	TPckg<TTime> endTimeBuffer(aEndTime);
   162 	TPckg<TTime> endTimeBuffer(aEndTime);
   138 	TPckg<TInt> rulesSizeBuffer(rulesSize);
   163 	TPckg<TInt> rulesSizeBuffer(rulesSize);
   139 		
   164 		
   146 	aZone.ExternalizeL(writeStream);
   171 	aZone.ExternalizeL(writeStream);
   147 	writeStream.WriteInt8L(aTimeRef);
   172 	writeStream.WriteInt8L(aTimeRef);
   148 	TPtr8 outPtr(outBuffer->Ptr(0) );
   173 	TPtr8 outPtr(outBuffer->Ptr(0) );
   149 	
   174 	
   150 	TIpcArgs args(&startTimeBuffer, &endTimeBuffer, &outPtr, &rulesSizeBuffer);
   175 	TIpcArgs args(&startTimeBuffer, &endTimeBuffer, &outPtr, &rulesSizeBuffer);
       
   176 	OstTraceDef0( OST_TRACE_CATEGORY_DEBUG,SEND_RECEIVE, RTZ_GETTIMEZONERULESL_SEND_RECEIVE2, "RTz::GetTimeZoneRulesL:CTzServer::EGetForeignEncodedTimeZoneRulesSize");
       
   177 	
   151 	const TInt result = SendReceive(CTzServer::EGetForeignEncodedTimeZoneRulesSize, args);
   178 	const TInt result = SendReceive(CTzServer::EGetForeignEncodedTimeZoneRulesSize, args);
   152 	User::LeaveIfError(result);
   179 	User::LeaveIfError(result);
   153 	
   180 	
   154 	CleanupStack::PopAndDestroy(outBuffer); // pop #1
   181 	CleanupStack::PopAndDestroy(outBuffer); // pop #1
   155 	
   182 	
   158 	CleanupStack::PushL(inBuffer); // push #1
   185 	CleanupStack::PushL(inBuffer); // push #1
   159 	inBuffer->ExpandL(0, rulesSize);
   186 	inBuffer->ExpandL(0, rulesSize);
   160 	TPtr8 inPtr(inBuffer->Ptr(0) );
   187 	TPtr8 inPtr(inBuffer->Ptr(0) );
   161 	
   188 	
   162 	TIpcArgs args2(&rulesSizeBuffer, &inPtr);
   189 	TIpcArgs args2(&rulesSizeBuffer, &inPtr);
       
   190 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, RTZ_GETTIMEZONERULESL_SEND_RECEIVE, "RTz::GetTimeZoneRulesL:CTzServer::EGetForeignEncodedTimeZoneRules" );
       
   191 	
   163 	const TInt result2 = SendReceive(CTzServer::EGetForeignEncodedTimeZoneRules, args2);
   192 	const TInt result2 = SendReceive(CTzServer::EGetForeignEncodedTimeZoneRules, args2);
   164 	User::LeaveIfError(result2);
   193 	User::LeaveIfError(result2);
   165 	
   194 	
   166 	RBufReadStream readStream;
   195 	RBufReadStream readStream;
   167 	readStream.Open(*inBuffer);
   196 	readStream.Open(*inBuffer);
   168 	
   197 	
   169 	CTzRules* rules = CTzRules::NewL(readStream);
   198 	CTzRules* rules = CTzRules::NewL(readStream);
   170 	
   199 	
   171 	CleanupStack::PopAndDestroy(inBuffer); // pop #1
   200 	CleanupStack::PopAndDestroy(inBuffer); // pop #1
       
   201 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, RTZ_GETTIMEZONERULESL_EXIT2, "RTz::GetTimeZoneRulesL Exit" );
       
   202 	
   172 	return rules;
   203 	return rules;
   173 	}
   204 	}
   174 	
   205 	
   175 // Registers to receive notification to time and zone changes in the
   206 // Registers to receive notification to time and zone changes in the
   176 // Server
   207 // Server
   192 	TPckg<TTime> timeBuffer(aTime);
   223 	TPckg<TTime> timeBuffer(aTime);
   193 	TPckg<TTime> timeInBuffer(aTime);
   224 	TPckg<TTime> timeInBuffer(aTime);
   194 	TPckg<TTzTimeReference> timerRefBuffer(aTimerRef);
   225 	TPckg<TTzTimeReference> timerRefBuffer(aTimerRef);
   195 
   226 
   196 	TIpcArgs args(&timeBuffer, &timerRefBuffer, &timeInBuffer);
   227 	TIpcArgs args(&timeBuffer, &timerRefBuffer, &timeInBuffer);
       
   228 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, RTZ_DOCONVERTL, "RTz::doConvertL:CTzServer::EConvertLocalZoneTime" );
       
   229 	
   197 	const TInt result = SendReceive(CTzServer::EConvertLocalZoneTime, args);
   230 	const TInt result = SendReceive(CTzServer::EConvertLocalZoneTime, args);
   198 	User::LeaveIfError(result);
   231 	User::LeaveIfError(result);
   199 
   232 
   200 	aTime = timeInBuffer();
   233 	aTime = timeInBuffer();
   201 	}
   234 	}
   217 	TPckg<TTime> timeBuffer(aTime);
   250 	TPckg<TTime> timeBuffer(aTime);
   218 	TPckg<TTime> timeInBuffer(aTime);
   251 	TPckg<TTime> timeInBuffer(aTime);
   219 	TPckg<TTzTimeReference> timerRefBuffer(aTimerRef);
   252 	TPckg<TTzTimeReference> timerRefBuffer(aTimerRef);
   220 
   253 
   221 	TIpcArgs args(&timeBuffer, &timerRefBuffer, &outPtr, &timeInBuffer);
   254 	TIpcArgs args(&timeBuffer, &timerRefBuffer, &outPtr, &timeInBuffer);
       
   255 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, DUP1_RTZ_DOCONVERTL, "RTz::doConvertL:CTzServer::EConvertForeignZoneTime" );
       
   256 	
   222 	const TInt result = SendReceive(CTzServer::EConvertForeignZoneTime, args);
   257 	const TInt result = SendReceive(CTzServer::EConvertForeignZoneTime, args);
   223 	CleanupStack::PopAndDestroy(outBuffer);
   258 	CleanupStack::PopAndDestroy(outBuffer);
   224 
   259 
   225 	User::LeaveIfError(result);
   260 	User::LeaveIfError(result);
   226 	aTime = timeInBuffer();
   261 	aTime = timeInBuffer();
   248 @panic TzServer 1 The attempt to connect to the server failed with an error 
   283 @panic TzServer 1 The attempt to connect to the server failed with an error 
   249 code other than KErrNotFound.
   284 code other than KErrNotFound.
   250 */
   285 */
   251 EXPORT_C TInt RTz::Connect()
   286 EXPORT_C TInt RTz::Connect()
   252 	{
   287 	{
       
   288     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, RTZ_CONNECT_ENTRY, "RTz::Connect Entry" );
       
   289     
   253 	// The number of message slots in the RSessionBase::CreateSession() 
   290 	// The number of message slots in the RSessionBase::CreateSession() 
   254 	// call are delibrately unspecified so the kernel will take messages 
   291 	// call are delibrately unspecified so the kernel will take messages 
   255 	// from a global pool as and when required (the session is allowed
   292 	// from a global pool as and when required (the session is allowed
   256 	// a maximum of 255 outstanding asynchronous messages)
   293 	// a maximum of 255 outstanding asynchronous messages)
   257 
   294 
   259 	FOREVER
   296 	FOREVER
   260 		{
   297 		{
   261 		TInt err = CreateSession(KTimeZoneServerName,Version());
   298 		TInt err = CreateSession(KTimeZoneServerName,Version());
   262 		if (err != KErrNotFound && err!=KErrServerTerminated)
   299 		if (err != KErrNotFound && err!=KErrServerTerminated)
   263 			{
   300 			{
       
   301 		    OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, RTZ_CONNECT_EXIT, "RTz::Connect Exit;err=%d", err );
       
   302 		    
   264 			return err;
   303 			return err;
   265 			}
   304 			}
   266 		// need to restart server
   305 		// need to restart server
   267 		if (--retry == 0)
   306 		if (--retry == 0)
   268 			{
   307 			{
       
   308 		    OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, RTZ_CONNECT_EXIT2, "RTz::Connect Exit;err=%d", err );
       
   309 		    
   269 			return err;
   310 			return err;
   270 			}
   311 			}
   271 		err = StartServer();
   312 		err = StartServer();
   272 		if (err != KErrNone && err != KErrAlreadyExists)
   313 		if (err != KErrNone && err != KErrAlreadyExists)
   273 			{
   314 			{
   274 			// Time Zone Server is configurable, so it is possible not to find it
   315 			// Time Zone Server is configurable, so it is possible not to find it
   275 			if (err != KErrNotFound)
   316 			if (err != KErrNotFound)
   276 				{
   317 				{
       
   318 			    OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, RTZ_CONNECT_EXIT3, "RTz::Connect Exit;err=%d", err );
       
   319 			    
   277 				return err;
   320 				return err;
   278 				}
   321 				}
       
   322 			OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_FATAL, RTZ_CONNECT, "RTz::Connect:Panic:Server not found" );
       
   323 			
   279 			Panic(EPanicServerNotFound);
   324 			Panic(EPanicServerNotFound);
   280 			}
   325 			}
   281 		}
   326 		}
   282 	}
   327 	}
   283 
   328 
   385 @param aOffsets An array that, on return, will contain the UTC offsets
   430 @param aOffsets An array that, on return, will contain the UTC offsets
   386 corresponding to the the time zone IDs in aTzNumericIds.
   431 corresponding to the the time zone IDs in aTzNumericIds.
   387 */
   432 */
   388 EXPORT_C void RTz::GetOffsetsForTimeZoneIdsL(const RArray<TInt>& aTzNumericIds, RArray<TInt>& aOffsets) const
   433 EXPORT_C void RTz::GetOffsetsForTimeZoneIdsL(const RArray<TInt>& aTzNumericIds, RArray<TInt>& aOffsets) const
   389 	{
   434 	{
       
   435     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, DUP1_RTZ_GETOFFSETSFORTIMEZONEIDSL_ENTRY, "RTz::GetOffsetsForTimeZoneIdsL Entry" );
       
   436     
   390 	TInt count 			= aTzNumericIds.Count();
   437 	TInt count 			= aTzNumericIds.Count();
   391 	TInt tintSize 		= sizeof(TInt);
   438 	TInt tintSize 		= sizeof(TInt);
   392 	TInt idBufLength	= count * tintSize;
   439 	TInt idBufLength	= count * tintSize;
   393 	TInt pos 			= 0;
   440 	TInt pos 			= 0;
   394 	idBufLength += tintSize;
   441 	idBufLength += tintSize;
   410 		}
   457 		}
   411 
   458 
   412 	TInt size = idBuf->Size();
   459 	TInt size = idBuf->Size();
   413 	TPtr8 outPtr(idBuf->Ptr(0) );
   460 	TPtr8 outPtr(idBuf->Ptr(0) );
   414 	TIpcArgs args(size,&outPtr);
   461 	TIpcArgs args(size,&outPtr);
       
   462 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, RTZ_GETOFFSETSFORTIMEZONEIDSL, "RTz::GetOffsetsForTimeZoneIdsL:CTzServer::EGetOffsetsForTimeZoneIds" );
       
   463 	
   415 	const TInt result = SendReceive(CTzServer::EGetOffsetsForTimeZoneIds, args);	
   464 	const TInt result = SendReceive(CTzServer::EGetOffsetsForTimeZoneIds, args);	
   416 	User::LeaveIfError(result);
   465 	User::LeaveIfError(result);
   417 	
   466 	
   418 	// idBuf now contains the offsets INSTEAD of the timezone Ids
   467 	// idBuf now contains the offsets INSTEAD of the timezone Ids
   419 	pos = 0;
   468 	pos = 0;
   427 		idBuf->Read(pos,&offset,tintSize);
   476 		idBuf->Read(pos,&offset,tintSize);
   428 		aOffsets.AppendL(offset);
   477 		aOffsets.AppendL(offset);
   429 		pos += tintSize;
   478 		pos += tintSize;
   430 		}
   479 		}
   431 	CleanupStack::PopAndDestroy(idBuf);
   480 	CleanupStack::PopAndDestroy(idBuf);
       
   481 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, DUP1_RTZ_GETOFFSETSFORTIMEZONEIDSL_EXIT, "RTz::GetOffsetsForTimeZoneIdsL Exit" );
       
   482 	
   432 	}
   483 	}
   433 
   484 
   434 /** 
   485 /** 
   435 Retrieves the time zone ID for the current system time zone.
   486 Retrieves the time zone ID for the current system time zone.
   436 @return Time zone ID. The client takes ownership of the object.
   487 @return Time zone ID. The client takes ownership of the object.
   437 @leave KErrNoMemory or another system leave code.
   488 @leave KErrNoMemory or another system leave code.
   438 @internalTechnology
   489 @internalTechnology
   439 */
   490 */
   440 EXPORT_C CTzId* RTz::GetTimeZoneIdL() const
   491 EXPORT_C CTzId* RTz::GetTimeZoneIdL() const
   441 	{
   492 	{
       
   493     
   442 	CBufFlat* inBuffer = CBufFlat::NewL(KMaxTimeZoneIdSize);
   494 	CBufFlat* inBuffer = CBufFlat::NewL(KMaxTimeZoneIdSize);
   443 	CleanupStack::PushL(inBuffer);
   495 	CleanupStack::PushL(inBuffer);
   444 
   496 
   445 	// reserve the full space
   497 	// reserve the full space
   446 	inBuffer->ExpandL(0, KMaxTimeZoneIdSize);
   498 	inBuffer->ExpandL(0, KMaxTimeZoneIdSize);
   447 
   499 
   448 	TPtr8 ptr(inBuffer->Ptr(0) );
   500 	TPtr8 ptr(inBuffer->Ptr(0) );
   449 
   501 
   450 	TIpcArgs args(&ptr);
   502 	TIpcArgs args(&ptr);
       
   503 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, RTZ_GETTIMEZONEIDL, "RTz::GetTimeZoneIdL, CTzServer::EGetLocalTimeZoneId" );
       
   504 	
   451 	const TInt result = SendReceive(CTzServer::EGetLocalTimeZoneId, args);
   505 	const TInt result = SendReceive(CTzServer::EGetLocalTimeZoneId, args);
   452 	User::LeaveIfError(result);
   506 	User::LeaveIfError(result);
   453 
   507 
   454 	RBufReadStream readStream;
   508 	RBufReadStream readStream;
   455 	readStream.Open(*inBuffer);
   509 	readStream.Open(*inBuffer);
   465 @capability WRITE_DEVICE_DATA
   519 @capability WRITE_DEVICE_DATA
   466 @internalTechnology
   520 @internalTechnology
   467 */
   521 */
   468 EXPORT_C void RTz::SetTimeZoneL(CTzId& aZone) const
   522 EXPORT_C void RTz::SetTimeZoneL(CTzId& aZone) const
   469 	{
   523 	{
       
   524     
   470 	CBufFlat* outBuffer = CBufFlat::NewL(KMaxTimeZoneIdSize);
   525 	CBufFlat* outBuffer = CBufFlat::NewL(KMaxTimeZoneIdSize);
   471 	CleanupStack::PushL(outBuffer);
   526 	CleanupStack::PushL(outBuffer);
   472 
   527 
   473 	RBufWriteStream writeStream;
   528 	RBufWriteStream writeStream;
   474 	writeStream.Open(*outBuffer);
   529 	writeStream.Open(*outBuffer);
   485 	inBuffer->ExpandL(0, KMaxTimeZoneIdSize);
   540 	inBuffer->ExpandL(0, KMaxTimeZoneIdSize);
   486 
   541 
   487 	TPtr8 outPtr(outBuffer->Ptr(0) );
   542 	TPtr8 outPtr(outBuffer->Ptr(0) );
   488 	TPtr8 inPtr(inBuffer->Ptr(0) );
   543 	TPtr8 inPtr(inBuffer->Ptr(0) );
   489 	TIpcArgs args(&outPtr, &inPtr);
   544 	TIpcArgs args(&outPtr, &inPtr);
       
   545 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, RTZ_SETTIMEZONEL, "RTz::SetTimeZoneL, CTzServer::ESetTimeZone" );
       
   546 	
   490 	const TInt result = SendReceive(CTzServer::ESetTimeZone, args);
   547 	const TInt result = SendReceive(CTzServer::ESetTimeZone, args);
   491 	User::LeaveIfError(result);
   548 	User::LeaveIfError(result);
   492 
   549 
   493 	RBufReadStream readStream;
   550 	RBufReadStream readStream;
   494 	readStream.Open(*inBuffer);
   551 	readStream.Open(*inBuffer);
   511 @param aZone The time zone ID.
   568 @param aZone The time zone ID.
   512 @return ETrue if the Daylight Saving is on, i.e. if it is summertime.
   569 @return ETrue if the Daylight Saving is on, i.e. if it is summertime.
   513 */	
   570 */	
   514 EXPORT_C TBool RTz::IsDaylightSavingOnL(CTzId& aZone) const
   571 EXPORT_C TBool RTz::IsDaylightSavingOnL(CTzId& aZone) const
   515 	{
   572 	{
       
   573     
   516 	// prepare out zoneid buffer
   574 	// prepare out zoneid buffer
   517 	CBufFlat* outBuffer = CBufFlat::NewL(KMaxTimeZoneIdSize);
   575 	CBufFlat* outBuffer = CBufFlat::NewL(KMaxTimeZoneIdSize);
   518 	CleanupStack::PushL(outBuffer);
   576 	CleanupStack::PushL(outBuffer);
   519 
   577 
   520 	RBufWriteStream writeStream;
   578 	RBufWriteStream writeStream;
   521 	writeStream.Open(*outBuffer);
   579 	writeStream.Open(*outBuffer);
   522 	aZone.ExternalizeL(writeStream);
   580 	aZone.ExternalizeL(writeStream);
   523 	
   581 		
   524 	TPckg<TTime> timeBuffer(Time::NullTTime());
   582 	TPckg<TTime> timeBuffer(Time::NullTTime());
   525 	
   583 	
   526 	TPtr8 outPtr(outBuffer->Ptr(0) );
   584 	TPtr8 outPtr(outBuffer->Ptr(0) );
   527 	TPckgBuf<TInt> package;
   585 	TPckgBuf<TInt> package;
   528 	TIpcArgs args(&outPtr, &timeBuffer, &package);
   586 	TIpcArgs args(&outPtr, &timeBuffer, &package);
       
   587 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, RTZ_ISDAYLIGHTSAVINGONL, "RTz::IsDaylightSavingOnL: For specified zone at the current time, CTzServer::EIsDaylightSavingOn" );
       
   588 	
   529 	const TInt result = SendReceive(CTzServer::EIsDaylightSavingOn, args);
   589 	const TInt result = SendReceive(CTzServer::EIsDaylightSavingOn, args);
   530 	User::LeaveIfError(result);
   590 	User::LeaveIfError(result);
   531 	CleanupStack::PopAndDestroy(outBuffer);
   591 	CleanupStack::PopAndDestroy(outBuffer);
   532 	return package();		
   592 	return package();		
   533 	}
   593 	}
   539 @param aUTCTime The UTC time at which DST settings are required.
   599 @param aUTCTime The UTC time at which DST settings are required.
   540 @return ETrue if the Daylight Saving is on, i.e. if it is summertime.
   600 @return ETrue if the Daylight Saving is on, i.e. if it is summertime.
   541 */	
   601 */	
   542 EXPORT_C TBool RTz::IsDaylightSavingOnL(CTzId& aZone, const TTime& aUTCTime) const
   602 EXPORT_C TBool RTz::IsDaylightSavingOnL(CTzId& aZone, const TTime& aUTCTime) const
   543 	{
   603 	{
       
   604     
   544 	// prepare out zoneid buffer
   605 	// prepare out zoneid buffer
   545 	CBufFlat* outBuffer = CBufFlat::NewL(KMaxTimeZoneIdSize);
   606 	CBufFlat* outBuffer = CBufFlat::NewL(KMaxTimeZoneIdSize);
   546 	CleanupStack::PushL(outBuffer);
   607 	CleanupStack::PushL(outBuffer);
   547 
   608 
   548 	RBufWriteStream writeStream;
   609 	RBufWriteStream writeStream;
   552 	TPckg<TTime> timeBuffer(aUTCTime);	
   613 	TPckg<TTime> timeBuffer(aUTCTime);	
   553 	
   614 	
   554 	TPtr8 outPtr(outBuffer->Ptr(0) );
   615 	TPtr8 outPtr(outBuffer->Ptr(0) );
   555  	TPckgBuf<TInt> package;
   616  	TPckgBuf<TInt> package;
   556 	TIpcArgs args(&outPtr, &timeBuffer, &package);
   617 	TIpcArgs args(&outPtr, &timeBuffer, &package);
       
   618 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, DUP1_RTZ_ISDAYLIGHTSAVINGONL, "RTz::IsDaylightSavingOnL:specified zone at a specified time , CTzServer::EIsDaylightSavingOn" );
       
   619 	
   557  	const TInt result = SendReceive(CTzServer::EIsDaylightSavingOn, args);
   620  	const TInt result = SendReceive(CTzServer::EIsDaylightSavingOn, args);
   558  	User::LeaveIfError(result);
   621  	User::LeaveIfError(result);
   559  	CleanupStack::PopAndDestroy(outBuffer);
   622  	CleanupStack::PopAndDestroy(outBuffer);
   560  	return package();		
   623  	return package();		
   561  	}
   624  	}
   584     {
   647     {
   585     // Create the message arguments, setting slot zero to the configuration value.
   648     // Create the message arguments, setting slot zero to the configuration value.
   586 	TIpcArgs args(aUpdateEnabled);
   649 	TIpcArgs args(aUpdateEnabled);
   587 	
   650 	
   588 	// Send the message.
   651 	// Send the message.
       
   652 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, RTZ_SETAUTOUPDATEBEHAVIORL, "RTz::SetAutoUpdateBehaviorL, CTzServer::EEnableAutoUpdate" );
       
   653 	
   589 	User::LeaveIfError(SendReceive(CTzServer::EEnableAutoUpdate, args));
   654 	User::LeaveIfError(SendReceive(CTzServer::EEnableAutoUpdate, args));
   590     }
   655     }
   591 
   656 
   592 /**
   657 /**
   593 Retrieves the daylight saving auto-update functionality.
   658 Retrieves the daylight saving auto-update functionality.
   595 */
   660 */
   596 EXPORT_C TInt RTz::AutoUpdateSettingL()
   661 EXPORT_C TInt RTz::AutoUpdateSettingL()
   597     {
   662     {
   598     TPckgBuf<TInt> package;
   663     TPckgBuf<TInt> package;
   599 	TIpcArgs args(&package);
   664 	TIpcArgs args(&package);
       
   665 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, RTZ_AUTOUPDATESETTINGL, "RTz::AutoUpdateSettingL, CTzServer::EAutoUpdate" );
       
   666 	
   600 	const TInt result = SendReceive(CTzServer::EAutoUpdate, args);
   667 	const TInt result = SendReceive(CTzServer::EAutoUpdate, args);
   601 	User::LeaveIfError(result);
   668 	User::LeaveIfError(result);
   602 	return package();	
   669 	return package();	
   603     }
   670     }
   604         
   671         
   621 EXPORT_C TInt RTz::SetHomeTime(const TTime& aLocalTime) const
   688 EXPORT_C TInt RTz::SetHomeTime(const TTime& aLocalTime) const
   622     {
   689     {
   623 	TPckg<TTime>   timeBuffer(aLocalTime);
   690 	TPckg<TTime>   timeBuffer(aLocalTime);
   624 
   691 
   625 	TIpcArgs args(&timeBuffer);
   692 	TIpcArgs args(&timeBuffer);
       
   693 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, RTZ_SETHOMETIME, "RTz::SetHomeTime, CTzServer::ESetHomeTime" );
       
   694 	
   626 	return SendReceive(CTzServer::ESetHomeTime, args);
   695 	return SendReceive(CTzServer::ESetHomeTime, args);
   627     }
   696     }
   628 
   697 
   629 /**
   698 /**
   630 Publish notification that the home time zone (as defined in CTzLocalizer) has been changed.
   699 Publish notification that the home time zone (as defined in CTzLocalizer) has been changed.
   635 EXPORT_C void RTz::NotifyHomeTimeZoneChangedL(const NTzUpdate::TTimeZoneChange& aChange) const
   704 EXPORT_C void RTz::NotifyHomeTimeZoneChangedL(const NTzUpdate::TTimeZoneChange& aChange) const
   636 	{
   705 	{
   637 	TIpcArgs args(aChange.iNewTimeZoneId, aChange.iOldTimeZoneId);
   706 	TIpcArgs args(aChange.iNewTimeZoneId, aChange.iOldTimeZoneId);
   638 	
   707 	
   639 	// Send the message.
   708 	// Send the message.
       
   709 	OstTraceDef0( OST_TRACE_CATEGORY_DEBUG,SEND_RECEIVE, RTZ_NOTIFYHOMETIMEZONECHANGEDL, "RTz::NotifyHomeTimeZoneChangedL, CTzServer::ENotifyHomeTimeZoneChanged" );
       
   710 	
   640 	User::LeaveIfError(SendReceive(CTzServer::ENotifyHomeTimeZoneChanged, args));
   711 	User::LeaveIfError(SendReceive(CTzServer::ENotifyHomeTimeZoneChanged, args));
   641 	}
   712 	}
   642 
   713 
   643 /**
   714 /**
   644 Sets the UTC time and the wall-clock offset for a zone not defined in the
   715 Sets the UTC time and the wall-clock offset for a zone not defined in the
   692 	TPckg<TTime> utcTime(aUTCTime);   
   763 	TPckg<TTime> utcTime(aUTCTime);   
   693 	TPckg<TInt>  utcOffset(aUTCOffset);
   764 	TPckg<TInt>  utcOffset(aUTCOffset);
   694 	TPckg<TBool> persist(aPersistInCenRep);
   765 	TPckg<TBool> persist(aPersistInCenRep);
   695 
   766 
   696 	TIpcArgs args(&utcTime, &utcOffset, &persist);
   767 	TIpcArgs args(&utcTime, &utcOffset, &persist);
       
   768 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, RTZ_SETUNKNOWNZONETIMEL, "RTz::SetUnknownZoneTimeL, CTzServer::ESetUnknownZoneTime" );
       
   769 	
   697 	User::LeaveIfError(SendReceive(CTzServer::ESetUnknownZoneTime, args));
   770 	User::LeaveIfError(SendReceive(CTzServer::ESetUnknownZoneTime, args));
   698 	}
   771 	}
   699 
   772 
   700 /**
   773 /**
   701 Reads all the user defined cities stored in the
   774 Reads all the user defined cities stored in the
   704 @param aCities Array of cities to add the user defined to.
   777 @param aCities Array of cities to add the user defined to.
   705 @internalTechnology
   778 @internalTechnology
   706 */
   779 */
   707 EXPORT_C void RTz::LocalizationReadCitiesL(RPointerArray<CTzLocalizedCityRecord>& aCities)
   780 EXPORT_C void RTz::LocalizationReadCitiesL(RPointerArray<CTzLocalizedCityRecord>& aCities)
   708 	{
   781 	{
       
   782     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, DUP4_RTZ_LOCALIZATIONREADCITIESL_ENTRY, "RTz::LocalizationReadCitiesL Entry" );
       
   783     
   709 	TInt resultSize = 0;
   784 	TInt resultSize = 0;
   710 	TPckg<TInt> resultSizeBuffer(resultSize);
   785 	TPckg<TInt> resultSizeBuffer(resultSize);
   711 	TIpcArgs args(&resultSizeBuffer);
   786 	TIpcArgs args(&resultSizeBuffer);
       
   787 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, RTZ_LOCALIZATIONREADCITIESL, "RTz::LocalizationReadCitiesL; CTzServer::ELocalizationReadCitiesSize");
       
   788 	
   712 	User::LeaveIfError(SendReceive(CTzServer::ELocalizationReadCitiesSize, args));
   789 	User::LeaveIfError(SendReceive(CTzServer::ELocalizationReadCitiesSize, args));
   713 		
   790 		
   714 	CBufFlat* inBuffer = CBufFlat::NewL(resultSize);
   791 	CBufFlat* inBuffer = CBufFlat::NewL(resultSize);
   715 	CleanupStack::PushL(inBuffer);
   792 	CleanupStack::PushL(inBuffer);
   716 	inBuffer->ExpandL(0, resultSize);
   793 	inBuffer->ExpandL(0, resultSize);
   717 	TPtr8 inPtr(inBuffer->Ptr(0));
   794 	TPtr8 inPtr(inBuffer->Ptr(0));
   718 	
   795 	
   719 	TIpcArgs args2(&inPtr);
   796 	TIpcArgs args2(&inPtr);
       
   797 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, DUP1_RTZ_LOCALIZATIONREADCITIESL, "RTz::LocalizationReadCitiesL; CTzServer::ELocalizationReadCities" );
       
   798 	
   720 	User::LeaveIfError(SendReceive(CTzServer::ELocalizationReadCities, args2));
   799 	User::LeaveIfError(SendReceive(CTzServer::ELocalizationReadCities, args2));
   721 	
   800 	
   722 	RBufReadStream readStream;
   801 	RBufReadStream readStream;
   723 	readStream.Open(*inBuffer);
   802 	readStream.Open(*inBuffer);
   724 	CleanupClosePushL(readStream);
   803 	CleanupClosePushL(readStream);
   725 	CTzLocalizedCityRecord::InternalizeL(readStream, aCities);
   804 	CTzLocalizedCityRecord::InternalizeL(readStream, aCities);
   726 	CleanupStack::PopAndDestroy(&readStream);
   805 	CleanupStack::PopAndDestroy(&readStream);
   727 	
   806 	
   728 	CleanupStack::PopAndDestroy(inBuffer);
   807 	CleanupStack::PopAndDestroy(inBuffer);
       
   808 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, DUP4_RTZ_LOCALIZATIONREADCITIESL_EXIT, "RTz::LocalizationReadCitiesL Exit" );
       
   809 	
   729 	}
   810 	}
   730 
   811 
   731 /**
   812 /**
   732 Reads all the user defined cities stored in the database that are members of
   813 Reads all the user defined cities stored in the database that are members of
   733 the time zone referenced by aTimeZoneid.
   814 the time zone referenced by aTimeZoneid.
   736 @param aTimeZoneId A time zone id identifying a time zone
   817 @param aTimeZoneId A time zone id identifying a time zone
   737 @internalTechnology
   818 @internalTechnology
   738 */
   819 */
   739 EXPORT_C void RTz::LocalizationReadCitiesL(RPointerArray<CTzLocalizedCityRecord>& aCities, TInt aTimeZoneId)
   820 EXPORT_C void RTz::LocalizationReadCitiesL(RPointerArray<CTzLocalizedCityRecord>& aCities, TInt aTimeZoneId)
   740 	{
   821 	{
       
   822     OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, RTZ_LOCALIZATIONREADCITIESL_ENTRY, "RTz::LocalizationReadCitiesL Entry;aTimeZoneId=%d", aTimeZoneId );
       
   823     
   741 	TInt resultSize = 0;
   824 	TInt resultSize = 0;
   742 	TPckg<TInt> resultSizeBuffer(resultSize);
   825 	TPckg<TInt> resultSizeBuffer(resultSize);
   743 	TIpcArgs args(&resultSizeBuffer, aTimeZoneId);
   826 	TIpcArgs args(&resultSizeBuffer, aTimeZoneId);
       
   827 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, DUP2_RTZ_LOCALIZATIONREADCITIESL, "RTz::LocalizationReadCitiesL:For a time zone id, CTzServer::ELocalizationReadCitiesTzIdSize" );
       
   828 	
   744 	User::LeaveIfError(SendReceive(CTzServer::ELocalizationReadCitiesTzIdSize, args));
   829 	User::LeaveIfError(SendReceive(CTzServer::ELocalizationReadCitiesTzIdSize, args));
   745 		
   830 		
   746 	CBufFlat* inBuffer = CBufFlat::NewL(resultSize);
   831 	CBufFlat* inBuffer = CBufFlat::NewL(resultSize);
   747 	CleanupStack::PushL(inBuffer);
   832 	CleanupStack::PushL(inBuffer);
   748 	inBuffer->ExpandL(0, resultSize);
   833 	inBuffer->ExpandL(0, resultSize);
   749 	TPtr8 inPtr(inBuffer->Ptr(0));
   834 	TPtr8 inPtr(inBuffer->Ptr(0));
   750 	
   835 	
   751 	TIpcArgs args2(&inPtr, aTimeZoneId);
   836 	TIpcArgs args2(&inPtr, aTimeZoneId);
       
   837 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, DUP3_RTZ_LOCALIZATIONREADCITIESL, "RTz::LocalizationReadCitiesL:For a time zone id,CTzServer::ELocalizationReadCities" );
       
   838 	
   752 	User::LeaveIfError(SendReceive(CTzServer::ELocalizationReadCities, args2));
   839 	User::LeaveIfError(SendReceive(CTzServer::ELocalizationReadCities, args2));
   753 		
   840 		
   754 	RBufReadStream readStream;
   841 	RBufReadStream readStream;
   755 	readStream.Open(*inBuffer);
   842 	readStream.Open(*inBuffer);
   756 	CleanupClosePushL(readStream);
   843 	CleanupClosePushL(readStream);
   757 	CTzLocalizedCityRecord::InternalizeL(readStream, aCities);
   844 	CTzLocalizedCityRecord::InternalizeL(readStream, aCities);
   758 	CleanupStack::PopAndDestroy(&readStream);
   845 	CleanupStack::PopAndDestroy(&readStream);
   759 	
   846 	
   760 	CleanupStack::PopAndDestroy(inBuffer);	
   847 	CleanupStack::PopAndDestroy(inBuffer);	
       
   848 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, RTZ_LOCALIZATIONREADCITIESL_EXIT, "RTz::LocalizationReadCitiesL Exit" );
       
   849 	
   761 	}
   850 	}
   762 
   851 
   763 /**
   852 /**
   764 Reads all the user defined cities stored in the database with a matching group id.
   853 Reads all the user defined cities stored in the database with a matching group id.
   765 If the database is empty the returned array will contain no elements.
   854 If the database is empty the returned array will contain no elements.
   767 @param aGroupId A city group id
   856 @param aGroupId A city group id
   768 @internalTechnology
   857 @internalTechnology
   769 */
   858 */
   770 EXPORT_C void RTz::LocalizationReadCitiesInGroupL(RPointerArray<CTzLocalizedCityRecord>& aCities, TUint8 aGroupId)
   859 EXPORT_C void RTz::LocalizationReadCitiesInGroupL(RPointerArray<CTzLocalizedCityRecord>& aCities, TUint8 aGroupId)
   771 	{
   860 	{
       
   861     OstTraceDefExt1( OST_TRACE_CATEGORY_DEBUG,TRACE_FLOW_PARAM, RTZ_LOCALIZATIONREADCITIESINGROUPL_ENTRY, "RTz::LocalizationReadCitiesInGroupL Entry;aGroupId=%hhu", aGroupId );
       
   862     
   772 	TInt resultSize = 0;
   863 	TInt resultSize = 0;
   773 	TPckg<TInt> resultSizeBuffer(resultSize);
   864 	TPckg<TInt> resultSizeBuffer(resultSize);
   774 	TIpcArgs args(&resultSizeBuffer, aGroupId);
   865 	TIpcArgs args(&resultSizeBuffer, aGroupId);
       
   866 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, RTZ_LOCALIZATIONREADCITIESINGROUPL, "RTz::LocalizationReadCitiesInGroupL, CTzServer::ELocalizationReadCitiesInGroupSize" );
       
   867 	
   775 	User::LeaveIfError(SendReceive(CTzServer::ELocalizationReadCitiesInGroupSize, args));
   868 	User::LeaveIfError(SendReceive(CTzServer::ELocalizationReadCitiesInGroupSize, args));
   776 		
   869 		
   777 	CBufFlat* inBuffer = CBufFlat::NewL(resultSize);
   870 	CBufFlat* inBuffer = CBufFlat::NewL(resultSize);
   778 	CleanupStack::PushL(inBuffer);
   871 	CleanupStack::PushL(inBuffer);
   779 	inBuffer->ExpandL(0, resultSize);
   872 	inBuffer->ExpandL(0, resultSize);
   780 	TPtr8 inPtr(inBuffer->Ptr(0));
   873 	TPtr8 inPtr(inBuffer->Ptr(0));
   781 	
   874 	
   782 	TIpcArgs args2(&inPtr, aGroupId);
   875 	TIpcArgs args2(&inPtr, aGroupId);
       
   876 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, RTZ_LOCALIZATIONREADCITIESINGROUPL_SEND, "RTz::LocalizationReadCitiesInGroupL :ELocalizationReadCities" );
       
   877 	
   783 	User::LeaveIfError(SendReceive(CTzServer::ELocalizationReadCities, args2));
   878 	User::LeaveIfError(SendReceive(CTzServer::ELocalizationReadCities, args2));
   784 		
   879 		
   785 	RBufReadStream readStream;
   880 	RBufReadStream readStream;
   786 	readStream.Open(*inBuffer);
   881 	readStream.Open(*inBuffer);
   787 	CleanupClosePushL(readStream);
   882 	CleanupClosePushL(readStream);
   788 	CTzLocalizedCityRecord::InternalizeL(readStream, aCities);
   883 	CTzLocalizedCityRecord::InternalizeL(readStream, aCities);
   789 	CleanupStack::PopAndDestroy(&readStream);
   884 	CleanupStack::PopAndDestroy(&readStream);
   790 	
   885 	
   791 	CleanupStack::PopAndDestroy(inBuffer);
   886 	CleanupStack::PopAndDestroy(inBuffer);
       
   887 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, RTZ_LOCALIZATIONREADCITIESINGROUPL_EXIT, "RTz::LocalizationReadCitiesInGroupL Entry" );
       
   888 	
       
   889 	
   792 	}
   890 	}
   793 
   891 
   794 /**
   892 /**
   795 Retrieves a cached zone from the database.
   893 Retrieves a cached zone from the database.
   796 The calling function takes ownership of the returned zone
   894 The calling function takes ownership of the returned zone
   798 @return a cached zone from the database
   896 @return a cached zone from the database
   799 @internalTechnology
   897 @internalTechnology
   800 */
   898 */
   801 EXPORT_C CTzLocalizedTimeZoneRecord* RTz::LocalizationReadFrequentlyUsedZoneL(TInt aFrequentlyUsedZone)
   899 EXPORT_C CTzLocalizedTimeZoneRecord* RTz::LocalizationReadFrequentlyUsedZoneL(TInt aFrequentlyUsedZone)
   802 	{
   900 	{
       
   901     OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, RTZ_LOCALIZATIONREADFREQUENTLYUSEDZONEL_ENTRY, "RTz::LocalizationReadFrequentlyUsedZoneL Entry;aFrequentlyUsedZone=%d", aFrequentlyUsedZone );
       
   902     
   803 	TInt resultSize = 0;
   903 	TInt resultSize = 0;
   804 	TPckg<TInt> resultSizeBuffer(resultSize);
   904 	TPckg<TInt> resultSizeBuffer(resultSize);
   805 	TIpcArgs args(&resultSizeBuffer, aFrequentlyUsedZone);
   905 	TIpcArgs args(&resultSizeBuffer, aFrequentlyUsedZone);
       
   906 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, RTZ_LOCALIZATIONREADFREQUENTLYUSEDZONEL, "RTz::LocalizationReadFrequentlyUsedZoneL, CTzServer::ELocalizationReadFrequentlyUsedZoneSize" );
       
   907 	
   806 	User::LeaveIfError(SendReceive(CTzServer::ELocalizationReadFrequentlyUsedZoneSize, args));
   908 	User::LeaveIfError(SendReceive(CTzServer::ELocalizationReadFrequentlyUsedZoneSize, args));
   807 		
   909 		
   808 	CBufFlat* inBuffer = CBufFlat::NewL(resultSize);
   910 	CBufFlat* inBuffer = CBufFlat::NewL(resultSize);
   809 	CleanupStack::PushL(inBuffer);
   911 	CleanupStack::PushL(inBuffer);
   810 	inBuffer->ExpandL(0, resultSize);
   912 	inBuffer->ExpandL(0, resultSize);
   811 	TPtr8 inPtr(inBuffer->Ptr(0));
   913 	TPtr8 inPtr(inBuffer->Ptr(0));
   812 	
   914 	
   813 	TIpcArgs args2(&inPtr, aFrequentlyUsedZone);
   915 	TIpcArgs args2(&inPtr, aFrequentlyUsedZone);
       
   916 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, DUP1_RTZ_LOCALIZATIONREADFREQUENTLYUSEDZONEL, "RTz::LocalizationReadFrequentlyUsedZoneL, CTzServer::ELocalizationReadFrequentlyUsedZone" );
       
   917 	
   814 	User::LeaveIfError(SendReceive(CTzServer::ELocalizationReadFrequentlyUsedZone, args2));
   918 	User::LeaveIfError(SendReceive(CTzServer::ELocalizationReadFrequentlyUsedZone, args2));
   815 		
   919 		
   816 	RBufReadStream readStream;
   920 	RBufReadStream readStream;
   817 	readStream.Open(*inBuffer);
   921 	readStream.Open(*inBuffer);
   818 	CleanupClosePushL(readStream);
   922 	CleanupClosePushL(readStream);
   819 	CTzLocalizedTimeZoneRecord* result = CTzLocalizedTimeZoneRecord::NewL(readStream);
   923 	CTzLocalizedTimeZoneRecord* result = CTzLocalizedTimeZoneRecord::NewL(readStream);
   820 	CleanupStack::PopAndDestroy(&readStream);
   924 	CleanupStack::PopAndDestroy(&readStream);
   821 	
   925 	
   822 	CleanupStack::PopAndDestroy(inBuffer);	
   926 	CleanupStack::PopAndDestroy(inBuffer);	
       
   927 	OstTraceDef0( OST_TRACE_CATEGORY_DEBUG,TRACE_FLOW_PARAM, RTZ_LOCALIZATIONREADFREQUENTLYUSEDZONEL_EXIT, "RTz::LocalizationReadFrequentlyUsedZoneL Exit" );
       
   928 	
   823 	
   929 	
   824 	return result;
   930 	return result;
   825 	}
   931 	}
   826 
   932 
   827 /**
   933 /**
   831 @return	 selected city for the cached zone
   937 @return	 selected city for the cached zone
   832 @internalTechnology
   938 @internalTechnology
   833 */
   939 */
   834 EXPORT_C CTzLocalizedCityRecord* RTz::LocalizationReadCachedTimeZoneCityL(TInt aFrequentlyUsedZone)
   940 EXPORT_C CTzLocalizedCityRecord* RTz::LocalizationReadCachedTimeZoneCityL(TInt aFrequentlyUsedZone)
   835 	{
   941 	{
       
   942     OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, DUP2_RTZ_LOCALIZATIONREADCACHEDTIMEZONECITYL_ENTRY, "RTz::LocalizationReadCachedTimeZoneCityL Entry;aFrequentlyUsedZone=%d", aFrequentlyUsedZone );
       
   943     
   836 	TInt resultSize = 0;
   944 	TInt resultSize = 0;
   837 	TPckg<TInt> resultSizeBuffer(resultSize);
   945 	TPckg<TInt> resultSizeBuffer(resultSize);
   838 	TIpcArgs args(&resultSizeBuffer, aFrequentlyUsedZone);
   946 	TIpcArgs args(&resultSizeBuffer, aFrequentlyUsedZone);
       
   947 	OstTraceDef0( OST_TRACE_CATEGORY_DEBUG,SEND_RECEIVE, RTZ_LOCALIZATIONREADCACHEDTIMEZONECITYL, "RTz::LocalizationReadCachedTimeZoneCityL, CTzServer::ELocalizationReadCachedTimeZoneCitySize" );
       
   948 	
   839 	User::LeaveIfError(SendReceive(CTzServer::ELocalizationReadCachedTimeZoneCitySize, args));
   949 	User::LeaveIfError(SendReceive(CTzServer::ELocalizationReadCachedTimeZoneCitySize, args));
   840 		
   950 		
   841 	CBufFlat* inBuffer = CBufFlat::NewL(resultSize);
   951 	CBufFlat* inBuffer = CBufFlat::NewL(resultSize);
   842 	CleanupStack::PushL(inBuffer);
   952 	CleanupStack::PushL(inBuffer);
   843 	inBuffer->ExpandL(0, resultSize);
   953 	inBuffer->ExpandL(0, resultSize);
   844 	TPtr8 inPtr(inBuffer->Ptr(0));
   954 	TPtr8 inPtr(inBuffer->Ptr(0));
   845 	
   955 	
   846 	TIpcArgs args2(&inPtr, aFrequentlyUsedZone);
   956 	TIpcArgs args2(&inPtr, aFrequentlyUsedZone);
       
   957 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, DUP1_RTZ_LOCALIZATIONREADCACHEDTIMEZONECITYL, "RTz::LocalizationReadCachedTimeZoneCityL, CTzServer::ELocalizationReadCachedTimeZoneCity" );
       
   958 	
   847 	User::LeaveIfError(SendReceive(CTzServer::ELocalizationReadCachedTimeZoneCity, args2));
   959 	User::LeaveIfError(SendReceive(CTzServer::ELocalizationReadCachedTimeZoneCity, args2));
   848 		
   960 		
   849 	RBufReadStream readStream;
   961 	RBufReadStream readStream;
   850 	readStream.Open(*inBuffer);
   962 	readStream.Open(*inBuffer);
   851 	CleanupClosePushL(readStream);
   963 	CleanupClosePushL(readStream);
   852 	CTzLocalizedCityRecord* result = CTzLocalizedCityRecord::NewL(readStream);
   964 	CTzLocalizedCityRecord* result = CTzLocalizedCityRecord::NewL(readStream);
   853 	CleanupStack::PopAndDestroy(&readStream);
   965 	CleanupStack::PopAndDestroy(&readStream);
   854 	
   966 	
   855 	CleanupStack::PopAndDestroy(inBuffer);	
   967 	CleanupStack::PopAndDestroy(inBuffer);	
       
   968 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, RTZ_LOCALIZATIONREADCACHEDTIMEZONECITYL_EXIT, "RTz::LocalizationReadCachedTimeZoneCityL Exit" );
       
   969 	
   856 	
   970 	
   857 	return result;
   971 	return result;
   858 	}
   972 	}
   859 
   973 
   860 EXPORT_C void RTz::LocalizationCloseDbL()
   974 EXPORT_C void RTz::LocalizationCloseDbL()
   884 	if (aCityTzId > 0xFFFF)
   998 	if (aCityTzId > 0xFFFF)
   885 		{
   999 		{
   886 		// This is a mess, although most of the API allows for 32 bit tz ids some of them
  1000 		// This is a mess, although most of the API allows for 32 bit tz ids some of them
   887 		// only allow for 16 bit tz ids so we accept a TInt but do check that it can fit in 
  1001 		// only allow for 16 bit tz ids so we accept a TInt but do check that it can fit in 
   888 		// 16 bits
  1002 		// 16 bits
       
  1003 	    OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_ERROR, RTZ_LOCALIZATIONWRITECITYL, "RTz::LocalizationWriteCityL, Invalid time zone of the city:Id = %d", aCityTzId);
       
  1004 	    
   889 		User::Leave(KErrArgument);
  1005 		User::Leave(KErrArgument);
   890 		}
  1006 		}
   891 	TIpcArgs args(&aCityName, aCityTzId, aCityGroupId, aCityResourceId);
  1007 	TIpcArgs args(&aCityName, aCityTzId, aCityGroupId, aCityResourceId);
       
  1008 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, DUP1_RTZ_LOCALIZATIONWRITECITYL, "RTz::LocalizationWriteCityL, CTzServer::ELocalizationWriteCity" );
       
  1009 	
   892 	User::LeaveIfError(SendReceive(CTzServer::ELocalizationWriteCity, args));
  1010 	User::LeaveIfError(SendReceive(CTzServer::ELocalizationWriteCity, args));
   893 	}
  1011 	}
   894 
  1012 
   895 /**
  1013 /**
   896 Deletes aCity from the user added cities database table.
  1014 Deletes aCity from the user added cities database table.
   907 	if (aCityTzId > 0xFFFF)
  1025 	if (aCityTzId > 0xFFFF)
   908 		{
  1026 		{
   909 		// This is a mess, although most of the API allows for 32 bit tz ids some of them
  1027 		// This is a mess, although most of the API allows for 32 bit tz ids some of them
   910 		// only allow for 16 bit tz ids so we accept a TInt but do check that it can fit in 
  1028 		// only allow for 16 bit tz ids so we accept a TInt but do check that it can fit in 
   911 		// 16 bits
  1029 		// 16 bits
       
  1030 	    OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_ERROR, RTZ_LOCALIZATIONDELETECITYL, "RTz::LocalizationDeleteCityL:Invalid time zone id  of a city: id = %d" , aCityTzId);
       
  1031 	    
   912 		User::Leave(KErrArgument);
  1032 		User::Leave(KErrArgument);
   913 		}
  1033 		}
   914 	TIpcArgs args(&aCityName, aCityTzId);
  1034 	TIpcArgs args(&aCityName, aCityTzId);
       
  1035 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, DUP1_RTZ_LOCALIZATIONDELETECITYL, "RTz::LocalizationDeleteCityL, CTzServer::ELocalizationDeleteCity" );
       
  1036 	
   915 	User::LeaveIfError(SendReceive(CTzServer::ELocalizationDeleteCity, args));
  1037 	User::LeaveIfError(SendReceive(CTzServer::ELocalizationDeleteCity, args));
   916 	}
  1038 	}
   917 
  1039 
   918 /**
  1040 /**
   919 Stores the localized time zone in the database for easy retrieval.
  1041 Stores the localized time zone in the database for easy retrieval.
   931 @internalTechnology
  1053 @internalTechnology
   932 */
  1054 */
   933 EXPORT_C void RTz::LocalizationWriteFrequentlyUsedZoneL(const CTzLocalizedTimeZoneRecord& aTimeZone,
  1055 EXPORT_C void RTz::LocalizationWriteFrequentlyUsedZoneL(const CTzLocalizedTimeZoneRecord& aTimeZone,
   934 	const CTzLocalizedCityRecord& aCity, TInt aFrequentlyUsedZone)
  1056 	const CTzLocalizedCityRecord& aCity, TInt aFrequentlyUsedZone)
   935 	{
  1057 	{
       
  1058     OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, DUP1_RTZ_LOCALIZATIONWRITEFREQUENTLYUSEDZONEL_ENTRY, "RTz::LocalizationWriteFrequentlyUsedZoneL Entry;aFrequentlyUsedZone=%d", aFrequentlyUsedZone );
       
  1059     
   936 	TInt bufferSize = aTimeZone.ExternalizeSize() + aCity.ExternalizeSize() + sizeof(TInt32);
  1060 	TInt bufferSize = aTimeZone.ExternalizeSize() + aCity.ExternalizeSize() + sizeof(TInt32);
   937 	CBufFlat* buffer = CBufFlat::NewL(bufferSize);
  1061 	CBufFlat* buffer = CBufFlat::NewL(bufferSize);
   938 	CleanupStack::PushL(buffer);
  1062 	CleanupStack::PushL(buffer);
   939 	RBufWriteStream bufStream;
  1063 	RBufWriteStream bufStream;
   940 	bufStream.Open(*buffer);
  1064 	bufStream.Open(*buffer);
   944 	bufStream.WriteInt32L(aFrequentlyUsedZone);
  1068 	bufStream.WriteInt32L(aFrequentlyUsedZone);
   945 	bufStream.CommitL();
  1069 	bufStream.CommitL();
   946 	CleanupStack::PopAndDestroy(&bufStream);
  1070 	CleanupStack::PopAndDestroy(&bufStream);
   947 	TPtr8 bufferPtr = buffer->Ptr(0); 
  1071 	TPtr8 bufferPtr = buffer->Ptr(0); 
   948 	TIpcArgs args(&bufferPtr);
  1072 	TIpcArgs args(&bufferPtr);
       
  1073 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, RTZ_LOCALIZATIONWRITEFREQUENTLYUSEDZONEL, "RTz::LocalizationWriteFrequentlyUsedZoneL, CTzServer::ELocalizationWriteFrequentlyUsedZone" );
       
  1074 		
   949 	User::LeaveIfError(SendReceive(CTzServer::ELocalizationWriteFrequentlyUsedZone, args));
  1075 	User::LeaveIfError(SendReceive(CTzServer::ELocalizationWriteFrequentlyUsedZone, args));
   950 	CleanupStack::PopAndDestroy(buffer);
  1076 	CleanupStack::PopAndDestroy(buffer);
       
  1077 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, RTZ_LOCALIZATIONWRITEFREQUENTLYUSEDZONEL_EXIT, "RTz::LocalizationWriteFrequentlyUsedZoneL Exit" );
       
  1078 	
   951 	}
  1079 	}
   952 
  1080 
   953 /**
  1081 /**
   954 @internalTechnology
  1082 @internalTechnology
   955 */
  1083 */
   956 EXPORT_C void RTz::LocalizationWriteAllFrequentlyUsedZonesL(const RPointerArray<CTzLocalizedTimeZoneRecord>& aTimeZones,
  1084 EXPORT_C void RTz::LocalizationWriteAllFrequentlyUsedZonesL(const RPointerArray<CTzLocalizedTimeZoneRecord>& aTimeZones,
   957 		const RPointerArray<CTzLocalizedCityRecord>& aCities)
  1085 		const RPointerArray<CTzLocalizedCityRecord>& aCities)
   958 	{
  1086 	{
       
  1087     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, RTZ_LOCALIZATIONWRITEALLFREQUENTLYUSEDZONESL_ENTRY, "RTz::LocalizationWriteAllFrequentlyUsedZonesL Entry" );
       
  1088     
   959 	TInt bufferSize = CTzLocalizedTimeZoneRecord::ExternalizeSize(aTimeZones);
  1089 	TInt bufferSize = CTzLocalizedTimeZoneRecord::ExternalizeSize(aTimeZones);
   960 	bufferSize += CTzLocalizedCityRecord::ExternalizeSize(aCities);
  1090 	bufferSize += CTzLocalizedCityRecord::ExternalizeSize(aCities);
   961 	CBufFlat* buffer = CBufFlat::NewL(bufferSize);
  1091 	CBufFlat* buffer = CBufFlat::NewL(bufferSize);
   962 	CleanupStack::PushL(buffer);
  1092 	CleanupStack::PushL(buffer);
   963 	RBufWriteStream bufStream;
  1093 	RBufWriteStream bufStream;
   967 	CTzLocalizedCityRecord::ExternalizeL(aCities, bufStream);
  1097 	CTzLocalizedCityRecord::ExternalizeL(aCities, bufStream);
   968 	bufStream.CommitL();
  1098 	bufStream.CommitL();
   969 	CleanupStack::PopAndDestroy(&bufStream);
  1099 	CleanupStack::PopAndDestroy(&bufStream);
   970 	TPtr8 bufferPtr = buffer->Ptr(0); 
  1100 	TPtr8 bufferPtr = buffer->Ptr(0); 
   971 	TIpcArgs args(&bufferPtr);
  1101 	TIpcArgs args(&bufferPtr);
       
  1102 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, RTZ_LOCALIZATIONWRITEALLFREQUENTLYUSEDZONESL, "RTz::LocalizationWriteAllFrequentlyUsedZonesL, CTzServer::ELocalizationWriteAllFrequentlyUsedZones" );
       
  1103 	
   972 	User::LeaveIfError(SendReceive(CTzServer::ELocalizationWriteAllFrequentlyUsedZones, args));
  1104 	User::LeaveIfError(SendReceive(CTzServer::ELocalizationWriteAllFrequentlyUsedZones, args));
   973 	CleanupStack::PopAndDestroy(buffer);
  1105 	CleanupStack::PopAndDestroy(buffer);
       
  1106 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, RTZ_LOCALIZATIONWRITEALLFREQUENTLYUSEDZONESL_EXIT, "RTz::LocalizationWriteAllFrequentlyUsedZonesL Exit" );
       
  1107 	
   974 	}
  1108 	}
   975 
  1109 
   976 /**
  1110 /**
   977 Called by the installation observer plugin to signal the start of an (un)install log.
  1111 Called by the installation observer plugin to signal the start of an (un)install log.
   978 
  1112 
  1044 
  1178 
  1045 /*********************************User Defined Time Zone Handling *****************/
  1179 /*********************************User Defined Time Zone Handling *****************/
  1046 
  1180 
  1047 CTzId* RTz::CreateUserTimeZoneL(const CTzRules& aTzUserRules, const CTzUserNames& aTzUserNames)
  1181 CTzId* RTz::CreateUserTimeZoneL(const CTzRules& aTzUserRules, const CTzUserNames& aTzUserNames)
  1048 	{
  1182 	{
       
  1183     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, RTZ_CREATEUSERTIMEZONEL_ENTRY, "RTz::CreateUserTimeZoneL Entry" );
       
  1184     
  1049 	TInt size = aTzUserNames.SizeOfObject() + aTzUserRules.SizeOfObject();
  1185 	TInt size = aTzUserNames.SizeOfObject() + aTzUserRules.SizeOfObject();
  1050 
  1186 
  1051 	CBufFlat* inpBuffer = CBufFlat::NewL(size);
  1187 	CBufFlat* inpBuffer = CBufFlat::NewL(size);
  1052 	CleanupStack::PushL(inpBuffer);
  1188 	CleanupStack::PushL(inpBuffer);
  1053 	inpBuffer->ExpandL(0, size);
  1189 	inpBuffer->ExpandL(0, size);
  1060 	writeStream.CommitL();
  1196 	writeStream.CommitL();
  1061 	
  1197 	
  1062 	TPtr8 ptrInp(inpBuffer->Ptr(0));
  1198 	TPtr8 ptrInp(inpBuffer->Ptr(0));
  1063 	TPckgBuf<TUint32> idBuffer;
  1199 	TPckgBuf<TUint32> idBuffer;
  1064 	TIpcArgs args(size, &ptrInp, &idBuffer);
  1200 	TIpcArgs args(size, &ptrInp, &idBuffer);
       
  1201 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, RTZ_CREATEUSERTIMEZONEL, "RTz::CreateUserTimeZoneL, CTzServer::ECreateUserTimeZone" );
       
  1202 	
  1065 	User::LeaveIfError(SendReceive(CTzServer::ECreateUserTimeZone, args));
  1203 	User::LeaveIfError(SendReceive(CTzServer::ECreateUserTimeZone, args));
  1066 	CleanupStack::PopAndDestroy(2, inpBuffer);
  1204 	CleanupStack::PopAndDestroy(2, inpBuffer);
  1067 	return CTzId::NewL(idBuffer());
  1205 	return CTzId::NewL(idBuffer());
  1068 	}
  1206 	}
  1069 
  1207 
  1070 CTzUserNames* RTz::GetUserTimeZoneNamesL(const CTzId& aTzId) const
  1208 CTzUserNames* RTz::GetUserTimeZoneNamesL(const CTzId& aTzId) const
  1071 	{
  1209 	{
       
  1210     OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, RTZ_GETUSERTIMEZONENAMESL_ENTRY, "RTz::GetUserTimeZoneNamesL Entry ;Time zone id=%u", aTzId.TimeZoneNumericID());
       
  1211     
  1072 	TInt nameSize = 0;
  1212 	TInt nameSize = 0;
  1073 	TPckg<TInt> nameSizeBuffer(nameSize);
  1213 	TPckg<TInt> nameSizeBuffer(nameSize);
  1074 
  1214 
  1075 	TIpcArgs args(aTzId.TimeZoneNumericID(),&nameSizeBuffer);
  1215 	TIpcArgs args(aTzId.TimeZoneNumericID(),&nameSizeBuffer);
       
  1216 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, RTZ_GETUSERTIMEZONENAMESL, "RTz::GetUserTimeZoneNamesL, CTzServer::EGetUserTimeZoneNamesSize" );
       
  1217 	
  1076 	User::LeaveIfError(SendReceive(CTzServer::EGetUserTimeZoneNamesSize, args));
  1218 	User::LeaveIfError(SendReceive(CTzServer::EGetUserTimeZoneNamesSize, args));
  1077 
  1219 
  1078 	CBufFlat* retBuffer = CBufFlat::NewL(nameSize);
  1220 	CBufFlat* retBuffer = CBufFlat::NewL(nameSize);
  1079 	CleanupStack::PushL(retBuffer);
  1221 	CleanupStack::PushL(retBuffer);
  1080 	retBuffer->ExpandL(0, nameSize);
  1222 	retBuffer->ExpandL(0, nameSize);
  1081 	TPtr8 outPtr(retBuffer->Ptr(0) );
  1223 	TPtr8 outPtr(retBuffer->Ptr(0) );
  1082 	
  1224 	
  1083 	TIpcArgs args2(&outPtr);
  1225 	TIpcArgs args2(&outPtr);
       
  1226 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, DUP1_RTZ_GETUSERTIMEZONENAMESL, "RTz::GetUserTimeZoneNamesL, CTzServer::EGetUserTimeZoneNames" );
       
  1227 	
  1084 	User::LeaveIfError(SendReceive(CTzServer::EGetUserTimeZoneNames, args2));
  1228 	User::LeaveIfError(SendReceive(CTzServer::EGetUserTimeZoneNames, args2));
  1085 	
  1229 	
  1086 	RBufReadStream readStream;
  1230 	RBufReadStream readStream;
  1087 	CleanupClosePushL(readStream);
  1231 	CleanupClosePushL(readStream);
  1088 	readStream.Open(*retBuffer);
  1232 	readStream.Open(*retBuffer);
  1089 	
  1233 	
  1090 	CTzUserNames* names = CTzUserNames::NewL(readStream);
  1234 	CTzUserNames* names = CTzUserNames::NewL(readStream);
  1091 	CleanupStack::PopAndDestroy(2, retBuffer); 
  1235 	CleanupStack::PopAndDestroy(2, retBuffer); 
       
  1236 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, RTZ_GETUSERTIMEZONENAMESL_EXIT, "RTz::GetUserTimeZoneNamesL Exit" );
       
  1237 	
  1092 	return names;
  1238 	return names;
  1093 	}
  1239 	}
  1094 	
  1240 	
  1095 void RTz::UpdateUserTimeZoneL(const CTzId& aTzId, const CTzRules& aTzUserRules, const CTzUserNames& aTzUserNames)
  1241 void RTz::UpdateUserTimeZoneL(const CTzId& aTzId, const CTzRules& aTzUserRules, const CTzUserNames& aTzUserNames)
  1096 	{
  1242 	{
       
  1243     OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, RTZ_UPDATEUSERTIMEZONEL_ENTRY, "RTz::UpdateUserTimeZoneL Entry;Time zone id=%u", aTzId.TimeZoneNumericID());
       
  1244     
  1097 	TInt size = aTzUserNames.SizeOfObject() + aTzUserRules.SizeOfObject();
  1245 	TInt size = aTzUserNames.SizeOfObject() + aTzUserRules.SizeOfObject();
  1098 	
  1246 	
  1099 	CBufFlat* inpBuffer = CBufFlat::NewL(size);
  1247 	CBufFlat* inpBuffer = CBufFlat::NewL(size);
  1100 	CleanupStack::PushL(inpBuffer);
  1248 	CleanupStack::PushL(inpBuffer);
  1101 	inpBuffer->ExpandL(0, size);
  1249 	inpBuffer->ExpandL(0, size);
  1107 	aTzUserNames.ExternalizeL(writeStream);
  1255 	aTzUserNames.ExternalizeL(writeStream);
  1108 	writeStream.CommitL();
  1256 	writeStream.CommitL();
  1109 	
  1257 	
  1110 	TPtr8 ptrInp(inpBuffer->Ptr(0) );
  1258 	TPtr8 ptrInp(inpBuffer->Ptr(0) );
  1111 	TIpcArgs args(size, &ptrInp, aTzId.TimeZoneNumericID());
  1259 	TIpcArgs args(size, &ptrInp, aTzId.TimeZoneNumericID());
       
  1260 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, RTZ_UPDATEUSERTIMEZONEL, "RTz::UpdateUserTimeZoneL, CTzServer::EUpdateUserTimeZone" );
       
  1261 	
  1112 	TInt reply = SendReceive(CTzServer::EUpdateUserTimeZone, args);
  1262 	TInt reply = SendReceive(CTzServer::EUpdateUserTimeZone, args);
  1113 	User::LeaveIfError(reply);
  1263 	User::LeaveIfError(reply);
  1114 	CleanupStack::PopAndDestroy(2, inpBuffer);
  1264 	CleanupStack::PopAndDestroy(2, inpBuffer);
       
  1265 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, RTZ_UPDATEUSERTIMEZONEL_EXIT, "RTz::UpdateUserTimeZoneL Exit" );
       
  1266 	
  1115 	}
  1267 	}
  1116 	
  1268 	
  1117 void RTz::DeleteUserTimeZoneL(const CTzId& aTzId)
  1269 void RTz::DeleteUserTimeZoneL(const CTzId& aTzId)
  1118 	{
  1270 	{
  1119 	TIpcArgs args(aTzId.TimeZoneNumericID());
  1271 	TIpcArgs args(aTzId.TimeZoneNumericID());
  1120 	User::LeaveIfError(SendReceive(CTzServer::EDeleteUserTimeZone, args));
  1272 	User::LeaveIfError(SendReceive(CTzServer::EDeleteUserTimeZone, args));
  1121 	}
  1273 	}
  1122 	
  1274 	
  1123 void RTz::GetUserTimeZoneIdsL(RPointerArray<CTzId>& aTzIds) const
  1275 void RTz::GetUserTimeZoneIdsL(RPointerArray<CTzId>& aTzIds) const
  1124 	{
  1276 	{
       
  1277     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, RTZ_GETUSERTIMEZONEIDSL_ENTRY, "RTz::GetUserTimeZoneIdsL Entry" );
       
  1278     
  1125 	TInt idsSize = 0;
  1279 	TInt idsSize = 0;
  1126 	TPckg<TInt> idsSizeBuffer(idsSize);
  1280 	TPckg<TInt> idsSizeBuffer(idsSize);
  1127 
  1281 
  1128 	TIpcArgs args(&idsSizeBuffer);
  1282 	TIpcArgs args(&idsSizeBuffer);
       
  1283 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, RTZ_GETUSERTIMEZONEIDSL, "RTz::GetUserTimeZoneIdsL, CTzServer::EGetUserTimeZoneIdsSize" );
       
  1284 	
  1129 	User::LeaveIfError(SendReceive(CTzServer::EGetUserTimeZoneIdsSize, args));
  1285 	User::LeaveIfError(SendReceive(CTzServer::EGetUserTimeZoneIdsSize, args));
  1130 
  1286 
  1131 	CBufFlat* retBuffer = CBufFlat::NewL(idsSize);
  1287 	CBufFlat* retBuffer = CBufFlat::NewL(idsSize);
  1132 	CleanupStack::PushL(retBuffer);
  1288 	CleanupStack::PushL(retBuffer);
  1133 	retBuffer->ExpandL(0, idsSize);
  1289 	retBuffer->ExpandL(0, idsSize);
  1134 	TPtr8 outPtr(retBuffer->Ptr(0) );
  1290 	TPtr8 outPtr(retBuffer->Ptr(0) );
  1135 	
  1291 	
  1136 	TIpcArgs args2(&outPtr);
  1292 	TIpcArgs args2(&outPtr);
       
  1293 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, SEND_RECEIVE, DUP1_RTZ_GETUSERTIMEZONEIDSL, "RTz::GetUserTimeZoneIdsL, CTzServer::EGetUserTimeZoneIds" );
       
  1294 	
  1137 	User::LeaveIfError(SendReceive(CTzServer::EGetUserTimeZoneIds, args2));
  1295 	User::LeaveIfError(SendReceive(CTzServer::EGetUserTimeZoneIds, args2));
  1138 	
  1296 	
  1139 	RBufReadStream readStream;
  1297 	RBufReadStream readStream;
  1140 	CleanupClosePushL(readStream);
  1298 	CleanupClosePushL(readStream);
  1141 	readStream.Open(*retBuffer);
  1299 	readStream.Open(*retBuffer);
  1147 		TUint32 id = readStream.ReadUint32L();
  1305 		TUint32 id = readStream.ReadUint32L();
  1148 		CTzId* zone = CTzId::NewL(id);
  1306 		CTzId* zone = CTzId::NewL(id);
  1149 		aTzIds.AppendL(zone);
  1307 		aTzIds.AppendL(zone);
  1150 		}
  1308 		}
  1151 	CleanupStack::PopAndDestroy(2, retBuffer);
  1309 	CleanupStack::PopAndDestroy(2, retBuffer);
       
  1310 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, RTZ_GETUSERTIMEZONEIDSL_EXIT, "RTz::GetUserTimeZoneIdsL Exit" );
       
  1311 	
  1152 	}
  1312 	}
  1153 
  1313 
  1154 
  1314 
  1155 #if defined(_DEBUG)
  1315 #if defined(_DEBUG)
  1156 
  1316