sl@0: /* sl@0: * Copyright (c) 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: * sl@0: */ sl@0: sl@0: #ifndef __TIMERSERVER_H__ sl@0: #define __TIMERSERVER_H__ sl@0: sl@0: #include sl@0: #include "timerutils.h" sl@0: sl@0: enum TMyPanic sl@0: { sl@0: EPanicBadDescriptor, sl@0: EPanicIllegalFunction, sl@0: EPanicAlreadyReceiving sl@0: }; sl@0: sl@0: void PanicClient(const RMessagePtr2& aMessage,TMyPanic TMyPanic); sl@0: sl@0: NONSHARABLE_CLASS(CShutdown) : public CTimer sl@0: { sl@0: public: sl@0: CShutdown() : CTimer(EPriorityStandard) sl@0: { sl@0: // nada sl@0: } sl@0: void Start(); sl@0: void ConstructL(); sl@0: private: sl@0: static const TUint KTimerServerShutdownDelay=3000000; sl@0: void RunL(); sl@0: }; sl@0: sl@0: NONSHARABLE_CLASS(CTimerServer) : public CServer2 sl@0: { sl@0: public: sl@0: // We want the transfers to be done on a priority. Hence the EPriorityHigh sl@0: CTimerServer() : CServer2(EPriorityHigh,ESharableSessions) sl@0: { sl@0: // nada sl@0: } sl@0: sl@0: ~CTimerServer(); sl@0: static CTimerServer* NewLC(); sl@0: sl@0: TInt AddToScheduler(); sl@0: void RemoveFromScheduler(); sl@0: TInt RemoveInternal(const TInt); sl@0: TInt SetTimer(const TInt); sl@0: void StartServer(); sl@0: static TInt NewTimerServerL(); sl@0: void AddSession(); sl@0: void DropSession(); sl@0: sl@0: CActiveScheduler* iOldScheduler; sl@0: sl@0: private: sl@0: void ConstructL(); sl@0: CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const; sl@0: private: sl@0: TInt iSessionCount; sl@0: CShutdown* iShutdown; sl@0: }; sl@0: sl@0: NONSHARABLE_CLASS(CTimerServerSession) : public CSession2 sl@0: { sl@0: public: sl@0: void CreateL(); sl@0: private: sl@0: ~CTimerServerSession(); sl@0: CTimerServer& Server(); sl@0: void ServiceL(const RMessage2& aMessage); sl@0: void ServiceError(const RMessage2& aMessage, TInt aError); sl@0: }; sl@0: sl@0: #endif //__TIMERSERVER_H__