|
1 /* |
|
2 * Copyright (c) 2010 Ixonos Plc. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "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 * Ixonos Plc |
|
14 * |
|
15 * Description: |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 |
|
22 // User includes |
|
23 #include "VeiDisplayLighter.h" |
|
24 |
|
25 EXPORT_C CVeiDisplayLighter* CVeiDisplayLighter::NewL() |
|
26 { |
|
27 CVeiDisplayLighter* self = new (ELeave) CVeiDisplayLighter(); |
|
28 CleanupStack::PushL( self ); |
|
29 self->ConstructL(); |
|
30 CleanupStack::Pop( self ); |
|
31 return self; |
|
32 } |
|
33 |
|
34 CVeiDisplayLighter::CVeiDisplayLighter(): CActive( CActive::EPriorityLow ) |
|
35 { |
|
36 CActiveScheduler::Add( this ); |
|
37 } |
|
38 |
|
39 CVeiDisplayLighter::~CVeiDisplayLighter() |
|
40 { |
|
41 Cancel(); |
|
42 iTimer.Close(); |
|
43 } |
|
44 |
|
45 void CVeiDisplayLighter::ConstructL() |
|
46 { |
|
47 iTimeout = 10; |
|
48 iTimer.CreateLocal(); |
|
49 } |
|
50 |
|
51 EXPORT_C void CVeiDisplayLighter::Reset() |
|
52 { |
|
53 Cancel(); |
|
54 Start(); |
|
55 } |
|
56 |
|
57 EXPORT_C void CVeiDisplayLighter::Stop() |
|
58 { |
|
59 Cancel(); |
|
60 } |
|
61 |
|
62 |
|
63 void CVeiDisplayLighter::DoCancel() |
|
64 { |
|
65 iTimer.Cancel(); |
|
66 } |
|
67 |
|
68 EXPORT_C void CVeiDisplayLighter::Start() |
|
69 { |
|
70 if ( !IsActive() ) |
|
71 { |
|
72 iTimer.Inactivity( iStatus, iTimeout ); |
|
73 SetActive(); |
|
74 } |
|
75 } |
|
76 |
|
77 void CVeiDisplayLighter::RunL() |
|
78 { |
|
79 if ( iStatus == KErrNone ) |
|
80 { |
|
81 TInt inactivity = User::InactivityTime().Int(); |
|
82 if ( inactivity >= iTimeout ) |
|
83 { |
|
84 User::ResetInactivityTime(); |
|
85 iTimer.Inactivity( iStatus, iTimeout ); |
|
86 SetActive(); |
|
87 } |
|
88 } |
|
89 } |
|
90 // End of File |