24 #include <yarp/os/Time.h>
26 #include <yarp/os/Log.h>
28 using namespace yarp::os;
33 eo_common_ipv4addr_to_string(ipv4, ipv4text,
sizeof(ipv4text));
38 bool string2ipv4(
const string &ipv4string, eOipv4addr_t &ipv4)
40 int ip1, ip2, ip3, ip4;
41 int n = sscanf(ipv4string.c_str(),
"%d.%d.%d.%d", &ip1, &ip2, &ip3, &ip4);
47 ipv4 = EO_COMMON_IPV4ADDR(ip1, ip2, ip3, ip4);
55 return htonl(address);
84 _useofinternalboardlist =
true;
101 _opened = mSocket.Create(ipv4, port);
105 else if((myIPV4addr == ipv4) && (myIPV4port == port))
119 _internalboardlist.clear();
174 eOuprot_cmd_EEPROM_ERASE_t command = {EOUPROT_VALUE_OF_UNUSED_BYTE};
176 command.opc = uprot_OPC_LEGACY_EEPROM_ERASE;
177 command.opc2 = uprot_OPC_EEPROM_ERASE;
178 command.sysrestart = 0;
182 sendCommand(ipv4, &command,
sizeof(command));
202 if((0 == size) || (size > uprot_EEPROMmaxsize))
207 eOuprot_cmd_EEPROM_READ_t command = {EOUPROT_VALUE_OF_UNUSED_BYTE};
209 command.opc = uprot_OPC_EEPROM_READ;
210 command.address = from;
213 sendCommand(ipv4, &command,
sizeof(command));
217 eOipv4addr_t rxipv4addr;
218 eOipv4port_t rxipv4port;
220 while(mSocket.ReceiveFrom(rxipv4addr, rxipv4port, mRxBuffer,
sizeof(mRxBuffer), 1000) > 0)
222 eOuprot_cmd_EEPROM_READ_REPLY_t * eepromread = (eOuprot_cmd_EEPROM_READ_REPLY_t*) mRxBuffer;
224 if(uprot_OPC_EEPROM_READ == eepromread->reply.opc)
227 if(rxipv4addr == ipv4)
229 ret = (uprot_RES_OK == eepromread->reply.res) ?
true :
false;
233 *value = eepromread->eeprom;
248 if(NULL == boardlist2use)
250 boardlist2use = &_internalboardlist;
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();
320 bool ok = command_supported(ipv4, capability);
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)
346 while(mSocket.ReceiveFrom(rxipv4addr, rxipv4port, mRxBuffer,
sizeof(mRxBuffer), 10) > 0)
348 eOuprot_cmdREPLY_t * reply = (eOuprot_cmdREPLY_t*) mRxBuffer;
350 if (uprot_OPC_PROG_START == reply->opc)
352 if (rxipv4addr != myIPV4addr)
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;
553 sendPROG2(uprot_OPC_PROG_END, progdata);
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;
592 if(ipv4OfAllSelected == ipv4)
594 if(NULL == boardlist)
596 boardlist = &_internalboardlist;
598 vector<EthBoard *> selected = boardlist->
get(ipv4);
599 for(
int i=0; i<selected.size(); i++)
601 mSocket.SendTo(selected[i]->getIPV4(), myIPV4port,
cmd, len);
605 else if(ipv4Broadcast == ipv4)
607 mSocket.SendBroad(myIPV4port,
cmd, len);
612 mSocket.SendTo(ipv4, myIPV4port,
cmd, len);
622 vector<EthBoard *> selected = boardlist.
get(ipv4);
629 for(
int i=0; i<selected.size(); i++)
631 if(
false == selected[i]->isInMaintenance())
643 vector<EthBoard *> selected = boardlist.
get(ipv4);
650 for(
int i=0; i<selected.size(); i++)
652 if(
false == selected[i]->isInApplication())
666 eOipv4addr_t rxipv4addr;
667 eOipv4port_t rxipv4port;
669 while(mSocket.ReceiveFrom(rxipv4addr, rxipv4port, mRxBuffer,
sizeof(mRxBuffer), waittimeout*1000.0) > 0)
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)
681 if(rxipv4addr != myIPV4addr)
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);
707 binfo.
moreinfostring = prepareMoreInfoText(disc, ipv4rxstring.c_str());
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)
738 if(rxipv4addr != myIPV4addr)
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)
806 if(rxipv4addr != myIPV4addr)
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);
829 binfo.
moreinfostring = prepareMoreInfoText(disc2, ipv4rxstring.c_str());
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;
867 while(mSocket.ReceiveFrom(rxipv4addr, rxipv4port, mRxBuffer,
sizeof(mRxBuffer), 500) > 0)
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)
878 if(rxipv4addr != myIPV4addr)
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)
904 binfo.
moreinfostring = prepareMoreInfoText(disc, ipv4rxstring.c_str());
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)
974 if (rxipv4addr != myIPV4addr)
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());
1020 char tmp[512] = {0};
1031 binfo.
boardtype = (eObrd_ethtype_t)disc->boardtype;
1033 memcpy(&binfo.
processes, &disc->processes,
sizeof(eOuprot_proctable_t));
1037 if(eUpdater == binfo.
processes.runningnow)
1042 uint8_t index = eouprot_process2index((eOuprot_process_t)disc->processes.runningnow);
1049 char status[64] =
"normal";
1052 snprintf(status,
sizeof(status),
"maintenance");
1056 snprintf(status,
sizeof(status),
"normal");
1059 char mac_string[64] =
"00-00-00-00-00-00";
1060 snprintf(mac_string,
sizeof(mac_string),
"%02X-%02X-%02X-%02X-%02X-%02X",
1070 snprintf(
tmp,
sizeof(
tmp),
"BOARD: \n- type: %s \n- mac: %s \n- ip: %s \n- status: %s",
1071 eoboards_type2string2((eObrd_type_t)binfo.
boardtype, eobool_true),
1077 snprintf(
tmp,
sizeof(
tmp),
"\n\nBOOTSTRAP PROCESSES:"
1081 snprintf(
tmp,
sizeof(
tmp),
"\n- startup: %s, \n- default: %s, \n- running: %s.",
1082 eouprot_process2string((eOuprot_process_t)binfo.
processes.startup),
1083 eouprot_process2string((eOuprot_process_t)binfo.
processes.def2run),
1084 eouprot_process2string((eOuprot_process_t)binfo.
processes.runningnow)
1088 snprintf(
tmp,
sizeof(
tmp),
"\n\nPROPS OF THE %d PROCESSES:",
1095 char strdate[24] = {0};
1096 char builton[24] = {0};
1097 eo_common_date_to_string(binfo.
processes.info[
n].date, strdate,
sizeof(strdate));
1098 eo_common_date_to_string(binfo.
processes.info[
n].compilationdate, builton,
sizeof(builton));
1099 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",
1101 eouprot_process2string((eOuprot_process_t)binfo.
processes.info[
n].type),
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
1230 info +=
"------------------------------\r\n";
1231 info += std::string(
"Board\t")+std::string(ipaddr);
1234 if(1 == moreinfo->hasdescription)
1236 info += std::string((
char*)moreinfo->description);
1240 info += std::string(
"the message does not have a textual description");
1252 if(uprot_OPC_PROG_DATA == opc)
1254 bool validFLASHaddress =
true;
1262 eOuprot_cmd_PROG_DATA_t *pd =
reinterpret_cast<eOuprot_cmd_PROG_DATA_t*
>(progdata.
data);
1263 uint32_t adr = *
reinterpret_cast<uint32_t*
>(&pd->address[0]);
1264 uint16_t siz = *
reinterpret_cast<uint16_t*
>(&pd->size[0]);
1266 if((adr < 0x08000000) || (adr >= 0x08200000) || ((adr+siz) > 0x08200000))
1268 validFLASHaddress =
false;
1269 printf(
"EthMaintainer::sendPROG2() detected and filtered out a eOuprot_cmd_PROG_DATA_t w/ non-FLASH chunch of %d bytes in [0x%x, 0x%x]\n" ,
1273 if(
false == validFLASHaddress)
1281 for(
int k=0;k<progdata.
selected.size(); k++)
1283 mSocket.SendTo(progdata.
selected[k]->getIPV4(), myIPV4port, progdata.
data, progdata.
size);
1287 eOipv4addr_t rxipv4addr;
1288 eOipv4port_t rxipv4port;
1290 if(uprot_OPC_PROG_DATA == opc)
1299 for (
int r=0; r<progdata.
retries; ++r)
1301 for (
int a=0; a<progdata.
answers; ++a)
1303 if(mSocket.ReceiveFrom(rxipv4addr, rxipv4port, mRxBuffer,
sizeof(mRxBuffer), 10) > 0)
1305 eOuprot_cmdREPLY_t * reply = (eOuprot_cmdREPLY_t*) mRxBuffer;
1307 if (opc == reply->opc)
1309 if (rxipv4addr != myIPV4addr)
1313 for(
int i=0; i<progdata.
selected.size(); i++)
1315 if(rxipv4addr == (progdata.
selected[i]->getIPV4()))
1317 if (uprot_RES_OK == reply->res)
1319 ++(progdata.
steps[i]);
1326 if (!--progdata.
answers)
return 0;
1339 _useofinternalboardlist =
on;
1348 if(_useofinternalboardlist)
1350 list2use = &_internalboardlist;
1353 if(clearbeforediscovery)
1358 const bool forceUpdatingMode =
false;
1359 eOuprot_cmd_DISCOVER_t *
cmd = (eOuprot_cmd_DISCOVER_t*) mTxBuffer;
1360 memset(
cmd, EOUPROT_VALUE_OF_UNUSED_BYTE,
sizeof(eOuprot_cmd_DISCOVER_t));
1361 cmd->opc = uprot_OPC_LEGACY_SCAN;
1362 cmd->opc2 = uprot_OPC_DISCOVER;
1363 cmd->jump2updater = (
true == forceUpdatingMode) ? (1) : (0);
1364 #define ETH_MAINTAINER_DISCOVER_UNICASTMODE
1365 for(
int i=0; i<numberofdiscoveries; i++)
1367 #if defined(ETH_MAINTAINER_DISCOVER_UNICASTMODE)
1368 eOipv4addr_t adr = EO_COMMON_IPV4ADDR(10, 0, 1, 99);
1369 sendCommand(adr,
cmd,
sizeof(eOuprot_cmd_DISCOVER_t), list2use);
1370 for(
int i=1; i<=32; i++)
1372 adr = EO_COMMON_IPV4ADDR(10, 0, 1, i);
1373 sendCommand(adr,
cmd,
sizeof(eOuprot_cmd_DISCOVER_t), list2use);
1376 sendCommand(ipv4Broadcast,
cmd,
sizeof(eOuprot_cmd_DISCOVER_t), list2use);
1379 processDiscoveryReplies2(*list2use, waittimeout);
1388 _internalboardlist.theboards = boards.
theboards;
1395 return _internalboardlist;
1401 _internalboardlist.clear();
1407 _internalboardlist.select(
on, ipv4);
1413 _internalboardlist.add(info2, ipv4, force);
1415 return _internalboardlist.size();
1420 _internalboardlist.rem(ipv4);
1421 return _internalboardlist.size();
1429 if(_useofinternalboardlist)
1431 list2use = &_internalboardlist;
1439 vector<EthBoard *> boards = list2use->
get(ipv4);
1441 if(0 == boards.size())
1448 for(
int i=0; i<boards.size(); i++)
1450 uint32_t mask = boards[i]->getInfo().capabilities;
1451 bool r = ((mask & capability) == capability) ? true :
false;
1463 if(_useofinternalboardlist)
1465 list2use = &_internalboardlist;
1468 if(
true == ask2board)
1472 if(forcemaintenance)
1474 go2maintenance(ipv4,
true, 6, 1.0);
1479 const bool forceUpdatingMode =
false;
1480 eOuprot_cmd_DISCOVER_t *
cmd = (eOuprot_cmd_DISCOVER_t*) mTxBuffer;
1481 memset(
cmd, EOUPROT_VALUE_OF_UNUSED_BYTE,
sizeof(eOuprot_cmd_DISCOVER_t));
1482 cmd->opc = uprot_OPC_LEGACY_SCAN;
1483 cmd->opc2 = uprot_OPC_DISCOVER;
1484 cmd->jump2updater = (
true == forceUpdatingMode) ? (1) : (0);
1486 for(
int i=0; i<numberofrequests; i++)
1488 sendCommand(ipv4Broadcast,
cmd,
sizeof(eOuprot_cmd_DISCOVER_t), list2use);
1490 processDiscoveryReplies2(*list2use, waittimeout);
1497 vector<EthBoard *> bb = list2use->
get(ipv4);
1499 for(
int i=0; i<bb.size(); i++)
1501 ret.
add(bb.at(i)->getInfo(), bb.at(i)->getIPV4());
1502 ret.
select(bb.at(i)->isSelected(), bb.at(i)->getIPV4());
1513 if(_useofinternalboardlist)
1515 list2use = &_internalboardlist;
1518 const bool ask2board =
true;
1519 const int numberofrequests = 1;
1523 if(
true == ask2board)
1527 if(forcemaintenance)
1529 go2maintenance(ipv4,
true, 6, 1.0);
1534 eOuprot_cmd_MOREINFO_t command;
1536 command.opc = uprot_OPC_LEGACY_PROCS;
1537 command.opc2 = uprot_OPC_MOREINFO;
1538 command.plusdescription = 1;
1539 command.jump2updater = 0;
1541 for(
int i=0; i<numberofrequests; i++)
1543 sendCommand(ipv4, &command,
sizeof(command), list2use);
1545 ret += processMoreInfoReplies(*list2use);
1556 if(_useofinternalboardlist)
1558 list2use = &_internalboardlist;
1562 const bool forceUpdatingMode =
true;
1563 eOuprot_cmd_DISCOVER_t command;
1564 memset(&command, EOUPROT_VALUE_OF_UNUSED_BYTE,
sizeof(eOuprot_cmd_DISCOVER_t));
1565 command.opc = uprot_OPC_LEGACY_SCAN;
1566 command.opc2 = uprot_OPC_DISCOVER;
1567 command.jump2updater = (
true == forceUpdatingMode) ? (1) : (0);
1570 sendCommand(ipv4, &command,
sizeof(command), list2use);
1571 processDiscoveryReplies2(*list2use);
1577 for(
int iter=0; iter<retries; iter++)
1579 if(isInMaintenance(ipv4, *list2use))
1583 printf(
"EthMaintainer::go2maintenance() succesfully sent in maintenance board %s after %d attempts\n",
ipv4tostring(ipv4).c_str(), iter+1);
1588 yarp::os::Time::delay(timegap);
1592 printf(
"EthMaintainer::go2maintenance() resent command for the %d-th time to board %s after %f secs\n", iter+1,
ipv4tostring(ipv4).c_str(), timegap);
1596 sendCommand(ipv4, &command,
sizeof(command), list2use);
1597 processDiscoveryReplies2(*list2use);
1602 bool ret = isInMaintenance(ipv4, *list2use);
1608 printf(
"EthMaintainer::go2maintenance() succesfully sent in maintenance board %s after %d retries\n",
ipv4tostring(ipv4).c_str(), retries);
1612 printf(
"EthMaintainer::go2maintenance() could not send in maintenance board %s even after %d retries\n",
ipv4tostring(ipv4).c_str(), retries);
1624 EthBoardList boardlist = information(ipv4,
true,
false, 2, 1.0);
1625 vector<EthBoard *> pboards;
1631 bool forcemaintainance =
false;
1632 bool forcedef2runapplication =
false;
1634 if(
true == isInApplication(ipv4, boardlist))
1636 if(checkdef2runapplication)
1639 pboards = boardlist.
get(ipv4);
1640 for(
int i=0; i<pboards.size(); i++)
1643 if(eApplication != info.processes.def2run)
1645 forcemaintainance =
true;
1646 forcedef2runapplication =
true;
1651 if((
false == forcemaintainance) && (
false == forcedef2runapplication))
1659 if(
false == go2maintenance(ipv4))
1663 printf(
"EthMaintainer::go2application() has called go2maintenance() which has failed for board %s.\n",
ipv4tostring(ipv4).c_str());
1671 if(
false == command_def2run(ipv4, eApplication,
false,
true))
1675 printf(
"EthMaintainer::go2application() has called command_def2run() which has failed for board %s.\n",
ipv4tostring(ipv4).c_str());
1683 command_restart(ipv4);
1685 yarp::os::Time::delay(bootstraptime);
1692 boardlist = information(ipv4,
true,
false, 2, 1.0);
1694 ret = isInApplication(ipv4, boardlist);
1698 pboards = boardlist.
get(ipv4);
1703 printf(
"EthMaintainer::go2application(): could not find any board %s after restart and wait of %f seconds \n",
ipv4tostring(ipv4).c_str(), bootstraptime);
1711 printf(
"EthMaintainer::go2application(): some boards %s are not in eApplication after restart and wait of %f seconds:\n",
ipv4tostring(ipv4).c_str(), bootstraptime);
1712 for(
int i=0; i<pboards.size(); i++)
1715 printf(
"- board %s is in %s\n", pboards[i]->getIPV4string().c_str(), eouprot_process2string((eOuprot_process_t)info.processes.runningnow));
1727 bool 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;
1765 if(ipv4 == ipv4Broadcast)
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;
1783 if(
false == go2maintenance(ipv4, verify, 6, 1.0))
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);
1797 pboards = boardlist.
get(ipv4Broadcast);
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;
1905 ret = command_program(ipv4,
fp, partition, progress, &boardlist, result);
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);
1952 pboards = boardlist.
get(ipv4Broadcast);
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)
2003 ret = go2application(ipv4,
true, 10,
true);
2014 if(_useofinternalboardlist)
2016 list2use = &_internalboardlist;
2019 if(forcemaintenance)
2021 if(
false == go2maintenance(ipv4,
true, 6, 1.0))
2025 printf(
"EthMaintainer::command_def2run(): cannot send the boards to maintenance.\n");
2033 eOuprot_cmd_DEF2RUN_t command = {EOUPROT_VALUE_OF_UNUSED_BYTE};
2034 command.opc = uprot_OPC_DEF2RUN;
2035 command.proc = process;
2037 sendCommand(ipv4, &command,
sizeof(command), list2use);
2046 boardlist = information(ipv4,
true,
false, 2, 1.0);
2048 vector<EthBoard *> boards = boardlist.
get(ipv4);
2049 if(0 == boards.size())
2053 printf(
"EthMaintainer::command_def2run(): found no boards in verify step.\n");
2059 for(
int i=0; i< boards.size(); i++)
2062 if(process != info.processes.def2run)
2064 if(0 != info.protversion)
2068 printf(
"EthMaintainer::command_def2run(): could not set DEF2RUN = %s for board %s. detected value is %s",
2069 eouprot_process2string(process),
2070 boards[i]->getIPV4string().c_str(), eouprot_process2string((eOuprot_process_t)info.processes.def2run)
2077 printf(
"EthMaintainer::command_def2run(): could not check DEF2RUN = %s for board %s beacuse protocolversion is 0",
2078 eouprot_process2string(process),
2079 boards[i]->getIPV4string().c_str()
2094 if(_useofinternalboardlist)
2096 list2use = &_internalboardlist;
2099 eOuprot_cmd_RESTART_t command = {EOUPROT_VALUE_OF_UNUSED_BYTE};
2100 command.opc = uprot_OPC_RESTART;
2102 bool ret = sendCommand(ipv4, &command,
sizeof(command), list2use);
2106 printf(
"EthMaintainer::command_restart(%s): %d\n",
ipv4tostring(ipv4).c_str(), ret);
2118 if(_useofinternalboardlist)
2120 list2use = &_internalboardlist;
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)
2187 bool r1 = go2maintenance(ipv4,
true, 6, 1.0);
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");
2225 bool rr = command_restart(ipv4);
2228 printf(
"EthMaintainer::command_changeaddress(): called command_restart() w/ res %d\n", rr);
2246 yarp::os::Time::delay(1.000);
2249 ret = go2maintenance(ipv4new,
true, 5, 0.5);
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");
2286 if(_useofinternalboardlist)
2288 list2use = &_internalboardlist;
2293 eOuprot_cmd_PAGE_CLR_t command = {EOUPROT_VALUE_OF_UNUSED_BYTE};
2294 command.opc = uprot_OPC_PAGE_CLR;
2295 command.pagesize = 32;
2297 ret = sendCommand(ipv4, &command,
sizeof(command), list2use);
2307 if(_useofinternalboardlist)
2309 list2use = &_internalboardlist;
2314 eOuprot_cmd_PAGE_SET_t *
cmd = (eOuprot_cmd_PAGE_SET_t*) mTxBuffer;
2315 uint16_t sizeofcmd =
sizeof(eOuprot_cmd_PAGE_SET_t) - uprot_pagemaxsize + 32;
2319 memset(
cmd, EOUPROT_VALUE_OF_UNUSED_BYTE, sizeofcmd);
2321 cmd->opc = uprot_OPC_PAGE_SET;
2323 memset(
cmd->page, 0, 32);
2326 const char * str32 = info32.c_str();
2328 int len = strlen(str32);
2334 memcpy(&
cmd->page[1], str32, len);
2336 ret = sendCommand(ipv4,
cmd, sizeofcmd, list2use);
2346 if(_useofinternalboardlist)
2348 list2use = &_internalboardlist;
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;
2362 while(mSocket.ReceiveFrom(rxipv4addr, rxipv4port, mRxBuffer,
sizeof(mRxBuffer), 500) > 0)
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);
2377 vector<EthBoard *> selected = _internalboardlist.get(rxipv4addr);
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);
2391 else if(rxipv4addr != myIPV4addr)
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]);
2432 if(_useofinternalboardlist)
2434 list2use = &_internalboardlist;
2439 eOuprot_cmd_JUMP2UPDATER_t command = {EOUPROT_VALUE_OF_UNUSED_BYTE};
2440 command.opc = uprot_OPC_JUMP2UPDATER;
2442 ret = sendCommand(ipv4, &command,
sizeof(command), list2use);
2453 if(_useofinternalboardlist)
2455 list2use = &_internalboardlist;
2460 eOuprot_cmd_JUMP2ADDRESS_t command = {EOUPROT_VALUE_OF_UNUSED_BYTE};
2461 command.opc = uprot_OPC_JUMP2ADDRESS;
2462 command.address = romaddress;
2464 ret = sendCommand(ipv4, &command,
sizeof(command), list2use);
2474 if(_useofinternalboardlist)
2476 list2use = &_internalboardlist;
2481 eOuprot_cmd_BLINK_t command = {EOUPROT_VALUE_OF_UNUSED_BYTE};
2482 command.opc = uprot_OPC_BLINK;
2484 ret = sendCommand(ipv4, &command,
sizeof(command), list2use);
string ipv4tostring(eOipv4addr_t ipv4)
eOipv4addr_t acetoipv4(ACE_UINT32 address)
bool string2ipv4(const string &ipv4string, eOipv4addr_t &ipv4)
ACE_UINT32 ipv4toace(eOipv4addr_t ipv4)
vector< EthBoard > theboards
int numberof(eOipv4addr_t ipv4)
vector< EthBoard * > get(eOipv4addr_t ipv4)
void select(bool on, eOipv4addr_t ipv4)
int add(boardInfo2_t &info2, eOipv4addr_t ipv4, bool force=false)
bool boards_useinternal(bool on)
static const eOipv4addr_t ipv4Broadcast
std::string moreinformation(eOipv4addr_t ipv4, bool forcemaintenance=false)
std::string getMoreInfoText(eOuprot_cmd_MOREINFO_REPLY_t *moreinfo, char *ipv4string)
EthBoardList information(eOipv4addr_t ipv4, bool ask2board=true, bool forcemaintenance=true, int numberofrequests=1, double waittimeout=1.0)
bool command_jump2updater(eOipv4addr_t ipv4)
EthBoardList discover(bool clearbeforediscovery=true, int numberofdiscoveries=1, double waittimeout=1.0)
static const eOipv4addr_t ipv4OfAllSelected
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 boards_set(EthBoardList &boards)
string processDiscoveryReplies2(EthBoardList &boardlist, double waittimeout=1.0)
int sendPROG2(const uint8_t opc, progData_t &progdata)
bool go2application(eOipv4addr_t ipv4, bool checkdef2runapplication=true, double bootstraptime=10.0, bool verify=true)
int boards_rem(eOipv4addr_t ipv4)
EthBoardList & boards_get(void)
bool boards_select(eOipv4addr_t ipv4, bool on)
bool command_info32_clr(eOipv4addr_t ipv4)
bool isInApplication(eOipv4addr_t ipv4, EthBoardList &boardlist)
bool isInMaintenance(eOipv4addr_t ipv4, EthBoardList &boardlist)
static const eOipv4port_t mainIPport
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)
std::string processMoreInfoReplies(EthBoardList &boardlist)
bool command_info32_set(eOipv4addr_t ipv4, const string &info32)
vector< string > command_info32_get(eOipv4addr_t ipv4)
std::string prepareMoreInfoText(eOuprot_cmd_DISCOVER_REPLY_t *disc, const char *ipv4string)
bool command_blink(eOipv4addr_t ipv4)
int boards_add(eOipv4addr_t ipv4, boardInfo2_t &info2, bool force)
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)
static const eOipv4addr_t hostIPaddress
bool command_eeprom_erase(eOipv4addr_t ipv4)
bool command_restart(eOipv4addr_t ipv4)
bool command_supported(eOipv4addr_t ipv4, eOuprot_proc_capabilities_t capability, bool ask2board=false)
bool command_jump2address(eOipv4addr_t ipv4, uint32_t romaddress)
bool command_changeaddress(eOipv4addr_t ipv4, eOipv4addr_t ipv4new, bool checkifnewispresent=true, bool forcemaintenance=true, bool restart=false, bool verify=false)
static struct bpf_program fp
vector< EthBoard * > selected
eOversion_t versionOfRunning
eObrd_ethtype_t boardtype
uint8_t applicationdetails
eOuprot_procinfo_t extraprocesses[2]
eOuprot_proctable_t processes