|
1 /* |
|
2 * Copyright (c) 2004-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: Central repository proxy, which is used by all CR dependent. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CVTENGCRPROXY_H |
|
21 #define CVTENGCRPROXY_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <e32std.h> |
|
26 #include <centralrepository.h> |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CVtEngCRObserverItem; |
|
30 class CRepository; |
|
31 class MVtEngCRSettingObserver; |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 /** |
|
36 * Central repository interface for video telephony. |
|
37 * |
|
38 * @lib videoteleng.lib |
|
39 * @since Series 60 3.0 |
|
40 */ |
|
41 NONSHARABLE_CLASS( CVtEngCRProxy ) : public CBase |
|
42 { |
|
43 public: // Data structures. |
|
44 |
|
45 // Internal data structure for storing CR sessions. |
|
46 NONSHARABLE_CLASS( CCRSession ) : public CBase |
|
47 { |
|
48 public: |
|
49 /** |
|
50 * Destructor needed. |
|
51 */ |
|
52 ~CCRSession(); |
|
53 |
|
54 // CenRep session. |
|
55 CRepository* iSession; |
|
56 // Uid attached to CenRep session. |
|
57 TUid iUid; |
|
58 }; |
|
59 |
|
60 public: // Constructors and destructor. |
|
61 |
|
62 /** |
|
63 * Two-phased constructor. |
|
64 * @return instance of CVtEngCRProxy |
|
65 */ |
|
66 static CVtEngCRProxy* NewL( ); |
|
67 |
|
68 /** |
|
69 * Destructor. |
|
70 */ |
|
71 virtual ~CVtEngCRProxy(); |
|
72 |
|
73 public: // New functions |
|
74 |
|
75 /** |
|
76 * Sets integer value to Central Repository. |
|
77 * @param aUid used UID |
|
78 * @param aId which key to use |
|
79 * @param aVal a value to set |
|
80 * @return error code |
|
81 */ |
|
82 TInt Set( const TUid aUid, const TUint32 aId, TInt aVal ); |
|
83 |
|
84 /** |
|
85 * Sets real value to Central Repository. |
|
86 * @param aUid used UID |
|
87 * @param aId which key to use |
|
88 * @param aVal a value to set |
|
89 * @return error code |
|
90 */ |
|
91 TInt Set( const TUid aUid, const TUint32 aId, const TReal& aVal ); |
|
92 |
|
93 /** |
|
94 * Sets binary value to Central Repository. |
|
95 * @param aUid used UID |
|
96 * @param aId which key to use |
|
97 * @param aVal a value to set |
|
98 * @return error code |
|
99 */ |
|
100 TInt Set( const TUid aUid, const TUint32 aId, const TDesC8& aVal ); |
|
101 |
|
102 /** |
|
103 * Sets string value to Central Repository. |
|
104 * @param aUid used UID |
|
105 * @param aId which key to use |
|
106 * @param aVal a value to set |
|
107 * @return error code |
|
108 */ |
|
109 TInt Set( const TUid aUid, const TUint32 aId, const TDesC16& aVal ); |
|
110 |
|
111 /** |
|
112 * Gets integer value from Central Repository. |
|
113 * @param aUid used UID |
|
114 * @param aId which key to use |
|
115 * @param aVal a value in return |
|
116 * @return error code |
|
117 */ |
|
118 TInt Get( const TUid aUid, const TUint32 aId, TInt& aVal ); |
|
119 |
|
120 /** |
|
121 * Gets real value from Central Repository. |
|
122 * @param aUid used UID |
|
123 * @param aId which key to use |
|
124 * @param aVal a value in return |
|
125 * @return error code |
|
126 */ |
|
127 TInt Get( const TUid aUid, const TUint32 aId, TReal& aVal ); |
|
128 |
|
129 /** |
|
130 * Gets binary value from Central Repository |
|
131 * @param aUid used UID |
|
132 * @param aId which key to use |
|
133 * @param aVal a value in return |
|
134 * @return error code |
|
135 */ |
|
136 TInt Get( const TUid aUid, const TUint32 aId, TDes8& aVal ); |
|
137 |
|
138 /** |
|
139 * Gets string value from Central Repository. |
|
140 * @param aUid used UID |
|
141 * @param aId which key to use |
|
142 * @param aVal a value in return |
|
143 * @return error code |
|
144 */ |
|
145 TInt Get( const TUid aUid, const TUint32 aId, TDes16& aVal ); |
|
146 |
|
147 /** |
|
148 * Add a new Cen Rep interested object. |
|
149 * @param aObserver callback interface |
|
150 */ |
|
151 void RegisterInterestedL( CVtEngCRObserverItem* aObserver ); |
|
152 |
|
153 /** |
|
154 * Removes an observer. |
|
155 * @param aObserver to be removed |
|
156 */ |
|
157 void RemoveInterested( CVtEngCRObserverItem& aObserver ); |
|
158 |
|
159 private: // New functions |
|
160 |
|
161 /** |
|
162 * Gets a Cen Rep session matching UID. |
|
163 * @param aUid UID to use in search |
|
164 * @param aCRSession found session or a new session |
|
165 * @return error code |
|
166 */ |
|
167 TInt GetSessionL( const TUid aUid, CRepository*& aCRSession ); |
|
168 |
|
169 /** |
|
170 * Creates an id-CenRep paired session. |
|
171 * @param aUid the UID to use |
|
172 * @return new session or NULL |
|
173 */ |
|
174 CCRSession* NewCRSessionL( TUid aUid ); |
|
175 |
|
176 /** |
|
177 * Finds observer item. |
|
178 * @param aKey |
|
179 * @param aIndex |
|
180 * @return observer item or NULL |
|
181 */ |
|
182 CVtEngCRObserverItem* FindItem( |
|
183 const TUint32 aKey, TInt& aIndex ) const; |
|
184 |
|
185 /** |
|
186 * Removes all observers |
|
187 * |
|
188 */ |
|
189 void RemoveAllObservers(); |
|
190 |
|
191 /** |
|
192 * Removes all Central repository instances |
|
193 * |
|
194 */ |
|
195 void RemoveSessions(); |
|
196 |
|
197 /** |
|
198 * Maps a given UID to a certain central repository instance |
|
199 * @param aUid the UID to map |
|
200 * @return found CRepository item or NULL |
|
201 */ |
|
202 CRepository* MapUidToCR( const TUid aUid ); |
|
203 |
|
204 /** |
|
205 * Finds observer item. |
|
206 * @param aUid |
|
207 * @param aKey |
|
208 * @param aIndex |
|
209 * @return observer item or NULL |
|
210 */ |
|
211 CVtEngCRObserverItem* FindItem( const TUid& aUid, const TUint32 aKey, |
|
212 TInt& aIndex ) const; |
|
213 |
|
214 private: |
|
215 |
|
216 /** |
|
217 * C++ default constructor. |
|
218 */ |
|
219 CVtEngCRProxy(); |
|
220 |
|
221 /** |
|
222 * By default Symbian 2nd phase constructor is private. |
|
223 */ |
|
224 void ConstructL( ); |
|
225 |
|
226 private: // Data |
|
227 |
|
228 // Storage for data observers. |
|
229 RPointerArray<CVtEngCRObserverItem> iObserverItems; |
|
230 |
|
231 // Array for central repository sessions. |
|
232 RPointerArray<CVtEngCRProxy::CCRSession> iCRSessions; |
|
233 }; |
|
234 |
|
235 #endif // CVTENGCRPROXY_H |
|
236 |
|
237 // End of File |