mirror of
https://github.com/wjwwood/serial.git
synced 2026-01-22 19:54:57 +08:00
Fix: only set timeout for handle instead of reconfiguring the com port
This commit is contained in:
parent
21c6e32255
commit
02654f03eb
@ -427,7 +427,17 @@ Serial::SerialImpl::setTimeout (serial::Timeout &timeout)
|
|||||||
{
|
{
|
||||||
timeout_ = timeout;
|
timeout_ = timeout;
|
||||||
if (is_open_) {
|
if (is_open_) {
|
||||||
reconfigurePort ();
|
//reconfigurePort ();
|
||||||
|
// Setup timeouts
|
||||||
|
COMMTIMEOUTS timeouts = { 0 };
|
||||||
|
timeouts.ReadIntervalTimeout = timeout_.inter_byte_timeout;
|
||||||
|
timeouts.ReadTotalTimeoutConstant = timeout_.read_timeout_constant;
|
||||||
|
timeouts.ReadTotalTimeoutMultiplier = timeout_.read_timeout_multiplier;
|
||||||
|
timeouts.WriteTotalTimeoutConstant = timeout_.write_timeout_constant;
|
||||||
|
timeouts.WriteTotalTimeoutMultiplier = timeout_.write_timeout_multiplier;
|
||||||
|
if (!SetCommTimeouts(fd_, &timeouts)) {
|
||||||
|
THROW(IOException, "Error setting timeouts.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user