diff --git a/include/CppLinuxSerial/SerialPort.hpp b/include/CppLinuxSerial/SerialPort.hpp index 62eb88e..173166c 100644 --- a/include/CppLinuxSerial/SerialPort.hpp +++ b/include/CppLinuxSerial/SerialPort.hpp @@ -173,6 +173,10 @@ namespace mn { /// \throws CppLinuxSerial::Exception if state != OPEN. int32_t Available(); + /// \brief Use to get the state of the serial port + /// \returns The state of the serial port + State GetState(); + private: /// \brief Configures the tty device as a serial port. diff --git a/src/SerialPort.cpp b/src/SerialPort.cpp index bf168e8..e4595b3 100644 --- a/src/SerialPort.cpp +++ b/src/SerialPort.cpp @@ -638,6 +638,9 @@ namespace CppLinuxSerial { return ret; } + State SerialPort::GetState() { + return state_; + } } // namespace CppLinuxSerial } // namespace mn