4#include "ui_mainwindow.h" 
    7#include <QtConcurrent/QtConcurrent> 
   19    qRegisterMetaType <QList<sBoard> > (
"QList<sBoard>");
 
   20    qRegisterMetaType <QVector<int> > (
"QVector<int>");
 
   21    qRegisterMetaType <boardInfo2_t> (
"boardInfo2_t");
 
   22    qRegisterMetaType <eOipv4addr_t> (
"eOipv4addr_t");
 
   23    qRegisterMetaType <sBoard> (
"sBoard");
 
   24    sgboardtype = icubCanProto_boardType__strain;
 
   30    QWidget *container = 
new QWidget(ui->statusBar);
 
   31    QHBoxLayout *layout = 
new QHBoxLayout(container);
 
   32    container->setLayout(layout);
 
   33    container->setFixedHeight(40);
 
   37    progress = 
new QProgressBar(container);
 
   38    progress->setEnabled(
false);
 
   39    progress->setFixedWidth(100);
 
   40    layout->addWidget(progress);
 
   42    infoResult = 
new QLabel(container);
 
   43    infoResult->setVisible(
false);
 
   44    layout->addWidget(infoResult);
 
   47    QSpacerItem *spacer = 
new QSpacerItem(20,40,QSizePolicy::MinimumExpanding,QSizePolicy::Fixed);
 
   48    layout->addSpacerItem(spacer);
 
   50    ui->statusBar->addWidget(container,100);
 
   55    infoTreeWidget = 
new QTreeWidget(ui->groupBox_2);
 
   56    infoTreeWidget->setVisible(
false);
 
   57    ui->groupBox_2->layout()->addWidget(infoTreeWidget);
 
   58    ui->groupBox_2->setTitle(
"Board Properties");
 
   59    infoTreeWidget->setColumnCount(2);
 
   60    infoTreeWidget->setHeaderLabels(QStringList() << 
"Name" << 
"Value");
 
   61    infoTreeWidget->addTopLevelItem(
new QTreeWidgetItem(infoTreeWidget,QStringList() << 
"Board"));
 
   62    infoTreeWidget->addTopLevelItem(
new QTreeWidgetItem(infoTreeWidget,QStringList() << 
"Bootstrap Processes"));
 
   63    infoTreeWidget->addTopLevelItem(
new QTreeWidgetItem(infoTreeWidget,QStringList() << 
"Properties of the Processes"));
 
   66    ui->checkBoxEE->setCheckState(Qt::Unchecked); 
 
   67    ui->checkBoxEE->setEnabled(
false);
 
   71    ui->actionSel->setIcon(QIcon(
":/images/sel-bw.png"));
 
   72    ui->actionDes->setIcon(QIcon(
":/images/des-bw.png"));
 
   76    connect(ui->actionSel, SIGNAL(triggered()), 
this, SLOT(onSel()));
 
   77    connect(ui->actionDes, SIGNAL(triggered()), 
this, SLOT(onDes()));
 
   82    QList < QPair<QString,QVariant> > devices = core->
getDevices();
 
   85    for(
int i=0;i<devices.count();i++){
 
   88        QString dev = devices.at(i).first + 
"<" + devices.at(i).second.toString() + 
">";
 
   91        ui->devicesTree->addTopLevelItem(item);
 
   93        QTreeWidgetItem *empty = 
new QTreeWidgetItem(item,QStringList() << 
"" << 
"" << 
"?");
 
   96        item->setTextColor(
DEVICEID,QColor(Qt::red));
 
   99        ui->advancedGroup->setVisible(
false);
 
  100        ui->strainGroup->setVisible(
false);
 
  113    connect(core,SIGNAL(updateProgress(
float)),
 
  114            this,SLOT(onUpdateProgressBar(
float)),Qt::QueuedConnection);
 
  116    connect(ui->devicesTree,SIGNAL(itemSelectionChanged()),
 
  117            this,SLOT(onDeviceSelectionChanged()));
 
  119                this,SLOT(onDeviceSelectionChanged()),Qt::QueuedConnection);
 
  121    connect(ui->devicesTree,SIGNAL(itemExpanded(QTreeWidgetItem*)),
 
  122            this,SLOT(onDeviceExpanded(QTreeWidgetItem*)));
 
  125            this,SLOT(onDeviceExpanded(QTreeWidgetItem*)),Qt::QueuedConnection);
 
  128    connect(ui->connectButton,SIGNAL(clicked(
bool)),
 
  129            this,SLOT(onConnect()));
 
  132            this,SLOT(onAppendInfo(
sBoard)),Qt::QueuedConnection);
 
  136            this,SLOT(onAppendInfo(QString)),Qt::QueuedConnection);
 
  139            this,SLOT(onAppendInfo(
boardInfo2_t,eOipv4addr_t)),Qt::QueuedConnection);
 
  142            this,SLOT(onCanBoardsRetrieved(QTreeWidgetItem*, 
bool)),Qt::QueuedConnection);
 
  145            this,SLOT(populateEthBoardsNode(QTreeWidgetItem*,
bool,
bool)),Qt::QueuedConnection);
 
  148            this,SLOT(onSetInfoRes(QString)),Qt::QueuedConnection);
 
  151            this,SLOT(onNeedSetRestartOnSelected()),Qt::QueuedConnection);
 
  153    connect(
this,SIGNAL(
needLoading(
bool,
bool,QString,
bool)),
 
  154                this,SLOT(loading(
bool,
bool,QString,
bool)),Qt::QueuedConnection);
 
  156    connect(ui->btnBlink,SIGNAL(clicked(
bool)),
this,SLOT(onBlinkPressed(
bool)));
 
  157    connect(ui->btnCahngeInfo,SIGNAL(clicked(
bool)),
this,SLOT(onChangeInfo(
bool)));
 
  158    connect(ui->btnChangeIp,SIGNAL(clicked(
bool)),
this,SLOT(onChangeAddress(
bool)));
 
  159    connect(ui->btnChangeCanAddr,SIGNAL(clicked(
bool)),
this,SLOT(onChangeAddress(
bool)));
 
  160    connect(ui->btnEraseApplication,SIGNAL(clicked(
bool)),
this,SLOT(onEraseApplication(
bool)));
 
  161    connect(ui->btnRestart,SIGNAL(clicked(
bool)),
this,SLOT(onRestartBoards(
bool)));
 
  163    connect(ui->btnCalibrate,SIGNAL(clicked(
bool)),
this,SLOT(onCalibrate(
bool)));
 
  164    connect(ui->btnBootApp,SIGNAL(clicked(
bool)),
this,SLOT(onBootApplication(
bool)));
 
  165    connect(ui->btnBootUpdater,SIGNAL(clicked(
bool)),
this,SLOT(onBootUpdater(
bool)));
 
  166    connect(ui->btnUploadApp,SIGNAL(clicked(
bool)),
this,SLOT(onUploadApplication(
bool)));
 
  167    connect(ui->btnUploadLoader,SIGNAL(clicked(
bool)),
this,SLOT(onUploadLoader(
bool)));
 
  168    connect(ui->btnUploadUpdater,SIGNAL(clicked(
bool)),
this,SLOT(onUploadUpdater(
bool)));
 
  169    connect(ui->btnJumpUpdater,SIGNAL(clicked(
bool)),
this,SLOT(onJumpToUpdater(
bool)));
 
  170    connect(ui->btnGoToMaintenance,SIGNAL(clicked(
bool)),
this,SLOT(onGoToMaintenance(
bool)));
 
  171    connect(ui->btnGoToApplication,SIGNAL(clicked(
bool)),
this,SLOT(onGoToApplication(
bool)));
 
  172    connect(ui->btnEraseEeprom,SIGNAL(clicked(
bool)),
this,SLOT(onEraseEprom(
bool)));
 
  173    connect(ui->btnStrainCalib,SIGNAL(clicked(
bool)),
this,SLOT(onStrainCalib(
bool)));
 
  174    connect(&watcher, SIGNAL(finished()), 
this, SLOT(onFutureFinished()));
 
  176    ui->devicesTree->sortItems(
ADDRESS,Qt::AscendingOrder);
 
 
  184void MainWindow::onSel(
void)
 
  187    if(selectedNodes.isEmpty())
 
  193    test che mette tutti a sel
 
  194    for(
int i=0;i<ui->devicesTree->topLevelItemCount();i++){
 
  195        QTreeWidgetItem *topLevel = ui->devicesTree->topLevelItem(i);
 
  196        for(
int j=0;j<topLevel->childCount();j++){
 
  198            QTreeWidgetItem *widgItem = topLevel->child(j);
 
  225        for(
int i=0;i<ui->devicesTree->topLevelItemCount();i++){
 
  226            QTreeWidgetItem *topLevel = ui->devicesTree->topLevelItem(i);
 
  227            int mmm = topLevel->childCount();
 
  228            for(
int j=0;j<topLevel->childCount();j++){
 
  230                QTreeWidgetItem *widgItem = topLevel->child(j);
 
  231                if(widgItem->type() != QTreeWidgetItem::Type){
 
  240                    int nnn = topLevel->child(j)->childCount();
 
  241                    for(
int k=0; k<topLevel->child(j)->childCount();k++ ){
 
  242                        QTreeWidgetItem *widgItem1 = topLevel->child(j)->child(k);
 
  243                        if(widgItem1->type() != QTreeWidgetItem::Type){
 
  285    checkEnableButtons();
 
  289void MainWindow::onDes(
void)
 
  292    if(selectedNodes.isEmpty())
 
  325    int size = selectedNodes.size();
 
  326    for(
int i=0;i<size;i++){
 
  342    checkEnableButtons();
 
  346void MainWindow::onUploadLoader(
bool click)
 
  348    QString filename = QFileDialog::getOpenFileName(
this,
"Choose File",QDir::home().absolutePath());
 
  350    if(filename.isEmpty()){
 
  354    QtConcurrent::run(
this,&MainWindow::uploadLoader,filename);
 
  358void MainWindow::onUploadUpdater(
bool click)
 
  360    QString filename = QFileDialog::getOpenFileName(
this,
"Choose File",QDir::home().absolutePath());
 
  362    if(filename.isEmpty()){
 
  366    QtConcurrent::run(
this,&MainWindow::uploadUpdater,filename);
 
  370void MainWindow::onUploadApplication(
bool click)
 
  372    QString filename = QFileDialog::getOpenFileName(
this,
"Choose File",QDir::home().absolutePath());
 
  374    if(filename.isEmpty()){
 
  378    if(!selectedNodes.isEmpty()){
 
  380            QtConcurrent::run(
this,&MainWindow::uploadEthApplication,filename);
 
  382            if(selectedNodes.first()->getParentNode()->type() == 
ETH_TREE_NODE){
 
  383                QString address = selectedNodes.first()->getParentNode()->text(
ADDRESS);
 
  385                QtConcurrent::run(
this,&MainWindow::uploadCanApplication,filename,address,-1,parentNode);
 
  391                getDeviceID(selectedNodes.first()->getParentNode(), deviceIdstr, driver);
 
  392                int deviceId = deviceIdstr.toInt();
 
  394                QtConcurrent::run(
this,&MainWindow::uploadCanApplication,filename,driver,deviceId,parentNode);
 
  404void MainWindow::uploadLoader(QString filename)
 
  408    if(selectedNodes.count() > 0){
 
  418void MainWindow::uploadUpdater(QString filename)
 
  422    if(selectedNodes.count() > 0){
 
  432void MainWindow::uploadEthApplication(QString filename)
 
  436    if(selectedNodes.count() > 0){
 
  446void MainWindow::uploadCanApplication(QString filename,QString address,
int deviceId,
CustomTreeWidgetItem *node)
 
  448    bool bEraseEEPROM = 
false;
 
  449    if(ui->checkBoxEE->isEnabled())
 
  451        Qt::CheckState eestate = ui->checkBoxEE->checkState();
 
  452        bEraseEEPROM = (Qt::Checked == eestate) ? 
true : false;
 
  460    QList <sBoard> resultCanBoards;
 
  461    core->
uploadCanApplication(filename, &result, bEraseEEPROM, address, deviceId, &resultCanBoards);
 
  474void MainWindow::onNeedSetRestartOnSelected()
 
  482void MainWindow::onBootApplication(
bool click)
 
  487    getDeviceID(ui->devicesTree->currentItem()->parent()->text(
DEVICEID), idstr, devicestr);
 
  488    if(ui->devicesTree->currentItem()->data(0,
DEVICE_LEVEL).toInt() == 2 && devicestr == 
"ETH"){
 
  490        QtConcurrent::run(
this,&MainWindow::populateInfo,ui->devicesTree->currentItem()->data(0,
INDEX_OF_BOARD).toInt());
 
  495void MainWindow::onBootUpdater(
bool click)
 
  500    getDeviceID(ui->devicesTree->currentItem()->parent()->text(
DEVICEID), idstr, devicestr);
 
  501    if(ui->devicesTree->currentItem()->data(0,
DEVICE_LEVEL).toInt() == 2 && devicestr == 
"ETH"){
 
  503        QtConcurrent::run(
this,&MainWindow::populateInfo,ui->devicesTree->currentItem()->data(0,
INDEX_OF_BOARD).toInt());
 
  507void MainWindow::onJumpToUpdater(
bool click)
 
  511    watcher.setFuture(future);
 
  514void MainWindow::onGoToMaintenance(
bool click)
 
  521    watcher.setFuture(future);
 
  525void MainWindow::onGoToApplication(
bool click)
 
  532    watcher.setFuture(future);
 
  537void MainWindow::onEraseEprom(
bool click)
 
  539    if(selectedNodes.count() > 0){
 
  543            watcher.setFuture(future);
 
  554void MainWindow::onFutureFinished()
 
  556    if(watcher.result()){
 
  563    checkEnableButtons();
 
  564    onDeviceSelectionChanged();
 
  567void MainWindow::onStrainCalib(
bool click)
 
  569    if(selectedNodes.isEmpty()){
 
  575    yDebug() << 
"onStrainCalib() has device = " << device.toStdString();
 
  576    yDebug() << 
"onStrainCalib() has bus = " << 
board.bus;
 
  577    yDebug() << 
"onStrainCalib() has id = " << 
board.pid;
 
  579    strainCalibGui.exec();
 
  582void MainWindow::onBlinkPressed(
bool click)
 
  587bool MainWindow::getDeviceID(QTreeWidgetItem *child, QString &idstr, QString &devicestr)
 
  590    QByteArray ba = 
tmp.toLatin1();
 
  591    const char *c_str2 = ba.data();
 
  593    char device_cstr[64] = {0};
 
  594    char id_cstr[64] = {0};
 
  595    sscanf(c_str2, 
"%s %s", device_cstr, id_cstr);
 
  596    devicestr = device_cstr;
 
  599    string ttmp = string(c_str2);
 
  600    std::size_t ff = ttmp.find(
"<");
 
  601    std::size_t ll = ttmp.find(
">");
 
  603    t1.assign(ttmp, 0, ff);
 
  605    t2.assign(ttmp, ff+1, ll-ff-1);
 
  606    devicestr = t1.c_str();
 
  613bool MainWindow::getDeviceID(QString devicefullstring, QString &idstr, QString &devicestr)
 
  615    QString 
tmp = devicefullstring;
 
  616    QByteArray ba = 
tmp.toLatin1();
 
  617    const char *c_str2 = ba.data();
 
  619    char device_cstr[64] = {0};
 
  620    char id_cstr[64] = {0};
 
  621    sscanf(c_str2, 
"%s %s", device_cstr, id_cstr);
 
  622    devicestr = device_cstr;
 
  625    string ttmp = string(c_str2);
 
  626    std::size_t ff = ttmp.find(
"<");
 
  627    std::size_t ll = ttmp.find(
">");
 
  629    t1.assign(ttmp, 0, ff);
 
  631    t2.assign(ttmp, ff+1, ll-ff-1);
 
  632    devicestr = t1.c_str();
 
  639void MainWindow::onChangeAddress(
bool click)
 
  641    if(selectedNodes.count() != 1){
 
  654        getCANaddress(child, cbus, cadr, canBus, oldAddress);
 
  661    if(dlg.exec() == QDialog::Accepted){
 
  665                QtConcurrent::run(
this,&MainWindow::setEthBoardAddress,
 
  671                for(
int i=0;i<child->childCount();i++){
 
  672                    child->child(i)->setDisabled(
true);
 
  674                int canType = child->data(0,
CAN_TYPE).toInt();
 
  679                    QPair <QString,QString> addr;
 
  681                    addr.first = address;
 
  683                    QtConcurrent::run(
this,&MainWindow::setCanBoardAddress,
 
  684                                      QPair<int,int>(cbus, cadr),
 
  697                    QString networkIdstr;
 
  701                    QPair <QString,QString> addr;
 
  705                    QtConcurrent::run(
this,&MainWindow::setCanBoardAddress,
 
  706                                      QPair<int,int>(cbus, cadr),
 
  720void MainWindow::onEraseApplication(
bool click)
 
  723    std::cout << 
"Erase application button clicked! Functionality not yet implemented." << std::endl;
 
  726void MainWindow::onChangeInfo(
bool click)
 
  728    if(selectedNodes.count() != 1){
 
  738        oldInfo = child->text(
INFO);
 
  745    if(dlg.exec() == QDialog::Accepted){
 
  753                for(
int i=0;i<child->childCount();i++){
 
  754                    child->child(i)->setDisabled(
true);
 
  761                getCANaddress(child, cbus, cadr, cbustring, cadrstring);
 
  764                    QString address = parentNode->text(
ADDRESS);
 
  765                    QtConcurrent::run(
this,&MainWindow::setCanBoardInfo,
 
  766                                      QPair<int,int>(cbus, cadr),
 
  776                    QString networkIdstr;
 
  780                    QtConcurrent::run(
this,&MainWindow::setCanBoardInfo,
 
  781                                      QPair<int,int>(cbus, cadr),
 
  797void MainWindow::onCalibrate(
bool click)
 
  809void MainWindow::setCanBoardInfo(QPair <int,int> canData, QString info, QString address, 
int deviceId,QTreeWidgetItem *refreshNode)
 
  812    int bus = canData.first;
 
  813    int id  = canData.second;
 
  826void MainWindow::setCanBoardAddress(QPair <int,int> canData, 
int canType, QPair<QString, QString> addr, 
int deviceId,QTreeWidgetItem *refreshNode)
 
  829    int bus = canData.first;
 
  830    int id  = canData.second;
 
  841void MainWindow::setEthBoardInfo(
int index,QString info, QTreeWidgetItem *refreshNode)
 
  845    watcher.setFuture(future);
 
  853void MainWindow::setEthBoardAddress(
int index,QString address, QTreeWidgetItem *refreshNode)
 
  857    watcher.setFuture(future);
 
  871void MainWindow::setNodeRestartNeed(QTreeWidgetItem *refreshNode, 
bool need)
 
  874        refreshNode->setIcon(
DEVICEID,QIcon(
":/images/restart-needed.png"));
 
  876        refreshNode->setIcon(
DEVICEID,QIcon());
 
  880    for(
int i=0;i<refreshNode->childCount();i++){
 
  881        QTreeWidgetItem *child = refreshNode->child(i);
 
  882        child->setDisabled(need);
 
  888void MainWindow::onRestartBoards(
bool click)
 
  900void MainWindow::checkConnectionButton(QTreeWidgetItem *it)
 
  902    if(it->parent() == NULL || it->data(0,
DEVICE_LEVEL) == 2){
 
  903        ui->connectButton->setEnabled(
true);
 
  911        ui->connectButton->setEnabled(
false);
 
  916void MainWindow::onDeviceSelectionChanged()
 
  918    if(ui->devicesTree->selectedItems().count() > 0){
 
  919        checkConnectionButton(ui->devicesTree->currentItem());
 
  922        if(ui->devicesTree->currentItem() && ui->devicesTree->currentItem()->parent()){
 
  924            if(ui->devicesTree->currentItem()->parent()->text(
DEVICEID).contains(
"ETH")){
 
  925                for(
int i=0; i < ui->devicesTree->currentItem()->parent()->childCount();i++){
 
  926                    if(ui->devicesTree->currentItem()->parent()->child(i)->isSelected() &&
 
  927                            ui->devicesTree->currentItem()->parent()->child(i)->data(0,
EMPTY_NODE).toBool() == 
false){
 
  928                        int boardNum =  ui->devicesTree->currentItem()->parent()->child(i)->data(0,
INDEX_OF_BOARD).toInt();
 
  930                        QtConcurrent::run(
this,&MainWindow::populateInfo,boardNum);
 
  939                int level = ui->devicesTree->currentItem()->data(0,
DEVICE_LEVEL).toInt();
 
  942                for(
int i=0; i < ui->devicesTree->currentItem()->parent()->childCount();i++){
 
  943                    if(ui->devicesTree->currentItem()->parent()->child(i)->isSelected() &&
 
  944                            ui->devicesTree->currentItem()->parent()->child(i)->data(0,
EMPTY_NODE).toBool() == 
false){
 
  946                         int boardNum =  ui->devicesTree->currentItem()->parent()->child(i)->data(0,
INDEX_OF_BOARD).toInt();
 
  951                            canBoard = ((
EthTreeWidgetItem*)ui->devicesTree->currentItem()->parent())->getCanBoard(boardNum);
 
  958                        QtConcurrent::run(
this,&MainWindow::populateCANinfo,canBoard);
 
  968        ui->connectButton->setEnabled(
false);
 
  969        ui->actionSel->setEnabled(
false);
 
  970        ui->actionDes->setEnabled(
false);
 
  973    checkEnableButtons();
 
  977void MainWindow::populateInfo(
int boardNum)
 
  981    eOipv4addr_t address;
 
  983    if(!details.isEmpty()){
 
  991void MainWindow::populateCANinfo(
sBoard canboard)
 
  998void MainWindow::onAppendInfo(
boardInfo2_t info,eOipv4addr_t address)
 
 1000    ui->detailsText->setVisible(
false);
 
 1001    infoTreeWidget->setVisible(
true);
 
 1003    infoTreeWidget->clear();
 
 1004    QTreeWidgetItem *boardNode = 
new QTreeWidgetItem(infoTreeWidget,QStringList() << 
"ETH board");
 
 1005    QTreeWidgetItem *bootStrapNode = 
new QTreeWidgetItem(infoTreeWidget,QStringList() << 
"Bootstrap Processes");
 
 1006    QTreeWidgetItem *propertiesNode = 
new QTreeWidgetItem(infoTreeWidget,QStringList() << 
"Properties of the Processes");
 
 1007    infoTreeWidget->addTopLevelItem(boardNode);
 
 1008    infoTreeWidget->addTopLevelItem(bootStrapNode);
 
 1009    infoTreeWidget->addTopLevelItem(propertiesNode);
 
 1011    constexpr uint8_t maxNumberOfProcessesOnSingleCore {3};
 
 1013    QString type = eoboards_type2string(eoboards_ethtype2type(
info.boardtype));
 
 1037    QTreeWidgetItem *typeNode = 
new QTreeWidgetItem(boardNode, QStringList() << 
"Type" << type);
 
 1038    boardNode->addChild(typeNode);
 
 1039    boardNode->setExpanded(
true);
 
 1041    ACE_UINT64 mac = 
info.macaddress;
 
 1044    snprintf(board_mac, 
sizeof(board_mac), 
"%02X-%02X-%02X-%02X-%02X-%02X",
 
 1045                        (uint8_t)(mac >> 40) & 0xff,
 
 1046                        (uint8_t)(mac >> 32) & 0xff,
 
 1047                        (uint8_t)(mac >> 24) & 0xff,
 
 1048                        (uint8_t)(mac >> 16) & 0xff,
 
 1049                        (uint8_t)(mac >> 8 ) & 0xff,
 
 1050                        (uint8_t)(mac      ) & 0xff);
 
 1052    QTreeWidgetItem *macNode = 
new QTreeWidgetItem(boardNode, QStringList() << 
"MAC" << board_mac);
 
 1053    boardNode->addChild(macNode);
 
 1055    QTreeWidgetItem *ipNode = 
new QTreeWidgetItem(boardNode, QStringList() << 
"IP" << 
ipv4tostring(address).c_str());
 
 1056    boardNode->addChild(ipNode);
 
 1058    QString mode = (
info.maintenanceIsActive ? 
"maintenance" : 
"application");
 
 1059    if(eApplPROGupdater == 
info.processes.runningnow)
 
 1061        mode = 
"special application for programming the updater";
 
 1063    else if((eApplication == 
info.processes.runningnow) && (0xff != 
info.applicationdetails))
 
 1065        if(0x01 == (0x01 & 
info.applicationdetails))
 
 1067            mode = 
"application (RUNNING)";
 
 1071            mode = 
"application (IDLE)";
 
 1075    QTreeWidgetItem *statusNode = 
new QTreeWidgetItem(boardNode, QStringList() << 
"Status" << mode);
 
 1078        QFont ff = statusNode->font(1);
 
 1080        statusNode->setFont(1, ff);
 
 1082        if(eApplPROGupdater == 
info.processes.runningnow)
 
 1084            statusNode->setForeground(1, Qt::magenta);
 
 1086        else if(eUpdater == 
info.processes.runningnow)
 
 1088            statusNode->setForeground(1, Qt::blue);
 
 1092            statusNode->setForeground(1, Qt::black);
 
 1096    boardNode->addChild(statusNode);
 
 1099    bool isMulticore = (eoboards_type2numberofcores(eoboards_ethtype2type(
info.boardtype))) > 1 ? 
true : false;
 
 1100    QTreeWidgetItem *startUpNode = 
new QTreeWidgetItem(bootStrapNode, QStringList() << 
"Startup" << core->
getProcessFromUint(
info.processes.startup, isMulticore));
 
 1101    bootStrapNode->addChild(startUpNode);
 
 1102    bootStrapNode->setExpanded(
true);
 
 1104    QTreeWidgetItem *defaultNode = 
new QTreeWidgetItem(bootStrapNode, QStringList() << 
"Default" << core->
getProcessFromUint(
info.processes.def2run, isMulticore));
 
 1105    bootStrapNode->addChild(defaultNode);
 
 1107    QTreeWidgetItem *runningNode = 
new QTreeWidgetItem(bootStrapNode, QStringList() << 
"Running" << core->
getProcessFromUint(
info.processes.runningnow, isMulticore));
 
 1108    bootStrapNode->addChild(runningNode);
 
 1112    propertiesNode->setExpanded(
true);
 
 1113    for(uint8_t i= 0; i < 
info.processes.numberofthem; i++){
 
 1114        eOuprot_procinfo_t pinfo;
 
 1115        if(i < maxNumberOfProcessesOnSingleCore)
 
 1117            pinfo = 
info.processes.info[i];
 
 1121            pinfo = 
info.extraprocesses[i-maxNumberOfProcessesOnSingleCore];
 
 1124        QTreeWidgetItem *processNode = 
new QTreeWidgetItem(propertiesNode, QStringList() << QString(
"Process %1").arg(i));
 
 1125        propertiesNode->addChild(processNode);
 
 1126        processNode->setExpanded(
true);
 
 1128        QTreeWidgetItem *processType = 
new QTreeWidgetItem(processNode, QStringList() << 
"Type" << core->
getProcessFromUint(pinfo.type, isMulticore));
 
 1129        processNode->addChild(processType);
 
 1131        QTreeWidgetItem *processVersion = 
new QTreeWidgetItem(processNode, QStringList() << 
"Version" << QString(
"%1.%2").arg(pinfo.version.major).arg(pinfo.version.minor));
 
 1132        processNode->addChild(processVersion);
 
 1134        QTreeWidgetItem *processDate = 
new QTreeWidgetItem(processNode, QStringList() << 
"Date" << QDateTime(QDate(pinfo.date.year,pinfo.date.month,pinfo.date.day),
 
 1135                                                                                                             QTime(pinfo.date.hour,pinfo.date.min)).toString(
"yyyy/MM/dd - hh:mm"));
 
 1136        processNode->addChild(processDate);
 
 1138        QTreeWidgetItem *processBuilt = 
new QTreeWidgetItem(processNode, QStringList() << 
"Built On" << QDateTime(QDate(pinfo.compilationdate.year,pinfo.compilationdate.month,pinfo.compilationdate.day),
 
 1139                                                                                                      QTime(pinfo.compilationdate.hour,pinfo.compilationdate.min)).toString(
"yyyy/MM/dd - hh:mm"));
 
 1140        processNode->addChild(processBuilt);
 
 1142        std::string processStorageName = (i < maxNumberOfProcessesOnSingleCore) ? 
"ROM" : 
"FLASH";
 
 1143        QTreeWidgetItem *processRom= 
new QTreeWidgetItem(processNode, QStringList() << processStorageName.c_str() << QString(
"[%1, %1+%2) kb").arg(pinfo.rom_addr_kb).arg(pinfo.rom_size_kb));
 
 1144        processNode->addChild(processRom);
 
 1150void MainWindow::onAppendInfo(QString text)
 
 1153    ui->detailsText->clear();
 
 1154    if(!text.isEmpty()){
 
 1155        ui->detailsText->appendPlainText(text);
 
 1157    infoTreeWidget->setVisible(
false);
 
 1158    ui->detailsText->setVisible(
true);
 
 1162void MainWindow::onAppendInfo(
sBoard canboard)
 
 1164    ui->detailsText->setVisible(
false);
 
 1165    infoTreeWidget->setVisible(
true);
 
 1167    infoTreeWidget->clear();
 
 1168    QTreeWidgetItem *boardNode = 
new QTreeWidgetItem(infoTreeWidget,QStringList() << 
"CAN board");
 
 1170    infoTreeWidget->addTopLevelItem(boardNode);
 
 1174    type = eoboards_type2string2((eObrd_type_t)canboard.
type, eobool_true);
 
 1176    QTreeWidgetItem *typeNode = 
new QTreeWidgetItem(boardNode, QStringList() << 
"Type" << type);
 
 1177    boardNode->addChild(typeNode);
 
 1182    snprintf(aaa, 
sizeof(aaa), 
"CAN%d:%d", canboard.
bus, canboard.
pid);
 
 1184    QTreeWidgetItem *adrNode = 
new QTreeWidgetItem(boardNode, QStringList() << 
"Address" << addr);
 
 1185    boardNode->addChild(adrNode);
 
 1190    const char *name = eoboards_type2string2((eObrd_type_t)canboard.
type, eobool_true);
 
 1191    QTreeWidgetItem *type = 
new QTreeWidgetItem(boardNode, QStringList() << 
"Type" << name);
 
 1192    boardNode->addChild(type);
 
 1195    snprintf(str, 
sizeof(str), 
"CAN%d:%d", canboard.
bus, canboard.
pid);
 
 1196    QTreeWidgetItem *adr = 
new QTreeWidgetItem(boardNode, QStringList() << 
"Address" << str);
 
 1197    boardNode->addChild(adr);
 
 1201        snprintf(str, 
sizeof(str), 
"canApplication");
 
 1205        snprintf(str, 
sizeof(str), 
"canBootloader");
 
 1207    QTreeWidgetItem *pro = 
new QTreeWidgetItem(boardNode, QStringList() << 
"Running process" << str);
 
 1208    boardNode->addChild(pro);
 
 1218    QTreeWidgetItem *fwvers = 
new QTreeWidgetItem(boardNode, QStringList() << 
"Firmware version" << str);
 
 1219    boardNode->addChild(fwvers);
 
 1223        snprintf(str, 
sizeof(str), 
"N/A");
 
 1229    QTreeWidgetItem *prvers = 
new QTreeWidgetItem(boardNode, QStringList() << 
"CAN protocol version" << str);
 
 1230    boardNode->addChild(prvers);
 
 1232    snprintf(str, 
sizeof(str), 
"%s", canboard.
add_info);
 
 1233    QTreeWidgetItem *inf = 
new QTreeWidgetItem(boardNode, QStringList() << 
"Info" << str);
 
 1234    boardNode->addChild(inf);
 
 1236    if((eobrd_strain == canboard.
type) || (eobrd_strain2 == canboard.
type) || (eobrd_strain2c == canboard.
type))
 
 1238        QTreeWidgetItem *sn = 
new QTreeWidgetItem(boardNode, QStringList() << 
"Serial Number" << canboard.
serial);
 
 1239        boardNode->addChild(sn);
 
 1242        QTreeWidgetItem *rs = 
new QTreeWidgetItem(boardNode, QStringList() << 
"Regulations Set" << str);
 
 1243        boardNode->addChild(rs);
 
 1254    boardNode->setExpanded(
true);
 
 1260void MainWindow::onConnect()
 
 1263    foreach (QTreeWidgetItem *it, ui->devicesTree->selectedItems()) {
 
 1266             if(it->data(0,
CONNECTED).toBool() == 
true){
 
 1269                 it->setTextColor(
DEVICEID,QColor(Qt::red));
 
 1272             QString deviceIdstr;
 
 1273             getDeviceID(it, deviceIdstr, device);
 
 1275             if(core->
connectTo(device,deviceIdstr) > 0){
 
 1277                 it->setExpanded(
true);
 
 1278                 it->setTextColor(
DEVICEID,QColor(Qt::green));
 
 1281                 it->setTextColor(
DEVICEID,QColor(Qt::red));
 
 1288            QString sss = it->text(
PROCESS);
 
 1289            if(it->text(
PROCESS).contains(
"eUpdater" )){
 
 1290                QtConcurrent::run(
this,&MainWindow::getCanBoards,it,
false);
 
 1294                msgBox.setIcon(QMessageBox::Warning);
 
 1295                if(it->text(
PROCESS).contains(
"eApplPROGupdater" ))
 
 1297                    msgBox.setText(
"The executing process is the " + sss + 
" which does not allow CAN discovery but only the programming of the eUpdater. You have to put the board in maintenance mode");
 
 1301                     msgBox.setText(
"You have to put the board in maintenance mode to perform this operation. Now it is running the " + sss);
 
 1304                msgBox.setStandardButtons(QMessageBox::Ok );
 
 1305                msgBox.setDefaultButton(QMessageBox::Ok);
 
 1310        checkConnectionButton(it);
 
 1316void MainWindow::checkEnableButtons()
 
 1319    bool needRestart = 
false;
 
 1320    bool canUploadLoader = 
true;
 
 1321    bool canUploadApp = 
true;
 
 1322    bool canChangeInfo =  
true;
 
 1323    bool canUploadUpdater = 
true;
 
 1324    bool canJumpUpdater = 
true;
 
 1325    bool canEraseEthEEPROM =  
true;
 
 1326    bool canChangeIP =  
true;
 
 1328    for(
int i=0;i<ui->devicesTree->topLevelItemCount();i++){
 
 1329        QTreeWidgetItem *topLevel = ui->devicesTree->topLevelItem(i);
 
 1330        for(
int j=0;j<topLevel->childCount();j++){
 
 1332            QTreeWidgetItem *widgItem = topLevel->child(j);
 
 1362    if(selectedNodes.isEmpty()){
 
 1363        ui->btnStrainCalib->setEnabled(
false);
 
 1364        ui->btnBlink->setEnabled(
false);
 
 1365        ui->btnBootApp->setEnabled(
false);
 
 1366        ui->btnBootUpdater->setEnabled(
false);
 
 1367        ui->btnCahngeInfo->setEnabled(
false);
 
 1368        ui->btnCalibrate->setEnabled(
false);
 
 1369        ui->btnChangeCanAddr->setEnabled(
false);
 
 1370        ui->btnEraseApplication->setEnabled(
false);
 
 1371        ui->btnChangeIp->setEnabled(
false);
 
 1372        ui->btnEraseEeprom->setEnabled(
false);
 
 1373        ui->btnJumpUpdater->setEnabled(
false);
 
 1374        ui->btnRestart->setEnabled(
false);
 
 1376        ui->btnGoToApplication->setEnabled(
false);
 
 1377        ui->btnGoToMaintenance->setEnabled(
false);
 
 1378        ui->btnUploadApp->setEnabled(
false);
 
 1379        ui->btnUploadLoader->setEnabled(
false);
 
 1380        ui->btnUploadUpdater->setEnabled(
false);
 
 1381        ui->actionSel->setEnabled(
false);
 
 1382        ui->actionDes->setEnabled(
false);
 
 1383        ui->checkBoxEE->setCheckState(Qt::Unchecked);
 
 1384        ui->checkBoxEE->setEnabled(
false);
 
 1391            ui->btnGoToApplication->setEnabled(
true);
 
 1392            ui->btnGoToMaintenance->setEnabled(
true);
 
 1393            ui->btnRestart->setEnabled(
true);
 
 1395            ui->btnBlink->setEnabled(
false);
 
 1396            ui->btnBootApp->setEnabled(
false);
 
 1397            ui->btnBootUpdater->setEnabled(
false);
 
 1398            ui->btnCalibrate->setEnabled(
false);
 
 1400            ui->btnChangeCanAddr->setEnabled(
false);
 
 1401            ui->btnEraseApplication->setEnabled(
false);
 
 1402            ui->btnCahngeInfo->setEnabled(
false);
 
 1404            ui->btnChangeIp->setEnabled(
false);
 
 1405            ui->btnEraseEeprom->setEnabled(
false);
 
 1406            ui->btnJumpUpdater->setEnabled(
false);
 
 1407            ui->btnUploadApp->setEnabled(
false);
 
 1408            ui->btnUploadLoader->setEnabled(
false);
 
 1409            ui->btnUploadUpdater->setEnabled(
false);
 
 1410            ui->actionSel->setEnabled(
false);
 
 1411            ui->actionDes->setEnabled(
false);
 
 1412            ui->checkBoxEE->setCheckState(Qt::Unchecked);
 
 1413            ui->checkBoxEE->setEnabled(
false);
 
 1415            ui->btnBlink->setEnabled(
true);
 
 1416            ui->btnBootApp->setEnabled(
true);
 
 1417            ui->btnBootUpdater->setEnabled(
true);
 
 1419            ui->btnCalibrate->setEnabled(
false);
 
 1420            ui->btnChangeCanAddr->setEnabled(
false);
 
 1421            if(selectedNodes.count() == 1){
 
 1423                ui->btnChangeIp->setEnabled(canChangeIP);
 
 1424                ui->btnCahngeInfo->setEnabled(canChangeInfo);
 
 1425                ui->btnEraseEeprom->setEnabled(canEraseEthEEPROM);
 
 1427                ui->btnChangeIp->setEnabled(
false);
 
 1428                ui->btnCahngeInfo->setEnabled(
false);
 
 1429                ui->btnEraseEeprom->setEnabled(
false);
 
 1433                ui->btnJumpUpdater->setEnabled(
true);
 
 1435                ui->btnJumpUpdater->setEnabled(
false);
 
 1437            ui->btnGoToApplication->setEnabled(
true);
 
 1438            ui->btnGoToMaintenance->setEnabled(
true);
 
 1439            ui->btnRestart->setEnabled(
true);
 
 1442                ui->btnUploadApp->setEnabled(
true);
 
 1443                ui->btnEraseApplication->setEnabled(
true);                
 
 1445                ui->btnUploadApp->setEnabled(
false);
 
 1447            if(canUploadLoader){
 
 1448                ui->btnUploadLoader->setEnabled(
true);
 
 1450                ui->btnUploadLoader->setEnabled(
false);
 
 1452            if(canUploadUpdater){
 
 1453                ui->btnUploadUpdater->setEnabled(
true);
 
 1455                ui->btnUploadUpdater->setEnabled(
false);
 
 1457            ui->actionSel->setEnabled(
true);
 
 1458            ui->actionDes->setEnabled(
true);
 
 1459            ui->checkBoxEE->setCheckState(Qt::Unchecked);
 
 1460            ui->checkBoxEE->setEnabled(
false);
 
 1464        ui->btnBlink->setEnabled(
false);
 
 1465        ui->btnBootApp->setEnabled(
false);
 
 1466        ui->btnBootUpdater->setEnabled(
false);
 
 1468        if(selectedNodes.count() == 1){
 
 1469            ui->btnChangeCanAddr->setEnabled(
true);
 
 1471            ui->btnCahngeInfo->setEnabled(
true);
 
 1473            sBoard canBoard = ((
EthTreeWidgetItem*)selectedNodes.first()->getParentNode())->getCanBoard(selectedNodes.first()->getIndexOfBoard());
 
 1474            if((canBoard.
type == icubCanProto_boardType__strain) || (canBoard.
type == icubCanProto_boardType__strain2) || (canBoard.
type == icubCanProto_boardType__strain2c)){
 
 1475                ui->btnStrainCalib->setEnabled(
true);
 
 1477                ui->btnStrainCalib->setEnabled(
false);
 
 1479            if(((canBoard.
type == icubCanProto_boardType__strain) || (canBoard.
type == icubCanProto_boardType__strain2) || (canBoard.
type == icubCanProto_boardType__strain2c) || (canBoard.
type == icubCanProto_boardType__6sg)) && (canBoard.
status == 
BOARD_RUNNING) ){
 
 1480                sgboardtype = 
static_cast<icubCanProto_boardType_t
>(canBoard.
type);
 
 1481                ui->btnCalibrate->setEnabled(
true);
 
 1483                ui->btnEraseEeprom->setEnabled(
false);
 
 1484                ui->checkBoxEE->setCheckState(Qt::Unchecked); 
 
 1485                ui->checkBoxEE->setEnabled(
true);
 
 1487                ui->btnCalibrate->setEnabled(
false);
 
 1488                ui->btnEraseEeprom->setEnabled(
false);
 
 1489                ui->checkBoxEE->setCheckState(Qt::Unchecked); 
 
 1490                ui->checkBoxEE->setEnabled(
false);
 
 1493            ui->btnChangeCanAddr->setEnabled(
false);
 
 1494            ui->btnEraseApplication->setEnabled(
false);
 
 1495            ui->btnCahngeInfo->setEnabled(
false);
 
 1496            ui->btnCalibrate->setEnabled(
false);
 
 1497            ui->btnEraseEeprom->setEnabled(
false);
 
 1498            ui->checkBoxEE->setCheckState(Qt::Unchecked);
 
 1499            ui->checkBoxEE->setEnabled(
false);
 
 1500            ui->btnStrainCalib->setEnabled(
false);
 
 1502        ui->btnChangeIp->setEnabled(
false);
 
 1504        ui->btnJumpUpdater->setEnabled(
false);
 
 1505        ui->btnRestart->setEnabled(
false);
 
 1507        ui->btnGoToApplication->setEnabled(
false);
 
 1508        ui->btnGoToMaintenance->setEnabled(
false);
 
 1509        ui->btnUploadApp->setEnabled(
true);
 
 1510        ui->btnEraseApplication->setEnabled(
true);
 
 1511        ui->btnUploadLoader->setEnabled(
false);
 
 1512        ui->btnUploadUpdater->setEnabled(
false);
 
 1513        ui->actionSel->setEnabled(
true);
 
 1514        ui->actionDes->setEnabled(
true);
 
 1520void MainWindow::emptyNode(QTreeWidgetItem *it)
 
 1523    QTreeWidgetItem *empty = 
new QTreeWidgetItem(it,QStringList() << 
"" << 
"" << 
"?");
 
 1531    for (
int i = 0; i<ui->devicesTree->selectedItems().count(); i++) {
 
 1532        QTreeWidgetItem *it = ui->devicesTree->selectedItems().at(i);
 
 1533        if(it->parent() != NULL){
 
 
 1552void MainWindow::removeChildren(QTreeWidgetItem *it)
 
 1554    for(
int i=it->childCount() - 1; i >= 0; i--){
 
 1555        QTreeWidgetItem *childItem = it->takeChild(i);
 
 1557        if(childItem->type() != QTreeWidgetItem::Type){
 
 1562            selectedNodes.removeOne(child);
 
 1572void MainWindow::populateEthBoardsNode(QTreeWidgetItem *it, 
bool refreshSingleNode, 
bool refreshAll)
 
 1575    if(refreshSingleNode){
 
 1581    QTreeWidgetItem *parentNode = it->parent();
 
 1599        if(refreshSingleNode){
 
 1600            int count = it->childCount();
 
 1601            for (
int i=0;i<count;i++) {
 
 1605                QTreeWidgetItem *c = parentNode->child(i);
 
 1607                    if(s == c || s == it){
 
 1608                        selectedNodes.removeOne(s);
 
 1613            it->parent()->removeChild(it);
 
 1620            connect(child,SIGNAL(selectedChanged(
bool)),
 
 1621                    this,SLOT(onSelectionChanged(
bool)),Qt::QueuedConnection);
 
 1622            connect(child,SIGNAL(destroyed(QObject*)),
 
 1623                    this,SLOT(onSelectionCheckDestroy(QObject*)));
 
 1625                    this,SLOT(loading(
bool,
bool)),Qt::DirectConnection);
 
 1627            if(selectedNodes.count() > 0){
 
 1628                if(selectedNodes.first()->getBoardType() != child->
getBoardType()){
 
 1638void MainWindow::onSelectionCheckDestroy(QObject *obj)
 
 1645void MainWindow::onCanBoardsRetrieved(QTreeWidgetItem *it, 
bool refresh)
 
 1649    int type = node->type();
 
 1655    node->setExpanded(
true);
 
 1673            connect(canNode,SIGNAL(selectedChanged(
bool)),
 
 1674                    this,SLOT(onSelectionChanged(
bool)),Qt::QueuedConnection);
 
 1675            connect(canNode,SIGNAL(destroyed(QObject*)),
 
 1676                    this,SLOT(onSelectionCheckDestroy(QObject*)),Qt::DirectConnection);
 
 1678                    this,SLOT(loading(
bool,
bool)),Qt::DirectConnection);
 
 1681            if(selectedNodes.count() > 0){
 
 1682                if(selectedNodes.first()->getBoardType() != canNode->
getBoardType()){
 
 1690        for(
int i=0;i<node->childCount();i++){
 
 1696    checkEnableButtons();
 
 1701void MainWindow::getCanBoards(QTreeWidgetItem *it, 
bool refresh)
 
 1716void MainWindow::onDeviceExpanded(QTreeWidgetItem *it)
 
 1737void MainWindow::onSetInfoRes(QString result)
 
 1740    infoResult->setVisible(
true);
 
 1741    infoResult->setText(result);
 
 1742    onDeviceSelectionChanged();
 
 1746void MainWindow::onUpdateProgressBar(
float fraction)
 
 1749    loadingMutex.lock();
 
 1751    if (fraction < 0.0f){
 
 1753    }
else if (fraction>1.0f){
 
 1756    int val = fraction*100;
 
 1758    if(progress->maximum() == 0){
 
 1759        progress->setMaximum(100);
 
 1763        if(!progress->isEnabled()){
 
 1764            progress->setEnabled(
true);
 
 1768        infoResult->setVisible(
true);
 
 1769        infoResult->setText(
"Updating...");
 
 1772        progress->setEnabled(
false);
 
 1775        infoResult->setText(
"Update Done");
 
 1778    progress->setValue(val);
 
 1779    loadingMutex.unlock();
 
 1783void MainWindow::loading(
bool load, 
bool disableAll,QString msg,
bool infiniteLoad)
 
 1790            progress->setMaximum(0);
 
 1791            progress->setEnabled(
true);
 
 1794        ui->strainGroup->setEnabled(
false);
 
 1795        ui->advancedGroup->setEnabled(
false);
 
 1796        ui->controlsGroup->setEnabled(
false);
 
 1797        infoResult->setVisible(
true);
 
 1799            ui->devicesTree->setEnabled(
false);
 
 1801        infoResult->setText(
"Loading...");
 
 1804        if(loadCounter == 0){
 
 1806                progress->setMaximum(100);
 
 1807                progress->setEnabled(
false);
 
 1809            ui->strainGroup->setEnabled(
true);
 
 1810            ui->advancedGroup->setEnabled(
true);
 
 1811            ui->controlsGroup->setEnabled(
true);
 
 1812            if(!ui->devicesTree->isEnabled()){
 
 1813                ui->devicesTree->setEnabled(
true);
 
 1815            infoResult->setVisible(
true);
 
 1817                infoResult->setText(msg);
 
 1819                infoResult->setText(
"Operation Done");
 
 1831        for(
int i=0;i<ui->devicesTree->topLevelItemCount();i++){
 
 1832            QTreeWidgetItem *topLevel = ui->devicesTree->topLevelItem(i);
 
 1833            for(
int j=0;j<topLevel->childCount();j++){
 
 1835                QTreeWidgetItem *widgItem = topLevel->child(j);
 
 1836                if(widgItem->type() != QTreeWidgetItem::Type){
 
 1848                    for(
int k=0; k<topLevel->child(j)->childCount();k++ ){
 
 1849                        QTreeWidgetItem *widgItem1 = topLevel->child(j)->child(k);
 
 1850                        if(widgItem1->type() != QTreeWidgetItem::Type){
 
 1872        for(
int i=0;i<ui->devicesTree->topLevelItemCount();i++){
 
 1873            QTreeWidgetItem *topLevel = ui->devicesTree->topLevelItem(i);
 
 1874            for(
int j=0;j<topLevel->childCount();j++){
 
 1875                QTreeWidgetItem *widgItem = topLevel->child(j);
 
 1876                if(widgItem->type() != QTreeWidgetItem::Type){
 
 1883                    for(
int k=0; k<topLevel->child(j)->childCount();k++ ){
 
 1884                        QTreeWidgetItem *widgItem1 = topLevel->child(j)->child(k);
 
 1885                        if(widgItem1->type() != QTreeWidgetItem::Type){
 
 1905            for(
int i=0;i<ui->devicesTree->topLevelItemCount();i++){
 
 1906                QTreeWidgetItem *topLevel = ui->devicesTree->topLevelItem(i);
 
 1907                for(
int j=0;j<topLevel->childCount();j++){
 
 1908                    QTreeWidgetItem *widgItem = topLevel->child(j);
 
 1909                    if(widgItem->type() != QTreeWidgetItem::Type){
 
 1912                        if(!topLevel->child(j)->isDisabled()){
 
 1915                        for(
int k=0; k<topLevel->child(j)->childCount();k++ ){
 
 1919                            QTreeWidgetItem *widgItem1 = topLevel->child(j)->child(k);
 
 1920                            if(widgItem1->type() != QTreeWidgetItem::Type){
 
 1922                                if(!topLevel->child(j)->child(k)->isDisabled()){
 
 1940void MainWindow::onSelectionChanged(
bool selected)
 
 1946        if(selectedNodes.contains(c)){
 
 1948            checkEnableButtons();
 
 1952        selectedNodes.append(c);
 
 1957        selectedNodes.removeOne(c);
 
 1961    checkSelection(selected,c);
 
 1964    checkEnableButtons();
 
 1968bool MainWindow::getCANaddress(
CustomTreeWidgetItem *child, 
int &cbus, 
int &cadr, QString &cbustr, QString &cadrstr)
 
 1970#if defined(_MAIN_WINDOW_SHOW_CAN_ADDRESS_IN_ADDRESS_COLUMN) 
 1973    QByteArray ba = 
tmp.toLatin1();
 
 1974    const char *c_str2 = ba.data();
 
 1976    bool bIPprefix = 
false;
 
 1977#if defined(_MAIN_WINDOW_USE_IP_PREFIX_FOR_CAN_ADDRESS) 
 1981    if(
false == bIPprefix)
 
 1983        sscanf(c_str2, 
"CAN%d:%d", &cbus, &cadr);
 
 1987        int ip1, ip2, ip3, ip4;
 
 1988        sscanf(c_str2, 
"%d.%d.%d.%d:CAN%d:%d", &ip1, &ip2, &ip3, &ip4, &cbus, &cadr);
 
 1992    snprintf(strtmp, 
sizeof(strtmp), 
"%d", cadr);
 
 1995    snprintf(strtmp, 
sizeof(strtmp), 
"CAN%d", cbus);
 
 2000    cbus = child->text(
ADDRESS).remove(
"CAN").toInt();
 
 2001    cadr = child->text(ID).toInt();
 
 2004    snprintf(strtmp, 
sizeof(strtmp), 
"%d", cadr);
 
 2007    snprintf(strtmp, 
sizeof(strtmp), 
"CAN%d", cbus);
 
string ipv4tostring(eOipv4addr_t ipv4)
 
void setOldAddress(QString address)
 
void setOldInfo(QString info)
 
int connectTo(QString device, QString id)
 
void setSelectedCanBoards(QList< sBoard > selectedBoards, QString address, int deviceId=-1)
 
bool setEthBoardAddress(int index, QString newAddress)
 
bool uploadCanApplication(QString filename, QString *resultString, bool ee, QString address="", int deviceId=-1, QList< sBoard > *resultCanBoards=NULL)
 
QString getProcessFromUint(uint8_t id, bool isMultiCore=false)
 
QString getEthBoardInfo(int index)
 
QString getEthBoardAddress(int index)
 
boardInfo2_t getMoreDetails(int boardNum=EthMaintainer::ipv4OfAllSelected, QString *infoString=NULL, eOipv4addr_t *address=NULL)
 
EthBoardList getEthBoardList()
 
QList< QPair< QString, QVariant > > getDevices()
 
void bootFromApplication()
 
bool setEthBoardInfo(int index, QString newInfo)
 
bool uploadUpdater(QString filename, QString *resultString)
 
void setCanBoardInfo(int bus, int id, QString newInfo, QString ethAddress="", int deviceId=-1, QString *resultString=NULL)
 
bool setCanBoardAddress(int bus, int id, int canType, QString newAddress, QString ethAddress="", int deviceId=-1, QString *resultString=NULL)
 
bool uploadEthApplication(QString filename, QString *resultString)
 
bool uploadLoader(QString filename, QString *resultString)
 
void needSetRestartOnSelected()
 
void refreshCanBoardsFromEth(QTreeWidgetItem *)
 
void deviceSelectionChanged()
 
MainWindow(FirmwareUpdaterCore *core, bool adminMode, QWidget *parent=0)
 
void needLoading(bool, bool, QString="", bool=true)
 
void canBoardsRetrieved(QTreeWidgetItem *it, bool refresh)
 
void appendInfo(boardInfo2_t, eOipv4addr_t)
 
void refreshEthBoardsNode(QTreeWidgetItem *, bool refresh=false, bool refreshAll=false)
 
#define CAN_UPLOAD_LOADER
 
#define CAN_UPLOAD_UPDATER
 
bool applicationisrunning