1
0
Fork 0

don't force sACN namespace to be all caps

This commit is contained in:
Kevin Matz 2021-08-28 09:01:33 -04:00
parent 6cde71a672
commit 031888f192
20 changed files with 169 additions and 81 deletions

View File

@ -16,7 +16,7 @@ QSacnNode::QSacnNode(QObject *parent, QUuid cid)
{
fctn_ = "OpenLCP QSacnNode";
bind(QHostAddress::AnyIPv4, SACN::ACN_SDT_MULTICAST_PORT);
bind(QHostAddress::AnyIPv4, sACN::ACN_SDT_MULTICAST_PORT);
connect(this, &QUdpSocket::readyRead,
this, &QSacnNode::udpReceive);
@ -34,7 +34,7 @@ void QSacnNode::subscribe(const uint16_t num)
{
if (Receiver::universe(num)) // already subscribed
return;
if (num != SACN::E131_DISCOVERY_UNIVERSE) {
if (num != sACN::E131_DISCOVERY_UNIVERSE) {
qDebug() << "Subscribing to universe" << QString::number(num);
Receiver::subscribe(num);
universes_.insert(num, new QSacnUniverse(this, Receiver::universe(num)));
@ -69,7 +69,7 @@ void QSacnNode::udpReceive()
while (hasPendingDatagrams()) {
QNetworkDatagram datagram = receiveDatagram();
// Expecting IANA registered Session Data Transport traffic
if (datagram.destinationPort() != SACN::ACN_SDT_MULTICAST_PORT)
if (datagram.destinationPort() != sACN::ACN_SDT_MULTICAST_PORT)
return;
// wrap a PDU io stream around the QNetworkDatagram data buffer
@ -88,7 +88,7 @@ void QSacnNode::udpReceive()
* wrap data change callback to a Qt signal
*/
void QSacnNode::emitFound(
std::shared_ptr<SACN::EXTENDED::DISCOVERY::discoveredUniverse> univ)
std::shared_ptr<sACN::EXTENDED::DISCOVERY::discoveredUniverse> univ)
{
qDebug() << "found universe " << QString::number(univ->universe);
emit foundUniverse(univ);

View File

@ -14,7 +14,7 @@
*/
class QT_EXPORT QSacnNode
: public QUdpSocket
, public SACN::Node
, public sACN::Node
{
Q_OBJECT
@ -28,12 +28,12 @@ public:
signals:
void foundUniverse(
std::shared_ptr<SACN::EXTENDED::DISCOVERY::discoveredUniverse>);
std::shared_ptr<sACN::EXTENDED::DISCOVERY::discoveredUniverse>);
private:
void udpReceive();
void emitFound(
std::shared_ptr<SACN::EXTENDED::DISCOVERY::discoveredUniverse>);
std::shared_ptr<sACN::EXTENDED::DISCOVERY::discoveredUniverse>);
QHash<uint16_t, QSacnUniverse*> universes_;

View File

@ -20,7 +20,7 @@ public:
* @param universe
*/
explicit QSacnUniverse(QObject *parent = nullptr,
SACN::Universe *universe = nullptr)
sACN::Universe *universe = nullptr)
: QObject(parent)
, universe_(universe)
{
@ -82,7 +82,7 @@ public slots:
signals:
void changed(SACN::Universe*);
void changed(sACN::Universe*);
protected:
void dataChangedNotifier(DMX::Universe* universe = nullptr)
@ -92,5 +92,5 @@ protected:
};
private:
SACN::Universe *universe_;
sACN::Universe *universe_;
};

View File

@ -25,7 +25,7 @@
#include "dmp/dmp.h"
#include "data.h"
namespace SACN {
namespace sACN {
namespace DATA {
/**

View File

@ -26,7 +26,16 @@
#include "acn/pdu.h"
#include "sacn.h"
namespace SACN::DATA {
/**
* \cite sACN 1.4 Classes of Data Appropriate for Transmission
*
* This standard, E1.31, is intended to define a method to carry DMX512-A
* \cite DMX style data and metadata over IP Networks. It is designed to carry
* repetitive control data from one or more sources to one or more receivers.
* This protocol is intended to be used to control dimmers, other lighting
* devices, and related non- hazardous effects equipment.
*/
namespace sACN::DATA {
/**
* @brief Table 6-1: E1.31 Data Packet Framing Layer

View File

@ -26,7 +26,7 @@
#include "extended.h"
#include "config.h"
namespace SACN {
namespace sACN {
namespace EXTENDED {
/**

View File

@ -28,10 +28,13 @@
#include "uuid/uuid.h"
#include <functional>
namespace SACN::EXTENDED {
/**
* @brief both Discovery and Syncronization
*/
namespace sACN::EXTENDED {
/**
* @brief 6.3 E1.31 Synchronization Packet Framing Layer
* @brief \cite sACN 6.3 E1.31 Synchronization Packet Framing Layer
*/
struct sync_header
: ACN::PDU::pdu_header
@ -47,7 +50,7 @@ struct sync_header
/**
* @brief 6.4 E1.31 Universe Discovery Packet Framing Layer
* @brief \cite sACN 6.4 E1.31 Universe Discovery Packet Framing Layer
*/
struct discovery_header
: ACN::PDU::pdu_header
@ -73,6 +76,15 @@ public:
};
/**
* \cite sACN 1.6 Universe Discovery
*
* This standard includes a Universe Discovery packet that sources must provide
* in order to enumerate the universes upon which they are transmitting. This
* allows other devices interested in network traffic to monitor which universes
* are currently active, without the need to join every multicast group to
* examine their individual transmissions.
*/
namespace DISCOVERY {
/**
@ -100,6 +112,10 @@ struct discoveredUniverse
uint16_t universe; //!< universe number
};
/**
* @brief a callback function interested in discovered universes
*/
using Watcher = std::function<void(std::shared_ptr<discoveredUniverse>)>;
@ -118,7 +134,11 @@ struct discovery_list_data
/**
* @brief The EXTENDED::DISCOVERY::Pdu class
* @brief \cite sACN 3.10 E1.31 Universe Discovery Packet
*
* An E1.31 Universe Discovery Packet is a packet which contains a packed list
* of the universes upon which a source is actively operating. It is transmitted
* with the VECTOR_E131_EXTENDED_DISCOVERY vector.
*/
class Pdu
: public ACN::PDU::Pdu

View File

@ -24,13 +24,13 @@
#include "mergeproxyuniverse.h"
namespace SACN {
namespace sACN {
/**
* @brief MergeProxyUniverse::MergeProxyUniverse
*/
MergeProxyUniverse::MergeProxyUniverse()
: SACN::Universe()
: sACN::Universe()
{
}
@ -126,7 +126,7 @@ void MergeProxyUniverse::addSourceUniverse(Universe* universe)
*/
void MergeProxyUniverse::dataChangedNotifier(DMX::Universe* dmx)
{
auto sacn = static_cast<SACN::Universe*>(dmx);
auto sacn = static_cast<sACN::Universe*>(dmx);
auto universe = dominant_();
if (!universe)
return;
@ -252,7 +252,7 @@ Universe* MergeProxyUniverse::dominant_() const
void MergeProxyUniverse::newProvenance_(const Provenance &src)
{
sources_.emplace(src, new Universe());
sources_.at(src)->onData(std::bind(&SACN::MergeProxyUniverse::dataChangedNotifier,
sources_.at(src)->onData(std::bind(&sACN::MergeProxyUniverse::dataChangedNotifier,
this, std::placeholders::_1));
}

View File

@ -28,17 +28,19 @@
#include <memory>
#include <unordered_map>
namespace SACN {
namespace sACN {
/**
* @brief The MergeProxyUniverse class
* 6.2.3.1 Multiple Sources at Highest Priority
* It is possible for there to be multiple sources, all transmitting data
* at the highest currently active priority for a given universe. When this
* occurs, receivers must handle these sources in some way.
*
* \cite sACN 6.2.3.1 Multiple Sources at Highest Priority
*
* It is possible for there to be multiple sources, all transmitting data at the
* highest currently active priority for a given universe. When this occurs,
* receivers must handle these sources in some way.
*/
class MergeProxyUniverse
: public SACN::Universe
: public sACN::Universe
{
public:
MergeProxyUniverse();
@ -66,7 +68,7 @@ public:
double rxRate() override;
private:
std::unordered_map<Provenance, SACN::Universe*> sources_;
std::unordered_map<Provenance, sACN::Universe*> sources_;
Universe* dominant_() const;
void newProvenance_(const Provenance&);

View File

@ -1,6 +1,6 @@
#include "node.h"
namespace SACN {
namespace sACN {
/**
* @brief Node::Node

View File

@ -27,7 +27,7 @@
#include "receiver.h"
#include "source.h"
namespace SACN {
namespace sACN {
/**
* @brief The Node class

View File

@ -28,7 +28,7 @@
namespace sACN {
/**
* @brief Provenance::Provenance
* @brief default constructor
*/
Provenance::Provenance()
: cid(UUID::uuid())
@ -41,7 +41,7 @@ Provenance::Provenance()
/**
* @brief Construct a Universe Source from an sACN frame PDU
* @brief Compile metadata from an sACN::DATA PDU
* @param pdu
*/
Provenance::Provenance(ACN::PDU::Message<DATA::Pdu> pdu)

View File

@ -26,7 +26,7 @@
#include "receiver.h"
#include "config.h"
namespace SACN {
namespace sACN {
/**
* @brief Receiver::Receiver
@ -96,7 +96,7 @@ Universe * Receiver::universe(const uint16_t num) {
* @brief Receiver::discoveryStart
*/
void Receiver::discoveryStart() {
subscribe(SACN::E131_DISCOVERY_UNIVERSE);
subscribe(sACN::E131_DISCOVERY_UNIVERSE);
}
@ -104,7 +104,7 @@ void Receiver::discoveryStart() {
* @brief Receiver::discoveryStop
*/
void Receiver::discoveryStop() {
unsubscribe(SACN::E131_DISCOVERY_UNIVERSE);
unsubscribe(sACN::E131_DISCOVERY_UNIVERSE);
}
@ -132,8 +132,7 @@ void Receiver::dataReceiver(ACN::PDU::Message<ACN::RLP::Pdu> root)
auto block = static_cast<ACN::PDU::Block<DATA::Pdu>*>(root->data());
for(auto const &frame : *block->pdu)
{
/// \cite sACN
/// 6.2.1 E1.31 Data Packet: Vector
/// \cite sACN 6.2.1 E1.31 Data Packet: Vector
/// Sources sending an E1.31 Data Packet shall set the E1.31 Layer's Vector
/// to VECTOR_E131_DATA_PACKET. This value indicates that the E1.31 framing
/// layer is wrapping a DMP PDU.
@ -196,8 +195,7 @@ void Receiver::dataFrameHandler(ACN::PDU::Message<DATA::Pdu> frame) {
return;
auto universe = universes_.at(source->universe)->sourceUniverse(*source);
/// \cite sACN
/// 6.2.6 E1.31 Data Packet: Options
/// \cite sACN 6.2.6 E1.31 Data Packet: Options
/// Preview_Data: Bit 7 (most significant bit)
/// This bit, when set to 1, indicates that the data in this packet is
/// intended for use in visualization or media server preview applications and
@ -205,8 +203,7 @@ void Receiver::dataFrameHandler(ACN::PDU::Message<DATA::Pdu> frame) {
if (source->options.preview_data)
return;
/// \cite sACN
/// 6.2.6 E1.31 Data Packet: Options
/// \cite sACN 6.2.6 E1.31 Data Packet: Options
/// Stream_Terminated: Bit 6
/// allow E1.31 sources to terminate transmission of a stream or of
/// universe synchronization without waiting for a timeout to occur.
@ -217,8 +214,7 @@ void Receiver::dataFrameHandler(ACN::PDU::Message<DATA::Pdu> frame) {
return;
}
/// \cite sACN
/// 6.2.4.1 Synchronization Address Usage in an E1.31 Data Packet
/// \cite sACN 6.2.4.1 Synchronization Address Usage in an E1.31 Data Packet
/// a value of 0 in the Synchronization Address indicates that the universe
/// data is not synchronized.
if (source->sync_address != 0)
@ -228,8 +224,7 @@ void Receiver::dataFrameHandler(ACN::PDU::Message<DATA::Pdu> frame) {
auto block = static_cast<ACN::PDU::Block<ACN::DMP::Pdu>*>(frame->data());
for (auto const &dmp : *block->pdu)
{
/// \cite sACN
/// 7.2 DMP Layer: Vector
/// \cite sACN 7.2 DMP Layer: Vector
/// The DMP Layer's Vector shall be set to VECTOR_DMP_SET_PROPERTY, which
/// indicates a DMP Set Property message by sources. Receivers shall
/// discard the packet if the received value is not
@ -264,8 +259,7 @@ void Receiver::discoveryFrameHandler(ACN::PDU::Message<EXTENDED::Pdu> frame) {
auto block = static_cast<ACN::PDU::Block<EXTENDED::DISCOVERY::Pdu>*>(frame->data());
for(auto const &pdu : *block->pdu)
{
/// \cite sACN
/// 8 Universe Discovery Layer
/// \cite sACN 8 Universe Discovery Layer
/// Universe Discovery data only appears in E1.31 Universe Discovery
/// Packets and shall not be included in E1.31 Data Packets or E1.31
/// Synchronization Packets.

View File

@ -32,10 +32,13 @@
#include <unordered_map>
#include <vector>
namespace SACN {
namespace sACN {
/**
* @brief The Receiver class
* @brief \cite sACN 3.6 Receiver: A receiver is the intended target of
* information from a source.
*
* A receiver may listen on multiple universes.
*/
class Receiver
: public virtual ACN::RLP::Component

View File

@ -25,8 +25,57 @@
#include <cstdint>
// E1.31 Lightweight streaming protocol for transport of DMX512 using ACN
namespace SACN {
/**
* @brief \cite sACN E1.31 Lightweight streaming protocol for transport of
* DMX512 \cite DMX using ACN \cite ACN.
*
* # 1 Introduction
*
* ## 1.1 Scope
*
* This standard describes a mechanism to transfer DMX512-A [DMX] packets over
* an IP network using a subset of the ACN protocol suite. It covers data
* format, data protocol, data addressing, and network management. It also
* outlines a synchronization method to help ensure that multiple receivers can
* process this data concurrently when supervised by the same source. Sources
* transporting either data or synchronization packets must also advertise, via
* the Universe Discovery mechanism, what universes they are actively
* transmitting on.
*
* ## 1.2 Overview and Architecture
*
* This standard can be used to transfer DMX512-A \cite DMX packets of all START
* Codes via an ANSI E1.17 \cite ACN supported network. It also defines a method
* by which this \cite DMX data may be synchronized across multiple receivers.
* A simple packet wrapper approach is used whereby the data is encapsulated in
* a wrapper following the ACN packet structure. For the use of this standard,
* the ACN wrapper is carried in UDP \cite udp packets.
*
* The wrapper is structured such that it is both compatible and meaningful to
* the ANSI E1.17 \cite ACN standard. Readers are referred to the ANSI E1.17
* \cite ACN standard, particularly the ACN Architecture \cite ACN and Device
* Management Protocol \cite DMP documents for more information. The Root
* Layer Protocol used in this standard is described in the ACN Architecture
* document.
*
* This standard uses multicast addressing to provide a mechanism to partition
* traffic for distinct universes of DMX512-A \cite DMX and synchronization
* data. Direct unicast of DMX512-A \cite DMX data is also supported.
*/
namespace sACN {
/// \cite sACN 3.1 Octet: An eight-bit byte within a data packet.
using octet = uint8_t;
/// \cite sACN 3.3 Universe Number: Each E1.31 Data Packet contains a universe
/// number identifying the universe it carries.
///
/// From an ACN perspective, a receiving device has some number of properties
/// whose value is addressed by the combination of a universe number and a data
/// slot number. From an historical perspective, a receiving device consumes
/// some number of DMX512-A \cite DMX data slots.
using universe_number = uint16_t;
/// \cite sACN
/// Appendix A: Defined Parameters (Normative)

View File

@ -23,7 +23,7 @@
*/
#include "source.h"
namespace SACN {
namespace sACN {
/**
* @brief Source::Source

View File

@ -29,10 +29,16 @@
#include <unordered_map>
namespace SACN {
namespace sACN {
/**
* @brief The Source class
* @brief \cite sACN 3.5 Source: A stream of E1.31 Packets for a universe is
* said to be sent from a source.
*
* A source is uniquely identified by a number in the header of the packet (see
* field CID in Table 4-1). A source may output multiple streams of data, each
* for a different universe. Also, multiple sources may output data for a given
* universe.
*/
class Source
: public virtual ACN::RLP::Component

View File

@ -24,7 +24,7 @@
#include "universe.h"
namespace SACN {
namespace sACN {
/**
* @brief Universe::Universe
@ -52,8 +52,8 @@ Universe::~Universe()
void Universe::set(ACN::PDU::Message<ACN::DMP::Pdu> dmp,
std::shared_ptr<Provenance> source)
{
/// \cite sACN
/// 7.3 Address Type and Data Type
/// \cite sACN 7.3 Address Type and Data Type
///
/// Sources shall set the DMP Layer's Address Type and Data Type to 0xa1.
/// Receivers shall discard the packet if the received value is not 0xa1.
if (!dmp->header())
@ -69,22 +69,22 @@ void Universe::set(ACN::PDU::Message<ACN::DMP::Pdu> dmp,
auto set_data = static_cast<ACN::DMP::address_pair_list*>(dmp->data());
const auto& [range, data] = set_data->properties.front();
/// \cite sACN
/// 7.4 First Property Address
/// \cite sACN 7.4 First Property Address
///
/// Sources shall set the DMP Layer's First Property Address to 0x0000.
/// Receivers shall discard the packet if the received value is not 0x0000.
if (range.address != 0)
return;
/// \cite sACN
/// 7.5 Address Increment
/// \cite sACN 7.5 Address Increment
///
/// Sources shall set the DMP Layer's Address Increment to 0x0001.
/// Receivers shall discard the packet if the received value is not 0x0001.
if (range.incriment != 1)
return;
/// \cite sACN
/// 7.6 Property Value Count
/// \cite sACN 7.6 Property Value Count
///
/// The DMP Layer's Property Value Count is used to encode the number of
/// DMX512-A [DMX] Slots (including the START Code slot).
if (range.count < 1 || range.count > 513)
@ -92,21 +92,21 @@ void Universe::set(ACN::PDU::Message<ACN::DMP::Pdu> dmp,
setProvenance(source);
/// \cite sACN 6.2.4.1 If a receiver is presented with an E1.31 Data Packet
/// containing a Synchronization Address of 0, it shall discard any data
/// waiting to be processed and immediately act on that Data Packet.
/// \cite sACN 6.2.6 E1.31 Data Packet: Options
/// Force_Synchronization: Bit 5
/// This bit indicates whether to lock or revert to an unsynchronized state
/// when synchronization is lost. When set to 0, components that had been
/// operating in a synchronized state shall not update with any new packets
/// until synchronization resumes. When set to 1, once synchronization has
/// been lost, components that had been operating in a synchronized state need
/// not wait for a new E1.31 Synchronization Packet in order to update to the
/// next E1.31 Data Packet.
if ((source->syncAddress() == 0) ||
(isSyncronized() && source->isForced() && rxRate() == 0))
if (/// \cite sACN 6.2.4.1 If a receiver is presented with an E1.31 Data
///
/// Packet containing a Synchronization Address of 0, it shall discard any
/// data waiting to be processed and immediately act on that Data Packet.
(source->sync_address == 0) ||
/// \cite sACN 6.2.6 E1.31 Data Packet: Options Force_Synchronization
///
/// This bit indicates whether to lock or revert to an unsynchronized
/// state when synchronization is lost. When set to 0, components that had
/// been operating in a synchronized state shall not update with any new
/// packets until synchronization resumes. When set to 1, once
/// synchronization has been lost, components that had been operating in a
/// synchronized state need not wait for a new E1.31 Synchronization
/// Packet in order to update to the next E1.31 Data Packet.
(isSyncronized() && source->options.force_synchronization && rxRate() == 0))
{
if (sync_data_)
{
@ -114,6 +114,7 @@ void Universe::set(ACN::PDU::Message<ACN::DMP::Pdu> dmp,
sync_data_ = nullptr;
}
/// \cite sACN 7.7 Property Values (DMX512-A Data)
///
/// The DMP Layer's Property values field is used to encode the
/// DMX512-A [DMX] START Code and data.
DMX::Universe::setData(data);

View File

@ -31,9 +31,13 @@
#include <memory>
#include <vector>
namespace SACN {
namespace sACN {
/**
* @brief The Universe class
* @brief \cite sACN 3.2 Universe
*
* A set of up to 512 data slots identified by universe number.
* Note: In E1.31 there may be multiple sources for a universe. See also: Slot.
*/
class Universe
: public DMX::Universe

View File

@ -82,7 +82,7 @@ class sACNdataTest
// Property values
}
SACN::Node node;
sACN::Node node;
uint8_t e131_data[638] = {0}; //!< Table 4-1: E1.31 Data Packet
};