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 : sipprofileregistrybase.h
16 * Part of : SIP Profile Client
17 * Interface : SDK API, SIP Profile API
18 * The class for retrieving SIP profiles from permanent storage.
25 #ifndef CSIPPROFILEREGISTRYBASE_H
26 #define CSIPPROFILEREGISTRYBASE_H
31 #include "sipconcreteprofileobserver.h"
33 // FORWARD DECLARATIONS
35 class CSIPConcreteProfile;
36 class TSIPProfileTypeInfo;
37 class CSIPProfileCleanupItem;
38 class CSIPProfileItem;
39 class CSIPProfileITCReceiver;
41 class CSIPProfilePlugins;
42 class MSIPProfileRegistryObserver;
44 class CSIPConcreteProfileHolder;
51 * The class functions for retrieving SIP profiles from permanent storage.
52 * It enables retrieval of single or more profiles from permanent
53 * storage located in profile server.
55 * The class enables also the query of supported profile types.
57 * This class is an abstract class and cannot be instantiated.
59 * @lib sipprofilecli.lib
61 class CSIPProfileRegistryBase: public CBase, public MSIPConcreteProfileObserver
63 public: // Constructors and destructor
65 IMPORT_C ~CSIPProfileRegistryBase();
67 public: //new functions
69 * Gets all SIP profiles
70 * @pre aProfiles.Count() == 0
71 * @param aProfiles a reference to a client-owned array, which
72 * on return is filled with all existing SIP profiles
73 * @leave KErrNoMemory if out of memory
74 * @capability ReadUserData
76 IMPORT_C void ProfilesL(RPointerArray<CSIPProfile>& aProfiles);
79 * Gets all SIP profiles of particular type
80 * The owneship of profiles are transferred.
81 * @pre aProfiles.Count() == 0
82 * @param aType a SIP profile type that is used for a query
83 * @param aProfiles a reference to a client-owned array, which
84 * on return is filled with profiles of the given type.
85 * @leave KErrNoMemory if out of memory
86 * @capability ReadUserData
88 IMPORT_C void ProfilesL(
89 const TSIPProfileTypeInfo& aType,
90 RPointerArray<CSIPProfile>& aProfiles);
93 * Gets SIP profile for a particular SIP AOR
94 * The owneship of profiles are transferred.
95 * @pre aProfiles.Count() == 0
96 * @param aAOR a SIP AOR e.g. user@domain.com
97 * @param aProfiles a reference to a client-owned array, which
98 * on return is filled with profiles of the given type.
99 * @leave KErrNoMemory if out memory
100 * @capability ReadUserData
102 IMPORT_C void ProfilesL(
104 RPointerArray<CSIPProfile>& aProfiles);
107 * Gets SIP profile identified by the Id
108 * The owneship of profile is transferred.
109 * @param aId a SIP profile Id
110 * @return SIP profile
111 * @leave KErrNotFound if profile is not found
112 * @capability ReadUserData
114 IMPORT_C CSIPProfile* ProfileL(TUint32 aId);
117 * Gets the default profile
118 * @return default profile; the owneship is transfered
119 * @leave KErrNotFound if profile not found
120 * @leave KErrNoMemory if out of memory
121 * @capability ReadUserData
123 IMPORT_C CSIPProfile* DefaultProfileL();
126 * Gets supported profile types
127 * The owneship of returned objects are transferred.
128 * @pre aSupportedProfileTypes.Count() == 0
129 * @param aSupportedProfileTypes a reference to client-owned array,
130 * which on return is filled with supported profile types.
131 * Any existing data in the array is destroyed.
132 * @leave KErrNoMemory if out of memory
134 IMPORT_C void SupportedProfileTypesL(
135 RArray<TSIPProfileTypeInfo>& aSupportedProfileTypes);
138 * Gets the last occurred error during registration
140 * @return last occurred registration error, KErrNone if no error
142 IMPORT_C TInt LastRegistrationError(const CSIPProfile& aProfile) const;
148 * @param aProfile to be enabled
151 void EnableProfileL(CSIPProfile& aProfile);
154 * Gets count of clients that have a profile enabled
155 * @param aProfile profile to be checked
156 * @return number of clients that have the profile enabled
159 TInt UsageL(const CSIPProfile& aProfile) const;
163 * @param aProfile to be disabled
166 void DisableProfileL(CSIPProfile& aProfile);
169 * Force disable profile
170 * All Profile related activities will be stopped ungracefully
171 * @param aProfile to be disabled
174 void ForceDisableProfileL(CSIPProfile& aProfile);
178 * @param aProfile to be added
181 void AddProfileL(CSIPProfile& aProfile);
185 * @param aProfile to be updated
188 void UpdateProfileL(CSIPProfile& aProfile);
192 * @pre UsageL(aProfile) == 0
193 * @param aProfile to be removed
196 void RemoveProfileL(CSIPProfile& aProfile);
199 * Informs destruction of local profile object instance
200 * @param aProfile instance of deleted profile
203 void ProfileDeleted(CSIPProfile& aProfile);
206 * Checks whether profile is default or not
207 * @param aProfile checked profile
208 * @return ETrue if is default, otherwise EFalse
211 TBool IsDefaultProfileL(const CSIPProfile& aProfile);
214 * Updates SIP profile value for negotiated security mechanism; leaves on failure
215 * @param aProfile a SIP profile
218 void NegotiatedSecurityMechanismL(CSIPConcreteProfile& aProfile);
221 * Updates SIP profile value for registered AORs; leaves on failure
222 * @param aProfile a SIP profile
225 void RegisteredAORsL(CSIPConcreteProfile& aProfile);
228 * Gets new instance of either type CSIPProfile or CSIPManagedProfile
229 * @return new instance
232 virtual CSIPProfile* NewInstanceL() = 0;
235 * Roll back in case of failure
236 * @param aItem object to be cleaned
239 static void CrashRevert (TAny* aItem);
242 * Roll back in case of failure
243 * @param aItem object to be cleaned
246 static void LocalCrashRevert (TAny* aItem);
249 * Gets the ITC member variable.
250 * The owneship of ITC is not transferred.
251 * @return Reference to ITC member variable.
254 CSIPProfileITC& Itc();
257 * Gets the ITC receiver member variable.
258 * The owneship of ITC receiver is not transferred.
259 * @return Reference to ITC receiver member variable.
262 CSIPProfileITCReceiver& ItcReceiver();
265 public: // From MSIPConcreteProfileObserver
268 * SIP profile registration status changed event
269 * @param aProfileId id of profile which registration
270 * status has been changed.
271 * @param aStatus new status of the profile
272 * @param aStatusId id related to registration
275 void RegistrationStatusChangedL(TUint32 aProfileId,
280 * SIP profile creation event.
281 * @param aProfileId id of new SIP Profile
284 void AddedL(TUint32 aProfileId);
287 * SIP profile destruction event.
288 * @param aProfileId id of profile which was destroyed
291 void RemovedL(TUint32 aProfileId);
294 * SIP profile information update event
295 * @param aProfileId id of updated SIP Profile
296 * @param aSize size of updated SIP Profile
299 void UpdatedL(TUint32 aProfileId, TUint aSize);
302 * An asynchronous error has occurred related to SIP profile
303 * @param aProfileId the id of failed profile
305 * @param aError a error code
308 void ErrorOccurredL(TUint32 aProfileId,
316 * @param aObserver observer to send events to
319 CSIPProfileRegistryBase(MSIPProfileRegistryObserver& aObserver);
322 * Symbian 2nd phase base class constructor
325 void BaseConstructL();
328 * Store profile into client cache
329 * @param aItem a cleanup item for roll back in case of failure
332 void StoreProfileL(CSIPProfileCleanupItem* aItem);
335 * Store array of profiles into client cache
336 * @param aProfiles a array containing the profiles
337 * @param aRetProfiles returned array containing profiles
341 RPointerArray<CSIPConcreteProfile>& aProfiles,
342 RPointerArray<CSIPProfile>& aRetProfiles);
345 * Gets profile cache item
346 * @param aProfileId a profile id to be found
347 * @return local cache item of the profile
350 CSIPProfileItem* ProfileItemL(TUint aProfileId);
353 * Gets profile cache item index
354 * @param aProfileId a profile id to be found
355 * @return local cache item index of the profile
358 TInt ProfileIndex (TUint aProfileId);
361 * Gets profile cache item by index
362 * @param aIndex a index of the profile to be found
363 * @return local cache item of the profile
366 CSIPProfileItem* ProfileItemByIndex(TUint aIndex);
369 * Gets SIP profile identified by the Id; leaves on failure
370 * The owneship of profile is transferred.
371 * @param aId a SIP profile Id
372 * @param aSize of profile if known
373 * @return SIP profile or 0 pointer if there's no such SIP profile
376 CSIPProfile* SIPProfileL(TUint32 aId, TInt aSize = 0);
383 RSIPProfile* iSipClient;
388 CSIPProfileITCReceiver* iITCReceiver;
393 CSIPProfileITC* iITC;
398 MSIPProfileRegistryObserver& iObserver;
403 RPointerArray<CSIPProfileItem> iProfiles;
408 CSIPProfilePlugins* iProfilePlugins;
413 CSIPProfileItem* iFindEntry;
417 void ProfilesCommonL(RPointerArray<CSIPProfile>& aProfiles,
418 CSIPConcreteProfileHolder* aHolder);
422 #endif // CSIPPROFILEREGISTRYBASE_H