|
1 /* |
|
2 * Copyright (c) 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: Destination interface class. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef DESTINATION_H |
|
19 #define DESTINATION_H |
|
20 |
|
21 // System includes |
|
22 #include <cmconnectionmethod.h> |
|
23 #include <cmmanagerdef.h> |
|
24 #include <E32def.h> |
|
25 #include <e32base.h> |
|
26 #include <metadatabase.h> |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CCmManagerImpl; |
|
30 class CCmDestinationData; |
|
31 class CGulIcon; |
|
32 |
|
33 /** |
|
34 * RCmDestination is for setting/getting values of a network destination. |
|
35 * |
|
36 * @lib cmmanager.lib |
|
37 * @since S60 v3.2 |
|
38 */ |
|
39 NONSHARABLE_CLASS(RCmDestination) |
|
40 { |
|
41 //===================================================================== |
|
42 // Constructors/Destructors |
|
43 // |
|
44 public: |
|
45 |
|
46 /** Default constructor. */ |
|
47 IMPORT_C RCmDestination(); |
|
48 |
|
49 IMPORT_C ~RCmDestination(); |
|
50 |
|
51 IMPORT_C RCmDestination(const RCmDestination& aCmDestination); |
|
52 |
|
53 //===================================================================== |
|
54 // API functions |
|
55 public: |
|
56 |
|
57 /** |
|
58 * Close the session. |
|
59 * |
|
60 * @since S60 3.2 |
|
61 */ |
|
62 IMPORT_C void Close(); |
|
63 |
|
64 /** |
|
65 * Returns the number of connection methods of the destination |
|
66 * |
|
67 * @since 3.2 |
|
68 * @return the number of connection methods belonging to a destination |
|
69 */ |
|
70 IMPORT_C TInt ConnectionMethodCount() const; |
|
71 |
|
72 /** |
|
73 * Returns a reference to the connection method. |
|
74 * The index must be less than the return value of |
|
75 * ConnectionMethodCount(). |
|
76 * |
|
77 * @since 3.2 |
|
78 * @param anIndex |
|
79 * @return a connection method |
|
80 */ |
|
81 IMPORT_C RCmConnectionMethod ConnectionMethodL( TInt anIndex ) const; |
|
82 |
|
83 /** |
|
84 * Returns the connection method with the ECmId. |
|
85 * Leaves with KErrNotFound if not found. |
|
86 * @param aCmId unique id of the requested connection method. |
|
87 * @return connection method |
|
88 */ |
|
89 IMPORT_C RCmConnectionMethod ConnectionMethodByIDL( |
|
90 TInt aCmId ) const; |
|
91 |
|
92 /** |
|
93 * Return the priority of the passed connection method |
|
94 * |
|
95 * @since 3.2 |
|
96 * @param aCCMItem connection method |
|
97 * @return the priority of the queried connection method |
|
98 */ |
|
99 IMPORT_C TUint PriorityL(const RCmConnectionMethod& aCCMItem ) const; |
|
100 |
|
101 //Getting attributes |
|
102 |
|
103 /** |
|
104 * Returns the destination's Name attribute |
|
105 * HBuf ownership is passed to the caller |
|
106 * |
|
107 * @since 3.2 |
|
108 * @return HBufC* Passes returned value's ownership to the caller |
|
109 */ |
|
110 IMPORT_C HBufC* NameLC() const; |
|
111 |
|
112 /** |
|
113 * Returns the destination's Id attribute |
|
114 * |
|
115 * @since 3.2 |
|
116 * @return the destination's id |
|
117 */ |
|
118 IMPORT_C TUint32 Id() const; |
|
119 |
|
120 /** |
|
121 * Returns the destination's ElementId attribute |
|
122 * |
|
123 * @since 3.2 |
|
124 * @return the destination's element id |
|
125 */ |
|
126 IMPORT_C TUint32 ElementId() const; |
|
127 |
|
128 /** |
|
129 * Returns the Icon pointer |
|
130 * This function leaves if the client does not have a valid UI context |
|
131 * |
|
132 * @since 3.2 |
|
133 * @return the destination icon |
|
134 */ |
|
135 IMPORT_C CGulIcon* IconL() const; |
|
136 |
|
137 /** |
|
138 * Returns the Metadata |
|
139 * |
|
140 * @since 3.2 |
|
141 * @param aMetaField the meta data field to query |
|
142 * @return the value of the requested field |
|
143 */ |
|
144 IMPORT_C TUint32 MetadataL( CMManager::TSnapMetadataField aMetaField ) const; |
|
145 |
|
146 /** |
|
147 * Return the protection level of the destination. |
|
148 * |
|
149 * @since 3.2 |
|
150 * @return protection level of the destination |
|
151 */ |
|
152 IMPORT_C CMManager::TProtectionLevel ProtectionLevel() const; |
|
153 |
|
154 /** |
|
155 * Returns if there's a connection created with any of the destination's |
|
156 * connection method. |
|
157 * |
|
158 * @since 3.2 |
|
159 * @return ETrue if there's a connection with any of the destination's |
|
160 * connection method. |
|
161 */ |
|
162 IMPORT_C TBool IsConnectedL() const; |
|
163 |
|
164 /** |
|
165 * Returns whether the destination is hidden or not. |
|
166 * |
|
167 * @since 3.2 |
|
168 * @return ETrue if the destination is hidden |
|
169 */ |
|
170 IMPORT_C TBool IsHidden() const; |
|
171 |
|
172 /** |
|
173 * checks if destinations are the same |
|
174 * |
|
175 * @since S60 3.2 |
|
176 * @param aDestination the destination being compared |
|
177 * @return ETrue if the destinations are the same |
|
178 */ |
|
179 IMPORT_C TBool operator==(const RCmDestination& aDestination ) const; |
|
180 |
|
181 /** |
|
182 * checks if destinations are not the same |
|
183 * |
|
184 * @since S60 3.2 |
|
185 * @param aDestination the destination being compared |
|
186 * @return ETrue if the destinations are different |
|
187 */ |
|
188 IMPORT_C TBool operator!=(const RCmDestination& aDestination ) const; |
|
189 |
|
190 /** |
|
191 * assignment operator |
|
192 * |
|
193 * @since S60 3.2 |
|
194 * @param aDestination the destination being compared |
|
195 * @return RCmDestination |
|
196 */ |
|
197 IMPORT_C RCmDestination& operator=(const RCmDestination& |
|
198 aCmDestination); |
|
199 |
|
200 /** |
|
201 * Create a connection method that belongs to this destination. |
|
202 * @param aImplementationUid - implementation uid (bearer type) of the |
|
203 * connection method to be created |
|
204 * @return newly created connection method |
|
205 */ |
|
206 IMPORT_C RCmConnectionMethod CreateConnectionMethodL( TUint32 aBearerType ); |
|
207 |
|
208 /* |
|
209 * Adds an existing connection method to a destination |
|
210 * @param aConnectionMethod Connection method to be added |
|
211 * @return index in the Connection Method list |
|
212 */ |
|
213 IMPORT_C TInt AddConnectionMethodL( RCmConnectionMethod aConnectionMethod ); |
|
214 |
|
215 /* |
|
216 * Embeds an existing destination into this destination. |
|
217 * @param RCmDestination - Destination to be embedded |
|
218 * @return TInt - index in the Connection Method list |
|
219 */ |
|
220 IMPORT_C TInt AddEmbeddedDestinationL( const RCmDestination& aDestination ); |
|
221 |
|
222 /** |
|
223 * Remove a connection method from a destination and delete it |
|
224 * on update. |
|
225 * Exception: conenction method is not deleted if it's referenced |
|
226 * from any other destination. |
|
227 * @param aConnectionMethod the connection method to be deleted. |
|
228 */ |
|
229 IMPORT_C void DeleteConnectionMethodL( RCmConnectionMethod& aConnectionMethod ); |
|
230 |
|
231 /** |
|
232 * Remove connection method from the destination |
|
233 * @param aConnectionMethod connection method to be removed |
|
234 */ |
|
235 IMPORT_C void RemoveConnectionMethodL( RCmConnectionMethod aConnectionMethod ); |
|
236 |
|
237 |
|
238 /** |
|
239 * Set the connection method's priority based on the passed index. |
|
240 * @param aCCMItem the connection method item |
|
241 * @param aIndex the new priority of the connection method in the |
|
242 * destination |
|
243 */ |
|
244 IMPORT_C void ModifyPriorityL( RCmConnectionMethod& aCCMItem, |
|
245 TUint aIndex ); |
|
246 |
|
247 /** |
|
248 * Set the destination's name |
|
249 * @param aDestinationName new name of the destination |
|
250 */ |
|
251 IMPORT_C void SetNameL( const TDesC& aName ); |
|
252 |
|
253 /** |
|
254 * Set the destination's icon index. |
|
255 * This fucton leaves if the client does not have a valid UI context |
|
256 * @param aIconIndex new icon index of the destination |
|
257 */ |
|
258 IMPORT_C void SetIconL( TUint32 anIndex ); |
|
259 |
|
260 /** |
|
261 * Set the Metadata |
|
262 * @param aMetaField field to be modified |
|
263 * @param aValue value to be set |
|
264 */ |
|
265 IMPORT_C void SetMetadataL( CMManager::TSnapMetadataField aMetaField, |
|
266 TUint32 aValue ); |
|
267 |
|
268 /** |
|
269 * Set the protection level of the destination. |
|
270 * @param aProtLevel new protection level |
|
271 */ |
|
272 IMPORT_C void SetProtectionL( CMManager::TProtectionLevel aProtLevel ); |
|
273 |
|
274 /** |
|
275 * Set if the destination is hidden or not. |
|
276 * @param aHidden - ETrue if destination is hidden |
|
277 */ |
|
278 IMPORT_C void SetHiddenL( TBool aHidden ); |
|
279 |
|
280 /** |
|
281 * Update all values of the destination and its connection method. |
|
282 * Nothing if stored, if update leaves due to any reason. |
|
283 */ |
|
284 IMPORT_C void UpdateL(); |
|
285 |
|
286 /** |
|
287 * Delete destination and its connection methods from CommsDat. |
|
288 * Connection methods that belong to other destination, too, are |
|
289 * not deleted. |
|
290 */ |
|
291 IMPORT_C void DeleteLD(); |
|
292 |
|
293 /** |
|
294 * Create a connection method with given id that belongs to this destination. |
|
295 * @param aImplementationUid - implementation uid (bearer type) of the |
|
296 * connection method to be created |
|
297 * @return newly created connection method or leaves with |
|
298 * KErrAlreadyExists if there exists CM with the same Id. |
|
299 */ |
|
300 IMPORT_C RCmConnectionMethod CreateConnectionMethodL( TUint32 aBearerType, |
|
301 TUint32 aConnMethId ); |
|
302 |
|
303 |
|
304 //======================================================================= |
|
305 // Member variables |
|
306 // |
|
307 private: |
|
308 |
|
309 /** |
|
310 * the implementation class |
|
311 */ |
|
312 CCmDestinationData* iDestinatonData; |
|
313 |
|
314 private: |
|
315 |
|
316 friend class RCmManager; |
|
317 friend class RCmConnectionMethod; |
|
318 }; |
|
319 |
|
320 |
|
321 #endif // DESTINATION_H |