|
1 /* |
|
2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __TESTFRAMEWORKIPC_INL__ |
|
20 #define __TESTFRAMEWORKIPC_INL__ |
|
21 |
|
22 |
|
23 // |
|
24 // RMmfSessionBaseX |
|
25 // |
|
26 |
|
27 // Pass throughs - equiv to using... |
|
28 |
|
29 inline TInt RMmfSessionBaseX::SendReceive(TInt aFunction) const |
|
30 { |
|
31 return RMmfSessionBase::SendReceive(aFunction); |
|
32 } |
|
33 |
|
34 inline void RMmfSessionBaseX::SendReceive(TInt aFunction, TRequestStatus& aStatus) const |
|
35 { |
|
36 RMmfSessionBase::SendReceive(aFunction, aStatus); |
|
37 } |
|
38 |
|
39 inline TInt RMmfSessionBaseX::SendReceive(TInt aFunction, TInt aParam0) const |
|
40 { |
|
41 return RMmfSessionBase::SendReceive(aFunction, aParam0); |
|
42 } |
|
43 |
|
44 inline TInt RMmfSessionBaseX::SendReceive(TInt aFunction, TInt aParam0, TInt aParam1) const |
|
45 { |
|
46 return RMmfSessionBase::SendReceive(aFunction, aParam0, aParam1); |
|
47 } |
|
48 |
|
49 inline void RMmfSessionBaseX::SendReceive(TInt aFunction, TInt aParam0, TRequestStatus& aStatus) const |
|
50 { |
|
51 RMmfSessionBase::SendReceive(aFunction, aParam0, aStatus); |
|
52 } |
|
53 |
|
54 inline void RMmfSessionBaseX::SendReceive(TInt aFunction, TInt aParam0, TInt aParam1, TRequestStatus& aStatus) const |
|
55 { |
|
56 RMmfSessionBase::SendReceive(aFunction, aParam0, aParam1, aStatus); |
|
57 } |
|
58 |
|
59 inline TInt RMmfSessionBaseX::SendReceive(TInt aFunction, const TDesC8& aParam0) const |
|
60 { |
|
61 return RMmfSessionBase::SendReceive(aFunction, aParam0); |
|
62 } |
|
63 |
|
64 inline TInt RMmfSessionBaseX::SendReceive(TInt aFunction, const TDesC8& aParam0, const TDesC8& aParam1) const |
|
65 { |
|
66 return RMmfSessionBase::SendReceive(aFunction, aParam0, aParam1); |
|
67 } |
|
68 |
|
69 inline TInt RMmfSessionBaseX::SendReceive(TInt aFunction, const TDesC8& aParam0, const TDesC8& aParam1, const TDesC8& aParam2) const |
|
70 { |
|
71 return RMmfSessionBase::SendReceive(aFunction, aParam0, aParam1, aParam2); |
|
72 } |
|
73 |
|
74 inline void RMmfSessionBaseX::SendReceive(TInt aFunction, const TDesC8& aParam0, TRequestStatus& aStatus) const |
|
75 { |
|
76 RMmfSessionBase::SendReceive(aFunction, aParam0, aStatus); |
|
77 } |
|
78 |
|
79 inline void RMmfSessionBaseX::SendReceive(TInt aFunction, const TDesC8& aParam0, const TDesC8& aParam1, TRequestStatus& aStatus) const |
|
80 { |
|
81 RMmfSessionBase::SendReceive(aFunction, aParam0, aParam1, aStatus); |
|
82 } |
|
83 |
|
84 inline void RMmfSessionBaseX::SendReceive(TInt aFunction, const TDesC8& aParam0, const TDesC8& aParam1, const TDesC8& aParam2, TRequestStatus& aStatus) const |
|
85 { |
|
86 RMmfSessionBase::SendReceive(aFunction, aParam0, aParam1, aParam2, aStatus); |
|
87 } |
|
88 |
|
89 // New call |
|
90 |
|
91 inline TInt RMmfSessionBaseX::SendReceive(TInt aFunction, const TDesC& aParam0, TInt aParam1) const |
|
92 { |
|
93 #ifdef __MMF_USE_IPC_V2__ |
|
94 return RSessionBase::SendReceive(aFunction, TIpcArgs(&aParam0,aParam1)); |
|
95 #else |
|
96 TAny* p[KMaxMessageArguments]; |
|
97 p[0] = static_cast<TAny*>(const_cast<TDesC16*>(&aParam0)); |
|
98 p[1] = reinterpret_cast<TAny*>(aParam1); |
|
99 p[2] = NULL; |
|
100 p[3] = NULL; |
|
101 return RSessionBase::SendReceive(aFunction, p); |
|
102 #endif __MMF_USE_IPC_V2__ |
|
103 } |
|
104 |
|
105 // |
|
106 // MmfMEssageUtilX |
|
107 // |
|
108 |
|
109 // Using calls |
|
110 |
|
111 inline TInt MmfMessageUtilX::Read(const RMmfIpcMessage& aMessage, TInt aParam, TDes8& aResult) |
|
112 { |
|
113 return MmfMessageUtil::Read(aMessage, aParam, aResult); |
|
114 } |
|
115 |
|
116 inline TInt MmfMessageUtilX::Write(const RMmfIpcMessage& aMessage, TInt aParam, const TDesC8& aValue) |
|
117 { |
|
118 return MmfMessageUtil::Write(aMessage, aParam, aValue); |
|
119 } |
|
120 |
|
121 inline void MmfMessageUtilX::ReadL(const RMmfIpcMessage& aMessage, TInt aParam, TDes8& aResult) |
|
122 { |
|
123 MmfMessageUtil::ReadL(aMessage, aParam, aResult); |
|
124 } |
|
125 |
|
126 inline void MmfMessageUtilX::WriteL(const RMmfIpcMessage& aMessage, TInt aParam, const TDesC8& aValue) |
|
127 { |
|
128 MmfMessageUtil::WriteL(aMessage, aParam, aValue); |
|
129 } |
|
130 |
|
131 |
|
132 // New calls |
|
133 |
|
134 inline void MmfMessageUtilX::ReadL(const RMmfIpcMessage& aMessage, TInt aParam, TDes16& aResult) |
|
135 { |
|
136 #ifdef __MMF_USE_IPC_V2__ |
|
137 User::LeaveIfError(aMessage.Read(aParam, aResult)); |
|
138 #else |
|
139 // expect aParam to be a literal - so this code should optimise out |
|
140 if (aParam==0) |
|
141 aMessage.ReadL(aMessage.Ptr0(), aResult); |
|
142 else if (aParam==1) |
|
143 aMessage.ReadL(aMessage.Ptr1(), aResult); |
|
144 else if (aParam==2) |
|
145 aMessage.ReadL(aMessage.Ptr2(), aResult); |
|
146 else if (aParam==3) |
|
147 aMessage.ReadL(aMessage.Ptr3(), aResult); |
|
148 else |
|
149 User::Leave(KErrArgument); |
|
150 #endif __MMF_USE_IPC_V2__ |
|
151 } |
|
152 |
|
153 inline void MmfMessageUtilX::WriteL(const RMmfIpcMessage& aMessage, TInt aParam, const TDesC16& aValue) |
|
154 { |
|
155 #ifdef __MMF_USE_IPC_V2__ |
|
156 User::LeaveIfError(aMessage.Write(aParam, aValue)); |
|
157 #else |
|
158 // expect aParam to be a literal - so this code should optimise out |
|
159 if (aParam==0) |
|
160 aMessage.WriteL(aMessage.Ptr0(), aValue); |
|
161 else if (aParam==1) |
|
162 aMessage.WriteL(aMessage.Ptr1(), aValue); |
|
163 else if (aParam==2) |
|
164 aMessage.WriteL(aMessage.Ptr2(), aValue); |
|
165 else if (aParam==3) |
|
166 aMessage.WriteL(aMessage.Ptr3(), aValue); |
|
167 else |
|
168 User::Leave(KErrArgument); |
|
169 #endif __MMF_USE_IPC_V2__ |
|
170 } |
|
171 |
|
172 inline TInt MmfMessageUtilX::Read(const RMmfIpcMessage& aMessage, TInt aParam, TDes16& aResult) |
|
173 { |
|
174 #ifdef __MMF_USE_IPC_V2__ |
|
175 return aMessage.Read(aParam, aResult); |
|
176 #else |
|
177 TRAPD(error, ReadL(aMessage, aParam, aResult)); |
|
178 return error; |
|
179 #endif __MMF_USE_IPC_V2__ |
|
180 } |
|
181 |
|
182 inline TInt MmfMessageUtilX::Write(const RMmfIpcMessage& aMessage, TInt aParam, const TDesC16& aValue) |
|
183 { |
|
184 #ifdef __MMF_USE_IPC_V2__ |
|
185 return aMessage.Write(aParam, aValue); |
|
186 #else |
|
187 TRAPD(error, WriteL(aMessage, aParam, aValue)); |
|
188 return error; |
|
189 #endif __MMF_USE_IPC_V2__ |
|
190 } |
|
191 |
|
192 |
|
193 |
|
194 #endif // __TESTFRAMEWORKIPC_INL__ |