1
0
mirror of https://github.com/wjwwood/serial.git synced 2026-01-22 19:54:57 +08:00

implement flushInput and flushOutput for windows (#153)

This commit is contained in:
Ben Moyer 2018-01-13 12:15:36 -08:00 committed by William Woodall
parent ce085ce88c
commit 534141aa8f

View File

@ -471,13 +471,19 @@ Serial::SerialImpl::flush ()
void void
Serial::SerialImpl::flushInput () Serial::SerialImpl::flushInput ()
{ {
THROW (IOException, "flushInput is not supported on Windows."); if (is_open_ == false) {
throw PortNotOpenedException("Serial::flushInput");
}
PurgeComm(fd_, PURGE_RXCLEAR);
} }
void void
Serial::SerialImpl::flushOutput () Serial::SerialImpl::flushOutput ()
{ {
THROW (IOException, "flushOutput is not supported on Windows."); if (is_open_ == false) {
throw PortNotOpenedException("Serial::flushOutput");
}
PurgeComm(fd_, PURGE_TXCLEAR);
} }
void void