diff --git a/protocol/rlp/component.cpp b/protocol/rlp/component.cpp index ecd1c37..d4a16ae 100644 --- a/protocol/rlp/component.cpp +++ b/protocol/rlp/component.cpp @@ -66,11 +66,27 @@ void Component::UdpPayloadReceiver(PDU::Stream stream) * @param ip */ void Component::rlpSendUdp (const uint32_t vector, - const PDU::Message< PDU::pdu_data > data, + const PDU::Message data, const SDT::UDP::ipAddress& ip) { - RLP::UDP::transport transport(true); - rlpSend(transport, vector, data, ip); + /// Construct the RLP PDU. + auto rlp = std::make_shared(); + rlp->setVector(vector); + rlp->setHeader(rlp_header_); + rlp->setData(data); + + /// Use the EPI 17 tranport format. + UDP::transport transport(true); + transport.root.pdu->push_back(rlp); + + /// Fill an output stream with the transported PDU + size_t length = transport.streamSize(); + uint8_t buffer[length]; + PDU::Stream stream(new PDU::pdu_stream(buffer, length)); + *stream << transport; + + /// Platform devices shall impliment the send. + sendUDP(stream, ip); } @@ -101,8 +117,24 @@ void Component::rlpSendTcp (const uint32_t vector, const PDU::Message data, const SDT::UDP::ipAddress& ip) { - RLP::TCP::transport transport(true); - rlpSend(transport, vector, data, ip); + /// Construct the RLP PDU. + auto rlp = std::make_shared(); + rlp->setVector(vector); + rlp->setHeader(rlp_header_); + rlp->setData(data); + + /// Use the EPI 33 tranport format. + TCP::transport transport(true); + transport.root.pdu->push_back(rlp); + + /// Fill an output stream with the transported PDU + size_t length = transport.streamSize(); + uint8_t buffer[length]; + PDU::Stream stream(new PDU::pdu_stream(buffer, length)); + *stream << transport; + + /// Platform devices shall impliment the send. + sendTCP(stream, ip); } @@ -143,38 +175,6 @@ void Component::RlpRegisterVector(uint32_t vect, PDU::Handler handle) } -/** - * @brief Component::rlpSend - * @param transport - * @param vector - * @param data - * @param ip - */ -void Component::rlpSend(ACN::RLP::message_transport& transport, - const uint32_t vector, - const PDU::Message data, - const SDT::UDP::ipAddress& ip) -{ - // rlp pdu - auto rlp = std::make_shared(); - rlp->setVector(vector); - rlp->setHeader(rlp_header_); - rlp->setData(data); - - // root block - transport.root.pdu->push_back(rlp); - - // create an output stream - size_t length = transport.streamSize(); - uint8_t buffer[length]; - ACN::PDU::Stream stream(new ACN::PDU::pdu_stream(buffer, length)); - - // write message - *stream << transport; - sendUDP(stream, ip); -} - - /** * @brief Component::sendUDP * @param stream diff --git a/protocol/rlp/component.h b/protocol/rlp/component.h index 017e9fc..5453767 100644 --- a/protocol/rlp/component.h +++ b/protocol/rlp/component.h @@ -62,10 +62,6 @@ protected: void RlpReceiver(PDU::Message); void RlpRegisterVector(uint32_t, PDU::Handler); - void rlpSend(ACN::RLP::message_transport&, const uint32_t vector, - const PDU::Message data, - const SDT::UDP::ipAddress&); - virtual void sendUDP(const PDU::Stream, const SDT::UDP::ipAddress&); virtual void sendTCP(const PDU::Stream, const SDT::UDP::ipAddress&);