sensor-command-dialog.h
Go to the documentation of this file.
1 /*
2 * Roboception GmbH
3 * Munich, Germany
4 * www.roboception.com
5 *
6 * Copyright (c) 2017 Roboception GmbH
7 * All rights reserved
8 *
9 * Author: Raphael Schaller
10 */
11 #ifndef SENSORCOMMANDDIALOG_H
12 #define SENSORCOMMANDDIALOG_H
13 
14 #include <wx/dialog.h>
15 
16 #include <array>
17 #include <unordered_map>
18 #include <vector>
19 
20 class wxChoice;
21 class wxTextCtrl;
22 class wxDataViewListModel;
23 class wxHtmlHelpController;
24 class wxBoxSizer;
25 class wxPanel;
26 class wxFlexGridSizer;
27 
34 class SensorCommandDialog : public wxDialog
35 {
36  public:
37  SensorCommandDialog() = default;
38 
39  SensorCommandDialog(wxHtmlHelpController *help_ctrl,
40  wxWindow *parent, wxWindowID id,
41  std::string title,
42  int additional_grid_rows,
43  const wxPoint &pos = wxDefaultPosition,
44  long style = wxDEFAULT_DIALOG_STYLE,
45  const wxString &name = wxDialogNameStr);
46 
47  virtual ~SensorCommandDialog() = default;
48 
49  public:
55  void setDiscoveredSensors(const wxDataViewListModel *sensor_list,
56  const std::vector<bool>& show = {});
57 
63  void setActiveSensor(const unsigned int row);
64 
65  protected:
66  wxBoxSizer *getVerticalBox();
67  wxPanel *getPanel();
68  wxFlexGridSizer *getGrid();
69  std::array<uint8_t, 6> getMac() const;
70  std::string getMacString() const;
71  void displayHelp(const std::string &section);
72 
76  virtual void clear();
77 
78  private:
83  void onSensorSelected(wxCommandEvent &event);
84 
88  void fillMac();
89 
93  void clearMac();
94 
96 
97  private:
98  wxPanel *panel_;
99  wxBoxSizer *vbox_;
100  wxFlexGridSizer *grid_;
101  wxChoice *sensors_;
102  std::array<wxTextCtrl *, 6> mac_;
103  std::unordered_map<unsigned int, unsigned int> row_map_;
104  std::unordered_map<unsigned int, unsigned int> row_map_inv_;
105 
106  const wxDataViewListModel *sensor_list_;
107 
108  wxHtmlHelpController *help_ctrl_;
109 };
110 
111 #endif // SENSORCOMMANDDIALOG_H
std::string getMacString() const
std::unordered_map< unsigned int, unsigned int > row_map_
virtual ~SensorCommandDialog()=default
SensorCommandDialog()=default
void onSensorSelected(wxCommandEvent &event)
Event handler for selection of an device from drop down menu.
const wxDataViewListModel * sensor_list_
virtual void clear()
Reset and clear all fields.
wxFlexGridSizer * getGrid()
Base class for dialogs for sending commands to a camera.
wxHtmlHelpController * help_ctrl_
std::array< wxTextCtrl *, 6 > mac_
void setDiscoveredSensors(const wxDataViewListModel *sensor_list, const std::vector< bool > &show={})
Set list of discovered devices to provide a drop down menu to the user.
void fillMac()
Fill MAC address according to selected device.
void clearMac()
Clear MAC address.
void displayHelp(const std::string &section)
std::unordered_map< unsigned int, unsigned int > row_map_inv_
void setActiveSensor(const unsigned int row)
Select a specific device of the list set by setDiscoveredSensors.
std::array< uint8_t, 6 > getMac() const


rcdiscover
Author(s): Heiko Hirschmueller , Raphael Schaller
autogenerated on Sun Apr 18 2021 02:16:32