llrp rdm into rdm responder
This commit is contained in:
parent
587f5a8d33
commit
0c96f9a69c
|
@ -47,4 +47,9 @@ Device::~Device()
|
|||
|
||||
}
|
||||
|
||||
void Device::receiveRDM(const RDM::MsgPtr message)
|
||||
{
|
||||
RDM::Responder::receive(message);
|
||||
}
|
||||
|
||||
} // namespace RDMnet
|
||||
|
|
|
@ -48,6 +48,8 @@ public:
|
|||
RDM::UID uid = RDM::UID());
|
||||
virtual ~Device();
|
||||
|
||||
virtual void receiveRDM(const RDM::MsgPtr) override;
|
||||
|
||||
private:
|
||||
UUID::uuid rid_;
|
||||
};
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "pdu.h"
|
||||
#include "rdmnet.h"
|
||||
#include "rdm/uid.h"
|
||||
#include "rdm/message.h"
|
||||
#include "uuid/uuid.h"
|
||||
|
@ -46,9 +47,9 @@ namespace LLRP {
|
|||
struct llrp_data
|
||||
: public ACN::PDU::pdu_data
|
||||
{
|
||||
UUID::uuid destination; //!< The receiver's unique CID or LLRP_BROADCAST_CID,
|
||||
uint32_t transaction; //!< Used to match request / response messages.
|
||||
std::shared_ptr<ACN::PDU::Pdu> child; //!< Probe Request PDU, Probe Reply PDU or RDM Command PDU...
|
||||
UUID::uuid destination; //!< The receiver's unique CID or LLRP_BROADCAST_CID,
|
||||
uint32_t transaction; //!< Used to match request / response messages.
|
||||
std::shared_ptr<RDMnet::Pdu> child; //!< Probe Request PDU, Probe Reply PDU or RDM Command PDU...
|
||||
size_t streamSize() const override { return 20 + child->streamSize(); }
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
void oStream(ACN::PDU::Stream) const override;
|
||||
|
@ -145,6 +146,38 @@ public:
|
|||
|
||||
namespace RdmCmd {
|
||||
|
||||
/// 5.5 Allowed Parameter Messages
|
||||
/// A limited subset of RDM Parameter Messages are allowed to be sent over LLRP
|
||||
static const PID allowed_pids[] = {
|
||||
COMPONENT_SCOPE,
|
||||
SEARCH_DOMAIN,
|
||||
TCP_COMMS_STATUS,
|
||||
BROKER_STATUS,
|
||||
RDM::LIST_INTERFACES,
|
||||
RDM::INTERFACE_LABEL,
|
||||
RDM::INTERFACE_HARDWARE_ADDRESS_TYPE1,
|
||||
RDM::IPV4_DHCP_MODE,
|
||||
RDM::IPV4_ZEROCONF_MODE,
|
||||
RDM::IPV4_CURRENT_ADDRESS,
|
||||
RDM::IPV4_STATIC_ADDRESS,
|
||||
RDM::INTERFACE_RENEW_DHCP,
|
||||
RDM::INTERFACE_RELEASE_DHCP,
|
||||
RDM::INTERFACE_APPLY_CONFIGURATION,
|
||||
RDM::IPV4_DEFAULT_ROUTE,
|
||||
RDM::DNS_IPV4_NAME_SERVER,
|
||||
RDM::DNS_HOSTNAME,
|
||||
RDM::DNS_DOMAIN_NAME,
|
||||
RDM::DEVICE_INFO,
|
||||
RDM::RESET_DEVICE,
|
||||
RDM::FACTORY_DEFAULTS,
|
||||
RDM::DEVICE_LABEL,
|
||||
RDM::MANUFACTURER_LABEL,
|
||||
RDM::DEVICE_MODEL_DESCRIPTION,
|
||||
RDM::IDENTIFY_DEVICE,
|
||||
RDM::LOCK_STATE_DESCRIPTION,
|
||||
RDM::LOCK_STATE
|
||||
};
|
||||
|
||||
struct rdm_data
|
||||
: public ACN::PDU::pdu_data
|
||||
{
|
||||
|
|
|
@ -44,5 +44,48 @@ Target::~Target()
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Target::receiveLLRP
|
||||
* @param frame
|
||||
*/
|
||||
void Target::receiveLLRP(std::shared_ptr<Pdu> frame)
|
||||
{
|
||||
auto data = static_cast<llrp_data*>(frame->data());
|
||||
switch (frame->vector()) {
|
||||
case VECTOR_LLRP_PROBE_REQUEST:
|
||||
receiveProbeRequest(std::static_pointer_cast<ProbeRequest::Pdu>(data->child));
|
||||
break;
|
||||
case VECTOR_LLRP_RDM_CMD:
|
||||
receiveRdmCommand(std::static_pointer_cast<RdmCmd::Pdu>(data->child));
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Target::receiveProbeRequest
|
||||
* @param pdu
|
||||
*/
|
||||
void Target::receiveProbeRequest(std::shared_ptr<LLRP::ProbeRequest::Pdu> pdu)
|
||||
{
|
||||
(void)pdu;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Target::receiveRdmCommand
|
||||
* @param pdu
|
||||
*/
|
||||
void Target::receiveRdmCommand(std::shared_ptr<LLRP::RdmCmd::Pdu> pdu)
|
||||
{
|
||||
auto data = static_cast<RdmCmd::rdm_data*>(pdu->data());
|
||||
for ( auto& pid : LLRP::RdmCmd::allowed_pids )
|
||||
if (pid == data->message.parameterId)
|
||||
return receiveRDM(RDM::MsgPtr(&data->message));
|
||||
}
|
||||
|
||||
} // namespace LLRP
|
||||
} // namespace RDMnet
|
||||
|
|
|
@ -42,8 +42,13 @@ public:
|
|||
virtual ~Target();
|
||||
|
||||
virtual void setup() = 0; //!< listens on LLRP_PORT
|
||||
virtual void receiveProbeRequest() {};
|
||||
|
||||
void receiveLLRP(std::shared_ptr<LLRP::Pdu> frame);
|
||||
|
||||
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 receiveRDM(const RDM::MsgPtr) = 0;
|
||||
};
|
||||
|
||||
} // namespace LLRP
|
||||
|
|
Loading…
Reference in New Issue