44
|
1 |
// TestTelephonyGetPhoneTime.cpp
|
|
2 |
// Copyright (c) Symbian Software Ltd 2008. All rights reserved.
|
|
3 |
//
|
|
4 |
// Implementation of the Class CTestTelephonyGetPhoneTime
|
|
5 |
|
|
6 |
//system include
|
|
7 |
#include <etelmm.h>
|
|
8 |
#include <e32std.h>
|
|
9 |
|
|
10 |
//user include
|
|
11 |
|
|
12 |
#include "TestLtsyGetPhoneBatteryInfo.h"
|
|
13 |
|
|
14 |
|
|
15 |
/** Supported battery information capabilities. The supported
|
|
16 |
* capabilities are returned to the client when it requests them by calling
|
|
17 |
* CMmPhoneTsy::GetBatteryCaps()
|
|
18 |
*/
|
|
19 |
/**
|
|
20 |
* Constructor
|
|
21 |
*
|
|
22 |
*/
|
|
23 |
CTestLtsyGetPhoneBatteryInfo::CTestLtsyGetPhoneBatteryInfo(CTestLtsyModel& aModel)
|
|
24 |
: CTestLtsyPhoneStepBase(aModel)
|
|
25 |
{
|
|
26 |
}
|
|
27 |
|
|
28 |
/**
|
|
29 |
* Destructor
|
|
30 |
*
|
|
31 |
*/
|
|
32 |
CTestLtsyGetPhoneBatteryInfo::~CTestLtsyGetPhoneBatteryInfo()
|
|
33 |
{
|
|
34 |
}
|
|
35 |
|
|
36 |
/**
|
|
37 |
* Invoked by the test execute framework for exercising functionality under test
|
|
38 |
* @return EPass: The test passed succesfully;
|
|
39 |
EFail: The test failed;
|
|
40 |
EInconclusive: The result of the test was inconclusive;
|
|
41 |
ETestSuiteError: Error in the test suite;
|
|
42 |
EAbort: The test was aborted;
|
|
43 |
EIgnore: The test was unexecuted
|
|
44 |
*/
|
|
45 |
TVerdict CTestLtsyGetPhoneBatteryInfo::doTestStepL()
|
|
46 |
{
|
|
47 |
INFO_PRINTF1(_L("CTestLtsyGetPhoneInfo::doTestStepL Begin"));
|
|
48 |
if (TestStepResult() == EPass)
|
|
49 |
{
|
|
50 |
GetBatteryCaps();
|
|
51 |
TRequestStatus reqStatus;
|
|
52 |
SharedPhone().GetBatteryInfo(reqStatus, iBatteryInfo);
|
|
53 |
User::WaitForRequest(reqStatus);
|
|
54 |
if (reqStatus==KErrNone)
|
|
55 |
{
|
|
56 |
INFO_PRINTF2(_L("Battery status : %d\n"), iBatteryInfo.iStatus);
|
|
57 |
INFO_PRINTF2(_L("Battery charge level : %d\n"), iBatteryInfo.iChargeLevel);
|
|
58 |
}
|
|
59 |
else
|
|
60 |
{
|
|
61 |
INFO_PRINTF2(_L("Battery charge, Error %d returned.\n"), reqStatus.Int());
|
|
62 |
}
|
|
63 |
}
|
|
64 |
return TestStepResult();
|
|
65 |
}
|
|
66 |
|
|
67 |
/**
|
|
68 |
*
|
|
69 |
* Get battery caps
|
|
70 |
*
|
|
71 |
*/
|
|
72 |
void CTestLtsyGetPhoneBatteryInfo::GetBatteryCaps()
|
|
73 |
{
|
|
74 |
TUint32 caps;
|
|
75 |
TInt res = SharedPhone().GetBatteryCaps(caps);
|
|
76 |
if (res != KErrNone)
|
|
77 |
{
|
|
78 |
ERR_PRINTF1(_L("Failed to Check return value."));
|
|
79 |
}
|
|
80 |
}
|
|
81 |
|
|
82 |
/**
|
|
83 |
*
|
|
84 |
* Notify battery info change or not
|
|
85 |
*
|
|
86 |
*/
|
|
87 |
void CTestLtsyGetPhoneBatteryInfo::NotifyBatteryInfoChangeL()
|
|
88 |
{
|
|
89 |
TRequestStatus status;
|
|
90 |
RMobilePhone::TMobilePhoneBatteryInfoV1 batInfo;
|
|
91 |
TUint twentyCharge = 20;
|
|
92 |
SharedPhone().NotifyBatteryInfoChange(status, batInfo);
|
|
93 |
|
|
94 |
User::WaitForRequest(status);
|
|
95 |
if(batInfo.iStatus != RMobilePhone::EBatteryConnectedButExternallyPowered)
|
|
96 |
{
|
|
97 |
INFO_PRINTF1(_L("Failed to Check Phone battery status."));
|
|
98 |
}
|
|
99 |
if(batInfo.iChargeLevel != twentyCharge)
|
|
100 |
{
|
|
101 |
INFO_PRINTF1(_L("Failed to Check Phone battery charge level."));
|
|
102 |
}
|
|
103 |
}
|