| 2095 | } |
| 2096 | |
| 2097 | inline |
| 2098 | void |
| 2099 | SerialPort::Implementation::SetDefaultOutputModes() |
| 2100 | { |
| 2101 | // Make sure that the serial port is open. |
| 2102 | if (not this->IsOpen()) |
| 2103 | { |
| 2104 | throw NotOpen(ERR_MSG_PORT_NOT_OPEN) ; |
| 2105 | } |
| 2106 | |
| 2107 | // Get the current serial port settings. |
| 2108 | termios port_settings {} ; |
| 2109 | std::memset(&port_settings, 0, sizeof(port_settings)) ; |
| 2110 | |
| 2111 | if (tcgetattr(this->mFileDescriptor, |
| 2112 | &port_settings) < 0) |
| 2113 | { |
| 2114 | throw std::runtime_error(std::strerror(errno)) ; |
| 2115 | } |
| 2116 | |
| 2117 | port_settings.c_oflag = 0 ; |
| 2118 | |
| 2119 | // Apply the modified settings. |
| 2120 | if (tcsetattr(this->mFileDescriptor, |
| 2121 | TCSANOW, |
| 2122 | &port_settings) < 0) |
| 2123 | { |
| 2124 | throw OpenFailed(std::strerror(errno)) ; |
| 2125 | } |
| 2126 | } |
| 2127 | |
| 2128 | inline |
| 2129 | void |
nothing calls this directly
no test coverage detected