Skip to content

Commit 64b440d

Browse files
committed
Rename DMX/RDM APIs to Transmit/Direction
Refactor DMX/RDM public APIs for clarity and consistency in lib-dmx include headers (h3/multi/dmx.h and h3/single/dmx.h). - Replace dmx::PortDirection with dmx::Direction and rename getter GetPortDirection -> PortDirection - Rename DMX transmit-related APIs: SetDmxBreakTime/GetDmxBreakTime -> SetTransmitBreakTime/TransmitBreakTime (and similarly for MAB, Period, Slots) - Rename send templates: SetSendData* -> SetTransmitDataWithSC / SetTransmitDataWithoutSC and update inline template name - Rename RDM send APIs to RdmTransmit / RdmTransmitDiscoveryRespondMessage and add RDM receive declarations - Update port_direction_ member type to dmx::Direction and adjust related declarations This is an API-breaking rename; update callsites accordingly (e.g. SetDmxBreakTime -> SetTransmitBreakTime, GetDmxSlots -> TransmitSlots, RdmSend -> RdmTransmit, SetSendDataWithoutSC -> SetTransmitDataWithoutSC).
1 parent 12f7d97 commit 64b440d

69 files changed

Lines changed: 959 additions & 1401 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎lib-artnet/include/artnetnode.h‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ struct Node
125125
uint8_t sw; ///< Bits 3-0 of the 15 bit Port-Address for a given port are encoded into the bottom 4 bits of this field.
126126
uint8_t sub_switch; ///< Bits 7-4 of the 15 bit Port-Address are encoded into the bottom 4 bits of this field.
127127
uint8_t net_switch; ///< Bits 14-8 of the 15 bit Port-Address are encoded into the bottom 7 bits of this field.
128-
dmxnode::PortDirection direction;
128+
dmxnode::Direction direction;
129129
artnet::PortProtocol protocol; ///< Art-Net 4
130130
bool local_merge;
131131
} port[dmxnode::kMaxPorts] ALIGNED;
@@ -210,11 +210,11 @@ class ArtNetNode
210210
void SetUniverse(uint32_t port_index, uint16_t universe);
211211
uint16_t GetUniverse(uint32_t port_index) const;
212212

213-
void SetDirection(uint32_t port_index, dmxnode::PortDirection port_direction);
214-
dmxnode::PortDirection GetDirection(uint32_t port_index) const;
213+
void SetDirection(uint32_t port_index, dmxnode::Direction port_direction);
214+
dmxnode::Direction GetDirection(uint32_t port_index) const;
215215

216-
void SetUniverse(uint32_t port_index, dmxnode::PortDirection port_direction, uint16_t universe);
217-
bool GetUniverse(uint32_t port_index, uint16_t& universe, dmxnode::PortDirection port_direction);
216+
void SetUniverse(uint32_t port_index, dmxnode::Direction port_direction, uint16_t universe);
217+
bool GetUniverse(uint32_t port_index, uint16_t& universe, dmxnode::Direction port_direction);
218218

219219
void SetMergeMode(uint32_t port_index, dmxnode::MergeMode merge_mode);
220220
dmxnode::MergeMode GetMergeMode(uint32_t port_index) const;
@@ -259,10 +259,10 @@ class ArtNetNode
259259
uint32_t GetActiveInputPorts() const { return state_.enabled_input_ports; }
260260
uint32_t GetActiveOutputPorts() const { return state_.enabled_output_ports; }
261261

262-
dmxnode::PortDirection GetPortDirection(uint32_t port_index) const;
262+
dmxnode::Direction PortDirection(uint32_t port_index) const;
263263

264264
bool GetPortAddress(uint32_t port_index, uint16_t& address) const;
265-
bool GetPortAddress(uint32_t port_index, uint16_t& address, dmxnode::PortDirection port_direction) const;
265+
bool GetPortAddress(uint32_t port_index, uint16_t& address, dmxnode::Direction port_direction) const;
266266

267267
bool GetOutputPort(uint16_t universe, uint32_t& port_index);
268268

‎lib-artnet/include/artnetnode4_inline_impl.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,18 @@ inline void ArtNetNode::SetPortProtocol4(uint32_t port_index, artnet::PortProtoc
8585
node_.port[port_index].protocol = port_protocol;
8686

8787
if (port_protocol == artnet::PortProtocol::kSacn) {
88-
if (node_.port[port_index].direction == dmxnode::PortDirection::kOutput) {
88+
if (node_.port[port_index].direction == dmxnode::Direction::kOutput) {
8989
output_port_[port_index].good_output |= artnet::GoodOutput::kOutputIsSacn;
9090
}
9191

9292
SetUniverse4(port_index);
9393
E131Bridge::SetDirection(port_index, node_.port[port_index].direction);
9494
} else {
95-
if (node_.port[port_index].direction == dmxnode::PortDirection::kOutput) {
95+
if (node_.port[port_index].direction == dmxnode::Direction::kOutput) {
9696
output_port_[port_index].good_output &= static_cast<uint8_t>(~artnet::GoodOutput::kOutputIsSacn);
9797
}
9898

99-
E131Bridge::SetDirection(port_index, dmxnode::PortDirection::kDisable);
99+
E131Bridge::SetDirection(port_index, dmxnode::Direction::kDisable);
100100
}
101101

102102
if (state_.status == artnet::Status::kOn) {
@@ -132,7 +132,7 @@ inline uint8_t ArtNetNode::GetGoodOutput4(uint32_t port_index) {
132132
assert(port_index < dmxnode::kMaxPorts);
133133

134134
uint16_t universe;
135-
const auto kIsActive = E131Bridge::GetUniverse(port_index, universe, dmxnode::PortDirection::kOutput);
135+
const auto kIsActive = E131Bridge::GetUniverse(port_index, universe, dmxnode::Direction::kOutput);
136136

137137
DEBUG_PRINTF("Port %u, Active %c, Universe %d, %s", port_index, kIsActive ? 'Y' : 'N', universe, dmxnode::GetMergeMode(E131Bridge::GetMergeMode(port_index), true));
138138

‎lib-artnet/include/artnetnode_inline_impl.h‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ inline uint16_t ArtNetNode::GetUniverse(uint32_t port_index) const {
8787
return 0;
8888
}
8989

90-
inline dmxnode::PortDirection ArtNetNode::GetDirection(uint32_t port_index) const {
90+
inline dmxnode::Direction ArtNetNode::GetDirection(uint32_t port_index) const {
9191
assert(port_index < dmxnode::kMaxPorts);
9292
return node_.port[port_index].direction;
9393
}
9494

95-
inline bool ArtNetNode::GetUniverse(uint32_t port_index, uint16_t& universe, dmxnode::PortDirection port_direction) {
95+
inline bool ArtNetNode::GetUniverse(uint32_t port_index, uint16_t& universe, dmxnode::Direction port_direction) {
9696
if (node_.port[port_index].protocol == artnet::PortProtocol::kArtnet) {
9797
return ArtNetNode::GetPortAddress(port_index, universe, port_direction);
9898
}
@@ -201,26 +201,26 @@ inline void ArtNetNode::GoodOutputBClear(uint32_t port_index, uint8_t b) {
201201
output_port_[port_index].good_output_b &= static_cast<uint8_t>(~b);
202202
}
203203

204-
inline dmxnode::PortDirection ArtNetNode::GetPortDirection(uint32_t port_index) const {
204+
inline dmxnode::Direction ArtNetNode::PortDirection(uint32_t port_index) const {
205205
assert(port_index < dmxnode::kMaxPorts);
206206
return node_.port[port_index].direction;
207207
}
208208

209209
inline bool ArtNetNode::GetPortAddress(uint32_t port_index, uint16_t& address) const {
210210
assert(port_index < dmxnode::kMaxPorts);
211211

212-
if (node_.port[port_index].direction == dmxnode::PortDirection::kDisable) {
212+
if (node_.port[port_index].direction == dmxnode::Direction::kDisable) {
213213
return false;
214214
}
215215

216216
address = node_.port[port_index].port_address;
217217
return true;
218218
}
219219

220-
inline bool ArtNetNode::GetPortAddress(uint32_t port_index, uint16_t& address, dmxnode::PortDirection port_direction) const {
220+
inline bool ArtNetNode::GetPortAddress(uint32_t port_index, uint16_t& address, dmxnode::Direction port_direction) const {
221221
assert(port_index < dmxnode::kMaxPorts);
222222

223-
if (port_direction == dmxnode::PortDirection::kDisable) {
223+
if (port_direction == dmxnode::Direction::kDisable) {
224224
return false;
225225
}
226226

@@ -230,7 +230,7 @@ inline bool ArtNetNode::GetPortAddress(uint32_t port_index, uint16_t& address, d
230230

231231
inline bool ArtNetNode::GetOutputPort(uint16_t universe, uint32_t& port_index) {
232232
for (port_index = 0; port_index < dmxnode::kMaxPorts; port_index++) {
233-
if (node_.port[port_index].direction != dmxnode::PortDirection::kOutput) {
233+
if (node_.port[port_index].direction != dmxnode::Direction::kOutput) {
234234
continue;
235235
}
236236
if ((node_.port[port_index].protocol == artnet::PortProtocol::kArtnet) && (universe == node_.port[port_index].port_address)) {
@@ -264,7 +264,7 @@ inline void ArtNetNode::Run() {
264264
}
265265

266266
if (kDeltaMillis >= (1U * 1000U)) {
267-
state_.receiving_dmx &= static_cast<uint8_t>(~(1U << static_cast<uint8_t>(dmxnode::PortDirection::kOutput)));
267+
state_.receiving_dmx &= static_cast<uint8_t>(~(1U << static_cast<uint8_t>(dmxnode::Direction::kOutput)));
268268
}
269269

270270
#if (DMXNODE_PORTS > 0)
@@ -312,8 +312,9 @@ inline void ArtNetNode::Run() {
312312

313313
#if defined(RDM_CONTROLLER)
314314
if (__builtin_expect((state_.is_rdm_enabled), 0)) {
315+
#if defined(ARTNET_HAVE_DMXIN)
315316
HandleRdmIn();
316-
317+
#endif
317318
rdm_controller_.Run();
318319
}
319320
#endif

‎lib-artnet/include/artnetstore.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ inline void SaveSwitch(uint32_t port_index, [[maybe_unused]] uint8_t sw)
130130
DEBUG_EXIT();
131131
}
132132

133-
inline void SaveDirection(uint32_t port_index, dmxnode::PortDirection direction)
133+
inline void SaveDirection(uint32_t port_index, dmxnode::Direction direction)
134134
{
135135
DEBUG_ENTRY();
136136
DEBUG_PRINTF("%u, %u", port_index, static_cast<uint32_t>(direction));
@@ -157,7 +157,7 @@ inline void SaveDirection(uint32_t port_index, dmxnode::PortDirection direction)
157157

158158
auto direction_store = ConfigStore::Instance().DmxNodeGet(&common::store::DmxNode::direction);
159159

160-
common::PortSet<dmxnode::PortDirection>(port_index, direction, direction_store);
160+
common::PortSet<dmxnode::Direction>(port_index, direction, direction_store);
161161

162162
ConfigStore::Instance().DmxNodeUpdate(&common::store::DmxNode::direction, direction_store);
163163

0 commit comments

Comments
 (0)