|
1 // Copyright (c) 2008-2010 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 // Remote Control bulk client side. |
|
15 // |
|
16 |
|
17 |
|
18 |
|
19 /** |
|
20 @file |
|
21 @internalComponent |
|
22 */ |
|
23 |
|
24 #ifndef REMCONBULKCLIENT_H |
|
25 #define REMCONBULKCLIENT_H |
|
26 |
|
27 #include <e32base.h> |
|
28 #include <remcon/messagetype.h> |
|
29 #include "remconserver.h" |
|
30 |
|
31 /** |
|
32 The abstract base class for RemCon session handles. |
|
33 */ |
|
34 NONSHARABLE_CLASS(RRemConBulk) : public RSessionBase |
|
35 { |
|
36 public: |
|
37 IMPORT_C RRemConBulk(); |
|
38 |
|
39 /** |
|
40 Connect the handle to the server. |
|
41 Must be called before all other methods (except Version and Close). |
|
42 @return Error. |
|
43 */ |
|
44 IMPORT_C TInt Connect(); |
|
45 |
|
46 /** |
|
47 Getter for the version of the server. |
|
48 @return Version of the server. |
|
49 */ |
|
50 IMPORT_C TVersion Version() const; |
|
51 |
|
52 /** |
|
53 Sends a message (command or response) to the remote device. |
|
54 Note that currently only responses are supported, but the API |
|
55 is generic enough for both types of message. |
|
56 @param aStatus TRequestStatus for asynchronous completion. |
|
57 @param aInterfaceUid The UID of the interface to which the message |
|
58 belongs. |
|
59 @param aOperationId The ID of the message. RemCon needs to know this, |
|
60 separately from the arbitrary data, so it can (a) match up any incoming |
|
61 response to this client (if the message is a command), and (b) match this |
|
62 message up to the target (if this message is a response). |
|
63 @param aData Data associated with the message. |
|
64 */ |
|
65 IMPORT_C void Send(TRequestStatus& aStatus, |
|
66 TUid aInterfaceUid, |
|
67 TUint aOperationId, |
|
68 const TDesC8& aData = KNullDesC8()); |
|
69 |
|
70 /** |
|
71 Sends a message (command or response) unreliably to the remote device. |
|
72 Note that currently only reponses are supported, by the API is |
|
73 generic enough for both types of message. |
|
74 @param aInterfaceUid The UID of the interface to which the message |
|
75 belongs. |
|
76 @param aOperationId The ID of the message. RemCon needs to know this, |
|
77 separately from the arbitrary data, so it can (a) match up any incoming |
|
78 response to this client (if the message is a command), and (b) match this |
|
79 message up to the target (if this message is a response). |
|
80 @param aData Data associated with the message. |
|
81 @return Error - this is the first point of error. A message may error |
|
82 after this function returns (that error will not be reported). |
|
83 */ |
|
84 IMPORT_C TInt SendUnreliable(TUid aInterfaceUid, |
|
85 TUint aOperationId, |
|
86 const TDesC8& aData = KNullDesC8()); |
|
87 |
|
88 /** |
|
89 Cancels interest in the completion of an outstanding Send operation. |
|
90 @return KErrNone. |
|
91 */ |
|
92 IMPORT_C TInt SendCancel(); |
|
93 |
|
94 /** |
|
95 Receive a message (command or response) from the remote device. Note that |
|
96 RemCon server queues both commands and responses so that none are ever |
|
97 thrown away just because the client didn't have a Receive outstanding when |
|
98 they arrived. |
|
99 @param aStatus TRequestStatus for asynchronous completion. |
|
100 @param aInterfaceUid The UID of the interface to which the message |
|
101 belongs. |
|
102 @param aOperationId The ID of the message. |
|
103 @param aData Data associated with the message. |
|
104 */ |
|
105 IMPORT_C void Receive(TRequestStatus& aStatus, |
|
106 TUid& aInterfaceUid, |
|
107 TUint& aOperationId, |
|
108 TDes8& aData); |
|
109 |
|
110 /** |
|
111 Cancels interest in the completion of an outstanding Receive operation. |
|
112 @return KErrNone. |
|
113 */ |
|
114 IMPORT_C TInt ReceiveCancel(); |
|
115 |
|
116 /** |
|
117 Marks the start of heap cell checking in the server's heap. In release |
|
118 builds, just returns KErrNone. |
|
119 @return Error. |
|
120 */ |
|
121 IMPORT_C TInt __DbgMarkHeap(); |
|
122 |
|
123 /** |
|
124 Checks that the number of allocated cells on the server's heap is correct. |
|
125 The server is panicked if not. In release builds, just returns KErrNone. |
|
126 @param aCount The expected number of allocated heap cells. |
|
127 @return Error. |
|
128 */ |
|
129 IMPORT_C TInt __DbgCheckHeap(TInt aCount); |
|
130 |
|
131 /** |
|
132 Marks the end of heap cell checking. Checks that the number of heap cells |
|
133 allocated since the last __DbgMarkHeap() is aCount; the most common value |
|
134 to pass here is zero. In release builds, just returns KErrNone. |
|
135 @param aCount The expected number of allocated heap cells. |
|
136 @return Error. |
|
137 */ |
|
138 IMPORT_C TInt __DbgMarkEnd(TInt aCount); |
|
139 |
|
140 /** |
|
141 Simulates memory allocation failure in the server. In release builds, just |
|
142 returns KErrNone. |
|
143 @param aCount The number of allocations after which memory allocation |
|
144 should fail. |
|
145 @return Error. |
|
146 */ |
|
147 IMPORT_C TInt __DbgFailNext(TInt aCount); |
|
148 |
|
149 private: // owned |
|
150 /** |
|
151 Used by Send. |
|
152 */ |
|
153 TPckgBuf<TOperationInformation> iOpInfoPckg; |
|
154 |
|
155 /** |
|
156 Used by Receive. |
|
157 */ |
|
158 TPckg<TUint> iUidPckg; |
|
159 TPckg<TUint> iOpIdPckg; |
|
160 }; |
|
161 |
|
162 #endif // REMCONBULKCLIENT_H |