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 // ProcessServerSession.h 00015 // 00016 00017 #ifndef __PROCESSSERVERSESSION_H__ 00018 #define __PROCESSSERVERSESSION_H__ 00019 00020 #include <e32base.h> 00021 #include <e32std.h> 00022 #include "threadserver.h" 00023 00024 const TInt KMaxAsyncRequests = 4; 00025 class CThreadServer; 00026 00030 class CThreadServerSession : public CSession2 00031 { 00032 public: 00033 static CThreadServerSession* NewL(CThreadServer& aServer); 00034 ~CThreadServerSession(); 00035 void CreateL(); 00036 void ServiceL(const RMessage2& aMessage); 00037 00038 private: 00039 CThreadServerSession(CThreadServer& aServer); 00040 void ConstructL(); 00041 00042 // Active object class for asynchronous requests 00043 class CAsyncHandler : public CActive 00044 { 00045 public: 00046 static CAsyncHandler* NewL(CThreadServer& aServer); 00047 ~CAsyncHandler(); 00048 //Store async request in message array 00049 TInt ProcessRequest(const RMessage2& aMessage); 00050 private: 00051 00052 CAsyncHandler(CThreadServer& aServer); 00053 void ConstructL(); 00054 00055 void RunL(); 00056 void DoCancel(); 00057 00058 TInt ExecuteFirstRequestInArray(); 00059 00063 class TMessage 00064 { 00065 public: 00066 const RMessage2& Message() const; // getter 00067 RMessage2& Message(); // setter 00068 private: 00069 RMessage2 iMessage; 00070 }; 00071 00072 void Complete(TInt aResult); 00073 00074 private: 00075 RArray<TMessage> iMessageArray; 00076 CThreadServer& iServer; 00077 }; 00078 00079 private: 00080 CThreadServer& iServer; 00081 CAsyncHandler* iAsyncRequestHandler; 00082 }; 00083 00084 #endif
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.