|
1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // include\mmf\common\mmfipc.h |
|
15 // Thin interface layer to use either V1 or V2 IPC calls as appropriate |
|
16 // |
|
17 // |
|
18 |
|
19 #ifndef __MMF_COMMON_MMFIPC_SERVER_H__ |
|
20 #define __MMF_COMMON_MMFIPC_SERVER_H__ |
|
21 |
|
22 #include <e32base.h> |
|
23 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
24 #include <mmf/common/mmfipc.h> |
|
25 #endif |
|
26 |
|
27 // The following declarations are used instead of the native ones on the particular system variant: |
|
28 // RMmfIpcMessage replaces RMessage or RMessage2 |
|
29 // CMmfIpcServer replaces CServer or CServer2 |
|
30 // CMmfIpcSession replaces CSharableSession or CSession2 |
|
31 // They are used internally to the MMF component to provide configurability for the particular subsystem |
|
32 |
|
33 #ifdef __MMF_USE_IPC_V2__ |
|
34 |
|
35 //typedef RMessage2 RMmfIpcMessage; |
|
36 |
|
37 class CMmfIpcServer; // forward declaration |
|
38 |
|
39 /** |
|
40 * derive CMmfIpcSession from CSession2 so we can bridge the differences to old CSharableSession |
|
41 * |
|
42 * @internalTechnology |
|
43 */ |
|
44 |
|
45 class CMmfIpcSession : public CSession2 |
|
46 { |
|
47 protected: |
|
48 virtual void CreateL(const CMmfIpcServer& aServer); |
|
49 CMmfIpcSession() {} |
|
50 // from CSession2 |
|
51 void CreateL(); |
|
52 }; |
|
53 |
|
54 /* |
|
55 * derive CMmfIpcServer from CServer2 so we can bridge difference to old CServer |
|
56 * |
|
57 * @internalTechnology |
|
58 */ |
|
59 |
|
60 class CMmfIpcServer : public CServer2 |
|
61 { |
|
62 protected: |
|
63 virtual CMmfIpcSession* NewSessionL(const TVersion& aVersion) const=0; |
|
64 CMmfIpcServer(TInt aPriority,TServerType aType=EUnsharableSessions); |
|
65 private: |
|
66 // derived from CServer2 |
|
67 CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const; |
|
68 }; |
|
69 |
|
70 #else // __MMF_USE_IPC_V2__ |
|
71 |
|
72 // otherwise always use V1 |
|
73 //typedef RMessage RMmfIpcMessage; |
|
74 typedef CServer CMmfIpcServer; |
|
75 typedef CSharableSession CMmfIpcSession; |
|
76 |
|
77 #endif // __MMF_USE_IPC_V2__ |
|
78 |
|
79 #if defined(__VC32__) |
|
80 #pragma warning( disable : 4097 ) // typedef-name used as synonym for class-name |
|
81 #endif |
|
82 |
|
83 |
|
84 /** |
|
85 * Adapt RMessage calls between IPC variants |
|
86 * |
|
87 * @internalTechnology |
|
88 */ |
|
89 |
|
90 class MmfMessageUtil |
|
91 { |
|
92 public: |
|
93 static TInt Read(const RMmfIpcMessage& aMessage, TInt aParam, TDes8& aResult); |
|
94 static TInt Write(const RMmfIpcMessage& aMessage, TInt aParam, const TDesC8& aValue); |
|
95 static void ReadL(const RMmfIpcMessage& aMessage, TInt aParam, TDes8& aResult); |
|
96 static void WriteL(const RMmfIpcMessage& aMessage, TInt aParam, const TDesC8& aValue); |
|
97 }; |
|
98 |
|
99 #include <mmf/common/mmfipcserver.inl> |
|
100 |
|
101 #endif // __MMF_COMMON_MMFIPC_SERVER_H__ |