Commit e1a7d9347a3fb5169ee093cc4a7c2994d4de2df0
1 parent
eb5698ae
Renamed method to get num. of RX bytes to 'Available'. Updated CHANGELOG.
Showing
3 changed files
with
10 additions
and
6 deletions
CHANGELOG.md
| ... | ... | @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. |
| 5 | 5 | The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) |
| 6 | 6 | and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). |
| 7 | 7 | |
| 8 | +## [v2.4.0] - 2022-02-12 | |
| 9 | + | |
| 10 | +- Added `Available()` method to return number of bytes ready to be read from the receive buffer (thanks lotricekCZ). | |
| 11 | +- Added CMake option for shared library (thanks lotricekCZ). | |
| 12 | + | |
| 8 | 13 | ## [v2.3.0] - 2021-12-23 |
| 9 | 14 | |
| 10 | 15 | - Added support for setting the num. data bits. | ... | ... |
include/CppLinuxSerial/SerialPort.hpp
| ... | ... | @@ -168,13 +168,12 @@ namespace mn { |
| 168 | 168 | /// \throws CppLinuxSerial::Exception if state != OPEN. |
| 169 | 169 | void ReadBinary(std::vector<uint8_t>& data); |
| 170 | 170 | |
| 171 | - /// \brief Use to get number of bytes available in buffer | |
| 171 | + /// \brief Use to get number of bytes available in receive buffer. | |
| 172 | + /// \returns The number of bytes available in the receive buffer (ready to be read). | |
| 172 | 173 | /// \throws CppLinuxSerial::Exception if state != OPEN. |
| 173 | - int32_t InWaiting(); | |
| 174 | - private: | |
| 174 | + int32_t Available(); | |
| 175 | 175 | |
| 176 | - /// \brief Returns a populated termios structure for the passed in file descriptor. | |
| 177 | - // termios GetTermios(); | |
| 176 | + private: | |
| 178 | 177 | |
| 179 | 178 | /// \brief Configures the tty device as a serial port. |
| 180 | 179 | /// \warning Device must be open (valid file descriptor) when this is called. | ... | ... |
src/SerialPort.cpp
| ... | ... | @@ -630,7 +630,7 @@ namespace CppLinuxSerial { |
| 630 | 630 | timeout_ms_ = timeout_ms; |
| 631 | 631 | } |
| 632 | 632 | |
| 633 | - int32_t SerialPort::InWaiting() { | |
| 633 | + int32_t SerialPort::Available() { | |
| 634 | 634 | if(state_ != State::OPEN) |
| 635 | 635 | THROW_EXCEPT(std::string() + __PRETTY_FUNCTION__ + " called but state != OPEN. Please call Open() first."); |
| 636 | 636 | int32_t ret = 0; | ... | ... |