12 connect(
check,SIGNAL(needChangeSelection(
bool)),
13 this,SLOT(onSelectedChanged(
bool)));
14 connect(
check,SIGNAL(destroyed(QObject*)),
17 this,SIGNAL(
needLoading(
bool,
bool)),Qt::DirectConnection);
18 connect(
core,SIGNAL(selectedEnded()),
check,SLOT(onSelectEnded()),Qt::QueuedConnection);
19 this->treeWidget()->setItemWidget(
this,0,
check);
37 check->setEnabled(enable);
45 return check->isEnabled();
50 check->setChecked(selected);
60 void CustomTreeWidgetItem::onSelectedChanged(
bool selected)
126 int Id = IDstr.toInt();
149 QTreeWidgetItem *empty =
new QTreeWidgetItem(
this,QStringList() <<
"" <<
"" <<
"?");
167 char board_ipaddr[16];
170 char board_version[16];
172 char board_built[24];
174 char running_process[24];
177 memset(board_ipaddr,0,
sizeof(board_ipaddr));
178 memset(board_mac,0,
sizeof(board_mac));
179 memset(board_version,0,
sizeof(board_version));
180 memset(board_date,0,
sizeof(board_date));
181 memset(board_built,0,
sizeof(board_built));
182 memset(board_type,0,
sizeof(board_type));
183 memset(running_process,0,
sizeof(running_process));
184 memset(board_info,0,
sizeof(board_info));
188 snprintf(board_ipaddr,
sizeof(board_ipaddr),
"%s",
board.getIPV4string().c_str());
190 ACE_UINT64 mac =
board.getInfo().macaddress;
193 snprintf(board_mac,
sizeof(board_mac),
"%02X-%02X-%02X-%02X-%02X-%02X",
194 (uint8_t)(mac >> 40) & 0xff,
195 (uint8_t)(mac >> 32) & 0xff,
196 (uint8_t)(mac >> 24) & 0xff,
197 (uint8_t)(mac >> 16) & 0xff,
198 (uint8_t)(mac >> 8 ) & 0xff,
199 (uint8_t)(mac ) & 0xff
203 snprintf(board_version,
sizeof(board_version),
"%s",
board.getVersionfRunning().c_str());
204 snprintf(board_type,
sizeof(board_type),
"%s", eoboards_type2string2(eoboards_ethtype2type(
board.getInfo().boardtype), eobool_true));
205 snprintf(running_process,
sizeof(running_process),
"%s", eouprot_process2string((eOuprot_process_t)
board.getInfo().processes.runningnow));
206 snprintf(board_info,
sizeof(board_info),
"%s",
board.getInfoOnEEPROM().c_str());
207 snprintf(board_date,
sizeof(board_date),
"%s",
board.getDatefRunning().c_str());
208 snprintf(board_built,
sizeof(board_date),
"%s",
board.getCompilationDateOfRunning().c_str());
210 QStringList myFields;
213 myFields.append(board_type);
215 myFields.append(board_ipaddr);
216 myFields.append(running_process);
217 myFields.append(board_version);
219 myFields.append(board_info);
224 for(
int i=0;i<myFields.count();i++) {
225 setText(i,myFields.at(i));
228 if((eOuprot_process_t)
board.getInfo().processes.runningnow == uprot_proc_Updater){
233 }
else if((eOuprot_process_t)
board.getInfo().processes.runningnow == uprot_proc_ApplPROGupdater){
272 char board_type [50]; memset (board_type, 0,
sizeof(board_type));
273 char board_process [50]; memset (board_process, 0,
sizeof(board_process));
274 char board_status [50]; memset (board_status, 0,
sizeof(board_status));
275 char board_add_info [50]; memset (board_add_info, 0,
sizeof(board_add_info));
276 char board_firmware_version [32]; memset (board_firmware_version, 0,
sizeof(board_firmware_version));
277 char board_appl_minor [10]; memset (board_appl_minor, 0,
sizeof(board_appl_minor));
278 char board_appl_build [10]; memset (board_appl_build, 0,
sizeof(board_appl_build));
279 char board_serial [50]; memset (board_serial, 0,
sizeof(board_serial));
280 char board_protocol [10]; memset (board_protocol, 0,
sizeof(board_protocol));
284 snprintf(board_type,
sizeof(board_type),
"%s", eoboards_type2string2((eObrd_type_t)
board.type, eobool_true));
285 switch (
board.status)
288 strcpy(board_status,
"RUNNING");
291 strcpy(board_status,
"WAITING");
294 strcpy(board_status,
"WAITING_ACK");
297 strcpy(board_status,
"DOWNLOADING");
300 strcpy(board_status,
"OK");
303 strcpy(board_status,
"ERR");
306 strcpy(board_status,
"UNKNOWN");
310 if(
true ==
board.applicationisrunning){
311 strcpy(board_process,
"canApplication");
313 strcpy(board_process,
"canBootloader");
316 strncpy (board_add_info,
board.add_info,32);
318 if(-1 ==
board.appl_vers_build){
319 snprintf (board_firmware_version,
sizeof(board_firmware_version),
"%d.%d",
board.appl_vers_major,
board.appl_vers_minor);
321 snprintf (board_firmware_version,
sizeof(board_firmware_version),
"%d.%d.%d",
board.appl_vers_major,
board.appl_vers_minor,
board.appl_vers_build);
324 snprintf (board_appl_minor,
sizeof(board_appl_minor),
"%d",
board.appl_vers_minor);
325 snprintf (board_appl_build,
sizeof(board_appl_build),
"%d",
board.appl_vers_build);
326 snprintf (board_serial,
sizeof(board_serial),
"%s",
board.serial);
328 if((0 ==
board.prot_vers_major) && (0 ==
board.prot_vers_minor))
330 snprintf (board_protocol,
sizeof(board_protocol),
"N/A");
334 snprintf (board_protocol,
sizeof(board_protocol),
"%d.%d",
board.prot_vers_major,
board.prot_vers_minor);
337 #if defined(_MAIN_WINDOW_SHOW_CAN_ADDRESS_IN_ADDRESS_COLUMN)
338 char prefix[20] = {0};
339 #if defined(_MAIN_WINDOW_USE_IP_PREFIX_FOR_CAN_ADDRESS)
344 QByteArray ba = ipaddress.toLatin1();
345 const char *c_str2 = ba.data();
346 snprintf(prefix,
sizeof(prefix),
"%s:", c_str2);
349 QStringList myFields;
352 myFields.append(board_type);
355 snprintf(canadr,
sizeof(canadr),
"%sCAN%d:%d", prefix,
board.bus,
board.pid);
356 myFields.append(canadr);
358 QStringList myFields;
360 myFields.append(board_type);
361 myFields.append(QString(
"%1").arg(
board.pid));
362 myFields.append(QString(
"CAN%1").arg(
board.bus));
364 myFields.append(board_process);
365 myFields.append(board_firmware_version);
367 myFields.append(board_add_info);
370 for(
int i=0;i<myFields.count();i++) {
371 setText(i,myFields.at(i));
393 QString
tmp = devicefullstring;
394 QByteArray ba =
tmp.toLatin1();
395 const char *c_str2 = ba.data();
397 char device_cstr[64] = {0};
398 char id_cstr[64] = {0};
399 sscanf(c_str2,
"%s %s", device_cstr, id_cstr);
400 devicestr = device_cstr;
403 string ttmp = string(c_str2);
404 std::size_t ff = ttmp.find(
"<");
405 std::size_t ll = ttmp.find(
">");
407 t1.assign(ttmp, 0, ff);
409 t2.assign(ttmp, ff+1, ll-ff-1);
410 devicestr = t1.c_str();
QList< sBoard > getCanBoardsFromDriver(QString driver, int networkId, QString *retString, bool force=false)
QList< sBoard > getCanBoardsFromEth(QString address, QString *retString, int canID=CanPacket::everyCANbus, bool force=false)
void setSelectedEthBoard(int index, bool selected)
EthBoardList getEthBoardList()
#define BOARD_WAITING_ACK
#define BOARD_DOWNLOADING
#define CAN_UPLOAD_LOADER
#define CAN_UPLOAD_UPDATER