|
1 /* |
|
2 * Copyright (c) 2005 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: RMessage2 wrapper holding general message utils. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __RPENGMESSAGE_H__ |
|
20 #define __RPENGMESSAGE_H__ |
|
21 |
|
22 // INCLUDES |
|
23 #include <E32Base.h> |
|
24 #include <badesca.h> |
|
25 #include "PEngInternalGlobalConsts.h" |
|
26 |
|
27 |
|
28 |
|
29 // CLASS DECLARATION |
|
30 |
|
31 /** |
|
32 * RMessage wrapper |
|
33 * |
|
34 * @since 3.0 |
|
35 */ |
|
36 class RPEngMessage |
|
37 { |
|
38 public: // Constructors and destructor |
|
39 |
|
40 /** |
|
41 * C++ default constructor. |
|
42 */ |
|
43 IMPORT_C RPEngMessage(); |
|
44 |
|
45 /** |
|
46 * C++ constructor. |
|
47 */ |
|
48 IMPORT_C RPEngMessage( const RMessage2& aMessage ); |
|
49 |
|
50 /** |
|
51 * C++ copy constructor. |
|
52 */ |
|
53 IMPORT_C RPEngMessage( const RPEngMessage& aMyMessage ); |
|
54 |
|
55 /** |
|
56 * C++ asigment operator. |
|
57 */ |
|
58 IMPORT_C RPEngMessage& operator=( const RPEngMessage& aMessage ); |
|
59 |
|
60 /** |
|
61 * Destructor. |
|
62 */ |
|
63 IMPORT_C ~RPEngMessage(); |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 public: // Mesage valid and completion utils |
|
69 |
|
70 /** |
|
71 * Tells if message is already completed or not |
|
72 * |
|
73 * @return ETrue if there is valid RMessage |
|
74 */ |
|
75 IMPORT_C TBool MessageValid( void ) const ; |
|
76 |
|
77 |
|
78 /** |
|
79 * Completes the client message with the reason |
|
80 * if the message is still valid. If message isn't |
|
81 * valid anymore (it is already completed), |
|
82 * does nothing. |
|
83 * |
|
84 * @param aReason The completion reason. |
|
85 */ |
|
86 IMPORT_C void Complete( TInt aReason ) const ; |
|
87 |
|
88 |
|
89 |
|
90 public: // Derscriptor read/write utils |
|
91 |
|
92 |
|
93 /** |
|
94 * Gets descriptor current or maximum length |
|
95 * from the client. |
|
96 */ |
|
97 IMPORT_C TInt DesLength( TInt aParam ) const; |
|
98 IMPORT_C TInt DesMaxLength( TInt aParam ) const; |
|
99 |
|
100 |
|
101 /** |
|
102 * Reads one descriptor from the client. |
|
103 * 16 bit variant. |
|
104 */ |
|
105 IMPORT_C HBufC16* ReadOneDescriptor16L( TInt aParam ) const; |
|
106 IMPORT_C HBufC16* ReadOneDescriptor16LC( TInt aParam ) const; |
|
107 IMPORT_C TInt ReadOneDescriptor( TInt aParam, HBufC16*& aDes ) const; |
|
108 IMPORT_C void ReadOneDescriptorL( TInt aParam, RBuf& aDes ) const; |
|
109 |
|
110 /** |
|
111 * Reads one descriptor from the client. |
|
112 * 8 bit variant. |
|
113 */ |
|
114 IMPORT_C HBufC8* ReadOneDescriptor8L( TInt aParam ) const; |
|
115 IMPORT_C HBufC8* ReadOneDescriptor8LC( TInt aParam ) const; |
|
116 IMPORT_C TInt ReadOneDescriptor( TInt aParam, HBufC8*& aDes ) const; |
|
117 IMPORT_C void ReadOneDescriptorL( TInt aParam, RBuf8& aDes ) const; |
|
118 |
|
119 |
|
120 /** |
|
121 * Writes one descriptor to client side. |
|
122 * 16 bit variant. |
|
123 */ |
|
124 IMPORT_C void WriteOneDescriptorL( TInt aParam, |
|
125 const TDesC16& aDes, |
|
126 TInt aOffset = 0 ) const; |
|
127 |
|
128 IMPORT_C TInt WriteOneDescriptor( TInt aParam, |
|
129 const TDesC16& aDes, |
|
130 TInt aOffset = 0 ) const; |
|
131 |
|
132 /** |
|
133 * Writes one descriptor to client side. |
|
134 * 8 bit variant. |
|
135 */ |
|
136 IMPORT_C void WriteOneDescriptorL( TInt aParam, |
|
137 const TDesC8& aDes, |
|
138 TInt aOffset = 0 ) const; |
|
139 |
|
140 IMPORT_C TInt WriteOneDescriptor( TInt aParam, |
|
141 const TDesC8& aDes, |
|
142 TInt aOffset = 0 ) const; |
|
143 |
|
144 |
|
145 |
|
146 public: // Descriptor array read/write utils |
|
147 |
|
148 /** |
|
149 * Gets descriptor array element count |
|
150 * from the client. |
|
151 */ |
|
152 IMPORT_C TInt ReadDescriptorArrayCountL( TInt aParam ) const; |
|
153 |
|
154 |
|
155 /** |
|
156 * Gets first descriptor element |
|
157 * from the client. |
|
158 */ |
|
159 IMPORT_C HBufC16* ReadFirstDescriptorFromArrayL( TInt aParam ) const; |
|
160 |
|
161 |
|
162 /** |
|
163 * Reads whole descriptor array from client. |
|
164 */ |
|
165 IMPORT_C void ReadDescriptorArrayL( TInt aParam, |
|
166 CDesCArray& aTargetArray ) const; |
|
167 |
|
168 |
|
169 /** |
|
170 * Reads whole descriptor array from client. |
|
171 */ |
|
172 IMPORT_C HBufC* ReadDescriptorArrayLC( |
|
173 TInt aParam, |
|
174 CPtrCArray& aTargetArray ) const; |
|
175 |
|
176 |
|
177 /** |
|
178 * Writes whole descriptor array to client. |
|
179 */ |
|
180 IMPORT_C void WriteDescriptorArrayL( TInt aParam, |
|
181 const MDesCArray& aSourceArray ) const; |
|
182 |
|
183 |
|
184 |
|
185 public: // RArray<TInt> read/write utils |
|
186 |
|
187 /** |
|
188 * Writes RArray<TInt> array to client. |
|
189 */ |
|
190 IMPORT_C void WriteTIntArrayL( TInt aParam, |
|
191 RArray<TInt>& aTargetArray ) const; |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 public: // Masked RMessage2 functions |
|
197 |
|
198 |
|
199 /** |
|
200 * Functions to access request parameters. |
|
201 */ |
|
202 IMPORT_C TInt Int0() const; |
|
203 IMPORT_C TInt Int1() const; |
|
204 IMPORT_C TInt Int2() const; |
|
205 IMPORT_C TInt Int3() const; |
|
206 |
|
207 |
|
208 /** |
|
209 * Functions to terminate the client. |
|
210 */ |
|
211 IMPORT_C void Panic( const TDesC& aCategory, TInt aReason ) const; |
|
212 IMPORT_C void Kill( TInt aReason ) const; |
|
213 IMPORT_C void Terminate( TInt aReason ) const; |
|
214 |
|
215 |
|
216 /** |
|
217 * Functions to access function and client information. |
|
218 */ |
|
219 IMPORT_C TInt Function() const; |
|
220 IMPORT_C TInt Client( RThread& aClient, |
|
221 TOwnerType aOwnerType = EOwnerProcess ) const; |
|
222 |
|
223 |
|
224 |
|
225 private: // Data |
|
226 |
|
227 //OWN: Is message valid |
|
228 TBool iMessageValid; |
|
229 |
|
230 //OWN: Real RMessage2 |
|
231 RMessage2 iMessage; |
|
232 }; |
|
233 |
|
234 |
|
235 #endif // __RPENGMESSAGE_H__ |
|
236 |
|
237 // End of File |
|
238 |
|
239 |