commonappservices/alarmserver/Test/unit/inc/TEAlarmTestAlarmPlayConfig.h
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 //
       
    15 
       
    16 #ifndef __TEALARMTESTALARMPLAYCONFIG_H__
       
    17 #define __TEALARMTESTALARMPLAYCONFIG_H__
       
    18 
       
    19 #include "TEAlarmTestStepBase.h"
       
    20 #include "consoleantestclient.h"
       
    21 
       
    22 class MAlarmEventHandler
       
    23 	{
       
    24 	public:
       
    25 	enum TAlertEvent
       
    26 		{
       
    27 		EAlarmExpired,
       
    28 		ESoundStarted,
       
    29 		ESoundStopped
       
    30 		};
       
    31 
       
    32 	virtual void HandleAlertEvent(TAlertEvent aEventType, TAlarmId aAlarmId) = 0;
       
    33 	virtual void InactivityTimerExpired() = 0;
       
    34 	};
       
    35 
       
    36 class CTEAlarmTestAlarmPlayConfigStep : public CTEAlarmTestStepBase, MAlarmEventHandler
       
    37 	{
       
    38 public:
       
    39 	CTEAlarmTestAlarmPlayConfigStep();
       
    40 	~CTEAlarmTestAlarmPlayConfigStep();
       
    41 	virtual TVerdict doTestStepL();
       
    42 	
       
    43 protected:
       
    44 	TBool GetAndCheckAlarmPlayIntervalsL();
       
    45 	TBool StartIntervalVerifierL(TAlarmId aAlarmId);
       
    46 	void HandleAlertEvent(TAlertEvent aEventType, TAlarmId aAlarmId);
       
    47 	void InactivityTimerExpired();
       
    48 	void StopIntervalVerifier();
       
    49 	TTimeIntervalSeconds TimeDiff(TAlarmId aAlarmId, MAlarmEventHandler::TAlertEvent aEventType);
       
    50 	TInt GetExpectedEventTime(TTime& aExpectedTime, MAlarmEventHandler::TAlertEvent aEventType);
       
    51 private:
       
    52 	CArrayFixFlat<TASCliSoundPlayDefinition>* iSoundIntervals;
       
    53 	TAlarmSoundRepeatSetting iRepeatSetting;
       
    54 	
       
    55 	TAlarmId iExpectedAlarmId;
       
    56 	MAlarmEventHandler::TAlertEvent iExpectedEventType;
       
    57 	TTime iExpectedEventTime;
       
    58 	TInt iExpectedInterval;
       
    59 	TTimeIntervalSeconds iTimerContingency;
       
    60 	};
       
    61 
       
    62 class CActiveAlertListener : public CActive
       
    63 	{
       
    64 public:
       
    65 	CActiveAlertListener(MAlarmEventHandler& aHandler, RANTestClient& aClient);
       
    66 	~CActiveAlertListener();
       
    67 	TBool Start(MAlarmEventHandler::TAlertEvent aEventTypeToWaitFor);
       
    68 	virtual void DoCancel();
       
    69 	virtual void RunL();
       
    70 private:
       
    71 	void RegisterForNextEvent();
       
    72 protected:
       
    73 	MAlarmEventHandler::TAlertEvent iEventType;
       
    74 	TASShdAlarm iExpiredAlarm;
       
    75 	TAlarmId iAlarmId;
       
    76 	MAlarmEventHandler& iHandler;
       
    77 	RANTestClient& iClient;
       
    78 	TBuf<32> iFileName;
       
    79 	};
       
    80 
       
    81 class CInactivityTimer : public CTimer
       
    82 	{
       
    83 public:
       
    84 	static CInactivityTimer* NewLC(MAlarmEventHandler& aHandler);
       
    85 	virtual void RunL();
       
    86 private:
       
    87 	CInactivityTimer(MAlarmEventHandler& aHandler);
       
    88 private:
       
    89 	MAlarmEventHandler& iHandler;
       
    90 	};
       
    91 
       
    92 class CTEAlarmTestAPCSetIntervalsStep : public CTEAlarmTestStepBase
       
    93 	{
       
    94 public:
       
    95 	CTEAlarmTestAPCSetIntervalsStep();
       
    96 	~CTEAlarmTestAPCSetIntervalsStep();
       
    97 	virtual TVerdict doTestStepL();
       
    98 	
       
    99 protected:
       
   100 private:
       
   101 	};
       
   102 
       
   103 		
       
   104 _LIT(KTEAlarmTestAlarmPlayConfigStep, "AlarmPlayConfig");
       
   105 _LIT(KTEAlarmTestAPCSetIntervalsStep, "APCSetIntervals");
       
   106 
       
   107 #endif // __TEALARMTESTALARMPLAYCONFIG_H__