commonappservices/alarmservertest/TestMultipleAlarmsSuite/src/TestAlarmSnoozeStep.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 CTestAlarmSnoozeStep class
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalTechnology 
       
    21 */
       
    22 
       
    23 // User Include
       
    24 #include "TestAlarmSnoozeStep.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 CTestAlarmSnoozeStep::CTestAlarmSnoozeStep(CTestMultipleAlarmsServer& aTestServer) 
       
    34 : CTestBaseStep(aTestServer)
       
    35 	{
       
    36 	//Call base class method to set human readable name for test step
       
    37 	SetTestStepName(KTestAlarmSnoozeStep);
       
    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 CTestAlarmSnoozeStep::doTestStepL()
       
    47 	{
       
    48 	TPtrC alarmMessage;
       
    49 	if(!ReadStringsFromConfig(ConfigSection(), &KIniAlarmMessage(), &alarmMessage, NULL))
       
    50 		{
       
    51 		IniProblem();
       
    52 		}
       
    53 	else
       
    54 		{
       
    55 		TRAPD(error, SnoozeAlarmL(alarmMessage));
       
    56 		PrintIfError(error);
       
    57 		}
       
    58 	return TestStepResult();	
       
    59 	}
       
    60 
       
    61 /**
       
    62 Snoozes the alarm whose message is the one that is passed as parameter
       
    63 The snoozing is actually done by the active object running from 
       
    64 alert server thread, as we can not snooze from another thread, as RTimer
       
    65 (used by CPeriodic) which is used in the alert server thread will raise a 
       
    66 bad handle panic.
       
    67 @param aAlarmMessage Message to identify the alarm control object
       
    68 @internalTechnology
       
    69 @test
       
    70 */
       
    71 void CTestAlarmSnoozeStep::SnoozeAlarmL(const TDesC& aAlarmMessage)
       
    72 	{
       
    73 	TInt minsToSnooze;
       
    74 	if(!ReadIntsFromConfig(ConfigSection(), &KIniMinsToSnooze(), &minsToSnooze, NULL))
       
    75 		{// assign default
       
    76 		minsToSnooze = KDefaultMinsToSnooze;
       
    77 		}
       
    78 	TRequestStatus status(KRequestPending);
       
    79 	TestServer()->AlarmControlsManager()->SnoozeAlarmL(aAlarmMessage, &status, minsToSnooze);
       
    80 	User::WaitForRequest(status);
       
    81 	User::LeaveIfError(status.Int());
       
    82 	}