williamr@2
|
1 |
// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@2
|
4 |
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@2
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
// e32\include\d32comm.h
|
williamr@2
|
15 |
//
|
williamr@2
|
16 |
//
|
williamr@2
|
17 |
|
williamr@2
|
18 |
//#define _DEBUG_DEVCOMM
|
williamr@2
|
19 |
|
williamr@2
|
20 |
/**
|
williamr@2
|
21 |
@file
|
williamr@2
|
22 |
@publishedPartner
|
williamr@2
|
23 |
@released
|
williamr@2
|
24 |
*/
|
williamr@2
|
25 |
|
williamr@2
|
26 |
#ifndef __D32COMM_H__
|
williamr@2
|
27 |
#define __D32COMM_H__
|
williamr@2
|
28 |
#include <e32cmn.h>
|
williamr@2
|
29 |
#include <e32ver.h>
|
williamr@2
|
30 |
|
williamr@2
|
31 |
/**
|
williamr@2
|
32 |
Enumeration of number of data bits for serial port configuration.
|
williamr@2
|
33 |
Typically, these values are used to initialize the iDataBits of
|
williamr@2
|
34 |
TCommConfigV01 before calling DComm::Configure() or any other serial
|
williamr@2
|
35 |
comm API to configure the serial port's databits size.
|
williamr@2
|
36 |
*/
|
williamr@2
|
37 |
enum TDataBits {EData5,EData6,EData7,EData8};
|
williamr@2
|
38 |
/**
|
williamr@2
|
39 |
Enumeration of number of stop bits for serial port configuration.
|
williamr@2
|
40 |
Typically, these values are used to initialize the iStopBits of
|
williamr@2
|
41 |
TCommConfigV01 before calling DComm::Configure() or any other serial
|
williamr@2
|
42 |
comm API to configure the serial port's stopbits.
|
williamr@2
|
43 |
*/
|
williamr@2
|
44 |
enum TStopBits {EStop1,EStop2};
|
williamr@2
|
45 |
/**
|
williamr@2
|
46 |
Enumeration of types of parity for serial port configuration.
|
williamr@2
|
47 |
Typically, these values are used to initialize the iParity of
|
williamr@2
|
48 |
TCommConfigV01 before calling DComm::Configure() or any other serial
|
williamr@2
|
49 |
comm API to configure the serial port's parity setting.
|
williamr@2
|
50 |
*/
|
williamr@2
|
51 |
enum TParity {EParityNone,EParityEven,EParityOdd,EParityMark,EParitySpace};
|
williamr@2
|
52 |
/**
|
williamr@2
|
53 |
Enumeration of baud rates in bits per second for serial port configuration.
|
williamr@2
|
54 |
* e.g EBps115200 is for 115200Bps data rate
|
williamr@2
|
55 |
Typically, these values are used to initialize the iRate of TCommConfigV01
|
williamr@2
|
56 |
before calling DComm::Configure() or any other serial comm API to configure
|
williamr@2
|
57 |
the serial port's baud rate.
|
williamr@2
|
58 |
*/
|
williamr@2
|
59 |
enum TBps
|
williamr@2
|
60 |
{
|
williamr@2
|
61 |
EBps50,
|
williamr@2
|
62 |
EBps75,
|
williamr@2
|
63 |
EBps110,
|
williamr@2
|
64 |
EBps134,
|
williamr@2
|
65 |
EBps150,
|
williamr@2
|
66 |
EBps300,
|
williamr@2
|
67 |
EBps600,
|
williamr@2
|
68 |
EBps1200,
|
williamr@2
|
69 |
EBps1800,
|
williamr@2
|
70 |
EBps2000,
|
williamr@2
|
71 |
EBps2400,
|
williamr@2
|
72 |
EBps3600,
|
williamr@2
|
73 |
EBps4800,
|
williamr@2
|
74 |
EBps7200,
|
williamr@2
|
75 |
EBps9600,
|
williamr@2
|
76 |
EBps19200,
|
williamr@2
|
77 |
EBps38400,
|
williamr@2
|
78 |
EBps57600,
|
williamr@2
|
79 |
EBps115200,
|
williamr@2
|
80 |
EBps230400,
|
williamr@2
|
81 |
EBps460800,
|
williamr@2
|
82 |
EBps576000,
|
williamr@2
|
83 |
EBps1152000,
|
williamr@2
|
84 |
EBps4000000,
|
williamr@2
|
85 |
EBps921600,
|
williamr@2
|
86 |
EBpsAutobaud=0x40000000,
|
williamr@2
|
87 |
EBpsSpecial=0x80000000,
|
williamr@2
|
88 |
};
|
williamr@2
|
89 |
/**
|
williamr@2
|
90 |
Enumeration of Fifo status (enable and disable) for serial port configuration.
|
williamr@2
|
91 |
Typically, these values are used to initialize the iFifo of TCommConfigV01
|
williamr@2
|
92 |
before calling DComm::Configure() or any other serial comm API to configure
|
williamr@2
|
93 |
the serial port's fifo.
|
williamr@2
|
94 |
*/
|
williamr@2
|
95 |
enum TFifo
|
williamr@2
|
96 |
{
|
williamr@2
|
97 |
EFifoEnable,EFifoDisable,
|
williamr@2
|
98 |
};
|
williamr@2
|
99 |
/**
|
williamr@2
|
100 |
Enumeration of SIR status (enable and disable) for serial comm configuration.
|
williamr@2
|
101 |
Typically, these values are used to initialize the iSIREnable of TCommConfigV01
|
williamr@2
|
102 |
before calling DComm::Configure() or any other serial comm API to configure
|
williamr@2
|
103 |
the serial port's SIR (infrared) settings.
|
williamr@2
|
104 |
*/
|
williamr@2
|
105 |
enum TSir
|
williamr@2
|
106 |
{
|
williamr@2
|
107 |
ESIREnable,ESIRDisable,
|
williamr@2
|
108 |
};
|
williamr@2
|
109 |
|
williamr@2
|
110 |
enum TFlowControl
|
williamr@2
|
111 |
{
|
williamr@2
|
112 |
EFlowControlOn,EFlowControlOff
|
williamr@2
|
113 |
};
|
williamr@2
|
114 |
//
|
williamr@2
|
115 |
|
williamr@2
|
116 |
const TInt KConfigMaxTerminators=4;
|
williamr@2
|
117 |
// DTE Constants
|
williamr@2
|
118 |
const TUint KConfigObeyXoff=0x01;
|
williamr@2
|
119 |
const TUint KConfigSendXoff=0x02;
|
williamr@2
|
120 |
const TUint KConfigObeyCTS=0x04;
|
williamr@2
|
121 |
const TUint KConfigFailCTS=0x08;
|
williamr@2
|
122 |
const TUint KConfigObeyDSR=0x10;
|
williamr@2
|
123 |
const TUint KConfigFailDSR=0x20;
|
williamr@2
|
124 |
const TUint KConfigObeyDCD=0x40;
|
williamr@2
|
125 |
const TUint KConfigFailDCD=0x80;
|
williamr@2
|
126 |
const TUint KConfigFreeRTS=0x100;
|
williamr@2
|
127 |
const TUint KConfigFreeDTR=0x200;
|
williamr@2
|
128 |
// DCE Constants
|
williamr@2
|
129 |
const TUint KConfigObeyDTR=0x400;
|
williamr@2
|
130 |
const TUint KConfigFailDTR=0x800;
|
williamr@2
|
131 |
const TUint KConfigObeyRTS=0x1000;
|
williamr@2
|
132 |
const TUint KConfigFailRTS=0x2000;
|
williamr@2
|
133 |
const TUint KConfigFreeDSR=0x4000;
|
williamr@2
|
134 |
const TUint KConfigFreeCTS=0x8000;
|
williamr@2
|
135 |
const TUint KConfigFreeDCD=0x10000;
|
williamr@2
|
136 |
const TUint KConfigFreeRI=0x20000;
|
williamr@2
|
137 |
const TUint KConfigWriteBufferedComplete=0x80000000;
|
williamr@2
|
138 |
//
|
williamr@2
|
139 |
const TUint KConfigParityErrorFail=0;
|
williamr@2
|
140 |
const TUint KConfigParityErrorIgnore=0x01;
|
williamr@2
|
141 |
const TUint KConfigParityErrorReplaceChar=0x02;
|
williamr@2
|
142 |
const TUint KConfigXonXoffDebug=0x80000000;
|
williamr@2
|
143 |
//
|
williamr@2
|
144 |
const TUint KSignalCTS=0x01;
|
williamr@2
|
145 |
const TUint KSignalDSR=0x02;
|
williamr@2
|
146 |
const TUint KSignalDCD=0x04;
|
williamr@2
|
147 |
const TUint KSignalRNG=0x08;
|
williamr@2
|
148 |
const TUint KSignalRTS=0x10;
|
williamr@2
|
149 |
const TUint KSignalDTR=0x20;
|
williamr@2
|
150 |
const TUint KSignalBreak=0x40;
|
williamr@2
|
151 |
|
williamr@2
|
152 |
const TUint KSignalChanged=0x1000;
|
williamr@2
|
153 |
const TUint KCTSChanged=KSignalCTS*KSignalChanged;
|
williamr@2
|
154 |
const TUint KDSRChanged=KSignalDSR*KSignalChanged;
|
williamr@2
|
155 |
const TUint KDCDChanged=KSignalDCD*KSignalChanged;
|
williamr@2
|
156 |
const TUint KRNGChanged=KSignalRNG*KSignalChanged;
|
williamr@2
|
157 |
const TUint KRTSChanged=KSignalRTS*KSignalChanged;
|
williamr@2
|
158 |
const TUint KDTRChanged=KSignalDTR*KSignalChanged;
|
williamr@2
|
159 |
const TUint KBreakChanged=KSignalBreak*KSignalChanged;
|
williamr@2
|
160 |
|
williamr@2
|
161 |
const TUint KSignalDTEOutputs=KSignalRTS|KSignalDTR;
|
williamr@2
|
162 |
const TUint KSignalDTEInputs=KSignalCTS|KSignalDSR|KSignalDCD|KSignalRNG;
|
williamr@2
|
163 |
const TUint KSignalDCEInputs=KSignalDTEOutputs;
|
williamr@2
|
164 |
const TUint KSignalDCEOutputs=KSignalDTEInputs;
|
williamr@2
|
165 |
|
williamr@2
|
166 |
const TUint KConfigSIRPulseWidthMaximum=0x01;
|
williamr@2
|
167 |
const TUint KConfigSIRPulseWidthMinimum=0x02;
|
williamr@2
|
168 |
|
williamr@2
|
169 |
// more SIRSettings for selecting the IR range
|
williamr@2
|
170 |
const TUint KConfigSIRShutDown=0x10;
|
williamr@2
|
171 |
const TUint KConfigSIRMinimumRange=0x20;
|
williamr@2
|
172 |
const TUint KConfigSIRMediumRange=0x40;
|
williamr@2
|
173 |
const TUint KConfigSIRMaximumRange=0x80;
|
williamr@2
|
174 |
|
williamr@2
|
175 |
/**
|
williamr@2
|
176 |
Comms configuration structure.
|
williamr@2
|
177 |
Class to hold the configuration settings for serial comm port
|
williamr@2
|
178 |
|
williamr@2
|
179 |
This class provides the serial port configuration block interface of serial comms (c32).
|
williamr@2
|
180 |
A serial comm client sets up a serial port before use, by providing a configuration block.
|
williamr@2
|
181 |
TCommConfigV01 is initialized with settings for serial port and used to configure the
|
williamr@2
|
182 |
serial port by calling DComm::Configure(TCommConfigV01 &aConfig) or any other serial comm
|
williamr@2
|
183 |
API to configure the serial port.
|
williamr@2
|
184 |
*/
|
williamr@2
|
185 |
class TCommConfigV01
|
williamr@2
|
186 |
{
|
williamr@2
|
187 |
public:
|
williamr@2
|
188 |
/**
|
williamr@2
|
189 |
Data rate in bits per second.
|
williamr@2
|
190 |
@see TBps
|
williamr@2
|
191 |
*/
|
williamr@2
|
192 |
TBps iRate;
|
williamr@2
|
193 |
/**
|
williamr@2
|
194 |
Character width in bits.
|
williamr@2
|
195 |
@see TDataBits
|
williamr@2
|
196 |
*/
|
williamr@2
|
197 |
TDataBits iDataBits;
|
williamr@2
|
198 |
/**
|
williamr@2
|
199 |
Number of stop bits.
|
williamr@2
|
200 |
@see TStopBits
|
williamr@2
|
201 |
*/
|
williamr@2
|
202 |
TStopBits iStopBits;
|
williamr@2
|
203 |
/**
|
williamr@2
|
204 |
Type of parity.
|
williamr@2
|
205 |
@see TParity
|
williamr@2
|
206 |
*/
|
williamr@2
|
207 |
TParity iParity;
|
williamr@2
|
208 |
/**
|
williamr@2
|
209 |
Type of Handshaking control.
|
williamr@2
|
210 |
Possible values can be KConfigObeyXXX or KConfigSendXXX or KConfigFailXXX or KConfigFreeXXX
|
williamr@2
|
211 |
*/
|
williamr@2
|
212 |
TUint iHandshake;
|
williamr@2
|
213 |
/**
|
williamr@2
|
214 |
Type of error to generate on a parity failure.
|
williamr@2
|
215 |
Possible values can be KConfigParityErrorFail or KConfigParityErrorIgnore or KConfigParityErrorReplaceChar
|
williamr@2
|
216 |
*/
|
williamr@2
|
217 |
TUint iParityError;
|
williamr@2
|
218 |
/**
|
williamr@2
|
219 |
FIFO status, enabled or disabled.
|
williamr@2
|
220 |
@see TFifo
|
williamr@2
|
221 |
*/
|
williamr@2
|
222 |
TUint iFifo;
|
williamr@2
|
223 |
/**
|
williamr@2
|
224 |
Special data rate, not listed under TBps. Use this, when iRate is set to EBpsSpecial
|
williamr@2
|
225 |
*/
|
williamr@2
|
226 |
TInt iSpecialRate;
|
williamr@2
|
227 |
/**
|
williamr@2
|
228 |
Count of number of special characters used as terminators (<=KConfigMaxTerminators)
|
williamr@2
|
229 |
*/
|
williamr@2
|
230 |
TInt iTerminatorCount;
|
williamr@2
|
231 |
/**
|
williamr@2
|
232 |
Array of special characters which can be used as terminators
|
williamr@2
|
233 |
*/
|
williamr@2
|
234 |
TText8 iTerminator[KConfigMaxTerminators];
|
williamr@2
|
235 |
/**
|
williamr@2
|
236 |
Character used to signal the transmitter to resume sending when using XON/XOFF handshaking
|
williamr@2
|
237 |
i.e character used as XON - software flow control
|
williamr@2
|
238 |
*/
|
williamr@2
|
239 |
TText8 iXonChar;
|
williamr@2
|
240 |
/**
|
williamr@2
|
241 |
Character used to signal the transmitter to suspend sending when using XON/XOFF handshaking
|
williamr@2
|
242 |
i.e character used as XOFF - software flow control
|
williamr@2
|
243 |
*/
|
williamr@2
|
244 |
TText8 iXoffChar;
|
williamr@2
|
245 |
/**
|
williamr@2
|
246 |
Character used to replace the characters received with a parity error.
|
williamr@2
|
247 |
This is used when iParityError is set to KConfigParityErrorReplaceChar
|
williamr@2
|
248 |
*/
|
williamr@2
|
249 |
TText8 iParityErrorChar;
|
williamr@2
|
250 |
/**
|
williamr@2
|
251 |
Switch the SIR encoding hardware on and off.
|
williamr@2
|
252 |
@see TSir
|
williamr@2
|
253 |
*/
|
williamr@2
|
254 |
TSir iSIREnable;
|
williamr@2
|
255 |
/**
|
williamr@2
|
256 |
SIR hardware control setting. Possible value can be one of KConfigSIRXXX
|
williamr@2
|
257 |
*/
|
williamr@2
|
258 |
TUint iSIRSettings;
|
williamr@2
|
259 |
};
|
williamr@2
|
260 |
/**
|
williamr@2
|
261 |
Package buffer for a TCommConfigV01 object.
|
williamr@2
|
262 |
|
williamr@2
|
263 |
TCommConfig packages the comms configuration structure TCommConfigV01 to a buffer.
|
williamr@2
|
264 |
This is used with API of serial comms like RComm::Config(TDes8 &aConfig) and
|
williamr@2
|
265 |
RComm::SetConfig(TDesC8 &aConfig) where config structure is passed as buffer.
|
williamr@2
|
266 |
|
williamr@2
|
267 |
@see TCommConfigV01
|
williamr@2
|
268 |
*/
|
williamr@2
|
269 |
typedef TPckgBuf<TCommConfigV01> TCommConfig;
|
williamr@2
|
270 |
|
williamr@2
|
271 |
// TCommConfigV02 is deprecated.
|
williamr@2
|
272 |
//
|
williamr@2
|
273 |
class TCommConfigV02: public TCommConfigV01
|
williamr@2
|
274 |
{
|
williamr@2
|
275 |
public:
|
williamr@2
|
276 |
TInt iTxShutdownTimeout;
|
williamr@2
|
277 |
};
|
williamr@2
|
278 |
|
williamr@2
|
279 |
// TCommConfig2 is deprecated
|
williamr@2
|
280 |
//
|
williamr@2
|
281 |
typedef TPckgBuf<TCommConfigV02> TCommConfig2;
|
williamr@2
|
282 |
|
williamr@2
|
283 |
//
|
williamr@2
|
284 |
const TUint KCapsBps50=0x00000001;
|
williamr@2
|
285 |
const TUint KCapsBps75=0x00000002;
|
williamr@2
|
286 |
const TUint KCapsBps110=0x00000004;
|
williamr@2
|
287 |
const TUint KCapsBps134=0x00000008;
|
williamr@2
|
288 |
const TUint KCapsBps150=0x00000010;
|
williamr@2
|
289 |
const TUint KCapsBps300=0x00000020;
|
williamr@2
|
290 |
const TUint KCapsBps600=0x00000040;
|
williamr@2
|
291 |
const TUint KCapsBps1200=0x00000080;
|
williamr@2
|
292 |
const TUint KCapsBps1800=0x00000100;
|
williamr@2
|
293 |
const TUint KCapsBps2000=0x00000200;
|
williamr@2
|
294 |
const TUint KCapsBps2400=0x00000400;
|
williamr@2
|
295 |
const TUint KCapsBps3600=0x00000800;
|
williamr@2
|
296 |
const TUint KCapsBps4800=0x00001000;
|
williamr@2
|
297 |
const TUint KCapsBps7200=0x00002000;
|
williamr@2
|
298 |
const TUint KCapsBps9600=0x00004000;
|
williamr@2
|
299 |
const TUint KCapsBps19200=0x00008000;
|
williamr@2
|
300 |
const TUint KCapsBps38400=0x00010000;
|
williamr@2
|
301 |
const TUint KCapsBps57600=0x00020000;
|
williamr@2
|
302 |
const TUint KCapsBps115200=0x00040000;
|
williamr@2
|
303 |
const TUint KCapsBps230400=0x00080000;
|
williamr@2
|
304 |
const TUint KCapsBps460800=0x00100000;
|
williamr@2
|
305 |
const TUint KCapsBps576000 =0x00200000;
|
williamr@2
|
306 |
const TUint KCapsBps1152000=0x00400000;
|
williamr@2
|
307 |
const TUint KCapsBps4000000=0x00800000;
|
williamr@2
|
308 |
const TUint KCapsBps921600=0x01000000;
|
williamr@2
|
309 |
const TUint KCapsBpsAutobaud=0x40000000;
|
williamr@2
|
310 |
const TUint KCapsBpsSpecial=0x80000000;
|
williamr@2
|
311 |
//
|
williamr@2
|
312 |
const TUint KCapsData5=0x01;
|
williamr@2
|
313 |
const TUint KCapsData6=0x02;
|
williamr@2
|
314 |
const TUint KCapsData7=0x04;
|
williamr@2
|
315 |
const TUint KCapsData8=0x08;
|
williamr@2
|
316 |
//
|
williamr@2
|
317 |
const TUint KCapsStop1=0x01;
|
williamr@2
|
318 |
const TUint KCapsStop2=0x02;
|
williamr@2
|
319 |
//
|
williamr@2
|
320 |
const TUint KCapsParityNone=0x01;
|
williamr@2
|
321 |
const TUint KCapsParityEven=0x02;
|
williamr@2
|
322 |
const TUint KCapsParityOdd=0x04;
|
williamr@2
|
323 |
const TUint KCapsParityMark=0x08;
|
williamr@2
|
324 |
const TUint KCapsParitySpace=0x10;
|
williamr@2
|
325 |
//
|
williamr@2
|
326 |
const TUint KCapsSignalCTSSupported=0x01;
|
williamr@2
|
327 |
const TUint KCapsSignalDSRSupported=0x02;
|
williamr@2
|
328 |
const TUint KCapsSignalDCDSupported=0x04;
|
williamr@2
|
329 |
const TUint KCapsSignalRNGSupported=0x08;
|
williamr@2
|
330 |
const TUint KCapsSignalRTSSupported=0x10;
|
williamr@2
|
331 |
const TUint KCapsSignalDTRSupported=0x20;
|
williamr@2
|
332 |
//
|
williamr@2
|
333 |
const TUint KCapsObeyXoffSupported=0x01;
|
williamr@2
|
334 |
const TUint KCapsSendXoffSupported=0x02;
|
williamr@2
|
335 |
const TUint KCapsObeyCTSSupported=0x04;
|
williamr@2
|
336 |
const TUint KCapsFailCTSSupported=0x08;
|
williamr@2
|
337 |
const TUint KCapsObeyDSRSupported=0x10;
|
williamr@2
|
338 |
const TUint KCapsFailDSRSupported=0x20;
|
williamr@2
|
339 |
const TUint KCapsObeyDCDSupported=0x40;
|
williamr@2
|
340 |
const TUint KCapsFailDCDSupported=0x80;
|
williamr@2
|
341 |
const TUint KCapsFreeRTSSupported=0x100;
|
williamr@2
|
342 |
const TUint KCapsFreeDTRSupported=0x200;
|
williamr@2
|
343 |
// DCE Constants
|
williamr@2
|
344 |
const TUint KCapsObeyRTSSupported=0x400;
|
williamr@2
|
345 |
const TUint KCapsObeyDTRSupported=0x800;
|
williamr@2
|
346 |
//
|
williamr@2
|
347 |
const TUint KCapsHasFifo=0x01;
|
williamr@2
|
348 |
//
|
williamr@2
|
349 |
const TUint KCapsSIR115kbps=0x01;
|
williamr@2
|
350 |
const TUint KCapsSIR2400bpsOnly=0x02;
|
williamr@2
|
351 |
const TUint KCapsSIR4Mbs=0x04;
|
williamr@2
|
352 |
//
|
williamr@2
|
353 |
const TUint KNotifySignalsChangeSupported=0x01;
|
williamr@2
|
354 |
const TUint KNotifyRateChangeSupported=0x02;
|
williamr@2
|
355 |
const TUint KNotifyDataFormatChangeSupported=0x04;
|
williamr@2
|
356 |
const TUint KNotifyHandshakeChangeSupported=0x08;
|
williamr@2
|
357 |
const TUint KNotifyBreakSupported=0x10;
|
williamr@2
|
358 |
const TUint KNotifyFlowControlChangeSupported=0x20;
|
williamr@2
|
359 |
const TUint KNotifyDataAvailableSupported=0x40;
|
williamr@2
|
360 |
const TUint KNotifyOutputEmptySupported=0x80;
|
williamr@2
|
361 |
//
|
williamr@2
|
362 |
const TUint KCapsRoleSwitchSupported=0x01;
|
williamr@2
|
363 |
//
|
williamr@2
|
364 |
const TUint KCapsFlowControlStatusSupported=0x01;
|
williamr@2
|
365 |
//
|
williamr@2
|
366 |
const TUint KRateChanged=0x01;
|
williamr@2
|
367 |
const TUint KDataFormatChanged=0x02;
|
williamr@2
|
368 |
const TUint KHandshakeChanged=0x04;
|
williamr@2
|
369 |
//
|
williamr@2
|
370 |
class TCommCapsV01
|
williamr@2
|
371 |
{
|
williamr@2
|
372 |
public:
|
williamr@2
|
373 |
TUint iRate;
|
williamr@2
|
374 |
TUint iDataBits;
|
williamr@2
|
375 |
TUint iStopBits;
|
williamr@2
|
376 |
TUint iParity;
|
williamr@2
|
377 |
TUint iHandshake;
|
williamr@2
|
378 |
TUint iSignals;
|
williamr@2
|
379 |
TUint iFifo;
|
williamr@2
|
380 |
TUint iSIR;
|
williamr@2
|
381 |
};
|
williamr@2
|
382 |
typedef TPckgBuf<TCommCapsV01> TCommCaps;
|
williamr@2
|
383 |
|
williamr@2
|
384 |
class TCommCapsV02 : public TCommCapsV01
|
williamr@2
|
385 |
{
|
williamr@2
|
386 |
public:
|
williamr@2
|
387 |
TUint iNotificationCaps;
|
williamr@2
|
388 |
TUint iRoleCaps;
|
williamr@2
|
389 |
TUint iFlowControlCaps;
|
williamr@2
|
390 |
};
|
williamr@2
|
391 |
typedef TPckgBuf<TCommCapsV02> TCommCaps2;
|
williamr@2
|
392 |
|
williamr@2
|
393 |
class TCommCapsV03 : public TCommCapsV02
|
williamr@2
|
394 |
{
|
williamr@2
|
395 |
public:
|
williamr@2
|
396 |
TBool iBreakSupported;
|
williamr@2
|
397 |
};
|
williamr@2
|
398 |
typedef TPckgBuf<TCommCapsV03> TCommCaps3;
|
williamr@2
|
399 |
|
williamr@2
|
400 |
//
|
williamr@2
|
401 |
class TCapsDevCommV01
|
williamr@2
|
402 |
{
|
williamr@2
|
403 |
public:
|
williamr@2
|
404 |
TVersion version;
|
williamr@2
|
405 |
};
|
williamr@2
|
406 |
|
williamr@2
|
407 |
class TCommNotificationV01
|
williamr@2
|
408 |
{
|
williamr@2
|
409 |
public:
|
williamr@2
|
410 |
TUint iChangedMembers;
|
williamr@2
|
411 |
TBps iRate;
|
williamr@2
|
412 |
TDataBits iDataBits;
|
williamr@2
|
413 |
TStopBits iStopBits;
|
williamr@2
|
414 |
TParity iParity;
|
williamr@2
|
415 |
TUint iHandshake;
|
williamr@2
|
416 |
};
|
williamr@2
|
417 |
typedef TPckgBuf<TCommNotificationV01> TCommNotificationPckg;
|
williamr@2
|
418 |
//
|
williamr@2
|
419 |
const TUint KDataAvailableNotifyFlag=0x80000000;
|
williamr@2
|
420 |
//
|
williamr@2
|
421 |
#ifdef _DEBUG_DEVCOMM
|
williamr@2
|
422 |
class TCommDebugInfo
|
williamr@2
|
423 |
{
|
williamr@2
|
424 |
public:
|
williamr@2
|
425 |
TBool iRxBusy;
|
williamr@2
|
426 |
TBool iRxHeld;
|
williamr@2
|
427 |
TInt iRxLength;
|
williamr@2
|
428 |
TInt iRxOffset;
|
williamr@2
|
429 |
TInt iRxIntCount;
|
williamr@2
|
430 |
TInt iRxErrCount;
|
williamr@2
|
431 |
TInt iRxBufCount;
|
williamr@2
|
432 |
TBool iTxBusy;
|
williamr@2
|
433 |
TBool iTxHeld;
|
williamr@2
|
434 |
TInt iTxLength;
|
williamr@2
|
435 |
TInt iTxOffset;
|
williamr@2
|
436 |
TInt iTxIntCount;
|
williamr@2
|
437 |
TInt iTxErrCount;
|
williamr@2
|
438 |
TInt iTxBufCount;
|
williamr@2
|
439 |
TBool iDrainingRxBuf;
|
williamr@2
|
440 |
TBool iFillingTxBuf;
|
williamr@2
|
441 |
TBool iRunningDfc;
|
williamr@2
|
442 |
TInt iDfcCount;
|
williamr@2
|
443 |
TInt iDfcReqSeq;
|
williamr@2
|
444 |
TInt iDfcHandlerSeq;
|
williamr@2
|
445 |
TInt iDoDrainSeq;
|
williamr@2
|
446 |
TBool iTxDfcPend;
|
williamr@2
|
447 |
TBool iRxDfcPend;
|
williamr@2
|
448 |
TInt iTxChars, iRxChars;
|
williamr@2
|
449 |
TInt iTxXon, iTxXoff, iRxXon, iRxXoff;
|
williamr@2
|
450 |
};
|
williamr@2
|
451 |
typedef TPckgBuf<TCommDebugInfo> TCommDebugInfoPckg;
|
williamr@2
|
452 |
#endif
|
williamr@2
|
453 |
//
|
williamr@2
|
454 |
class RBusDevComm : public RBusLogicalChannel
|
williamr@2
|
455 |
{
|
williamr@2
|
456 |
public:
|
williamr@2
|
457 |
enum TVer {EMajorVersionNumber=1,EMinorVersionNumber=0,EBuildVersionNumber=KE32BuildVersionNumber};
|
williamr@2
|
458 |
enum TRequest
|
williamr@2
|
459 |
{
|
williamr@2
|
460 |
ERequestRead=0x0,ERequestReadCancel=0x1,
|
williamr@2
|
461 |
ERequestWrite=0x1,ERequestWriteCancel=0x2,
|
williamr@2
|
462 |
ERequestBreak=0x2,ERequestBreakCancel=0x4,
|
williamr@2
|
463 |
ERequestNotifySignalChange=0x3,ERequestNotifySignalChangeCancel=0x8,
|
williamr@2
|
464 |
};
|
williamr@2
|
465 |
enum TControl
|
williamr@2
|
466 |
{
|
williamr@2
|
467 |
EControlConfig,EControlSetConfig,EControlCaps,
|
williamr@2
|
468 |
EControlSignals,EControlSetSignals,
|
williamr@2
|
469 |
EControlQueryReceiveBuffer,EControlResetBuffers,
|
williamr@2
|
470 |
EControlReceiveBufferLength,EControlSetReceiveBufferLength,
|
williamr@2
|
471 |
EControlMinTurnaroundTime,EControlSetMinTurnaroundTime,
|
williamr@2
|
472 |
#ifdef _DEBUG_DEVCOMM
|
williamr@2
|
473 |
EControlDebugInfo
|
williamr@2
|
474 |
#endif
|
williamr@2
|
475 |
};
|
williamr@2
|
476 |
public:
|
williamr@2
|
477 |
#ifndef __KERNEL_MODE__
|
williamr@2
|
478 |
inline TInt Open(TInt aUnit);
|
williamr@2
|
479 |
inline TVersion VersionRequired() const;
|
williamr@2
|
480 |
inline void Read(TRequestStatus &aStatus,TDes8 &aDes);
|
williamr@2
|
481 |
inline void Read(TRequestStatus &aStatus,TDes8 &aDes,TInt aLength);
|
williamr@2
|
482 |
inline void ReadOneOrMore(TRequestStatus &aStatus,TDes8 &aDes);
|
williamr@2
|
483 |
inline void ReadCancel();
|
williamr@2
|
484 |
inline void Write(TRequestStatus &aStatus,const TDesC8 &aDes);
|
williamr@2
|
485 |
inline void Write(TRequestStatus &aStatus,const TDesC8 &aDes,TInt aLength);
|
williamr@2
|
486 |
inline void WriteCancel();
|
williamr@2
|
487 |
inline void Break(TRequestStatus &aStatus,TInt aTime);
|
williamr@2
|
488 |
inline void BreakCancel();
|
williamr@2
|
489 |
inline void Config(TDes8 &aConfig);
|
williamr@2
|
490 |
inline TInt SetConfig(const TDesC8 &aConfig);
|
williamr@2
|
491 |
inline void Caps(TDes8 &aCaps);
|
williamr@2
|
492 |
inline TUint Signals();
|
williamr@2
|
493 |
inline void SetSignals(TUint aSetMask,TUint aClearMask);
|
williamr@2
|
494 |
inline TInt QueryReceiveBuffer();
|
williamr@2
|
495 |
inline void ResetBuffers();
|
williamr@2
|
496 |
inline TInt ReceiveBufferLength();
|
williamr@2
|
497 |
inline TInt SetReceiveBufferLength(TInt aLength);
|
williamr@2
|
498 |
inline void NotifySignalChange(TRequestStatus& aStatus,TUint& aSignals,TUint aSignalMask=0x3F);
|
williamr@2
|
499 |
inline void NotifySignalChangeCancel();
|
williamr@2
|
500 |
inline void NotifyReceiveDataAvailable(TRequestStatus& aStatus);
|
williamr@2
|
501 |
inline void NotifyReceiveDataAvailableCancel();
|
williamr@2
|
502 |
inline TUint MinTurnaroundTime();
|
williamr@2
|
503 |
inline TInt SetMinTurnaroundTime(TUint aMicroSeconds);
|
williamr@2
|
504 |
#ifdef _DEBUG_DEVCOMM
|
williamr@2
|
505 |
inline void DebugInfo(TDes8 &aInfo);
|
williamr@2
|
506 |
#endif
|
williamr@2
|
507 |
#endif
|
williamr@2
|
508 |
};
|
williamr@2
|
509 |
|
williamr@2
|
510 |
class RBusDevCommDCE : public RBusLogicalChannel
|
williamr@2
|
511 |
{
|
williamr@2
|
512 |
public:
|
williamr@2
|
513 |
enum TVer {EMajorVersionNumber=1,EMinorVersionNumber=0,EBuildVersionNumber=KE32BuildVersionNumber};
|
williamr@2
|
514 |
enum TRequest
|
williamr@2
|
515 |
{
|
williamr@2
|
516 |
ERequestRead=0x0,ERequestReadCancel=0x1,
|
williamr@2
|
517 |
ERequestWrite=0x1,ERequestWriteCancel=0x2,
|
williamr@2
|
518 |
ERequestBreak=0x2,ERequestBreakCancel=0x4,
|
williamr@2
|
519 |
ERequestNotifySignalChange=0x3,ERequestNotifySignalChangeCancel=0x8,
|
williamr@2
|
520 |
ERequestNotifyFlowControlChange=0x4,ERequestNotifyFlowControlChangeCancel=0x10,
|
williamr@2
|
521 |
ERequestNotifyConfigChange=0x5,ERequestNotifyConfigChangeCancel=0x20
|
williamr@2
|
522 |
};
|
williamr@2
|
523 |
enum TControl
|
williamr@2
|
524 |
{
|
williamr@2
|
525 |
EControlConfig,EControlSetConfig,EControlCaps,
|
williamr@2
|
526 |
EControlSignals,EControlSetSignals,
|
williamr@2
|
527 |
EControlQueryReceiveBuffer,EControlResetBuffers,
|
williamr@2
|
528 |
EControlReceiveBufferLength,EControlSetReceiveBufferLength,
|
williamr@2
|
529 |
EControlFlowControlStatus,
|
williamr@2
|
530 |
#ifdef _DEBUG_DEVCOMM
|
williamr@2
|
531 |
EControlDebugInfo
|
williamr@2
|
532 |
#endif
|
williamr@2
|
533 |
};
|
williamr@2
|
534 |
public:
|
williamr@2
|
535 |
#ifndef __KERNEL_MODE__
|
williamr@2
|
536 |
inline TInt Open(TInt aUnit);
|
williamr@2
|
537 |
inline TVersion VersionRequired() const;
|
williamr@2
|
538 |
inline void Read(TRequestStatus &aStatus,TDes8 &aDes);
|
williamr@2
|
539 |
inline void Read(TRequestStatus &aStatus,TDes8 &aDes,TInt aLength);
|
williamr@2
|
540 |
inline void ReadOneOrMore(TRequestStatus &aStatus,TDes8 &aDes);
|
williamr@2
|
541 |
inline void ReadCancel();
|
williamr@2
|
542 |
inline void Write(TRequestStatus &aStatus,const TDesC8 &aDes);
|
williamr@2
|
543 |
inline void Write(TRequestStatus &aStatus,const TDesC8 &aDes,TInt aLength);
|
williamr@2
|
544 |
inline void WriteCancel();
|
williamr@2
|
545 |
inline void Break(TRequestStatus &aStatus,TInt aTime);
|
williamr@2
|
546 |
inline void BreakCancel();
|
williamr@2
|
547 |
inline void Config(TDes8 &aConfig);
|
williamr@2
|
548 |
inline TInt SetConfig(const TDesC8 &aConfig);
|
williamr@2
|
549 |
inline void Caps(TDes8 &aCaps);
|
williamr@2
|
550 |
inline TUint Signals();
|
williamr@2
|
551 |
inline void SetSignals(TUint aSetMask,TUint aClearMask);
|
williamr@2
|
552 |
inline TInt QueryReceiveBuffer();
|
williamr@2
|
553 |
inline void ResetBuffers();
|
williamr@2
|
554 |
inline TInt ReceiveBufferLength();
|
williamr@2
|
555 |
inline TInt SetReceiveBufferLength(TInt aLength);
|
williamr@2
|
556 |
inline void NotifySignalChange(TRequestStatus& aStatus,TUint& aSignals,TUint aSignalMask=0x3F);
|
williamr@2
|
557 |
inline void NotifySignalChangeCancel();
|
williamr@2
|
558 |
inline void NotifyReceiveDataAvailable(TRequestStatus& aStatus);
|
williamr@2
|
559 |
inline void NotifyReceiveDataAvailableCancel();
|
williamr@2
|
560 |
inline void NotifyFlowControlChange(TRequestStatus& aStatus);
|
williamr@2
|
561 |
inline void NotifyFlowControlChangeCancel();
|
williamr@2
|
562 |
inline void GetFlowControlStatus(TFlowControl& aFlowControl);
|
williamr@2
|
563 |
inline void NotifyConfigChange(TRequestStatus& aStatus, TDes8& aNewConfig);
|
williamr@2
|
564 |
inline void NotifyConfigChangeCancel();
|
williamr@2
|
565 |
#ifdef _DEBUG_DEVCOMM
|
williamr@2
|
566 |
inline void DebugInfo(TDes8 &aInfo);
|
williamr@2
|
567 |
#endif
|
williamr@2
|
568 |
#endif
|
williamr@2
|
569 |
};
|
williamr@2
|
570 |
|
williamr@2
|
571 |
#include <d32comm.inl>
|
williamr@2
|
572 |
#endif
|