Skip to content

Commit

Permalink
implement flushInput and flushOutput for windows (wjwwood#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmoyer authored and wjwwood committed Jan 13, 2018
1 parent ce085ce commit 534141a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/impl/win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -471,13 +471,19 @@ Serial::SerialImpl::flush ()
void
Serial::SerialImpl::flushInput ()
{
THROW (IOException, "flushInput is not supported on Windows.");
if (is_open_ == false) {
throw PortNotOpenedException("Serial::flushInput");
}
PurgeComm(fd_, PURGE_RXCLEAR);
}

void
Serial::SerialImpl::flushOutput ()
{
THROW (IOException, "flushOutput is not supported on Windows.");
if (is_open_ == false) {
throw PortNotOpenedException("Serial::flushOutput");
}
PurgeComm(fd_, PURGE_TXCLEAR);
}

void
Expand Down

0 comments on commit 534141a

Please sign in to comment.