2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Destination interface class.
22 #include <cmconnectionmethod.h>
23 #include <cmmanagerdef.h>
26 #include <metadatabase.h>
28 // FORWARD DECLARATIONS
30 class CCmDestinationData;
34 * RCmDestination is for setting/getting values of a network destination.
39 NONSHARABLE_CLASS(RCmDestination)
41 //=====================================================================
42 // Constructors/Destructors
46 /** Default constructor. */
47 IMPORT_C RCmDestination();
49 IMPORT_C ~RCmDestination();
51 IMPORT_C RCmDestination(const RCmDestination& aCmDestination);
53 //=====================================================================
62 IMPORT_C void Close();
65 * Returns the number of connection methods of the destination
68 * @return the number of connection methods belonging to a destination
70 IMPORT_C TInt ConnectionMethodCount() const;
73 * Returns a reference to the connection method.
74 * The index must be less than the return value of
75 * ConnectionMethodCount().
79 * @return a connection method
81 IMPORT_C RCmConnectionMethod ConnectionMethodL( TInt anIndex ) const;
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
89 IMPORT_C RCmConnectionMethod ConnectionMethodByIDL(
93 * Return the priority of the passed connection method
96 * @param aCCMItem connection method
97 * @return the priority of the queried connection method
99 IMPORT_C TUint PriorityL(const RCmConnectionMethod& aCCMItem ) const;
104 * Returns the destination's Name attribute
105 * HBuf ownership is passed to the caller
108 * @return HBufC* Passes returned value's ownership to the caller
110 IMPORT_C HBufC* NameLC() const;
113 * Returns the destination's Id attribute
116 * @return the destination's id
118 IMPORT_C TUint32 Id() const;
121 * Returns the destination's ElementId attribute
124 * @return the destination's element id
126 IMPORT_C TUint32 ElementId() const;
129 * Returns the Icon pointer
130 * This function leaves if the client does not have a valid UI context
133 * @return the destination icon
135 IMPORT_C CGulIcon* IconL() const;
138 * Returns the Metadata
141 * @param aMetaField the meta data field to query
142 * @return the value of the requested field
144 IMPORT_C TUint32 MetadataL( CMManager::TSnapMetadataField aMetaField ) const;
147 * Return the protection level of the destination.
150 * @return protection level of the destination
152 IMPORT_C CMManager::TProtectionLevel ProtectionLevel() const;
155 * Returns if there's a connection created with any of the destination's
159 * @return ETrue if there's a connection with any of the destination's
162 IMPORT_C TBool IsConnectedL() const;
165 * Returns whether the destination is hidden or not.
168 * @return ETrue if the destination is hidden
170 IMPORT_C TBool IsHidden() const;
173 * checks if destinations are the same
176 * @param aDestination the destination being compared
177 * @return ETrue if the destinations are the same
179 IMPORT_C TBool operator==(const RCmDestination& aDestination ) const;
182 * checks if destinations are not the same
185 * @param aDestination the destination being compared
186 * @return ETrue if the destinations are different
188 IMPORT_C TBool operator!=(const RCmDestination& aDestination ) const;
191 * assignment operator
194 * @param aDestination the destination being compared
195 * @return RCmDestination
197 IMPORT_C RCmDestination& operator=(const RCmDestination&
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
206 IMPORT_C RCmConnectionMethod CreateConnectionMethodL( TUint32 aBearerType );
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
213 IMPORT_C TInt AddConnectionMethodL( RCmConnectionMethod aConnectionMethod );
216 * Embeds an existing destination into this destination.
217 * @param RCmDestination - Destination to be embedded
218 * @return TInt - index in the Connection Method list
220 IMPORT_C TInt AddEmbeddedDestinationL( const RCmDestination& aDestination );
223 * Remove a connection method from a destination and delete it
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.
229 IMPORT_C void DeleteConnectionMethodL( RCmConnectionMethod& aConnectionMethod );
232 * Remove connection method from the destination
233 * @param aConnectionMethod connection method to be removed
235 IMPORT_C void RemoveConnectionMethodL( RCmConnectionMethod aConnectionMethod );
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
244 IMPORT_C void ModifyPriorityL( RCmConnectionMethod& aCCMItem,
248 * Set the destination's name
249 * @param aDestinationName new name of the destination
251 IMPORT_C void SetNameL( const TDesC& aName );
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
258 IMPORT_C void SetIconL( TUint32 anIndex );
262 * @param aMetaField field to be modified
263 * @param aValue value to be set
265 IMPORT_C void SetMetadataL( CMManager::TSnapMetadataField aMetaField,
269 * Set the protection level of the destination.
270 * @param aProtLevel new protection level
272 IMPORT_C void SetProtectionL( CMManager::TProtectionLevel aProtLevel );
275 * Set if the destination is hidden or not.
276 * @param aHidden - ETrue if destination is hidden
278 IMPORT_C void SetHiddenL( TBool aHidden );
281 * Update all values of the destination and its connection method.
282 * Nothing if stored, if update leaves due to any reason.
284 IMPORT_C void UpdateL();
287 * Delete destination and its connection methods from CommsDat.
288 * Connection methods that belong to other destination, too, are
291 IMPORT_C void DeleteLD();
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.
300 IMPORT_C RCmConnectionMethod CreateConnectionMethodL( TUint32 aBearerType,
301 TUint32 aConnMethId );
304 //=======================================================================
310 * the implementation class
312 CCmDestinationData* iDestinatonData;
316 friend class RCmManager;
317 friend class RCmConnectionMethod;
321 #endif // DESTINATION_H