2 * Copyright (c) 2003-2009 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.
15 * Name : sipprofileregistry.h
16 * Part of : SIP Profile Client
17 * Interface : SDK API, SIP Profile API
18 * The class for using SIP profiles
25 #ifndef CSIPPROFILEREGISTRY_H
26 #define CSIPPROFILEREGISTRY_H
32 #include "sipprofileregistrybase.h"
34 // FORWARD DECLARATIONS
38 class MSIPProfileRegistryObserver;
39 class MSIPConnectionObserver;
47 * The class for retrieving SIP profiles from permanent storage.
48 * This class provides services for retreiving SIP profiles
49 * and enabling/disabling them for the usage.
51 * The user can create only one instance of this class (a singleton class).
53 * @lib sipprofilecli.lib
55 class CSIPProfileRegistry: public CSIPProfileRegistryBase
57 public: // Constructors and destructor
59 * Two-phased constructor.
60 * This constructor should be used if the client intends
61 * to use SIP services with profiles.
62 * @param aSip a SIP client providing connection to SIP stack.
63 * @param aObserver a observer for SIP profile change events.
65 IMPORT_C static CSIPProfileRegistry* NewL(
67 MSIPProfileRegistryObserver& aObserver);
70 * Two-phased constructor.
71 * This constructor should be used if the client intends
72 * to use SIP services with profiles.
73 * Constructs an object and adds the pointer to the cleanup stack;
74 * @param aSip a SIP client providing connection to SIP stack.
75 * @param aObserver a observer for SIP profile change events.
77 IMPORT_C static CSIPProfileRegistry* NewLC(
79 MSIPProfileRegistryObserver& aObserver);
84 IMPORT_C ~CSIPProfileRegistry();
86 public: // New functions
88 * Gets handle to the SIP server
89 * @return handle to the SIP server
91 IMPORT_C CSIP& SIP() const;
94 * Gets the SIP connection to be used with this SIP profile.
95 * @pre IsEnabled() == ETrue
96 * @param aProfile a sip profile
97 * @return a SIP connection to be used; the owneship is transfered
98 * @leave KErrNoMemory if out of memory
99 * @capability NetworkServices
101 IMPORT_C CSIPConnection* ConnectionL(
102 CSIPProfile& aProfile);
105 * Enables the SIP profile for use.
106 * Enabling the SIP profile will cause the SIP profile to
107 * be registered if its status was unregistered.
108 * The user must check the profile status after calling this
109 * function. In case the profile is not registered the user must
110 * wait until the it is notified about profile registration
111 * on MSIPProfileRegistryObserver-callback interface.
112 * @param aProfile a sip profile to enable
113 * @param aObserver a observer for SIP connection events
114 * @leave KErrNotFound if non-existing profile is provided
115 * @capability NetworkServices
117 IMPORT_C void EnableL(
118 CSIPProfile& aProfile,
119 MSIPConnectionObserver &aObserver);
122 * Disables the usage of SIP profile
123 * @param aProfile a sip profile to disable
124 * @return KErrNone if SIP profile was successfully disabled;
125 * system wide error otherwise
126 * @capability NetworkServices
128 IMPORT_C TInt Disable(CSIPProfile& aProfile);
131 * Tests is the SIP profile enabled for the use
132 * @param aProfile a SIP profile to be checked
133 * @return ETrue if SIP profile is enabled; EFalse otherwise
135 IMPORT_C TBool IsEnabled(const CSIPProfile& aProfile) const;
138 * Force disables the usage of SIP profile
139 * All Profile related activities will be stopped ungracefully
140 * @param aProfile a sip profile to disable
141 * @return KErrNone if SIP profile was successfully disabled;
142 * system wide error otherwise
143 * @capability NetworkControl
145 IMPORT_C TInt ForceDisable(CSIPProfile& aProfile);
148 * Refreshes the Enabled SIP profile for use.
149 * Refreshing the Enabled Profile will cause the SIP Profile to
150 * get Registered if its status was not registered.
151 * This function has to be used when the profile is in Enabled state and
152 * might be unregistered due to a connection loss.
153 * @param aProfile a sip profile to enable
154 * @leave KErrNotFound if non-existing profile is provided
155 * @leave KErrArgument if the profile is not previously Enabled and in Unregistered state.
156 * @capability NetworkServices
159 IMPORT_C void RefreshEnableL(CSIPProfile& aProfile);
166 CSIPProfile* NewInstanceL();
170 CSIPProfileRegistry();
171 CSIPProfileRegistry(CSIP& aSip, MSIPProfileRegistryObserver& aObserver);
177 MSIPConnectionObserver* iConnectionObserver;
180 #endif // CSIPPROFILEREGISTRY_H