00001 // Copyright (c) 2000-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 #include <e32base.h> 00017 00018 // needed for creating server thread. 00019 const TUint KDefaultHeapSize=0x10000; 00020 00021 // reasons for server panic 00022 enum TCountServPanic 00023 { 00024 EBadRequest = 1, 00025 EBadDescriptor, 00026 EMainSchedulerError, 00027 ESvrCreateServer, 00028 ESvrStartServer, 00029 ECreateTrapCleanup, 00030 ENotImplementedYet, 00031 }; 00032 00033 00034 //********************************** 00035 //CCountServServer 00036 //********************************** 00043 class CCountServServer : public CServer2 00044 { 00045 public: 00046 // Creates a new session with the server; the function 00047 // implements the pure virtutal function 00048 // defined in class CServer2 00049 CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const; 00050 public : 00051 // The thread function executed by the server 00052 static TInt ThreadFunction(TAny* aStarted); 00053 // Function to panic the server 00054 static void PanicServer(TCountServPanic aPanic); 00055 00056 protected: 00057 CCountServServer(CActive::TPriority aActiveObjectPriority); 00058 }; 00059 00060 00061 //********************************** 00062 //CCountServSession 00063 //********************************** 00068 class CCountServSession : public CSession2 00069 { 00070 public: 00071 CCountServSession(); 00072 00073 //service request 00074 void ServiceL(const RMessage2& aMessage); 00075 void DispatchMessageL(const RMessage2& aMessage); 00076 00077 //services available to initialize/increase/decrease/reset and return the counter value. 00078 void SetFromStringL(const RMessage2& aMessage); 00079 void Increase(); 00080 void Decrease(); 00081 void IncreaseBy(const RMessage2& aMessage); 00082 void DecreaseBy(const RMessage2& aMessage); 00083 void CounterValueL(const RMessage2& aMessage); 00084 void Reset(); 00085 00086 protected: 00087 // panic the client 00088 void PanicClient(const RMessage2& aMessage,TInt aPanic) const; 00089 00090 private: 00091 TInt iCount; 00092 }; 00093 00094
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.