#Eyetv 3.6.1 serial serial#
QSerialPort:: QSerialPort( QObject * parent = nullptr)Ĭonstructs a new serial port object with the given parent. The name should have a specific format see the setPort() method. QSerialPort:: QSerialPort(const QString & name, QObject * parent = nullptr)Ĭonstructs a new serial port object with the given parent to represent the serial port with the specified name.
Member Function Documentation QSerialPort:: QSerialPort(const QSerialPortInfo & serialPortInfo, QObject * parent = nullptr)Ĭonstructs a new serial port object with the given parent to represent the serial port with the specified helper class serialPortInfo. This enum describes the number of stop bits used. This value was introduced in QtSerialPort 5.2. The requested device operation is not supported or prohibited by the running operating system.Ī timeout error occurred. when the device is unexpectedly removed from the system. This value was introduced in QtSerialPort 5.2.Īn I/O error occurred while writing the data.Īn I/O error occurred while reading the data.Īn I/O error occurred when a resource becomes unavailable, e.g. This error occurs when an operation is executed that can only be successfully performed if the device is open.
There is one issue to be aware of, though: make sure that enough data is available before attempting to read by using the operator>() overloaded operator.Īn error occurred while attempting to open an non-existing device.Īn error occurred while attempting to open an already opened device by another process or a user not having enough permission and credentials to open.Īn error occurred while attempting to open an already opened device in this object. The QSerialPort class can also be used with QTextStream and QDataStream's stream operators (operator>()). However, in a GUI application, blocking serial port should only be used in non-GUI threads, to avoid freezing the user interface.įor more details about these approaches, refer to the example applications. A blocking serial port does not require an event loop and typically leads to simpler code. Programming with a blocking serial port is radically different from programming with a non-blocking serial port. You can also call error() to find the type of error that occurred last. If an error occurs at any point in time, QSerialPort will emit the errorOccurred() signal. If waitForReadyRead() returns false, the connection has been closed or an error has occurred. waitForBytesWritten() blocks calls until one payload of data has been written to the serial port.waitForReadyRead() blocks calls until new data is available for reading.These functions can be used to implement blocking serial ports: QSerialPort provides a set of functions that suspend the calling thread until certain signals are emitted. You can limit the size of the read buffer using setReadBufferSize(). If not all the data is read at once, the remaining data will be available for later as new incoming data is appended to the QSerialPort's internal read buffer. Alternatively the readLine() and readAll() convenience methods can also be invoked. Once you know that the ports are ready to read or write, you can use the read() or write() methods. It is also possible to use the pinoutSignals() method to query the current pinout signals set. There are a couple of properties to work with the pinout signals namely: QSerialPort::dataTerminalReady, QSerialPort::requestToSend. You can reconfigure the port to the desired setting using the setBaudRate(), setDataBits(), setParity(), setStopBits(), and setFlowControl() methods. Having successfully opened, QSerialPort tries to determine the current configuration of the port and initializes itself. Use the close() method to close the port and cancel the I/O operations. Note: The serial port is always opened with exclusive access (that is, no other process or thread can access an already opened serial port). SetStopBits(QSerialPort::StopBits stopBits) SetPort(const QSerialPortInfo & serialPortInfo)
SetFlowControl(QSerialPort::FlowControl flowControl) SetDataBits(QSerialPort::DataBits dataBits) SetBaudRate(qint32 baudRate, QSerialPort::Directions directions = AllDirections) QSerialPort(const QString & name, QObject * parent = nullptr)īaudRate(QSerialPort::Directions directions = AllDirections) constĬlear(QSerialPort::Directions directions = AllDirections) QSerialPort(const QSerialPortInfo & serialPortInfo, QObject * parent = nullptr)