CoAPProtocolSettingsWidget.hpp
1 #pragma once
2 #include <Device/Protocol/DeviceSettings.hpp>
3 #include <Device/Protocol/ProtocolSettingsWidget.hpp>
4 
5 #include <Protocols/CoAP/CoAPSpecificSettings.hpp>
6 
7 #include <verdigris>
8 
9 class QStackedLayout;
10 class QLineEdit;
11 class QSpinBox;
12 class QWidget;
13 
14 namespace Protocols
15 {
16 
17 class UDPWidget;
18 class BasicTCPWidget;
19 class WebsocketClientWidget;
20 class RateWidget;
21 
22 enum class CoapProtocol
23 {
24  UDP = 0,
25  TCP = 1,
26  WSClient = 2,
27 };
28 
29 class CoAPTransportWidget : public QWidget
30 {
31 public:
32  explicit CoAPTransportWidget(
33  Device::ProtocolSettingsWidget& proto, QWidget* parent = nullptr);
34 
35  void setCurrentProtocol(CoapProtocol index);
36  ossia::net::coap_client_configuration configuration(CoapProtocol index) const noexcept;
37  CoapProtocol setConfiguration(const ossia::net::coap_client_configuration& conf);
38 
39 private:
40  QStackedLayout* m_transportLayout{};
41 
42  UDPWidget* m_udp{};
43  BasicTCPWidget* m_tcp{};
44  WebsocketClientWidget* m_ws_client{};
45 };
46 
48 {
49 public:
50  explicit CoAPProtocolSettingsWidget(QWidget* parent = nullptr);
51 
52  Device::DeviceSettings getSettings() const override;
53  void setSettings(const Device::DeviceSettings& settings) override;
54 
55  using Device::ProtocolSettingsWidget::checkForChanges;
56 
57 private:
58  void setDefaults();
59  QLineEdit* m_deviceNameEdit{};
60  RateWidget* m_rate{};
61  QComboBox* m_transport{};
62  CoAPTransportWidget* m_transportWidget{};
63  CoAPSpecificSettings m_settings;
64 };
65 }
Definition: ProtocolSettingsWidget.hpp:22
Definition: TCPWidget.hpp:16
Definition: CoAPProtocolSettingsWidget.hpp:48
Definition: CoAPProtocolSettingsWidget.hpp:30
Definition: RateWidget.hpp:15
Definition: UDPWidget.hpp:14
Definition: WebsocketClientWidget.hpp:12
Definition: DeviceSettings.hpp:20
Definition: CoAPSpecificSettings.hpp:12