Rudiments
|
#include <serialportprofile.h>
Inherits object.
A serialportprofile is a set of parameters for a serial port such as baud rate, parity, bits-per character and lots of other settings. On some systems, these are referred to as "termios".
In antiquity, teletypes and dumb terminals were the most common serial-attached devices and they required these to be set to very specific values. These days serial ports are more often used for talking to peripherals on embedded systems but many of the same concepts still apply.
serialportprofile::serialportprofile | ( | ) |
Creates an instance of the serialportprofile class.
serialportprofile::~serialportprofile | ( | ) |
Deletes this instance of the serialportprofile class.
bool serialportprofile::getAnyCharacterStartsFlow | ( | ) |
Returns true if any character will restart output.
baudrate_t serialportprofile::getBaud | ( | ) |
Returns current (input and output) baud.
bool serialportprofile::getBellIfLineTooLong | ( | ) |
Returns true if the bell will be rung when the input queue is full.
bool serialportprofile::getBlockJobControlOutput | ( | ) |
Returns true if output from a nonconcurrent shell layer is being blocked.
bool serialportprofile::getCanonicalInput | ( | ) |
Returns true if special characters EOF, EOL, EOL2, ERASE, KILL, LNEXT, REPRINT, STATUS and WERASE are enabled and buffering is being done by lines.
charsize_t serialportprofile::getCharacterSize | ( | ) |
Returns current character size.
backspacedelay_t serialportprofile::getDelayAfterBackSpace | ( | ) |
Returns the delay that is sent after backspace characters.
carriagereturndelay_t serialportprofile::getDelayAfterCarriageReturn | ( | ) |
Returns the delay that is sent after carriage return characters.
formfeeddelay_t serialportprofile::getDelayAfterFormFeed | ( | ) |
Returns the delay that is sent after form feed characters.
newlinedelay_t serialportprofile::getDelayAfterNewLine | ( | ) |
Returns the delay that is sent after new line characters.
tabdelay_t serialportprofile::getDelayAfterTab | ( | ) |
Returns the delay that is sent after tab characters.
verticaltabdelay_t serialportprofile::getDelayAfterVerticalTab | ( | ) |
Returns the delay that is sent after vertical tab characters.
byte_t serialportprofile::getDelayedSuspendCharacter | ( | ) |
Returns the character that will cause a SIGTSTP to be sent to the process when generateSignals() and extendedFunctions() are set true.
bool serialportprofile::getDiscardEndOfTransmission | ( | ) |
???
byte_t serialportprofile::getDiscardPendingOutputCharacter | ( | ) |
Returns the character that toggles discarding pending output, recognized when extendedFunctions() is set true.
bool serialportprofile::getDontOutputCarriageReturnAtColumnZero | ( | ) |
Returns true if carriage returns aren't sent at column 0.
bool serialportprofile::getEchoControlCharacters | ( | ) |
Returns true if control characters are being echoed as ^X where X is the ascii code for the character plus 0x40.
bool serialportprofile::getEchoErasedCharacter | ( | ) |
Returns true if characters are being printed as they are erased.
bool serialportprofile::getEchoInput | ( | ) |
Returns true if input characters are being echoed.
bool serialportprofile::getEchoNewLine | ( | ) |
Returns true if new line characters are being echoed even if echoInput() is set false.
bool serialportprofile::getEmulateKill | ( | ) |
Returns true if the character set using killCharacter() causes the line to be erased by erasing each character on the line.
byte_t serialportprofile::getEndOfFileCharacter | ( | ) |
Returns the character that will cause the pending tty buffer to be sent to the program without waiting for end-of-line and read()'s to return 0 when canonicalInput() is set to true.
byte_t serialportprofile::getEndOfLineCharacter | ( | ) |
Returns the end-of-line character, recognized when canonicalInput() is set to true.
byte_t serialportprofile::getEraseCharacter | ( | ) |
Returns the character that will cause a character erase when canonicalInput() is set to true.
bool serialportprofile::getEraseCharactersOn | ( | ) |
Returns true if the character set using eraseCharacter() erases the preceeding character and the character set using wordEraseCharacter() erases the preceeding word.
bool serialportprofile::getEscapedUpperCase | ( | ) |
Returns true if on input, characters are being converted from upper to lower case unless they are preceeded by a \ and on output lower case characters are being converted to upper case and upper case characters are being preceeded with a .
bool serialportprofile::getExpandTabToSpaces | ( | ) |
Returns true if the tabs are mapped to spaces.
bool serialportprofile::getExtendedFunctions | ( | ) |
Returns true if characters set by secondEndOfLineCharacter(), reprintCharacter() and wordEraseCharacter() are enabled and lowerCase() is enabled.
flowcontrol_t serialportprofile::getFlowControl | ( | ) |
Get the current flow control setting.
bool serialportprofile::getGenerateSignals | ( | ) |
Returns true if corresponding signals will be raised when any of the INTR, QUIT, SUSP or DSUSP characters are received default is not to raise signals.
bool serialportprofile::getHangupOnClose | ( | ) |
Returns true if the modem lines will be lowered when the last device closes the device.
bool serialportprofile::getHardwareFlowControl | ( | ) |
Returns true if RTS/CTS hardware flow control is being used.
bool serialportprofile::getIgnoreBreak | ( | ) |
Returns true if the BREAK character is being ignored.
bool serialportprofile::getIgnoreCarriageReturn | ( | ) |
Returns true if carriage returns are ignored on input.
bool serialportprofile::getIgnoreModemControlLines | ( | ) |
Returns true if (possibly sporadic) job control and hangup signals are being ignored.
bool serialportprofile::getIgnoreParityErrors | ( | ) |
Returns true if parity errors are being ignored.
baudrate_t serialportprofile::getInputBaud | ( | ) |
Returns current input baud.
inputmode_t serialportprofile::getInputMode | ( | ) |
Get the current input mode setting.
bool serialportprofile::getInputParityCheck | ( | ) |
Returns true if input parity checking is enabled.
byte_t serialportprofile::getInterruptCharacter | ( | ) |
Returns the character that will cause a SIGINT to be sent to the process when generateSignals() is set true.
byte_t serialportprofile::getKillCharacter | ( | ) |
Returns the character that will cause a line erase when canonicalInput() is set to true.
bool serialportprofile::getKillCharacterOn | ( | ) |
Returns true if the character set using killCharacter() erases the current line.
byte_t serialportprofile::getLiteralNextCharcter | ( | ) |
Returns the character that "quotes" the next character, depriving it of special meaning, recognized when extendedFunctions() is set true.
bool serialportprofile::getLowerCase | ( | ) |
Returns true if uppercase characters are mapped to lowercase on input.
bool serialportprofile::getMapCarriageReturnToNewLineOnInput | ( | ) |
Returns true if carriage returns are mapped to new lines on input.
bool serialportprofile::getMapCarriageReturnToNewLineOnOutput | ( | ) |
Returns true if carriage returns are mapped to new lines on output.
bool serialportprofile::getMapNewLineToCarriageReturnNewLineOnOutput | ( | ) |
Returns true if new lines are mapped to carriage return/new line on output.
bool serialportprofile::getMapNewLineToCarriageReturnOnInput | ( | ) |
Returns true if new lines are mapped to carriage returns on input.
bool serialportprofile::getMapNewLineToCarriageReturnOnOutput | ( | ) |
Returns true if new lines are mapped to carriage returns on output.
bool serialportprofile::getMarkParityErrors | ( | ) |
Returns true if characters with parity errors are prefixed with \377 \0.
bool serialportprofile::getNoFlushAfterInterruptOrQuit | ( | ) |
Returns true if flushing of the input/output queues when generating SIGINT, SIGQUIT or SIGSUSP signals is enabled.
bool serialportprofile::getOddParity | ( | ) |
Returns true if odd parity is being used.
baudrate_t serialportprofile::getOutputBaud | ( | ) |
Returns current output baud.
bool serialportprofile::getOutputUpperCase | ( | ) |
Returns true if lowercase characters are mapped to uppercase on output.
bool serialportprofile::getParityCheck | ( | ) |
Returns true if parity check is enabled.
bool serialportprofile::getPostProcessOutput | ( | ) |
Returns true if implementation-defined output processing is enabled.
byte_t serialportprofile::getQuitCharacter | ( | ) |
Returns the character that will cause a SIGQUIT to be sent to the process when generateSignals() is set true.
byte_t serialportprofile::getReadThreshold | ( | ) |
Returns the number of characters that must be read before a read() will begin waiting for readTimeout() deciseconds before falling through.
byte_t serialportprofile::getReadTimeout | ( | ) |
Returns the number of deciseconds that a read() will wait after reading readThreshold() characters before falling through.
bool serialportprofile::getReceiverOn | ( | ) |
Returns true if the receiver is on.
byte_t serialportprofile::getReprintCharacter | ( | ) |
Returns the character that causes unread characters to be reprinted, recognized when canonicalInput() and extendedFunctions() are set true.
bool serialportprofile::getRetypePendingCharacters | ( | ) |
Returns true if all characters in the input queue are reprinted when the next character is read.
byte_t serialportprofile::getSecondEndOfLineCharacter | ( | ) |
Returns the "other" end-of-line character, recognized when canonicalInput() is set to true.
bool serialportprofile::getSendSignalForBackgroundOutput | ( | ) |
Returns true if the SIGTTOU signal is being sent to the process group of a background process which tries to write to its controlling terminal.
bool serialportprofile::getSendSignalOnBreak | ( | ) |
Returns true if input and output queues are flushed and a SIGINT is sent to the process group if the serial port is the controlling terminal when a BREAK character is received.
bool serialportprofile::getSoftwareFlowControlOnInput | ( | ) |
Returns true if XON/XOFF flow control is enabled on input.
bool serialportprofile::getSoftwareFlowControlOnOutput | ( | ) |
Returns true if XON/XOFF flow control is enabled on output.
byte_t serialportprofile::getStartCharacter | ( | ) |
Returns the start character for XON/XOFF flow control.
byte_t serialportprofile::getStatusRequestCharacter | ( | ) |
Returns the status request character.
byte_t serialportprofile::getStopCharacter | ( | ) |
Returns the stop character for XON/XOFF flow control.
bool serialportprofile::getStripParityBits | ( | ) |
Returns true if the 8th bit (the parity bit) of each character is being set to 0.
byte_t serialportprofile::getSuspendCharacter | ( | ) |
Returns the character that will cause a SIGSUSP to be sent to the process when generateSignals() is set true.
byte_t serialportprofile::getSwitchCharacer | ( | ) |
Returns the switch character.
bool serialportprofile::getTwoStopBits | ( | ) |
Returns true if two stop bits are being used.
bool serialportprofile::getUseDelForFill | ( | ) |
Returns true if the DEL character is used instead of NULL for the fill character.
bool serialportprofile::getUseFillCharactersForDelay | ( | ) |
Returns true if fill characters are sent for delay instead of using a timed delay.
byte_t serialportprofile::getWordEraseCharcter | ( | ) |
Returns the word erase character, recognized when canonicalInput() and extendedFunctions() are set true.
Serial port configuration requirements are often given as a 3 character string representing the number of bits-per-char, the parity and the number of stop bits such as "8n1", "7e2", etc. This methods parses such a string and sets the profile to match those values.
Enable any character to restart output. Corresponding termios flag: IXANY.
void serialportprofile::setBaud | ( | baudrate_t | baudrate | ) |
Sets the (input and output) baud rate. Default is 0.
Sets the (input and output) baud rate. Default is 0.
Ring bell when input queue is full. Corresponding termios flag: IMAXBEL.
Block output from a nonconcurrent shell layer. Default is not to block. Corresponding termios flag: LOBLK.
Enable special characters EOF, EOL, EOL2, ERASE, KILL, LNEXT, REPRINT, STATUS and WERASE, buffer by lines. Default is not to enable the special characters and not buffer by lines. Corresponding termios flag: ICANON.
void serialportprofile::setCharacterSize | ( | charsize_t | size | ) |
Set the character size. Default is 5 bits. Corresponding termios flag: CSIZE.
Set control characters to the values pointed to by "c_cc". Note that c_cc must be an array of length NCCS.
void serialportprofile::setDefaultControlCharacters | ( | ) |
Sets the control characters to system defaults.
void serialportprofile::setDefaultControlOptions | ( | ) |
Sets the control options to system defaults.
void serialportprofile::setDefaultInputOptions | ( | ) |
Sets the input options to system defaults.
void serialportprofile::setDefaultLocalOptions | ( | ) |
Sets the local options to system defaults.
void serialportprofile::setDefaultOptions | ( | ) |
Sets all options and control characters to system defaults.
void serialportprofile::setDefaultOutputOptions | ( | ) |
Sets the output options to system defaults.
void serialportprofile::setDelayAfterBackSpace | ( | backspacedelay_t | bsdelay | ) |
Send a delay after each backspace character Corresponding termios flag: BSDLY.
void serialportprofile::setDelayAfterCarriageReturn | ( | carriagereturndelay_t | crdelay | ) |
Send a delay after each carriage return character. Corresponding termios flag: CRDLY.
void serialportprofile::setDelayAfterFormFeed | ( | formfeeddelay_t | ffdelay | ) |
Send a delay after each form feed character Corresponding termios flag: FFDLY.
void serialportprofile::setDelayAfterNewLine | ( | newlinedelay_t | nldelay | ) |
Send a delay after each new line character. Corresponding termios flag: NLDLY.
void serialportprofile::setDelayAfterTab | ( | tabdelay_t | tabdelay | ) |
Send a delay after each tab character Corresponding termios flag: TABDLY.
void serialportprofile::setDelayAfterVerticalTab | ( | verticaltabdelay_t | vtdelay | ) |
Send a delay after each vertical tab character. Corresponding termios flag: VTDLY.
Sets the character that will cause a SIGTSTP to be sent to the process when generateSignals() and extendedFunctions() are set true. Corresponding termios flag: VDSUSP.
??? Corresponding termios flag: ONOEOT.
Sets the character that toggles discarding pending output, recognized when extendedFunctions() is set true. Corresponding termios flag: VDISCARD.
Don't output carriage return at column 0. Corresponding termios flag: ONOCR.
If echoInput() is also set true, control characters are echoed as ^X where X is the ascii code for the character plus 0x40. Corresponding termios flag: ECHOCTL.
If cannonicalInput() and echoInput() are also set true, characters are printed as they are erased. Corresponding termios flag: ECHOPRT.
If cannonicalInput() is also set true then echo input. Corresponding termios flag: ECHO.
If cannonicalInput() is also set true, new line characters are echoed even if echoInput() is set false. Corresponding termios flag: ECHONL.
If cannonicalInput() is also set, the character set using killCharacter() causes the line to be erased by erasing each character on the line. (Useful when a terminal doesn't support the KILL character but does support the ERASE character.) Corresponding termios flag: ECHOKE.
Sets the character that will cause the pending tty buffer to be sent to the program without waiting for end-of-line and read()'s to return 0 when canonicalInput() is set to true Corresponding termios flag: VEOF.
Sets the end-of-line character, recognized when canonicalInput() is set to true Corresponding termios flag: VEOL.
Sets the character that will cause a character erase when canonicalInput() is set to true Corresponding termios flag: VERASE.
If cannonicalInput() is also set true, character set using eraseCharacter() erases the preceeding character and character set using wordEraseCharacter() erases the preceeding word. Corresponding termios flag: ECHOE.
If cannonicalInput() is also set true, converts characters from input to lower case unless they are preceeded by a . On output, preceeds each upper case character with a \ and converts all lower case characters to uppercase. Default is not to use escaped upper case. (This is used when communicating with terminals that can display upper or lower case, but only transmit and receive upper case.) Corresponding termios flag: XCASE.
Map tabs to spaces. Corresponding termios flag: XTAGS/OXTABS/TAB3.
If cannonicalInput() is also set true, enables characters set by secondEndOfLineCharacter(), reprintCharacter() and wordEraseCharacter(). Also enables lowerCase(). Corresponding termios flag: IEXTEN.
void serialportprofile::setFlowControl | ( | flowcontrol_t | flowcontrol | ) |
Set flow control to "flowcontrol".
Cause corresponding signals to be raised when any of the INTR, QUIT, SUSP or DSUSP characters are received default is not to raise signals Corresponding termios flag: ISIG.
Lower modem control lines after last process closes the device (hang up). Default is not to hang up on close. Corresponding termios flag: HUPCL.
Use RTS/CTS flow control. Default is not to use RTS/CTS flow control. Corresponding termios flags: CRTSCTS/NEW_CRTSCTS/CRTS_IFLOW/CRTS_OFLOW.
Ignore BREAK character. Corresponding termios flag: IGNBRK.
Ignore carriage return on input. Corresponding termios flag: IGNCR.
Ignore (possibly sporadic) job control and hangup signals that could terminate or otherwise control the program. Default is not to ignore. (This should be set to true when communicating with a device connected directly to the computer as opposed to over a modem.) Corresponding termios flag: CLOCAL.
Ignore parity errors (ie. if a character has a parity error, just return what we got, rather than marking or converting it). Corresponding termios flag: IGNPAR.
bool serialportprofile::setInputBaud | ( | baudrate_t | baudrate | ) |
Sets the input baud rate. Default is 0.
Sets the input baud rate. Default is 0.
void serialportprofile::setInputMode | ( | inputmode_t | inputmode | ) |
Set input mode to "inputmode".
Enable parity checking on input Corresponding termios flag: INPCK.
Sets the character that will cause a SIGINT to be sent to the process when generateSignals() is set true. Corresponding termios flag: VINTR.
Sets the character that will cause a line erase when canonicalInput() is set to true Corresponding termios flag: VKILL.
If cannonicalInput() is also set true, character set using killCharacter() erases the current line. Corresponding termios flag: ECHOK.
Sets the character that "quotes" the next character, depriving it of special meaning, recognized when extendedFunctions() is set true. Corresponding termios flag: VLNEXT.
Map uppercase characters to lowercase on input. Corresponding termios flag: IUCLC.
Translate carriage return to new line on input. Corresponding termios flag: ICRNL.
Map carriage return to new line on output. Corresponding termios flag: OCRNL.
Map new line to carriage return/new line on output. Corresponding termios flag: ONLCR.
Translate new line to carriage return on input termios flag: INLCR.
Map new line to carriage return on output. Corresponding termios flag: ONLRET.
Unless ignoreParityErrors() is set true, prefix a character with a parity error with \337 \0. The default is to convert it to \0 unless ignoreParityErrors() is set true. Corresponding termios flag: PARMRK.
Disables flushing of the input/output queues when generating SIGINT, SIGQUIT or SIGSUSP signals. Corresponding termios flag: NOFLSH.
Use odd parity if "truefalse" is true or even parity if "truefalse" is false. Default is even parity. Corresponding termios flag: PARODD.
bool serialportprofile::setOutputBaud | ( | baudrate_t | baudrate | ) |
Sets the output baud rate. Default is 0.
Sets the output baud rate. Default is 0.
Map lowercase characters to uppercase on output. Corresponding termios flag: OLCUC.
Turns parity checking on or off. Default is off. Corresponding termios flag: CPARENB.
Enables implementation-defined output processing. Corresponding termios flag: OPOST.
Sets the character that will cause a SIGQUIT to be sent to the process when generateSignals() is set true. Corresponding termios flag: VQUIT.
Sets the number of characters that must be read before a read() will begin waiting for readTimeout() deciseconds before falling through. Corresponding termios flag: VMIN.
Sets the number of deciseconds that a read() will wait after reading readThreshold() characters before falling through. Corresponding termios flag: VTIME.
Turns the receiver on or off. (Enables serial port to read incoming data or not.) Default is off. (You probably always want to set this on.) Corresponding termios flag: CREAD.
Sets the character that causes unread characters to be reprinted, recognized when canonicalInput() and extendedFunctions() are set true. Corresponding termios flag: VREPRINT.
All characters in the input queue are reprinted when the next character is read. Corresponding termios flag: PENDIN.
Sets the "other" end-of-line character, recognized when canonicalInput() is set to true Corresponding termios flag: VEOL2.
Send the SIGTTOU signal to the process group of a background process which tries to write to its controlling terminal. Corresponding termios flag: TOSTOP.
If ignoreBreak() isn't set true and a BREAK character is received, flush input and output queues and send a SIGINT if the serial port is the controlling terminal of the process group. If ignoreBreak() is not set, the default is to return a \0 character or \377 \0 if markParityErrors() is set true. Corresponding termios flag: BRKINT.
Enable XON/XOFF flow control on input. Corresponding termios flag: IXOFF.
Enable XON/XOFF flow control on output. Corresponding termios flag: IXON.
Sets the start character for XON/XOFF flow control Corresponding termios flag: VSTART.
Sets the status request character. Corresponding termios flag: VSTATUS.
Sets the stop character for XON/XOFF flow control Corresponding termios flag: VSTOP.
Set the 8th bit of each character (the parity bit) to 0. Corresponding termios flag: ISTRIP.
Sets the character that will cause a SIGSUSP to be sent to the process when generateSignals() is set true. Corresponding termios flag: VSUSP.
Sets the switch character. Corresponding termios flag: VSWTCH/VSWTC.
Use two stop bits if "truefalse" is true or one stop bit if "truefalse" is false. Default is one stop bit. Corresponding termios flag: CSTOPB.
Use the DEL character instead of NULL for the fill character. Corresponding termios flag: OFDEL.
Send fill characters for delay instead of using a timed delay. Corresponding termios flag: OFILL.