|
1 // Copyright (c) 2004-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 <e32base.h> |
|
17 #include "sessmgr.h" |
|
18 #include "srvparams.h" |
|
19 #include "srvsess.h" |
|
20 |
|
21 CSessionManager* CSessionManager::NewLC() |
|
22 { |
|
23 CSessionManager* s = new(ELeave) CSessionManager(); |
|
24 CleanupStack::PushL(s); |
|
25 s->ConstructL(); |
|
26 return s; |
|
27 } |
|
28 |
|
29 CSessionManager::CSessionManager() : |
|
30 CServer2(KServerPriority, ESharableSessions) |
|
31 {} |
|
32 |
|
33 void CSessionManager::ConstructL() |
|
34 { |
|
35 StartL(KServerName); |
|
36 } |
|
37 |
|
38 CSession2* CSessionManager::NewSessionL( |
|
39 const TVersion& aVersion, const RMessage2&) const |
|
40 { |
|
41 // Test if the version specifies a repository session |
|
42 const TVersion KRepositoryVersion( |
|
43 KServerMajorVersion, KServerMinorVersion, KServerBuildVersion); |
|
44 TBool r = User::QueryVersionSupported(aVersion, KRepositoryVersion); |
|
45 if(r) |
|
46 return new(ELeave) CServerSession(); |
|
47 |
|
48 //the version is not supported |
|
49 User::Leave(KErrNotSupported); |
|
50 return 0; //compiler, be quiet! |
|
51 } |