Changeset View
Changeset View
Standalone View
Standalone View
src/core/seriallayer.cpp
Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | |||||
58 | public: | 58 | public: | ||
59 | bool _serialOpened; //!< @param _serialOpened: is serial port opened | 59 | bool _serialOpened; //!< @param _serialOpened: is serial port opened | ||
60 | QSerialPort::SerialPortError _lastError; //!< @param _lastError: the last reported error | 60 | QSerialPort::SerialPortError _lastError; //!< @param _lastError: the last reported error | ||
61 | QByteArray _rawData; //!< @param _rawData: the raw serial data | 61 | QByteArray _rawData; //!< @param _rawData: the raw serial data | ||
62 | QVector<QByteArray> _rByteCommands; //!< @param _rByteCommand: received Messages | 62 | QVector<QByteArray> _rByteCommands; //!< @param _rByteCommand: received Messages | ||
63 | QVector<QByteArray> _sByteCommands; //!< @param _sByteCommand: sent Messages | 63 | QVector<QByteArray> _sByteCommands; //!< @param _sByteCommand: sent Messages | ||
64 | }; | 64 | }; | ||
65 | 65 | | |||
66 | SerialLayer::SerialLayer(const QString &port, uint baud, QObject *parent) : | 66 | SerialLayer::SerialLayer(const QString &port, int32_t baud, QObject *parent) : | ||
67 | QSerialPort(parent), d(new SerialLayerPrivate()) | 67 | QSerialPort(parent), d(new SerialLayerPrivate()) | ||
68 | { | 68 | { | ||
69 | setPortName(port); | 69 | setPortName(port); | ||
70 | setBaudRate(baud); | 70 | setBaudRate(baud); | ||
71 | if (open(QIODevice::ReadWrite)) { | 71 | if (open(QIODevice::ReadWrite)) { | ||
72 | d->_serialOpened = true; | 72 | d->_serialOpened = true; | ||
73 | connect(this, &QSerialPort::readyRead, this, &SerialLayer::readAllData); | 73 | connect(this, &QSerialPort::readyRead, this, &SerialLayer::readAllData); | ||
74 | connect(this, &QSerialPort::errorOccurred, this, &SerialLayer::handleError); | 74 | connect(this, &QSerialPort::errorOccurred, this, &SerialLayer::handleError); | ||
▲ Show 20 Lines • Show All 85 Lines • Show Last 20 Lines |