|
1 /* |
|
2 * Copyright (c) 2002-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: AVKON notifier client for setting the state of |
|
15 * status pane's battery pane. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include "AknBatteryNotify.h" |
|
21 #include <AknNotifyStd.h> |
|
22 #include <AknNotifySignature.h> |
|
23 |
|
24 //---------------------------------------------------------------------------- |
|
25 // CAknBatteryNotify::NewL |
|
26 // Two-phased constructor. |
|
27 //---------------------------------------------------------------------------- |
|
28 // |
|
29 EXPORT_C CAknBatteryNotify* CAknBatteryNotify::NewL() |
|
30 { |
|
31 CAknBatteryNotify* self = NewLC(); |
|
32 CleanupStack::Pop( self ); |
|
33 return self; |
|
34 } |
|
35 |
|
36 |
|
37 //---------------------------------------------------------------------------- |
|
38 // CAknBatteryNotify::NewLC |
|
39 // Two-phased constructor. |
|
40 //---------------------------------------------------------------------------- |
|
41 // |
|
42 EXPORT_C CAknBatteryNotify* CAknBatteryNotify::NewLC() |
|
43 { |
|
44 CAknBatteryNotify* self = new (ELeave) CAknBatteryNotify; |
|
45 CleanupStack::PushL( self ); |
|
46 self->ConstructL(); |
|
47 return self; |
|
48 } |
|
49 |
|
50 |
|
51 //---------------------------------------------------------------------------- |
|
52 // CAknBatteryNotify::~CAknBatteryNotify |
|
53 // Destructor. |
|
54 //---------------------------------------------------------------------------- |
|
55 // |
|
56 EXPORT_C CAknBatteryNotify::~CAknBatteryNotify() |
|
57 { |
|
58 } |
|
59 |
|
60 |
|
61 //---------------------------------------------------------------------------- |
|
62 // CAknBatteryNotify::CAknBatteryNotify |
|
63 // Default C++ constructor. |
|
64 //---------------------------------------------------------------------------- |
|
65 // |
|
66 CAknBatteryNotify::CAknBatteryNotify() : |
|
67 CAknNotifyBase( KAknBatteryNotifierUid ) |
|
68 { |
|
69 } |
|
70 |
|
71 |
|
72 //---------------------------------------------------------------------------- |
|
73 // CAknBatteryNotify::ConstructL |
|
74 // Second phase constructor. |
|
75 //---------------------------------------------------------------------------- |
|
76 // |
|
77 void CAknBatteryNotify::ConstructL() |
|
78 { |
|
79 CAknNotifyBase::ConstructL(); |
|
80 } |
|
81 |
|
82 |
|
83 //---------------------------------------------------------------------------- |
|
84 // CAknBatteryNotify::SetBatteryLevelL |
|
85 // Sets the battery level. |
|
86 //---------------------------------------------------------------------------- |
|
87 // |
|
88 EXPORT_C void CAknBatteryNotify::SetBatteryLevelL( TInt aLevel ) |
|
89 { |
|
90 TPckgBuf< SAknNotifierPackage<SAknBatteryNotifyParams> > pckg; |
|
91 pckg().iParamData.iType = SAknBatteryNotifyParams::ESetValue; |
|
92 pckg().iParamData.iValue = aLevel; |
|
93 TBuf8<1> resp; |
|
94 StartOrUpdateL( pckg, resp ); |
|
95 } |
|
96 |
|
97 |
|
98 //---------------------------------------------------------------------------- |
|
99 // CAknBatteryNotify::StartChargingL |
|
100 // Starts the recharging animation. |
|
101 //---------------------------------------------------------------------------- |
|
102 // |
|
103 EXPORT_C void CAknBatteryNotify::StartChargingL() |
|
104 { |
|
105 TPckgBuf< SAknNotifierPackage<SAknBatteryNotifyParams> > pckg; |
|
106 pckg().iParamData.iType = SAknBatteryNotifyParams::ERecharge; |
|
107 TBuf8<1> resp; |
|
108 StartOrUpdateL( pckg, resp ); |
|
109 } |
|
110 |
|
111 |
|
112 //---------------------------------------------------------------------------- |
|
113 // CAknBatteryNotify::StopChargingL |
|
114 // Stops the recharging animation. |
|
115 //---------------------------------------------------------------------------- |
|
116 // |
|
117 EXPORT_C void CAknBatteryNotify::StopChargingL() |
|
118 { |
|
119 TPckgBuf< SAknNotifierPackage<SAknBatteryNotifyParams> > pckg; |
|
120 pckg().iParamData.iType = SAknBatteryNotifyParams::EStopRecharge; |
|
121 TBuf8<1> resp; |
|
122 StartOrUpdateL( pckg, resp ); |
|
123 } |
|
124 |
|
125 |
|
126 //---------------------------------------------------------------------------- |
|
127 // CAknBatteryNotify::NotChargingL |
|
128 // Deprecated, current implementation stops the recharging animation. |
|
129 //---------------------------------------------------------------------------- |
|
130 // |
|
131 EXPORT_C void CAknBatteryNotify::NotChargingL() |
|
132 { |
|
133 TPckgBuf< SAknNotifierPackage<SAknBatteryNotifyParams> > pckg; |
|
134 pckg().iParamData.iType = SAknBatteryNotifyParams::ENoRecharge; |
|
135 TBuf8<1> resp; |
|
136 StartOrUpdateL( pckg, resp ); |
|
137 } |
|
138 |
|
139 |
|
140 //---------------------------------------------------------------------------- |
|
141 // CAknBatteryNotify::SetBatteryStateL |
|
142 // Sets the battery icon state. |
|
143 //---------------------------------------------------------------------------- |
|
144 // |
|
145 EXPORT_C void CAknBatteryNotify::SetBatteryStateL( TInt aState ) |
|
146 { |
|
147 TPckgBuf< SAknNotifierPackage<SAknBatteryNotifyParams> > pckg; |
|
148 pckg().iParamData.iType = SAknBatteryNotifyParams::ESetState; |
|
149 pckg().iParamData.iBatteryState = aState; |
|
150 TBuf8<1> resp; |
|
151 StartOrUpdateL( pckg, resp ); |
|
152 } |
|
153 |
|
154 // End of File |