1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/posixrealtimeextensions/inc/timer.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,87 @@
1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// timer header file
1.18 +//
1.19 +//
1.20 +
1.21 +
1.22 +#ifndef __TIMER__H
1.23 +#define __TIMER__H
1.24 +
1.25 +#include <e32base.h>
1.26 +#include <time.h>
1.27 +#include <signal.h>
1.28 +
1.29 +#define MAXTIMERLIMIT 512
1.30 +#define DELAYTIMER_MAX 32
1.31 +
1.32 +class CTimerReqHandler;
1.33 +class CRtTimer;
1.34 +class CTimerServer;
1.35 +NONSHARABLE_CLASS(CLibRtTimer): public CTimer
1.36 + {
1.37 + public:
1.38 + CLibRtTimer():CTimer(EPriorityHigh)
1.39 + {
1.40 + }
1.41 + void ConstructL()
1.42 + {
1.43 + CTimer::ConstructL();
1.44 + }
1.45 + void At(TTime aSetTime)
1.46 + {
1.47 + CTimer::At(aSetTime);
1.48 + }
1.49 + inline void Set(CRtTimer* CRtPtr)
1.50 + {
1.51 + ptr = CRtPtr;
1.52 + }
1.53 + inline CRtTimer* GetRtPtr()
1.54 + {
1.55 + return ptr;
1.56 + }
1.57 + void AddToAS();
1.58 + private:
1.59 + void RunL();
1.60 + CRtTimer* ptr;
1.61 + };
1.62 +
1.63 +class CRtTimer:public CBase
1.64 +{
1.65 +public:
1.66 + friend class CTimerReqHandler;
1.67 + friend class CTimerServer;
1.68 + friend class CLibRtTimer;
1.69 + static CRtTimer* New(struct sigevent *aSig);
1.70 + TInt SetTime(TInt aFlag, const struct itimerspec *aIpTime,
1.71 + struct itimerspec *aOpTime);
1.72 + TInt Time(struct itimerspec *aTime) const;
1.73 + TInt OverrunCount(TInt& aOverrunCount) const;
1.74 + virtual ~CRtTimer();
1.75 +protected:
1.76 +
1.77 + CRtTimer(struct sigevent *aSig);
1.78 +private:
1.79 + CLibRtTimer iTimer;
1.80 +
1.81 + TInt iTimerId;
1.82 + TBool iIsArmed;
1.83 + TBool iIsTimerReset;
1.84 +
1.85 + struct sigevent iSigEvent;
1.86 + struct itimerspec iStartTime;
1.87 + struct timespec iEndTime;
1.88 +};
1.89 +#endif //__TIMER__H
1.90 +