Minor changes for YModemReceive with timers and signals

This commit is contained in:
2021-08-26 11:18:04 +02:00
parent bc701ae833
commit a2670a441d
5 changed files with 53 additions and 41 deletions

View File

@@ -101,7 +101,7 @@ public:
* \param size array size
* \throws boost::system::system_error if any error
*/
void write(const char *data, size_t size);
size_t write(const char *data, size_t size);
/**
* Write data
@@ -126,7 +126,7 @@ public:
* \throws boost::system::system_error if any error
* \throws timeout_exception in case of timeout
*/
void read(char *data, size_t size);
size_t read(char *data, size_t size);
/**
* Read some data, blocking
@@ -162,7 +162,7 @@ public:
*/
std::string readStringUntil(const std::string& delim="\n");
int readChar(int delay);
void setRTS(bool enabled);
void setDTR(bool enabled);
@@ -227,6 +227,7 @@ private:
boost::asio::io_service io; ///< Io service object
boost::asio::serial_port port; ///< Serial port object
boost::asio::deadline_timer timer; ///< Timer for timeout
boost::posix_time::time_duration timeout; ///< Read/write timeout
boost::asio::streambuf readData; ///< Holds eventual read but not consumed
enum ReadResult result; ///< Used by read with timeout