Subversion Repositories Projects

Rev

Rev 451 | Rev 500 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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