Skip to content

Commit cdab6e5

Browse files
committed
✨ feat(serial): readByte method without his implementation
1 parent 24ea099 commit cdab6e5

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

include/libserial/serial.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,18 @@ void write(std::shared_ptr<std::string> data);
119119
*/
120120
size_t read(std::shared_ptr<std::string> buffer, size_t max_length);
121121

122+
/**
123+
* @brief Read a single byte from the serial port
124+
*
125+
* Reads one byte from the serial port and stores it in the provided buffer.
126+
*
127+
* @param buffer Shared pointer to string where the byte will be stored
128+
* @return Number of bytes actually read (1 if successful, 0 on error)
129+
* @throws SerialException if read operation fails
130+
* @throws SerialException if buffer is null
131+
*/
132+
void readByte([[maybe_unused]] std::shared_ptr<std::string> buffer);
133+
122134
/**
123135
* @brief Reads data until a specific terminator character is found
124136
*

src/serial.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ size_t Serial::read(std::shared_ptr<std::string> buffer, size_t max_length) {
6868
return static_cast<size_t>(bytes_read);
6969
}
7070

71+
void Serial::readByte([[maybe_unused]] std::shared_ptr<std::string> buffer) {
72+
// Implementation can be added here if needed
73+
}
74+
7175
size_t Serial::readUntil(std::shared_ptr<std::string> buffer, char terminator) {
7276
if (!buffer) {
7377
throw SerialException("Null pointer passed to readUntil function");

0 commit comments

Comments
 (0)