summaryrefslogtreecommitdiff
path: root/qpsxserial.h
blob: 2728ce3e3d946fc5b6ccb1b76b02c012bb6fd203 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef QPSXSERIAL_H
#define QPSXSERIAL_H

#include <QMainWindow>
#include <QtSerialPort/QSerialPort>
#include <QString>
#include <QDebug>
#include <QTimer>
#include <QThread>
#include <QTime>
#include <QWinTaskbarButton>

namespace Ui {
class QPSXSerial;
}

class QPSXSerial : public QMainWindow
{
    Q_OBJECT

public:
    explicit QPSXSerial(QWidget *parent = 0);
    ~QPSXSerial();

private:
    bool            sendExe(void);
    void            sendData(QByteArray data, QString fileName);
    void            sendDataSize(quint32 size);

    Ui::QPSXSerial  *ui;
    QString         inputExe;
    QString         selectedPort;
    QString         selectedFolder;
    QSerialPort     serial;
    bool            ack;
    bool            exe_sent;
    QTimer*         init_timer;
    bool            write_ready;
    bool            byte_sent_received;
    QByteArray      last_packet_sent;
    QTimer*         lost_packet_timer;

private slots:
    void onLoadFileBtnReleased(void);
    void onUpdatePortsBtnReleased(void);
    void onSendBtnReleased(void);
    void onPortSelectedComboBox(QString);
    void onBytesWritten(qint64);
    void onReadyRead(void);
    void connectToPSXTimeout(void);
    void onPacketLost(void);
};

#endif // QPSXSERIAL_H