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". |
15 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
15 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
16 #include <tzuserdefineddata.h> |
16 #include <tzuserdefineddata.h> |
17 #endif |
17 #endif |
18 #include "timezoneserver.h" |
18 #include "timezoneserver.h" |
19 #include "timezonesession.h" |
19 #include "timezonesession.h" |
|
20 #include "OstTraceDefinitions.h" |
|
21 #ifdef OST_TRACE_COMPILER_IN_USE |
|
22 #include "timezoneserverTraces.h" |
|
23 #endif |
|
24 |
20 |
25 |
21 // Set server priority |
26 // Set server priority |
22 const TInt KServerPriority = 0; // EStandard Priority |
27 const TInt KServerPriority = 0; // EStandard Priority |
23 |
28 |
24 // indexes into TPolicyElement::KPolicyElements |
29 // indexes into TPolicyElement::KPolicyElements |
92 // Rename the server process to "TZServer" |
97 // Rename the server process to "TZServer" |
93 // Start the server |
98 // Start the server |
94 // |
99 // |
95 void CTzServer::ConstructL() |
100 void CTzServer::ConstructL() |
96 { |
101 { |
|
102 OstTraceDef0( OST_TRACE_CATEGORY_DEBUG,TRACE_FLOW_PARAM, CTZSERVER_CONSTRUCTL_ENTRY, "CTzServer::ConstructL Entry" ); |
|
103 |
97 iTzUserDataDb = CTzUserDataDb::NewL(); |
104 iTzUserDataDb = CTzUserDataDb::NewL(); |
98 iTzSwiObserver = CTzSwiObserver::NewL(); |
105 iTzSwiObserver = CTzSwiObserver::NewL(); |
99 iTimeZoneMgr = CTzConfigAgent::NewL(*this, *iTzUserDataDb, *iTzSwiObserver); |
106 iTimeZoneMgr = CTzConfigAgent::NewL(*this, *iTzUserDataDb, *iTzSwiObserver); |
100 iTzLocalizationDb = CTzLocalizationDb::NewL(*this); |
107 iTzLocalizationDb = CTzLocalizationDb::NewL(*this); |
101 iTimeZoneMgr->SetLocalizationDb(iTzLocalizationDb); |
108 iTimeZoneMgr->SetLocalizationDb(iTzLocalizationDb); |
102 iTzUserDataDb->AddObserverL(iTimeZoneMgr); |
109 iTzUserDataDb->AddObserverL(iTimeZoneMgr); |
103 iTimeZoneMgr->AddObserverL(iTzLocalizationDb); |
110 iTimeZoneMgr->AddObserverL(iTzLocalizationDb); |
104 StartL(KTimeZoneServerName); |
111 StartL(KTimeZoneServerName); |
|
112 OstTraceDef0( OST_TRACE_CATEGORY_DEBUG,TRACE_FLOW_PARAM, CTZSERVER_CONSTRUCTL_EXIT, "CTzServer::ConstructL Exit" ); |
|
113 |
105 } |
114 } |
106 |
115 |
107 // Create a new server session |
116 // Create a new server session |
108 CSession2* CTzServer::NewSessionL(const TVersion& aVersion,const RMessage2& /*aMessage*/) const |
117 CSession2* CTzServer::NewSessionL(const TVersion& aVersion,const RMessage2& /*aMessage*/) const |
109 { |
118 { |
|
119 OstTraceDefExt3( OST_TRACE_CATEGORY_DEBUG,TRACE_FLOW_PARAM, CTZSERVER_NEWSESSIONL_ENTRY, "CTzServer::NewSessionL Entry;Major version No=%hhd;Minorr version No=%hhd;Build version No=%hd", aVersion.iMajor, aVersion.iMinor, aVersion.iBuild ); |
|
120 |
|
121 |
110 TVersion ver(KTimeZoneServerMajorVersion, KTimeZoneServerMinorVersion, KTimeZoneServerBuildVersion); |
122 TVersion ver(KTimeZoneServerMajorVersion, KTimeZoneServerMinorVersion, KTimeZoneServerBuildVersion); |
111 if (!User::QueryVersionSupported(ver,aVersion)) |
123 if (!User::QueryVersionSupported(ver,aVersion)) |
112 { |
124 { |
|
125 OstTraceDef1( OST_TRACE_CATEGORY_DEBUG,TRACE_ERROR, CTZSERVER_NEWSESSIONL, "CTzServer::NewSessionL Version not supported Error value: %d", KErrNotSupported ); |
|
126 |
113 User::Leave(KErrNotSupported); |
127 User::Leave(KErrNotSupported); |
114 } |
128 } |
115 |
129 |
116 CTzServerSession* session = CTzServerSession::NewL(); |
130 CTzServerSession* session = CTzServerSession::NewL(); |
117 |
131 |
118 SessionAdded(); |
132 SessionAdded(); |
|
133 OstTraceDef0( OST_TRACE_CATEGORY_DEBUG,TRACE_FLOW_PARAM, DUP1_CTZSERVER_NEWSESSIONL_EXIT, "CTzServer::NewSessionL Exit" ); |
|
134 |
119 return session; |
135 return session; |
120 } |
136 } |
121 |
137 |
122 void CTzServer::SessionClosed() const |
138 void CTzServer::SessionClosed() const |
123 { |
139 { |
139 // Notifies Change to all client sessions |
155 // Notifies Change to all client sessions |
140 // each client is responsible for rejecting the call |
156 // each client is responsible for rejecting the call |
141 // if there is no pending request |
157 // if there is no pending request |
142 void CTzServer::NotifyTZStatusChange(RTz::TTzChanges aChange, const TAny* aRequester) |
158 void CTzServer::NotifyTZStatusChange(RTz::TTzChanges aChange, const TAny* aRequester) |
143 { |
159 { |
|
160 |
144 iSessionIter.SetToFirst(); |
161 iSessionIter.SetToFirst(); |
145 CSession2* pS; |
162 CSession2* pS; |
146 while ((pS = iSessionIter++)!=NULL) |
163 while ((pS = iSessionIter++)!=NULL) |
147 { |
164 { |
148 (static_cast<CTzServerSession*>(pS))->NotifyTZStatusChange(aChange, aRequester); |
165 (static_cast<CTzServerSession*>(pS))->NotifyTZStatusChange(aChange, aRequester); |