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 handler header file sl@0: // sl@0: // sl@0: sl@0: sl@0: #ifndef __TIMERHANDLER__H sl@0: #define __TIMERHANDLER__H sl@0: sl@0: #include "timer.h" sl@0: #include "timerserver.h" sl@0: #include "timerclient.h" sl@0: sl@0: #define MAXTIMERLIMIT 512 sl@0: #define DELAYTIMER_MAX 32 sl@0: sl@0: class CTimerReqHandler: public CBase sl@0: { sl@0: public: sl@0: friend class CTimerServer; sl@0: friend class CLibRtTimer; sl@0: TInt CreateTimer(TInt& aTimerId, struct sigevent *aSig); sl@0: TInt RemoveTimer(const TInt& aTimerId); sl@0: TInt Time(const TInt& aTimerId, struct itimerspec *aTime); sl@0: TInt SetTime(const TInt& aTimerId, TInt aFlag, const struct itimerspec *aIpTime, sl@0: struct itimerspec *aOpTime); sl@0: TInt OverrunCount(const TInt& aTimerId, TInt& aOverrunCount); sl@0: TInt TimerRequestHandler(); sl@0: sl@0: CTimerReqHandler(); sl@0: ~CTimerReqHandler(); sl@0: RTimerSession session; sl@0: inline void SetServerHandle(RServer2 aServer) sl@0: { sl@0: iServer = aServer; sl@0: } sl@0: RServer2 iServer; sl@0: inline void ResetClientFlag() sl@0: { sl@0: session.ResetConnectionFlag(); sl@0: } sl@0: inline void ResetServerFlag() sl@0: { sl@0: iServConnectLock.Wait(); sl@0: iIsServStarted = EFalse; sl@0: iServConnectLock.Signal(); sl@0: } sl@0: private: sl@0: TInt Connect(); sl@0: CRtTimer* FindTimer(const TInt& aTimerId); sl@0: TInt StartTimerServer(); sl@0: sl@0: const static TInt KTimersGran = 4; sl@0: CArrayPtrSeg iTimers; sl@0: RMutex iTimersLock; sl@0: sl@0: RThread iServ; //timer server thread sl@0: sl@0: TBool iIsServStarted; sl@0: RMutex iServConnectLock; sl@0: RSemaphore iTimerSemaphore; sl@0: }; sl@0: sl@0: CTimerReqHandler* getTimerHandler(); sl@0: sl@0: #endif //__TIMERHANDLER__H sl@0: