MCPcopy Create free account
hub / github.com/crayzeewulf/libserial / SetDefaultInputModes

Method SetDefaultInputModes

src/SerialPort.cpp:2065–2095  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

NotOpenClass · 0.85
OpenFailedClass · 0.85
IsOpenMethod · 0.45

Tested by

no test coverage detected