kmobiletools
KMobileTools::QSerial Class Reference
#include <qserial.h>

Detailed Description
Definition at line 32 of file qserial.h.
Public Types | |
| enum | Baud { BAUD_50 = B50, BAUD_75 = B75, BAUD_110 = B110, BAUD_134 = B134, BAUD_150 = B150, BAUD_200 = B200, BAUD_300 = B300, BAUD_600 = B600, BAUD_1200 = B1200, BAUD_1800 = B1800, BAUD_2400 = B2400, BAUD_4800 = B4800, BAUD_9600 = B9600, BAUD_19200 = B19200, BAUD_38400 = B38400, BAUD_57600 = B57600, BAUD_115200 = B115200, BAUD_230400 = B230400, BAUD_DEFAULT = BAUD_57600 } |
| enum | DataBits { DATABITS_5 = 5, DATABITS_6 = 6, DATABITS_7 = 7, DATABITS_8 = 8, DATABITS_DEFAULT = DATABITS_8 } |
| enum | FlowControl { FLOW_CONTROL_HARD = 0x1, FLOW_CONTROL_XONXOFF = 0x2, FLOW_CONTROL_NONE = 0x0, FLOW_CONTROL_DEFAULT = FLOW_CONTROL_HARD } |
| enum | Parity { PARITY_NONE = 0x0, PARITY_ODD = 0x1, PARITY_EVEN = 0x2, PARITY_MARK = 0x3, PARITY_SPACE = 0x4, PARITY_DEFAULT = PARITY_NONE } |
| enum | StopBits { STOP_BITS_1 = 0x1, STOP_BITS_2 = 0x2, STOP_BITS_DEFAULT = STOP_BITS_1 } |
Signals | |
| void | gotData () |
Public Member Functions | |
| Baud | baud () |
| void | close () |
| DataBits | databits () |
| FlowControl | flowControl () |
| void | flush () |
| int | getch () |
| bool | isOpen () const |
| bool | isSequential () const |
| QString | name () const |
| bool | open (OpenMode mode) |
| bool | open (OpenMode mode, bool createLockFile) |
| Parity | parity () |
| int | putch (int ch) |
| QSerial (const QString &deviceName) | |
| QSerial () | |
| bool | reset () |
| void | setBaud (Baud baudrate) |
| void | setDatabits (DataBits databits) |
| void | setFlowControl (FlowControl flowcontrol) |
| void | setName (const QString &name) |
| void | setParity (Parity parity) |
| void | setStopBits (StopBits stopbits) |
| qint64 | size () const |
| StopBits | stopBits () |
| int | ungetch (int ch) |
| ~QSerial () | |
Protected Member Functions | |
| qint64 | readData (char *data, qint64 maxSize) |
| qint64 | writeData (const char *data, qint64 maxSize) |
Member Enumeration Documentation
Constructor & Destructor Documentation
| KMobileTools::QSerial::QSerial | ( | ) |
| KMobileTools::QSerial::QSerial | ( | const QString & | deviceName | ) |
Convenience method for the above.
Creates a new QSerial object, and sets the device path to deviceName.
- Parameters:
-
deviceName path to the device to use.
Definition at line 70 of file qserial.cpp.
| KMobileTools::QSerial::~QSerial | ( | ) |
Definition at line 84 of file qserial.cpp.
Member Function Documentation
| QSerial::Baud KMobileTools::QSerial::baud | ( | ) |
Current serial port baudrate.
- Returns:
- the current serial port baudrate.
Definition at line 456 of file qserial.cpp.
| void KMobileTools::QSerial::close | ( | ) |
Closes the serial device.
- See also:
- open(int)
Reimplemented from QIODevice.
Definition at line 250 of file qserial.cpp.
| QSerial::DataBits KMobileTools::QSerial::databits | ( | ) |
Current serial port databits settings.
- Returns:
- the current serial port databits settings.
Definition at line 484 of file qserial.cpp.
| QSerial::FlowControl KMobileTools::QSerial::flowControl | ( | ) |
Current serial port flow control settings.
- Returns:
- the current serial port flow control settings.
Definition at line 477 of file qserial.cpp.
| void KMobileTools::QSerial::flush | ( | ) |
| int KMobileTools::QSerial::getch | ( | ) |
Reads a single byte/character from the serial device.
- Returns:
- the byte/character read, or -1 if an error occurred.
- See also:
- putch()
Reimplemented from QIODevice.
Definition at line 418 of file qserial.cpp.
| void KMobileTools::QSerial::gotData | ( | ) | [signal] |
This signal is emitted when the serial port has received data ready to be read.
| bool KMobileTools::QSerial::isOpen | ( | ) | const |
Returns if the device was opened or not.
- Returns:
- true if the device was opened, false otherwise.
Definition at line 450 of file qserial.cpp.
| bool KMobileTools::QSerial::isSequential | ( | ) | const |
Definition at line 496 of file qserial.cpp.
| QString KMobileTools::QSerial::name | ( | ) | const |
Current serial port device path.
- Returns:
- the current serial port device path.
- See also:
- QSerial::setName(const QString &)
Definition at line 492 of file qserial.cpp.
| bool KMobileTools::QSerial::open | ( | OpenMode | mode | ) |
Convenience method for the above.
Opens the serial device with mode, creating automatically a lock file.
- Parameters:
-
mode Flags for opening the device. createLockFile True if a lock file has to be created, false otherwise.
- Returns:
- true if the device was opened, otherwise false.
- See also:
- QIODevice::open(int m), close()
Reimplemented from QIODevice.
Definition at line 494 of file qserial.cpp.
| bool KMobileTools::QSerial::open | ( | OpenMode | mode, | |
| bool | createLockFile | |||
| ) |
Opens the serial device using the specified mode.
Returns TRUE if the device was successfully opened; otherwise returns FALSE.
- Parameters:
-
mode Flags for opening the device. createLockFile True if a lock file has to be created, false otherwise.
- Returns:
- true if the device was opened, otherwise false.
- See also:
- QIODevice::open(int m), close()
Definition at line 90 of file qserial.cpp.
| QSerial::Parity KMobileTools::QSerial::parity | ( | ) |
Current serial port parity check settings.
- Returns:
- the current serial port parity check settings.
Definition at line 463 of file qserial.cpp.
| int KMobileTools::QSerial::putch | ( | int | ch | ) |
Writes the character ch to the I/O device.
- Parameters:
-
ch the byte to write.
- Returns:
- ch, or -1 if an error occurred.
- See also:
- getch()
Reimplemented from QIODevice.
Definition at line 429 of file qserial.cpp.
| qint64 KMobileTools::QSerial::readData | ( | char * | data, | |
| qint64 | maxSize | |||
| ) | [protected] |
Reads at most maxlen bytes from the I/O device into data and returns the number of bytes actually read.
The device must be opened for reading, and data must not be 0.
- Parameters:
-
data buffer for receiving bytes. maxlen,maximum number of bytes that should be read.
- Returns:
- -1 if a fatal error occurs, otherwise the number of bytes read (0 if no data is available).
- See also:
- writeBlock()
Reimplemented from QIODevice.
Definition at line 409 of file qserial.cpp.
| bool KMobileTools::QSerial::reset | ( | ) |
Reset the serial port sending a 0x1A character.
- Returns:
- true if the reset was sent correctly, false otherwise.
Reimplemented from QIODevice.
Definition at line 443 of file qserial.cpp.
| void KMobileTools::QSerial::setBaud | ( | QSerial::Baud | baudrate | ) |
Sets the current serial port baudrate.
This will work only if the serial port is not already opened.
- Parameters:
-
baudrate the baudrate to use.
Definition at line 458 of file qserial.cpp.
| void KMobileTools::QSerial::setDatabits | ( | DataBits | databits | ) |
Sets the current serial port databits settings.
- Parameters:
-
databits the databits setting to use.
Definition at line 485 of file qserial.cpp.
| void KMobileTools::QSerial::setFlowControl | ( | QSerial::FlowControl | flowcontrol | ) |
Sets the current serial port flow control settings.
This will work only if the serial port is not already opened.
- Parameters:
-
flowcontrol the flow control settings to use.
Definition at line 479 of file qserial.cpp.
| void KMobileTools::QSerial::setName | ( | const QString & | name | ) |
Sets the current serial device path to use.
This will work only if the serial port is not already opened.
- Parameters:
-
name the serial device path to use.
- See also:
- QSerial::name()
Definition at line 493 of file qserial.cpp.
| void KMobileTools::QSerial::setParity | ( | Parity | parity | ) |
Sets the current serial port parity check settings.
This will work only if the serial port is not already opened.
- Parameters:
-
parity the parity setting to use.
Definition at line 464 of file qserial.cpp.
| void KMobileTools::QSerial::setStopBits | ( | QSerial::StopBits | stopbits | ) |
Sets the current serial port stop bits.
This will work only if the serial port is not already opened.
- Parameters:
-
stopbits the stop bits settings to use.
Definition at line 471 of file qserial.cpp.
| qint64 KMobileTools::QSerial::size | ( | ) | const |
Checks the serial device input buffer for incoming bytes.
- Returns:
- the number of incoming bytes that can be read right now.
Definition at line 392 of file qserial.cpp.
| QSerial::StopBits KMobileTools::QSerial::stopBits | ( | ) |
Current serial port stop bits.
- Returns:
- the current serial port stop bits.
Definition at line 470 of file qserial.cpp.
| int KMobileTools::QSerial::ungetch | ( | int | ch | ) |
Unimplemented.
- Parameters:
-
ch character to write back to the device
- Returns:
- always -1 (error) at this time.
unimplemented
Reimplemented from QIODevice.
Definition at line 495 of file qserial.cpp.
| qint64 KMobileTools::QSerial::writeData | ( | const char * | data, | |
| qint64 | maxSize | |||
| ) | [protected] |
Writes len bytes from data to the serial device and returns the number of bytes actually written.
This function should return -1 if a fatal error occurs.
- Parameters:
-
data Buffer containing data to write. len length of the buffer.
- Returns:
- -1 if an error occurred.
- See also:
- readBlock()
Reimplemented from QIODevice.
Definition at line 342 of file qserial.cpp.
The documentation for this class was generated from the following files:
KDE 4.1 API Reference