|
26 | 26 | #define JSON_ARTNETPARAMSCONST_H_ |
27 | 27 |
|
28 | 28 | #include "common/utils/utils_hash.h" |
29 | | -#include "configurationstore.h" |
30 | 29 | #include "json/json_key.h" |
31 | | -#include "common/utils/utils_hash.h" |
32 | | - |
33 | | -#undef MAX_ARRAY_SIZE |
| 30 | +#include "dmxnode_outputtype.h" |
34 | 31 | #if defined(DMXNODE_OUTPUT_DMX) |
35 | 32 | #include "dmx.h" |
36 | | -#define MAX_ARRAY_SIZE DMX_MAX_PORTS |
37 | | -#else |
38 | | -#define MAX_ARRAY_SIZE 4 |
39 | 33 | #endif |
40 | 34 |
|
41 | | -static_assert(MAX_ARRAY_SIZE <= common::store::dmxnode::kParamPorts); |
42 | | - |
43 | | -namespace json |
44 | | -{ |
| 35 | +namespace json { |
45 | 36 | struct ArtNetParamsConst { |
46 | 37 | static constexpr char kFileName[] = "artnet.json"; |
| 38 | + static constexpr auto kMapUniverse0 = json::MakeSimpleKey("map_universe0"); |
| 39 | + |
| 40 | +#if defined(RDM_CONTROLLER) || defined(RDM_RESPONDER) |
| 41 | + static constexpr auto kEnableRdm = json::MakeSimpleKey("enable_rdm"); |
| 42 | + |
| 43 | + static constexpr json::PortKey kRdmEnablePortA{"rdm_enable_port_a", 17, Fnv1a32("rdm_enable_port_a", 17)}; |
| 44 | +#if (DMX_MAX_PORTS > 1) |
| 45 | + static constexpr json::PortKey kRdmEnablePortB{"rdm_enable_port_b", 17, Fnv1a32("rdm_enable_port_b", 17)}; |
| 46 | +#endif |
| 47 | +#if (DMX_MAX_PORTS > 2) |
| 48 | + static constexpr json::PortKey kRdmEnablePortC{"rdm_enable_port_c", 17, Fnv1a32("rdm_enable_port_c", 17)}; |
| 49 | +#endif |
| 50 | +#if (DMX_MAX_PORTS == 4) |
| 51 | + static constexpr json::PortKey kRdmEnablePortD{"rdm_enable_port_d", 17, Fnv1a32("rdm_enable_port_d", 17)}; |
| 52 | +#endif |
| 53 | + |
| 54 | + static constexpr json::PortKey kRdmEnablePort[] = { |
| 55 | + kRdmEnablePortA, |
| 56 | +#if (DMX_MAX_PORTS > 1) |
| 57 | + kRdmEnablePortB, |
| 58 | +#endif |
| 59 | +#if (DMX_MAX_PORTS > 2) |
| 60 | + kRdmEnablePortC, |
| 61 | +#endif |
| 62 | +#if (DMX_MAX_PORTS == 4) |
| 63 | + kRdmEnablePortD, |
| 64 | +#endif |
| 65 | + }; |
| 66 | +#endif |
47 | 67 |
|
| 68 | +#if defined(DMX_MAX_PORTS) |
48 | 69 | static constexpr json::PortKey kDestinationIpPortA{"destination_ip_port_a", 21, Fnv1a32("destination_ip_port_a", 21)}; |
49 | | -#if (MAX_ARRAY_SIZE > 1) |
| 70 | +#if (DMX_MAX_PORTS > 1) |
50 | 71 | static constexpr json::PortKey kDestinationIpPortB{"destination_ip_port_b", 21, Fnv1a32("destination_ip_port_b", 21)}; |
51 | 72 | #endif |
52 | | -#if (MAX_ARRAY_SIZE > 2) |
| 73 | +#if (DMX_MAX_PORTS > 2) |
53 | 74 | static constexpr json::PortKey kDestinationIpPortC{"destination_ip_port_c", 21, Fnv1a32("destination_ip_port_c", 21)}; |
54 | 75 | #endif |
55 | | -#if (MAX_ARRAY_SIZE == 4) |
| 76 | +#if (DMX_MAX_PORTS == 4) |
56 | 77 | static constexpr json::PortKey kDestinationIpPortD{"destination_ip_port_d", 21, Fnv1a32("destination_ip_port_d", 21)}; |
57 | 78 | #endif |
58 | 79 |
|
59 | 80 | static constexpr json::PortKey kDestinationIpPort[] = { |
60 | 81 | kDestinationIpPortA, |
61 | | -#if (MAX_ARRAY_SIZE > 1) |
| 82 | +#if (DMX_MAX_PORTS > 1) |
62 | 83 | kDestinationIpPortB, |
63 | 84 | #endif |
64 | | -#if (MAX_ARRAY_SIZE > 2) |
| 85 | +#if (DMX_MAX_PORTS > 2) |
65 | 86 | kDestinationIpPortC, |
66 | 87 | #endif |
67 | | -#if (MAX_ARRAY_SIZE == 4) |
| 88 | +#if (DMX_MAX_PORTS == 4) |
68 | 89 | kDestinationIpPortD, |
69 | 90 | #endif |
70 | 91 | }; |
71 | 92 |
|
72 | | - // Art-Net 4 |
73 | | - static constexpr auto kEnableRdm = json::MakeSimpleKey("enable_rdm"); |
74 | | - |
75 | | - static constexpr auto kMapUniverse0 = json::MakeSimpleKey("map_universe0"); |
76 | | - |
77 | 93 | static constexpr json::PortKey kProtocolPortA{"protocol_port_a", 15, Fnv1a32("protocol_port_a", 15)}; |
78 | | -#if (MAX_ARRAY_SIZE > 1) |
| 94 | +#if (DMX_MAX_PORTS > 1) |
79 | 95 | static constexpr json::PortKey kProtocolPortB{"protocol_port_b", 15, Fnv1a32("protocol_port_b", 15)}; |
80 | 96 | #endif |
81 | | -#if (MAX_ARRAY_SIZE > 2) |
| 97 | +#if (DMX_MAX_PORTS > 2) |
82 | 98 | static constexpr json::PortKey kProtocolPortC{"protocol_port_c", 15, Fnv1a32("protocol_port_c", 15)}; |
83 | 99 | #endif |
84 | | -#if (MAX_ARRAY_SIZE == 4) |
| 100 | +#if (DMX_MAX_PORTS == 4) |
85 | 101 | static constexpr json::PortKey kProtocolPortD{"protocol_port_d", 15, Fnv1a32("protocol_port_d", 15)}; |
86 | 102 | #endif |
87 | 103 |
|
88 | 104 | static constexpr json::PortKey kProtocolPort[] = { |
89 | 105 | kProtocolPortA, |
90 | | -#if (MAX_ARRAY_SIZE > 1) |
| 106 | +#if (DMX_MAX_PORTS > 1) |
91 | 107 | kProtocolPortB, |
92 | 108 | #endif |
93 | | -#if (MAX_ARRAY_SIZE > 2) |
| 109 | +#if (DMX_MAX_PORTS > 2) |
94 | 110 | kProtocolPortC, |
95 | 111 | #endif |
96 | | -#if (MAX_ARRAY_SIZE == 4) |
| 112 | +#if (DMX_MAX_PORTS == 4) |
97 | 113 | kProtocolPortD, |
98 | 114 | #endif |
99 | 115 | }; |
100 | 116 |
|
101 | | - static constexpr json::PortKey kRdmEnablePortA{"rdm_enable_port_a", 17, Fnv1a32("rdm_enable_port_a", 17)}; |
102 | | -#if (MAX_ARRAY_SIZE > 1) |
103 | | - static constexpr json::PortKey kRdmEnablePortB{"rdm_enable_port_b", 17, Fnv1a32("rdm_enable_port_b", 17)}; |
104 | | -#endif |
105 | | -#if (MAX_ARRAY_SIZE > 2) |
106 | | - static constexpr json::PortKey kRdmEnablePortC{"rdm_enable_port_c", 17, Fnv1a32("rdm_enable_port_c", 17)}; |
107 | | -#endif |
108 | | -#if (MAX_ARRAY_SIZE == 4) |
109 | | - static constexpr json::PortKey kRdmEnablePortD{"rdm_enable_port_d", 17, Fnv1a32("rdm_enable_port_d", 17)}; |
110 | | -#endif |
111 | | - |
112 | | - static constexpr json::PortKey kRdmEnablePort[] = { |
113 | | - kRdmEnablePortA, |
114 | | -#if (MAX_ARRAY_SIZE > 1) |
115 | | - kRdmEnablePortB, |
116 | | -#endif |
117 | | -#if (MAX_ARRAY_SIZE > 2) |
118 | | - kRdmEnablePortC, |
119 | | -#endif |
120 | | -#if (MAX_ARRAY_SIZE == 4) |
121 | | - kRdmEnablePortD, |
122 | | -#endif |
123 | | - }; |
124 | | - |
125 | 117 | static constexpr json::PortKey kBgDiscoveryPortA{"bg_discovery_port_a", 19, Fnv1a32("bg_discovery_port_a", 19)}; |
126 | | -#if (MAX_ARRAY_SIZE > 1) |
| 118 | +#if (DMX_MAX_PORTS > 1) |
127 | 119 | static constexpr json::PortKey kBgDiscoveryPortB{"bg_discovery_port_b", 19, Fnv1a32("bg_discovery_port_b", 19)}; |
128 | 120 | #endif |
129 | | -#if (MAX_ARRAY_SIZE > 2) |
| 121 | +#if (DMX_MAX_PORTS > 2) |
130 | 122 | static constexpr json::PortKey kBgDiscoveryPortC{"bg_discovery_port_c", 19, Fnv1a32("bg_discovery_port_c", 19)}; |
131 | 123 | #endif |
132 | | -#if (MAX_ARRAY_SIZE == 4) |
| 124 | +#if (DMX_MAX_PORTS == 4) |
133 | 125 | static constexpr json::PortKey kBgDiscoveryPortD{"bg_discovery_port_d", 19, Fnv1a32("bg_discovery_port_d", 19)}; |
134 | 126 | #endif |
135 | 127 |
|
136 | 128 | static constexpr json::PortKey kBgDiscoveryPort[] = { |
137 | 129 | kBgDiscoveryPortA, |
138 | | -#if (MAX_ARRAY_SIZE > 1) |
| 130 | +#if (DMX_MAX_PORTS > 1) |
139 | 131 | kBgDiscoveryPortB, |
140 | 132 | #endif |
141 | | -#if (MAX_ARRAY_SIZE > 2) |
| 133 | +#if (DMX_MAX_PORTS > 2) |
142 | 134 | kBgDiscoveryPortC, |
143 | 135 | #endif |
144 | | -#if (MAX_ARRAY_SIZE == 4) |
| 136 | +#if (DMX_MAX_PORTS == 4) |
145 | 137 | kBgDiscoveryPortD, |
146 | 138 | #endif |
147 | 139 | }; |
| 140 | +#endif |
148 | 141 | }; |
149 | 142 | } // namespace json |
150 | 143 |
|
|
0 commit comments