1 #ifndef FIRMWAREUPLOADERWINDOW_H
2 #define FIRMWAREUPLOADERWINDOW_H
3 
4 #include <QDialog>
5 #include <QTimer>
6 #include "can_structs.h"
7 #include "connections/canconmanager.h"
8 #include "utility.h"
9 
10 namespace Ui {
11 class FirmwareUploaderWindow;
12 }
13 
14 class FirmwareUploaderWindow : public QDialog
15 {
16     Q_OBJECT
17 
18 public:
19     explicit FirmwareUploaderWindow(const QVector<CANFrame> *frames, QWidget *parent = 0);
20     ~FirmwareUploaderWindow();
21 
22 public slots:
23     void gotTargettedFrame(CANFrame frame);
24 
25 private slots:
26     void handleLoadFile();
27     void handleStartStopTransfer();
28     void updatedFrames(int);
29     void timerElapsed();
30 
31 private:
32     void updateProgress();
33     void loadBinaryFile(QString);
34     void sendFirmwareChunk();
35     void sendFirmwareEnding();
36 
37     Ui::FirmwareUploaderWindow *ui;
38     bool transferInProgress;
39     bool startedProcess;
40     int firmwareSize;
41     int currentSendingPosition;
42     int baseAddress;
43     int bus;
44     uint32_t token;
45     QByteArray firmwareData;
46     const QVector<CANFrame> *modelFrames;
47     QTimer *timer;
48 };
49 
50 #endif // FIRMWAREUPLOADERWINDOW_H
51