1
0
mirror of https://github.com/wjwwood/serial.git synced 2026-01-22 11:44:53 +08:00

Update to Serial::setTimeout (and unix/win implementations) to accept timeout by const reference (Addresses issue #101)

This commit is contained in:
Patrick McMichael 2015-06-15 12:49:01 -04:00
parent 99e57e633c
commit 1c1c43e97f
6 changed files with 8 additions and 8 deletions

View File

@ -141,7 +141,7 @@ public:
getPort () const; getPort () const;
void void
setTimeout (Timeout &timeout); setTimeout (const Timeout &timeout);
Timeout Timeout
getTimeout () const; getTimeout () const;

View File

@ -130,7 +130,7 @@ public:
getPort () const; getPort () const;
void void
setTimeout (Timeout &timeout); setTimeout (const Timeout &timeout);
Timeout Timeout
getTimeout () const; getTimeout () const;

View File

@ -179,7 +179,7 @@ public:
*/ */
Serial (const std::string &port = "", Serial (const std::string &port = "",
uint32_t baudrate = 9600, uint32_t baudrate = 9600,
Timeout timeout = Timeout(), const Timeout &timeout = Timeout(),
bytesize_t bytesize = eightbits, bytesize_t bytesize = eightbits,
parity_t parity = parity_none, parity_t parity = parity_none,
stopbits_t stopbits = stopbits_one, stopbits_t stopbits = stopbits_one,
@ -456,7 +456,7 @@ public:
* \see serial::Timeout * \see serial::Timeout
*/ */
void void
setTimeout (Timeout &timeout); setTimeout (const Timeout &timeout);
/*! Sets the timeout for reads and writes. */ /*! Sets the timeout for reads and writes. */
void void

View File

@ -699,7 +699,7 @@ Serial::SerialImpl::getPort () const
} }
void void
Serial::SerialImpl::setTimeout (serial::Timeout &timeout) Serial::SerialImpl::setTimeout (const serial::Timeout &timeout)
{ {
timeout_ = timeout; timeout_ = timeout;
} }

View File

@ -370,7 +370,7 @@ Serial::SerialImpl::getPort () const
} }
void void
Serial::SerialImpl::setTimeout (serial::Timeout &timeout) Serial::SerialImpl::setTimeout (const serial::Timeout &timeout)
{ {
timeout_ = timeout; timeout_ = timeout;
if (is_open_) { if (is_open_) {

View File

@ -63,7 +63,7 @@ private:
SerialImpl *pimpl_; SerialImpl *pimpl_;
}; };
Serial::Serial (const string &port, uint32_t baudrate, serial::Timeout timeout, Serial::Serial (const string &port, uint32_t baudrate, const serial::Timeout &timeout,
bytesize_t bytesize, parity_t parity, stopbits_t stopbits, bytesize_t bytesize, parity_t parity, stopbits_t stopbits,
flowcontrol_t flowcontrol) flowcontrol_t flowcontrol)
: pimpl_(new SerialImpl (port, baudrate, bytesize, parity, : pimpl_(new SerialImpl (port, baudrate, bytesize, parity,
@ -279,7 +279,7 @@ Serial::getPort () const
} }
void void
Serial::setTimeout (serial::Timeout &timeout) Serial::setTimeout (const serial::Timeout &timeout)
{ {
pimpl_->setTimeout (timeout); pimpl_->setTimeout (timeout);
} }