LLRP rdm command uses the RPT COMMAND type PDU
This commit is contained in:
parent
edb0880bdf
commit
6e47d8690f
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
|
||||
#include "llrp.h"
|
||||
#include "rpt.h"
|
||||
#include "rdmnet.h"
|
||||
|
||||
namespace RDMnet {
|
||||
|
@ -95,7 +96,7 @@ void Pdu::iStream(ACN::PDU::Stream stream)
|
|||
break;
|
||||
case VECTOR_LLRP_RDM_CMD:
|
||||
{
|
||||
auto block = ACN::PDU::Block<RdmCmd::Pdu>();
|
||||
auto block = ACN::PDU::Block<RPT::COMMAND::Pdu>();
|
||||
block.iStream(stream_);
|
||||
if (!block.pdu->empty())
|
||||
payload->child = block.pdu->front();
|
||||
|
@ -214,56 +215,5 @@ void Pdu::iStream(ACN::PDU::Stream stream)
|
|||
|
||||
} // namespace ProbeReply
|
||||
|
||||
|
||||
namespace RdmCmd {
|
||||
|
||||
/**
|
||||
* @brief rdm_data::iStream
|
||||
*/
|
||||
void rdm_data::iStream(ACN::PDU::Stream stream)
|
||||
{
|
||||
auto buffer = std::vector<uint8_t>();
|
||||
buffer.push_back(RDM::SC_RDM);
|
||||
while (stream->good())
|
||||
buffer.push_back(stream->readType<uint8_t>());
|
||||
message.read(buffer);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief rdm_data::oStream
|
||||
*/
|
||||
void rdm_data::oStream(ACN::PDU::Stream stream) const
|
||||
{
|
||||
auto buffer = std::vector<uint8_t>();
|
||||
message.write(buffer);
|
||||
for (size_t i = 1; i < buffer.size(); i++ )
|
||||
*stream << buffer.at(i);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief LLRP::RdmCmd::Pdu::Pdu
|
||||
*/
|
||||
Pdu::Pdu()
|
||||
: RDMnet::Pdu(1)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief LLRP::ProbeReply::Pdu::iStream
|
||||
* @param stream
|
||||
*/
|
||||
void Pdu::iStream(ACN::PDU::Stream stream)
|
||||
{
|
||||
RDMnet::Pdu::iStream(stream); // flags, length, and vector
|
||||
// hase no header // header
|
||||
createData<rdm_data>(); // data
|
||||
}
|
||||
|
||||
} // namespace RdmCmd
|
||||
|
||||
|
||||
} // namespace LLRP
|
||||
} // namespace RDMnet
|
||||
|
|
|
@ -145,8 +145,8 @@ public:
|
|||
|
||||
} // namespace ProbeReply
|
||||
|
||||
namespace RdmCmd {
|
||||
|
||||
namespace COMMAND {
|
||||
/// 5.5 Allowed Parameter Messages
|
||||
/// A limited subset of RDM Parameter Messages are allowed to be sent over LLRP
|
||||
static const PID allowed_pids[] = {
|
||||
|
@ -178,29 +178,7 @@ static const PID allowed_pids[] = {
|
|||
RDM::LOCK_STATE_DESCRIPTION,
|
||||
RDM::LOCK_STATE
|
||||
};
|
||||
|
||||
struct rdm_data
|
||||
: public ACN::PDU::pdu_data
|
||||
{
|
||||
RDM::Message message;
|
||||
size_t streamSize() const override { return 23 + message.length(); }
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
void oStream(ACN::PDU::Stream) const override;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The LLRP::RdmCmd::Pdu class
|
||||
*/
|
||||
class Pdu
|
||||
: public RDMnet::Pdu
|
||||
{
|
||||
public:
|
||||
Pdu();
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
};
|
||||
|
||||
} // namespace RdmCmd
|
||||
|
||||
} // namespace COMMAND
|
||||
|
||||
} // namespace LLRP
|
||||
} // namespace RDMnet
|
||||
|
|
|
@ -55,7 +55,7 @@ void Target::receiveLLRP(std::shared_ptr<Pdu> frame)
|
|||
receiveProbeRequest(std::static_pointer_cast<ProbeRequest::Pdu>(data->child));
|
||||
break;
|
||||
case VECTOR_LLRP_RDM_CMD:
|
||||
receiveRdmCommand(std::static_pointer_cast<RdmCmd::Pdu>(data->child));
|
||||
receiveRdmCommand(std::static_pointer_cast<RPT::COMMAND::Pdu>(data->child));
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
@ -76,10 +76,10 @@ void Target::receiveProbeRequest(std::shared_ptr<LLRP::ProbeRequest::Pdu>)
|
|||
* @brief Target::receiveRdmCommand
|
||||
* @param pdu
|
||||
*/
|
||||
void Target::receiveRdmCommand(std::shared_ptr<LLRP::RdmCmd::Pdu> pdu)
|
||||
void Target::receiveRdmCommand(std::shared_ptr<RPT::COMMAND::Pdu> pdu)
|
||||
{
|
||||
auto data = static_cast<RdmCmd::rdm_data*>(pdu->data());
|
||||
for ( auto& pid : LLRP::RdmCmd::allowed_pids )
|
||||
auto data = static_cast<RPT::COMMAND::command_data*>(pdu->data());
|
||||
for ( auto& pid : LLRP::COMMAND::allowed_pids )
|
||||
if (pid == data->message.parameterId)
|
||||
return receiveRDM(RDM::MsgPtr(&data->message));
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "rdmnet.h"
|
||||
#include "rpt.h"
|
||||
#include "llrp.h"
|
||||
|
||||
namespace RDMnet {
|
||||
|
@ -47,7 +48,7 @@ public:
|
|||
|
||||
virtual void receiveProbeRequest(std::shared_ptr<LLRP::ProbeRequest::Pdu> pdu);
|
||||
virtual void sendProbeReply() {};
|
||||
virtual void receiveRdmCommand(std::shared_ptr<LLRP::RdmCmd::Pdu> pdu);
|
||||
virtual void receiveRdmCommand(std::shared_ptr<RPT::COMMAND::Pdu> pdu);
|
||||
virtual void receiveRDM(const RDM::MsgPtr) = 0;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue