| 2063 | } |
| 2064 | |
| 2065 | inline |
| 2066 | void |
| 2067 | SerialPort::Implementation::SetDefaultInputModes() |
| 2068 | { |
| 2069 | // Make sure that the serial port is open. |
| 2070 | if (not this->IsOpen()) |
| 2071 | { |
| 2072 | throw NotOpen(ERR_MSG_PORT_NOT_OPEN) ; |
| 2073 | } |
| 2074 | |
| 2075 | // Get the current serial port settings. |
| 2076 | termios port_settings {} ; |
| 2077 | std::memset(&port_settings, 0, sizeof(port_settings)) ; |
| 2078 | |
| 2079 | if (tcgetattr(this->mFileDescriptor, |
| 2080 | &port_settings) < 0) |
| 2081 | { |
| 2082 | throw std::runtime_error(std::strerror(errno)) ; |
| 2083 | } |
| 2084 | |
| 2085 | // Ignore Break conditions on input. |
| 2086 | port_settings.c_iflag = IGNBRK ; |
| 2087 | |
| 2088 | // Apply the modified settings. |
| 2089 | if (tcsetattr(this->mFileDescriptor, |
| 2090 | TCSANOW, |
| 2091 | &port_settings) < 0) |
| 2092 | { |
| 2093 | throw OpenFailed(std::strerror(errno)) ; |
| 2094 | } |
| 2095 | } |
| 2096 | |
| 2097 | inline |
| 2098 | void |
nothing calls this directly
no test coverage detected