Subversion Repositories Projects

Rev

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

Rev Author Line No. Line
449 Brean 1
#ifndef QT_SERIAL_COMMUNICATION_H
2
#define QT_SERIAL_COMMUNICATION_H
451 Brean 3
#include <QObject>
4
#include <QTimer>
449 Brean 5
#include "Communication.h"
500 Brean 6
#include "Handler.h"
449 Brean 7
#include "../SerialPort/ManageSerialPort.h"
392 Brean 8
 
9
/**
10
 * QT specific communication class
11
 * based on the communication interface
12
 * using the SerialPort implementation
13
 * by VIANNEY-LIAUD Philippe
14
 * ( philippe.vianney.liaud gmail.com )
15
 */
16
 
462 Brean 17
class QTSerialCommunication : public QObject, public Communication {
451 Brean 18
    Q_OBJECT
396 Brean 19
 
449 Brean 20
    private:
500 Brean 21
        Handler * handler;
451 Brean 22
        //timer to resend data if necessary
23
        QTimer resendTimer;
24
        //data that will be resended if the timer
25
        //got the timeout
26
        char * resendData;
27
 
28
        //Serial Port connection class by Philippe VIANNEY-LIAUD
449 Brean 29
        ManageSerialPort * serial;
451 Brean 30
    private slots:
31
        void slot_resend_timer();
500 Brean 32
        void slot_received_data(const QByteArray & data);
392 Brean 33
    public:
500 Brean 34
        QTSerialCommunication(Handler * handler);
450 Brean 35
        void connect_MK(char * addr);
500 Brean 36
        void received_data(char * data, int length);
450 Brean 37
        void send_cmd(char cmd, int address, char data[150], unsigned int length, bool resend);
397 Brean 38
        void stop_resend();
392 Brean 39
};
40
#endif