Your image looks weird to me. You confused with terminology. F.e., DTR_CONTROL is the name of line (signal). It can be set to one of three states: DTR_CONTROL_DISABLE (0), DTR_CONTROL_ENABLE (1), and DTR_CONTROL_HANDSHAKE (auto switching). You have to read about RS232 control lines and flow controls, and this https://learn.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-dcb.
That is what the sniffer shows. My cunning plan is to make those routines once and forget about them. Anyway, here
https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddser/ns-ntddser-_serial_handflow the listed values are SERIAL_DTR_CONTROL and SERIAL_DTR_HANDSHAKE. But I assume
SERIAL_DTR_CONTROL and SERIAL_DTR_HANDSHAKE cannot both be equal to zero at the same time.Your help worked, I have now:
procedure SetHandFlow(HandFlow: THandFlow; var aLazSerial: TLazSerial);
begin
with aLazSerial.SynSer.DCB do
begin
Flags := dcb_Binary; //$00000001;
case HandFlow of
hfNone : Flags := Flags and not dcb_RtsControlEnable;
hfXonXoff : begin Flags := Flags or dcb_OutX or dcb_InX; Flags := Flags or dcb_DtrControlEnable; end;
hfDTR_DSR : Flags := Flags or dcb_DtrControlEnable;
hfRTS_CTS : Flags := Flags or dcb_OutxCtsFlow or dcb_RtsControlHandshake; //aka Hardware
hfXonXoff_and_RTS_CTS : begin Flags := Flags or dcb_OutX or dcb_InX; Flags := Flags or dcb_DtrControlEnable; Flags := Flags or dcb_OutxCtsFlow or dcb_RtsControlHandshake; end;
hfXonXoff_and_DTR_DSR : begin Flags := Flags or dcb_DtrControlHandshake or dcb_OutxDsrFlow or dcb_OutX or dcb_InX or dcb_RtsControlToggle; Flags := Flags and not dcb_RtsControlHandshake; end;
end; //case
end; //with
aLazSerial.SynSer.SetCommState;
end;
But it seems that everyone has a different idea about what DTR/DSR shall be.
I sniffed several terminal apps, two of them set it as:
SERIAL_DTR_HANDSHAKE = 1; SERIAL_DSR_HANDSHAKE =1; SERIAL_RTS_CONTROL = 1; everything else = 0.
One of them sets different values each time.
And another one sets SERIAL_DTR_CONTROL = 1; SERIAL_CTS_HANDSHAKE = 1; everything else = 0.
In order to connect to the multimeter I need SERIAL_DTR_CONTROL = 1; SERIAL_CTS_HANDSHAKE = *; everything else = 0;
Most terminal apps do not have this mode (once is named DTR/DSR, once is RS485, the multimeter is actually a regular RS232 on 9V).