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