diff --git a/include/CppLinuxSerial/SerialPort.hpp b/include/CppLinuxSerial/SerialPort.hpp index 62eb88e..3d7d3f0 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..e9b9a17 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