First public contribution.
1 // Copyright (c) 2008-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // timer handler header file
19 #ifndef __TIMERHANDLER__H
20 #define __TIMERHANDLER__H
23 #include "timerserver.h"
24 #include "timerclient.h"
26 #define MAXTIMERLIMIT 512
27 #define DELAYTIMER_MAX 32
29 class CTimerReqHandler: public CBase
32 friend class CTimerServer;
33 friend class CLibRtTimer;
34 TInt CreateTimer(TInt& aTimerId, struct sigevent *aSig);
35 TInt RemoveTimer(const TInt& aTimerId);
36 TInt Time(const TInt& aTimerId, struct itimerspec *aTime);
37 TInt SetTime(const TInt& aTimerId, TInt aFlag, const struct itimerspec *aIpTime,
38 struct itimerspec *aOpTime);
39 TInt OverrunCount(const TInt& aTimerId, TInt& aOverrunCount);
40 TInt TimerRequestHandler();
44 RTimerSession session;
45 inline void SetServerHandle(RServer2 aServer)
50 inline void ResetClientFlag()
52 session.ResetConnectionFlag();
54 inline void ResetServerFlag()
56 iServConnectLock.Wait();
57 iIsServStarted = EFalse;
58 iServConnectLock.Signal();
62 CRtTimer* FindTimer(const TInt& aTimerId);
63 TInt StartTimerServer();
65 const static TInt KTimersGran = 4;
66 CArrayPtrSeg<CRtTimer> iTimers;
69 RThread iServ; //timer server thread
72 RMutex iServConnectLock;
73 RSemaphore iTimerSemaphore;
76 CTimerReqHandler* getTimerHandler();
78 #endif //__TIMERHANDLER__H