device_list.h
Go to the documentation of this file.
1 /*
2  * Roboception GmbH
3  * Munich, Germany
4  * www.roboception.com
5  *
6  * Copyright (c) 2024 Roboception GmbH
7  * All rights reserved
8  *
9  * Author: Heiko Hirschmueller
10  */
11 
12 #ifndef DEVICE_LIST_H
13 #define DEVICE_LIST_H
14 
15 #include <FL/Fl.H>
16 #include <FL/Fl_Table_Row.H>
17 
18 #include <vector>
19 #include <set>
20 #include <string>
21 
22 class DeviceList : public Fl_Table_Row
23 {
24  public:
25 
26  DeviceList(int x, int y, int w, int h);
27 
28  void clear();
29 
30  void add(const char *name, const char *manufacturer, const char *model, const char *sn,
31  const char *ip, const char *mac, const char *interface, bool reachable);
32 
33  void setSelectionChangeCallback(Fl_Callback* _cb, void* p) { cb=_cb; user=p; }
34 
35  int getSelectedRow();
37  bool isRCVisardSelected();
38  std::string getSelectedMAC();
39  std::vector<std::pair<std::string, std::string> > getCurrentNameMACList(bool only_rc_visard);
40 
41  std::string getCell(int r, int c);
42  void openWebGUI(int r);
43 
44  void filterRCDevices(bool filter_rc);
45  void filter(const char *filter_value);
46 
47  void getSorting(int &sort_col, bool &sort_down);
48  void setSorting(int sort_col, bool sort_down);
49 
50  protected:
51 
52  int handle(int event);
53  void draw_cell(TableContext context, int ROW, int COL, int X, int Y, int W, int H);
54 
55  private:
56 
57  void notifySelectionChange();
58 
59  void sortColumn(int c);
60 
61  bool addDeviceIndex(size_t i);
62  void updateDeviceIndices();
63 
64  std::set<std::string> previous_mac_list;
66 
68  {
69  std::string item[8];
70  std::set<std::string> interface_list;
71  bool reachable;
73  };
74 
75  std::vector<DeviceListData> device; // all discovered devices
76  std::vector<size_t> index; // indices of visible devices in sorted order
77 
78  Fl_Callback *cb;
79  void *user;
80 
81  int sort_col;
82  bool sort_down;
83  bool filter_rc;
84  std::string filter_value;
85 };
86 
87 #endif
DeviceList::addDeviceIndex
bool addDeviceIndex(size_t i)
Definition: device_list.cc:496
DeviceList::setSelectionChangeCallback
void setSelectionChangeCallback(Fl_Callback *_cb, void *p)
Definition: device_list.h:33
DeviceList::getSorting
void getSorting(int &sort_col, bool &sort_down)
Definition: device_list.cc:269
DeviceList::setSorting
void setSorting(int sort_col, bool sort_down)
Definition: device_list.cc:278
DeviceList::sort_down
bool sort_down
Definition: device_list.h:82
DeviceList::isReachableRCDeviceSelected
bool isReachableRCDeviceSelected()
Definition: device_list.cc:178
DeviceList::DeviceListData::item
std::string item[8]
Definition: device_list.h:69
DeviceList::draw_cell
void draw_cell(TableContext context, int ROW, int COL, int X, int Y, int W, int H)
Definition: device_list.cc:356
DeviceList::DeviceListData::reachable
bool reachable
Definition: device_list.h:71
DeviceList::index
std::vector< size_t > index
Definition: device_list.h:76
DeviceList::device
std::vector< DeviceListData > device
Definition: device_list.h:75
DeviceList::clear
void clear()
Definition: device_list.cc:59
DeviceList::DeviceListData::interface_list
std::set< std::string > interface_list
Definition: device_list.h:70
DeviceList::DeviceList
DeviceList(int x, int y, int w, int h)
Definition: device_list.cc:20
DeviceList::cb
Fl_Callback * cb
Definition: device_list.h:78
DeviceList::filter
void filter(const char *filter_value)
Definition: device_list.cc:259
DeviceList::openWebGUI
void openWebGUI(int r)
Definition: device_list.cc:228
DeviceList::DeviceListData::new_discovery
bool new_discovery
Definition: device_list.h:72
DeviceList::add
void add(const char *name, const char *manufacturer, const char *model, const char *sn, const char *ip, const char *mac, const char *interface, bool reachable)
Definition: device_list.cc:79
DeviceList::getSelectedRow
int getSelectedRow()
Definition: device_list.cc:164
DeviceList::DeviceListData
Definition: device_list.h:67
DeviceList::notifySelectionChange
void notifySelectionChange()
Definition: device_list.cc:469
DeviceList::previous_mac_list
std::set< std::string > previous_mac_list
Definition: device_list.h:64
DeviceList::new_discovery
bool new_discovery
Definition: device_list.h:65
DeviceList
Definition: device_list.h:22
DeviceList::isRCVisardSelected
bool isRCVisardSelected()
Definition: device_list.cc:185
DeviceList::getCell
std::string getCell(int r, int c)
Definition: device_list.cc:218
DeviceList::filter_rc
bool filter_rc
Definition: device_list.h:83
DeviceList::updateDeviceIndices
void updateDeviceIndices()
Definition: device_list.cc:547
DeviceList::getCurrentNameMACList
std::vector< std::pair< std::string, std::string > > getCurrentNameMACList(bool only_rc_visard)
Definition: device_list.cc:203
DeviceList::handle
int handle(int event)
Definition: device_list.cc:288
DeviceList::filterRCDevices
void filterRCDevices(bool filter_rc)
Definition: device_list.cc:249
DeviceList::getSelectedMAC
std::string getSelectedMAC()
Definition: device_list.cc:191
DeviceList::sort_col
int sort_col
Definition: device_list.h:81
DeviceList::filter_value
std::string filter_value
Definition: device_list.h:84
DeviceList::sortColumn
void sortColumn(int c)
Definition: device_list.cc:477
DeviceList::user
void * user
Definition: device_list.h:79


rcdiscover
Author(s): Heiko Hirschmueller , Raphael Schaller
autogenerated on Thu Aug 1 2024 02:55:56