diff -r f5050f1da672 -r 04becd199f91 javacommons/utils/functionserver/inc.s60/os_functionserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javacommons/utils/functionserver/inc.s60/os_functionserver.h Tue Apr 27 16:30:29 2010 +0300 @@ -0,0 +1,124 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +#ifndef OS_FUNCTIONSERVER_H +#define OS_FUNCTIONSERVER_H + +#include +#include + +#include "javaosheaders.h" + +namespace java +{ +namespace util +{ + +class FunctionServer; + +NONSHARABLE_CLASS(ServerShutdown) : public CActive +{ +public: + ServerShutdown(); + void startShutDown(); + +protected: + virtual void RunL(); + virtual TInt RunError(TInt error); + virtual void DoCancel(); + +}; + + +/** + * + */ +NONSHARABLE_CLASS(OsFunctionServer) : public CServer2 +{ +// Data types +public: + enum TAction + { + EExecute = 0, + EStop + }; + +private: + class CFunctionSession; +// Methods +public: + ~OsFunctionServer(); + + OsFunctionServer(); + inline void osThreadInit(); + inline void osThreadClean(); + void startOsServer(); + + void startShutDown(); + void stopServerInsideServerThread(); + +// From CServer2 +protected: + TInt RunError(TInt aError); + +private: + CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const; + + CTrapCleanup* mCleanUp; + + ServerShutdown mShutdown; +}; + + +NONSHARABLE_CLASS(OsFunctionServer::CFunctionSession) + : public CSession2 +{ +public: + inline CFunctionSession(); + +private: + TInt doServiceL(TAction aAction, const TAny* aParam); + +// From CSession2 +public: + void ServiceL(const RMessage2& aMessage); + +}; + + +/** + * + */ +inline void OsFunctionServer::osThreadInit() +{ + mCleanUp = CTrapCleanup::New(); +} + +/** + * + */ +inline void OsFunctionServer::osThreadClean() +{ + delete mCleanUp; + mCleanUp = 0; +} + +} //end namespace util +} //end namespace java +#endif // OS_FUNCTIONSERVER_H +