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