sl@0: // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // timer header file sl@0: // sl@0: // sl@0: sl@0: sl@0: #ifndef __TIMER__H sl@0: #define __TIMER__H sl@0: sl@0: #include <e32base.h> sl@0: #include <time.h> sl@0: #include <signal.h> sl@0: sl@0: #define MAXTIMERLIMIT 512 sl@0: #define DELAYTIMER_MAX 32 sl@0: sl@0: class CTimerReqHandler; sl@0: class CRtTimer; sl@0: class CTimerServer; sl@0: NONSHARABLE_CLASS(CLibRtTimer): public CTimer sl@0: { sl@0: public: sl@0: CLibRtTimer():CTimer(EPriorityHigh) sl@0: { sl@0: } sl@0: void ConstructL() sl@0: { sl@0: CTimer::ConstructL(); sl@0: } sl@0: void At(TTime aSetTime) sl@0: { sl@0: CTimer::At(aSetTime); sl@0: } sl@0: inline void Set(CRtTimer* CRtPtr) sl@0: { sl@0: ptr = CRtPtr; sl@0: } sl@0: inline CRtTimer* GetRtPtr() sl@0: { sl@0: return ptr; sl@0: } sl@0: void AddToAS(); sl@0: private: sl@0: void RunL(); sl@0: CRtTimer* ptr; sl@0: }; sl@0: sl@0: class CRtTimer:public CBase sl@0: { sl@0: public: sl@0: friend class CTimerReqHandler; sl@0: friend class CTimerServer; sl@0: friend class CLibRtTimer; sl@0: static CRtTimer* New(struct sigevent *aSig); sl@0: TInt SetTime(TInt aFlag, const struct itimerspec *aIpTime, sl@0: struct itimerspec *aOpTime); sl@0: TInt Time(struct itimerspec *aTime) const; sl@0: TInt OverrunCount(TInt& aOverrunCount) const; sl@0: virtual ~CRtTimer(); sl@0: protected: sl@0: sl@0: CRtTimer(struct sigevent *aSig); sl@0: private: sl@0: CLibRtTimer iTimer; sl@0: sl@0: TInt iTimerId; sl@0: TBool iIsArmed; sl@0: TBool iIsTimerReset; sl@0: sl@0: struct sigevent iSigEvent; sl@0: struct itimerspec iStartTime; sl@0: struct timespec iEndTime; sl@0: }; sl@0: #endif //__TIMER__H sl@0: