|
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 settings handler class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef PSMSETTINGSHANDLER_H |
|
20 #define PSMSETTINGSHANDLER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <psmsettingsprovider.h> |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class CPsmStorage; |
|
27 class CPsmConfigStorage; |
|
28 class CPsmCenRepStorage; |
|
29 class CPsmBackupStorage; |
|
30 |
|
31 /** |
|
32 * PSM Settings handler class |
|
33 * |
|
34 * Handles settings related events during power save mode change |
|
35 * |
|
36 * @since S60 5.0 |
|
37 */ |
|
38 class CPsmSettingsHandler : public CBase, |
|
39 public MPsmSettingsProvider |
|
40 { |
|
41 public: // Constructors and destructor |
|
42 |
|
43 /** |
|
44 * Creates a new PSM settings handler. |
|
45 * |
|
46 * @since S60 5.0 |
|
47 * @param aMode Mode where to swith to |
|
48 * @return A pointer to the created object. |
|
49 */ |
|
50 static CPsmSettingsHandler* NewL( TPsmsrvMode aMode ); |
|
51 |
|
52 /** |
|
53 * Creates a new PSM settings handler. Newly created instance is left in the cleanup stack. |
|
54 * |
|
55 * @since S60 5.0 |
|
56 * @param aMode Mode where to swith to |
|
57 * @return A pointer to the created object. |
|
58 */ |
|
59 static CPsmSettingsHandler* NewLC( TPsmsrvMode aMode ); |
|
60 |
|
61 /** |
|
62 * Destructor. |
|
63 */ |
|
64 virtual ~CPsmSettingsHandler(); |
|
65 |
|
66 /** |
|
67 * From MPsmSettingsProvider. Changes the settings |
|
68 */ |
|
69 void BackupAndGetSettingsL( RConfigInfoArray& aPsmConfigArray, const TUint32 aRepository ); |
|
70 |
|
71 /** |
|
72 * From MPsmSettingsProvider. Gets configuration set for current PSM mode |
|
73 */ |
|
74 void GetSettingsL( RConfigInfoArray& aPsmConfigArray, const TUint32 aRepository ); |
|
75 |
|
76 /** |
|
77 * From MPsmSettingsProvider. Creates backup for configuration set. |
|
78 */ |
|
79 void BackupSettingsL( const RConfigInfoArray& aPsmConfigArray, const TUint32 aRepository ); |
|
80 |
|
81 /** |
|
82 * Changes CenRep keys |
|
83 */ |
|
84 void ChangeCenRepSettingsL(); |
|
85 |
|
86 /** |
|
87 * Sets new mode |
|
88 */ |
|
89 void SetMode( TPsmsrvMode aMode ); |
|
90 |
|
91 /** |
|
92 * Returns mode where to switch to |
|
93 */ |
|
94 TPsmsrvMode Mode() { return iMode; }; |
|
95 |
|
96 /** |
|
97 * Returns current mode before mode change |
|
98 */ |
|
99 TPsmsrvMode PreviousMode() const { return iCurrentMode; }; |
|
100 |
|
101 private: |
|
102 |
|
103 /** |
|
104 * C++ constructor. |
|
105 * @param aMode Mode where to swith to |
|
106 */ |
|
107 CPsmSettingsHandler( TPsmsrvMode aMode ); |
|
108 |
|
109 /** |
|
110 * By default Symbian 2nd phase constructor is private. |
|
111 */ |
|
112 void ConstructL(); |
|
113 |
|
114 /** |
|
115 * Changes CenRep keys |
|
116 */ |
|
117 void ChangeCenRepSettingsL( RConfigInfoArray& aPsmConfigArray, TUint32 aRepository ); |
|
118 |
|
119 /** |
|
120 * Compares current settings to new settings, creates backup and returns |
|
121 * new settings |
|
122 * |
|
123 * @param aConfigStorage Storage where to get new config values |
|
124 * |
|
125 */ |
|
126 void ChangeSettingsL( RConfigInfoArray& aPsmConfigArray, |
|
127 TUint32 aRepository, |
|
128 CPsmStorage& aConfigStorage ); |
|
129 |
|
130 /** |
|
131 * Compares two configuration informations |
|
132 */ |
|
133 TBool Compare( const TPsmsrvConfigInfo& aSource, const TPsmsrvConfigInfo& aTarget ) const; |
|
134 |
|
135 private: // Data |
|
136 |
|
137 /** |
|
138 * Mode where to switch to |
|
139 */ |
|
140 TPsmsrvMode iMode; |
|
141 |
|
142 /** |
|
143 * Mode before PSM change completed |
|
144 */ |
|
145 TPsmsrvMode iCurrentMode; |
|
146 |
|
147 /** |
|
148 * Handle to file server session |
|
149 */ |
|
150 RFs iFileSession; |
|
151 |
|
152 /** |
|
153 * Storage file handlers |
|
154 */ |
|
155 CPsmConfigStorage* iConfigStorage; |
|
156 CPsmBackupStorage* iBackupStorage; |
|
157 CPsmCenRepStorage* iCenRepStorage; |
|
158 |
|
159 }; |
|
160 |
|
161 #endif // PSMSETTINGSHANDLER_H |