Skip to content

Commit d89abd2

Browse files
committed
Handle vendorcast/broadcast when sending RDM commands via E1.33
(cherry picked from commit 9e113f0)
1 parent 7e83985 commit d89abd2

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

libs/acn/MessageBuilder.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "ola/e133/MessageBuilder.h"
2626
#include "ola/io/IOStack.h"
2727
#include "ola/rdm/RDMCommandSerializer.h"
28+
#include "ola/rdm/UID.h"
2829

2930
#include "libs/acn/BrokerPDU.h"
3031
#include "libs/acn/E133PDU.h"
@@ -72,12 +73,27 @@ void MessageBuilder::BuildTCPRDMCommandPDU(IOStack *packet,
7273
uint16_t source_endpoint_id,
7374
uint16_t destination_endpoint_id,
7475
uint32_t sequence_number) {
76+
// TODO(Peter): Potentially need some future way to handle controller
77+
// messages here
78+
ola::rdm::UID rpt_destination_uid = request->DestinationUID();
79+
if (rpt_destination_uid.IsBroadcast()) {
80+
if (rpt_destination_uid.IsVendorcast()) {
81+
rpt_destination_uid = ola::rdm::UID::RPTVendorcastAddressDevices(
82+
rpt_destination_uid);
83+
} else {
84+
rpt_destination_uid = ola::rdm::UID::RPTAllDevices();
85+
}
86+
if (destination_endpoint_id != NULL_ENDPOINT) {
87+
// TODO(Peter): Should we handle the reserved endpoints now?
88+
destination_endpoint_id = BROADCAST_ENDPOINT;
89+
}
90+
}
7591
ola::rdm::RDMCommandSerializer::Write(*request, packet);
7692
ola::acn::RDMPDU::PrependPDU(packet);
7793
ola::acn::RPTRequestPDU::PrependPDU(packet);
7894
RPTPDU::PrependPDU(packet, ola::acn::VECTOR_RPT_REQUEST,
7995
request->SourceUID(), source_endpoint_id,
80-
request->DestinationUID(), destination_endpoint_id,
96+
rpt_destination_uid, destination_endpoint_id,
8197
sequence_number);
8298
RootPDU::PrependPDU(packet, ola::acn::VECTOR_ROOT_RPT, m_cid, true);
8399
PreamblePacker::AddTCPPreamble(packet);

0 commit comments

Comments
 (0)