examples/Base/IPC/AdvancedClientServerExample/ThreadServer/inc/threadserver.h

00001 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
00002 // All rights reserved.
00003 // This component and the accompanying materials are made available
00004 // under the terms of "Eclipse Public License v1.0"
00005 // which accompanies this distribution, and is available
00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
00007 //
00008 // Initial Contributors:
00009 // Nokia Corporation - initial contribution.
00010 //
00011 // Contributors:
00012 //
00013 // Description:
00014 //
00015 
00016 #ifndef __THREADSERVER_H__
00017 #define __THREADSERVER_H__
00018 
00019 #include <e32base.h>
00020 #include <e32std.h>
00021 #include "shutdownserver.h"
00022 #include "threadclientserver.h"
00023 #include "threadserverstart.h"
00024 #include "driver1.h"
00025 
00026 class CAsyncHandler; 
00027 
00031 class CThreadServer : public CServer2
00032         {
00033 public:
00037         enum TDriverState
00038                 {
00039                 EStateUnknown,
00040                 EDriverLoaded,
00041                 ELogicalChannelOpened,
00042                 ESendingData,
00043                 ELogicalChannelClosed,
00044                 EDriverUnloaded
00045                 };
00049         IMPORT_C static TInt StartThread(TAny* aPointer);
00053         static void NewLC();
00058         ~CThreadServer();
00063         CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const;
00068         void IncrementRefCount();
00073         void DecrementRefCount();
00077         TInt LoadDevice();
00081         TInt UnloadDevice();
00085         TInt OpenLogicalChannel();
00089         void CloseLogicalChannel();
00093         TInt SendDataToDevice(TRequestStatus& aStatus, const TDesC8& aData);
00097         void CancelSendData();
00101         void UpdateDriverState(TDriverState aState);
00102         
00103         
00104 private:
00105         CThreadServer();
00106         void ConstructL();
00107         
00108         static void StartThreadL();
00109         static void RenameServer();
00110 private:
00111         TInt                                    iRefCount;
00112         CDelayServerShutDown*   iDelayThreadServerShutDown;
00113         RDriver1                                iDriver;
00114         TDriverState                    iDriverState;
00115         };
00116         
00117 
00118 
00119 #endif

Generated by  doxygen 1.6.2