mmserv/radioutility/presetutility/inc/cenrephandler.h
changeset 14 80975da52420
equal deleted inserted replaced
12:5a06f39ad45b 14:80975da52420
       
     1 /*
       
     2 * Copyright (c) 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 "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:  This is a wrapper class of Central Repository, responsible
       
    15 *               for the operations that need to access the central respository.
       
    16 *
       
    17 *
       
    18 */
       
    19 
       
    20 #ifndef CCENREPHANDLER_H
       
    21 #define CCENREPHANDLER_H
       
    22 
       
    23 // System includes
       
    24 #include <e32base.h>
       
    25 
       
    26 // Constants
       
    27 const TInt KBufferLength = 20;
       
    28 const TInt KStreamBufferSize = 100;
       
    29 
       
    30 // Forward declarations
       
    31 class CRepository;
       
    32 class TPreset;
       
    33 class CCenrepBookKeeping;
       
    34 
       
    35 // Class declaration
       
    36 
       
    37 /**
       
    38  *  it is a wrapper of Central Repository, responsible for the operations that need to access
       
    39  *  the central respository.
       
    40  */
       
    41 class CCenrepHandler : public CBase
       
    42     {
       
    43 public:
       
    44 
       
    45     /**
       
    46     * Two-phased class constructor.
       
    47     */
       
    48     static CCenrepHandler* NewL();
       
    49     
       
    50     /**
       
    51     * Destructor of CCenrepHandler class.
       
    52     */
       
    53     virtual ~CCenrepHandler();
       
    54 
       
    55     /**
       
    56     * Get the maximum number of presets.
       
    57     * @return The maximum number of presets.
       
    58     */
       
    59     TInt MaxPresetCount() const;
       
    60 
       
    61     /**
       
    62     * Get the current number of presets.
       
    63     * @return The number of presets.
       
    64     */
       
    65     TInt PresetCount() const;
       
    66 
       
    67     /**
       
    68     * Get the index of first preset.
       
    69     * @return The first preset index.
       
    70     */        
       
    71     TInt FirstPreset() const;
       
    72 
       
    73     /**
       
    74     * Get the index of the next preset.
       
    75     * @param aFromIndex -  Start from index after this.
       
    76     * @return the next preset index.
       
    77     */           
       
    78     TInt NextPreset( TInt aFromIndex ) const;
       
    79     
       
    80     /**
       
    81     * Delete the specified preset.
       
    82     * Specifying aIndex < 0, will delete all presets.
       
    83     * Has no effect if specified index contains no preset.
       
    84     */
       
    85     TInt DeletePreset( TInt aIndex );
       
    86     
       
    87     /**
       
    88     * Save the preset.
       
    89     * @param aPreset Preset object.
       
    90     * @param aIndex -  Preset index.
       
    91     * @return given/allocated(in case given value was -1) index.
       
    92     */           
       
    93     TInt SavePresetL( const TPreset& aPreset, TInt aIndex = -1 );
       
    94     
       
    95     
       
    96     /**
       
    97     * Read a preset.
       
    98     * @param aIndex -  Preset index.
       
    99     * @param aPreset Preset object to where to update the data.
       
   100     * @return none
       
   101     */           
       
   102     void ReadPresetL( TInt aIndex, TPreset& aPreset );
       
   103 
       
   104 private:
       
   105 
       
   106     /**
       
   107     * Default class constructor.
       
   108     */
       
   109     CCenrepHandler();
       
   110 
       
   111     /**
       
   112     * Second phase class constructor.
       
   113     */
       
   114     void ConstructL();
       
   115 
       
   116     /**
       
   117     * Read bookkeeping information from the permanent storage.
       
   118     */
       
   119     void ReadBookKeepingL();
       
   120 
       
   121     /**
       
   122     * Save bookkeeping information to the permanent storage.
       
   123     */
       
   124     void SaveBookKeeping();
       
   125         
       
   126     /**
       
   127     * Read preconfigured presets from the permanent storage.
       
   128     */
       
   129     void ReadPreDefinedPresetsL();
       
   130 
       
   131 private: // data
       
   132 
       
   133     // Central Repository
       
   134     CRepository*        iCentralRepository;
       
   135 
       
   136     // Bookkeeping of existing presets
       
   137     CCenrepBookKeeping* iBookKeeping;
       
   138 
       
   139     };
       
   140 
       
   141 #endif  // CCENREPHANDLER_H