iCub-main
firmwareupdatercore.h
Go to the documentation of this file.
1 #ifndef FIRMWAREUPDATERCORE_H
2 #define FIRMWAREUPDATERCORE_H
3 
4 #include <QObject>
5 #include <QVariantMap>
6 #include <yarp/os/all.h>
7 //#include <EthUpdater.h>
8 #include <EthMaintainer.h>
9 #include <downloader.h>
10 #include <yarp/dev/all.h>
11 #include <QMutex>
12 
13 using namespace yarp::os;
14 
15 class FirmwareUpdaterCore : public QObject
16 {
17  Q_OBJECT
18 public:
19  explicit FirmwareUpdaterCore(QObject *parent = 0);
20 
21  bool init(Searchable& config, int port, QString address, int VerbositY);
22  bool setVerbosity(int verb);
23  QStringList getDevicesName();
24  QList<QPair<QString,QVariant> > getDevices();
25  int connectTo(QString device, QString id);
26  bool isBoardInMaintenanceMode(QString ip);
27  void disconnectFrom(QString device, QString id);
28  EthBoardList getEthBoardList();
29  void setSelectedEthBoard(int index,bool selected);
30  void setSelectedEthBoard(QString boardIp,bool selected);
31  void setSelectedCanBoard(int index, bool selected, QString ethAddress = "", int deviceId = -1);
32  void setSelectedCanBoards(QList <sBoard> selectedBoards, QString address, int deviceId = -1);
33  boardInfo2_t getMoreDetails(int boardNum = EthMaintainer::ipv4OfAllSelected, QString *infoString = NULL, eOipv4addr_t *address = NULL);
34  QList<sBoard> getCanBoardsFromEth(QString address, QString *retString, int canID = CanPacket::everyCANbus, bool force = false);
35  QList<sBoard> getCanBoardsFromDriver(QString driver, int networkId, QString *retString, bool force = false);
36  void blinkEthBoards();
37  QString getEthBoardInfo(int index);
38  QString getEthBoardAddress(int index);
39  bool setEthBoardInfo(int index, QString newInfo);
40  void setCanBoardInfo(int bus, int id, QString newInfo, QString ethAddress = "", int deviceId = -1, QString *resultString = NULL);
41  bool setEthBoardAddress(int index, QString newAddress);
42  bool setCanBoardAddress(int bus, int id, int canType, QString newAddress, QString ethAddress = "", int deviceId = -1, QString *resultString = NULL);
43  void restartEthBoards();
44  void bootFromApplication();
45  void bootFromUpdater();
46  bool uploadEthApplication(QString filename, QString *resultString);
47  bool uploadCanApplication(QString filename, QString *resultString, bool ee, QString address = "", int deviceId = -1, QList<sBoard> *resultCanBoards = NULL);
48  bool uploadLoader(QString filename, QString *resultString);
49  bool uploadUpdater(QString filename, QString *resultString);
50  //void updateProgressCallback(float);
51  bool jumpToUpdater();
52  bool goToApplication();
53  bool goToMaintenance();
54  bool eraseEthEprom();
55  void eraseCanEprom();
56  QString getProcessFromUint(uint8_t id);
57  cDownloader *getDownloader();
58 
59 
60 private:
61  bool compile_ip_addresses(const char* addr,unsigned int *remoteAddr,unsigned int *localAddr);
62  bool isValidIpAddress(QString addr);
63 private:
64 
65  QList < QPair<QString,QVariant> > devices;
66  //EthUpdater gUpdater;
67  EthMaintainer gMNT;
69  QMutex mutex;
70  QString currentAddress;
71  QString currentDriver;
72  int currentId;
73  QList <sBoard> canBoards;
74  int verbosity;
75  eOipv4addr_t hostIPaddress;
76 
77 signals:
78  void updateProgress(float);
79  void selectedEnded();
80 
81 public slots:
82 };
83 
84 #endif // FIRMWAREUPDATERCORE_H
EthMaintainer
Definition: EthMaintainer.h:43
cDownloader
Definition: downloader.h:111
canID
int canID
Definition: main.cpp:152
verbosity
int verbosity
Definition: main.cpp:21
EthMaintainer::ipv4OfAllSelected
static const eOipv4addr_t ipv4OfAllSelected
Definition: EthMaintainer.h:59
EthMaintainer.h
localAddr
unsigned int localAddr
Definition: main.cpp:153
EthBoardList
Definition: EthBoard.h:127
remoteAddr
unsigned int remoteAddr
Definition: main.cpp:154
downloader.h
compile_ip_addresses
static bool compile_ip_addresses(const char *addr)
Definition: main.cpp:198
CanPacket::everyCANbus
@ everyCANbus
Definition: driver.h:51
boardInfo2_t
Definition: EthBoard.h:34
networkId
int networkId
Definition: main.cpp:151
FirmwareUpdaterCore
Definition: firmwareupdatercore.h:15
downloader
cDownloader downloader
Definition: main.cpp:148