ThymioBootloader.h
Go to the documentation of this file.
00001 #ifndef THYMIO_BOOTLOADER_H
00002 #define THYMIO_BOOTLOADER_H
00003 
00004 #include <QDialog>
00005 #include <QVBoxLayout>
00006 #include <QHBoxLayout>
00007 #include <QProgressBar>
00008 #include <QPushButton>
00009 #include <QLineEdit>
00010 #include <dashel/dashel.h>
00011 
00012 #include <map>
00013 #include <vector>
00014 #include <iterator>
00015 
00016 #include <dashel/dashel.h>
00017 
00018 #include "../Plugin.h"
00019 #include "../DashelTarget.h"
00020 
00021 namespace Aseba
00022 {
00025         
00026         class ThymioBootloaderDialog : public QDialog, public InvasivePlugin, public NodeToolInterface
00027         {
00028                 Q_OBJECT
00029 
00030         private:
00031                 QVBoxLayout     *verticalLayout;
00032                 QHBoxLayout *fileLayout;
00033                 QHBoxLayout *flashLayout;
00034                 QSpacerItem *spacer;
00035                 QLineEdit       *lineEdit;
00036                 QPushButton *fileButton;
00037                 QPushButton *quitButton;
00038                 QPushButton *flashButton;
00039                 QProgressBar *progressBar;
00040                 
00041                 typedef std::map<uint32, std::vector<uint8> > PageMap;
00042                 PageMap pageMap;
00043                 PageMap::iterator currentPage;
00044 
00045                 // we must cache this because during the flashing process, the tab is not there any more
00046                 unsigned nodeId;
00047                 Target * target;
00048                 Dashel::Stream  *stream;
00049 
00050                 bool deleteMyself;
00051 
00052         public:
00053                 ThymioBootloaderDialog(NodeTab* nodeTab);
00054                 ~ThymioBootloaderDialog();
00055                 
00056                 virtual QWidget* createMenuEntry();
00057                 virtual void closeAsSoonAsPossible();
00058                 virtual bool surviveTabDestruction() const;
00059                 
00060         private slots:
00061                 void showFlashDialog();
00062                 
00063                 void openFile(void);
00064                 void doFlash(void);
00065                 void doClose(void);
00066                 
00067                 void ackReceived(unsigned error_code, unsigned address);
00068                 void vmDisconnected(unsigned);
00069 
00070         private:
00071                 void writePage(unsigned page, unsigned char * data);
00072                 void flashDone(void);
00073                 void timerEvent(QTimerEvent *event);
00074                 void closeEvent(QCloseEvent * event);
00075 
00076         private:
00077                 void handleDashelException(Dashel::DashelException e);
00078         };
00080 }; // Aseba
00081 
00082 #endif


aseba
Author(s): Stéphane Magnenat
autogenerated on Thu Jan 2 2014 11:17:17