examples/SFExamples/Symbian_OS_Explained_Hercules-v9_Example_Code/inc/client-server.h

00001 // 
00002 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
00003 // All rights reserved.
00004 // This component and the accompanying materials are made available
00005 // under the terms of the License "Eclipse Public License v1.0"
00006 // which accompanies this distribution, and is available
00007 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
00008 // 
00009 // Initial Contributors:
00010 // Nokia Corporation - initial contribution.
00011 // 
00012 // Contributors:
00013 // 
00014 // Description:
00015 // 
00016 // client-server.h
00017 #ifndef CLIENTSERVER_H__
00018 #define CLIENTSERVER_H__
00019 
00020 #include <e32std.h>
00021 #include <s32std.h>
00022 
00023 _LIT(KServerName,"HerculesServer");// The server's identity within the client-server framework
00024 _LIT(KServerBinaryName,"server"); // The name of the server binary (dll or exe) 
00025 
00026 #ifdef __WINS__
00027 const TInt KMinServerHeapSize=0x1000;
00028 const TInt KMaxServerHeapSize=0x1000000;
00029 #endif
00030 
00031 // Test values - used for checking that IPC handling is correct.
00032 // Normal production code would *not* include these
00033 _LIT8(KNemeanLionDes, "NemeanLion");
00034 const TInt KNemeanLionVal = 1;
00035 const TInt KHydraHeadCount = 9;
00036 const TInt KNoHeads = 0;
00037 const TInt KInitialCount = 0;
00038 const TInt KCapturedCount = 6;
00039 _LIT8(KHercules, "Hercules");
00040 _LIT8(KHeracles, "Heracles");
00041 const TInt KHerculesDataVal = 7;
00042 const TInt KBirdCount = 3;
00043 // End of test values
00044 
00045 
00046 enum THerculeanLabours
00047         {
00048         ESlayNemeanLion,
00049         ESlayHydra,
00050         ECaptureCeryneianHind,
00051         ESlayErymanthianBoar,
00052         ECleanAugeanStables,
00053         ECancelCleanAugeanStables,
00054         ESlayStymphalianBirds,
00055         ECancelSlayStymphalianBirds,
00056         ECaptureCretanBull,
00057         ECaptureMaresOfDiomedes,
00058         EObtainGirdleOfHippolyta,
00059         ECaptureOxenOfGeryon,
00060         ETakeGoldenApplesOfHesperides,
00061         ECaptureCerberus
00062         };
00063 
00064 struct THydraData
00065         {
00066         TVersion iHydraVersion;
00067         TInt iHeadCount;
00068         };
00069 
00070 
00071 class TServerStart
00072         {
00073 public:
00074         TServerStart() {};
00075         TServerStart(TRequestStatus& aStatus);
00076         TPtrC AsCommand() const;
00077         TInt GetCommand();
00078         void SignalL();
00079 private:
00080         TThreadId iId;
00081         TRequestStatus* iStatus;
00082         };
00083 
00084 inline TServerStart::TServerStart(TRequestStatus& aStatus)
00085         :iId(RThread().Id()),iStatus(&aStatus)
00086         {aStatus=KRequestPending;}
00087 
00088 // Descriptorizes ’this’ to pass it from client to server
00089 inline TPtrC TServerStart::AsCommand() const
00090         {return TPtrC(reinterpret_cast<const TText*>(this),sizeof(TServerStart)/sizeof(TText));}
00091         
00092 
00093 class CHerculesData : public CBase
00094         {
00095 public:
00096         IMPORT_C static CHerculesData* NewLC(const TDesC8& aDes1, const TDesC8& aDes2, TInt aVal);
00097         static CHerculesData* NewLC(const TDesC8& aStreamData);
00098         IMPORT_C ~CHerculesData();
00099 public:
00100         // Creates an HBufC8 representation of ’this’
00101         IMPORT_C HBufC8* MarshalDataL() const;
00102 public:
00103         void SetDes1L(const TDesC8& aDes);
00104         void SetDes2L(const TDesC8& aDes);
00105         inline void SetVal(TInt aVal) {iVal=aVal;};
00106         inline const TDesC8& Des1() const {return (*iDes1);};
00107         inline const TDesC8& Des2() const {return (*iDes2);};
00108         inline TInt Val() const {return (iVal);};
00109 protected:
00110         // Writes ’this’ to the stream
00111         void ExternalizeL(RWriteStream& aStream) const;
00112         // Initializes ’this’ from stream
00113         void InternalizeL(RReadStream& aStream);
00114 protected:
00115         CHerculesData(TInt aVal);
00116         CHerculesData(){};
00117         void ConstructL(const TDesC8& aDes1, const TDesC8& aDes2);
00118         void ConstructL();
00119 private:
00120         HBufC8* iDes1;
00121         HBufC8* iDes2;
00122         TInt iVal;
00123         };
00124 
00125 #endif // CLIENTSERVER_H__
00126 

Generated by  doxygen 1.6.2