bindings-cpp icon indicating copy to clipboard operation
bindings-cpp copied to clipboard

Control fOutxCtsFlow with flag

Open mishase opened this issue 2 years ago • 0 comments

💥 Proposal

What feature you'd like to see

I need to control dcb.fOutxCtsFlow (https://github.com/serialport/bindings-cpp/blob/main/src/serialport_win.cpp#L160) value with flag from serial port configuration. Now it's linked directly to rtscts configuration, so it can't be set to false in any way.

Pitch

I have some kind of very exotic serial device that requires dcb.fOutxCtsFlow to be set to false while dcb.fRtsControl is set to RTS_CONTROL_ENABLE. There are the only DCB parameters that works with my device:

dcb.BaudRate = CBR_9600;
dcb.ByteSize = 8;
dcb.StopBits = TWOSTOPBITS;

dcb.Parity = EVENPARITY;
dcb.fDtrControl = DTR_CONTROL_ENABLE;
dcb.fRtsControl = RTS_CONTROL_ENABLE;

dcb.EofChar = 0x0;
dcb.ErrorChar = 0x0;
    
dcb.fErrorChar = 0x0;
dcb.EvtChar = 0x0;
    
dcb.XonChar = 0x11;
dcb.XoffChar = 0x13;

dcb.fOutxCtsFlow = FALSE; // Can't be set to FALSE using serialport library
dcb.fOutX = FALSE;
dcb.XonLim = 2048;
dcb.XoffLim = 512;

So I'm getting the following packet when setting up serial communication:

IOCTL_SERIAL_SET_HANDFLOW: Set handshake information
  ControlHandShake=1
  FlowReplace=64
  XonLimit=2048
  XoffLimit=512

mishase avatar Apr 30 '23 12:04 mishase