[boost.asio] Getting/setting RTS and CTS/DSR/DCD with serial_port
Hello, I'm porting old platform-specific serial port code to use asio::serial_port, and it's working nicely overall, but I'm missing some functionality. How can I get/set the status of the DTR, RTS and DCD pins? This seems to be needed for some devices. I'm no expert, but the current documentation says: // RTS on if Data in Transmit queue or while BREAK transmitted // RTS off iff no data in transmit queue and // Output Handshaking via CTS/DSR/DCD // data is transmitted only when all lines which are enabled for // output handshake are up. (BREAKs can be transmitted) There is also this one, can this be implemented in asio? // setErrorChar ... enable/disable Error handling and lets you define // the error replacement char. // Specifies whether bytes received with parity errors are replaced // with the character specified by the ErrorChar member. void setErrorChar(bool on, char errorChar); If it helps, the Windows implementation was: dcbI.fbFlowReplace |= MODE_ERROR_CHAR; dcbI.bErrorReplacementChar = cError; but I suppose I don't have access to the DCBINFO used inside boost, and anyway the whole purpose is to make this cross-platform :) -- David Faure | dfaure@kdab.com | KDE/Qt Senior Software Engineer Klarälvdalens Datakonsult AB, a KDAB Group company Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322) KDAB - Qt Experts - Platform-independent software solutions
On Tuesday 02 February 2010, David Faure wrote:
How can I get/set the status of the DTR, RTS and DCD pins? [....]
Anyone? Who can I talk to about the asio::serial_port implementation? -- David Faure | dfaure@kdab.com | KDE/Qt Senior Software Engineer Klarälvdalens Datakonsult AB, a KDAB Group company Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322) KDAB - Qt Experts - Platform-independent software solutions
David Faure wrote:
On Tuesday 02 February 2010, David Faure wrote:
How can I get/set the status of the DTR, RTS and DCD pins? [....]
Anyone? Who can I talk to about the asio::serial_port implementation?
Hi David - You can use get_option and set_option to set/get various bits in the win DCB or posix termios. These pins are not currently described as far as I can tell. Options implement the SetabbleSerialPortOption and GettableSerialPortOption. Take a look at serial_port_base.hpp for the existing options (such as baud_rate). You will find the implementation in impl/serial_port_base.ipp. It should be fairly easy to use those as a guide to make your own options that support your platform. For window you will modify the DCB structure and for posix the termios. HTH michael -- ---------------------------------- Michael Caisse Object Modeling Designs www.objectmodelingdesigns.com
participants (2)
-
David Faure
-
Michael Caisse