Export (0) Print
Expand All

DCB (Windows CE 5.0)

Windows CE 5.0
Send Feedback

This structure defines the control setting for a serial communications device.

typedef struct _DCB {
  DWORD DCBlength;
  DWORD BaudRate; 
  DWORD fBinary :1;
  DWORD fParity :1;
  DWORD fOutxCtsFlow :1;
  DWORD fOutxDsrFlow :1;
  DWORD fDtrControl :2;
  DWORD fDsrSensitivity :1;
  DWORD fTXContinueOnXoff :1;
  DWORD fOutX :1;
  DWORD fInX :1;
  DWORD fErrorChar :1;
  DWORD fNull :1; 
  DWORD fRtsControl :2; 
  DWORD fAbortOnError :1;
  DWORD fDummy2 :17;
  WORD wReserved;
  WORD XonLim; 
  WORD XoffLim;  
  BYTE ByteSize; 
  BYTE Parity; 
  BYTE StopBits;
  char XonChar; 
  char XoffChar; 
  char ErrorChar;
  char EofChar; 
  char EvtChar; 
  WORD wReserved1; 
} DCB, *LPDCB; 

Members

DCBlength
Specifies the DCB structure length, in bytes.
BaudRate
Specifies the baud rate at which the communication device operates.

It is an actual baud rate value, or one of the following baud rate indexes:

  • CBR_110
  • CBR_300
  • CBR_600
  • CBR_1200
  • CBR_2400
  • CBR_4800
  • CBR_9600
  • CBR_14400
  • CBR_19200
  • CBR_38400
  • CBR_56000
  • CBR_57600
  • CBR_115200
  • CBR_128000
  • CBR_256000
fBinary
Specifies if binary mode is enabled.

The Microsoft® Win32® API does not support nonbinary mode transfers, so this member must be TRUE.

Using FALSE does not work.

fParity
Specifies if parity checking is enabled.

If this member is TRUE, parity checking is performed and errors are reported.

fOutxCtsFlow
Specifies if the CTS (clear-to-send) signal is monitored for output flow control.

If this member is TRUE and CTS is turned off, output is suspended until CTS is sent again.

fOutxDsrFlow
Specifies if the DSR (data-set-ready) signal is monitored for output flow control.

If this member is TRUE and DSR is turned off, output is suspended until DSR is sent again.

fDtrControl
Specifies the DTR (data-terminal-ready) flow control.

The following values are possible for this member.

ValueDescription
DTR_CONTROL_DISABLEDisables the DTR line when the device is opened and leaves it disabled.
DTR_CONTROL_ENABLEEnables the DTR line when the device is opened and leaves it on.
DTR_CONTROL_HANDSHAKEEnables DTR handshaking.

If handshaking is enabled, it is an error for the application to adjust the line by using the EscapeCommFunction function.

fDsrSensitivity
Specifies if the communications driver is sensitive to the state of the DSR signal.

If this member is TRUE, the driver ignores bytes received, unless the DSR modem input line is high.

fTXContinueOnXoff
Specifies if transmission stops when the input buffer is full and the driver has transmitted the XoffChar character.

If this member is TRUE, transmission continues after the input buffer has come within XoffLim bytes of being full and the driver has transmitted the XoffChar character to stop receiving bytes.

If this member is FALSE, transmission does not continue until the input buffer is within XonLim bytes of being empty and the driver has transmitted the XonChar character to resume reception.

fOutX
Specifies if XON/XOFF flow control is used during transmission.

If this member is TRUE, transmission stops when the XoffChar character is received and starts again when the XonChar character is received.

fInX
Specifies if XON/XOFF flow control is used during reception.

If this member is TRUE, the XoffChar character is sent when the input buffer comes within XoffLim bytes of being full, and the XonChar character is sent when the input buffer comes within XonLim bytes of being empty.

fErrorChar
Specifies if bytes received with parity errors are replaced with the character specified by the ErrorChar member.

If this member is TRUE and the fParity member is TRUE, replacement occurs.

fNull
Specifies if null bytes are discarded.

If this member is TRUE, null bytes are discarded when received.

fRtsControl
Specifies the RTS (request-to-send) flow control.

If this value is zero, the default is RTS_CONTROL_HANDSHAKE.

The following values are possible for this member.

ValueDescription
RTS_CONTROL_DISABLEDisables the RTS line when the device is opened and leaves it disabled.
RTS_CONTROL_ENABLEEnables the RTS line when the device is opened and leaves it on.
RTS_CONTROL_HANDSHAKEEnables RTS handshaking.

The driver raises the RTS line when the type-ahead (input) buffer is less than half full and lowers the RTS line when the buffer is more than three-quarters full.

If handshaking is enabled, it is an error for the application to adjust the line by using the EscapeCommFunction function.

RTS_CONTROL_TOGGLESpecifies that the RTS line is high if bytes are available for transmission.

After all buffered bytes are sent, the RTS line is low.

fAbortOnError
Specifies if read and write operations are terminated if an error occurs.

If this member is TRUE, the driver terminates all read and write operations with an error status if an error occurs.

The driver does not accept further communications operations until the application acknowledges the error by calling the ClearCommError function.

fDummy2
Reserved; do not use.
wReserved
Not used; set to zero.
XonLim
Specifies the minimum number of bytes accepted in the input buffer before the XON character is sent.
XoffLim
Specifies the maximum number of bytes accepted in the input buffer before the XOFF character is sent.

The maximum number of bytes accepted is calculated by subtracting this value from the size, in bytes, of the input buffer.

ByteSize
Specifies the number of bits in the bytes transmitted and received.
Parity
Specifies the parity scheme to be used.

The following values are possible for this member.

ValueDescription
EVENPARITYEven
MARKPARITYMark
NOPARITYNo parity
ODDPARITYOdd
SPACEPARITYSpace
StopBits
Specifies the number of stop bits to be used.

The following values are possible for this member.

ValueDescription
ONESTOPBIT1 stop bit
ONE5STOPBITS1.5 stop bits
TWOSTOPBITS2 stop bits
XonChar
Specifies the value of the XON character for both transmission and reception.
XoffChar
Specifies the value of the XOFF character for both transmission and reception.
ErrorChar
Specifies the value of the character used to replace bytes received with a parity error.
EofChar
Specifies the value of the character used to signal the end of data.
EvtChar
Specifies the value of the character used to signal an event.
wReserved1
Reserved; do not use.

Remarks

For device driver developers: the COM_Open function in the sample serial port PDD driver does not support the fAbortOnChar member of the DCB structure. You must add support for this functionality in your PDD layer, if appropriate for your serial port hardware.

The sample serial port PDD driver is in the %_WINCEROOT%\Public\Common\Oak\Drivers\Serial directory.

All directories under the Serial folder contain sample serial PDD drivers except for the COM_MDD and COM_MDD2 folders.

Requirements

OS Versions: Windows CE 1.0 and later.
Header: Winbase.h.

See Also

ClearCommError | EscapeCommFunction | GetCommState | SetCommState


Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.


Show:
© 2014 Microsoft