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:
parent
e761b2bb64
commit
3d69d04c86
@ -217,6 +217,22 @@ public:
|
|||||||
*/
|
*/
|
||||||
const bool getDSR() const;
|
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.
|
/** Sets the timeout for reads in seconds.
|
||||||
*
|
*
|
||||||
* @param timeout A long that represents the time (in milliseconds) until a
|
* @param timeout A long that represents the time (in milliseconds) until a
|
||||||
|
|||||||
@ -281,6 +281,14 @@ const bool Serial::getDSR() const {
|
|||||||
return false;
|
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) {
|
void Serial::setTimeoutMilliseconds(long timeout) {
|
||||||
// If timeout > 0 then read until size or timeout occurs
|
// If timeout > 0 then read until size or timeout occurs
|
||||||
// If timeout == 0 then read nonblocking, return data available immediately up to size
|
// If timeout == 0 then read nonblocking, return data available immediately up to size
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user