Subversion Repositories Projects

Rev

Rev 462 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#ifndef QT_SERIAL_COMMUNICATION_H
#define QT_SERIAL_COMMUNICATION_H
#include <QObject>
#include <QTimer>
#include "Communication.h"
#include "Handler.h"
#include "../SerialPort/ManageSerialPort.h"

/**
 * QT specific communication class
 * based on the communication interface
 * using the SerialPort implementation
 * by VIANNEY-LIAUD Philippe
 * ( philippe.vianney.liaud gmail.com )
 */


class QTSerialCommunication : public QObject, public Communication {
    Q_OBJECT

    private:
        Handler * handler;
        //timer to resend data if necessary
        QTimer resendTimer;
        //data that will be resended if the timer
        //got the timeout
        char * resendData;

        //Serial Port connection class by Philippe VIANNEY-LIAUD
        ManageSerialPort * serial;
    private slots:
        void slot_resend_timer();
        void slot_received_data(const QByteArray & data);
    public:
        QTSerialCommunication(Handler * handler);
        void connect_MK(char * addr);
        void received_data(char * data, int length);
        void send_cmd(char cmd, int address, char data[150], unsigned int length, bool resend);
        void stop_resend();
};
#endif