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