DeviceLineReader::DeviceLineReader(QIODevice *device, QObject *parent)
: QObject(parent)
, m_device(device)
{
connect(m_device, &QIODevice::readyRead, this, &DeviceLineReader::dataReceived);
connect(m_device, &QIODevice::aboutToClose, this, &DeviceLineReader::disconnected);
}
This constructor builds a device object from an existing device object, and its duplex connections. It connects the readyRead and aboutToClose methods to the device object and sets up signal/slot connections for data received and aboutToClose.