25
|
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: Stub imlementation
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include <psmsettingsprovider.h>
|
|
21 |
#include "PSMDisplayPlugin.h"
|
|
22 |
#include "GSDisplayPluginModel.h"
|
|
23 |
#include "GsLogger.h"
|
|
24 |
#include <psmsrvdomaincrkeys.h>
|
|
25 |
#include <featmgr.h>
|
|
26 |
#include <settingsinternalcrkeys.h>
|
|
27 |
|
|
28 |
#ifndef __WINS__
|
|
29 |
#include <power_save_display_mode.h>
|
|
30 |
#endif
|
|
31 |
|
|
32 |
// CONSTANT DEFINITIONS
|
|
33 |
const TUint32 KPSMDisplayPluginStorageId = 0x2000B591;
|
|
34 |
|
|
35 |
enum TPsmDisplayPluginKeys
|
|
36 |
{
|
|
37 |
EContrast = 1,
|
|
38 |
EBacklightPeriod,
|
|
39 |
EBrightness,
|
|
40 |
EAmbientLightSensor,
|
|
41 |
EScreenSaverPeriod,
|
|
42 |
EAutomaticBrightnessControl
|
|
43 |
};
|
|
44 |
//
|
|
45 |
// ----------------------------------------------------------------------------------
|
|
46 |
// CPSMDisplayPlugin::CPSMDisplayPlugin()
|
|
47 |
// ----------------------------------------------------------------------------------
|
|
48 |
//
|
|
49 |
CPSMDisplayPlugin::CPSMDisplayPlugin( TPsmPluginCTorParams& aInitParams ) :
|
|
50 |
CPsmPluginBase( aInitParams )
|
|
51 |
{
|
|
52 |
}
|
|
53 |
|
|
54 |
// -----------------------------------------------------------------------------
|
|
55 |
// CPSMDisplayPlugin::ConstructL(
|
|
56 |
// Symbian 2nd phase constructor can leave.
|
|
57 |
// -----------------------------------------------------------------------------
|
|
58 |
//
|
|
59 |
void CPSMDisplayPlugin::ConstructL()
|
|
60 |
{
|
|
61 |
iModel = CGSDisplayPluginModel::NewL( EFalse );
|
|
62 |
#ifndef __WINS__
|
|
63 |
iDisplayModel = CPowerSaveDisplayMode::NewL();
|
|
64 |
#endif
|
|
65 |
}
|
|
66 |
|
|
67 |
//
|
|
68 |
// ----------------------------------------------------------------------------------
|
|
69 |
// CPSMDisplayPlugin::NewL()
|
|
70 |
// ----------------------------------------------------------------------------------
|
|
71 |
//
|
|
72 |
// Two-phased constructor.
|
|
73 |
CPSMDisplayPlugin* CPSMDisplayPlugin::NewL( TPsmPluginCTorParams& aInitParams )
|
|
74 |
{
|
|
75 |
CPSMDisplayPlugin* self = new ( ELeave ) CPSMDisplayPlugin( aInitParams );
|
|
76 |
|
|
77 |
CleanupStack::PushL( self );
|
|
78 |
self->ConstructL();
|
|
79 |
CleanupStack::Pop( self );
|
|
80 |
|
|
81 |
return self;
|
|
82 |
}
|
|
83 |
|
|
84 |
// ----------------------------------------------------------------------------------
|
|
85 |
// CPSMDisplayPlugin::~CPSMDisplayPlugin()
|
|
86 |
// ----------------------------------------------------------------------------------
|
|
87 |
//
|
|
88 |
// Destructor.
|
|
89 |
CPSMDisplayPlugin::~CPSMDisplayPlugin()
|
|
90 |
{
|
|
91 |
__GSLOGSTRING( "[CPSMDisplayPlugin::~CPSMDisplayPlugin]" );
|
|
92 |
if( iModel ) delete iModel;
|
|
93 |
|
|
94 |
#ifndef __WINS__
|
|
95 |
if ( iDisplayModel )
|
|
96 |
{
|
|
97 |
delete iDisplayModel;
|
|
98 |
}
|
|
99 |
#endif
|
|
100 |
|
|
101 |
}
|
|
102 |
|
|
103 |
// ----------------------------------------------------------------------------------
|
|
104 |
// CPSMDisplayPlugin::NotifyModeChange()
|
|
105 |
// ----------------------------------------------------------------------------------
|
|
106 |
//
|
|
107 |
void CPSMDisplayPlugin::NotifyModeChange( const TInt aMode )
|
|
108 |
{
|
|
109 |
TInt err = KErrNone;
|
|
110 |
TRAP( err, DoModeChangeL( aMode ) );
|
|
111 |
__GSLOGSTRING2( "[CPSMDisplayPlugin::NotifyModeChange]: Mode:%d Err:%d", aMode, err );
|
|
112 |
|
|
113 |
}
|
|
114 |
|
|
115 |
|
|
116 |
// ----------------------------------------------------------------------------------
|
|
117 |
// CPSMDisplayPlugin::NotifyModeChange()
|
|
118 |
// ----------------------------------------------------------------------------------
|
|
119 |
//
|
|
120 |
void CPSMDisplayPlugin::DoModeChangeL( const TInt aMode )
|
|
121 |
{
|
|
122 |
RConfigInfoArray infoArray;
|
|
123 |
|
|
124 |
TPsmsrvConfigInfo info1;
|
|
125 |
info1.iConfigId = EContrast;
|
|
126 |
info1.iConfigType = EConfigTypeInt;
|
|
127 |
info1.iIntValue = iModel->ContrastL();
|
|
128 |
infoArray.Append( info1 );
|
|
129 |
|
|
130 |
TPsmsrvConfigInfo info2;
|
|
131 |
info2.iConfigId = EBacklightPeriod;
|
|
132 |
info2.iConfigType = EConfigTypeInt;
|
|
133 |
info2.iIntValue = iModel->BacklightPeriodL();
|
|
134 |
infoArray.Append( info2 );
|
|
135 |
|
|
136 |
TPsmsrvConfigInfo info3;
|
|
137 |
info3.iConfigId = EBrightness;
|
|
138 |
info3.iConfigType = EConfigTypeInt;
|
|
139 |
info3.iIntValue = iModel->BrightnessL();
|
|
140 |
infoArray.Append( info3 );
|
|
141 |
|
|
142 |
TPsmsrvConfigInfo info4;
|
|
143 |
info4.iConfigId = EAmbientLightSensor;
|
|
144 |
info4.iConfigType = EConfigTypeInt;
|
|
145 |
info4.iIntValue = iModel->AmbientLightSensorL();
|
|
146 |
infoArray.Append( info4 );
|
|
147 |
|
|
148 |
TPsmsrvConfigInfo info5;
|
|
149 |
info5.iConfigId = EScreenSaverPeriod;
|
|
150 |
info5.iConfigType = EConfigTypeInt;
|
|
151 |
info5.iIntValue = iModel->ScreenSaverAndKeyguardPeriodL();
|
|
152 |
infoArray.Append( info5 );
|
|
153 |
|
|
154 |
#ifndef __WINS__
|
|
155 |
TPsmsrvConfigInfo info6;
|
|
156 |
info6.iConfigId = EAutomaticBrightnessControl;
|
|
157 |
info6.iConfigType = EConfigTypeInt;
|
|
158 |
info6.iIntValue = iDisplayModel->GetPowerSaveLevel();
|
|
159 |
infoArray.Append( info6 );
|
|
160 |
#endif
|
|
161 |
|
|
162 |
__GSLOGSTRING1( "[CPSMDisplayPlugin::NotifyModeChangeL] Switching to mode:%d", aMode );
|
|
163 |
|
|
164 |
// Print old values from array
|
|
165 |
__GSLOGSTRING1( "[CPSMDisplayPlugin::NotifyModeChangeL]: oldValue info1: %d", infoArray[0].iIntValue );
|
|
166 |
__GSLOGSTRING1( "[CPSMDisplayPlugin::NotifyModeChangeL]: oldValue info2: %d", infoArray[1].iIntValue );
|
|
167 |
__GSLOGSTRING1( "[CPSMDisplayPlugin::NotifyModeChangeL]: oldValue info3: %d", infoArray[2].iIntValue );
|
|
168 |
__GSLOGSTRING1( "[CPSMDisplayPlugin::NotifyModeChangeL]: oldValue info4: %d", infoArray[3].iIntValue );
|
|
169 |
__GSLOGSTRING1( "[CPSMDisplayPlugin::NotifyModeChangeL]: oldValue info5: %d", infoArray[4].iIntValue );
|
|
170 |
#ifndef __WINS__
|
|
171 |
__GSLOGSTRING1( "[CPSMDisplayPlugin::NotifyModeChangeL]: oldValue info6: %d", infoArray[5].iIntValue );
|
|
172 |
#endif
|
|
173 |
|
|
174 |
iSettingsProvider.BackupAndGetSettingsL( infoArray, KPSMDisplayPluginStorageId );
|
|
175 |
|
|
176 |
// Print new values from array
|
|
177 |
__GSLOGSTRING1( "[CPSMDisplayPlugin::NotifyModeChangeL]: newValue info1: %d", infoArray[0].iIntValue );
|
|
178 |
__GSLOGSTRING1( "[CPSMDisplayPlugin::NotifyModeChangeL]: newValue info2: %d", infoArray[1].iIntValue );
|
|
179 |
__GSLOGSTRING1( "[CPSMDisplayPlugin::NotifyModeChangeL]: newValue info3: %d", infoArray[2].iIntValue );
|
|
180 |
__GSLOGSTRING1( "[CPSMDisplayPlugin::NotifyModeChangeL]: newValue info4: %d", infoArray[3].iIntValue );
|
|
181 |
__GSLOGSTRING1( "[CPSMDisplayPlugin::NotifyModeChangeL]: newValue info5: %d", infoArray[4].iIntValue );
|
|
182 |
#ifndef __WINS__
|
|
183 |
__GSLOGSTRING1( "[CPSMDisplayPlugin::NotifyModeChangeL]: newValue info6: %d", infoArray[5].iIntValue );
|
|
184 |
#endif
|
|
185 |
|
|
186 |
if ( iModel->ContrastL ( )!= KErrNotSupported )
|
|
187 |
{
|
|
188 |
iModel->SetContrastL ( infoArray[0].iIntValue );
|
|
189 |
}
|
|
190 |
|
|
191 |
if ( FeatureManager::FeatureSupported ( KFeatureIdBrightnessControl ) )
|
|
192 |
{
|
|
193 |
iModel->SetBrightnessL ( infoArray[2].iIntValue );
|
|
194 |
}
|
|
195 |
|
|
196 |
if ( iModel->CheckScreenSaverTimeoutSupportL() )
|
|
197 |
{
|
|
198 |
iModel->SetScreenSaverAndKeyguardPeriodL( infoArray[4].iIntValue );
|
|
199 |
}
|
|
200 |
|
|
201 |
iModel->SetBacklightPeriodL( infoArray[1].iIntValue );
|
|
202 |
iModel->SetAmbientLightSensorL( infoArray[3].iIntValue );
|
|
203 |
|
|
204 |
#ifndef __WINS__
|
|
205 |
if ( FeatureManager::FeatureSupported( KFeatureIdFfAbcAgressiveUi ) )
|
|
206 |
{
|
|
207 |
iDisplayModel->SetPowerSaveLevel(
|
|
208 |
(CPowerSaveDisplayMode::TPowerSaveLevel)infoArray[5].iIntValue );
|
|
209 |
__GSLOGSTRING1( "[CPSMDisplayPlugin::NotifyModeChangeL]: level: %d",
|
|
210 |
iDisplayModel->GetPowerSaveLevel() );
|
|
211 |
}
|
|
212 |
#endif
|
|
213 |
|
|
214 |
infoArray.Reset();
|
|
215 |
}
|
|
216 |
|
|
217 |
|
|
218 |
//End of file
|