williamr@2: /* williamr@2: * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@2: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: Destination interface class. williamr@2: * williamr@2: */ williamr@2: williamr@2: #ifndef DESTINATION_H williamr@2: #define DESTINATION_H williamr@2: williamr@2: // System includes williamr@2: #include williamr@2: #include williamr@4: #include williamr@2: #include williamr@2: #include williamr@2: williamr@2: // FORWARD DECLARATIONS williamr@2: class CCmManagerImpl; williamr@2: class CCmDestinationData; williamr@2: class CGulIcon; williamr@2: williamr@2: /** williamr@2: * RCmDestination is for setting/getting values of a network destination. williamr@2: * williamr@2: * @lib cmmanager.lib williamr@2: * @since S60 v3.2 williamr@2: */ williamr@2: NONSHARABLE_CLASS(RCmDestination) williamr@2: { williamr@2: //===================================================================== williamr@2: // Constructors/Destructors williamr@2: // williamr@2: public: williamr@2: williamr@2: /** Default constructor. */ williamr@2: IMPORT_C RCmDestination(); williamr@2: williamr@2: IMPORT_C ~RCmDestination(); williamr@2: williamr@2: IMPORT_C RCmDestination(const RCmDestination& aCmDestination); williamr@2: williamr@2: //===================================================================== williamr@2: // API functions williamr@2: public: williamr@2: williamr@2: /** williamr@2: * Close the session. williamr@2: * williamr@2: * @since S60 3.2 williamr@2: */ williamr@2: IMPORT_C void Close(); williamr@2: williamr@2: /** williamr@2: * Returns the number of connection methods of the destination williamr@2: * williamr@2: * @since 3.2 williamr@2: * @return the number of connection methods belonging to a destination williamr@2: */ williamr@2: IMPORT_C TInt ConnectionMethodCount() const; williamr@2: williamr@2: /** williamr@2: * Returns a reference to the connection method. williamr@2: * The index must be less than the return value of williamr@2: * ConnectionMethodCount(). williamr@2: * williamr@2: * @since 3.2 williamr@2: * @param anIndex williamr@2: * @return a connection method williamr@2: */ williamr@2: IMPORT_C RCmConnectionMethod ConnectionMethodL( TInt anIndex ) const; williamr@2: williamr@2: /** williamr@2: * Returns the connection method with the ECmId. williamr@2: * Leaves with KErrNotFound if not found. williamr@2: * @param aCmId unique id of the requested connection method. williamr@2: * @return connection method williamr@2: */ williamr@2: IMPORT_C RCmConnectionMethod ConnectionMethodByIDL( williamr@2: TInt aCmId ) const; williamr@2: williamr@2: /** williamr@2: * Return the priority of the passed connection method williamr@2: * williamr@2: * @since 3.2 williamr@2: * @param aCCMItem connection method williamr@2: * @return the priority of the queried connection method williamr@2: */ williamr@2: IMPORT_C TUint PriorityL(const RCmConnectionMethod& aCCMItem ) const; williamr@2: williamr@2: //Getting attributes williamr@2: williamr@2: /** williamr@2: * Returns the destination's Name attribute williamr@2: * HBuf ownership is passed to the caller williamr@2: * williamr@2: * @since 3.2 williamr@2: * @return HBufC* Passes returned value's ownership to the caller williamr@2: */ williamr@2: IMPORT_C HBufC* NameLC() const; williamr@2: williamr@2: /** williamr@2: * Returns the destination's Id attribute williamr@2: * williamr@2: * @since 3.2 williamr@2: * @return the destination's id williamr@2: */ williamr@2: IMPORT_C TUint32 Id() const; williamr@2: williamr@2: /** williamr@2: * Returns the destination's ElementId attribute williamr@2: * williamr@2: * @since 3.2 williamr@2: * @return the destination's element id williamr@2: */ williamr@2: IMPORT_C TUint32 ElementId() const; williamr@2: williamr@2: /** williamr@2: * Returns the Icon pointer williamr@2: * This function leaves if the client does not have a valid UI context williamr@2: * williamr@2: * @since 3.2 williamr@2: * @return the destination icon williamr@2: */ williamr@2: IMPORT_C CGulIcon* IconL() const; williamr@2: williamr@2: /** williamr@2: * Returns the Metadata williamr@2: * williamr@2: * @since 3.2 williamr@2: * @param aMetaField the meta data field to query williamr@2: * @return the value of the requested field williamr@2: */ williamr@2: IMPORT_C TUint32 MetadataL( CMManager::TSnapMetadataField aMetaField ) const; williamr@2: williamr@2: /** williamr@2: * Return the protection level of the destination. williamr@2: * williamr@2: * @since 3.2 williamr@2: * @return protection level of the destination williamr@2: */ williamr@2: IMPORT_C CMManager::TProtectionLevel ProtectionLevel() const; williamr@2: williamr@2: /** williamr@2: * Returns if there's a connection created with any of the destination's williamr@2: * connection method. williamr@2: * williamr@2: * @since 3.2 williamr@2: * @return ETrue if there's a connection with any of the destination's williamr@2: * connection method. williamr@2: */ williamr@2: IMPORT_C TBool IsConnectedL() const; williamr@2: williamr@2: /** williamr@2: * Returns whether the destination is hidden or not. williamr@2: * williamr@2: * @since 3.2 williamr@2: * @return ETrue if the destination is hidden williamr@2: */ williamr@2: IMPORT_C TBool IsHidden() const; williamr@2: williamr@2: /** williamr@2: * checks if destinations are the same williamr@2: * williamr@2: * @since S60 3.2 williamr@2: * @param aDestination the destination being compared williamr@2: * @return ETrue if the destinations are the same williamr@2: */ williamr@2: IMPORT_C TBool operator==(const RCmDestination& aDestination ) const; williamr@2: williamr@2: /** williamr@2: * checks if destinations are not the same williamr@2: * williamr@2: * @since S60 3.2 williamr@2: * @param aDestination the destination being compared williamr@2: * @return ETrue if the destinations are different williamr@2: */ williamr@2: IMPORT_C TBool operator!=(const RCmDestination& aDestination ) const; williamr@2: williamr@2: /** williamr@2: * assignment operator williamr@2: * williamr@2: * @since S60 3.2 williamr@2: * @param aDestination the destination being compared williamr@2: * @return RCmDestination williamr@2: */ williamr@2: IMPORT_C RCmDestination& operator=(const RCmDestination& williamr@2: aCmDestination); williamr@2: williamr@2: /** williamr@2: * Create a connection method that belongs to this destination. williamr@2: * @param aImplementationUid - implementation uid (bearer type) of the williamr@2: * connection method to be created williamr@2: * @return newly created connection method williamr@2: */ williamr@2: IMPORT_C RCmConnectionMethod CreateConnectionMethodL( TUint32 aBearerType ); williamr@2: williamr@2: /* williamr@2: * Adds an existing connection method to a destination williamr@2: * @param aConnectionMethod Connection method to be added williamr@2: * @return index in the Connection Method list williamr@2: */ williamr@2: IMPORT_C TInt AddConnectionMethodL( RCmConnectionMethod aConnectionMethod ); williamr@2: williamr@2: /* williamr@2: * Embeds an existing destination into this destination. williamr@2: * @param RCmDestination - Destination to be embedded williamr@2: * @return TInt - index in the Connection Method list williamr@2: */ williamr@2: IMPORT_C TInt AddEmbeddedDestinationL( const RCmDestination& aDestination ); williamr@2: williamr@2: /** williamr@2: * Remove a connection method from a destination and delete it williamr@2: * on update. williamr@2: * Exception: conenction method is not deleted if it's referenced williamr@2: * from any other destination. williamr@2: * @param aConnectionMethod the connection method to be deleted. williamr@2: */ williamr@2: IMPORT_C void DeleteConnectionMethodL( RCmConnectionMethod& aConnectionMethod ); williamr@2: williamr@2: /** williamr@2: * Remove connection method from the destination williamr@2: * @param aConnectionMethod connection method to be removed williamr@2: */ williamr@2: IMPORT_C void RemoveConnectionMethodL( RCmConnectionMethod aConnectionMethod ); williamr@2: williamr@2: williamr@2: /** williamr@2: * Set the connection method's priority based on the passed index. williamr@2: * @param aCCMItem the connection method item williamr@2: * @param aIndex the new priority of the connection method in the williamr@2: * destination williamr@2: */ williamr@2: IMPORT_C void ModifyPriorityL( RCmConnectionMethod& aCCMItem, williamr@2: TUint aIndex ); williamr@2: williamr@2: /** williamr@2: * Set the destination's name williamr@2: * @param aDestinationName new name of the destination williamr@2: */ williamr@2: IMPORT_C void SetNameL( const TDesC& aName ); williamr@2: williamr@2: /** williamr@2: * Set the destination's icon index. williamr@2: * This fucton leaves if the client does not have a valid UI context williamr@2: * @param aIconIndex new icon index of the destination williamr@2: */ williamr@2: IMPORT_C void SetIconL( TUint32 anIndex ); williamr@2: williamr@2: /** williamr@2: * Set the Metadata williamr@2: * @param aMetaField field to be modified williamr@2: * @param aValue value to be set williamr@2: */ williamr@2: IMPORT_C void SetMetadataL( CMManager::TSnapMetadataField aMetaField, williamr@2: TUint32 aValue ); williamr@2: williamr@2: /** williamr@2: * Set the protection level of the destination. williamr@2: * @param aProtLevel new protection level williamr@2: */ williamr@2: IMPORT_C void SetProtectionL( CMManager::TProtectionLevel aProtLevel ); williamr@2: williamr@2: /** williamr@2: * Set if the destination is hidden or not. williamr@2: * @param aHidden - ETrue if destination is hidden williamr@2: */ williamr@2: IMPORT_C void SetHiddenL( TBool aHidden ); williamr@2: williamr@2: /** williamr@2: * Update all values of the destination and its connection method. williamr@2: * Nothing if stored, if update leaves due to any reason. williamr@2: */ williamr@2: IMPORT_C void UpdateL(); williamr@2: williamr@2: /** williamr@2: * Delete destination and its connection methods from CommsDat. williamr@2: * Connection methods that belong to other destination, too, are williamr@2: * not deleted. williamr@2: */ williamr@2: IMPORT_C void DeleteLD(); williamr@2: williamr@2: /** williamr@2: * Create a connection method with given id that belongs to this destination. williamr@2: * @param aImplementationUid - implementation uid (bearer type) of the williamr@2: * connection method to be created williamr@2: * @return newly created connection method or leaves with williamr@2: * KErrAlreadyExists if there exists CM with the same Id. williamr@2: */ williamr@2: IMPORT_C RCmConnectionMethod CreateConnectionMethodL( TUint32 aBearerType, williamr@2: TUint32 aConnMethId ); williamr@2: williamr@2: williamr@2: //======================================================================= williamr@2: // Member variables williamr@2: // williamr@2: private: williamr@2: williamr@2: /** williamr@2: * the implementation class williamr@2: */ williamr@2: CCmDestinationData* iDestinatonData; williamr@2: williamr@2: private: williamr@2: williamr@2: friend class RCmManager; williamr@2: friend class RCmConnectionMethod; williamr@2: }; williamr@2: williamr@2: williamr@2: #endif // DESTINATION_H