Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions |
The QSerialPort class provides a simple serial device interface. More...
#include <QSerialPort>
Inherits QSerialIODevice.
The QSerialPort class provides a simple serial device interface.
This class manages a very simple serial device, which is accessed at a specific baud rate with no parity, 8 data bits, and 1 stop bit. It is intended for communicating with GSM modems and the like.
The recommended way to create an instance of this class is to call the QSerialPort::create() method.
See also QSerialPort::create() and QSerialIODevice.
Construct a new serial device handler object for the specified device at the given rate. After construction, it is necessary to call QSerialPort::open() to complete initialization.
If trackStatus is true, then the device should attempt to track changes in DSR, DCD, and CTS. This may require the use of a regular timeout, which will be detrimental to battery life.
Status tracking should only be enabled when absolutely required. It isn't required for modems that support GSM 07.10 multiplexing, as the multiplexing mechanism has its own method of tracking status changes that does not require the use of a timeout.
The device name is usually something like /dev/ttyS0, but it can have the special form sim:hostname, where hostname is the name of a host running a phone simulator daemon (usually localhost). The phone simulator mode is intended for debugging purposes only.
Destruct this serial device. If the device is currently open, it will be closed.
Closes the serial device.
Reimplemented from QIODevice.
Create and open a serial device from a name of the form device:rate. Returns NULL if the device could not be opened. The defaultRate parameter indicates the default rate to use if :rate was not included in the device name. If flowControl is true, then CTS/RTS flow control should be enabled on the device.
The name parameter can have the special form sim:hostname, where hostname is the name of a host running a phone simulator daemon (usually localhost). The phone simulator mode is intended for debugging purposes only.
Returns the operating system file descriptor for this serial port, or -1 if the port is currently closed.
This function was introduced in Qtopia 4.3.
Returns the state of CTS/RTS flow control on the serial device. The default value is false.
See also setFlowControl().
Returns true if able to flush all buffered data to the physical serial device; otherwise returns false.
Returns true if tty devices should be kept open on a zero-byte read; otherwise returns false. The default value is true.
Some serial devices return zero bytes when there is no data available, instead of returning the system error EWOULDBLOCK. When keepOpen() is true, a zero-byte read will be treated the same as EWOULDBLOCK. When keepOpen() is false, a zero-byte read will be interpreted as an unrecoverable error and the serial port will be closed.
For Bluetooth RFCOMM sockets, keepOpen() should be false.
The keepOpen() state is ignored if the underlying serial device is a socket connection to a phone simulator.
See also setKeepOpen().
Opens the serial device with the specified mode. Returns true if the device could be opened; false otherwise.
Sets the state of CTS/RTS flow control on the serial device to value. This must be called before QSerialPort::open(). Changes to the value after opening will be ignored.
See also flowControl().
Sets the keep open flag to value. The default value is true.
Some serial devices return zero bytes when there is no data available, instead of returning the system error EWOULDBLOCK. When value is true, a zero-byte read will be treated the same as EWOULDBLOCK. When value is false, a zero-byte read will be interpreted as an unrecoverable error and the serial port will be closed.
For Bluetooth RFCOMM sockets, value should be false.
The state of value is ignored if the underlying serial device is a socket connection to a phone simulator.
See also keepOpen().
Copyright © 2009 Nokia | Trademarks | Qt Extended 4.4.3 |