Skip to content

Commit

Permalink
Add message builders for RDMCommand and BrokerFetchClientList packets
Browse files Browse the repository at this point in the history
(cherry picked from commit 16455b1)
  • Loading branch information
peternewman committed Mar 28, 2024
1 parent 8af9777 commit eab5997
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/ola/e133/MessageBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <ola/e133/E133Enums.h>
#include <ola/io/IOStack.h>
#include <ola/io/MemoryBlockPool.h>
#include <ola/rdm/RDMCommand.h>
#include <string>

namespace ola {
Expand All @@ -46,8 +47,16 @@ class MessageBuilder {

void PrependRDMHeader(IOStack *packet);

void BuildTCPRDMCommandPDU(IOStack *packet,
ola::rdm::RDMRequest *request,
uint16_t source_endpoint_id,
uint16_t destination_endpoint_id,
uint32_t sequence_number);

void BuildNullTCPPacket(IOStack *packet);

void BuildBrokerFetchClientListTCPPacket(IOStack *packet);

void BuildBrokerNullTCPPacket(IOStack *packet);

void BuildTCPE133StatusPDU(IOStack *packet,
Expand Down
34 changes: 34 additions & 0 deletions tools/e133/MessageBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@
#include "ola/acn/CID.h"
#include "ola/e133/MessageBuilder.h"
#include "ola/io/IOStack.h"
#include "ola/rdm/RDMCommandSerializer.h"

#include "libs/acn/BrokerPDU.h"
#include "libs/acn/E133PDU.h"
#include "libs/acn/RDMPDU.h"
#include "libs/acn/RootPDU.h"
#include "libs/acn/RPTPDU.h"
#include "libs/acn/RPTRequestPDU.h"
#include "libs/acn/E133StatusPDU.h"
#include "libs/acn/PreamblePacker.h"

Expand All @@ -41,6 +44,7 @@ using ola::acn::BrokerPDU;
using ola::acn::E133PDU;
using ola::acn::PreamblePacker;
using ola::acn::RootPDU;
using ola::acn::RPTPDU;


MessageBuilder::MessageBuilder(const CID &cid, const string &source_name)
Expand All @@ -60,6 +64,26 @@ void MessageBuilder::PrependRDMHeader(IOStack *packet) {
}


/**
* Build a TCP E1.33 RDM Command PDU response.
*/
void MessageBuilder::BuildTCPRDMCommandPDU(IOStack *packet,
ola::rdm::RDMRequest *request,
uint16_t source_endpoint_id,
uint16_t destination_endpoint_id,
uint32_t sequence_number) {
ola::rdm::RDMCommandSerializer::Write(*request, packet);
ola::acn::RDMPDU::PrependPDU(packet);
ola::acn::RPTRequestPDU::PrependPDU(packet);
RPTPDU::PrependPDU(packet, ola::acn::VECTOR_RPT_REQUEST,
request->SourceUID(), source_endpoint_id,
request->DestinationUID(), destination_endpoint_id,
sequence_number);
RootPDU::PrependPDU(packet, ola::acn::VECTOR_ROOT_RPT, m_cid, true);
PreamblePacker::AddTCPPreamble(packet);
}


/**
* Build a NULL TCP packet. These packets can be used for heartbeats.
*/
Expand All @@ -69,6 +93,16 @@ void MessageBuilder::BuildNullTCPPacket(IOStack *packet) {
}


/**
* Build a Broker Fetch Client List TCP packet.
*/
void MessageBuilder::BuildBrokerFetchClientListTCPPacket(IOStack *packet) {
BrokerPDU::PrependPDU(packet, ola::acn::VECTOR_BROKER_FETCH_CLIENT_LIST);
RootPDU::PrependPDU(packet, ola::acn::VECTOR_ROOT_BROKER, m_cid, true);
PreamblePacker::AddTCPPreamble(packet);
}


/**
* Build a Broker NULL TCP packet. These packets can be used for broker heartbeats.
*/
Expand Down

0 comments on commit eab5997

Please sign in to comment.