This section describes the RComm::Signal
and RComm::SetSignal
APIs.
While the handshaking facilities allow an application to ignore the status of the control lines, the levels of the control lines can be read at any time using the RComm::Signals()
member function. This is a bit field that needs to be masked with the KCapsSignalXXX
bitmasks. The status of the output lines as well as the input lines is returned.
However, when a value of 0 is returned for any bit, the meaning is ambiguous. The value could mean 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, 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()
. The KCapsSignalXXX
bitmasks can be used with the TCommCaps
version of iSignals
to find out what signals are supported. For example KCapsSignalCTSSupported.
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 only those relating to the RTS and DTR lines are valid.