Skip to content

Commit ae26044

Browse files
committed
Unify undefined labels and JSON guards
Adds a shared `common::kUndefined` string and replaces scattered literal "Undefined" fallbacks across DMX, RDM, LTC, and MIDI-related code. The remote config JSON endpoints now enforce non-null/non-zero output buffers with assertions, and several small consistency cleanups were applied (macro style `#ifdef`, Art-Net node ID print usage, and minor formatting/log message tidy-ups).
1 parent c460478 commit ae26044

4 files changed

Lines changed: 25 additions & 23 deletions

File tree

common/include/common/utils/utils_string.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ inline constexpr char kWarning[] = "Warning";
3333
inline constexpr char kError[] = "Error";
3434
inline constexpr char kSuccess[] = "Success";
3535
inline constexpr char kUnknown[] = "Unknown";
36+
inline constexpr char kUndefined[] = "Undefined";
3637

3738
constexpr const char* IsSuccess(bool is_success) {
3839
return is_success ? kSuccess : kError;

gd32_rdm_responder/lib/rdmslotinfo.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,13 @@
2626
#include <cstdint>
2727

2828
#include "rdmslotinfo.h"
29+
#include "common/utils/utils_string.h"
2930
#include "pixeldmxparamsrdm.h"
3031

3132
using pixeldmx::paramsdmx::SlotsInfo;
3233

33-
const char* RDMSlotInfo::GetCategoryTextUndefined(uint16_t slotoffset, uint32_t& length)
34-
{
35-
switch (static_cast<pixeldmx::paramsdmx::SlotsInfo>(slotoffset))
36-
{
34+
const char* RDMSlotInfo::GetCategoryTextUndefined(uint16_t slotoffset, uint32_t& length) {
35+
switch (static_cast<pixeldmx::paramsdmx::SlotsInfo>(slotoffset)) {
3736
case SlotsInfo::TYPE:
3837
length = 4;
3938
return "Type";
@@ -63,5 +62,5 @@ const char* RDMSlotInfo::GetCategoryTextUndefined(uint16_t slotoffset, uint32_t&
6362
}
6463

6564
length = 9;
66-
return "Undefined";
65+
return common::kUndefined;
6766
}

lib-dmxnode/include/dmxnode_nodetype.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#define DMXNODE_NODETYPE_H_
2727

2828
#include <cstdint>
29+
#include "common/utils/utils_string.h"
2930

3031
namespace dmxnode {
3132
enum class NodeType {
@@ -60,7 +61,7 @@ inline const char* GetNodeType(NodeType type) {
6061
return kNodeTypeNames[static_cast<uint32_t>(type)];
6162
}
6263

63-
return "Undefined";
64+
return common::kUndefined;
6465
}
6566
} // namespace dmxnode
6667

lib-dmxnode/include/dmxnode_outputtype.h

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,25 @@
2626
#define DMXNODE_OUTPUTTYPE_H_
2727

2828
#include <cstdint>
29+
#include "common/utils/utils_string.h"
2930

3031
namespace dmxnode {
3132
enum class OutputType {
32-
kDmx, //
33-
kDmxRdm, //
34-
kPixel, //
35-
kPixelDmx, //
36-
kPwm, //
37-
kRgbPanel, //
38-
kSerial, //
39-
kOsc, //
40-
kMonitor, //
41-
kStepper, //
42-
kPlayer, //
43-
kArtNet, //
44-
kTimeCode, //
45-
kNone, //
46-
kUndefined //
33+
kDmx, //
34+
kDmxRdm, //
35+
kPixel, //
36+
kPixelDmx, //
37+
kPwm, //
38+
kRgbPanel, //
39+
kSerial, //
40+
kOsc, //
41+
kMonitor, //
42+
kStepper, //
43+
kPlayer, //
44+
kArtNet, //
45+
kTimeCode, //
46+
kNone, //
47+
kUndefined, //
4748
};
4849

4950
inline constexpr const char* kOutputTypeNames[static_cast<uint32_t>(OutputType::kUndefined)] = {
@@ -60,15 +61,15 @@ inline constexpr const char* kOutputTypeNames[static_cast<uint32_t>(OutputType::
6061
"Player", //
6162
"Art-Net", //
6263
"Timecode", //
63-
"None" //
64+
"None", //
6465
};
6566

6667
inline const char* GetOutputType(OutputType type) {
6768
if (type < OutputType::kUndefined) {
6869
return kOutputTypeNames[static_cast<uint32_t>(type)];
6970
}
7071

71-
return "Undefined";
72+
return common::kUndefined;
7273
}
7374
} // namespace dmxnode
7475

0 commit comments

Comments
 (0)