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