SimpleIOSpecificSettings.hpp
1 #pragma once
2 #include <ossia/detail/config.hpp>
3 #if defined(OSSIA_PROTOCOL_SIMPLEIO)
4 #include <score/tools/std/StringHash.hpp>
5 
6 #include <ossia/detail/variant.hpp>
7 
8 #include <QString>
9 
10 #include <utility>
11 #include <vector>
12 #include <verdigris>
13 
14 namespace Protocols
15 {
16 
17 namespace SimpleIO
18 {
19 struct GPIO
20 {
21  int32_t chip{};
22  int32_t line{};
23  int32_t flags{};
24  int32_t events{};
25  int32_t state{};
26  bool direction{};
27 };
28 struct PWM
29 {
30  int32_t chip{};
31  int32_t channel{};
32 };
33 struct ADC
34 {
35  int32_t chip{};
36  int32_t channel{};
37 };
38 struct DAC
39 {
40  int32_t chip{};
41  int32_t channel{};
42 };
43 struct HID
44 {
45  int32_t chip{};
46  int32_t channel{};
47 };
48 struct Custom
49 {
50 };
51 
52 using Type = ossia::variant<GPIO, PWM, ADC, DAC, HID, Custom>;
53 
54 struct Port
55 {
56  Type control;
57  QString name;
58  QString path;
59 };
60 
61 }
62 
63 struct SimpleIOSpecificSettings
64 {
65  std::vector<SimpleIO::Port> ports;
66 };
67 }
68 
69 Q_DECLARE_METATYPE(Protocols::SimpleIOSpecificSettings)
70 W_REGISTER_ARGTYPE(Protocols::SimpleIOSpecificSettings)
71 #endif