|
1 /* |
|
2 * Copyright (c) 2006-2006 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: CPSStateMapper class declaration. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_PSSTATEMAPPER_H |
|
21 #define C_PSSTATEMAPPER_H |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <e32property.h> |
|
25 #include <cfcontextobject.h> |
|
26 |
|
27 |
|
28 class MCFContextInterface; |
|
29 |
|
30 /** |
|
31 * P&S state mapper wraps inside a selected P&S key from some category |
|
32 * and maps this key to defined context. |
|
33 * Currently only integer P&S values are handled. If other P&S values |
|
34 * are wanted to map into contexts derive this class and provide support |
|
35 * for this. |
|
36 * |
|
37 * @lib - |
|
38 * @since S60 4.0 |
|
39 */ |
|
40 NONSHARABLE_CLASS( CPSStateMapper ): public CActive |
|
41 { |
|
42 public: |
|
43 |
|
44 // Mapper ids |
|
45 enum TPSStateMapperType |
|
46 { |
|
47 EPSIntMapper, |
|
48 EPSTextMapper |
|
49 }; |
|
50 |
|
51 public: |
|
52 |
|
53 // Destructor |
|
54 ~CPSStateMapper(); |
|
55 |
|
56 public: // New methods |
|
57 |
|
58 virtual TInt MapperType() const = 0; |
|
59 |
|
60 void SetPSCategory (TUid aPSCategory); |
|
61 void SetPSKey (TUint32 aKey); |
|
62 void SetSecurityPolicy (const TSecurityPolicy& aSecurityPolicy); |
|
63 void SetSourceL ( const TDesC& aSource ); |
|
64 void SetTypeL ( const TDesC& aType ); |
|
65 void SetPassThrough(TBool aPassThrough); |
|
66 |
|
67 /** |
|
68 * Returns context source related to this mapping. |
|
69 * |
|
70 * @since S60 4.0 |
|
71 * @param None |
|
72 * @return const TDesC& |
|
73 */ |
|
74 virtual const TDesC& Source() const; |
|
75 |
|
76 /** |
|
77 * Returns context type related to this mapping. |
|
78 * |
|
79 * @since S60 4.0 |
|
80 * @param None |
|
81 * @return const TDesC& |
|
82 */ |
|
83 virtual const TDesC& Type() const; |
|
84 |
|
85 /** |
|
86 * Returns security policy related to this mapping. |
|
87 * |
|
88 * @since S60 4.0 |
|
89 * @param None |
|
90 * @return const TSecurityPolicy& |
|
91 */ |
|
92 virtual const TSecurityPolicy& SecurityPolicy() const; |
|
93 |
|
94 virtual void Define() = 0; |
|
95 virtual void InitializeL() = 0; |
|
96 |
|
97 protected: // New methods |
|
98 |
|
99 /** |
|
100 * Subscribes into property. |
|
101 * |
|
102 * @since S60 4.0 |
|
103 * @param None |
|
104 * @return None |
|
105 */ |
|
106 virtual void Subscribe(); |
|
107 |
|
108 protected: // From base classes |
|
109 |
|
110 // @see CActive |
|
111 virtual void RunL(); |
|
112 |
|
113 // @see CActive |
|
114 virtual void DoCancel(); |
|
115 |
|
116 // @see CActive |
|
117 virtual TInt RunError( TInt aError ); |
|
118 |
|
119 private: // New methods |
|
120 |
|
121 // Informs implementation that propery has changed |
|
122 virtual void ProperyChangedL() = 0; |
|
123 |
|
124 protected: |
|
125 |
|
126 CPSStateMapper( MCFContextInterface& aCF ); |
|
127 virtual void ConstructL( ); |
|
128 |
|
129 protected: // Data |
|
130 |
|
131 // Own: P&S property in hand. |
|
132 RProperty iProperty; |
|
133 |
|
134 |
|
135 public: |
|
136 |
|
137 // P&S category |
|
138 TUid iPSCategory; |
|
139 |
|
140 // P&S key from iPSCategory |
|
141 TUint32 iPSKey; |
|
142 |
|
143 // Context source to publish |
|
144 HBufC* iSource; |
|
145 |
|
146 // Context type to publish |
|
147 HBufC* iType; |
|
148 |
|
149 // Security policy |
|
150 TSecurityPolicy iSecurityPolicy; |
|
151 |
|
152 TBool iPassThrough; |
|
153 |
|
154 // CF interface |
|
155 MCFContextInterface& iCF; |
|
156 |
|
157 CCFContextObject* iContext; |
|
158 |
|
159 }; |
|
160 |
|
161 #endif |