examples/Base/IPC/AdvancedClientServerExample/ProcessServer/inc/processserversession.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 __PROCESSSERVERSESSION_H__
00017 #define __PROCESSSERVERSESSION_H__
00018 
00019 #include <e32base.h>
00020 #include <e32std.h>
00021 #include "processserver.h"
00022 
00023 
00024 const TInt KMaxAsyncRequests = 4;
00025 class CProcessServer;
00029 class CProcessServerSession : public CSession2
00030         {
00031 public:
00032         static CProcessServerSession* NewL(CProcessServer& aServer);
00033         ~CProcessServerSession();
00034         void CreateL();// Create a server-side client session
00035         void ServiceL(const RMessage2& aMessage);// Handles the client request
00036         
00037         
00038 private:
00039         CProcessServerSession(CProcessServer& aServer);
00040         void ConstructL();
00041         
00042         // Active object class for asynchronous requests
00043         class CAsyncHandler : public CActive 
00044                 {
00045         public:
00046                 static CAsyncHandler* NewL(CProcessServer& aServer);
00047                 ~CAsyncHandler();
00048                 
00049                  //Store async request in message array
00050                 TInt ProcessRequest(const RMessage2& aMessage);
00051         private:
00052 
00053                 CAsyncHandler(CProcessServer& aServer);
00054                 void ConstructL();
00055                 
00056                 // CActive implementation
00057                 void RunL();
00058                 void DoCancel();
00059                         
00060                 TInt ExecuteFirstRequestInArray();// Execute messages in array
00061                 
00065                 class TMessage
00066                         {
00067                 public:
00068                         const RMessage2& Message() const;       // getter
00069                         RMessage2& Message();                           // setter
00070                 private:
00071                         RMessage2 iMessage;
00072                         };
00073                 
00074                 void Complete(TInt aResult);
00075                 
00076         private:
00077                 RArray<TMessage>                iMessageArray;
00078                 CProcessServer&                 iServer;
00079                 };
00080         
00081 private:
00082         CProcessServer& iServer;
00083         CAsyncHandler*  iAsyncRequestHandler;
00084         
00085         };
00086 
00087 #endif

Generated by  doxygen 1.6.2