Subversion Repositories Projects

Rev

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

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