Subversion Repositories Projects

Rev

Rev 462 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 462 Rev 500
Line 1... Line 1...
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"
Line 7... Line 8...
7
 
8
 
8
/**
9
/**
9
 * QT specific communication class
10
 * QT specific communication class
Line 15... Line 16...
15
 
16
 
16
class QTSerialCommunication : public QObject, public Communication {
17
class QTSerialCommunication : public QObject, public Communication {
Line 17... Line 18...
17
    Q_OBJECT
18
    Q_OBJECT
-
 
19
 
18
 
20
    private:
19
    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
Line 23... Line 25...
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
-
 
29
        ManageSerialPort * serial;
27
        ManageSerialPort * serial;
30
    private slots:
28
    private slots:
31
        void slot_resend_timer();
29
        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();