1
0
mirror of https://github.com/wjwwood/serial.git synced 2026-01-22 19:54:57 +08:00

Added the set and get port functions, probably should have been in there from the start...

This commit is contained in:
William Woodall 2011-03-26 18:19:12 -05:00
parent e761b2bb64
commit 3d69d04c86
2 changed files with 24 additions and 0 deletions

View File

@ -217,6 +217,22 @@ public:
*/
const bool getDSR() const;
/** Sets the serial port identifier.
*
* @param port A std::string containing the address of the serial port,
* which would be something like 'COM1' on Windows and '/dev/ttyS0'
* on Linux.
*/
void setPort(std::string port);
/** Gets the serial port identifier.
*
* @return A std::string containing the address of the serial port,
* which would be something like 'COM1' on Windows and '/dev/ttyS0'
* on Linux.
*/
const std::string getPort() const;
/** Sets the timeout for reads in seconds.
*
* @param timeout A long that represents the time (in milliseconds) until a

View File

@ -281,6 +281,14 @@ const bool Serial::getDSR() const {
return false;
}
void Serial::setPort(std::string port) {
this->port = port;
}
const std::string Serial::getPort() const {
return this->port;
}
void Serial::setTimeoutMilliseconds(long timeout) {
// If timeout > 0 then read until size or timeout occurs
// If timeout == 0 then read nonblocking, return data available immediately up to size