1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/posixrealtimeextensions/inc/timerhandler.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,79 @@
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 handler header file
1.18 +//
1.19 +//
1.20 +
1.21 +
1.22 +#ifndef __TIMERHANDLER__H
1.23 +#define __TIMERHANDLER__H
1.24 +
1.25 +#include "timer.h"
1.26 +#include "timerserver.h"
1.27 +#include "timerclient.h"
1.28 +
1.29 +#define MAXTIMERLIMIT 512
1.30 +#define DELAYTIMER_MAX 32
1.31 +
1.32 +class CTimerReqHandler: public CBase
1.33 +{
1.34 +public:
1.35 + friend class CTimerServer;
1.36 + friend class CLibRtTimer;
1.37 + TInt CreateTimer(TInt& aTimerId, struct sigevent *aSig);
1.38 + TInt RemoveTimer(const TInt& aTimerId);
1.39 + TInt Time(const TInt& aTimerId, struct itimerspec *aTime);
1.40 + TInt SetTime(const TInt& aTimerId, TInt aFlag, const struct itimerspec *aIpTime,
1.41 + struct itimerspec *aOpTime);
1.42 + TInt OverrunCount(const TInt& aTimerId, TInt& aOverrunCount);
1.43 + TInt TimerRequestHandler();
1.44 +
1.45 + CTimerReqHandler();
1.46 + ~CTimerReqHandler();
1.47 + RTimerSession session;
1.48 + inline void SetServerHandle(RServer2 aServer)
1.49 + {
1.50 + iServer = aServer;
1.51 + }
1.52 + RServer2 iServer;
1.53 + inline void ResetClientFlag()
1.54 + {
1.55 + session.ResetConnectionFlag();
1.56 + }
1.57 + inline void ResetServerFlag()
1.58 + {
1.59 + iServConnectLock.Wait();
1.60 + iIsServStarted = EFalse;
1.61 + iServConnectLock.Signal();
1.62 + }
1.63 +private:
1.64 + TInt Connect();
1.65 + CRtTimer* FindTimer(const TInt& aTimerId);
1.66 + TInt StartTimerServer();
1.67 +
1.68 + const static TInt KTimersGran = 4;
1.69 + CArrayPtrSeg<CRtTimer> iTimers;
1.70 + RMutex iTimersLock;
1.71 +
1.72 + RThread iServ; //timer server thread
1.73 +
1.74 + TBool iIsServStarted;
1.75 + RMutex iServConnectLock;
1.76 + RSemaphore iTimerSemaphore;
1.77 +};
1.78 +
1.79 +CTimerReqHandler* getTimerHandler();
1.80 +
1.81 +#endif //__TIMERHANDLER__H
1.82 +