williamr@2: /* williamr@2: * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@2: * under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members williamr@2: * which accompanies this distribution, and is available williamr@2: * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: williamr@2: * Name : sipprofileregistry.h williamr@2: * Part of : SIP Profile Client williamr@2: * Interface : SDK API, SIP Profile API williamr@2: * The class for using SIP profiles williamr@2: * Version : 1.0 williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: williamr@2: #ifndef CSIPPROFILEREGISTRY_H williamr@2: #define CSIPPROFILEREGISTRY_H williamr@2: williamr@2: // INCLUDES williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include "sipprofileregistrybase.h" williamr@2: williamr@2: // FORWARD DECLARATIONS williamr@2: class CSIP; williamr@2: class CSIPConnection; williamr@2: class CSIPProfile; williamr@2: class MSIPProfileRegistryObserver; williamr@2: class MSIPConnectionObserver; williamr@2: williamr@2: williamr@2: // CLASS DECLARATION williamr@2: /** williamr@2: * @publishedAll williamr@2: * @released williamr@2: * williamr@2: * The class for retrieving SIP profiles from permanent storage. williamr@2: * This class provides services for retreiving SIP profiles williamr@2: * and enabling/disabling them for the usage. williamr@2: * williamr@2: * The user can create only one instance of this class (a singleton class). williamr@2: * williamr@2: * @lib sipprofilecli.lib williamr@2: */ williamr@2: class CSIPProfileRegistry: public CSIPProfileRegistryBase williamr@2: { williamr@2: public: // Constructors and destructor williamr@2: /** williamr@2: * Two-phased constructor. williamr@2: * This constructor should be used if the client intends williamr@2: * to use SIP services with profiles. williamr@2: * @param aSip a SIP client providing connection to SIP stack. williamr@2: * @param aObserver a observer for SIP profile change events. williamr@2: */ williamr@2: IMPORT_C static CSIPProfileRegistry* NewL( williamr@2: CSIP& aSip, williamr@2: MSIPProfileRegistryObserver& aObserver); williamr@2: williamr@2: /** williamr@2: * Two-phased constructor. williamr@2: * This constructor should be used if the client intends williamr@2: * to use SIP services with profiles. williamr@2: * Constructs an object and adds the pointer to the cleanup stack; williamr@2: * @param aSip a SIP client providing connection to SIP stack. williamr@2: * @param aObserver a observer for SIP profile change events. williamr@2: */ williamr@2: IMPORT_C static CSIPProfileRegistry* NewLC( williamr@2: CSIP& aSip, williamr@2: MSIPProfileRegistryObserver& aObserver); williamr@2: williamr@2: /** williamr@2: * Destructor williamr@2: */ williamr@2: IMPORT_C ~CSIPProfileRegistry(); williamr@2: williamr@2: public: // New functions williamr@2: /** williamr@2: * Gets handle to the SIP server williamr@2: * @return handle to the SIP server williamr@2: */ williamr@2: IMPORT_C CSIP& SIP() const; williamr@2: williamr@2: /** williamr@2: * Gets the SIP connection to be used with this SIP profile. williamr@2: * @pre IsEnabled() == ETrue williamr@2: * @param aProfile a sip profile williamr@2: * @return a SIP connection to be used; the owneship is transfered williamr@2: * @leave KErrNoMemory if out of memory williamr@2: * @capability NetworkServices williamr@2: */ williamr@2: IMPORT_C CSIPConnection* ConnectionL( williamr@2: CSIPProfile& aProfile); williamr@2: williamr@2: /** williamr@2: * Enables the SIP profile for use. williamr@2: * Enabling the SIP profile will cause the SIP profile to williamr@2: * be registered if its status was unregistered. williamr@2: * The user must check the profile status after calling this williamr@2: * function. In case the profile is not registered the user must williamr@2: * wait until the it is notified about profile registration williamr@2: * on MSIPProfileRegistryObserver-callback interface. williamr@2: * @param aProfile a sip profile to enable williamr@2: * @param aObserver a observer for SIP connection events williamr@2: * @leave KErrNotFound if non-existing profile is provided williamr@2: * @capability NetworkServices williamr@2: */ williamr@2: IMPORT_C void EnableL( williamr@2: CSIPProfile& aProfile, williamr@2: MSIPConnectionObserver &aObserver); williamr@2: williamr@2: /** williamr@2: * Disables the usage of SIP profile williamr@2: * @param aProfile a sip profile to disable williamr@2: * @return KErrNone if SIP profile was successfully disabled; williamr@2: * system wide error otherwise williamr@2: * @capability NetworkServices williamr@2: */ williamr@2: IMPORT_C TInt Disable(CSIPProfile& aProfile); williamr@2: williamr@2: /** williamr@2: * Tests is the SIP profile enabled for the use williamr@2: * @param aProfile a SIP profile to be checked williamr@2: * @return ETrue if SIP profile is enabled; EFalse otherwise williamr@2: */ williamr@2: IMPORT_C TBool IsEnabled(const CSIPProfile& aProfile) const; williamr@2: williamr@2: /** williamr@2: * Force disables the usage of SIP profile williamr@2: * All Profile related activities will be stopped ungracefully williamr@2: * @param aProfile a sip profile to disable williamr@2: * @return KErrNone if SIP profile was successfully disabled; williamr@2: * system wide error otherwise williamr@2: * @capability NetworkControl williamr@2: */ williamr@2: IMPORT_C TInt ForceDisable(CSIPProfile& aProfile); williamr@2: williamr@2: /** williamr@2: * Refreshes the Enabled SIP profile for use. williamr@2: * Refreshing the Enabled Profile will cause the SIP Profile to williamr@2: * get Registered if its status was not registered. williamr@2: * This function has to be used when the profile is in Enabled state and williamr@2: * might be unregistered due to a connection loss. williamr@2: * @param aProfile a sip profile to enable williamr@2: * @leave KErrNotFound if non-existing profile is provided williamr@2: * @leave KErrArgument if the profile is not previously Enabled and in Unregistered state. williamr@2: * @capability NetworkServices williamr@2: */ williamr@2: williamr@2: IMPORT_C void RefreshEnableL(CSIPProfile& aProfile); williamr@2: williamr@2: public: williamr@2: williamr@2: /** williamr@2: * @internalComponent williamr@2: */ williamr@2: CSIPProfile* NewInstanceL(); williamr@2: williamr@2: private: williamr@2: williamr@2: CSIPProfileRegistry(); williamr@2: CSIPProfileRegistry(CSIP& aSip, MSIPProfileRegistryObserver& aObserver); williamr@2: void ConstructL(); williamr@2: williamr@2: private: williamr@2: williamr@2: CSIP& iSip; williamr@2: MSIPConnectionObserver* iConnectionObserver; williamr@2: }; williamr@2: williamr@2: #endif // CSIPPROFILEREGISTRY_H