|
2 | 2 | * @file displayudfparamsconst.h |
3 | 3 | * |
4 | 4 | */ |
5 | | -/* Copyright (C) 2025 by Arjan van Vught mailto:info@gd32-dmx.org |
| 5 | +/* Copyright (C) 2025-2026 by Arjan van Vught mailto:info@gd32-dmx.org |
6 | 6 | * |
7 | 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
8 | 8 | * of this software and associated documentation files (the "Software"), to deal |
|
27 | 27 | #define JSON_DISPLAYUDFPARAMSCONST_H_ |
28 | 28 |
|
29 | 29 | #include "json/json_key.h" |
30 | | -#if defined (DMXNODE_PORTS) && (DMXNODE_PORTS > 0) |
| 30 | +#include "common/utils/utils_hash.h" |
| 31 | +#if defined(DMXNODE_PORTS) && (DMXNODE_PORTS > 0) |
31 | 32 | #include "json/dmxnodeparamsconst.h" |
32 | 33 | #endif |
33 | | -#if defined(NODE_ARTNET) || defined (NODE_ARTNET_MULTI) |
| 34 | +#if defined(NODE_ARTNET) || defined(NODE_ARTNET_MULTI) |
34 | 35 | #include "json/artnetparamsconst.h" |
35 | 36 | #endif |
36 | 37 | #if defined(OUTPUT_DMX_SEND) || defined(OUTPUT_DMX_SEND_MULTI) |
37 | 38 | #include "dmx.h" |
38 | 39 | #endif |
39 | 40 |
|
40 | | -namespace json |
41 | | -{ |
42 | | -struct DisplayUdfParamsConst |
43 | | -{ |
44 | | - static constexpr char kFileName[] = "display.json"; |
45 | | - |
46 | | - static constexpr json::SimpleKey kIntensity { |
47 | | - "intensity", |
48 | | - 9, |
49 | | - Fnv1a32("intensity", 9) |
50 | | - }; |
51 | | - |
52 | | - static constexpr json::SimpleKey kSleepTimeout { |
53 | | - "sleep_timeout", |
54 | | - 13, |
55 | | - Fnv1a32("sleep_timeout", 13) |
56 | | - }; |
57 | | - |
58 | | - static constexpr json::SimpleKey kFlipVertically { |
59 | | - "flip_vertically", |
60 | | - 15, |
61 | | - Fnv1a32("flip_vertically", 15) |
62 | | - }; |
63 | | - |
64 | | - static constexpr json::PortKey kTitle { |
65 | | - "title", |
66 | | - 5, |
67 | | - Fnv1a32("title", 5) |
68 | | - }; |
69 | | - |
70 | | - static constexpr json::PortKey kBoardName { |
71 | | - "board_name", |
72 | | - 10, |
73 | | - Fnv1a32("board_name", 10) |
74 | | - }; |
75 | | - |
76 | | - static constexpr json::PortKey kVersion { |
77 | | - "version", |
78 | | - 7, |
79 | | - Fnv1a32("version", 7) |
80 | | - }; |
| 41 | +namespace json { |
| 42 | +struct DisplayUdfParamsConst { |
| 43 | + static constexpr char kFileName[] = "display.json"; |
81 | 44 |
|
82 | | - static constexpr json::PortKey kActivePorts { |
83 | | - "active_ports", |
84 | | - 12, |
85 | | - Fnv1a32("active_ports", 12) |
86 | | - }; |
87 | | - |
88 | | - static constexpr json::PortKey kHostname { |
89 | | - "hostname", |
90 | | - 8, |
91 | | - Fnv1a32("hostname", 8) |
92 | | - }; |
93 | | - |
94 | | - static constexpr json::PortKey kIpAddress { |
95 | | - "ip_address", |
96 | | - 10, |
97 | | - Fnv1a32("ip_address", 10) |
98 | | - }; |
99 | | - |
100 | | - static constexpr json::PortKey kNetMask { |
101 | | - "net_mask", |
102 | | - 8, |
103 | | - Fnv1a32("net_mask", 8) |
104 | | - }; |
105 | | - |
106 | | - static constexpr json::PortKey kDefaultGateway { |
107 | | - "default_gateway", |
108 | | - 15, |
109 | | - Fnv1a32("default_gateway", 15) |
110 | | - }; |
111 | | - |
112 | | - static constexpr json::PortKey kDmxStartAddress { |
113 | | - "dmx_start_address", |
114 | | - 17, |
115 | | - Fnv1a32("dmx_start_address", 17) |
116 | | - }; |
117 | | - |
118 | | - static constexpr json::PortKey kLabels[] = |
119 | | - { |
120 | | - kTitle, |
121 | | - kBoardName, |
122 | | - kVersion, |
123 | | - kHostname, |
124 | | - kIpAddress, |
125 | | - kNetMask, |
126 | | - kDefaultGateway, |
127 | | - kActivePorts, |
128 | | - kDmxStartAddress, |
129 | | -#if defined (DMX_MAX_PORTS) |
130 | | -#if (DMX_MAX_PORTS == 1) |
131 | | - DmxNodeParamsConst::kUniversePortA, |
132 | | -#if defined(NODE_ARTNET) || defined (NODE_ARTNET_MULTI) |
133 | | - ArtNetParamsConst::kDestinationIpPortA |
134 | | -#endif |
135 | | -#endif |
136 | | -#if (DMX_MAX_PORTS == 2) |
137 | | - DmxNodeParamsConst::kUniversePortA, |
138 | | - DmxNodeParamsConst::kUniversePortB, |
139 | | -#if defined(NODE_ARTNET) || defined (NODE_ARTNET_MULTI) |
140 | | - ArtNetParamsConst::kDestinationIpPortA, |
141 | | - ArtNetParamsConst::kDestinationIpPortB |
142 | | -#endif |
| 45 | + static constexpr json::SimpleKey kIntensity{"intensity", 9, Fnv1a32("intensity", 9)}; |
| 46 | + static constexpr json::SimpleKey kSleepTimeout{"sleep_timeout", 13, Fnv1a32("sleep_timeout", 13)}; |
| 47 | + static constexpr json::SimpleKey kFlipVertically{"flip_vertically", 15, Fnv1a32("flip_vertically", 15)}; |
| 48 | + static constexpr json::PortKey kTitle{"title", 5, Fnv1a32("title", 5)}; |
| 49 | + static constexpr json::PortKey kBoardName{"board_name", 10, Fnv1a32("board_name", 10)}; |
| 50 | + static constexpr json::PortKey kVersion{"version", 7, Fnv1a32("version", 7)}; |
| 51 | + static constexpr json::PortKey kActivePorts{"active_ports", 12, Fnv1a32("active_ports", 12)}; |
| 52 | + static constexpr json::PortKey kHostname{"hostname", 8, Fnv1a32("hostname", 8)}; |
| 53 | + static constexpr json::PortKey kIpAddress{"ip_address", 10, Fnv1a32("ip_address", 10)}; |
| 54 | + static constexpr json::PortKey kNetMask{"net_mask", 8, Fnv1a32("net_mask", 8)}; |
| 55 | + static constexpr json::PortKey kDefaultGateway{"default_gateway", 15, Fnv1a32("default_gateway", 15)}; |
| 56 | + static constexpr json::PortKey kDmxStartAddress{"dmx_start_address", 17, Fnv1a32("dmx_start_address", 17)}; |
| 57 | + |
| 58 | + static constexpr json::PortKey kLabels[] = {kTitle, |
| 59 | + kBoardName, |
| 60 | + kVersion, |
| 61 | + kHostname, |
| 62 | + kIpAddress, |
| 63 | + kNetMask, |
| 64 | + kDefaultGateway, |
| 65 | + kActivePorts, |
| 66 | + kDmxStartAddress, |
| 67 | +#if defined(DMX_MAX_PORTS) |
| 68 | +#if (DMX_MAX_PORTS == 1) |
| 69 | + DmxNodeParamsConst::kUniversePortA, |
| 70 | +#if defined(NODE_ARTNET) || defined(NODE_ARTNET_MULTI) |
| 71 | + ArtNetParamsConst::kDestinationIpPortA |
| 72 | +#endif |
| 73 | +#endif |
| 74 | +#if (DMX_MAX_PORTS == 2) |
| 75 | + DmxNodeParamsConst::kUniversePortA, |
| 76 | + DmxNodeParamsConst::kUniversePortB, |
| 77 | +#if defined(NODE_ARTNET) || defined(NODE_ARTNET_MULTI) |
| 78 | + ArtNetParamsConst::kDestinationIpPortA, |
| 79 | + ArtNetParamsConst::kDestinationIpPortB |
| 80 | +#endif |
| 81 | +#endif |
| 82 | +#if (DMX_MAX_PORTS == 3) |
| 83 | + DmxNodeParamsConst::kUniversePortA, |
| 84 | + DmxNodeParamsConst::kUniversePortB, |
| 85 | + DmxNodeParamsConst::kUniversePortC, |
| 86 | +#if defined(NODE_ARTNET) || defined(NODE_ARTNET_MULTI) |
| 87 | + ArtNetParamsConst::kDestinationIpPortA, |
| 88 | + ArtNetParamsConst::kDestinationIpPortB, |
| 89 | + ArtNetParamsConst::kDestinationIpPortC |
| 90 | +#endif |
| 91 | +#endif |
| 92 | +#if (DMX_MAX_PORTS == 4) |
| 93 | + DmxNodeParamsConst::kUniversePortA, |
| 94 | + DmxNodeParamsConst::kUniversePortB, |
| 95 | + DmxNodeParamsConst::kUniversePortC, |
| 96 | + DmxNodeParamsConst::kUniversePortD, |
| 97 | +#if defined(NODE_ARTNET) || defined(NODE_ARTNET_MULTI) |
| 98 | + ArtNetParamsConst::kDestinationIpPortA, |
| 99 | + ArtNetParamsConst::kDestinationIpPortB, |
| 100 | + ArtNetParamsConst::kDestinationIpPortC, |
| 101 | + ArtNetParamsConst::kDestinationIpPortD |
143 | 102 | #endif |
144 | | -#if (DMX_MAX_PORTS == 3) |
145 | | - DmxNodeParamsConst::kUniversePortA, |
146 | | - DmxNodeParamsConst::kUniversePortB, |
147 | | - DmxNodeParamsConst::kUniversePortC, |
148 | | -#if defined(NODE_ARTNET) || defined (NODE_ARTNET_MULTI) |
149 | | - ArtNetParamsConst::kDestinationIpPortA, |
150 | | - ArtNetParamsConst::kDestinationIpPortB, |
151 | | - ArtNetParamsConst::kDestinationIpPortC |
152 | | -#endif |
153 | 103 | #endif |
154 | | -#if (DMX_MAX_PORTS == 4) |
155 | | - DmxNodeParamsConst::kUniversePortA, |
156 | | - DmxNodeParamsConst::kUniversePortB, |
157 | | - DmxNodeParamsConst::kUniversePortC, |
158 | | - DmxNodeParamsConst::kUniversePortD, |
159 | | -#if defined(NODE_ARTNET) || defined (NODE_ARTNET_MULTI) |
160 | | - ArtNetParamsConst::kDestinationIpPortA, |
161 | | - ArtNetParamsConst::kDestinationIpPortB, |
162 | | - ArtNetParamsConst::kDestinationIpPortC, |
163 | | - ArtNetParamsConst::kDestinationIpPortD |
164 | | -#endif |
165 | 104 | #endif |
166 | | -#endif |
167 | | - }; |
| 105 | + }; |
168 | 106 | }; |
169 | 107 | } // namespace json |
170 | 108 |
|
171 | | -#endif // JSON_DISPLAYUDFPARAMSCONST_H_ |
| 109 | +#endif // JSON_DISPLAYUDFPARAMSCONST_H_ |
0 commit comments