|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "HWRMEnhancedLight.h" |
|
21 #include "HWRMExtendedLightImpl.h" |
|
22 #include "HWRMtrace.h" |
|
23 |
|
24 // EXTERNAL DATA STRUCTURES |
|
25 |
|
26 // EXTERNAL FUNCTION PROTOTYPES |
|
27 |
|
28 // CONSTANTS |
|
29 |
|
30 // MACROS |
|
31 |
|
32 // LOCAL CONSTANTS AND MACROS |
|
33 |
|
34 // MODULE DATA STRUCTURES |
|
35 |
|
36 // LOCAL FUNCTION PROTOTYPES |
|
37 |
|
38 // FORWARD DECLARATIONS |
|
39 |
|
40 // ============================= LOCAL FUNCTIONS =============================== |
|
41 |
|
42 // ============================ MEMBER FUNCTIONS =============================== |
|
43 |
|
44 CHWRMEnhancedLight::CHWRMEnhancedLight(): |
|
45 iExtendedLightImpl(NULL) |
|
46 { |
|
47 |
|
48 } |
|
49 |
|
50 CHWRMEnhancedLight::~CHWRMEnhancedLight() |
|
51 { |
|
52 COMPONENT_TRACE1(_L( "HWRM CHWRMEnhancedLight - Destructor" ) ); |
|
53 |
|
54 delete iExtendedLightImpl; |
|
55 |
|
56 COMPONENT_TRACE1(_L( "HWRM CHWRMEnhancedLight - Destructor return" ) ); |
|
57 } |
|
58 |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // CHWRMEnhancedLight::NewL |
|
62 // Two-phased constructor. |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 EXPORT_C CHWRMEnhancedLight* CHWRMEnhancedLight::NewL() |
|
66 { |
|
67 CHWRMEnhancedLight* impl = NewLC(); |
|
68 |
|
69 CleanupStack::Pop(); |
|
70 |
|
71 return impl; |
|
72 } |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // CHWRMEnhancedLight::NewLC |
|
76 // Two-phased constructor. Leaves instance to CleanupStack. |
|
77 // ----------------------------------------------------------------------------- |
|
78 // |
|
79 EXPORT_C CHWRMEnhancedLight* CHWRMEnhancedLight::NewLC() |
|
80 { |
|
81 COMPONENT_TRACE1(_L( "HWRM CHWRMEnhancedLight - CHWRMEnhancedLight::NewLC()" ) ); |
|
82 |
|
83 CHWRMEnhancedLight* enhancedLight = new( ELeave ) CHWRMEnhancedLight(); |
|
84 |
|
85 CleanupStack::PushL( enhancedLight ); |
|
86 |
|
87 enhancedLight->ConstructL(NULL); |
|
88 |
|
89 COMPONENT_TRACE2(_L( "HWRM CHWRMEnhancedLight - CHWRMEnhancedLight::NewLC - return 0x%x" ), enhancedLight ); |
|
90 |
|
91 return enhancedLight; |
|
92 } |
|
93 |
|
94 // ----------------------------------------------------------------------------- |
|
95 // CHWRMEnhancedLight::NewL |
|
96 // Two-phased constructor for creating a Enhanced Light client with callbacks. |
|
97 // ----------------------------------------------------------------------------- |
|
98 // |
|
99 EXPORT_C CHWRMEnhancedLight* CHWRMEnhancedLight::NewL(MHWRMExtendedLightObserver* aCallback) |
|
100 { |
|
101 CHWRMEnhancedLight* impl = NewLC(aCallback); |
|
102 |
|
103 CleanupStack::Pop(); |
|
104 |
|
105 return impl; |
|
106 } |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // CHWRMEnhancedLight::NewLC |
|
110 // Two-phased constructor for creating a Enhanced Light client with callbacks. |
|
111 // Leaves instance to CleanupStack. |
|
112 // ----------------------------------------------------------------------------- |
|
113 // |
|
114 EXPORT_C CHWRMEnhancedLight* CHWRMEnhancedLight::NewLC(MHWRMExtendedLightObserver* aCallback) |
|
115 { |
|
116 COMPONENT_TRACE2(_L( "HWRM CHWRMEnhancedLight - CHWRMEnhancedLight::NewLC(0x%x)" ), aCallback ); |
|
117 |
|
118 // Check that reference is not NULL |
|
119 if ( !aCallback ) |
|
120 { |
|
121 User::Leave(KErrBadHandle); |
|
122 } |
|
123 |
|
124 CHWRMEnhancedLight* enhancedLight = new( ELeave ) CHWRMEnhancedLight(); |
|
125 |
|
126 CleanupStack::PushL( enhancedLight ); |
|
127 |
|
128 enhancedLight->ConstructL(aCallback); |
|
129 |
|
130 COMPONENT_TRACE2(_L( "HWRM CHWRMEnhancedLight - CHWRMEnhancedLight::NewLC - return 0x%x" ), enhancedLight ); |
|
131 |
|
132 return enhancedLight; |
|
133 } |
|
134 |
|
135 // ------------------------------------------------- |
|
136 // CHWRMEnhancedLight::NewL |
|
137 // Two-phased constructor for implementation class. |
|
138 // On opening passes permitted targets. |
|
139 // ------------------------------------------------- |
|
140 // |
|
141 EXPORT_C CHWRMEnhancedLight* CHWRMEnhancedLight::NewL(TInt aPermittedTargets) |
|
142 { |
|
143 CHWRMEnhancedLight* enhancedLight = new(ELeave)CHWRMEnhancedLight; |
|
144 CleanupStack::PushL(enhancedLight); |
|
145 enhancedLight->ConstructL(NULL,aPermittedTargets); |
|
146 CleanupStack::Pop(enhancedLight); |
|
147 return enhancedLight; |
|
148 } |
|
149 |
|
150 // ------------------------------------------------- |
|
151 // CHWRMEnhancedLight::NewL |
|
152 // Two-phased constructor for implementation class. |
|
153 // Use this method for creating a Light client with callbacks. |
|
154 // On opening passes permitted targets. |
|
155 // ------------------------------------------------- |
|
156 // |
|
157 EXPORT_C CHWRMEnhancedLight* CHWRMEnhancedLight::NewL(MHWRMExtendedLightObserver* aCallback, TInt aPermittedTargets) |
|
158 { |
|
159 // Check that reference is not NULL |
|
160 if ( !aCallback ) |
|
161 { |
|
162 User::Leave(KErrBadHandle); |
|
163 } |
|
164 |
|
165 CHWRMEnhancedLight* enhancedLight = new(ELeave)CHWRMEnhancedLight; |
|
166 CleanupStack::PushL(enhancedLight); |
|
167 enhancedLight->ConstructL(aCallback,aPermittedTargets); |
|
168 CleanupStack::Pop(enhancedLight); |
|
169 return enhancedLight; |
|
170 } |
|
171 |
|
172 // ----------------------------------------------------------------------------- |
|
173 // CHWRMEnhancedLight::ConstructL |
|
174 // Symbian 2nd phase constructor can leave. |
|
175 // ----------------------------------------------------------------------------- |
|
176 // |
|
177 void CHWRMEnhancedLight::ConstructL(MHWRMExtendedLightObserver* aCallback, TInt aPermittedTargets) |
|
178 { |
|
179 COMPONENT_TRACE1(_L( "HWRM CHWRMEnhancedLight - CHWRMEnhancedLight::ConstructL()" ) ); |
|
180 |
|
181 iExtendedLightImpl = new(ELeave) CHWRMExtendedLightImpl; |
|
182 |
|
183 iExtendedLightImpl->ConstructL(aCallback, aPermittedTargets); |
|
184 |
|
185 COMPONENT_TRACE1(_L( "HWRM CHWRMEnhancedLight - CHWRMEnhancedLight::ConstructL - return" ) ); |
|
186 } |
|
187 |
|
188 // |
|
189 // API functions forward calls to Extended Light Client |
|
190 // |
|
191 void CHWRMEnhancedLight::ReserveLightL(TInt aTarget) |
|
192 { |
|
193 iExtendedLightImpl->ReserveLightL(aTarget); |
|
194 } |
|
195 |
|
196 void CHWRMEnhancedLight::ReserveLightL(TInt aTarget, TBool aRestoreState, TBool aForceNoCCoeEnv) |
|
197 { |
|
198 iExtendedLightImpl->ReserveLightL(aTarget,aRestoreState,aForceNoCCoeEnv); |
|
199 } |
|
200 |
|
201 void CHWRMEnhancedLight::ReleaseLight(TInt aTarget) |
|
202 { |
|
203 iExtendedLightImpl->ReleaseLight(aTarget); |
|
204 } |
|
205 |
|
206 void CHWRMEnhancedLight::LightOnL(TInt aTarget) |
|
207 { |
|
208 iExtendedLightImpl->LightOnL(aTarget); |
|
209 } |
|
210 |
|
211 void CHWRMEnhancedLight::LightOnL(TInt aTarget, TInt aDuration) |
|
212 { |
|
213 iExtendedLightImpl->LightOnL(aTarget,aDuration); |
|
214 } |
|
215 |
|
216 void CHWRMEnhancedLight::LightOnL(TInt aTarget, TInt aDuration, TInt aIntensity, TBool aFadeIn) |
|
217 { |
|
218 iExtendedLightImpl->LightOnL(aTarget,aDuration,aIntensity,aFadeIn); |
|
219 } |
|
220 |
|
221 void CHWRMEnhancedLight::LightBlinkL(TInt aTarget) |
|
222 { |
|
223 iExtendedLightImpl->LightBlinkL(aTarget); |
|
224 } |
|
225 |
|
226 void CHWRMEnhancedLight::LightBlinkL(TInt aTarget, TInt aDuration) |
|
227 { |
|
228 iExtendedLightImpl->LightBlinkL(aTarget,aDuration); |
|
229 } |
|
230 |
|
231 void CHWRMEnhancedLight::LightBlinkL(TInt aTarget, TInt aDuration, TInt aOnDuration, TInt aOffDuration, TInt aIntensity) |
|
232 { |
|
233 iExtendedLightImpl->LightBlinkL(aTarget,aDuration,aOnDuration,aOffDuration,aIntensity); |
|
234 } |
|
235 |
|
236 void CHWRMEnhancedLight::LightOffL(TInt aTarget) |
|
237 { |
|
238 iExtendedLightImpl->LightOffL(aTarget); |
|
239 } |
|
240 |
|
241 void CHWRMEnhancedLight::LightOffL(TInt aTarget, TInt aDuration) |
|
242 { |
|
243 iExtendedLightImpl->LightOffL(aTarget,aDuration); |
|
244 } |
|
245 |
|
246 void CHWRMEnhancedLight::LightOffL(TInt aTarget, TInt aDuration, TBool aFadeOut) |
|
247 { |
|
248 iExtendedLightImpl->LightOffL(aTarget,aDuration,aFadeOut); |
|
249 } |
|
250 |
|
251 CHWRMExtendedLight::TLightStatus CHWRMEnhancedLight::LightStatus(TInt aTarget) const |
|
252 { |
|
253 return iExtendedLightImpl->LightStatus(aTarget); |
|
254 } |
|
255 |
|
256 TInt CHWRMEnhancedLight::SupportedTargets() const |
|
257 { |
|
258 return iExtendedLightImpl->SupportedTargets(); |
|
259 } |
|
260 |
|
261 EXPORT_C void CHWRMEnhancedLight::SetLightColorL(TInt aTarget, THWRMLightColor& aRGB) |
|
262 { |
|
263 iExtendedLightImpl->DoSetLightColorL(ETrue, aTarget, aRGB.iRed, aRGB.iGreen, aRGB.iBlue); |
|
264 } |
|
265 |
|
266 EXPORT_C void CHWRMEnhancedLight::SetLightDefaultColorL(TInt aTarget) |
|
267 { |
|
268 iExtendedLightImpl->DoSetLightColorL(EFalse, aTarget); |
|
269 } |
|
270 |
|
271 EXPORT_C void CHWRMEnhancedLight::LightOnL(TInt aTarget, TInt aDuration, const THWRMLightColor& aRGBParam) |
|
272 { |
|
273 this->LightOnL(aTarget, aDuration, KHWRMDefaultIntensity, ETrue, aRGBParam); |
|
274 } |
|
275 |
|
276 EXPORT_C void CHWRMEnhancedLight::LightOnL(TInt aTarget, TInt aDuration, TInt aIntensity, TBool aFadeIn, |
|
277 const THWRMLightColor& aRGBParam) |
|
278 { |
|
279 iExtendedLightImpl->DoLightOnWithColorL(aTarget, aDuration, aIntensity, aFadeIn, aRGBParam); |
|
280 } |
|
281 |
|
282 EXPORT_C void CHWRMEnhancedLight::LightBlinkL(TInt aTarget, TInt aDuration, const THWRMLightColor& aRGBParam) |
|
283 { |
|
284 this->LightBlinkL(aTarget, aDuration, KHWRMDefaultCycleTime, |
|
285 KHWRMDefaultCycleTime, KHWRMDefaultIntensity, aRGBParam); |
|
286 } |
|
287 |
|
288 EXPORT_C void CHWRMEnhancedLight::LightBlinkL(TInt aTarget, TInt aDuration, TInt aOnDuration, TInt aOffDuration, |
|
289 TInt aIntensity, const THWRMLightColor& aRGBParam) |
|
290 { |
|
291 iExtendedLightImpl->DoLightBlinkWithColorL(aTarget, aDuration, aOnDuration, aOffDuration, aIntensity, aRGBParam); |
|
292 } |
|
293 |
|
294 |
|
295 |
|
296 |
|
297 // End of File |