commonappservices/alarmserver/Test/unit/inc/TEAlarmTestMANEventEntry.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 __TEALARMTESTMANEVENTENTRY_H__
       
    17 #define __TEALARMTESTMANEVENTENTRY_H__
       
    18 
       
    19 #include <asshddefs.h>
       
    20 
       
    21 
       
    22 const TInt KAllAlarms = -1;
       
    23 const TInt KBogusAlarmIdx = 99;
       
    24 
       
    25 enum TEventType
       
    26 	{
       
    27 	EEventSetAlarm,
       
    28 	EEventSetState,
       
    29 	EEventVisible,
       
    30 	EEventSoundStart,
       
    31 	EEventSoundStop,
       
    32 	EEventDelete,
       
    33 	EActionCheckState,
       
    34 	EActionCheckStateOnly,
       
    35 	EActionSnooze,
       
    36 	EActionClear,
       
    37 	EActionPauseSound,
       
    38 	EActionSilence,
       
    39 	EActionUserWait,
       
    40 	EActionReconnectToAS,		
       
    41 	EActionAddAlarm,
       
    42 	EActionDeleteAlarm,
       
    43 	EException,
       
    44 	EUnknown
       
    45 	};
       
    46 
       
    47 _LIT(KEventSetAlarm,	"SetAlarm");
       
    48 _LIT(KEventSetState,	"SetState");
       
    49 _LIT(KEventVisible,		"Visible");
       
    50 _LIT(KEventSoundStart,	"SoundStart");
       
    51 _LIT(KEventSoundStop,	"SoundStop");
       
    52 _LIT(KEventDelete,		"Delete");
       
    53 _LIT(KActionCheckState,	"CheckState");
       
    54 _LIT(KActionCheckStateOnly,	"CheckStateOnly");
       
    55 _LIT(KActionSnooze,		"Snooze");
       
    56 _LIT(KActionClear,		"Clear");
       
    57 _LIT(KActionPauseSound,	"PauseSound");
       
    58 _LIT(KActionSilence,	"Silence");
       
    59 _LIT(KActionUserWait,	"UserWait");
       
    60 _LIT(KActionReconnectToAS,	"ReconnectToAS");
       
    61 _LIT(KActionAddAlarm,	"AddAlarm");
       
    62 _LIT(KActionDeleteAlarm,"DeleteAlarm");
       
    63 _LIT(KException,		"Exception");
       
    64 _LIT(KUnknown,			"Unknown");
       
    65 
       
    66 _LIT(KTrue,	"True");
       
    67 _LIT(KFalse,"False");
       
    68 
       
    69 
       
    70 
       
    71 // //
       
    72 //
       
    73 // TEventEntry
       
    74 //
       
    75 // //
       
    76 class TEventEntry		// Event or Action
       
    77 	{
       
    78 public:
       
    79 	TEventEntry(TEventType aEventType = EUnknown, TInt aError = KErrUnknown);
       
    80 	TBool operator==(const TEventEntry& aEntry);
       
    81 	inline TBool operator!=(TEventEntry& aEntry) { return !(*this == aEntry); }
       
    82 
       
    83 	inline TBool IsEvent();
       
    84 	inline TBool IsAction();
       
    85 
       
    86 	void ToStr(TDes& aStr);	
       
    87 	const TDesC& TypeToStr();
       
    88 
       
    89 public:
       
    90 	TEventType 	iType;
       
    91 	TInt 		iSequenceNumber;
       
    92 	TInt 		iAlarmIdx;	// KAllAlarms 	  = event/action for all alarms
       
    93 							// KBogusAlarmIdx = non-existent alarm
       
    94 	TAlarmId	iAlarmId;	
       
    95 	TInt		iAltSFlags;	// applies to EEventSetState
       
    96 	TAlarmState	iAlarmState;// applies to EActionCheckState
       
    97 	TBool		iPlaying;	// applies to EActionCheckState only
       
    98 	TBool		iVisible;	// applies to EActionCheckState only
       
    99 	TInt		iPeriod;	// in seconds, applies to EActionSnooze, 
       
   100 							//   EActionPauseSound and EActionUserWait
       
   101 	TInt		iError;		// holds error code if EException type
       
   102 	};
       
   103 
       
   104 
       
   105 
       
   106 inline TBool TEventEntry::IsEvent() 
       
   107 	{ 
       
   108 	return !IsAction(); 
       
   109 	}
       
   110 	
       
   111 inline TBool TEventEntry::IsAction()
       
   112 	{ 
       
   113 	return ( iType >= EActionCheckState && iType <= EActionDeleteAlarm ); 
       
   114 	}
       
   115 
       
   116 static inline const TDesC& BoolToStr(TBool aBool)
       
   117 	{
       
   118 	return aBool? (const TDesC&)KTrue: (const TDesC&)KFalse;
       
   119  	}
       
   120 
       
   121 
       
   122 #endif // __TEALARMTESTMANEVENTENTRY_H__
       
   123