|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implementation of subsession registry class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include "posindicatorsubsessionregistry.h" |
|
22 #include "posindicatorserversubsession.h" |
|
23 #include "posindicatorlogger.h" |
|
24 #include <e32base.h> |
|
25 |
|
26 // --------------------------------------------------------------------------- |
|
27 // CPosIndicatorSubSessionRegistry::NewL |
|
28 // --------------------------------------------------------------------------- |
|
29 CPosIndicatorSubSessionRegistry* CPosIndicatorSubSessionRegistry::NewL() |
|
30 { |
|
31 FUNC("CPosIndicatorSubSessionRegistry::NewL"); |
|
32 CPosIndicatorSubSessionRegistry* self = new ( ELeave ) CPosIndicatorSubSessionRegistry; |
|
33 CleanupStack::PushL( self ); |
|
34 self->ConstructL(); |
|
35 CleanupStack::Pop(); |
|
36 return self; |
|
37 } |
|
38 |
|
39 // --------------------------------------------------------------------------- |
|
40 // CPosIndicatorSubSessionRegistry::CPosIndicatorSubSessionRegistry |
|
41 // --------------------------------------------------------------------------- |
|
42 CPosIndicatorSubSessionRegistry::CPosIndicatorSubSessionRegistry() |
|
43 { |
|
44 FUNC("CPosIndicatorSubSessionRegistry::CPosIndicatorSubSessionRegistry"); |
|
45 } |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // CPosIndicatorSubSessionRegistry::~CPosIndicatorSubSessionRegistry |
|
49 // --------------------------------------------------------------------------- |
|
50 CPosIndicatorSubSessionRegistry::~CPosIndicatorSubSessionRegistry() |
|
51 { |
|
52 FUNC("CPosIndicatorSubSessionRegistry::~CPosIndicatorSubSessionRegistry"); |
|
53 delete iRegistryIndex; |
|
54 delete iRegistryContainerIndex; |
|
55 } |
|
56 |
|
57 |
|
58 // --------------------------------------------------------------------------- |
|
59 // CPosIndicatorSubSessionRegistry::ConstructL |
|
60 // --------------------------------------------------------------------------- |
|
61 void CPosIndicatorSubSessionRegistry::ConstructL() |
|
62 { |
|
63 FUNC("CPosIndicatorSubSessionRegistry::ConstructL"); |
|
64 iRegistryIndex = CObjectIx::NewL(); |
|
65 iRegistryContainerIndex = CObjectConIx::NewL(); |
|
66 iRegistryContainer = iRegistryContainerIndex->CreateL(); |
|
67 } |
|
68 |
|
69 // --------------------------------------------------------------------------- |
|
70 // CPosIndicatorSubSessionRegistry::AddSubSessionL |
|
71 // --------------------------------------------------------------------------- |
|
72 TInt CPosIndicatorSubSessionRegistry::AddSubSessionL( |
|
73 CPosIndicatorServerSubsession* aSubSession) |
|
74 { |
|
75 FUNC("CPosIndicatorSubSessionRegistry::AddSubSessionL"); |
|
76 iRegistryContainer->AddL( aSubSession ); |
|
77 return iRegistryIndex->AddL( aSubSession ); |
|
78 } |
|
79 |
|
80 // --------------------------------------------------------------------------- |
|
81 // CPosIndicatorSubSessionRegistry::CloseSubSession |
|
82 // --------------------------------------------------------------------------- |
|
83 TInt CPosIndicatorSubSessionRegistry::CloseSubSession( TUint aHandle ) |
|
84 { |
|
85 FUNC("CPosIndicatorSubSessionRegistry::CloseSubSession"); |
|
86 if ( iRegistryIndex->At( aHandle ) ) |
|
87 { |
|
88 // Removes the sub-session object and closes |
|
89 // the handle i,e. destroys the object |
|
90 iRegistryIndex->Remove( aHandle ); |
|
91 return KErrNone; |
|
92 } |
|
93 return KErrBadHandle; |
|
94 } |
|
95 |
|
96 // --------------------------------------------------------------------------- |
|
97 // CPosIndicatorSubSessionRegistry::SubSessionFromHandle |
|
98 // --------------------------------------------------------------------------- |
|
99 CPosIndicatorServerSubsession* CPosIndicatorSubSessionRegistry:: |
|
100 SubSessionFromHandle( TUint aHandle ) |
|
101 { |
|
102 FUNC("CPosIndicatorSubSessionRegistry::SubSessionFromHandle"); |
|
103 return static_cast<CPosIndicatorServerSubsession*> (iRegistryIndex->At(aHandle)); |
|
104 } |
|
105 |
|
106 // end of file |