epoc32/include/mw/sipprofileregistrybase.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 epoc32/include/sipprofileregistrybase.h@2fe1408b6811
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
     1 /*
     2 * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * 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
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:
    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.
    19 * Version     : 1.0
    20 *
    21 */
    22 
    23 
    24 
    25 #ifndef CSIPPROFILEREGISTRYBASE_H
    26 #define CSIPPROFILEREGISTRYBASE_H
    27 
    28 //  INCLUDES
    29 #include <e32base.h>
    30 #include <badesca.h>
    31 #include "sipconcreteprofileobserver.h"
    32 
    33 // FORWARD DECLARATIONS
    34 class CSIPProfile;
    35 class CSIPConcreteProfile;
    36 class TSIPProfileTypeInfo;
    37 class CSIPProfileCleanupItem;
    38 class CSIPProfileItem;
    39 class CSIPProfileITCReceiver;
    40 class CSIPProfileITC;
    41 class CSIPProfilePlugins;
    42 class MSIPProfileRegistryObserver;
    43 class RSIPProfile;
    44 class CSIPConcreteProfileHolder;
    45 
    46 // CLASS DECLARATION
    47 /**
    48 * @publishedAll
    49 * @released
    50 *
    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.
    54 *  
    55 * The class enables also the query of supported profile types.
    56 *
    57 * This class is an abstract class and cannot be instantiated.
    58 *
    59 * @lib sipprofilecli.lib
    60 */
    61 class CSIPProfileRegistryBase: public CBase, public MSIPConcreteProfileObserver
    62     {
    63     public:  // Constructors and destructor
    64 
    65         IMPORT_C ~CSIPProfileRegistryBase();
    66 
    67     public: //new functions
    68         /**
    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
    75         */
    76         IMPORT_C void ProfilesL(RPointerArray<CSIPProfile>& aProfiles);
    77 
    78         /**
    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
    87         */        
    88         IMPORT_C void ProfilesL(
    89                      const TSIPProfileTypeInfo& aType,
    90                      RPointerArray<CSIPProfile>& aProfiles);
    91 
    92         /**
    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
   101         */
   102         IMPORT_C void ProfilesL(
   103                      const TDesC8& aAOR,
   104                      RPointerArray<CSIPProfile>& aProfiles);
   105 
   106         /**
   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
   113         */
   114         IMPORT_C CSIPProfile* ProfileL(TUint32 aId);
   115 
   116         /**
   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
   122         */
   123         IMPORT_C CSIPProfile* DefaultProfileL();
   124 
   125         /**
   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
   133         */
   134         IMPORT_C void SupportedProfileTypesL(
   135                     RArray<TSIPProfileTypeInfo>& aSupportedProfileTypes);
   136 
   137         /**
   138         * Gets the last occurred error during registration
   139         * @param aProfile 
   140         * @return last occurred registration error, KErrNone if no error
   141         */
   142         IMPORT_C TInt LastRegistrationError(const CSIPProfile& aProfile) const;
   143 
   144     public:
   145 
   146         /**
   147         * Enable profile
   148         * @param aProfile to be enabled
   149         * @internalComponent        
   150         */
   151         void EnableProfileL(CSIPProfile& aProfile);
   152         
   153         /**
   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
   157         * @internalComponent
   158         */
   159         TInt UsageL(const CSIPProfile& aProfile) const;
   160 
   161         /**
   162         * Disable profile
   163         * @param aProfile to be disabled
   164         * @internalComponent
   165         */
   166         void DisableProfileL(CSIPProfile& aProfile);
   167         
   168         /**
   169         * Force disable profile
   170     	* All Profile related activities will be stopped ungracefully
   171         * @param aProfile to be disabled
   172         * @internalComponent
   173         */
   174         void ForceDisableProfileL(CSIPProfile& aProfile);
   175 
   176         /**
   177         * Add profile
   178         * @param aProfile to be added
   179         * @internalComponent
   180         */
   181         void AddProfileL(CSIPProfile& aProfile);
   182 
   183         /**
   184         * Update profile
   185         * @param aProfile to be updated
   186         * @internalComponent
   187         */
   188         void UpdateProfileL(CSIPProfile& aProfile);
   189 
   190         /**
   191         * Remove profile
   192         * @pre UsageL(aProfile) == 0
   193         * @param aProfile to be removed
   194         * @internalComponent
   195         */
   196         void RemoveProfileL(CSIPProfile& aProfile);
   197 
   198         /**
   199         * Informs destruction of local profile object instance
   200         * @param aProfile instance of deleted profile
   201         * @internalComponent
   202         */
   203         void ProfileDeleted(CSIPProfile& aProfile);
   204 
   205         /**
   206         * Checks whether profile is default or not
   207         * @param aProfile checked profile
   208         * @return ETrue if is default, otherwise EFalse
   209         * @internalComponent
   210         */
   211         TBool IsDefaultProfileL(const CSIPProfile& aProfile);
   212 
   213         /**
   214         * Updates SIP profile value for negotiated security mechanism; leaves on failure
   215         * @param aProfile a SIP profile
   216         * @internalComponent
   217         */
   218         void NegotiatedSecurityMechanismL(CSIPConcreteProfile& aProfile);
   219 
   220         /**
   221         * Updates SIP profile value for registered AORs; leaves on failure
   222         * @param aProfile a SIP profile
   223         * @internalComponent
   224         */
   225         void RegisteredAORsL(CSIPConcreteProfile& aProfile);
   226 
   227         /**
   228         * Gets new instance of either type CSIPProfile or CSIPManagedProfile
   229         * @return new instance
   230         * @internalComponent
   231         */        
   232         virtual CSIPProfile* NewInstanceL() = 0;
   233 
   234         /**
   235         * Roll back in case of failure
   236         * @param aItem object to be cleaned
   237         * @internalComponent
   238         */
   239         static void CrashRevert (TAny* aItem);
   240 
   241         /**
   242         * Roll back in case of failure
   243         * @param aItem object to be cleaned
   244         * @internalComponent
   245         */
   246         static void LocalCrashRevert (TAny* aItem);
   247         
   248         /**
   249         * Gets the ITC member variable.
   250         * The owneship of ITC is not transferred.
   251         * @return Reference to ITC member variable.
   252         * @internalComponent 
   253         */
   254         CSIPProfileITC& Itc(); 
   255         
   256         /**
   257         * Gets the ITC receiver member variable.
   258         * The owneship of ITC receiver is not transferred.
   259         * @return Reference to ITC receiver member variable.
   260         * @internalComponent 
   261         */
   262         CSIPProfileITCReceiver& ItcReceiver(); 
   263 
   264 
   265     public: // From MSIPConcreteProfileObserver
   266 
   267         /**
   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
   273         * @internalComponent
   274         */
   275         void RegistrationStatusChangedL(TUint32 aProfileId, 
   276                                        TInt aStatus,
   277                                        TUint32 aStatusId);
   278 
   279         /** 
   280         * SIP profile creation event.
   281         * @param aProfileId id of new SIP Profile
   282         * @internalComponent
   283         */
   284         void AddedL(TUint32 aProfileId);
   285 
   286         /**
   287         * SIP profile destruction event.
   288         * @param aProfileId id of profile which was destroyed
   289         * @internalComponent
   290         */    
   291         void RemovedL(TUint32 aProfileId);
   292 
   293         /** 
   294         * SIP profile information update event
   295         * @param aProfileId id of updated SIP Profile
   296         * @param aSize size of updated SIP Profile
   297         * @internalComponent
   298         */
   299         void UpdatedL(TUint32 aProfileId, TUint aSize);
   300 
   301         /**
   302         * An asynchronous error has occurred related to SIP profile
   303         * @param aProfileId the id of failed profile 
   304         * @param aStatus
   305         * @param aError a error code
   306         * @internalComponent
   307         */
   308         void ErrorOccurredL(TUint32 aProfileId,
   309                             TInt aStatus,
   310                             TInt aError);
   311 
   312     protected: 
   313                                             
   314         /**
   315         * Constructor
   316         * @param aObserver observer to send events to
   317         * @internalComponent 
   318         */
   319         CSIPProfileRegistryBase(MSIPProfileRegistryObserver& aObserver); 
   320 
   321         /**
   322         * Symbian 2nd phase base class constructor
   323         * @internalComponent
   324         */
   325         void BaseConstructL();
   326 
   327         /**
   328         * Store profile into client cache
   329         * @param aItem a cleanup item for roll back in case of failure
   330         * @internalComponent
   331         */
   332         void StoreProfileL(CSIPProfileCleanupItem* aItem);
   333 
   334         /**
   335         * Store array of profiles into client cache
   336         * @param aProfiles a array containing the profiles
   337         * @param aRetProfiles returned array containing profiles
   338         * @internalComponent
   339         */
   340         void StoreArrayL(
   341             RPointerArray<CSIPConcreteProfile>& aProfiles,
   342             RPointerArray<CSIPProfile>& aRetProfiles);
   343 
   344         /**
   345         * Gets profile cache item
   346         * @param aProfileId a profile id to be found
   347         * @return local cache item of the profile
   348         * @internalComponent
   349         */        
   350         CSIPProfileItem* ProfileItemL(TUint aProfileId);
   351 
   352         /**
   353         * Gets profile cache item index
   354         * @param aProfileId a profile id to be found
   355         * @return local cache item index of the profile
   356         * @internalComponent
   357         */        
   358         TInt ProfileIndex (TUint aProfileId);
   359 
   360         /**
   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
   364         * @internalComponent
   365         */        
   366         CSIPProfileItem* ProfileItemByIndex(TUint aIndex);
   367 
   368         /**
   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
   374         * @internalComponent
   375         */
   376         CSIPProfile* SIPProfileL(TUint32 aId, TInt aSize = 0);
   377         
   378     protected: // Data
   379 
   380         /**
   381         * @internalComponent
   382         */
   383         RSIPProfile* iSipClient;
   384         
   385         /**
   386         * @internalComponent
   387         */        
   388         CSIPProfileITCReceiver* iITCReceiver;
   389         
   390         /**
   391         * @internalComponent
   392         */        
   393         CSIPProfileITC* iITC;
   394         
   395         /**
   396         * @internalComponent
   397         */        
   398         MSIPProfileRegistryObserver& iObserver;
   399         
   400         /**
   401         * @internalComponent
   402         */        
   403         RPointerArray<CSIPProfileItem> iProfiles;
   404         
   405         /**
   406         * @internalComponent
   407         */        
   408         CSIPProfilePlugins* iProfilePlugins;
   409         
   410         /**
   411         * @internalComponent
   412         */        
   413         CSIPProfileItem* iFindEntry;
   414         
   415     private:
   416         
   417         void ProfilesCommonL(RPointerArray<CSIPProfile>& aProfiles, 
   418                              CSIPConcreteProfileHolder* aHolder);
   419 
   420     };
   421 
   422 #endif // CSIPPROFILEREGISTRYBASE_H