248 if(NULL == boardlist2use)
262 if(NULL != updateProgressBar)
264 updateProgressBar(0.0f);
267 eOuprot_cmd_PROG_START_t * cmdStart = (eOuprot_cmd_PROG_START_t*)
mTxBuffer;
268 eOuprot_cmd_PROG_DATA_t * cmdData = (eOuprot_cmd_PROG_DATA_t*)
mTxBuffer;
269 eOuprot_cmd_PROG_END_t * cmdEnd = (eOuprot_cmd_PROG_END_t*)
mTxBuffer;
271 const int sizeStart =
sizeof(eOuprot_cmd_PROG_START_t);
272 const int sizeEnd =
sizeof(eOuprot_cmd_PROG_END_t);
275 const int HEAD_SIZE = 7;
277 fseek(programFile,0,SEEK_END);
278 float fileSize=(float)(ftell(programFile)/3);
279 fseek(programFile,0,SEEK_SET);
281 memset(cmdStart, EOUPROT_VALUE_OF_UNUSED_BYTE,
sizeof(eOuprot_cmd_PROG_START_t));
282 cmdStart->opc = uprot_OPC_PROG_START;
283 cmdStart->partition = partition;
285 string partname(
"UNK");
286 eOuprot_proc_capabilities_t capability = uprot_canDO_nothing;
287 if(uprot_partitionLOADER == partition)
289 partname = string(
"LDR");
290 capability = uprot_canDO_PROG_loader;
292 else if(uprot_partitionUPDATER == partition)
294 partname = string(
"UPD");
295 capability = uprot_canDO_PROG_updater;
297 else if(uprot_partitionAPPLICATION == partition)
299 partname = string(
"APP");
300 capability = uprot_canDO_PROG_application;
307 sendCommand(ipv4, cmdStart, sizeStart, boardlist2use);
309 yarp::os::Time::delay(0.01);
315 printf(
"EthMaintainer::cmdProgram() is about to program the %s partition of %d boards:", partname.c_str(), (
int)progdata.
selected.size());
316 for(
int j=0; j< progdata.
selected.size(); j++)
318 eOipv4addr_t ipv4 = progdata.
selected[j]->getIPV4();
322 printf(
" %s (%s)", progdata.
selected[j]->getIPV4string().c_str(),
ok ? (
"candoit") : (
"CANTdoit"));
334 eOipv4addr_t rxipv4addr;
335 eOipv4port_t rxipv4port;
341 int numberOfOKreplies = 0;
344 for(
int n=0;
n<1000; ++
n)
348 eOuprot_cmdREPLY_t * reply = (eOuprot_cmdREPLY_t*)
mRxBuffer;
350 if (uprot_OPC_PROG_START == reply->opc)
356 for(
int i=0; i<progdata.
selected.size(); i++)
358 if(rxipv4addr == (progdata.
selected[i]->getIPV4()))
360 if(uprot_RES_OK == reply->res)
370 printf(
"board %s tells that we cannot program the %s partition\n", progdata.
selected[i]->getIPV4string().c_str(), partname.c_str());
375 if (++success >= progdata.
selected.size())
388 if(0 == numberOfOKreplies)
390 std::string earlyexit;
392 for(
int i=0; i<progdata.
selected.size(); ++i)
394 eOipv4addr_t ipv4adr = progdata.
selected[i]->getIPV4();
397 earlyexit += ipv4adrstring;
399 earlyexit += partname;
400 earlyexit += (progdata.
steps[i] == progdata.
mNProgSteps)?
" OK\r\n":
" CANT (early exit)\r\n";
403 stringresult = earlyexit;
418 while (!beof && fgets(buffer,1024,programFile))
420 std::string line(buffer);
422 int cmd=strtol(line.substr(7,2).c_str(),NULL,16);
428 int size =strtol(line.substr(1,2).c_str(),NULL,16);
429 int addrL=strtol(line.substr(3,4).c_str(),NULL,16);
431 int addressHL=addrH<<16|addrL;
433 if (!baseAddress) baseAddress=addressHL;
435 if (bytesToWrite+size>uprot_PROGmaxsize || addressHL!=baseAddress+bytesToWrite)
439 cmdData->size[0]= bytesToWrite &0xFF;
440 cmdData->size[1]=(bytesToWrite>>8)&0xFF;
442 progdata.
data = cmdData;
443 progdata.
size = HEAD_SIZE+bytesToWrite;
446 sendPROG2(uprot_OPC_PROG_DATA, progdata);
447 if(NULL != updateProgressBar)
449 updateProgressBar(
float(bytesWritten+=bytesToWrite)/fileSize);
457 baseAddress=addressHL;
458 cmdData->opc = uprot_OPC_PROG_DATA;
459 cmdData->address[0] = addrL&0xFF;
460 cmdData->address[1] = (addrL>>8)&0xFF;
461 cmdData->address[2] = addrH&0xFF;
462 cmdData->address[3] = (addrH>>8)&0xFF;
465 for (
int i=0; i<size; ++i)
467 cmdData->data[bytesToWrite+i]=(
unsigned char)strtol(line.substr(i*2+9,2).c_str(),NULL,16);
478 cmdData->size[0] = bytesToWrite &0xFF;
479 cmdData->size[1] = (bytesToWrite>>8)&0xFF;
481 progdata.
data = cmdData;
482 progdata.
size = HEAD_SIZE+bytesToWrite;
485 sendPROG2(uprot_OPC_PROG_DATA, progdata);
486 if(NULL != updateProgressBar)
488 updateProgressBar(1.0f);
501 cmdData->size[0] = bytesToWrite &0xFF;
502 cmdData->size[1] = (bytesToWrite>>8)&0xFF;
504 progdata.
data = cmdData;
505 progdata.
size = HEAD_SIZE+bytesToWrite;
508 sendPROG2(uprot_OPC_PROG_DATA, progdata);
509 if(NULL != updateProgressBar)
511 updateProgressBar(
float(bytesWritten+=bytesToWrite)/fileSize);
516 addrH=strtol(line.substr(9,4).c_str(),NULL,16);
523 cmdData->size[0]= bytesToWrite &0xFF;
524 cmdData->size[1]= (bytesToWrite>>8)&0xFF;
526 progdata.
data = cmdData;
527 progdata.
size = HEAD_SIZE+bytesToWrite;
530 sendPROG2(uprot_OPC_PROG_DATA, progdata);
531 if(NULL != updateProgressBar)
533 updateProgressBar(
float(bytesWritten+=bytesToWrite)/fileSize);
544 memset(cmdEnd, EOUPROT_VALUE_OF_UNUSED_BYTE,
sizeof(eOuprot_cmd_PROG_END_t));
545 cmdEnd->opc = uprot_OPC_PROG_END;
546 cmdEnd->numberofpkts[0] = progdata.
mNChunks & 0xFF;
547 cmdEnd->numberofpkts[1] = (progdata.
mNChunks>>8) & 0xFF;
549 progdata.
data = cmdEnd;
550 progdata.
size = sizeEnd;
555 if(NULL != updateProgressBar)
557 updateProgressBar(1.0f);
564 for(
int i=0; i<progdata.
selected.size(); ++i)
571 eOipv4addr_t ipv4adr = progdata.
selected[i]->getIPV4();
574 sOutput += ipv4adrstring;
577 sOutput += (
ok)?
" OK\r\n":
" NOK\r\n";
580 stringresult = sOutput;
666 eOipv4addr_t rxipv4addr;
667 eOipv4port_t rxipv4port;
671 eOuprot_cmd_DISCOVER_REPLY2_t * disc2 =
reinterpret_cast<eOuprot_cmd_DISCOVER_REPLY2_t*
>(
mRxBuffer);
672 eOuprot_cmd_DISCOVER_REPLY_t * disc =
reinterpret_cast<eOuprot_cmd_DISCOVER_REPLY_t*
>(
mRxBuffer);
673 eOuprot_cmd_LEGACY_SCAN_REPLY_t * scan =
reinterpret_cast<eOuprot_cmd_LEGACY_SCAN_REPLY_t*
> (
mRxBuffer);
677 if(uprot_OPC_DISCOVER == disc->reply.opc)
690 binfo.
boardtype = (eObrd_ethtype_t)disc->boardtype;
693 memcpy(&binfo.
processes, &disc->processes,
sizeof(eOuprot_proctable_t));
697 if(eUpdater == binfo.
processes.runningnow)
702 uint8_t index = eouprot_process2index((eOuprot_process_t)disc->processes.runningnow);
709 boardlist.
add(binfo, rxipv4addr);
719 printf(
"EthMaintainer::processDiscoveryReplies2() has found a board @ %s: %s w/ %s v%d.%d running protocol v%d w/ capabilities = 0x%x. mainteinance = %s\n",
720 ipv4rxstring.c_str(),
721 eoboards_type2string2((eObrd_type_t)disc->boardtype, eobool_true),
722 eouprot_process2string((eOuprot_process_t)disc->processes.runningnow),
723 disc->processes.info[index].version.major,
724 disc->processes.info[index].version.minor,
725 disc->reply.protversion,
734 else if (uprot_OPC_LEGACY_SCAN == scan->opc)
752 uint8_t procmajor = scan->version.major;
753 uint8_t procminor = scan->version.minor;
759 for(
int i=7; i>=0; --i)
761 mac=(mac<<8)|scan->mac48[i];
784 binfo.
processes.info[eUpdater].type = eUpdater;
785 binfo.
processes.info[eUpdater].version.major = procmajor;
786 binfo.
processes.info[eUpdater].version.minor = procminor;
791 boardlist.
add(binfo, rxipv4addr);
796 printf(
"EthMaintainer::processDiscoveryReplies2() has found board @ %s in maintenance: the running process is v %d.%d, uses legacy protocol, i assume protocol capabilities = 0x%x.\n",
797 ipv4rxstring.c_str(), procmajor, procminor, binfo.
capabilities);
802 else if(uprot_OPC_DISCOVER2 == disc2->discoveryreply.reply.opc)
811 binfo.
protversion = disc2->discoveryreply.reply.protversion;
812 binfo.
capabilities = disc2->discoveryreply.capabilities;
814 memcpy(&binfo.
macaddress, disc2->discoveryreply.mac48, 6);
815 binfo.
boardtype = (eObrd_ethtype_t)disc2->discoveryreply.boardtype;
818 memcpy(&binfo.
processes, &disc2->discoveryreply.processes,
sizeof(eOuprot_proctable_t));
820 memcpy(binfo.
extraprocesses, disc2->extraprocs,
sizeof(eOuprot_procinfo_t));
824 uint8_t index = eouprot_process2index((eOuprot_process_t)disc2->discoveryreply.processes.runningnow);
831 boardlist.
add(binfo, rxipv4addr);
838 printf(
"EthMaintainer::processDiscoveryReplies2() has a found board @ %s: %s w/ %s v%d.%d running protocol v%d w/ capabilities = 0x%x. mainteinance = %s\n",
839 ipv4rxstring.c_str(),
840 eoboards_type2string2((eObrd_type_t)disc2->discoveryreply.boardtype, eobool_true),
841 eouprot_process2string((eOuprot_process_t)disc2->discoveryreply.processes.runningnow),
842 disc2->discoveryreply.processes.info[index].version.major,
843 disc2->discoveryreply.processes.info[index].version.minor,
844 disc2->discoveryreply.reply.protversion,
845 disc2->discoveryreply.capabilities,
864 eOipv4addr_t rxipv4addr;
865 eOipv4port_t rxipv4port;
869 eOuprot_cmd_MOREINFO_REPLY_t *moreinfo =
reinterpret_cast<eOuprot_cmd_MOREINFO_REPLY_t*
>(
mRxBuffer);
870 eOuprot_cmd_LEGACY_PROCS_REPLY_t *procs =
reinterpret_cast<eOuprot_cmd_LEGACY_PROCS_REPLY_t*
>(
mRxBuffer);
874 if(uprot_OPC_MOREINFO == moreinfo->discover.reply.opc)
880 eOuprot_cmd_DISCOVER_REPLY_t * disc = &moreinfo->discover;
889 binfo.
boardtype = (eObrd_ethtype_t)disc->boardtype;
892 memcpy(&binfo.
processes, &disc->processes,
sizeof(eOuprot_proctable_t));
896 if(eUpdater == binfo.
processes.runningnow)
906 boardlist.
add(binfo, rxipv4addr);
921 printf(
"\nBOARD at address %s:", ipv4rxstring.c_str());
922 printf(
"\n prot = %d, boardtype = %s, startup proc = %s, def2run proc = %s. it has %d processes:",
924 eoboards_type2string2((eObrd_type_t)binfo.
boardtype, eobool_true),
925 eouprot_process2string((eOuprot_process_t)binfo.
processes.startup),
926 eouprot_process2string((eOuprot_process_t)binfo.
processes.def2run),
931 char strdate[24] = {0};
932 char builton[24] = {0};
933 eo_common_date_to_string(binfo.
processes.info[
n].date, strdate,
sizeof(strdate));
934 eo_common_date_to_string(binfo.
processes.info[
n].compilationdate, builton,
sizeof(builton));
935 printf(
"\n proc-%d: type %s w/ appl version = (%d, %d), dated %s, built on %s, rom = [%d, %d) kb",
937 eouprot_process2string((eOuprot_process_t)binfo.
processes.info[
n].type),
946 printf(
"\n now process %s is running", eouprot_process2string((eOuprot_process_t)binfo.
processes.runningnow));
950 printf(
"\n stored info32 is .. ");
951 for(
int m=0; m<32; m++)
959 printf(
"\n stored info32 is .. ");
968 else if(uprot_OPC_LEGACY_PROCS == procs->opc)
979 string moreinfostring;
981 moreinfostring +=
"------------------------------\r\n";
982 moreinfostring += std::string(
"Board\t")+ipv4rxstring;
983 moreinfostring +=
"\r\n\r\n";
984 moreinfostring += std::string((
char*)procs->description);
988 vector<EthBoard *> boards = boardlist.
get(rxipv4addr);
989 for(
int i=0; i<boards.size(); i++)
991 boards[i]->setMoreInfo(moreinfostring);
996 info += moreinfostring;
1001 printf(
"\n received a uprot_OPC_LEGACY_PROCS from IP %s \n", ipv4rxstring.c_str());
1122 char tmp[512] = {0};
1130 binfo.
protversion = disc->discoveryreply.reply.protversion;
1131 binfo.
capabilities = disc->discoveryreply.capabilities;
1132 memcpy(&binfo.
macaddress, disc->discoveryreply.mac48, 6);
1133 binfo.
boardtype = (eObrd_ethtype_t)disc->discoveryreply.boardtype;
1135 memcpy(&binfo.
processes, &disc->discoveryreply.processes,
sizeof(eOuprot_proctable_t));
1137 memcpy(binfo.
extraprocesses, disc->extraprocs,
sizeof(eOuprot_procinfo_t));
1140 if(eUpdater == binfo.
processes.runningnow)
1145 uint8_t index = eouprot_process2index((eOuprot_process_t)disc->discoveryreply.processes.runningnow);
1152 char status[64] =
"normal";
1155 snprintf(status,
sizeof(status),
"maintenance");
1159 snprintf(status,
sizeof(status),
"normal");
1162 char mac_string[64] =
"00-00-00-00-00-00";
1163 snprintf(mac_string,
sizeof(mac_string),
"%02X-%02X-%02X-%02X-%02X-%02X",
1173 snprintf(tmp,
sizeof(tmp),
"BOARD: \n- type: %s \n- mac: %s \n- ip: %s \n- status: %s",
1174 eoboards_type2string2((eObrd_type_t)binfo.
boardtype, eobool_true),
1180 snprintf(tmp,
sizeof(tmp),
"\n\nBOOTSTRAP PROCESSES:"
1184 snprintf(tmp,
sizeof(tmp),
"\n- startup: %s, \n- default: %s, \n- running: %s.",
1185 eouprot_process2string((eOuprot_process_t)binfo.
processes.startup),
1186 eouprot_process2string((eOuprot_process_t)binfo.
processes.def2run),
1187 eouprot_process2string((eOuprot_process_t)binfo.
processes.runningnow)
1191 snprintf(tmp,
sizeof(tmp),
"\n\nPROPS OF THE %d PROCESSES:",
1198 char strdate[24] = {0};
1199 char builton[24] = {0};
1200 constexpr uint8_t maxNumberOfProcessesOnSingleCore {3};
1206 eo_common_date_to_string(pInfo.date, strdate,
sizeof(strdate));
1207 eo_common_date_to_string(pInfo.compilationdate, builton,
sizeof(builton));
1208 snprintf(tmp,
sizeof(tmp),
"\n- proc-%d: \n type: %s \n version: %d.%d, \n dated: %s, \n built on: %s, \n rom: [%d, %d) kb",
1210 eouprot_process2string((eOuprot_process_t)binfo.
processes.info[
n].type),
1211 pInfo.version.major, pInfo.version.minor,
1214 pInfo.rom_addr_kb, pInfo.rom_addr_kb + pInfo.rom_size_kb
1727bool EthMaintainer::program(eOipv4addr_t ipv4, eObrd_ethtype_t type, eOuprot_process_t process, eOversion_t targetversion, FILE *
fp,
bool forcemaintenance,
void progress(
float),
bool restart2application)
1731 const char *targetboardtext = eoboards_type2string2(eoboards_ethtype2type(type), eobool_true);
1733 bool checkversion = (0 == (targetversion.major+targetversion.minor)) ? false :
true;
1734 bool checktype = ((eobrd_ethtype_none == type) || (eobrd_ethtype_unknown == type)) ?
false :
true;
1740 printf(
"ERROR: EthMaintainer::program() could not open the file with the binary code.\n");
1746 vector<EthBoard *> pboards;
1751 printf(
"\nEthMaintainer::program() is about to program the board @ %s of type %s with an %s.\n", ipv4string.c_str(), targetboardtext, eouprot_process2string(process));
1754 if(eUpdater == process)
1758 printf(
"EthMaintainer::program(): is forcing restart2application = false\n");
1760 restart2application =
false;
1769 printf(
"\nERROR: EthMaintainer::program() cannot program the board @ %s because address is invalid.\n", ipv4string.c_str());
1775 if(forcemaintenance)
1779 printf(
"\nEthMaintainer::program() is about to send the board @ %s in maintenance.\n", ipv4string.c_str());
1782 const bool verify =
true;
1787 printf(
"ERROR: EthMaintainer::program() cannot send the board @ %s in maintenance.\n", ipv4string.c_str());
1794 const bool forcemaintenance4information =
false;
1795 boardlist =
information(ipv4,
true, forcemaintenance4information, 2, 1.0);
1799 uint8_t nboards = pboards.size();
1803 printf(
"WARNING: EthMaintainer::program() has found %d boards @ %s.\n", (
int)nboards, ipv4string.c_str());
1807 for(
int i=0; i<nboards; i++)
1811 const char *found = eoboards_type2string2(eoboards_ethtype2type(boardinfo.
boardtype), eobool_true);
1815 printf(
"- board %d of %d: %s\n", i+1, nboards, pboards.at(i)->getIPV4string().c_str());
1821 if((eobrd_ethtype_unknown == boardinfo.
boardtype) || (eobrd_ethtype_none == boardinfo.
boardtype))
1824 printf(
"WARNING: EthMaintainer::program() has found @ %s: type %s and not %s as wanted.\n", pboards.at(i)->getIPV4string().c_str(), found, targetboardtext);
1830 printf(
"ERROR: EthMaintainer::program() has found @ %s: type %s and not %s as wanted.\n", pboards.at(i)->getIPV4string().c_str(), found, targetboardtext);
1840 if(eApplPROGupdater == boardinfo.
processes.runningnow)
1847 const char *runningprocess = eouprot_process2string((eOuprot_process_t)boardinfo.
processes.runningnow);
1848 printf(
"ERROR: EthMaintainer::program() has found @ %s: %s is running and not the eApplPROGupdater as needed to program a %s.\n",
1849 pboards.at(i)->getIPV4string().c_str(), runningprocess, eouprot_process2string(process));
1857 if(eUpdater == boardinfo.
processes.runningnow)
1864 const char *runningprocess = eouprot_process2string((eOuprot_process_t)boardinfo.
processes.runningnow);
1865 printf(
"ERROR: EthMaintainer::program() has found @ %s: %s is running and not the eUpdater as needed to program a %s.\n",
1866 pboards.at(i)->getIPV4string().c_str(), runningprocess, eouprot_process2string(process));
1878 eOuprot_partition2prog_t partition = uprot_partitionAPPLICATION;
1883 partition = uprot_partitionLOADER;
1886 case eApplPROGupdater:
1889 partition = uprot_partitionAPPLICATION;
1894 partition = uprot_partitionUPDATER;
1899 partition = uprot_partitionAPPLICATION;
1914 printf(
"KO: EthMaintainer::program() could not program some of these boards:\n");
1915 for(
int i=0; i<pboards.size(); i++)
1918 printf(
"board %s @ %s.\n",
1919 eoboards_type2string2(eoboards_ethtype2type(boardinfo.
boardtype), eobool_true),
1920 pboards.at(i)->_ipv4string.c_str());
1930 for(
int i=0; i<pboards.size(); i++)
1935 printf(
"OK: EthMaintainer::program() has succesfully programmed board %s @ %s.\n",
1936 eoboards_type2string2(eoboards_ethtype2type(boardinfo.
boardtype), eobool_true),
1937 pboards.at(i)->_ipv4string.c_str());
1948 printf(
"EthMaintainer::program() will now verify if target version matches w/ programmed version.\n");
1951 boardlist =
information(ipv4,
true,
false, 2, 1.0);
1954 if(nboards != pboards.size())
1958 printf(
"WARNING: there were %d boards and there are %d now...\n", (
int)nboards, (
int)boardlist.
size());
1962 for(
int i=0; i<pboards.size(); i++)
1967 uint8_t index = eouprot_process2index(process);
1968 eOuprot_procinfo_t procinfo = boardinfo.
processes.info[index];
1970 eo_common_date_to_string(procinfo.date, datestr,
sizeof(datestr));
1972 if((procinfo.version.major != targetversion.major) || (procinfo.version.minor != targetversion.minor))
1976 printf(
"\nWARNING: EthMaintainer::program() found an unexpected version for board %s: instead of %d.%d, there is %d.%d dated %s:\n",
1977 pboards.at(i)->getIPV4string().c_str(),
1978 targetversion.major, targetversion.minor,
1979 procinfo.version.major, procinfo.version.minor,
1988 printf(
"\nOK: EthMaintainer::program() has succesfully verified that board @ %s contains a %s w/ v = (%d.%d) dated %s\n",
1989 pboards.at(i)->getIPV4string().c_str(),
1990 eouprot_process2string(process),
1991 procinfo.version.major, procinfo.version.minor,
2001 if(restart2application)
2125 eOuprot_cmd_IP_ADDR_SET_t command = {EOUPROT_VALUE_OF_UNUSED_BYTE};
2127 command.opc = uprot_OPC_LEGACY_IP_ADDR_SET;
2128 command.opc2 = uprot_OPC_IP_ADDR_SET;
2129 command.sysrestart = 0;
2131 command.address[3] = (ipv4new>>24) & 0xFF;
2132 command.address[2] = (ipv4new>>16) & 0xFF;
2133 command.address[1] = (ipv4new>>8 ) & 0xFF;
2134 command.address[0] = (ipv4new ) & 0xFF;
2141 bool stopit =
false;
2149 if(!((10 == command.address[0]) || (0 < command.address[1] < 255) || (0 < command.address[2] < 255) || (0 < command.address[3] < 255)))
2158 printf(
"EthMaintainer::command_changeaddress(): cannot send command uprot_OPC_IP_ADDR_SET to %s with new address %s because either one or both are not valid\n", ipv4string.c_str(), ipv4newstring.c_str());
2164 if(checkifnewispresent)
2166 boardlist =
information(ipv4new,
true,
false, 1, 1.0);
2167 if(0 != boardlist.
numberof(ipv4new))
2171 printf(
"EthMaintainer::command_changeaddress(): cannot send command uprot_OPC_IP_ADDR_SET to %s with new address %s because the new address is already present\n", ipv4string.c_str(), ipv4newstring.c_str());
2180 printf(
"EthMaintainer::command_changeaddress(): new address %s is not present\n", ipv4newstring.c_str());
2185 if(forcemaintenance)
2193 printf(
"EthMaintainer::command_changeaddress(): failed to send %s in maintenance\n", ipv4newstring.c_str());
2201 printf(
"EthMaintainer::command_changeaddress(): succesfully sent %s in maintenance\n", ipv4newstring.c_str());
2210 printf(
"EthMaintainer::command_changeaddress(): sent command uprot_OPC_IP_ADDR_SET to %s, new address is %s. w/%s sysrestart\n", ipv4string.c_str(), ipv4newstring.c_str(), (0 == command.sysrestart) ?
"out" :
"");
2213 bool r =
sendCommand(ipv4, &command,
sizeof(command), list2use);
2219 printf(
"EthMaintainer::command_changeaddress(): could not send command\n");
2228 printf(
"EthMaintainer::command_changeaddress(): called command_restart() w/ res %d\n", rr);
2246 yarp::os::Time::delay(1.000);
2253 printf(
"EthMaintainer::command_changeaddress(): board w/ new address %s is in maintenance: %s\n", ipv4newstring.c_str(), ret ?
"YES" :
"NO!");
2262 boardlist =
information(ipv4new,
true,
false, 1, 1.0);
2264 if(0 == boardlist.
numberof(ipv4new))
2268 printf(
"EthMaintainer::command_changeaddress(): error: we dont have the new address %s ...\n", ipv4newstring.c_str());
2275 printf(
"EthMaintainer::command_changeaddress(): OK\n");
2351 vector<string> thestrings(0);
2353 eOuprot_cmd_PAGE_GET_t command = {EOUPROT_VALUE_OF_UNUSED_BYTE};
2354 command.opc = uprot_OPC_PAGE_GET;
2355 command.pagesize = 32;
2357 bool r =
sendCommand(ipv4, &command,
sizeof(command), list2use);
2359 eOipv4addr_t rxipv4addr;
2360 eOipv4port_t rxipv4port;
2364 eOuprot_cmd_PAGE_GET_REPLY_t * pageget = (eOuprot_cmd_PAGE_GET_REPLY_t*)
mRxBuffer;
2368 if(uprot_OPC_PAGE_GET == pageget->reply.opc)
2372 if((rxipv4addr !=
myIPV4addr) && (uprot_RES_OK == pageget->reply.res) && (32 == pageget->pagesize) && (0xff != pageget->page[0]))
2374 readstring = string((
const char*)&pageget->page[1]);
2375 thestrings.push_back(readstring);
2378 for(
int i=0; i<selected.size(); i++)
2387 if(uprot_RES_OK != pageget->reply.res)
2389 printf(
"\n received a eOuprot_cmd_PAGE_GET_REPLY_t from IP %s with a failure result %d for size %d", ipv4rxstring.c_str(), pageget->reply.res, pageget->pagesize);
2393 printf(
"\n received a eOuprot_cmd_PAGE_GET_REPLY_t from IP %s with size %d: ", ipv4rxstring.c_str(), pageget->pagesize);
2395 if(32 == pageget->pagesize)
2398 uint8_t info32[32] = {0};
2399 memcpy(info32, pageget->page, 32);
2401 if(0xff == info32[0])
2403 printf(
"\n stored info32 is .. ");
2404 for(
int m=0; m<32; m++)
2406 printf(
"0x%x ", info32[m]);
2412 printf(
"l = %d, string = %s \n", info32[0], &info32[1]);
bool string2ipv4(const string &ipv4string, eOipv4addr_t &ipv4)
EthBoardList information(eOipv4addr_t ipv4, bool ask2board=true, bool forcemaintenance=true, int numberofrequests=1, double waittimeout=1.0)
EthBoardList discover(bool clearbeforediscovery=true, int numberofdiscoveries=1, double waittimeout=1.0)
bool open(eOipv4addr_t ipv4=hostIPaddress, eOipv4port_t port=mainIPport)
bool command_def2run(eOipv4addr_t ipv4, eOuprot_process_t process, bool forcemaintenance=true, bool verify=true)
bool go2application(eOipv4addr_t ipv4, bool checkdef2runapplication=true, double bootstraptime=10.0, bool verify=true)
bool sendCommand(eOipv4addr_t ipv4, void *cmd, uint16_t len, EthBoardList *boardlist=NULL)
bool go2maintenance(eOipv4addr_t ipv4, bool verify=true, int retries=6, double timegap=1.0)
bool command_eeprom_read(eOipv4addr_t ipv4, uint16_t from, uint16_t size, uint8_t **value)
bool program(eOipv4addr_t ipv4, eObrd_ethtype_t type, eOuprot_process_t process, eOversion_t targetversion, FILE *fp, bool forcemaintenance=true, void progress(float)=NULL, bool restart2application=true)
bool command_program(eOipv4addr_t ipv4, FILE *programFile, eOuprot_partition2prog_t partition, void(*updateProgressBar)(float), EthBoardList *pboardlist, string &stringresult)
bool command_supported(eOipv4addr_t ipv4, eOuprot_proc_capabilities_t capability, bool ask2board=false)
bool command_changeaddress(eOipv4addr_t ipv4, eOipv4addr_t ipv4new, bool checkifnewispresent=true, bool forcemaintenance=true, bool restart=false, bool verify=false)