convergedcallengine/spsettings/inc/spsettingsengine.h
changeset 0 ff3b6d0fd310
child 19 7d48bed6ce0c
equal deleted inserted replaced
-1:000000000000 0:ff3b6d0fd310
       
     1 /*
       
     2 * Copyright (c)  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:  Service Provider Settings API's engine class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_SPSETTINGSENGINE_H
       
    20 #define C_SPSETTINGSENGINE_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <badesca.h>
       
    24 #include "spdefinitions.h"
       
    25 #include "cenrepdatabaseproperty.h"
       
    26 
       
    27 class CRepository;
       
    28 class CSPEntry;
       
    29 class CSPProperty;
       
    30 class CCenRepDatabaseUtil;
       
    31 
       
    32 /**
       
    33  *  Engine class for Service Provider Settings API.
       
    34  *
       
    35  *  Do actual storage operations for service settings.
       
    36  *
       
    37  *  @lib serviceprovidersettings.lib
       
    38  *  @since S60 v3.2
       
    39  */
       
    40 NONSHARABLE_CLASS( CSPSettingsEngine ): public CBase
       
    41     {
       
    42 
       
    43 	public: // Constructors and destructor
       
    44 
       
    45 	    /**
       
    46 	    * Two-phased constructor.
       
    47 	    */
       
    48 	    static CSPSettingsEngine* NewL();
       
    49 
       
    50 	    /**
       
    51 	    * Two-phased constructor.
       
    52 	    */
       
    53 	    static CSPSettingsEngine* NewLC();
       
    54 
       
    55 	    /**
       
    56 	    * Destructors.
       
    57 	    */
       
    58 	    virtual ~CSPSettingsEngine();
       
    59 
       
    60 	public: // memeber functions
       
    61 	    /**
       
    62 	     * Starts transaction in repository
       
    63 	     *
       
    64 	     * @since S60 v3.2
       
    65 	     */
       
    66 	    TInt BeginTransactionLC();
       
    67 
       
    68 	    /**
       
    69 	     * Commits changes in repository
       
    70 	     *
       
    71 	     * @since S60 v3.2
       
    72 	     */
       
    73 	    TInt CommitTransaction();
       
    74 	    
       
    75 	    /**
       
    76 	     * Rollback changes in repository
       
    77 	     *
       
    78 	     * @since S60 v3.2
       
    79 	     */
       
    80 	    void RollbackTransaction();
       
    81 
       
    82 	    /**
       
    83 	     * Stores new service provider settings entry
       
    84 	     *
       
    85 	     * @since S60 v3.2
       
    86 	     * @param aEntry New service provider settings entry, on return service Id is filled in
       
    87 	     */
       
    88 	    void AddEntryL( CSPEntry& aEntry );
       
    89 
       
    90 	    /**
       
    91 	     * Search service provider settings entry by service ID. 
       
    92 	     *
       
    93 	     * @since S60 v3.2
       
    94 	     * @param aServiceId Id of requested xSP settings entry
       
    95 	     * @param aEntry on return, SP settings entry corresponding to aServiceId.
       
    96 	     * @return error code, KErrNone if succeeded, otherwise system wide error code
       
    97 	     */
       
    98 	    TInt FindEntryL( TServiceId aServiceId, CSPEntry& aEntry );
       
    99 
       
   100 	    /**
       
   101 	     * Updates service provider settings entry to settings storage.
       
   102 	     *
       
   103 	     * @since S60 v3.2
       
   104 	     * @param aEntry Updated service provider settings entry
       
   105 	     * @return error code, KErrNone if update succeeded, otherwise system wide error code
       
   106 	     */
       
   107 	    TInt UpdateEntryL( const CSPEntry& aEntry );
       
   108 
       
   109 	    /**
       
   110 	     * Deletes service provider settings entry from storage by service ID.
       
   111 	     *
       
   112 	     * @since S60 v3.2
       
   113 	     * @param aEntryId Id of settings entry which is going to be deleted
       
   114 	     * @return error code, KErrNone if delete succeeded, otherwise system wide error code
       
   115 	     */
       
   116 	    TInt DeleteEntryL( TServiceId aServiceId );
       
   117 
       
   118 	    /**
       
   119 	     * Search property of service provider settings entry from storage.
       
   120 	     *
       
   121 	     * @since S60 v3.2
       
   122 	     * @param aServiceId The service ID of requested service entry
       
   123 	     * @param aPropertyName property name to be found
       
   124 	     * @param aProperty on return, requested property
       
   125 	     * @return error code, KErrNone if succeeded, otherwise system wide error code
       
   126 	     */
       
   127 	    TInt FindPropertyL( TServiceId aServiceId, 
       
   128 	                        TServicePropertyName aPropertyName,
       
   129 	                        CSPProperty& aProperty );
       
   130 
       
   131 	    /**
       
   132 	     * Add or update properties of service provider settings entry to storage.
       
   133 	     * If property name exists, update property. If property doesn't exist,
       
   134 	     *
       
   135 	     * @since S60 v3.2
       
   136 	     * @param aServiceId The ID of updated service entry
       
   137 	     * @param aPropertyArray new properties to be added or updated
       
   138 	     * @return error code, KErrNone if update succeeded, otherwise system wide error code
       
   139 	     */
       
   140 	    TInt AddOrUpdatePropertiesL( TServiceId aServiceId, const RPropertyArray& aPropertyArray );
       
   141 
       
   142 	    /**
       
   143 	     * Return count of service provider settings entries in storage.
       
   144 	     *
       
   145 	     * @since S60 v3.2
       
   146 	     * @return Count of stored service provider settings.
       
   147 	     */
       
   148 	    TInt SettingsCountL();
       
   149 
       
   150 	    /**
       
   151 	     * Search all service provider IDs from storage
       
   152 	     *
       
   153 	     * @since S60 v3.2
       
   154 	     * @param aServiceIds An array containing returned service IDs
       
   155 	     * @return error code
       
   156 	     */
       
   157 	    TInt FindServiceIdsL( RIdArray& aServiceIds );
       
   158 
       
   159 	    /**
       
   160 	     * Search all service names from settings storage by given service IDs.
       
   161 	     * Removes service ID from given array if corresponding service name
       
   162 	     * is not found. 
       
   163 	     *
       
   164 	     * @since S60 v3.2
       
   165 	     * @param aServiceIds An array of service IDs
       
   166 	     * @param aServiceNames on return, array which saves found service names 
       
   167 	     */
       
   168 	    void FindServiceNamesL( RIdArray& aServiceIds, CDesCArray& aServiceNames );
       
   169 
       
   170 
       
   171 	   /**
       
   172 	     * Search subservice properties of requested service provider settings entry by ID.
       
   173 	     *
       
   174 	     * @since S60 v3.2
       
   175 	     * @param aServiceId The ID of requested service entry
       
   176 	     * @param aPropertyType property type of sub service
       
   177 	     * @param aPropertyArray on return,  array which saves found subservice properties
       
   178 	     * @return error code
       
   179 	     */
       
   180 	    TInt FindSubServicePropertiesL( TServiceId aServiceId,
       
   181 	    								TSPItemType aPropertyType,
       
   182 	                                   RPropertyArray& aPropertyArray );
       
   183 
       
   184 	    /**
       
   185 	     * Deletes service properties by service ID and property name.
       
   186 	     *
       
   187 	     * @since S60 v3.2
       
   188 	     * @param aServiceId The service ID of requested service entry
       
   189 	     * @param aNameArray name of properties to be deleted
       
   190 	     * @return error code
       
   191 	     */
       
   192 	    TInt DeleteServicePropertiesL( TServiceId aServiceId,
       
   193 	                                   const RPropertyNameArray& aNameArray );
       
   194 	                                   
       
   195 	    /**
       
   196 	     * Find service IDs with same properties
       
   197 	     *
       
   198 	     * @since S60 v3.2
       
   199 	     * @param aPropertyArray property array
       
   200 	     * @param on return, service Ids with same properties
       
   201 	     * @return error code
       
   202 	     */
       
   203 	    void FindServiceIdsFromPropertiesL( const RPropertyArray& aPropertyArray, RIdArray& aServiceIds );
       
   204 	                                   
       
   205 	    /**
       
   206 	     * Check feature is supported or not
       
   207 	     *
       
   208 	     * @since S60 v3.2
       
   209 	     * @return SIP VoIP software version
       
   210 	     */
       
   211 	    TBool IsFeatureSupportedL( TSPServiceFeature aFeature, 
       
   212 	                               TBool aWriteAllowed );
       
   213 	    
       
   214 	    
       
   215 	    /**
       
   216 	     * When service table is changed, update the P&S key
       
   217 	     *
       
   218 	     * @since S60 v3.2
       
   219 	     */
       
   220 	    void UpdateSupportFeaturePSKeyL();
       
   221 
       
   222 	    /**
       
   223 	     * Check if it is VoIP Service ID
       
   224 	     *
       
   225 	     * @since S60 v3.2.3
       
   226 	     * @return ETrue if yes
       
   227 	     */
       
   228 		TBool IsVoIPServiceL( TServiceId aServiceId );
       
   229 
       
   230 	    /**		
       
   231 	     * Get Name array from Property array
       
   232 	     *
       
   233 	     * @since S60 v3.2.3
       
   234 	     */
       
   235 		void NameArrayFromPropertyArrayL( RPropertyNameArray& aNameArray, const RPropertyArray& aPropertyArray );
       
   236 
       
   237 	    /**
       
   238 	     * Check if an array has call related property name in it
       
   239 	     *
       
   240 	     * @since S60 v3.2.3
       
   241 	     * @return ETrue if yes
       
   242 	     */
       
   243 		TBool HasCallPropertyName( const RPropertyNameArray& aNameArray );
       
   244 		
       
   245 	    /**
       
   246 	     * Check if an array has VoIP or Vmbx related property name in it
       
   247 	     *
       
   248 	     * @since S60 v3.2.3
       
   249 	     * @return ETrue if yes
       
   250 	     */
       
   251 		TBool HasVoIPAndVmbxPropertyName(  const RPropertyNameArray& aNameArray );
       
   252 		
       
   253 	private:
       
   254 
       
   255 	    /**
       
   256 	    * C++ default constructor.
       
   257 	    */
       
   258 	    CSPSettingsEngine();
       
   259 
       
   260 	    /**
       
   261 	    * By default Symbian 2nd phase constructor is private.
       
   262 	    */
       
   263 	    void ConstructL();
       
   264 
       
   265 
       
   266 	    /**
       
   267 	     * Walk through all the sevices and check there is any service match 
       
   268 	     *
       
   269 	     * @since S60 v3.2
       
   270 	     * @param aMask attribute mask 
       
   271 	     * @param aValue value to be checked
       
   272 	     */
       
   273 	    TBool CheckFeatureL( TInt aMask, TInt aValue );
       
   274 	    
       
   275         
       
   276         void ConvertSpEntryToCenRepArrayL( const CSPEntry& aEntry, 
       
   277                                            RIpAppPropArray& aArray );
       
   278         
       
   279         void ConvertSpArrayToCenRepArrayL( const RPropertyArray& aSpArray,
       
   280                                            RIpAppPropArray& aCenRepArray );
       
   281                                            
       
   282         void PropertyNameArrayFromItemTypeL( TSPItemType aPropertyType, 
       
   283                                              RPropertyNameArray& aNameArray );
       
   284                                            
       
   285         static void CleanupPointerArray( TAny* aPointer );
       
   286 	    
       
   287 	    
       
   288 	private: // data
       
   289 
       
   290         CCenRepDatabaseUtil* iCenRepUtils;
       
   291     };
       
   292 
       
   293 #endif // C_SPSETTINGS_H