pressrv_plat/xdm_settings_api/inc/XdmSettingsApi.h
changeset 0 c8caa15ef882
equal deleted inserted replaced
-1:000000000000 0:c8caa15ef882
       
     1 /*
       
     2 * Copyright (c) 2005 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 "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".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   XDM Settings API
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __XDMSETTINGSAPI__
       
    22 #define __XDMSETTINGSAPI__
       
    23 
       
    24 #include <badesca.h>
       
    25 #include "XdmEngineDomainCRKeys.h"
       
    26 
       
    27 /**
       
    28 * The list of configurable XDM Settings
       
    29 **/
       
    30 enum TXdmSettingsProperty
       
    31     {
       
    32     EXdmPropSettingsId      = KXdmSettingsId,
       
    33     EXdmPropAppId           = KXDMAppId,
       
    34     EXdmPropName            = KXDMAppName,
       
    35     EXdmPropProvId          = KXDMProviderId,
       
    36     EXdmPropToNapId         = KXDMNAPID,
       
    37     EXdmPropToAppRef        = KXDMSipReference,
       
    38     EXdmPropUri             = KXDMXcapRootURI,
       
    39     EXdmPropAuthName        = KXDMUserName,
       
    40     EXdmPropAuthSecret      = KXDMPassword,
       
    41     EXdmPropAuthType        = KXDMAuthType,
       
    42     EXdmPropNotFound        = KErrNotFound  // for initialization
       
    43     };
       
    44 
       
    45 //The authentication types = possible values for EXdmPropAuthType
       
    46 _LIT( KXdmAuthGaa,                             "GAA" );
       
    47 _LIT( KXdmAuthEarlyIms,                        "EARLY-IMS" );
       
    48 _LIT( KXdmAuthHttpDigest,                      "HTTP-DIGEST" );
       
    49 
       
    50 //Logging constants
       
    51 _LIT( KXdmSettingsLogDir,                       "XDM" );
       
    52 _LIT( KXdmSettingsLogFile,                      "SettingsApi.txt" );
       
    53 const TInt KXdmSettingsLogBufferMaxSize		    = 2000;
       
    54 
       
    55 //Forward declarations
       
    56 class CRepository;
       
    57 class CXdmSettingsCollection;
       
    58     
       
    59 //CLASS DECLARATION
       
    60 class TXdmSettingsApi
       
    61     {
       
    62     public:
       
    63         
       
    64         /**
       
    65         * Return the name of each settings collection
       
    66         * stored in the repository
       
    67         *
       
    68         * @return CDesCArray* Names of all settings collections
       
    69         */
       
    70         IMPORT_C static CDesCArray* CollectionNamesLC( RArray<TInt>& aSettingIds );
       
    71         
       
    72         /**
       
    73         * Set the XDM properties as a collection of settings
       
    74         *
       
    75         * @param CXdmSettingsCollection A collection of properties
       
    76         * @return TInt The ID of the newly created collection
       
    77         */
       
    78         IMPORT_C static TInt CreateCollectionL( const CXdmSettingsCollection& aCollection );
       
    79         
       
    80         /**
       
    81         * Remove a collection from the Central Repository
       
    82         *
       
    83         * NOTE:
       
    84         *
       
    85         * - Leaves with KErrNotFound if a collection of properties
       
    86         *   by the specified ID does not exist in the repository.
       
    87         *
       
    88         * @param TInt ID of the collection to be removed
       
    89         * @return void
       
    90         */
       
    91         IMPORT_C static void RemoveCollectionL( TInt aSettingsId );
       
    92         
       
    93         /**
       
    94         * Create an individual property to the specified
       
    95         * collection of properties.
       
    96         *
       
    97         * NOTE:
       
    98         *
       
    99         * - Leaves with KErrAlreadyExists, if the property to be
       
   100         *   created already exists in the specified collection.
       
   101         *
       
   102         * - Leaves with KErrNotFound, if a property set by the
       
   103         *   specified ID cannot be found from the repository
       
   104         *
       
   105         * @param TInt ID of the target property set
       
   106         * @param TDesC& Value for the property to be created
       
   107         * @param TXdmSettingsProperty Name of the property
       
   108         * @return void
       
   109         */
       
   110         IMPORT_C static void CreatePropertyL( TInt aSettingsId,
       
   111                                               const TDesC& aPropertyValue,
       
   112                                               TXdmSettingsProperty aPropertyName );
       
   113                                               
       
   114         /**
       
   115         * Remove an individual property from the specified
       
   116         * collection of properties.
       
   117         *
       
   118         * NOTE:
       
   119         *
       
   120         * - Leaves with KErrNotFound, if a property set by the
       
   121         *   specified ID cannot be found from the repository
       
   122         *
       
   123         * @param TInt Name of the target property set
       
   124         * @param TXdmSettingsProperty Name of the property to remove
       
   125         * @return void
       
   126         */
       
   127         IMPORT_C static void RemovePropertyL( TInt aSettingsId,
       
   128                                               TXdmSettingsProperty aPropertyName );
       
   129                                           
       
   130         /**
       
   131         * Update an individual property in a named property set
       
   132         *
       
   133         * NOTE:
       
   134         *
       
   135         * - Leaves with KErrNotFound, if a property set by the
       
   136         *   specified ID cannot be found
       
   137         *
       
   138         * - Also note that an attempt to update a non-existent
       
   139         *   property effectively creates a new one.
       
   140         *
       
   141         * @param TInt ID of the target property set
       
   142         * @param TDesC& New value for the property to be updated
       
   143         * @param TXdmSettingsProperty Name of the property
       
   144         * @return void
       
   145         */
       
   146         IMPORT_C static void UpdatePropertyL( TInt aSettingsId,
       
   147                                               const TDesC& aPropertyValue,
       
   148                                               TXdmSettingsProperty aPropertyName );
       
   149                                          
       
   150         /**
       
   151         * Return an XDM property set/collection
       
   152         *
       
   153         * NOTE:
       
   154         *
       
   155         * - Leaves with KErrNotFound, if a property set by the
       
   156         *   specified ID cannot be found from the repository.
       
   157         *
       
   158         * @param TInt ID of the property set
       
   159         * @return CDesCArray& Colletion of properties
       
   160         */
       
   161         IMPORT_C static CXdmSettingsCollection* SettingsCollectionL( TInt aSettingsId );
       
   162         
       
   163         /**
       
   164         * Return an individual XDM settings property
       
   165         *
       
   166         * NOTE:
       
   167         *
       
   168         * - Leaves with KErrNotFound, if a property set by the
       
   169         *   specified ID cannot be found from the repository.
       
   170         *
       
   171         * @param TInt ID of the target property set
       
   172         * @param TXdmSettingsProperty Name of the property
       
   173         * @return HBufC* Value of the property on top of CleanupStack 
       
   174         */
       
   175         IMPORT_C static HBufC* PropertyL( TInt aSettingsId,
       
   176                                           TXdmSettingsProperty aSingleProp );
       
   177         
       
   178     private:
       
   179 
       
   180         /**
       
   181         * Write to the log file
       
   182         *
       
   183         * @param TRefByValue<const TDesC> Log string
       
   184         * @return void
       
   185         */
       
   186         static void WriteToLog( TRefByValue<const TDesC8> aFmt,... );
       
   187         
       
   188         /**
       
   189         * Find keys by their ID
       
   190         *
       
   191         * @param TInt ID of the desired property set
       
   192         * @param CRepository* An opened repository
       
   193         */
       
   194         static RArray<TUint32> FindByIdL( TInt aSettingsId, CRepository* aRepository );
       
   195                                             
       
   196         
       
   197         /**
       
   198         * Find keys by their type
       
   199         *
       
   200         * @param CRepository* An opened repository
       
   201         * @param TXdmSettingsProperty Type of the desired property set
       
   202         */                  
       
   203         static RArray<TUint32> FindByTypeL( CRepository* aRepository,
       
   204                                             TXdmSettingsProperty aSingleProp );
       
   205         
       
   206         /**
       
   207         * Create a unique ID for a collection of settings
       
   208         *
       
   209         * @param CRepository* An opened repository
       
   210         * @param TInt Number of the target row
       
   211         * @return TInt32 A new Central Repository key
       
   212         */
       
   213         static TInt CreateUniqueIdL( CRepository* aRepository, TInt aRow );
       
   214         
       
   215         /**
       
   216         * Find the row for the specified collection of settings
       
   217         *
       
   218         * @param TInt the ID of the desired property set
       
   219         * @param CRepository* An opened repository
       
   220         * @return TInt Row number for the target property set
       
   221         */
       
   222         static TInt FindRowL( TInt aSettingsId, CRepository* aRepository );
       
   223                                 
       
   224         /**
       
   225         * Return the last row from the repository
       
   226         *
       
   227         * @param CRepository* An opened repository
       
   228         * @param TInt32 Column
       
   229         * @return TInt Row number for the last property set
       
   230         */
       
   231         static TInt LastRow( CRepository* aRepository );
       
   232     };
       
   233 
       
   234 #endif      //__XDMSETTINGSAPI__
       
   235             
       
   236 // End of File