sl@0
|
1 |
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// timer handler header file
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
#ifndef __TIMERHANDLER__H
|
sl@0
|
20 |
#define __TIMERHANDLER__H
|
sl@0
|
21 |
|
sl@0
|
22 |
#include "timer.h"
|
sl@0
|
23 |
#include "timerserver.h"
|
sl@0
|
24 |
#include "timerclient.h"
|
sl@0
|
25 |
|
sl@0
|
26 |
#define MAXTIMERLIMIT 512
|
sl@0
|
27 |
#define DELAYTIMER_MAX 32
|
sl@0
|
28 |
|
sl@0
|
29 |
class CTimerReqHandler: public CBase
|
sl@0
|
30 |
{
|
sl@0
|
31 |
public:
|
sl@0
|
32 |
friend class CTimerServer;
|
sl@0
|
33 |
friend class CLibRtTimer;
|
sl@0
|
34 |
TInt CreateTimer(TInt& aTimerId, struct sigevent *aSig);
|
sl@0
|
35 |
TInt RemoveTimer(const TInt& aTimerId);
|
sl@0
|
36 |
TInt Time(const TInt& aTimerId, struct itimerspec *aTime);
|
sl@0
|
37 |
TInt SetTime(const TInt& aTimerId, TInt aFlag, const struct itimerspec *aIpTime,
|
sl@0
|
38 |
struct itimerspec *aOpTime);
|
sl@0
|
39 |
TInt OverrunCount(const TInt& aTimerId, TInt& aOverrunCount);
|
sl@0
|
40 |
TInt TimerRequestHandler();
|
sl@0
|
41 |
|
sl@0
|
42 |
CTimerReqHandler();
|
sl@0
|
43 |
~CTimerReqHandler();
|
sl@0
|
44 |
RTimerSession session;
|
sl@0
|
45 |
inline void SetServerHandle(RServer2 aServer)
|
sl@0
|
46 |
{
|
sl@0
|
47 |
iServer = aServer;
|
sl@0
|
48 |
}
|
sl@0
|
49 |
RServer2 iServer;
|
sl@0
|
50 |
inline void ResetClientFlag()
|
sl@0
|
51 |
{
|
sl@0
|
52 |
session.ResetConnectionFlag();
|
sl@0
|
53 |
}
|
sl@0
|
54 |
inline void ResetServerFlag()
|
sl@0
|
55 |
{
|
sl@0
|
56 |
iServConnectLock.Wait();
|
sl@0
|
57 |
iIsServStarted = EFalse;
|
sl@0
|
58 |
iServConnectLock.Signal();
|
sl@0
|
59 |
}
|
sl@0
|
60 |
private:
|
sl@0
|
61 |
TInt Connect();
|
sl@0
|
62 |
CRtTimer* FindTimer(const TInt& aTimerId);
|
sl@0
|
63 |
TInt StartTimerServer();
|
sl@0
|
64 |
|
sl@0
|
65 |
const static TInt KTimersGran = 4;
|
sl@0
|
66 |
CArrayPtrSeg<CRtTimer> iTimers;
|
sl@0
|
67 |
RMutex iTimersLock;
|
sl@0
|
68 |
|
sl@0
|
69 |
RThread iServ; //timer server thread
|
sl@0
|
70 |
|
sl@0
|
71 |
TBool iIsServStarted;
|
sl@0
|
72 |
RMutex iServConnectLock;
|
sl@0
|
73 |
RSemaphore iTimerSemaphore;
|
sl@0
|
74 |
};
|
sl@0
|
75 |
|
sl@0
|
76 |
CTimerReqHandler* getTimerHandler();
|
sl@0
|
77 |
|
sl@0
|
78 |
#endif //__TIMERHANDLER__H
|
sl@0
|
79 |
|