psmservices/psmserver/inc/client/psmsettingsimpl.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2007 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:  PSM client settings API implementation class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef PSMSETTINGSIMPL_H
       
    20 #define PSMSETTINGSIMPL_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <psmsettings.h>
       
    24 #include "psmsession.h"
       
    25 
       
    26 /**
       
    27  *  PSM settings API class.
       
    28  *
       
    29  *  Implementents power save mode client settings API.
       
    30  *
       
    31  *  @since S60 5.0
       
    32  */
       
    33 NONSHARABLE_CLASS( CPsmSettingsImpl ) : public CPsmSettings
       
    34     {
       
    35 
       
    36     friend class CPsmSettings;
       
    37 
       
    38     public:  // Constructors and destructor
       
    39 
       
    40         /**
       
    41          * Destructor.
       
    42          */
       
    43         virtual ~CPsmSettingsImpl();
       
    44 
       
    45         /**
       
    46          * C++ constructor.
       
    47          */
       
    48         CPsmSettingsImpl( RPsmServer& aPsmServer );
       
    49 
       
    50     public: // API methods
       
    51 
       
    52         /**
       
    53          * Changes the values. Backups current settings and returns changeable settings
       
    54          *
       
    55          * @since S60 5.0
       
    56          * @param[in, out] aPsmConfigArray Contains current settings, on exit, contains updated settings
       
    57          * @param[in] aRepository Specific reposiroty UID where these settings are in
       
    58          * @return A system wide error code.
       
    59          */
       
    60         TInt BackupAndGetSettings( RConfigInfoArray& aPsmConfigArray, const TUint32 aRepository );
       
    61 
       
    62         /**
       
    63          * Gets configuration set for current mode without doing any backups or changing any values.
       
    64          * Only reads configurations for currently active power save mode. If current mode is not
       
    65          * a power save mode, returns empty array.
       
    66          *
       
    67          * @param[in, out] aPsmConfig Pre-filled configuration info. Must contain at least config identification
       
    68          * @param[in] aRepository Specific reposiroty UID where these settings are in
       
    69          * @return A system wide error code
       
    70          */
       
    71         TInt GetSettings( RConfigInfoArray& aPsmConfigArray, const TUint32 aRepository );
       
    72 
       
    73         /**
       
    74          * Backups settings that exists in aPsmConfigArray. Note that any existing config information
       
    75          * with same config Id in aRepository is overriden with new values from aPsmConfigArray.
       
    76          *
       
    77          *
       
    78          * @param[in, out] aPsmConfigArray Contains current settings, on exit, contains updated settings
       
    79          * @param[in] aRepository Specific reposiroty UID where these settings are in
       
    80          * @return A system wide error code
       
    81          */
       
    82         TInt BackupSettings( RConfigInfoArray& aPsmConfigArray, const TUint32 aRepository );
       
    83 
       
    84         /**
       
    85          * Gives currently active power save mode. If mode change is ongoing, gives the PSM mode for which 
       
    86          * is changing.
       
    87          *
       
    88          * @return TPsmsrvMode Currently active mode
       
    89          */
       
    90         TInt GetCurrentMode( TInt& aMode );
       
    91 
       
    92     private:
       
    93 
       
    94         /**
       
    95          * C++ constructor.
       
    96          */
       
    97         CPsmSettingsImpl();
       
    98 
       
    99         /**
       
   100          * Symbian 2nd phase constructor.
       
   101          */
       
   102         void ConstructL();
       
   103 
       
   104         /**
       
   105          * Handles settings related requests
       
   106          */
       
   107         TInt HandleSettingsRequest( RConfigInfoArray& aPsmConfigArray, 
       
   108                                     const TUint32 aRepository,
       
   109                                     const TPsmServerRequest aRequest );
       
   110 
       
   111         /**
       
   112          * Updates config array
       
   113          */
       
   114         void UpdateConfigArray( RConfigInfoArray& aTargetArray, 
       
   115                                 RConfigInfoArray& aSourceArray );
       
   116 
       
   117     private: // data
       
   118 
       
   119         /**
       
   120          * Client-server session to PSM server.
       
   121          */
       
   122         RPsmServer iPsmServer;
       
   123 
       
   124         /**
       
   125          * Indicates is iPsmServer owned
       
   126          */
       
   127         TBool iOwnSession;
       
   128 
       
   129     };
       
   130 
       
   131 #endif // PSMSETTINGSIMPL_H