commonappservices/alarmservertest/TestMultipleAlarmsSuite/src/TestAlarmClearStep.cpp
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Contains implementation of CTestAlarmClearStep class
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalTechnology 
       
    21 */
       
    22 
       
    23 // User Include
       
    24 #include "TestAlarmClearStep.h"
       
    25 #include "DummyAlarmControl.h"
       
    26 
       
    27 /**
       
    28 Constructor. Sets the test step name. Testserver reference passed to make use 
       
    29 of TEF's method of sharing data between test steps
       
    30 @internalTechnology
       
    31 @test
       
    32 */
       
    33 CTestAlarmClearStep::CTestAlarmClearStep(CTestMultipleAlarmsServer& aTestServer) 
       
    34 : CTestBaseStep(aTestServer)
       
    35 	{
       
    36 	//Call base class method to set human readable name for test step
       
    37 	SetTestStepName(KTestAlarmClearStep);
       
    38 	}
       
    39 
       
    40 /**
       
    41 Base class pure virtual.
       
    42 @return		EPass or EFail indicating the result of the test step.
       
    43 @internalTechnology
       
    44 @test
       
    45 */
       
    46 TVerdict CTestAlarmClearStep::doTestStepL()
       
    47 	{
       
    48 	TPtrC alarmMessage;
       
    49 	TPtrC clearAll;
       
    50 	if(ReadStringsFromConfig(ConfigSection(), &KIniClearAll(), &clearAll, NULL) 
       
    51 	&& clearAll.Compare(KYes) == KErrNone )
       
    52 		{// Clear all request is to be issued
       
    53 		TRAPD(error, ClearAllAlarmsL());
       
    54 		PrintIfError(error);
       
    55 		}
       
    56 	else if(!ReadStringsFromConfig(ConfigSection(), &KIniAlarmMessage(), &alarmMessage, NULL))
       
    57 		{// Not Clear all. And no alarm-message too
       
    58 		IniProblem();
       
    59 		}
       
    60 	else
       
    61 		{
       
    62 		TRAPD(error, ClearAlarmL(alarmMessage));
       
    63 		PrintIfError(error);
       
    64 		}
       
    65 	return TestStepResult();	
       
    66 	}
       
    67 
       
    68 /**
       
    69 Asks the Alert Server to clear all the alarms
       
    70 @internalTechnology
       
    71 @test
       
    72 */
       
    73 void CTestAlarmClearStep::ClearAllAlarmsL()
       
    74 	{
       
    75 	TestServer()->AlertServer()->ClearAllAlarmsL();
       
    76 	}
       
    77 
       
    78 /**
       
    79 Clears the alarm whose message is the one that is passed as parameter
       
    80 The clearing is actually done by the active object running from 
       
    81 alert server thread
       
    82 @param aAlarmMessage Message to identify the alarm control object
       
    83 @internalTechnology
       
    84 @test
       
    85 */
       
    86 void CTestAlarmClearStep::ClearAlarmL(const TDesC& aAlarmMessage)
       
    87 	{
       
    88 	TRequestStatus status(KRequestPending);
       
    89 	TestServer()->AlarmControlsManager()->ClearAlarmL(aAlarmMessage, &status);
       
    90 	User::WaitForRequest(status);
       
    91 	User::LeaveIfError(status.Int());
       
    92 	}
       
    93