author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 24 Nov 2009 08:56:33 +0200 | |
changeset 33 | 50974a8b132e |
parent 19 | 989d2f495d90 |
permissions | -rw-r--r-- |
19 | 1 |
/* |
2 |
* Copyright (c) 2002 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 the License "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: ?Description |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
20 |
#include "tsysbattery.h" |
19 | 21 |
#include "sysinfoservice.h" |
22 |
#include "entitykeys.h" |
|
23 |
#include "tsysbatterystrengthasync.h" |
|
24 |
||
25 |
using namespace SysInfo; |
|
26 |
_LIT(KBatteryLevel,"BatteryLevel"); |
|
27 |
||
28 |
CBatteryStrengthAsync* CBatteryStrengthAsync::NewL(CStifLogger* aLog) |
|
29 |
{ |
|
30 |
CBatteryStrengthAsync* self = new(ELeave) CBatteryStrengthAsync(aLog); |
|
31 |
self->ConstructL(); |
|
32 |
return self; |
|
33 |
} |
|
34 |
||
35 |
CBatteryStrengthAsync::~CBatteryStrengthAsync() |
|
36 |
{ |
|
37 |
Cancel(); |
|
38 |
||
39 |
if(iWaitScheduler->IsStarted()) |
|
40 |
iWaitScheduler->AsyncStop(); |
|
41 |
||
42 |
delete iSysInfoService; |
|
43 |
delete iWaitScheduler; |
|
44 |
// delete iTimer; |
|
45 |
} |
|
46 |
||
47 |
void CBatteryStrengthAsync::ConstructL() |
|
48 |
{ |
|
49 |
iSysInfoService = CSysInfoService::NewL(); |
|
50 |
iWaitScheduler = new(ELeave) CActiveSchedulerWait(); |
|
51 |
// iTimer = CWatchTimer::NewL(EPriorityNormal,this); |
|
52 |
CActiveScheduler::Add(this); |
|
53 |
} |
|
54 |
||
55 |
CBatteryStrengthAsync::CBatteryStrengthAsync(CStifLogger* aLog) |
|
56 |
:CActive(EPriorityStandard), |
|
57 |
iLog(aLog) |
|
58 |
{ |
|
59 |
} |
|
60 |
||
61 |
void CBatteryStrengthAsync::DoCancel() |
|
62 |
{ |
|
63 |
} |
|
64 |
||
65 |
void CBatteryStrengthAsync::RunL() |
|
66 |
{ |
|
67 |
TRAP(iResult,TestFuncL()); |
|
68 |
iWaitScheduler->AsyncStop(); |
|
69 |
} |
|
70 |
||
71 |
void CBatteryStrengthAsync::Start() |
|
72 |
{ |
|
73 |
SetActive(); |
|
74 |
TRequestStatus* temp = &iStatus; |
|
75 |
User::RequestComplete(temp, KErrNone); |
|
76 |
iWaitScheduler->Start(); |
|
77 |
} |
|
78 |
||
79 |
TInt CBatteryStrengthAsync::Result() |
|
80 |
{ |
|
81 |
return iResult; |
|
82 |
} |
|
83 |
||
84 |
void CBatteryStrengthAsync::TestFuncL() |
|
85 |
{ |
|
86 |
// const TTimeIntervalMicroSeconds32 OneMinute(60000000); |
|
87 |
iSysInfoService->GetInfoL(KBattery,KBatteryLevel,1,this); |
|
88 |
// iTimer->After(OneMinute); |
|
89 |
} |
|
90 |
||
91 |
void CBatteryStrengthAsync::HandleResponseL(const TDesC& /*aEntity*/,const TDesC& /*aKey*/, |
|
92 |
CSysData* /*aOutput*/, TInt32 /*aTransID*/,TSysRequest::TRequestType /*aType*/, TInt /*aError*/) |
|
93 |
{ |
|
94 |
||
95 |
} |
|
96 |