|
1 /* |
|
2 * Copyright (c) 2004-2007 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 the License "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 TMESSAGEWRP2_H |
|
20 #define TMESSAGEWRP2_H |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 class TDpMessage |
|
25 { |
|
26 public: |
|
27 |
|
28 /** |
|
29 * Message wrapper constructor |
|
30 * |
|
31 * @param aMessage message to be wrapped |
|
32 * @param aConnected session connection flag |
|
33 */ |
|
34 TDpMessage( const RMessage2& aMessage, const TBool& aConnected ); |
|
35 |
|
36 public: |
|
37 |
|
38 /** |
|
39 * If session connected, write descriptor to the wrapped message |
|
40 * |
|
41 * @param aParam message parameter id |
|
42 * @param aDes descriptor |
|
43 * @param aOffset offset from the start of the client's descriptor |
|
44 */ |
|
45 void WriteL(TInt aParam, const TDesC8 &aDes, TInt aOffset=0) const; |
|
46 |
|
47 /** |
|
48 * If session connected, complete the wrapped message |
|
49 * |
|
50 * @param aReason completion code |
|
51 */ |
|
52 void Complete(TInt aReason) const; |
|
53 |
|
54 /** |
|
55 * If session connected, gets the 1st message argument as an integer value |
|
56 * |
|
57 * @return 1st message argument as an integer value |
|
58 */ |
|
59 TInt Int0() const; |
|
60 |
|
61 /** |
|
62 * If session connected, gets the 2nd message argument as an integer value |
|
63 * |
|
64 * @return 2nd message argument as an integer value |
|
65 */ |
|
66 TInt Int1() const; |
|
67 |
|
68 /** |
|
69 * If session connected, gets the length of a descriptor argument |
|
70 * in the client's process |
|
71 * |
|
72 * @param aParam index value identifying the argument |
|
73 * @return the length of the descriptor or error code |
|
74 */ |
|
75 TInt GetDesLength(TInt aParam) const; |
|
76 |
|
77 /** |
|
78 * If session connected, read data from the specified offset within |
|
79 * the 8-bit descriptor argument, into the specified target descriptor |
|
80 * |
|
81 * @param aParam message parameter id |
|
82 * @param aDes target descriptor |
|
83 * @param aOffset offset from the start of the client's descriptor |
|
84 */ |
|
85 void ReadL(TInt aParam, TDes8 &aDes, TInt aOffset=0) const; |
|
86 |
|
87 /** |
|
88 * If session connected, read data from the specified offset within |
|
89 * the 16-bit descriptor argument, into the specified target descriptor |
|
90 * |
|
91 * @param aParam message parameter id |
|
92 * @param aDes target descriptor |
|
93 * @param aOffset offset from the start of the client's descriptor |
|
94 */ |
|
95 void ReadL(TInt aParam, TDes16 &aDes, TInt aOffset=0) const; |
|
96 |
|
97 /** |
|
98 * Panic the client thread |
|
99 * |
|
100 * @param aCategory category descriptor |
|
101 * @param aReason reason id |
|
102 */ |
|
103 void Panic(const TDesC &aCategory, TInt aReason) const; |
|
104 |
|
105 /** |
|
106 * Gets the the number of the function requested by the client |
|
107 * |
|
108 * @return the function number |
|
109 */ |
|
110 TInt Function() const; |
|
111 |
|
112 /** |
|
113 * Sets the disposable state. Disposable means that the message needs not |
|
114 * to be preserved |
|
115 * |
|
116 * @param aDisposable disposable flag |
|
117 */ |
|
118 void SetDisposable( TBool aDisposable ); |
|
119 |
|
120 /** |
|
121 * Gets the disposable state |
|
122 * |
|
123 * @return the disposable flag |
|
124 */ |
|
125 TBool Disposable() const; |
|
126 |
|
127 private: // data |
|
128 RMessage2 iMessage; |
|
129 const TBool& iConnected; |
|
130 TBool iDisposable; |
|
131 }; |
|
132 |
|
133 |
|
134 #endif // TMESSAGEWRP2_H |
|
135 |
|
136 // End of File |