1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/posixrealtimeextensions/inc/timerserver.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,89 @@
1.4 +/*
1.5 +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +#ifndef __TIMERSERVER_H__
1.22 +#define __TIMERSERVER_H__
1.23 +
1.24 +#include <e32base.h>
1.25 +#include "timerutils.h"
1.26 +
1.27 +enum TMyPanic
1.28 + {
1.29 + EPanicBadDescriptor,
1.30 + EPanicIllegalFunction,
1.31 + EPanicAlreadyReceiving
1.32 + };
1.33 +
1.34 +void PanicClient(const RMessagePtr2& aMessage,TMyPanic TMyPanic);
1.35 +
1.36 +NONSHARABLE_CLASS(CShutdown) : public CTimer
1.37 + {
1.38 +public:
1.39 + CShutdown() : CTimer(EPriorityStandard)
1.40 + {
1.41 + // nada
1.42 + }
1.43 + void Start();
1.44 + void ConstructL();
1.45 +private:
1.46 + static const TUint KTimerServerShutdownDelay=3000000;
1.47 + void RunL();
1.48 + };
1.49 +
1.50 +NONSHARABLE_CLASS(CTimerServer) : public CServer2
1.51 + {
1.52 +public:
1.53 + // We want the transfers to be done on a priority. Hence the EPriorityHigh
1.54 + CTimerServer() : CServer2(EPriorityHigh,ESharableSessions)
1.55 + {
1.56 + // nada
1.57 + }
1.58 +
1.59 + ~CTimerServer();
1.60 + static CTimerServer* NewLC();
1.61 +
1.62 + TInt AddToScheduler();
1.63 + void RemoveFromScheduler();
1.64 + TInt RemoveInternal(const TInt);
1.65 + TInt SetTimer(const TInt);
1.66 + void StartServer();
1.67 + static TInt NewTimerServerL();
1.68 + void AddSession();
1.69 + void DropSession();
1.70 +
1.71 + CActiveScheduler* iOldScheduler;
1.72 +
1.73 +private:
1.74 + void ConstructL();
1.75 + CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;
1.76 +private:
1.77 + TInt iSessionCount;
1.78 + CShutdown* iShutdown;
1.79 + };
1.80 +
1.81 +NONSHARABLE_CLASS(CTimerServerSession) : public CSession2
1.82 + {
1.83 +public:
1.84 + void CreateL();
1.85 +private:
1.86 + ~CTimerServerSession();
1.87 + CTimerServer& Server();
1.88 + void ServiceL(const RMessage2& aMessage);
1.89 + void ServiceError(const RMessage2& aMessage, TInt aError);
1.90 + };
1.91 +
1.92 +#endif //__TIMERSERVER_H__