26 #include <FL/fl_draw.H> 
   27 #include <FL/fl_ask.H> 
   28 #include <FL/Enumerations.H> 
   29 #include <FL/Fl_Group.H> 
   30 #include <FL/Fl_Menu_Item.H> 
   46 void quitCb(Fl_Widget *, 
void *user_data)
 
   52 void helpCb(Fl_Widget *, 
void *)
 
   57 void aboutCb(Fl_Widget *, 
void *)
 
   61   while (about.shown()) Fl::wait();
 
   64 void discoverCb(Fl_Widget *, 
void *user_data)
 
   70 void onlyRCCb(Fl_Widget *, 
void *user_data)
 
   76 void filterCb(Fl_Widget *, 
void *user_data)
 
   82 template <
int n> 
void copyToClipboardCb(Fl_Widget *, 
void *user_data)
 
   88 void openWebGUICb(Fl_Widget *, 
void *user_data)
 
   94 void listCb(Fl_Widget *, 
void *user_data)
 
   96   if (Fl::event_button() == FL_RIGHT_MOUSE && Fl::event() == FL_PUSH)
 
  103 void listSelectionChangeCb(Fl_Widget *, 
void *user_data)
 
  109 void resetCb(Fl_Widget *, 
void *user_data)
 
  115 void setTmpIPCb(Fl_Widget *, 
void *user_data)
 
  121 void reconnectCb(Fl_Widget *, 
void *user_data)
 
  130   Fl_Double_Window(1180, 394, 
"rcdiscover")
 
  139   menu_bar->add(
"File/Quit", FL_CTRL+
'q', quitCb, 
this);
 
  140   menu_bar->add(
"Help/Help", FL_F+1, helpCb, 
this);
 
  141   menu_bar->add(
"Help/About", 0, aboutCb, 
this);
 
  147     Fl_Group *group=
new Fl_Group(xc, yc, width, row_height);
 
  150     discover->callback(discoverCb, 
this);
 
  153     divider->textcolor(FL_INACTIVE_COLOR);
 
  157     only_rc->callback(onlyRCCb, 
this);
 
  160     filter->value(_filter.c_str());
 
  163     Fl_Group *empty=
new Fl_Group(
ADD_RIGHT_XY, width-5*
GAP_SIZE-(160+45+150+190+row_height), row_height);
 
  165     group->resizable(empty);
 
  180     context_menu->add(
"Copy name", 0, copyToClipboardCb<0>, 
this);
 
  181     context_menu->add(
"Copy manufacturer", 0, copyToClipboardCb<1>, 
this);
 
  182     context_menu->add(
"Copy model", 0, copyToClipboardCb<2>, 
this);
 
  183     context_menu->add(
"Copy serial number", 0, copyToClipboardCb<3>, 
this);
 
  184     context_menu->add(
"Copy IP address", 0, copyToClipboardCb<4>, 
this);
 
  185     context_menu->add(
"Copy MAC address", 0, copyToClipboardCb<5>, 
this);
 
  186     context_menu->add(
"Copy interface(s)", 0, copyToClipboardCb<6>, 
this, FL_MENU_DIVIDER);
 
  187     context_menu->add(
"Open WebGUI", 0, openWebGUICb, 
this, FL_MENU_DIVIDER);
 
  189     context_menu->add(
"Set temporary IP address", 0, setTmpIPCb, 
this);
 
  190     context_menu->add(
"Reconnect device", 0, reconnectCb, 
this);
 
  197     list->callback(listCb, 
this);
 
  209     reset=
new Button(xc, yc, 180, row_height, 
"Reset rc_visard");
 
  210     reset->callback(resetCb, 
this);
 
  220     group->resizable(empty);
 
  223     help->callback(helpCb, 
this);
 
  228   callback(quitCb, 
this);
 
  233   size_range(std::min(w(), 640), std::min(h(), 200));
 
  285   if (
list->callback_context() == Fl_Table::CONTEXT_CELL)
 
  289     list->select_row(
list->callback_row());
 
  322     list->select_row(0, 0);
 
  333     Fl::copy(value.c_str(), 
static_cast<int>(value.size()), 1);
 
  423     std::chrono::steady_clock::time_point tstart=std::chrono::steady_clock::now();
 
  424     std::chrono::steady_clock::time_point tend=tstart;
 
  426     std::vector<rcdiscover::DeviceInfo> info;
 
  429       std::chrono::duration<double, std::milli>(tend-tstart).count() < 1000))
 
  435       for (
size_t k=0; k<info.size(); k++)
 
  437         if (info[k].isValid())
 
  439           std::ostringstream ip, mac;
 
  441           ip << ((info[k].getIP()>>24)&0xff) << 
'.' << ((info[k].getIP()>>16)&0xff) << 
'.' <<
 
  442             ((info[k].getIP()>>8)&0xff) << 
'.'  << (info[k].getIP()&0xff);
 
  444           mac << std::hex << std::setw(2) << std::setfill(
'0') <<
 
  445             std::setw(2) << std::setfill(
'0') << ((info[k].getMAC()>>40)&0xff) << 
':' <<
 
  446             std::setw(2) << std::setfill(
'0') << ((info[k].getMAC()>>32)&0xff) << 
':' <<
 
  447             std::setw(2) << std::setfill(
'0') << ((info[k].getMAC()>>24)&0xff) << 
':' <<
 
  448             std::setw(2) << std::setfill(
'0') << ((info[k].getMAC()>>16)&0xff) << 
':' <<
 
  449             std::setw(2) << std::setfill(
'0') << ((info[k].getMAC()>>8)&0xff) << 
':' <<
 
  450             std::setw(2) << std::setfill(
'0') << (info[k].getMAC()&0xff);
 
  452           list->
add(info[k].getUserName().c_str(),
 
  453             info[k].getManufacturerName().c_str(),
 
  454             info[k].getModelName().c_str(),
 
  455             info[k].getSerialNumber().c_str(),
 
  458             info[k].getIfaceName().c_str(),
 
  468       tend=std::chrono::steady_clock::now();
 
  471   catch (
const std::exception &ex)
 
  476     std::cerr << 
"Exception in discover thread: " << ex.what() << std::endl;
 
  483     std::cerr << 
"Unknown exception in discover thread" << std::endl;