|
1 /* |
|
2 * Copyright (c) 2007-2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef FEATMGR_TLS_DATA_H |
|
22 #define FEATMGR_TLS_DATA_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 #include <featmgr/featurecmn.h> |
|
27 #include "featmgrclient.h" |
|
28 #include "featureclient.h" |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class MFeatureObserver; |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 /** |
|
36 * Feature manager internal implementation. |
|
37 * This object is stored in TLS. |
|
38 * |
|
39 */ |
|
40 NONSHARABLE_CLASS(CFeatMgrTlsData) : public CBase, public MFeatureClient |
|
41 { |
|
42 public: // Constructors and destructor |
|
43 |
|
44 /** |
|
45 * Two-phased constructor. |
|
46 */ |
|
47 static CFeatMgrTlsData* NewL(); |
|
48 |
|
49 /** |
|
50 * Destructor. |
|
51 */ |
|
52 virtual ~CFeatMgrTlsData(); |
|
53 |
|
54 public: |
|
55 /** |
|
56 * Check if TLS can be freed, i.e. if client count is zero (or less). |
|
57 * |
|
58 * @return ETrue if TLS can be freed, EFalse otherwise. |
|
59 */ |
|
60 TBool CanBeFreed() const; |
|
61 /** |
|
62 * Increse client count for this thread. |
|
63 */ |
|
64 void IncreaseClientCount(); |
|
65 |
|
66 /** |
|
67 * Decrease client count for this thread |
|
68 */ |
|
69 void DecreaseClientCount(); |
|
70 |
|
71 /** |
|
72 * From MFeatureClient |
|
73 */ |
|
74 TInt FeatureSupported( TFeatureEntry& aFeature ) const; |
|
75 |
|
76 TInt FeaturesSupported( RFeatureArray& aFeatures ); |
|
77 |
|
78 TInt EnableFeature( TUid aFeature ) const; |
|
79 |
|
80 TInt DisableFeature( TUid aFeature ) const; |
|
81 |
|
82 TInt SetFeature( TUid aFeature, TBool aEnabled, TInt aData ) const; |
|
83 |
|
84 TInt SetFeature( TUid aFeature, TInt aData ) const; |
|
85 |
|
86 TInt AddFeature( TFeatureEntry aFeature ) const; |
|
87 |
|
88 TInt DeleteFeature( TUid aFeature ) const; |
|
89 |
|
90 void ListSupportedFeaturesL( RFeatureUidArray& aSupportedFeatures ); |
|
91 |
|
92 TInt RequestNotification( RFeatureUidArray& aFeatures, TUid& aFeatUid, |
|
93 TRequestStatus& aStatus ); |
|
94 |
|
95 TInt ReRequestNotification( TUid& aFeatUid, TRequestStatus& aStatus ); |
|
96 |
|
97 TInt RequestNotifyCancel( TUid aFeature ) const; |
|
98 |
|
99 TInt RequestNotifyCancelAll( ) const; |
|
100 |
|
101 static void DeleteClient(); |
|
102 |
|
103 TInt SWIStart() const; |
|
104 |
|
105 TInt SWIEnd() const; |
|
106 |
|
107 private: |
|
108 |
|
109 /** |
|
110 * C++ default constructor. |
|
111 */ |
|
112 CFeatMgrTlsData(); |
|
113 |
|
114 /** |
|
115 * By default Symbian 2nd phase constructor is private. |
|
116 */ |
|
117 void ConstructL(); |
|
118 |
|
119 private: // Data |
|
120 |
|
121 // Keep count of clients so that we know when to free TLS |
|
122 TInt iClientCount; |
|
123 |
|
124 // Feature Manager server client |
|
125 RFeatMgrClient iFeatMgrClient; |
|
126 |
|
127 |
|
128 #ifdef EXTENDED_FEATURE_MANAGER_TEST |
|
129 // Debug only API functions |
|
130 public: |
|
131 TInt NumberOfNotifyFeatures( void ) const; |
|
132 TInt CountAllocCells( void ) const; |
|
133 #endif |
|
134 |
|
135 }; |
|
136 |
|
137 #endif // FEATMGR_TLS_DATA_H |
|
138 |
|
139 // End of File |