While the handshaking facilities provided are intended to relieve an application from the burden of having to worry about
the status of the various control lines, the levels of any or all of them can nevertheless be read at any time using the Signals()
member function. This is yet another integer that needs to be masked with individually enumerated bitmasks. The status of
the output lines as well as the input lines is returned.
However, when a value of 0 returned for any bit is returned, the meaning is ambiguous it could signify that a particular
signal is low, or that reading its status is not supported. For example, if the RNG Ring Indicator input is not supported, so the value returned by Signals(&KSignalRNG)
would always be 0 even if the serial port was attached to a ringing telephone.
This is something that can be checked using Caps()
if there is any doubt. The usual set of enumerated bitmasks can be used with the TCommCaps
version of iSignals
to find out what signals are supported.
Obviously, only the voltage levels on the output lines can be set. This can be done at any time. The recommended method is
using the inline function SetSignals()
which takes two integers as parameters the first is a bitmask for the signals to be set and the second is a bitmask for
the values to be read. These masks are the same signal line constants as those defined for getting signal levels, but clearly,
only those relating to the RTS and DTR lines have any validity.