diff options
author | Serhii Voloshynov <serhii.voloshynov@globallogic.com> | 2020-02-28 10:49:45 +0200 |
---|---|---|
committer | Serhii Voloshynov <serhii.voloshynov@globallogic.com> | 2020-02-28 15:10:39 +0200 |
commit | 383d4a2f1f54c8adf8b1dd86baa7edd4440e76d4 (patch) | |
tree | 23221a439fdd3b1f0933d92f916fb196c0c7a898 | |
parent | 4d6fe7516f8469062a063cd36c6ceff0c6b446da (diff) | |
download | libmts-io-383d4a2f1f54c8adf8b1dd86baa7edd4440e76d4.tar.gz libmts-io-383d4a2f1f54c8adf8b1dd86baa7edd4440e76d4.tar.bz2 libmts-io-383d4a2f1f54c8adf8b1dd86baa7edd4440e76d4.zip |
fix unitialized m_eFlowControl and serial settings
-rw-r--r-- | src/MTS_IO_SerialConnection.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/MTS_IO_SerialConnection.cpp b/src/MTS_IO_SerialConnection.cpp index c91f5d5..a12a09b 100644 --- a/src/MTS_IO_SerialConnection.cpp +++ b/src/MTS_IO_SerialConnection.cpp @@ -50,6 +50,7 @@ SerialConnection::Builder::Builder(const std::string& sPortName) , m_eParity(OFF) , m_eDataBits(B8) , m_eStopBits(B1) +, m_eFlowControl(NONE) , m_bBuilt(false) { @@ -424,6 +425,7 @@ bool SerialConnection::doOpen(const int32_t& timeoutMillis) { } //Set Parity, Stop Bits, and Data Length + options.c_cflag &= ~(PARODD | PARENB); switch(m_eParity) { case ODD: options.c_cflag |= ( PARODD | PARENB ); @@ -434,8 +436,6 @@ bool SerialConnection::doOpen(const int32_t& timeoutMillis) { break; case OFF: - default: - options.c_cflag &= ~PARENB; break; } @@ -461,7 +461,7 @@ bool SerialConnection::doOpen(const int32_t& timeoutMillis) { switch(m_eStopBits) { case B2: - options.c_cflag &= CSTOPB; + options.c_cflag |= CSTOPB; break; case B1: @@ -472,11 +472,11 @@ bool SerialConnection::doOpen(const int32_t& timeoutMillis) { switch (m_eFlowControl) { case RTS_CTS: - options.c_cflag &= CRTSCTS; + options.c_cflag |= CRTSCTS; break; case NONE: default: - options.c_cflag &= ~(IXON | IXOFF | IXANY); + options.c_cflag &= ~CRTSCTS; break; } |