diff -r 7fdc9a71d314 -r 8ad140f3dd41 hti/HtiCommPlugins/HtiBtCommPlugin/HtiBtCommServer/inc/HtiBtCommServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hti/HtiCommPlugins/HtiBtCommPlugin/HtiBtCommServer/inc/HtiBtCommServer.h Wed Oct 13 16:17:58 2010 +0300 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2009 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: CHtiBtCommServer declaration +* +*/ + + +#ifndef __HTIBTCOMMSERVER_H__ +#define __HTIBTCOMMSERVER_H__ + +// INCLUDES + +#include +#include + +// CONSTANTS + +// Reasons for BtCommServer panic +enum TBtCommServerPanic + { + EBadRequest, + EBadDescriptor, + EMainSchedulerError, + ESvrCreateServer, + ESvrStartServer, + ECreateTrapCleanup, + ENotImplementedYet, + EFailedToInitMessageBox, + EFailedToOpenBTconnection, + EFailedToOpenPhonetChannel, + EFailedToRecPhonetMsg, + EFailedToSendPhonetMsg, + ETooManyAsyncRequests + }; + +// FUNCTION PROTOTYPES + +// Function to panic the server +GLREF_C void PanicServer( TBtCommServerPanic aPanic ); + +// Thread function for server +GLREF_C TInt BtCommServerThread( TAny * ); + +// FORWARD DECLARATIONS +class CHtiBtCommServerSession; +class CHtiBtReaderWriter; + +// CLASS DECLARATION + +/** +* Server class for BT communication. +*/ +class CHtiBtCommServer : public CServer2 + { + + private: // Constructors and destructor + /** + * C++ default constructor. + */ + CHtiBtCommServer( TInt aPriority ); + + /** + * Second Phase constructor + */ + void ConstructL(); + + public: + /** + * Symbian Two-phased constructor. + */ + static CHtiBtCommServer* NewL(); + + /** + * Destructor. + */ + ~CHtiBtCommServer(); + + public: // callbacks from session + + /** + * Session was deleted notification. + * Session notifies server, when client is disconnecting + * and session is being deleted. Server will start shutdown. + */ + void SessionFreed(); + + /** + * Session was created notification. + * @param aSession Session, which is notifying server of its creation. + */ + void SessionCreated( CHtiBtCommServerSession* aSession ); + + public: + /** + * Creates a new client session + * @param aVersion Version of the server + * @param aMessage Client message + * @return Pointer to the client session + */ + virtual CSession2* NewSessionL( const TVersion& aVersion, + const RMessage2& aMessage ) const; + + /** + * Creates server thread + * @param aStarted semaphore + * @return Error code + */ + static TInt ThreadFunction( TAny* aStarted ); + +public: // Data + // Priority of the server + enum TBtServPriority + { + EBtCommServerPriority = 100 + }; + +private: + + CHtiBtCommServerSession* iSession; // Not owned. Only one session allowed! + + }; + +#endif // __HTIBTCOMMSERVER_H__ + +// End of file