epoc32/include/mmf/common/mmfipcserver.h
branchSymbian3
changeset 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/mmf/common/mmfipcserver.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,101 @@
     1.4 +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// include\mmf\common\mmfipc.h
    1.18 +// Thin interface layer to use either V1 or V2 IPC calls as appropriate
    1.19 +// 
    1.20 +//
    1.21 +
    1.22 +#ifndef __MMF_COMMON_MMFIPC_SERVER_H__
    1.23 +#define __MMF_COMMON_MMFIPC_SERVER_H__
    1.24 +
    1.25 +#include <e32base.h>
    1.26 +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    1.27 +#include <mmf/common/mmfipc.h>
    1.28 +#endif
    1.29 +
    1.30 +// The following declarations are used instead of the native ones on the particular system variant:
    1.31 +//    RMmfIpcMessage replaces RMessage or RMessage2
    1.32 +//    CMmfIpcServer replaces CServer or CServer2
    1.33 +//    CMmfIpcSession replaces CSharableSession or CSession2
    1.34 +// They are used internally to the MMF component to provide configurability for the particular subsystem
    1.35 +
    1.36 +#ifdef __MMF_USE_IPC_V2__
    1.37 +
    1.38 +//typedef RMessage2 RMmfIpcMessage;
    1.39 +
    1.40 +class CMmfIpcServer; // forward declaration
    1.41 +
    1.42 +/**
    1.43 + * derive CMmfIpcSession from CSession2 so we can bridge the differences to old CSharableSession
    1.44 + *
    1.45 + * @internalTechnology
    1.46 + */
    1.47 + 
    1.48 +class CMmfIpcSession : public CSession2
    1.49 +	{
    1.50 +protected:
    1.51 +	virtual void CreateL(const CMmfIpcServer& aServer);
    1.52 +	CMmfIpcSession() {}
    1.53 +	// from CSession2
    1.54 +	void CreateL();
    1.55 +	};
    1.56 +
    1.57 +/*
    1.58 + * derive CMmfIpcServer from CServer2 so we can bridge difference to old CServer
    1.59 + *
    1.60 + * @internalTechnology
    1.61 + */
    1.62 + 
    1.63 +class CMmfIpcServer : public CServer2
    1.64 +	{
    1.65 +protected:
    1.66 +	virtual CMmfIpcSession* NewSessionL(const TVersion& aVersion) const=0;
    1.67 +	CMmfIpcServer(TInt aPriority,TServerType aType=EUnsharableSessions);
    1.68 +private:
    1.69 +	// derived from CServer2
    1.70 +	CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const;
    1.71 +	};
    1.72 +
    1.73 +#else // __MMF_USE_IPC_V2__
    1.74 +
    1.75 +// otherwise always use V1
    1.76 +//typedef RMessage RMmfIpcMessage;
    1.77 +typedef CServer CMmfIpcServer;
    1.78 +typedef CSharableSession CMmfIpcSession;
    1.79 +
    1.80 +#endif // __MMF_USE_IPC_V2__
    1.81 +
    1.82 +#if defined(__VC32__)
    1.83 +#pragma warning( disable : 4097 )	// typedef-name used as synonym for class-name 
    1.84 +#endif
    1.85 +
    1.86 +
    1.87 +/**
    1.88 + * Adapt RMessage calls between IPC variants
    1.89 + *
    1.90 + * @internalTechnology
    1.91 + */
    1.92 +
    1.93 +class MmfMessageUtil 
    1.94 +	{
    1.95 +public:
    1.96 +	static TInt Read(const RMmfIpcMessage& aMessage, TInt aParam, TDes8& aResult);
    1.97 +	static TInt Write(const RMmfIpcMessage& aMessage, TInt aParam, const TDesC8& aValue);
    1.98 +	static void ReadL(const RMmfIpcMessage& aMessage, TInt aParam, TDes8& aResult);
    1.99 +	static void WriteL(const RMmfIpcMessage& aMessage, TInt aParam, const TDesC8& aValue);
   1.100 +	};
   1.101 +	
   1.102 +#include <mmf/common/mmfipcserver.inl>
   1.103 +
   1.104 +#endif // __MMF_COMMON_MMFIPC_SERVER_H__