Rev 364 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
#ifndef SERIALHELPER_H#define SERIALHELPER_H#include "GlobalDefines.h"#include <QtSerialPort>#define SERIAL_NEWLINE_CHAR "\n"#define SERIAL_BUFFER_SIZE 32class SerialHelper : public QObject{Q_OBJECTpublic:SerialHelper(QObject *parent = 0);~SerialHelper();bool connected;public slots:// Inbound from SerialControllervoid QueryParameters(void);void Connect(QString port, QString speed, QString dataBits,QString stopBits, QString parity, QString flowControl);void Disconnect(bool errored = false);void TransmitString(QString string);void TransmitByteArray(QByteArray data);// Local processing of received datavoid ProcessIncomingData(void);void ProcessError(QSerialPort::SerialPortError error);signals:// Outbound to SerialControllervoid UpdateParameters(QStringList ports, QStringList speeds, QStringList dataBits,QStringList stopBits, QStringList parity, QStringList flowControl);void ReceivedByte(QByteArray);void Connected(bool);void UpdateStatus(QString string);private:QSerialPort *serialPort;QStringList speeds;QStringList dataBits;QStringList stopBits;QStringList parity;QStringList flowControl;char bufferIn[SERIAL_BUFFER_SIZE];int bufferInIndex;bool bufferInOverflow;QString currString;};#endif // SERIALHELPER_H