cbsref/telephonyrefplugins/atltsy/integrationtest/src/testltsygetphonesignalstrength.cpp
changeset 49 f50f4094acd7
equal deleted inserted replaced
48:14460bf2a402 49:f50f4094acd7
       
     1 // TestTelephonyGetPhonesingalStrength.cpp
       
     2 // Copyright (c) Symbian Software Ltd 2008. All rights reserved.
       
     3 //
       
     4 // Implementation of the Class CTestTelephonyGetPhonesingalStrength
       
     5 
       
     6 //system include
       
     7 #include <etelmm.h>
       
     8 
       
     9 //user include
       
    10 
       
    11 #include "TestLtsyGetPhoneSignalStrength.h"
       
    12 
       
    13 /**
       
    14  * Constructor
       
    15  * 
       
    16  */
       
    17 CTestLtsyGetPhoneSignalStrength::CTestLtsyGetPhoneSignalStrength(CTestLtsyModel& aModel)
       
    18     :CTestLtsyPhoneStepBase(aModel)
       
    19 	{
       
    20 	}
       
    21 
       
    22 /**
       
    23  * Destructor
       
    24  * 
       
    25  */
       
    26 CTestLtsyGetPhoneSignalStrength::~CTestLtsyGetPhoneSignalStrength()
       
    27 	{
       
    28 	}
       
    29 
       
    30 /**
       
    31  * Invoked by the test execute framework for exercising functionality under test
       
    32  * @return	EPass: The test passed succesfully;
       
    33 		    EFail: The test failed;
       
    34 		    EInconclusive: The result of the test was inconclusive;
       
    35 		    ETestSuiteError: Error in the test suite;
       
    36 		    EAbort: The test was aborted;
       
    37 		    EIgnore: The test was unexecuted
       
    38  */	
       
    39 
       
    40 TVerdict CTestLtsyGetPhoneSignalStrength::doTestStepL()
       
    41 	{
       
    42 	INFO_PRINTF1(_L("CTestTelePhonyGetPhoneInfo::doTestStepL Begin"));
       
    43 	if (TestStepResult() == EPass)
       
    44 		{
       
    45 		
       
    46 		GetSignalCaps();
       
    47 		TRequestStatus reqStatus;
       
    48 		SharedPhone().GetSignalStrength(reqStatus, iSignalStrength, iBar);
       
    49 		User::WaitForRequest(reqStatus);
       
    50 		if (reqStatus==KErrNone)
       
    51 			{
       
    52 			INFO_PRINTF2(_L("Signal strength (in dBm) : %d\n"), iSignalStrength);
       
    53 			INFO_PRINTF2(_L("Signal strength (in display bars) : %d\n"), iBar);
       
    54 			}
       
    55 		else
       
    56 			{
       
    57 			INFO_PRINTF2(_L("Signal strength, Error %d returned.\n"), reqStatus.Int());
       
    58 			}
       
    59 	
       
    60 		}
       
    61 	return TestStepResult();
       
    62 	}
       
    63 
       
    64 /**
       
    65  * Get signal caps
       
    66  * 
       
    67  */
       
    68 void CTestLtsyGetPhoneSignalStrength::GetSignalCaps()
       
    69 	{
       
    70 	TUint32 caps;
       
    71 	TInt res = SharedPhone().GetSignalCaps(caps);
       
    72 	if (res != KErrNone)
       
    73 		{
       
    74 		ERR_PRINTF2(_L("The result is not expect %d"),&res);
       
    75 		SetTestStepResult(EFail);
       
    76 		}
       
    77 	}
       
    78 
       
    79 /**
       
    80  * Notify signal strength change
       
    81  * 
       
    82  */
       
    83 void CTestLtsyGetPhoneSignalStrength::NotifySignalStrengthChangeL()
       
    84 	{
       
    85 	TRequestStatus reqStatus;
       
    86 	TInt32 signalStrength(0);
       
    87 	TInt8 bar(0);
       
    88 	TInt32 completeSignalStrength(70);
       
    89 	TInt8 completeBar(3);
       
    90 	SharedPhone().NotifySignalStrengthChange(reqStatus, signalStrength, bar);
       
    91 	User::WaitForRequest(reqStatus);
       
    92 	if(bar != completeBar)
       
    93 		{
       
    94 		ERR_PRINTF1(_L("bar is not expect."));
       
    95 		SetTestStepResult(EFail);
       
    96 		}
       
    97 	if(signalStrength != completeSignalStrength)
       
    98 		{
       
    99 		ERR_PRINTF1(_L("signalStrength is not expect."));
       
   100 		SetTestStepResult(EFail);
       
   101 		}
       
   102 	}
       
   103