Subversion Repositories Code-Repo

Rev

Rev 344 | Blame | Last modification | View Log | RSS feed

#ifndef SERIALCONTROLLER_H
#define SERIALCONTROLLER_H

#include "GlobalDefines.h"
#include <QtSerialPort>

#define SERIAL_NEWLINE_CHAR "\n"
#define SERIAL_BUFFER_SIZE      32

class SerialController : public QObject
{
        Q_OBJECT
    public:
        SerialController(QObject *parent = 0);
        ~SerialController();

        bool connected;

    public slots:
        void Serial_QueryParameters(void);
        void Serial_Connect(QString port, QString speed);
        void Serial_Disconnect(void);
        void Serial_TransmitString(QString string);
        void Serial_ProcessIncomingData(void);

    signals:
        void Serial_UpdateParameters(QStringList ports, QStringList speeds);
        void Serial_ReceivedString(QString string);
        void Serial_Connected(void);
        void Serial_Disconnected(void);

    private:
        QSerialPort *serialPort;
        QStringList speeds;

        char bufferIn[SERIAL_BUFFER_SIZE];
        int bufferInIndex;
        bool bufferInOverflow;
        QString currString;
};

#endif // SERIALCONTROLLER_H