additional documentation
This commit is contained in:
parent
d5bef37ddf
commit
f948932c90
|
@ -38,17 +38,40 @@ namespace ACN {
|
|||
*/
|
||||
class Component {
|
||||
public:
|
||||
/**
|
||||
* @brief Component
|
||||
* @param cid
|
||||
*/
|
||||
Component(UUID::uuid cid = UUID::uuid())
|
||||
: fctn_(std::string("OpenLCP ACN Component"))
|
||||
, uacn_(std::string())
|
||||
, cid_(cid)
|
||||
{};
|
||||
|
||||
/**
|
||||
* @brief cid
|
||||
* @return
|
||||
*/
|
||||
const UUID::uuid cid() const { return cid_; }
|
||||
/**
|
||||
* @brief fixedName fixed component name
|
||||
* @return
|
||||
*/
|
||||
const std::string fixedName() const { return fctn_; }
|
||||
/**
|
||||
* @brief userName user-asigned name
|
||||
* @return
|
||||
*/
|
||||
const std::string userName() const { return uacn_; }
|
||||
/**
|
||||
* @brief component name, either user asigned or fixed.
|
||||
* @return
|
||||
*/
|
||||
const std::string name() const { return uacn_.empty() ? fctn_ : uacn_; }
|
||||
|
||||
/**
|
||||
* @brief set the user asigned name
|
||||
* @param s
|
||||
*/
|
||||
void assignUserName(const std::string s) { uacn_ = s; }
|
||||
|
||||
protected:
|
||||
|
|
|
@ -39,11 +39,50 @@ pdu_stream::pdu_stream(uint8_t * p, std::streamsize l)
|
|||
setp(p, p + l);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief pdu_stream::available
|
||||
* @return
|
||||
*/
|
||||
uint32_t pdu_stream::available()
|
||||
{
|
||||
return in_avail();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief pdu_stream::data
|
||||
* @return
|
||||
*/
|
||||
uint8_t * pdu_stream::data()
|
||||
{
|
||||
return gptr();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief pdu_stream::size
|
||||
* @return
|
||||
*/
|
||||
uint32_t pdu_stream::size()
|
||||
{
|
||||
return pptr() - pbase();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief pdu_stream::base
|
||||
* @return
|
||||
*/
|
||||
uint8_t * pdu_stream::base()
|
||||
{
|
||||
return pbase();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief pdu_stream::readString
|
||||
* @param str std::string to which the read string will be appended.
|
||||
* @param length this many bytes will be read from the stream. If 0, all
|
||||
* @param fixed_length this many bytes will be read from the stream. If 0, all
|
||||
* available bytes on the stream will be used to construct the appended string.
|
||||
*/
|
||||
void pdu_stream::readString(std::string &str, const int fixed_length)
|
||||
|
|
|
@ -44,12 +44,12 @@ public:
|
|||
pdu_stream(uint8_t * p, std::streamsize l);
|
||||
|
||||
// input sequence
|
||||
uint32_t available() { return in_avail(); }
|
||||
uint8_t * data() { return gptr(); }
|
||||
uint32_t available();
|
||||
uint8_t * data();
|
||||
|
||||
// output sequence
|
||||
uint32_t size() { return pptr() - pbase(); }
|
||||
uint8_t * base() { return pbase(); }
|
||||
uint32_t size();
|
||||
uint8_t * base();
|
||||
|
||||
// stream objects
|
||||
pdu_stream& operator>> (pdu_stream_object& obj);
|
||||
|
@ -84,7 +84,12 @@ public:
|
|||
void writeString(const std::string& str, const int fixed_length = 0);
|
||||
|
||||
// reinterpreted i/o
|
||||
template<typename T> T readType()
|
||||
/**
|
||||
* @brief readType
|
||||
* @return T
|
||||
*/
|
||||
template<typename T>
|
||||
T readType()
|
||||
{
|
||||
if (in_avail() < sizeof(T))
|
||||
setstate(std::ios_base::failbit);
|
||||
|
@ -98,7 +103,12 @@ public:
|
|||
setstate(std::ios_base::eofbit);
|
||||
return ret;
|
||||
}
|
||||
template<typename T> void writeType (const T& val)
|
||||
/**
|
||||
* @brief writeType
|
||||
* @param val
|
||||
*/
|
||||
template<typename T>
|
||||
void writeType (const T& val)
|
||||
{
|
||||
auto data = reinterpret_cast<const uint8_t*>(&val);
|
||||
for (int i = sizeof(T); --i >= 0; )
|
||||
|
@ -116,8 +126,18 @@ using Stream = std::shared_ptr<pdu_stream>;
|
|||
struct pdu_stream_object
|
||||
{
|
||||
virtual ~pdu_stream_object() {};
|
||||
/**
|
||||
* @brief streamSize
|
||||
* @return length (count of octets) on the wire
|
||||
*/
|
||||
virtual size_t streamSize() const = 0;
|
||||
/**
|
||||
* @brief fill structure data from input stream
|
||||
*/
|
||||
virtual void iStream(Stream) = 0;
|
||||
/**
|
||||
* @brief write structure data to output stream
|
||||
*/
|
||||
virtual void oStream(Stream) const = 0;
|
||||
};
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ namespace PDU {
|
|||
|
||||
/**
|
||||
* @brief Pdu::Pdu
|
||||
* @param stream
|
||||
* @param vector_size
|
||||
*/
|
||||
Pdu::Pdu(size_t vector_size)
|
||||
|
@ -92,6 +91,26 @@ pdu_data * Pdu::data()
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pdu::parent
|
||||
* @return
|
||||
*/
|
||||
Message<Pdu> Pdu::parent()
|
||||
{
|
||||
return parent_;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pdu::stream
|
||||
* @return
|
||||
*/
|
||||
Stream Pdu::stream()
|
||||
{
|
||||
return stream_;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pdu::streamSize
|
||||
* @return
|
||||
|
@ -255,6 +274,57 @@ void Pdu::oStream(Stream stream) const
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pdu::setVector
|
||||
* @param v
|
||||
*/
|
||||
void Pdu::setVector (const uint32_t v)
|
||||
{
|
||||
vector_ = v; flags_.hasVector = true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pdu::setHeader
|
||||
* @param h
|
||||
*/
|
||||
void Pdu::setHeader (pdu_header * h)
|
||||
{
|
||||
header_ = h; flags_.hasHeader = true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pdu::setData
|
||||
* @param d
|
||||
*/
|
||||
void Pdu::setData (pdu_data * d)
|
||||
{
|
||||
data_ = d; flags_.hasData = true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pdu::setParent
|
||||
* @param pdu
|
||||
*/
|
||||
void Pdu::setParent (Message<Pdu> pdu)
|
||||
{
|
||||
parent_ = pdu;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pdu::setInherit
|
||||
* @param pdu
|
||||
*/
|
||||
void Pdu::setInherit(Message<Pdu> pdu)
|
||||
{
|
||||
inherit_ = pdu;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief pdu_flags::set
|
||||
* @param val
|
||||
|
|
|
@ -72,9 +72,16 @@ struct Block
|
|||
static_assert(std::is_base_of<Pdu, T>::value,
|
||||
"type parameter of ACN::PDU::Block must derive from ACN::PDU::Pdu");
|
||||
}
|
||||
/**
|
||||
* @brief member Messages of this block
|
||||
*/
|
||||
std::shared_ptr<std::vector<Message<T>>> pdu
|
||||
= std::shared_ptr<std::vector<Message<T>>>
|
||||
(new std::vector<Message<T>>);
|
||||
/**
|
||||
* @brief setParent
|
||||
* @param parent
|
||||
*/
|
||||
void setParent(Message<Pdu> parent) {
|
||||
for (auto p : *pdu)
|
||||
p->setParent(parent);
|
||||
|
@ -119,6 +126,9 @@ struct pdu_flags
|
|||
bool hasData : 1; //!< false if Pdu inherits it's data
|
||||
pdu_flags() { set(0); }
|
||||
void set(const uint8_t);
|
||||
/**
|
||||
* @brief operator uint8_t
|
||||
*/
|
||||
operator uint8_t() const {
|
||||
uint8_t ret = 0;
|
||||
if (hasLength) ret |= 0b10000000;
|
||||
|
@ -153,20 +163,23 @@ public:
|
|||
uint32_t vector(); // may inherit
|
||||
pdu_header * header(); // may inherit
|
||||
pdu_data * data(); // may inherit
|
||||
Message<Pdu> parent() {return parent_;}
|
||||
Stream stream() {return stream_;}
|
||||
Message<Pdu> parent();
|
||||
Stream stream();
|
||||
virtual size_t streamSize() const override;
|
||||
virtual void iStream(Stream) override;
|
||||
virtual void oStream(Stream) const override;
|
||||
|
||||
// setters
|
||||
void setVector (const uint32_t v) { vector_ = v; flags_.hasVector = true; }
|
||||
void setHeader (pdu_header * h) { header_ = h; flags_.hasHeader = true; }
|
||||
void setData (pdu_data * d) { data_ = d; flags_.hasData = true; }
|
||||
void setParent (Message<Pdu> pdu) { parent_ = pdu; }
|
||||
void setInherit(Message<Pdu> pdu) { inherit_ = pdu; }
|
||||
void setVector (const uint32_t v);
|
||||
void setHeader (pdu_header * h);
|
||||
void setData (pdu_data * d);
|
||||
void setParent (Message<Pdu> pdu);
|
||||
void setInherit(Message<Pdu> pdu);
|
||||
|
||||
// protocol payloads
|
||||
/**
|
||||
* @brief createHeader
|
||||
*/
|
||||
template<class T>
|
||||
void createHeader()
|
||||
{
|
||||
|
@ -177,6 +190,9 @@ public:
|
|||
header_->iStream(stream_);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @brief createData
|
||||
*/
|
||||
template<class T>
|
||||
void createData()
|
||||
{
|
||||
|
@ -187,6 +203,9 @@ public:
|
|||
data_->iStream(stream_);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @brief createDataBlock
|
||||
*/
|
||||
template<class T>
|
||||
void createDataBlock() {
|
||||
auto block = new Block<T>();
|
||||
|
@ -197,14 +216,14 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
pdu_flags flags_;
|
||||
uint32_t vector_ = 0;
|
||||
size_t vector_size_;
|
||||
Message<Pdu> parent_;
|
||||
Message<Pdu> inherit_;
|
||||
pdu_header * header_ = nullptr;
|
||||
pdu_data * data_ = nullptr;
|
||||
Stream stream_;
|
||||
pdu_flags flags_; //!< flags for length, vector, header and data
|
||||
uint32_t vector_ = 0; //!< vector of this PDU
|
||||
size_t vector_size_; //!< width (numbe of octets) of the vector
|
||||
Message<Pdu> parent_; //!< parent PDU
|
||||
Message<Pdu> inherit_; //!< PDU from which to inherit
|
||||
pdu_header * header_ = nullptr; //!< header segment
|
||||
pdu_data * data_ = nullptr; //!< data segment
|
||||
Stream stream_; //!< buffer
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ namespace ACN::DMP {
|
|||
|
||||
/**
|
||||
* @brief Controller::Controller
|
||||
* @param cid
|
||||
*/
|
||||
Controller::Controller(UUID::uuid cid)
|
||||
: SDT::Leader(cid)
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
|
||||
namespace ACN::DMP {
|
||||
|
||||
/**
|
||||
* @brief The ACN::DMP::Device class
|
||||
*/
|
||||
class Device
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -124,7 +124,8 @@ size_t address_pair_list::streamSize() const
|
|||
|
||||
|
||||
/**
|
||||
* @brief range_data::iStream
|
||||
* @brief address_pair_list::iStream
|
||||
* @param stream
|
||||
*/
|
||||
void address_pair_list::iStream(PDU::Stream stream)
|
||||
{
|
||||
|
@ -156,7 +157,8 @@ void address_pair_list::iStream(PDU::Stream stream)
|
|||
|
||||
|
||||
/**
|
||||
* @brief range_data::oStream
|
||||
* @brief address_pair_list::oStream
|
||||
* @param stream
|
||||
*/
|
||||
void address_pair_list::oStream(PDU::Stream stream) const
|
||||
{
|
||||
|
@ -184,6 +186,7 @@ size_t address_list::streamSize() const
|
|||
|
||||
/**
|
||||
* @brief address_list::iStream
|
||||
* @param stream
|
||||
*/
|
||||
void address_list::iStream(PDU::Stream stream)
|
||||
{
|
||||
|
@ -203,6 +206,7 @@ void address_list::iStream(PDU::Stream stream)
|
|||
|
||||
/**
|
||||
* @brief address_list::oStream
|
||||
* @param stream
|
||||
*/
|
||||
void address_list::oStream(PDU::Stream stream) const
|
||||
{
|
||||
|
|
|
@ -99,13 +99,18 @@ struct address_type
|
|||
struct range
|
||||
: PDU::pdu_stream_object
|
||||
{
|
||||
/**
|
||||
* @brief range
|
||||
* @param t
|
||||
* @param l
|
||||
*/
|
||||
range(const data_type t, const address_length l)
|
||||
: type_(t)
|
||||
, length_(l)
|
||||
{};
|
||||
uint32_t address = 0;
|
||||
uint32_t incriment = 0;
|
||||
uint32_t count = 0;
|
||||
uint32_t address = 0; //!< start address
|
||||
uint32_t incriment = 0; //!< property size (number of octets)
|
||||
uint32_t count = 0; //!< number of properties
|
||||
|
||||
size_t streamSize() const override;
|
||||
void iStream(PDU::Stream) override;
|
||||
|
@ -131,8 +136,12 @@ typedef std::pair<range, std::vector<uint8_t>> address_data_pair;
|
|||
struct address_pair_list
|
||||
: PDU::pdu_data
|
||||
{
|
||||
/**
|
||||
* @brief address_pair_list
|
||||
* @param t
|
||||
*/
|
||||
address_pair_list(const address_type* t) : type_(t) {};
|
||||
std::vector<address_data_pair> properties;
|
||||
std::vector<address_data_pair> properties; //!< list of address/data pairs
|
||||
|
||||
size_t streamSize() const override;
|
||||
void iStream(PDU::Stream) override;
|
||||
|
@ -149,8 +158,12 @@ private:
|
|||
struct address_list
|
||||
: PDU::pdu_data
|
||||
{
|
||||
/**
|
||||
* @brief address_list
|
||||
* @param t
|
||||
*/
|
||||
address_list(const address_type* t) : type_(t) {};
|
||||
std::vector<range> addresses;
|
||||
std::vector<range> addresses; //!< list of addresses
|
||||
|
||||
size_t streamSize() const override;
|
||||
void iStream(PDU::Stream) override;
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
|
||||
namespace ACN::DMP {
|
||||
|
||||
/**
|
||||
* @brief The ACN::DMP::Event class
|
||||
*/
|
||||
class Event
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
|
||||
namespace ACN::DMP {
|
||||
|
||||
/**
|
||||
* @brief The ACN::DMP::Property class
|
||||
*/
|
||||
class Property
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -57,10 +57,50 @@ uint16_t Device::footprint() const
|
|||
return personalities_.at(personality_ - 1)->footprint();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Device::personality
|
||||
* @return
|
||||
*/
|
||||
uint8_t Device::personality() const
|
||||
{
|
||||
return personality_;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Device::personalityCount
|
||||
* @return
|
||||
*/
|
||||
uint8_t Device::personalityCount() const
|
||||
{
|
||||
return personalities_.size();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Device::address
|
||||
* @return
|
||||
*/
|
||||
uint16_t Device::address() const
|
||||
{
|
||||
return startAddress_;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Device::setPersonality
|
||||
* @param mode
|
||||
*/
|
||||
void Device::setPersonality(uint8_t mode)
|
||||
{
|
||||
personality_ = mode;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Device::setAddress
|
||||
* @param start
|
||||
* @return
|
||||
*/
|
||||
bool Device::setAddress(uint16_t start)
|
||||
{
|
||||
|
|
|
@ -39,18 +39,18 @@ public:
|
|||
Device();
|
||||
virtual ~Device();
|
||||
|
||||
uint16_t footprint() const;
|
||||
uint8_t personality() const { return personality_; }
|
||||
uint8_t personalityCount() const { return personalities_.size(); }
|
||||
uint16_t address() const { return startAddress_; }
|
||||
uint16_t footprint() const;
|
||||
uint8_t personality() const;
|
||||
uint8_t personalityCount() const;
|
||||
uint16_t address() const;
|
||||
|
||||
virtual void setPersonality(uint8_t mode) { personality_ = mode; }
|
||||
virtual void setPersonality(uint8_t mode);
|
||||
virtual bool setAddress(uint16_t start);
|
||||
|
||||
protected:
|
||||
std::vector<Personality*> personalities_;
|
||||
uint8_t personality_;
|
||||
uint16_t startAddress_;
|
||||
std::vector<Personality*> personalities_; //!< available personalities
|
||||
uint8_t personality_; //!< index of current personality
|
||||
uint16_t startAddress_; //!< DMX start address
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,37 @@
|
|||
/*
|
||||
dmx/patch.cpp
|
||||
|
||||
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "patch.h"
|
||||
|
||||
namespace DMX {
|
||||
|
||||
/**
|
||||
* @brief Patch::Patch
|
||||
*/
|
||||
Patch::Patch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
} // namespace DMX
|
||||
|
|
|
@ -1,11 +1,37 @@
|
|||
#ifndef PATCH_H
|
||||
#define PATCH_H
|
||||
/*
|
||||
dmx/patch.h
|
||||
|
||||
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
namespace DMX {
|
||||
|
||||
/**
|
||||
* @brief The DMX::Patch class
|
||||
*/
|
||||
class Patch
|
||||
{
|
||||
public:
|
||||
Patch();
|
||||
};
|
||||
|
||||
#endif // PATCH_H
|
||||
} // namespace DMX
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace DMX {
|
|||
* @brief Personality::Personality
|
||||
*/
|
||||
Personality::Personality()
|
||||
: description("Null")
|
||||
: description_("Null")
|
||||
, footprint_(0)
|
||||
{
|
||||
}
|
||||
|
@ -43,4 +43,24 @@ Personality::~Personality()
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Personality::footprint
|
||||
* @return
|
||||
*/
|
||||
uint16_t Personality::footprint() const
|
||||
{
|
||||
return footprint_;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Personality::description
|
||||
* @return
|
||||
*/
|
||||
std::string Personality::description() const
|
||||
{
|
||||
return description_;
|
||||
}
|
||||
|
||||
} // namespace DMX
|
||||
|
|
|
@ -37,12 +37,12 @@ public:
|
|||
Personality();
|
||||
virtual ~Personality();
|
||||
|
||||
uint16_t footprint() const { return footprint_; }
|
||||
|
||||
std::string description;
|
||||
uint16_t footprint() const;
|
||||
std::string description() const;
|
||||
|
||||
protected:
|
||||
uint16_t footprint_;
|
||||
std::string description_; //!< text description
|
||||
uint16_t footprint_; //!< DMX footprint size
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ namespace DMX {
|
|||
|
||||
/**
|
||||
* @brief Universe::Universe
|
||||
* @param timeout_period
|
||||
*/
|
||||
Universe::Universe(int timeout_period)
|
||||
: rx_timeout_period_(timeout_period)
|
||||
|
@ -45,11 +46,19 @@ Universe::~Universe()
|
|||
|
||||
|
||||
/**
|
||||
Get value of a slot.
|
||||
* @brief Universe::data
|
||||
* @return
|
||||
*/
|
||||
const DimmerData * Universe::data() const
|
||||
{
|
||||
return &null_start_data_;
|
||||
}
|
||||
|
||||
@param uint16_t address of the requested slot.
|
||||
@return const uint8_t value of the slot.
|
||||
*/
|
||||
/**
|
||||
* @brief Universe::slot
|
||||
* @param address
|
||||
* @return
|
||||
*/
|
||||
uint8_t Universe::slot(const uint16_t address)
|
||||
{
|
||||
if (address == 0)
|
||||
|
@ -98,11 +107,10 @@ void Universe::setData(std::vector<uint8_t> vect) {
|
|||
|
||||
|
||||
/**
|
||||
set value of a specific slot
|
||||
|
||||
@param uint16_t address of the slot being changed
|
||||
@param uint8_t value being set
|
||||
*/
|
||||
* @brief Universe::setValue
|
||||
* @param address
|
||||
* @param value
|
||||
*/
|
||||
void Universe::setValue(const uint16_t address, const uint8_t value)
|
||||
{
|
||||
if (address == 0)
|
||||
|
@ -114,12 +122,11 @@ void Universe::setValue(const uint16_t address, const uint8_t value)
|
|||
|
||||
|
||||
/**
|
||||
set value of a block of slots
|
||||
|
||||
@param uint16_t address of the slot being changed
|
||||
@param uint16_t footprint of profile
|
||||
@param uint8_t* values being set
|
||||
*/
|
||||
* @brief Universe::setValue
|
||||
* @param start
|
||||
* @param footprint
|
||||
* @param profile
|
||||
*/
|
||||
void Universe::setValue(const uint16_t start, const uint16_t footprint,
|
||||
const uint8_t* profile)
|
||||
{
|
||||
|
@ -133,10 +140,9 @@ void Universe::setValue(const uint16_t start, const uint16_t footprint,
|
|||
|
||||
|
||||
/**
|
||||
register a data consumer callback function
|
||||
|
||||
@param const DataHandlerFunction something that knows what to do with DMX
|
||||
*/
|
||||
* @brief Universe::onData
|
||||
* @param callback
|
||||
*/
|
||||
void Universe::onData(const DataHandler callback)
|
||||
{
|
||||
callbacks_.push_back(callback);
|
||||
|
|
|
@ -49,7 +49,7 @@ class Universe {
|
|||
Universe (int timeout_period = E111_DATA_LOSS_TIMEOUT);
|
||||
virtual ~Universe ();
|
||||
|
||||
virtual const DimmerData * data() const { return &null_start_data_; }
|
||||
virtual const DimmerData * data() const;
|
||||
virtual uint8_t slot (const uint16_t);
|
||||
virtual double rxRate();
|
||||
|
||||
|
@ -60,7 +60,7 @@ class Universe {
|
|||
void onData (const DataHandler);
|
||||
|
||||
protected:
|
||||
std::vector<DataHandler> callbacks_;
|
||||
std::vector<DataHandler> callbacks_; //!< list of calback functions
|
||||
|
||||
private:
|
||||
DimmerData null_start_data_;
|
||||
|
|
|
@ -50,10 +50,13 @@ public:
|
|||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief The ept_header struct
|
||||
*/
|
||||
struct ept_header
|
||||
: ACN::PDU::pdu_header
|
||||
{
|
||||
UUID::uuid destination_cid;
|
||||
UUID::uuid destination_cid; //!< CID of the destination component
|
||||
|
||||
size_t streamSize() const override { return UUID_LENGTH; }
|
||||
void iStream(ACN::PDU::Stream s) override { *s >> destination_cid; }
|
||||
|
@ -74,10 +77,15 @@ public:
|
|||
void iStream(ACN::PDU::Stream) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief The data_data struct
|
||||
*/
|
||||
struct data_data
|
||||
: ACN::PDU::pdu_data
|
||||
{
|
||||
std::vector<uint8_t> data;
|
||||
std::vector<uint8_t> data; //!< unprocessed data array
|
||||
|
||||
size_t streamSize() const override { return data.size(); }
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
void oStream(ACN::PDU::Stream) const override;
|
||||
|
|
|
@ -28,8 +28,9 @@
|
|||
namespace RDMnet::LLRP {
|
||||
|
||||
/**
|
||||
* @brief llrp_data::iStream
|
||||
*/
|
||||
* @brief llrp_data::iStream
|
||||
* @param stream
|
||||
*/
|
||||
void llrp_data::iStream(ACN::PDU::Stream stream)
|
||||
{
|
||||
/// Destination CID - The Destination CID indicates the CID of the intended
|
||||
|
@ -170,6 +171,7 @@ namespace ProbeReply {
|
|||
|
||||
/**
|
||||
* @brief reply_data::iStream
|
||||
* @param stream
|
||||
*/
|
||||
void reply_data::iStream(ACN::PDU::Stream stream)
|
||||
{
|
||||
|
@ -183,6 +185,7 @@ void reply_data::iStream(ACN::PDU::Stream stream)
|
|||
|
||||
/**
|
||||
* @brief reply_data::oStream
|
||||
* @param stream
|
||||
*/
|
||||
void reply_data::oStream(ACN::PDU::Stream stream) const
|
||||
{
|
||||
|
@ -191,6 +194,7 @@ void reply_data::oStream(ACN::PDU::Stream stream) const
|
|||
*stream << type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief LLRP::ProbeReply::Pdu::Pdu
|
||||
*/
|
||||
|
|
|
@ -42,7 +42,9 @@ namespace RDMnet::LLRP {
|
|||
*/
|
||||
|
||||
|
||||
/// 5.4 Packet Structure
|
||||
/**
|
||||
* @brief 5.4 Packet Structure
|
||||
*/
|
||||
struct llrp_data
|
||||
: public ACN::PDU::pdu_data
|
||||
{
|
||||
|
@ -77,11 +79,11 @@ namespace ProbeRequest {
|
|||
struct filter_t {
|
||||
union {
|
||||
uint16_t value = 0;
|
||||
struct __attribute__((packed)) {
|
||||
bool client_tcp_inactive : 1;
|
||||
bool brokers_only : 1;
|
||||
uint16_t reserved : 14;
|
||||
};
|
||||
struct {
|
||||
bool client_tcp_inactive : 1; //!< filter inactive clients
|
||||
bool brokers_only : 1; //!< only brokers
|
||||
uint16_t reserved : 14; //!< reserved bits
|
||||
} __attribute__((packed));
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -93,10 +95,10 @@ struct filter_t {
|
|||
struct request_data
|
||||
: public ACN::PDU::pdu_data
|
||||
{
|
||||
RDM::UID lower;
|
||||
RDM::UID upper;
|
||||
filter_t filter;
|
||||
std::vector<RDM::UID> known;
|
||||
RDM::UID lower; //!< UID of upper bound
|
||||
RDM::UID upper; //!< UID of lower bound
|
||||
filter_t filter; //!< device vilters
|
||||
std::vector<RDM::UID> known; //!< known UIDs
|
||||
|
||||
size_t streamSize() const override { return 14 + (6 * known.size()); }
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
|
@ -119,12 +121,16 @@ public:
|
|||
|
||||
namespace ProbeReply {
|
||||
|
||||
/**
|
||||
* @brief The reply_data struct
|
||||
*/
|
||||
struct reply_data
|
||||
: public ACN::PDU::pdu_data
|
||||
{
|
||||
RDM::UID id;
|
||||
uint8_t address[6];
|
||||
uint8_t type;
|
||||
RDM::UID id; //!< device UID
|
||||
uint8_t address[6]; //!< device address
|
||||
uint8_t type; //!< address type
|
||||
|
||||
size_t streamSize() const override { return 13; }
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
void oStream(ACN::PDU::Stream) const override;
|
||||
|
|
|
@ -29,6 +29,7 @@ namespace RDMnet::LLRP {
|
|||
|
||||
/**
|
||||
* @brief Manager::Manager
|
||||
* @param cid
|
||||
*/
|
||||
Manager::Manager(UUID::uuid cid)
|
||||
: ACN::RLP::Component(cid)
|
||||
|
@ -49,4 +50,22 @@ void Manager::rlpLlrpReceiver(ACN::PDU::Message<ACN::RLP::Pdu> root)
|
|||
(void)root;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief sendProbeRequest
|
||||
*/
|
||||
void Manager::sendProbeRequest()
|
||||
{
|
||||
return;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief receiveProbeReply
|
||||
*/
|
||||
void Manager::receiveProbeReply()
|
||||
{
|
||||
return;
|
||||
};
|
||||
|
||||
} // namespace RDMnet::LLRP
|
||||
|
|
|
@ -42,8 +42,8 @@ public:
|
|||
|
||||
void rlpLlrpReceiver(ACN::PDU::Message<ACN::RLP::Pdu>);
|
||||
|
||||
virtual void sendProbeRequest() {};
|
||||
virtual void receiveProbeReply() {};
|
||||
virtual void sendProbeRequest();
|
||||
virtual void receiveProbeReply();
|
||||
};
|
||||
|
||||
} // namespace RDMnet::LLRP
|
||||
|
|
|
@ -63,16 +63,27 @@ void Target::receiveProbeRequest(ACN::PDU::Message<ProbeRequest::Pdu>)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Target::sendProbeReply
|
||||
*/
|
||||
void Target::sendProbeReply()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Target::receiveRdmCommand
|
||||
* @param pdu
|
||||
*/
|
||||
void Target::receiveRdmCommand(ACN::PDU::Message<RPT::COMMAND::Pdu> pdu)
|
||||
{
|
||||
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));
|
||||
(void)pdu;
|
||||
// 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));
|
||||
//
|
||||
}
|
||||
|
||||
} // namespace RDMnet::LLRP
|
||||
|
|
|
@ -44,9 +44,8 @@ public:
|
|||
void receiveLLRP(ACN::PDU::Message<LLRP::Pdu> frame);
|
||||
|
||||
virtual void receiveProbeRequest(ACN::PDU::Message<LLRP::ProbeRequest::Pdu> pdu);
|
||||
virtual void sendProbeReply() {};
|
||||
virtual void sendProbeReply();
|
||||
virtual void receiveRdmCommand(ACN::PDU::Message<RPT::COMMAND::Pdu> pdu);
|
||||
virtual void receiveRDM(const RDM::MsgPtr) = 0;
|
||||
};
|
||||
|
||||
} // namespace RDMnet::LLRP
|
||||
|
|
|
@ -46,8 +46,8 @@ public:
|
|||
struct module_identifier
|
||||
: PDU::pdu_stream_object
|
||||
{
|
||||
uint16_t manufacturer;
|
||||
uint16_t number;
|
||||
uint16_t manufacturer; //!< ESTA manufactuer ID
|
||||
uint16_t number; //!< manufacturer's model number
|
||||
|
||||
size_t streamSize() const override { return 4; }
|
||||
void iStream(PDU::Stream) override;
|
||||
|
@ -61,8 +61,8 @@ struct module_identifier
|
|||
struct module_data
|
||||
: PDU::pdu_data
|
||||
{
|
||||
uint32_t reserved;
|
||||
std::vector<module_identifier> modules;
|
||||
uint32_t reserved; //!< reserved
|
||||
std::vector<module_identifier> modules; //!< list of module IDs
|
||||
|
||||
size_t streamSize() const override { return 4 + (4 * modules.size()); }
|
||||
void iStream(PDU::Stream) override;
|
||||
|
@ -91,10 +91,10 @@ public:
|
|||
struct point_description
|
||||
: PDU::pdu_stream_object
|
||||
{
|
||||
uint8_t system;
|
||||
uint16_t group;
|
||||
uint32_t point;
|
||||
std::string name;
|
||||
uint8_t system; //!< system number
|
||||
uint16_t group; //!< group number
|
||||
uint32_t point; //!< point number
|
||||
std::string name; //!< point name
|
||||
|
||||
size_t streamSize() const override { return 39; }
|
||||
void iStream(PDU::Stream) override;
|
||||
|
@ -115,8 +115,8 @@ struct name_data
|
|||
bool response : 1;
|
||||
};
|
||||
};
|
||||
uint32_t reserved;
|
||||
std::vector<point_description> points;
|
||||
uint32_t reserved; //!< reserved
|
||||
std::vector<point_description> points; //!< list of point descriptions
|
||||
|
||||
size_t streamSize() const override { return 5 + (39 * points.size()); }
|
||||
void iStream(PDU::Stream) override;
|
||||
|
@ -152,8 +152,8 @@ struct system_data
|
|||
bool response : 1;
|
||||
};
|
||||
};
|
||||
uint32_t reserved;
|
||||
std::vector<uint8_t> systems;
|
||||
uint32_t reserved; //!< reserved
|
||||
std::vector<uint8_t> systems; //!< list of system numbers
|
||||
|
||||
size_t streamSize() const override { return 5 + systems.size(); }
|
||||
void iStream(PDU::Stream) override;
|
||||
|
@ -180,8 +180,8 @@ public:
|
|||
struct advertisement_data
|
||||
: PDU::pdu_data
|
||||
{
|
||||
uint32_t reserved;
|
||||
PDU::Pdu payload;
|
||||
uint32_t reserved; //!< reserved
|
||||
PDU::Pdu payload; //!< Pdu
|
||||
|
||||
size_t streamSize() const override { return 4 + payload->streamSize(); }
|
||||
void iStream(PDU::Stream) override;
|
||||
|
|
|
@ -33,16 +33,16 @@ namespace OTP::Layer {
|
|||
struct base_data
|
||||
: PDU::pdu_data
|
||||
{
|
||||
uint8_t footer_options;
|
||||
uint8_t footer_length;
|
||||
UUID::uuid cid;
|
||||
uint32_t folio_number;
|
||||
uint16_t page;
|
||||
uint16_t last_page;
|
||||
uint8_t options;
|
||||
uint32_t reserved;
|
||||
std::string name;
|
||||
PDU::Pdu payload;
|
||||
uint8_t footer_options; //!< footer options
|
||||
uint8_t footer_length; //!< footer length
|
||||
UUID::uuid cid; //!< component UUID
|
||||
uint32_t folio_number; //!< folio number
|
||||
uint16_t page; //!< current number
|
||||
uint16_t last_page; //!< last page
|
||||
uint8_t options; //!< options
|
||||
uint32_t reserved; //!< reserved
|
||||
std::string name; //!< name
|
||||
PDU::Pdu payload; //!< next PDU
|
||||
|
||||
size_t streamSize() const override;
|
||||
void iStream(PDU::Stream) override;
|
||||
|
@ -56,9 +56,9 @@ struct base_data
|
|||
struct base_footer
|
||||
: PDU::pdu_stream_object
|
||||
{
|
||||
uint8_t options;
|
||||
uint8_t length;
|
||||
std::vector<uint8_t> data;
|
||||
uint8_t options; //!< options
|
||||
uint8_t length; //!< length
|
||||
std::vector<uint8_t> data; //!< binary data
|
||||
|
||||
size_t streamSize() const override { return data.size(); }
|
||||
void iStream(PDU::Stream) override;
|
||||
|
@ -73,7 +73,7 @@ class pdu
|
|||
: public OTP::PDU::pdu
|
||||
{
|
||||
public:
|
||||
base_footer footer;
|
||||
base_footer footer; //!< footer
|
||||
|
||||
size_t streamSize() const override;
|
||||
void iStream(PDU::Stream) override;
|
||||
|
|
|
@ -43,6 +43,16 @@ pdu::~pdu()
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief pdu::stream
|
||||
* @return
|
||||
*/
|
||||
Stream pdu::stream()
|
||||
{
|
||||
return stream_;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief pdu::streamSize
|
||||
* @return
|
||||
|
|
|
@ -43,6 +43,9 @@ class pdu;
|
|||
using Pdu = std::shared_ptr<pdu>;
|
||||
|
||||
|
||||
/**
|
||||
* @brief The PDU::Block struct
|
||||
*/
|
||||
template<class T>
|
||||
struct Block
|
||||
: public pdu_data
|
||||
|
@ -51,19 +54,34 @@ struct Block
|
|||
static_assert(std::is_base_of<OTP::PDU::pdu, T>::value,
|
||||
"type parameter of ACN::PDU::Block must derive from OTP::PDU::Pdu");
|
||||
}
|
||||
/**
|
||||
* @brief Messages contained in the block
|
||||
*/
|
||||
std::shared_ptr<std::vector<std::shared_ptr<T>>> members
|
||||
= std::shared_ptr<std::vector<std::shared_ptr<T>>>
|
||||
(new std::vector<std::shared_ptr<T>>);
|
||||
/**
|
||||
* @brief setParent
|
||||
* @param parent
|
||||
*/
|
||||
void setParent(Pdu parent) {
|
||||
for (auto &p : *members)
|
||||
p->parent = parent;
|
||||
}
|
||||
/**
|
||||
* @brief streamSize
|
||||
* @return
|
||||
*/
|
||||
size_t streamSize() const override {
|
||||
size_t s = 0;
|
||||
for (auto &p : *members)
|
||||
s += p->streamSize();
|
||||
return s;
|
||||
}
|
||||
/**
|
||||
* @brief iStream
|
||||
* @param s
|
||||
*/
|
||||
void iStream(Stream s) override {
|
||||
while(s->good()) {
|
||||
std::shared_ptr<T> p(new T());
|
||||
|
@ -75,6 +93,10 @@ struct Block
|
|||
members->push_back(p); // add to block
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @brief oStream
|
||||
* @param s
|
||||
*/
|
||||
void oStream(Stream s) const override {
|
||||
for ( const auto& p : *members )
|
||||
p->oStream(s);
|
||||
|
@ -93,15 +115,18 @@ public:
|
|||
pdu();
|
||||
~pdu();
|
||||
|
||||
pdu_data* data = nullptr;
|
||||
uint16_t vector = 0;
|
||||
Pdu parent;
|
||||
pdu_data* data = nullptr; //!< data Message
|
||||
uint16_t vector = 0; //!< vector
|
||||
Pdu parent; //!< parent Message
|
||||
|
||||
Stream stream() { return stream_; }
|
||||
Stream stream();
|
||||
virtual size_t streamSize() const override;
|
||||
virtual void iStream(Stream) override;
|
||||
virtual void oStream(Stream) const override;
|
||||
|
||||
/**
|
||||
* @brief createData
|
||||
*/
|
||||
template<class T>
|
||||
void createData()
|
||||
{
|
||||
|
@ -111,7 +136,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
Stream stream_;
|
||||
Stream stream_; //!< buffer
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -235,6 +235,26 @@ void scale_module::oStream(PDU::Stream stream) const
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief reference_frame_module::iStream
|
||||
* @param s
|
||||
*/
|
||||
void reference_frame_module::iStream(PDU::Stream s)
|
||||
{
|
||||
*s >> point;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief reference_frame_module::oStream
|
||||
* @param s
|
||||
*/
|
||||
void reference_frame_module::oStream(PDU::Stream s) const
|
||||
{
|
||||
*s << point;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief module_data::~module_data
|
||||
*/
|
||||
|
|
|
@ -34,12 +34,15 @@ using Timestamp = std::chrono::time_point<std::chrono::system_clock>;
|
|||
|
||||
namespace Point {
|
||||
|
||||
/**
|
||||
* @brief The address struct
|
||||
*/
|
||||
struct address
|
||||
: PDU::pdu_stream_object
|
||||
{
|
||||
uint8_t system;
|
||||
uint16_t group;
|
||||
uint32_t point;
|
||||
uint8_t system; //!< system referance number
|
||||
uint16_t group; //!< group referance number
|
||||
uint32_t point; //!< point referance number
|
||||
|
||||
size_t streamSize() const override { return 7; }
|
||||
void iStream(PDU::Stream) override;
|
||||
|
@ -54,8 +57,8 @@ namespace Module {
|
|||
*/
|
||||
struct module_id
|
||||
{
|
||||
uint16_t manufacturer;
|
||||
uint16_t number;
|
||||
uint16_t manufacturer; //!< ESTA manufacturer ID
|
||||
uint16_t number; //!< manurfactuer assigned model number
|
||||
};
|
||||
|
||||
/// Table 16-1: Standard Module Types
|
||||
|
@ -94,9 +97,9 @@ struct position_module
|
|||
bool scaling : 1;
|
||||
};
|
||||
};
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
int32_t z;
|
||||
int32_t x; //!< x-axis position
|
||||
int32_t y; //!< y-axis position
|
||||
int32_t z; //!< z-axis position
|
||||
|
||||
size_t streamSize() const override { return 13; }
|
||||
void iStream(PDU::Stream) override;
|
||||
|
@ -110,12 +113,12 @@ struct position_module
|
|||
struct position_va_module
|
||||
: module
|
||||
{
|
||||
int32_t Vx;
|
||||
int32_t Vy;
|
||||
int32_t Vz;
|
||||
int32_t Ax;
|
||||
int32_t Ay;
|
||||
int32_t Az;
|
||||
int32_t Vx; //!< x-axis velocity
|
||||
int32_t Vy; //!< y-axis velocity
|
||||
int32_t Vz; //!< z-axis velocity
|
||||
int32_t Ax; //!< x-axis acceleration
|
||||
int32_t Ay; //!< y-axis acceleration
|
||||
int32_t Az; //!< z-axis acceleration
|
||||
|
||||
size_t streamSize() const override { return 24; }
|
||||
void iStream(PDU::Stream) override;
|
||||
|
@ -129,9 +132,9 @@ struct position_va_module
|
|||
struct rotation_module
|
||||
: module
|
||||
{
|
||||
int32_t Rx;
|
||||
int32_t Ry;
|
||||
int32_t Rz;
|
||||
int32_t Rx; //!< x-axis rotation
|
||||
int32_t Ry; //!< y-axis rotation
|
||||
int32_t Rz; //!< z-axis rotation
|
||||
|
||||
size_t streamSize() const override { return 12; }
|
||||
void iStream(PDU::Stream) override;
|
||||
|
@ -145,12 +148,12 @@ struct rotation_module
|
|||
struct rotation_va_module
|
||||
: module
|
||||
{
|
||||
int32_t Vrx;
|
||||
int32_t Vry;
|
||||
int32_t Vrz;
|
||||
int32_t Arx;
|
||||
int32_t Ary;
|
||||
int32_t Arz;
|
||||
int32_t Vrx; //!< x-axis rotational velocity
|
||||
int32_t Vry; //!< y-axis rotational velocity
|
||||
int32_t Vrz; //!< z-axis rotational velocity
|
||||
int32_t Arx; //!< x-axis rotational acceleration
|
||||
int32_t Ary; //!< y-axis rotational acceleration
|
||||
int32_t Arz; //!< z-axis rotational acceleration
|
||||
|
||||
size_t streamSize() const override { return 24; }
|
||||
void iStream(PDU::Stream) override;
|
||||
|
@ -164,9 +167,9 @@ struct rotation_va_module
|
|||
struct scale_module
|
||||
: module
|
||||
{
|
||||
int32_t scale_x;
|
||||
int32_t scale_y;
|
||||
int32_t scale_z;
|
||||
int32_t scale_x; //!< x-axis scale
|
||||
int32_t scale_y; //!< y-axis scale
|
||||
int32_t scale_z; //!< z-axis scale
|
||||
|
||||
size_t streamSize() const override { return 12; }
|
||||
void iStream(PDU::Stream) override;
|
||||
|
@ -180,21 +183,24 @@ struct scale_module
|
|||
struct reference_frame_module
|
||||
: module
|
||||
{
|
||||
address point;
|
||||
address point; //!< referance point
|
||||
|
||||
size_t streamSize() const override { return point.streamSize(); }
|
||||
void iStream(PDU::Stream s) override { *s >> point; }
|
||||
void oStream(PDU::Stream s) const override { *s << point; }
|
||||
void iStream(PDU::Stream s) override;
|
||||
void oStream(PDU::Stream s) const override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief The module_data struct
|
||||
*/
|
||||
struct module_data
|
||||
: OTP::PDU::pdu_data
|
||||
{
|
||||
~module_data();
|
||||
|
||||
uint16_t number;
|
||||
module * mod = nullptr;
|
||||
uint16_t number; //!< module number
|
||||
module * mod = nullptr; //!< module object
|
||||
|
||||
size_t streamSize() const override;
|
||||
void iStream(PDU::Stream) override;
|
||||
|
@ -216,21 +222,24 @@ public:
|
|||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief The point_data struct
|
||||
*/
|
||||
struct point_data
|
||||
: OTP::PDU::pdu_data
|
||||
{
|
||||
uint8_t priority = 100;
|
||||
uint16_t group;
|
||||
uint32_t point;
|
||||
Timestamp timestamp;
|
||||
uint8_t priority = 100; //!< priority, between 0 and 200
|
||||
uint16_t group; //!< group number
|
||||
uint32_t point; //!< point number
|
||||
Timestamp timestamp; //!< timestamp
|
||||
union {
|
||||
uint8_t options;
|
||||
struct {
|
||||
uint8_t f_reserved : 8;
|
||||
};
|
||||
};
|
||||
uint32_t reserved;
|
||||
PDU::Block<Module::pdu> modules;
|
||||
uint32_t reserved; //!< reserved
|
||||
PDU::Block<Module::pdu> modules; //!< block of module PDU
|
||||
|
||||
size_t streamSize() const override;
|
||||
void iStream(PDU::Stream) override;
|
||||
|
@ -251,11 +260,15 @@ public:
|
|||
void iStream(PDU::Stream) override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief The transform_data struct
|
||||
*/
|
||||
struct transform_data
|
||||
: OTP::PDU::pdu_data
|
||||
{
|
||||
uint8_t system;
|
||||
Timestamp timestamp;
|
||||
uint8_t system; //!< system number
|
||||
Timestamp timestamp; //!< timestamp
|
||||
union {
|
||||
uint8_t options;
|
||||
struct {
|
||||
|
@ -263,8 +276,8 @@ struct transform_data
|
|||
bool full_set : 1;
|
||||
};
|
||||
};
|
||||
uint32_t reserved;
|
||||
PDU::Block<Point::pdu> points;
|
||||
uint32_t reserved; //!< reserved
|
||||
PDU::Block<Point::pdu> points; //!< block of Point PDU
|
||||
|
||||
size_t streamSize() const override;
|
||||
void iStream(PDU::Stream) override;
|
||||
|
|
|
@ -109,6 +109,8 @@ bool Controller::findDevices(uint64_t lowerBound, uint64_t upperBound) const
|
|||
/**
|
||||
* @brief Controller::quick_find
|
||||
* @param uid
|
||||
* @param lowerBound
|
||||
* @param upperBound
|
||||
* @return
|
||||
*/
|
||||
bool Controller::quick_find([[maybe_unused]] const UID& uid,
|
||||
|
|
|
@ -29,6 +29,8 @@ namespace RDM {
|
|||
|
||||
/**
|
||||
* @brief Device::Device
|
||||
* @param id
|
||||
* @param parent
|
||||
*/
|
||||
Device::Device(UID id, Device* parent)
|
||||
: DMX::Device()
|
||||
|
@ -310,6 +312,26 @@ void Device::set(const MsgPtr message, MsgPtr response)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Device::identify
|
||||
* @param state
|
||||
*/
|
||||
void Device::identify(bool state)
|
||||
{
|
||||
identifying_ = state;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Device::reset
|
||||
* @param hard
|
||||
*/
|
||||
void Device::reset(bool hard)
|
||||
{
|
||||
(void)hard;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Device::enqueueMessage
|
||||
* @param message
|
||||
|
@ -368,7 +390,9 @@ void Device::enqueueStatus(StatusPtr status)
|
|||
|
||||
|
||||
/**
|
||||
* @brief Device::actionPrep
|
||||
* @brief Device::actionPrep_
|
||||
* @param message
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
bool Device::actionPrep_(const MsgPtr message, MsgPtr response)
|
||||
|
@ -702,11 +726,11 @@ void Device::actionGetDmxPersonalityDesc(const MsgPtr message, MsgPtr response)
|
|||
response->responseType = RESPONSE_TYPE_ACK;
|
||||
response->appendData(mode);
|
||||
response->appendData(personalities_.at(mode)->footprint());
|
||||
for (size_t i = 0; i < personalities_.at(mode)->description.size(); i++)
|
||||
for (size_t i = 0; i < personalities_.at(mode)->description().size(); i++)
|
||||
{
|
||||
if (i > 32)
|
||||
break;
|
||||
response->appendData(personalities_.at(mode)->description.at(i));
|
||||
response->appendData(personalities_.at(mode)->description().at(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,9 @@
|
|||
|
||||
namespace RDM {
|
||||
|
||||
/**
|
||||
* @brief The RDM::Device class
|
||||
*/
|
||||
class Device
|
||||
: public DMX::Device
|
||||
{
|
||||
|
@ -52,26 +55,26 @@ public:
|
|||
void get(const MsgPtr message, MsgPtr response);
|
||||
void set(const MsgPtr message, MsgPtr response);
|
||||
|
||||
virtual void identify(bool state) { identifying_ = state; }
|
||||
virtual void reset(bool hard) { (void)hard; }
|
||||
virtual void identify(bool state);
|
||||
virtual void reset(bool hard);
|
||||
|
||||
uint16_t deviceModelID;
|
||||
std::string deviceModelDescription;
|
||||
uint16_t deviceProductCategory;
|
||||
uint16_t deviceModelID; //!< model ID number
|
||||
std::string deviceModelDescription; //!< model description
|
||||
uint16_t deviceProductCategory; //!< device category
|
||||
|
||||
protected:
|
||||
friend class Responder;
|
||||
UID id_;
|
||||
std::unordered_map<uint16_t, Device*> sub_devices_;
|
||||
std::unordered_map<PID, Parameter*> parameters_;
|
||||
std::vector<Sensor*> sensors_;
|
||||
std::list<uint16_t> product_detail_list_;
|
||||
UID id_; //!< device UID
|
||||
std::unordered_map<uint16_t, Device*> sub_devices_; //!< sub devices
|
||||
std::unordered_map<PID, Parameter*> parameters_; //!< parameters
|
||||
std::vector<Sensor*> sensors_; //!< sensors
|
||||
std::list<uint16_t> product_detail_list_; //!< product detail list
|
||||
|
||||
std::deque<MsgPtr> queued_messages_;
|
||||
std::deque<MsgPtr> queued_messages_; //!< outbound message queue
|
||||
void enqueueMessage(MsgPtr message, bool urgent = false);
|
||||
UID controller_uid_;
|
||||
UID controller_uid_; //!< controller UID
|
||||
|
||||
std::unordered_map<uint8_t, std::queue<StatusPtr>> queued_statuses_;
|
||||
std::unordered_map<uint8_t, std::queue<StatusPtr>> queued_statuses_; //!< outbound status queue
|
||||
void enqueueStatus(StatusPtr status);
|
||||
|
||||
bool actionPrep_(const MsgPtr message, MsgPtr response);
|
||||
|
|
|
@ -58,22 +58,13 @@ Message::Message(const Message &obj)
|
|||
* @brief Message::Message
|
||||
* @param data
|
||||
*/
|
||||
Message::Message(const std::vector<u_int8_t> &data)
|
||||
Message::Message(const std::vector<uint8_t> &data)
|
||||
: failure_mode(0)
|
||||
{
|
||||
read(data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Message::~Message
|
||||
*/
|
||||
Message::~Message()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Message::read
|
||||
* @param data
|
||||
|
@ -268,6 +259,26 @@ void Message::nak(uint16_t reason)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Message::data
|
||||
* @return
|
||||
*/
|
||||
const std::vector<uint8_t>* Message::data() const
|
||||
{
|
||||
return &data_;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Message::length
|
||||
* @return
|
||||
*/
|
||||
uint8_t Message::length() const
|
||||
{
|
||||
return data_.size();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Message::checksum
|
||||
* @return
|
||||
|
|
|
@ -33,54 +33,65 @@
|
|||
namespace RDM {
|
||||
|
||||
struct Message;
|
||||
using MsgPtr = std::shared_ptr<Message>;
|
||||
|
||||
using MsgPtr = std::shared_ptr<Message>; //!< valid RDM Message
|
||||
|
||||
/**
|
||||
* @brief The Message struct
|
||||
*/
|
||||
struct Message
|
||||
{
|
||||
Message();
|
||||
Message(const Message &obj);
|
||||
Message(const std::vector<uint8_t> &data);
|
||||
~Message();
|
||||
|
||||
void read(const std::vector<uint8_t> &data);
|
||||
void write(std::vector<uint8_t> &data) const;
|
||||
void nak(uint16_t reason);
|
||||
|
||||
UID source;
|
||||
UID destination;
|
||||
uint8_t transaction;
|
||||
UID source; //!< source UID
|
||||
UID destination; //!< destination UID
|
||||
uint8_t transaction; //!< transaction number
|
||||
union {
|
||||
uint8_t portID;
|
||||
uint8_t responseType;
|
||||
uint8_t portID; //!< destination port
|
||||
uint8_t responseType; //!< type of response
|
||||
};
|
||||
uint8_t messageCount;
|
||||
uint16_t subDevice;
|
||||
uint8_t commandClass;
|
||||
PID parameterId;
|
||||
uint8_t messageCount; //!< message count number
|
||||
uint16_t subDevice; //!< destination subdevice
|
||||
uint8_t commandClass; //!< message command class
|
||||
PID parameterId; //!< PID
|
||||
|
||||
union {
|
||||
uint8_t failure_mode;
|
||||
struct {
|
||||
bool short_message : 1;
|
||||
bool length_mismatch : 1;
|
||||
bool checksum_fail : 1;
|
||||
bool incorrect_sc : 1;
|
||||
bool incorrect_sub_sc: 1;
|
||||
bool do_no_send : 1;
|
||||
bool short_message : 1; //!< undersized buffer
|
||||
bool length_mismatch : 1; //!< message longer than adervertised
|
||||
bool checksum_fail : 1; //!< message did not match checksum
|
||||
bool incorrect_sc : 1; //!< invalid StartCode
|
||||
bool incorrect_sub_sc: 1; //!< invalid sub-StartCode
|
||||
bool do_not_send : 1; //!< message does not require transmission
|
||||
};
|
||||
};
|
||||
|
||||
const std::vector<uint8_t>* data() const { return &data_; }
|
||||
uint8_t length() const { return data_.size(); }
|
||||
const std::vector<uint8_t>* data() const;
|
||||
uint8_t length() const;
|
||||
uint16_t checksum() const;
|
||||
bool requiredLength(const size_t length, MsgPtr response) const;
|
||||
|
||||
/**
|
||||
* @brief appendData
|
||||
* @param val
|
||||
*/
|
||||
template<typename T>
|
||||
void appendData(const T & val)
|
||||
{
|
||||
Message::writeType<T>(data_, val);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief readType
|
||||
* @param vect
|
||||
* @param start
|
||||
* @return
|
||||
*/
|
||||
template<typename T>
|
||||
static T readType(const std::vector<uint8_t>& vect, size_t start)
|
||||
{
|
||||
|
@ -92,7 +103,11 @@ struct Message
|
|||
data[i] = vect[start + i];
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief writeType
|
||||
* @param data
|
||||
* @param val
|
||||
*/
|
||||
template<typename T>
|
||||
static void writeType(std::vector<uint8_t>& data, T val)
|
||||
{
|
||||
|
|
|
@ -59,10 +59,9 @@ void Parameter::disc(const MsgPtr message, MsgPtr response) const
|
|||
|
||||
|
||||
/**
|
||||
* @brief Property::get
|
||||
* @brief Parameter::get
|
||||
* @param message
|
||||
* @param ack
|
||||
* @param nak
|
||||
* @param response
|
||||
*/
|
||||
void Parameter::get(const MsgPtr message, MsgPtr response) const
|
||||
{
|
||||
|
@ -76,10 +75,9 @@ void Parameter::get(const MsgPtr message, MsgPtr response) const
|
|||
|
||||
|
||||
/**
|
||||
* @brief Property::set
|
||||
* @brief Parameter::set
|
||||
* @param message
|
||||
* @param ack
|
||||
* @param nak
|
||||
* @param response
|
||||
*/
|
||||
void Parameter::set(const MsgPtr message, MsgPtr response) const
|
||||
{
|
||||
|
@ -92,4 +90,34 @@ void Parameter::set(const MsgPtr message, MsgPtr response) const
|
|||
setter_(message, response);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Parameter::discAction
|
||||
* @param action
|
||||
*/
|
||||
void Parameter::discAction(const PidAction action)
|
||||
{
|
||||
discover_ = action;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Parameter::getAction
|
||||
* @param action
|
||||
*/
|
||||
void Parameter::getAction(const PidAction action)
|
||||
{
|
||||
getter_ = action;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Parameter::setAction
|
||||
* @param action
|
||||
*/
|
||||
void Parameter::setAction(const PidAction action)
|
||||
{
|
||||
setter_ = action;
|
||||
};
|
||||
|
||||
} // namespace RDM
|
||||
|
|
|
@ -30,8 +30,13 @@
|
|||
|
||||
namespace RDM {
|
||||
|
||||
|
||||
/**
|
||||
* @brief function that acts upon a PID
|
||||
*/
|
||||
using PidAction = std::function<void(const MsgPtr message, MsgPtr response)>;
|
||||
|
||||
|
||||
/**
|
||||
* @brief The Parameter class
|
||||
*/
|
||||
|
@ -45,9 +50,9 @@ public:
|
|||
void get(const MsgPtr message, MsgPtr response) const;
|
||||
void set(const MsgPtr message, MsgPtr response) const;
|
||||
|
||||
void discAction(const PidAction action) { getter_ = action; };
|
||||
void getAction(const PidAction action) { getter_ = action; };
|
||||
void setAction(const PidAction action) { setter_ = action; };
|
||||
void discAction(const PidAction action);
|
||||
void getAction(const PidAction action);
|
||||
void setAction(const PidAction action);
|
||||
|
||||
private:
|
||||
PidAction discover_;
|
||||
|
|
|
@ -180,7 +180,7 @@ std::string ProductCategoryDescription(const uint16_t PRODUCT_CATEGORY)
|
|||
* @param PRODUCT_DETAIL
|
||||
* @return
|
||||
*/
|
||||
std::string ProductDetailDescription(const u_int16_t PRODUCT_DETAIL)
|
||||
std::string ProductDetailDescription(const uint16_t PRODUCT_DETAIL)
|
||||
{
|
||||
switch (PRODUCT_DETAIL) {
|
||||
case PRODUCT_DETAIL_NOT_DECLARED:
|
||||
|
|
|
@ -31,9 +31,8 @@
|
|||
#include <string>
|
||||
|
||||
namespace RDM {
|
||||
using namespace DMX;
|
||||
|
||||
using PID = uint16_t;
|
||||
using PID = uint16_t; //!< Parameter Identification number
|
||||
|
||||
/// 10.5.1 Get Device Info (DEVICE_INFO)
|
||||
/// RDM Protocol Version:
|
||||
|
|
|
@ -30,6 +30,8 @@ namespace RDM {
|
|||
|
||||
/**
|
||||
* @brief Responder::Responder
|
||||
* @param id
|
||||
* @param parent
|
||||
*/
|
||||
Responder::Responder(UID id, Device* parent)
|
||||
: Device(id, parent)
|
||||
|
@ -114,22 +116,22 @@ Responder::~Responder()
|
|||
* @brief Responder::send
|
||||
* @param data
|
||||
*/
|
||||
void Responder::send(__attribute__((unused)) const std::vector<uint8_t> &data)
|
||||
void Responder::send(const std::vector<uint8_t> &data)
|
||||
{
|
||||
|
||||
(void)data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Responder::send
|
||||
* @param message
|
||||
* @param response
|
||||
*/
|
||||
void Responder::send(MsgPtr response)
|
||||
{
|
||||
if (!response)
|
||||
return;
|
||||
|
||||
if (response->do_no_send)
|
||||
if (response->do_not_send)
|
||||
return;
|
||||
|
||||
// 6.2.8.2 Message Count field for Responder Generated Messages
|
||||
|
@ -210,7 +212,7 @@ void Responder::receive(const MsgPtr message)
|
|||
/// responders shall not send a response.
|
||||
if (message->destination.isBroadcast() &&
|
||||
message->commandClass != DISCOVERY_COMMAND)
|
||||
response->do_no_send = true;
|
||||
response->do_not_send = true;
|
||||
|
||||
switch (message->commandClass) {
|
||||
case DISCOVERY_COMMAND:
|
||||
|
@ -232,7 +234,7 @@ void Responder::receive(const MsgPtr message)
|
|||
if (!response)
|
||||
return;
|
||||
|
||||
if (response->do_no_send)
|
||||
if (response->do_not_send)
|
||||
return;
|
||||
|
||||
send(response);
|
||||
|
@ -256,6 +258,7 @@ void Responder::reset(bool hard)
|
|||
/**
|
||||
* @brief Responder::rxDiscovery
|
||||
* @param message
|
||||
* @param response
|
||||
*/
|
||||
void Responder::rxDiscovery(const MsgPtr message, MsgPtr response)
|
||||
{
|
||||
|
@ -275,6 +278,7 @@ void Responder::rxDiscovery(const MsgPtr message, MsgPtr response)
|
|||
/**
|
||||
* @brief Responder::rxGet
|
||||
* @param message
|
||||
* @param response
|
||||
*/
|
||||
void Responder::rxGet(const MsgPtr message, MsgPtr response)
|
||||
{
|
||||
|
@ -308,6 +312,7 @@ void Responder::rxGet(const MsgPtr message, MsgPtr response)
|
|||
/**
|
||||
* @brief Responder::rxSet
|
||||
* @param message
|
||||
* @param response
|
||||
*/
|
||||
void Responder::rxSet(const MsgPtr message, MsgPtr response)
|
||||
{
|
||||
|
@ -352,7 +357,7 @@ void Responder::actionDiscoverUniqueBranch(const MsgPtr message, MsgPtr response
|
|||
|
||||
if (discovery_mute_flag_)
|
||||
{
|
||||
response->do_no_send = true;
|
||||
response->do_not_send = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -364,12 +369,12 @@ void Responder::actionDiscoverUniqueBranch(const MsgPtr message, MsgPtr response
|
|||
|
||||
if (id_.uid < lower.uid)
|
||||
{
|
||||
response->do_no_send = true;
|
||||
response->do_not_send = true;
|
||||
return;
|
||||
}
|
||||
if (id_.uid > upper.uid)
|
||||
{
|
||||
response->do_no_send = true;
|
||||
response->do_not_send = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -465,7 +470,7 @@ void Responder::actionGetQueuedMessage(const MsgPtr message, MsgPtr response)
|
|||
return;
|
||||
}
|
||||
|
||||
response->do_no_send = true;
|
||||
response->do_not_send = true;
|
||||
auto msg = queued_messages_.front();
|
||||
queued_messages_.pop_front();
|
||||
last_status_message_ = msg;
|
||||
|
@ -496,7 +501,7 @@ void Responder::actionGetStatusMessages(const MsgPtr message, MsgPtr response)
|
|||
|
||||
if (type == STATUS_GET_LAST_MESSAGE)
|
||||
{
|
||||
response->do_no_send = true;
|
||||
response->do_not_send = true;
|
||||
send(last_status_message_);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
|
||||
namespace RDM {
|
||||
|
||||
/**
|
||||
* @brief The Responder class
|
||||
*/
|
||||
class Responder
|
||||
: public Device
|
||||
{
|
||||
|
|
|
@ -64,6 +64,15 @@ void Sensor::setValue(int16_t &val)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Sensor::save
|
||||
*/
|
||||
void Sensor::save()
|
||||
{
|
||||
memory_ = value_;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Sensor::minimum
|
||||
* @return
|
||||
|
@ -88,6 +97,16 @@ int16_t Sensor::maximum() const
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Sensor::value
|
||||
* @return
|
||||
*/
|
||||
int16_t Sensor::value() const
|
||||
{
|
||||
return value_;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Sensor::saved
|
||||
* @return
|
||||
|
@ -114,7 +133,7 @@ void Sensor::clearMemory()
|
|||
|
||||
/**
|
||||
* @brief Sensor::actionGetSensorDefinition
|
||||
* @param message
|
||||
* @param index
|
||||
* @param response
|
||||
*/
|
||||
void Sensor::actionGetSensorDefinition(uint8_t index, MsgPtr response)
|
||||
|
@ -140,7 +159,7 @@ void Sensor::actionGetSensorDefinition(uint8_t index, MsgPtr response)
|
|||
|
||||
/**
|
||||
* @brief Sensor::actionGetSensorValue
|
||||
* @param message
|
||||
* @param index
|
||||
* @param response
|
||||
*/
|
||||
void Sensor::actionGetSensorValue(uint8_t index, MsgPtr response)
|
||||
|
@ -156,7 +175,7 @@ void Sensor::actionGetSensorValue(uint8_t index, MsgPtr response)
|
|||
|
||||
/**
|
||||
* @brief Sensor::actionSetSensorValue
|
||||
* @param message
|
||||
* @param index
|
||||
* @param response
|
||||
*/
|
||||
void Sensor::actionSetSensorValue(uint8_t index, MsgPtr response)
|
||||
|
@ -186,7 +205,6 @@ void Sensor::actionSetSensorValue(uint8_t index, MsgPtr response)
|
|||
|
||||
/**
|
||||
* @brief Sensor::actionSetRecordSensors
|
||||
* @param message
|
||||
* @param response
|
||||
*/
|
||||
void Sensor::actionSetRecordSensors(MsgPtr response)
|
||||
|
|
|
@ -40,13 +40,13 @@ public:
|
|||
virtual ~Sensor() {};
|
||||
|
||||
// RDM required properties
|
||||
uint8_t type;
|
||||
uint8_t unit;
|
||||
uint8_t unitPrefix;
|
||||
int16_t minLimit;
|
||||
int16_t maxLimit;
|
||||
int16_t minNominal;
|
||||
int16_t maxNominal;
|
||||
uint8_t type; //!< value type
|
||||
uint8_t unit; //!< unit type
|
||||
uint8_t unitPrefix; //!< unit prefix type
|
||||
int16_t minLimit; //!< minimum value
|
||||
int16_t maxLimit; //!< maximum value
|
||||
int16_t minNominal; //!< nominal value minimum
|
||||
int16_t maxNominal; //!< nominal value maximum
|
||||
union {
|
||||
uint8_t recordedValueSupport;
|
||||
struct {
|
||||
|
@ -55,15 +55,15 @@ public:
|
|||
uint8_t reserved : 6;
|
||||
};
|
||||
};
|
||||
std::string description;
|
||||
std::string description; //!< sensor description
|
||||
|
||||
// modifiers
|
||||
void setValue(int16_t &val);
|
||||
void save() { memory_ = value_; }
|
||||
void save();
|
||||
void clearMemory();
|
||||
|
||||
// queriers
|
||||
int16_t value() const { return value_; }
|
||||
int16_t value() const;
|
||||
int16_t saved() const;
|
||||
int16_t minimum() const;
|
||||
int16_t maximum() const;
|
||||
|
|
|
@ -28,20 +28,26 @@
|
|||
|
||||
namespace RDM {
|
||||
|
||||
/**
|
||||
* @brief The Status struct
|
||||
*/
|
||||
struct Status
|
||||
{
|
||||
union {
|
||||
uint8_t bytes[9];
|
||||
struct __attribute__ ((packed)) {
|
||||
uint16_t subdevice_id;
|
||||
uint8_t status_type;
|
||||
uint16_t status_message;
|
||||
int16_t data1;
|
||||
int16_t data2;
|
||||
};
|
||||
struct {
|
||||
uint16_t subdevice_id; //!< sub-device ID
|
||||
uint8_t status_type; //!< status type
|
||||
uint16_t status_message; //!< status message
|
||||
int16_t data1; //!< data field 1
|
||||
int16_t data2; //!< data field 2
|
||||
} __attribute__ ((packed));
|
||||
};
|
||||
}; // struct Status
|
||||
|
||||
/**
|
||||
* @brief a valid status
|
||||
*/
|
||||
using StatusPtr = std::shared_ptr<Status>;
|
||||
|
||||
|
||||
|
|
|
@ -32,6 +32,12 @@ namespace RDM {
|
|||
* @brief The UID struct
|
||||
*/
|
||||
struct UID {
|
||||
/**
|
||||
* @brief UID
|
||||
* @param dev
|
||||
* @param man
|
||||
* @param flag
|
||||
*/
|
||||
UID(uint32_t dev = 0, uint16_t man = 0, bool flag = false)
|
||||
: device(dev)
|
||||
, esta_man(man)
|
||||
|
@ -50,9 +56,19 @@ struct UID {
|
|||
};
|
||||
};
|
||||
};
|
||||
/**
|
||||
* @brief isBroadcast
|
||||
* @return
|
||||
*/
|
||||
bool isBroadcast() const {
|
||||
return (uid == BROADCAST_ALL_DEVICES_ID || device == ALL_DEVICE_ID_MASK);
|
||||
}
|
||||
/**
|
||||
* @brief operator ==
|
||||
* @param a
|
||||
* @param b
|
||||
* @return
|
||||
*/
|
||||
friend bool operator== (const UID& a, const UID& b)
|
||||
{
|
||||
if (a.uid == BROADCAST_ALL_DEVICES_ID || b.uid == BROADCAST_ALL_DEVICES_ID)
|
||||
|
@ -61,6 +77,12 @@ struct UID {
|
|||
return (a.esta_man == b.esta_man);
|
||||
return (a.uid == b.uid);
|
||||
}
|
||||
/**
|
||||
* @brief operator !=
|
||||
* @param a
|
||||
* @param b
|
||||
* @return
|
||||
*/
|
||||
friend bool operator!= (const UID& a, const UID& b)
|
||||
{
|
||||
return !(a == b);
|
||||
|
|
|
@ -348,8 +348,10 @@ Pdu::Pdu()
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief ClientEntryPdu::iStream
|
||||
* @brief Pdu::iStream
|
||||
* @param stream
|
||||
*/
|
||||
void Pdu::iStream(ACN::PDU::Stream stream)
|
||||
{
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
struct entry_header
|
||||
: ACN::PDU::pdu_header
|
||||
{
|
||||
UUID::uuid cid;
|
||||
UUID::uuid cid; //!< Component's UUID
|
||||
|
||||
size_t streamSize() const override;
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
|
@ -75,9 +75,9 @@ struct entry_header
|
|||
struct entry_rpt_data
|
||||
: ACN::PDU::pdu_data
|
||||
{
|
||||
RDM::UID client_uid;
|
||||
uint8_t client_type;
|
||||
UUID::uuid binding_cid;
|
||||
RDM::UID client_uid; //!< client RDM UID
|
||||
uint8_t client_type; //!< client type identifier
|
||||
UUID::uuid binding_cid; //!< UUID to bind
|
||||
|
||||
size_t streamSize() const override { return 23; }
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
|
@ -91,7 +91,7 @@ struct entry_rpt_data
|
|||
struct entry_ept_data
|
||||
: ACN::PDU::pdu_data
|
||||
{
|
||||
std::vector<uint8_t> subprotocol_list;
|
||||
std::vector<uint8_t> subprotocol_list; //!< list of sub-protocols
|
||||
|
||||
size_t streamSize() const override { return subprotocol_list.size(); }
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
|
@ -118,11 +118,11 @@ public:
|
|||
* @brief The connection_flags union
|
||||
*/
|
||||
union connection_flags {
|
||||
uint8_t byte;
|
||||
struct __attribute__((packed)) {
|
||||
bool incrementalUpdates : 1;
|
||||
uint8_t flags_reserved : 7; //!< Brokers shall ignore.
|
||||
};
|
||||
uint8_t byte; //!< packed byte
|
||||
struct {
|
||||
bool incrementalUpdates : 1; //!< incremental updates
|
||||
uint8_t flags_reserved : 7; //!< Brokers shall ignore.
|
||||
}__attribute__((packed));
|
||||
};
|
||||
|
||||
|
||||
|
@ -132,11 +132,11 @@ union connection_flags {
|
|||
struct client_connect_data
|
||||
: ACN::PDU::pdu_data
|
||||
{
|
||||
std::string clientScope;
|
||||
uint16_t version;
|
||||
std::string searchDomain;
|
||||
connection_flags flags;
|
||||
std::shared_ptr<ClientEntry::Pdu> pdu;
|
||||
std::string clientScope; //!< scope of the client
|
||||
uint16_t version; //!< version
|
||||
std::string searchDomain; //!< search domain
|
||||
connection_flags flags; //!< connection flags
|
||||
ACN::PDU::Message<ClientEntry::Pdu> pdu; //!< client entry PDU
|
||||
|
||||
size_t streamSize() const override { return 297 + pdu->streamSize(); }
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
|
@ -150,10 +150,10 @@ struct client_connect_data
|
|||
struct connect_reply_data
|
||||
: ACN::PDU::pdu_data
|
||||
{
|
||||
uint16_t code;
|
||||
uint16_t version;
|
||||
RDM::UID broker_uid;
|
||||
RDM::UID client_uid;
|
||||
uint16_t code; //!< reply code
|
||||
uint16_t version; //!< version
|
||||
RDM::UID broker_uid; //!< broker's UID
|
||||
RDM::UID client_uid; //!< client's UID
|
||||
|
||||
size_t streamSize() const override { return 16; }
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
|
@ -167,8 +167,8 @@ struct connect_reply_data
|
|||
struct client_entry_update_data
|
||||
: ACN::PDU::pdu_data
|
||||
{
|
||||
connection_flags flags;
|
||||
std::shared_ptr<ClientEntry::Pdu> pdu;
|
||||
connection_flags flags; //!< connection flags
|
||||
ACN::PDU::Message<ClientEntry::Pdu> pdu; //!< client entry PDU
|
||||
|
||||
size_t streamSize() const override { return 1 + pdu->streamSize(); }
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
|
@ -182,8 +182,8 @@ struct client_entry_update_data
|
|||
struct client_redirect_ipv4_data
|
||||
: ACN::PDU::pdu_data
|
||||
{
|
||||
uint32_t ip;
|
||||
uint16_t port;
|
||||
uint32_t ip; //!< IP address
|
||||
uint16_t port; //!< Port
|
||||
|
||||
size_t streamSize() const override { return 6; }
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
|
@ -197,8 +197,8 @@ struct client_redirect_ipv4_data
|
|||
struct client_redirect_ipv6_data
|
||||
: ACN::PDU::pdu_data
|
||||
{
|
||||
uint8_t ip[16];
|
||||
uint16_t port;
|
||||
uint8_t ip[16]; //!< IP address
|
||||
uint16_t port; //!< Port
|
||||
|
||||
size_t streamSize() const override { return 18; }
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
|
@ -213,8 +213,8 @@ struct dynamic_uid_request
|
|||
: ACN::PDU::pdu_stream_object
|
||||
{
|
||||
|
||||
RDM::UID uid;
|
||||
UUID::uuid rid;
|
||||
RDM::UID uid; //!< UID
|
||||
UUID::uuid rid; //!< UUID
|
||||
|
||||
size_t streamSize() const override { return 22; }
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
|
@ -228,7 +228,7 @@ struct dynamic_uid_request
|
|||
struct request_dynamic_uid_data
|
||||
: ACN::PDU::pdu_data
|
||||
{
|
||||
std::vector<dynamic_uid_request> list;
|
||||
std::vector<dynamic_uid_request> list; //!< dynamic UIDs
|
||||
|
||||
size_t streamSize() const override { return 22 * list.size(); }
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
|
@ -243,9 +243,9 @@ struct dynamic_uid_mapping
|
|||
: ACN::PDU::pdu_stream_object
|
||||
{
|
||||
|
||||
RDM::UID uid;
|
||||
UUID::uuid rid;
|
||||
uint16_t status;
|
||||
RDM::UID uid; //!< UID
|
||||
UUID::uuid rid; //!< UUID
|
||||
uint16_t status; //!< status
|
||||
|
||||
size_t streamSize() const override { return 24; }
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
|
@ -259,7 +259,7 @@ struct dynamic_uid_mapping
|
|||
struct dynamic_uid_assignment_data
|
||||
: ACN::PDU::pdu_data
|
||||
{
|
||||
std::vector<dynamic_uid_mapping> list;
|
||||
std::vector<dynamic_uid_mapping> list; //!< dynamic mappings
|
||||
|
||||
size_t streamSize() const override { return 24 * list.size(); }
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
|
@ -273,7 +273,7 @@ struct dynamic_uid_assignment_data
|
|||
struct fetch_dynamcic_assignment_data
|
||||
: ACN::PDU::pdu_data
|
||||
{
|
||||
std::vector<RDM::UID> list;
|
||||
std::vector<RDM::UID> list; //!< list of UID
|
||||
|
||||
size_t streamSize() const override { return 6 * list.size(); }
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
|
@ -287,7 +287,7 @@ struct fetch_dynamcic_assignment_data
|
|||
struct disconnect_data
|
||||
: ACN::PDU::pdu_data
|
||||
{
|
||||
uint16_t reason;
|
||||
uint16_t reason; //!< reason code
|
||||
|
||||
size_t streamSize() const override { return 2; }
|
||||
void iStream(ACN::PDU::Stream s) override { *s >> reason; }
|
||||
|
|
|
@ -28,6 +28,8 @@ namespace RDMnet {
|
|||
|
||||
/**
|
||||
* @brief Broker::Broker
|
||||
* @param cid
|
||||
* @param uid
|
||||
*/
|
||||
Broker::Broker(UUID::uuid cid, RDM::UID uid)
|
||||
: Implementation(cid, uid)
|
||||
|
|
|
@ -27,6 +27,8 @@ namespace RDMnet {
|
|||
|
||||
/**
|
||||
* @brief Controller::Controller
|
||||
* @param cid
|
||||
* @param uid
|
||||
*/
|
||||
Controller::Controller(UUID::uuid cid, RDM::UID uid)
|
||||
: Implementation(cid, uid)
|
||||
|
|
|
@ -26,7 +26,10 @@
|
|||
namespace RDMnet {
|
||||
|
||||
/**
|
||||
* @brief Controller::Controller
|
||||
* @brief Device::Device
|
||||
* @param cid
|
||||
* @param uid
|
||||
* @param rid
|
||||
*/
|
||||
Device::Device(UUID::uuid cid, RDM::UID uid, UUID::uuid rid)
|
||||
: Implementation(cid, uid)
|
||||
|
|
|
@ -29,6 +29,7 @@ namespace RDMnet {
|
|||
/**
|
||||
* @brief Implementation::Implementation
|
||||
* @param cid
|
||||
* @param uid
|
||||
*/
|
||||
Implementation::Implementation(UUID::uuid cid, RDM::UID uid)
|
||||
: ACN::RLP::Component(cid)
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
|
||||
namespace RDMnet {
|
||||
|
||||
/**
|
||||
* @brief The Implementation class
|
||||
*/
|
||||
class Implementation
|
||||
: public ACN::RLP::Component
|
||||
, public RDM::Responder
|
||||
|
@ -39,6 +42,13 @@ public:
|
|||
RDM::UID = RDM::UID());
|
||||
|
||||
void rlpLlrpReceiver(ACN::PDU::Message<ACN::RLP::Pdu>);
|
||||
|
||||
/**
|
||||
* @brief rlpEptReceiver
|
||||
*
|
||||
* EPT client support is optional. Override this method in your derived
|
||||
* class to impliment EPT support.
|
||||
*/
|
||||
virtual void rlpEptReceiver(ACN::PDU::Message<ACN::RLP::Pdu>) {};
|
||||
};
|
||||
|
||||
|
|
|
@ -28,17 +28,29 @@
|
|||
|
||||
namespace RDMnet {
|
||||
|
||||
/**
|
||||
* @brief The RDMnet::Pdu class
|
||||
*/
|
||||
class Pdu
|
||||
: public ACN::PDU::Pdu
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Pdu
|
||||
* @param vector_size
|
||||
*/
|
||||
Pdu(size_t vector_size)
|
||||
: ACN::PDU::Pdu(vector_size)
|
||||
{
|
||||
// RDMnet PDU flags always 0xF
|
||||
flags_.set(0xF0);
|
||||
flags_.set(0xF0); // RDMnet PDU flags always 0xF
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief RDMnet::Pdu::iStream
|
||||
* @param stream
|
||||
*
|
||||
* RDMnet PDU must have flag value of 0xF0
|
||||
*/
|
||||
virtual void iStream(ACN::PDU::Stream stream) override
|
||||
{
|
||||
ACN::PDU::Pdu::iStream(stream);
|
||||
|
@ -47,7 +59,6 @@ public:
|
|||
};
|
||||
};
|
||||
|
||||
|
||||
} // namespace RDMNet
|
||||
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace ACN::RLP {
|
|||
*/
|
||||
struct rlp_header : PDU::pdu_header
|
||||
{
|
||||
UUID::uuid cid;
|
||||
UUID::uuid cid; //!< Component's UUID
|
||||
|
||||
size_t streamSize() const override;
|
||||
void iStream(PDU::Stream) override;
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
namespace ACN::RLP::TCP {
|
||||
|
||||
/**
|
||||
* @brief preamble_t::preamble_t
|
||||
* @param stream
|
||||
* @brief transport::transport
|
||||
* @param filled
|
||||
*/
|
||||
transport::transport(bool filled)
|
||||
: PDU::pdu_stream_object()
|
||||
|
@ -67,6 +67,7 @@ void transport::iStream(PDU::Stream stream)
|
|||
|
||||
/**
|
||||
* @brief transport::oStream
|
||||
* @param stream
|
||||
*/
|
||||
void transport::oStream(PDU::Stream stream) const
|
||||
{
|
||||
|
|
|
@ -39,10 +39,10 @@ struct transport
|
|||
{
|
||||
transport(bool filled = false);
|
||||
|
||||
uint8_t acn_id[12]; // 3.1 Packet Identifier
|
||||
uint32_t length; // 3.2 PDU Block Size
|
||||
uint8_t acn_id[12]; //!< 3.1 Packet Identifier
|
||||
uint32_t length; //!< 3.2 PDU Block Size
|
||||
|
||||
PDU::Block<RLP::Pdu> root;
|
||||
PDU::Block<RLP::Pdu> root; //!< root PDU block
|
||||
|
||||
size_t streamSize() const override { return sizeof(acn_id) + 4 +
|
||||
root.streamSize(); }
|
||||
|
|
|
@ -53,11 +53,11 @@ struct transport
|
|||
: public PDU::pdu_stream_object {
|
||||
transport(bool filled = false);
|
||||
|
||||
uint16_t length = 0;
|
||||
uint16_t postamble_size = 0;
|
||||
uint8_t acn_id[12];
|
||||
uint16_t length = 0; //!< length of preamble + PDU block
|
||||
uint16_t postamble_size = 0; //!< length of postamble
|
||||
uint8_t acn_id[12]; //!< packet identifier
|
||||
|
||||
PDU::Block<RLP::Pdu> root;
|
||||
PDU::Block<RLP::Pdu> root; //!< root PDU block
|
||||
|
||||
size_t streamSize() const override { return PREAMBLE_MINIMUM_SIZE
|
||||
+ root.streamSize(); }
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
|
||||
namespace RDMnet::RPT {
|
||||
|
||||
/**
|
||||
* @brief The Broker class
|
||||
*/
|
||||
class Broker
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
|
||||
namespace RDMnet::RPT {
|
||||
|
||||
/**
|
||||
* @brief The Controller class
|
||||
*/
|
||||
class Controller
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
|
||||
namespace RDMnet::RPT {
|
||||
|
||||
/**
|
||||
* @brief The Device class
|
||||
*/
|
||||
class Device
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -84,7 +84,7 @@ public:
|
|||
struct status_string_data
|
||||
: ACN::PDU::pdu_data
|
||||
{
|
||||
std::string status_string;
|
||||
std::string status_string; //!< status message
|
||||
|
||||
size_t streamSize() const override;
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
|
@ -131,7 +131,7 @@ public:
|
|||
struct command_data
|
||||
: public ACN::PDU::pdu_data
|
||||
{
|
||||
RDM::Message message;
|
||||
RDM::Message message; //!< RDM message
|
||||
|
||||
size_t streamSize() const override { return 23 + message.length(); }
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
|
@ -159,10 +159,10 @@ public:
|
|||
struct rpt_header
|
||||
: ACN::PDU::pdu_header
|
||||
{
|
||||
RDM::UID source;
|
||||
uint16_t source_endpoint;
|
||||
RDM::UID destination;
|
||||
uint16_t destination_endpoint;
|
||||
RDM::UID source; //!< source UID
|
||||
uint16_t source_endpoint; //!< source endpoint number
|
||||
RDM::UID destination; //!< destination UID
|
||||
uint16_t destination_endpoint; //!< destination endpoint number
|
||||
|
||||
size_t streamSize() const override { return 16; }
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
|
@ -176,9 +176,9 @@ struct rpt_header
|
|||
struct rpt_data
|
||||
: ACN::PDU::pdu_data
|
||||
{
|
||||
uint32_t sequence;
|
||||
uint8_t reserved;
|
||||
std::shared_ptr<RDMnet::Pdu> pdu;
|
||||
uint32_t sequence; //!< sequence number
|
||||
uint8_t reserved; //!< reserved
|
||||
std::shared_ptr<RDMnet::Pdu> pdu; //!< RDMnet PDU
|
||||
|
||||
size_t streamSize() const override { return 5 + pdu->streamSize(); }
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
|
|
|
@ -38,9 +38,6 @@ Several reference implementations may be available in the `platform` subdirector
|
|||
## Usage with Arduino
|
||||
|
||||
Include `receiver-esp.h` at the top of your sketch.
|
||||
> ```
|
||||
> #include "src/lib/sacn/receiver-esp.h"
|
||||
> ```
|
||||
|
||||
Create a receiver object.
|
||||
> ```
|
||||
|
|
|
@ -44,8 +44,8 @@ void data_header::iStream(ACN::PDU::Stream stream)
|
|||
|
||||
|
||||
/**
|
||||
* @brief frame_header::asStream
|
||||
* @return
|
||||
* @brief data_header::oStream
|
||||
* @param stream
|
||||
*/
|
||||
void data_header::oStream(ACN::PDU::Stream stream) const
|
||||
{
|
||||
|
|
|
@ -32,12 +32,12 @@ namespace SACN::DATA {
|
|||
* @brief Table 6-1: E1.31 Data Packet Framing Layer
|
||||
*/
|
||||
struct data_header : ACN::PDU::pdu_header {
|
||||
std::string source_name;
|
||||
uint8_t priority;
|
||||
uint16_t sync_address;
|
||||
uint8_t sequence_number;
|
||||
uint8_t options;
|
||||
uint16_t universe;
|
||||
std::string source_name; //!< source description
|
||||
uint8_t priority; //!< priority, between 0 and 200
|
||||
uint16_t sync_address; //!< syncronization address
|
||||
uint8_t sequence_number; //!< sequence
|
||||
uint8_t options; //!< options
|
||||
uint16_t universe; //!< universe number
|
||||
|
||||
size_t streamSize() const override { return 71; }
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
|
|
|
@ -43,7 +43,7 @@ void sync_header::iStream(ACN::PDU::Stream stream)
|
|||
|
||||
/**
|
||||
* @brief sync_header::oStream
|
||||
* @return
|
||||
* @param stream
|
||||
*/
|
||||
void sync_header::oStream(ACN::PDU::Stream stream) const
|
||||
{
|
||||
|
@ -66,7 +66,7 @@ void discovery_header::iStream(ACN::PDU::Stream stream)
|
|||
|
||||
/**
|
||||
* @brief discovery_header::oStream
|
||||
* @return
|
||||
* @param stream
|
||||
*/
|
||||
void discovery_header::oStream(ACN::PDU::Stream stream) const
|
||||
{
|
||||
|
@ -116,7 +116,7 @@ void discovery_list_header::iStream(ACN::PDU::Stream stream)
|
|||
|
||||
/**
|
||||
* @brief discovery_list_header::oStream
|
||||
* @return
|
||||
* @param stream
|
||||
*/
|
||||
void discovery_list_header::oStream(ACN::PDU::Stream stream) const
|
||||
{
|
||||
|
|
|
@ -36,9 +36,9 @@ namespace SACN::EXTENDED {
|
|||
struct sync_header
|
||||
: ACN::PDU::pdu_header
|
||||
{
|
||||
uint8_t sequence_number;
|
||||
uint16_t sync_address;
|
||||
uint16_t reserved;
|
||||
uint8_t sequence_number; //!< sequence
|
||||
uint16_t sync_address; //!< synchronization address
|
||||
uint16_t reserved; //!< reserved
|
||||
|
||||
size_t streamSize() const override { return 5; }
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
|
@ -52,8 +52,8 @@ struct sync_header
|
|||
struct discovery_header
|
||||
: ACN::PDU::pdu_header
|
||||
{
|
||||
std::string source_name;
|
||||
uint32_t reserved;
|
||||
std::string source_name; //!< source descripton
|
||||
uint32_t reserved; //!< reserved
|
||||
|
||||
size_t streamSize() const override { return 68; }
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
|
@ -81,8 +81,8 @@ namespace DISCOVERY {
|
|||
struct discovery_list_header
|
||||
: ACN::PDU::pdu_header
|
||||
{
|
||||
uint8_t page;
|
||||
uint8_t last_page;
|
||||
uint8_t page; //!< number of the current page
|
||||
uint8_t last_page; //!< total pages
|
||||
|
||||
size_t streamSize() const override { return 2; }
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
|
@ -95,9 +95,9 @@ struct discovery_list_header
|
|||
*/
|
||||
struct discoveredUniverse
|
||||
{
|
||||
UUID::uuid source;
|
||||
std::string description;
|
||||
uint16_t universe;
|
||||
UUID::uuid source; //!< CID of source
|
||||
std::string description; //!< universe description
|
||||
uint16_t universe; //!< universe number
|
||||
};
|
||||
|
||||
using Watcher = std::function<void(std::shared_ptr<discoveredUniverse>)>;
|
||||
|
@ -109,7 +109,7 @@ using Watcher = std::function<void(std::shared_ptr<discoveredUniverse>)>;
|
|||
struct discovery_list_data
|
||||
: ACN::PDU::pdu_data
|
||||
{
|
||||
std::vector<discoveredUniverse> found;
|
||||
std::vector<discoveredUniverse> found; //!< discovered universes
|
||||
|
||||
size_t streamSize() const override { return 2 * found.size(); }
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
|
|
|
@ -60,6 +60,7 @@ const std::vector<Provenance> MergeProxyUniverse::sources() const
|
|||
|
||||
/**
|
||||
* @brief MergeProxyUniverse::sourceUniverse
|
||||
* @param src
|
||||
* @return
|
||||
*/
|
||||
Universe* MergeProxyUniverse::sourceUniverse(const Provenance &src)
|
||||
|
@ -72,6 +73,7 @@ Universe* MergeProxyUniverse::sourceUniverse(const Provenance &src)
|
|||
|
||||
/**
|
||||
* @brief MergeProxyUniverse::hasSourceUniverse
|
||||
* @param src
|
||||
* @return
|
||||
*/
|
||||
bool MergeProxyUniverse::hasSourceUniverse(const Provenance& src) const
|
||||
|
@ -96,7 +98,7 @@ bool MergeProxyUniverse::hasSources() const
|
|||
|
||||
/**
|
||||
* @brief MergeProxyUniverse::deleteSourceUniverse
|
||||
* @return
|
||||
* @param src
|
||||
*/
|
||||
void MergeProxyUniverse::deleteSourceUniverse(const Provenance& src)
|
||||
{
|
||||
|
@ -110,6 +112,7 @@ void MergeProxyUniverse::deleteSourceUniverse(const Provenance& src)
|
|||
|
||||
/**
|
||||
* @brief MergeProxyUniverse::addSourceUniverse
|
||||
* @param universe
|
||||
*/
|
||||
void MergeProxyUniverse::addSourceUniverse(Universe* universe)
|
||||
{
|
||||
|
@ -119,7 +122,7 @@ void MergeProxyUniverse::addSourceUniverse(Universe* universe)
|
|||
|
||||
/**
|
||||
* @brief MergeProxyUniverse::dataChangedNotifier
|
||||
* @param universe
|
||||
* @param dmx
|
||||
*/
|
||||
void MergeProxyUniverse::dataChangedNotifier(DMX::Universe* dmx)
|
||||
{
|
||||
|
@ -162,7 +165,7 @@ std::shared_ptr<Provenance> MergeProxyUniverse::source() const
|
|||
/**
|
||||
* @brief MergeProxyUniverse::set
|
||||
* @param pdu
|
||||
* @param source
|
||||
* @param src
|
||||
*/
|
||||
void MergeProxyUniverse::set(std::shared_ptr<ACN::DMP::Pdu> pdu,
|
||||
std::shared_ptr<Provenance> src)
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
namespace SACN {
|
||||
|
||||
/**
|
||||
* @brief Node::Node
|
||||
* @param cid
|
||||
*/
|
||||
Node::Node(UUID::uuid cid)
|
||||
: Component(cid)
|
||||
{
|
||||
|
|
|
@ -29,7 +29,9 @@
|
|||
|
||||
namespace SACN {
|
||||
|
||||
|
||||
/**
|
||||
* @brief The Node class
|
||||
*/
|
||||
class Node
|
||||
: public Receiver
|
||||
, public Source
|
||||
|
|
|
@ -59,6 +59,86 @@ Provenance::Provenance(std::shared_ptr<DATA::Pdu> pdu)
|
|||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Provenance::CID
|
||||
* @return
|
||||
*/
|
||||
const UUID::uuid Provenance::CID() const
|
||||
{
|
||||
return cid_;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Provenance::description
|
||||
* @return
|
||||
*/
|
||||
const std::string Provenance::description() const
|
||||
{
|
||||
return description_;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Provenance::universe
|
||||
* @return
|
||||
*/
|
||||
uint16_t Provenance::universe() const
|
||||
{
|
||||
return universe_;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Provenance::priority
|
||||
* @return
|
||||
*/
|
||||
uint8_t Provenance::priority() const
|
||||
{
|
||||
return priority_;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Provenance::syncAddress
|
||||
* @return
|
||||
*/
|
||||
uint16_t Provenance::syncAddress() const
|
||||
{
|
||||
return sync_address_;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Provenance::isTerminated
|
||||
* @return
|
||||
*/
|
||||
bool Provenance::isTerminated() const
|
||||
{
|
||||
return options_ & DATA::STREAM_TERMINATED;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Provenance::isPreview
|
||||
* @return
|
||||
*/
|
||||
bool Provenance::isPreview() const
|
||||
{
|
||||
return options_ & DATA::PREVIEW_DATA;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Provenance::isForced
|
||||
* @return
|
||||
*/
|
||||
bool Provenance::isForced() const
|
||||
{
|
||||
return options_ & DATA::FORCE_SYNCHRONIZATION;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief operator ==
|
||||
* @param a
|
||||
|
@ -71,5 +151,64 @@ bool operator== (const Provenance& a, const Provenance& b)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Provenance::setCID
|
||||
* @param cid
|
||||
*/
|
||||
void Provenance::setCID(UUID::uuid cid)
|
||||
{
|
||||
cid_ = cid;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Provenance::setDescription
|
||||
* @param desc
|
||||
*/
|
||||
void Provenance::setDescription(std::string desc)
|
||||
{
|
||||
description_ = desc;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Provenance::setOptions
|
||||
* @param o
|
||||
*/
|
||||
void Provenance::setOptions(uint8_t o)
|
||||
{
|
||||
options_ = o;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Provenance::setUniverse
|
||||
* @param n
|
||||
*/
|
||||
void Provenance::setUniverse(uint16_t n)
|
||||
{
|
||||
if (n >= 1 && n <= 63999) universe_ = n;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Provenance::setSyncAddress
|
||||
* @param a
|
||||
*/
|
||||
void Provenance::setSyncAddress(uint16_t a)
|
||||
{
|
||||
if (a >= 1 && a <= 63999) sync_address_ = a;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Provenance::setPriority
|
||||
* @param p
|
||||
*/
|
||||
void Provenance::setPriority(uint8_t p)
|
||||
{
|
||||
if (p <= 200) priority_ = p;
|
||||
}
|
||||
|
||||
|
||||
} // namespace SACN
|
||||
|
|
|
@ -40,26 +40,23 @@ public:
|
|||
Provenance();
|
||||
Provenance(std::shared_ptr<DATA::Pdu>);
|
||||
|
||||
const UUID::uuid CID() const {return cid_;};
|
||||
const std::string description() const {return description_;}
|
||||
uint16_t universe() const {return universe_;}
|
||||
uint8_t priority() const {return priority_;}
|
||||
uint16_t syncAddress() const {return sync_address_;}
|
||||
bool isTerminated() const {return options_
|
||||
& DATA::STREAM_TERMINATED;}
|
||||
bool isPreview() const {return options_
|
||||
& DATA::PREVIEW_DATA;}
|
||||
bool isForced() const {return options_
|
||||
& DATA::FORCE_SYNCHRONIZATION;}
|
||||
const UUID::uuid CID() const;
|
||||
const std::string description() const;
|
||||
uint16_t universe() const;
|
||||
uint8_t priority() const;
|
||||
uint16_t syncAddress() const;
|
||||
bool isTerminated() const;
|
||||
bool isPreview() const;
|
||||
bool isForced() const;
|
||||
|
||||
friend bool operator== (const Provenance& a, const Provenance& b);
|
||||
|
||||
void setCID(UUID::uuid cid) { cid_ = cid; }
|
||||
void setDescription(std::string desc) { description_ = desc; }
|
||||
void setOptions(uint8_t o) { options_ = o; }
|
||||
void setUniverse(uint16_t n) { if (n >= 1 && n <= 63999) universe_ = n; }
|
||||
void setSyncAddress(uint16_t a) { if (a >= 1 && a <= 63999) sync_address_ = a; }
|
||||
void setPriority(uint8_t p) { if (p <= 200) priority_ = p; }
|
||||
void setCID(UUID::uuid cid);
|
||||
void setDescription(std::string desc);
|
||||
void setOptions(uint8_t o);
|
||||
void setUniverse(uint16_t n);
|
||||
void setSyncAddress(uint16_t a);
|
||||
void setPriority(uint8_t p);
|
||||
|
||||
private:
|
||||
UUID::uuid cid_;
|
||||
|
|
|
@ -34,6 +34,9 @@
|
|||
|
||||
namespace SACN {
|
||||
|
||||
/**
|
||||
* @brief The Receiver class
|
||||
*/
|
||||
class Receiver
|
||||
: public virtual ACN::RLP::Component
|
||||
{
|
||||
|
|
|
@ -31,7 +31,9 @@
|
|||
|
||||
namespace SACN {
|
||||
|
||||
|
||||
/**
|
||||
* @brief The Source class
|
||||
*/
|
||||
class Source
|
||||
: public virtual ACN::RLP::Component
|
||||
{
|
||||
|
|
|
@ -38,8 +38,10 @@ Universe::Universe()
|
|||
|
||||
|
||||
/**
|
||||
Set universe data from a DMP PDU from a UniverseSource.
|
||||
*/
|
||||
* @brief Universe::set
|
||||
* @param dmp
|
||||
* @param source
|
||||
*/
|
||||
void Universe::set(std::shared_ptr<ACN::DMP::Pdu> dmp,
|
||||
std::shared_ptr<Provenance> source)
|
||||
{
|
||||
|
@ -106,6 +108,31 @@ void Universe::setProvenance(std::shared_ptr<Provenance> source)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Universe::isSyncronized
|
||||
* @return
|
||||
*/
|
||||
bool Universe::isSyncronized() const
|
||||
{
|
||||
return (sync_data_.size() > 0);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Universe::source
|
||||
* @return
|
||||
*/
|
||||
std::shared_ptr<Provenance> Universe::source() const
|
||||
{
|
||||
return provenance_;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Universe::slot
|
||||
* @param addr
|
||||
* @return
|
||||
*/
|
||||
uint8_t Universe::slot(const uint16_t addr)
|
||||
{
|
||||
/// 6.2.6 E1.31 Data Packet: Options
|
||||
|
|
|
@ -43,8 +43,8 @@ class Universe
|
|||
public:
|
||||
Universe();
|
||||
|
||||
virtual bool isSyncronized() const { return (sync_data_.size() > 0); };
|
||||
virtual std::shared_ptr<Provenance> source() const { return provenance_; }
|
||||
virtual bool isSyncronized() const;;
|
||||
virtual std::shared_ptr<Provenance> source() const;
|
||||
virtual uint8_t slot (const uint16_t) override;
|
||||
|
||||
virtual void set(std::shared_ptr<ACN::DMP::Pdu>, std::shared_ptr<Provenance>);
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
|
||||
namespace ACN::SDT {
|
||||
|
||||
/**
|
||||
* @brief The Identity class
|
||||
*/
|
||||
class Identity
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -48,7 +48,7 @@ Leader::Leader(UUID::uuid cid)
|
|||
|
||||
/**
|
||||
* @brief Leader::SdtReceiver
|
||||
* @param rlp
|
||||
* @param root
|
||||
*/
|
||||
void Leader::SdtReceiver(PDU::Message<RLP::Pdu> root)
|
||||
{
|
||||
|
@ -64,4 +64,31 @@ void Leader::SdtReceiver(PDU::Message<RLP::Pdu> root)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Leader::SdtJoinSession
|
||||
*/
|
||||
void Leader::SdtJoinSession()
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Leader::SdtGetSessions
|
||||
*/
|
||||
void Leader::SdtGetSessions()
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Leader::SdtSessions
|
||||
*/
|
||||
void Leader::SdtSessions()
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
} // namespace ACN::SDT
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
|
||||
namespace ACN::SDT {
|
||||
|
||||
/**
|
||||
* @brief The Leader class
|
||||
*/
|
||||
class Leader
|
||||
: public ACN::RLP::Component
|
||||
{
|
||||
|
@ -43,9 +46,9 @@ public:
|
|||
// Join, Get Sessions, and Sessions are ad-hoc messages, that is, they are
|
||||
// not sent within channels. These messages identify their intended recipient
|
||||
// by CID.
|
||||
virtual void SdtJoinSession() {};
|
||||
virtual void SdtGetSessions() {};
|
||||
virtual void SdtSessions() {};
|
||||
virtual void SdtJoinSession();
|
||||
virtual void SdtGetSessions();
|
||||
virtual void SdtSessions();
|
||||
|
||||
private:
|
||||
std::vector<std::shared_ptr<Session>> sdt_sessions_;
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
|
||||
namespace ACN::SDT {
|
||||
|
||||
/**
|
||||
* @brief The Member class
|
||||
*/
|
||||
class Member
|
||||
: public ACN::RLP::Component
|
||||
{
|
||||
|
|
|
@ -110,8 +110,8 @@ public:
|
|||
struct client_header
|
||||
: PDU::pdu_header
|
||||
{
|
||||
uint32_t protocol;
|
||||
uint16_t association;
|
||||
uint32_t protocol; //!< protocol number
|
||||
uint16_t association; //!< association
|
||||
|
||||
size_t streamSize() const override { return 6; };
|
||||
void iStream(PDU::Stream) override;
|
||||
|
@ -166,15 +166,15 @@ struct params
|
|||
struct join_data
|
||||
: PDU::pdu_data
|
||||
{
|
||||
UUID::uuid cid;
|
||||
MID mid;
|
||||
uint16_t channel;
|
||||
uint16_t reciprocal;
|
||||
uint32_t sequence;
|
||||
uint32_t reliable;
|
||||
UDP::ipAddress destination;
|
||||
params parameters;
|
||||
uint8_t expiry;
|
||||
UUID::uuid cid; //!< component UUID
|
||||
MID mid; //!< message ID
|
||||
uint16_t channel; //!< channel number
|
||||
uint16_t reciprocal; //!< reciprocol channel
|
||||
uint32_t sequence; //!< sequence number
|
||||
uint32_t reliable; //!< reliable number
|
||||
UDP::ipAddress destination; //!< destination IP address
|
||||
params parameters; //!< parameters
|
||||
uint8_t expiry; //!< expiry timeout
|
||||
|
||||
size_t streamSize() const override;
|
||||
void iStream(PDU::Stream) override;
|
||||
|
@ -188,11 +188,11 @@ struct join_data
|
|||
struct join_accept_data
|
||||
: PDU::pdu_data
|
||||
{
|
||||
UUID::uuid leader;
|
||||
uint16_t number;
|
||||
MID mid;
|
||||
uint32_t reliable;
|
||||
uint16_t reciprocal;
|
||||
UUID::uuid leader; //!< channel leader UUID
|
||||
uint16_t number; //!< channel number
|
||||
MID mid; //!< message ID
|
||||
uint32_t reliable; //!< reliable number
|
||||
uint16_t reciprocal; //!< reciprocal channel
|
||||
|
||||
size_t streamSize() const override { return 26; }
|
||||
void iStream(PDU::Stream) override;
|
||||
|
@ -206,11 +206,11 @@ struct join_accept_data
|
|||
struct join_refuse_data
|
||||
: PDU::pdu_data
|
||||
{
|
||||
UUID::uuid leader;
|
||||
uint16_t number;
|
||||
MID mid;
|
||||
uint32_t reliable;
|
||||
uint8_t reason;
|
||||
UUID::uuid leader; //!< channel leader UUID
|
||||
uint16_t number; //!< channel number
|
||||
MID mid; //!< message ID
|
||||
uint32_t reliable; //!< realiable number
|
||||
uint8_t reason; //!< NAK reason code
|
||||
|
||||
size_t streamSize() const override { return 25; }
|
||||
void iStream(PDU::Stream) override;
|
||||
|
@ -224,12 +224,12 @@ struct join_refuse_data
|
|||
struct nak_data
|
||||
: PDU::pdu_data
|
||||
{
|
||||
UUID::uuid leader;
|
||||
uint16_t number;
|
||||
MID mid;
|
||||
uint32_t reliable;
|
||||
uint32_t missed_first;
|
||||
uint32_t missed_last;
|
||||
UUID::uuid leader; //!< leader UUID
|
||||
uint16_t number; //!< channel number
|
||||
MID mid; //!< message ID
|
||||
uint32_t reliable; //!< reliable number
|
||||
uint32_t missed_first; //!< first missed message
|
||||
uint32_t missed_last; //!< last missed message
|
||||
|
||||
size_t streamSize() const override { return 32; }
|
||||
void iStream(PDU::Stream) override;
|
||||
|
@ -243,14 +243,14 @@ struct nak_data
|
|||
struct wrapper_data
|
||||
: PDU::pdu_data
|
||||
{
|
||||
uint16_t channel;
|
||||
uint32_t sequence;
|
||||
uint32_t reliable;
|
||||
uint32_t oldest;
|
||||
MID ack_range_begin;
|
||||
MID ack_range_end;
|
||||
uint16_t MAK_threshold;
|
||||
PDU::Block<CLIENT::Pdu> block;
|
||||
uint16_t channel; //!< channel number
|
||||
uint32_t sequence; //!< sequence number
|
||||
uint32_t reliable; //!< reliable number
|
||||
uint32_t oldest; //!< oldest sequence number
|
||||
MID ack_range_begin; //!< first MID to acknowledge
|
||||
MID ack_range_end; //!< last MID to acknowledge
|
||||
uint16_t MAK_threshold; //!< MAK Threshold
|
||||
PDU::Block<CLIENT::Pdu> block; //!< client PDU block
|
||||
|
||||
size_t streamSize() const override;
|
||||
void iStream(PDU::Stream) override;
|
||||
|
@ -265,7 +265,7 @@ struct wrapper_data
|
|||
struct get_sessions_data
|
||||
: PDU::pdu_data
|
||||
{
|
||||
UUID::uuid cid;
|
||||
UUID::uuid cid; //!< component UUID
|
||||
|
||||
size_t streamSize() const override { return UUID_LENGTH; }
|
||||
void iStream(PDU::Stream s) override { *s >> cid; }
|
||||
|
@ -280,14 +280,14 @@ struct get_sessions_data
|
|||
struct channel_info_block
|
||||
: PDU::pdu_stream_object
|
||||
{
|
||||
MID mid;
|
||||
UUID::uuid owner;
|
||||
uint16_t channel;
|
||||
UDP::ipAddress destination;
|
||||
UDP::ipAddress source;
|
||||
uint16_t reciprocal;
|
||||
uint16_t sessions;
|
||||
std::vector<uint32_t> protocols;
|
||||
MID mid; //!< MID
|
||||
UUID::uuid owner; //!< channel owner UUID
|
||||
uint16_t channel; //!< channel number
|
||||
UDP::ipAddress destination; //!< destination IP address
|
||||
UDP::ipAddress source; //!< source IP address
|
||||
uint16_t reciprocal; //!< reciprocal channel
|
||||
uint16_t sessions; //!< session count
|
||||
std::vector<uint32_t> protocols; //!< transported protocols
|
||||
|
||||
size_t streamSize() const override;
|
||||
void iStream(PDU::Stream) override;
|
||||
|
@ -301,7 +301,7 @@ struct channel_info_block
|
|||
struct sessions_data
|
||||
: PDU::pdu_data
|
||||
{
|
||||
std::vector<channel_info_block> list;
|
||||
std::vector<channel_info_block> list; //!< list of channel info blocks
|
||||
|
||||
size_t streamSize() const override;
|
||||
void iStream(PDU::Stream) override;
|
||||
|
@ -315,7 +315,7 @@ struct sessions_data
|
|||
struct ack_data
|
||||
: PDU::pdu_data
|
||||
{
|
||||
uint32_t sequence;
|
||||
uint32_t sequence; //!< sequence number
|
||||
|
||||
size_t streamSize() const override { return 4; }
|
||||
void iStream(PDU::Stream s) override { *s >> sequence; }
|
||||
|
@ -329,9 +329,9 @@ struct ack_data
|
|||
struct channel_params_data
|
||||
: PDU::pdu_data
|
||||
{
|
||||
params parameters;
|
||||
UDP::ipAddress address;
|
||||
uint8_t expiry;
|
||||
params parameters; //!< parameters
|
||||
UDP::ipAddress address; //!< IP address
|
||||
uint8_t expiry; //!< timeout
|
||||
|
||||
size_t streamSize() const override;
|
||||
void iStream(PDU::Stream) override;
|
||||
|
@ -345,7 +345,7 @@ struct channel_params_data
|
|||
struct connect_data
|
||||
: PDU::pdu_data
|
||||
{
|
||||
uint32_t protocol;
|
||||
uint32_t protocol; //!< protocol number
|
||||
|
||||
size_t streamSize() const override { return 4; }
|
||||
void iStream(PDU::Stream s) override { *s >> protocol; }
|
||||
|
@ -359,8 +359,8 @@ struct connect_data
|
|||
struct disconnecting_data
|
||||
: PDU::pdu_data
|
||||
{
|
||||
uint32_t protocol;
|
||||
uint8_t reason;
|
||||
uint32_t protocol; //!< protocol number
|
||||
uint8_t reason; //!< refuse/disconnect reason code
|
||||
|
||||
size_t streamSize() const override { return 5; }
|
||||
void iStream(PDU::Stream) override;
|
||||
|
|
|
@ -66,4 +66,130 @@ SessionId Session::id() {
|
|||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Session::join_accept
|
||||
*/
|
||||
void Session::join_accept()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Session::join_refuse
|
||||
*/
|
||||
void Session::join_refuse()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Session::leaving
|
||||
*/
|
||||
void Session::leaving()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Session::nak
|
||||
*/
|
||||
void Session::nak()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Session::reliable_wrapper
|
||||
*/
|
||||
void Session::reliable_wrapper()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Session::unreliable_wrapper
|
||||
*/
|
||||
void Session::unreliable_wrapper()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Session::ack
|
||||
*/
|
||||
void Session::ack()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Session::channel_params
|
||||
*/
|
||||
void Session::channel_params()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Session::leave
|
||||
*/
|
||||
void Session::leave()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Session::connect
|
||||
*/
|
||||
void Session::connect()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Session::connect_accept
|
||||
*/
|
||||
void Session::connect_accept()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Session::connect_refuse
|
||||
*/
|
||||
void Session::connect_refuse()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Session::disconnect
|
||||
*/
|
||||
void Session::disconnect()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Session::disconnecting
|
||||
*/
|
||||
void Session::disconnecting()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
} // namespace ACN::SDT
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "channel.h"
|
||||
#include "sdt.h"
|
||||
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
|
@ -34,9 +35,9 @@ namespace ACN::SDT {
|
|||
* @brief 3.1 Session Identity
|
||||
*/
|
||||
struct SessionId {
|
||||
UUID::uuid cid; // the component ID (CID) of the session leader
|
||||
uint16_t number; // the session number the leader has assigned
|
||||
uint32_t protocol; // the ID of the protocol carried by the session
|
||||
UUID::uuid cid; //!< the component ID (CID) of the session leader
|
||||
uint16_t number; //!< the session number the leader has assigned
|
||||
uint32_t protocol; //!< the ID of the protocol carried by the session
|
||||
bool operator== (const SessionId &) const;
|
||||
};
|
||||
|
||||
|
@ -55,12 +56,12 @@ public:
|
|||
SessionId id();
|
||||
|
||||
// 4.4 SDT Base Layer Messages (non ad-hoc)
|
||||
void join_accept() {};
|
||||
void join_refuse() {};
|
||||
void leaving() {};
|
||||
void nak() {};
|
||||
void reliable_wrapper() {};
|
||||
void unreliable_wrapper() {};
|
||||
void join_accept();
|
||||
void join_refuse();
|
||||
void leaving();
|
||||
void nak();
|
||||
void reliable_wrapper();
|
||||
void unreliable_wrapper();
|
||||
|
||||
// 4.5 SDT Wrapped Messages
|
||||
void ack();
|
||||
|
@ -73,9 +74,9 @@ public:
|
|||
void disconnecting();
|
||||
|
||||
protected:
|
||||
std::shared_ptr<ACN::Component> leader;
|
||||
std::shared_ptr<Channel> downstream;
|
||||
std::unordered_map<MID, std::shared_ptr<Channel>> upstream;
|
||||
std::shared_ptr<ACN::Component> leader; //!< session leader
|
||||
std::shared_ptr<Channel> downstream; //!< downstram channel
|
||||
std::unordered_map<MID, std::shared_ptr<Channel>> upstream; //!< upstream channel
|
||||
|
||||
private:
|
||||
uint16_t number_;
|
||||
|
|
|
@ -50,8 +50,8 @@ static const uint16_t SDT_MULTICAST_PORT = 5568; // IANA registered “sdt”
|
|||
struct ipAddress
|
||||
: PDU::pdu_stream_object
|
||||
{
|
||||
uint8_t type = 0;
|
||||
uint16_t port = SDT_MULTICAST_PORT;
|
||||
uint8_t type = 0; //!< address type identifier
|
||||
uint16_t port = SDT_MULTICAST_PORT; //!< Port
|
||||
union {
|
||||
uint8_t ipv4[4];
|
||||
uint8_t ipv6[16] = {0};
|
||||
|
|
|
@ -60,6 +60,99 @@ uuid::uuid(const uuid& other)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief uuid::uuid
|
||||
* @param raw
|
||||
*/
|
||||
uuid::uuid(const uint8_t * raw)
|
||||
: uuid()
|
||||
{
|
||||
fromArray_(raw);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief uuid::uuid
|
||||
* @param c_str
|
||||
*/
|
||||
uuid::uuid(const char * c_str)
|
||||
: uuid()
|
||||
{
|
||||
fromCstring_(c_str);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief uuid::uuid
|
||||
* @param str
|
||||
*/
|
||||
uuid::uuid(std::string str)
|
||||
: uuid()
|
||||
{
|
||||
fromString_(str);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief uuid::bytes
|
||||
* @return
|
||||
*/
|
||||
const uint8_t * uuid::bytes() const
|
||||
{
|
||||
return raw_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief uuid::type
|
||||
* @return
|
||||
*/
|
||||
Type uuid::type() const
|
||||
{
|
||||
return type_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief uuid::version
|
||||
* @return
|
||||
*/
|
||||
uint16_t uuid::version() const
|
||||
{
|
||||
return version_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief uuid::time
|
||||
* @return
|
||||
*/
|
||||
uint64_t uuid::time() const
|
||||
{
|
||||
return timestamp_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief uuid::sequence
|
||||
* @return
|
||||
*/
|
||||
uint16_t uuid::sequence() const
|
||||
{
|
||||
return clock_seq_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief uuid::node
|
||||
* @return
|
||||
*/
|
||||
uint64_t uuid::node() const
|
||||
{
|
||||
return node_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief uuid::fromArray
|
||||
* @param bytes
|
||||
|
@ -339,6 +432,34 @@ bool operator== (const uuid& a, const uuid& b)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief uuid::operator const uint8_t *
|
||||
*/
|
||||
uuid::operator const uint8_t * () const
|
||||
{
|
||||
return raw_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief uuid::operator const std::string
|
||||
*/
|
||||
uuid::operator const std::string () const
|
||||
{
|
||||
return string();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief uuid::setBytes
|
||||
* @param raw
|
||||
*/
|
||||
void uuid::setBytes(const uint8_t * raw)
|
||||
{
|
||||
fromArray_(raw);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief uuid::uuid1
|
||||
* @param node
|
||||
|
@ -361,9 +482,9 @@ uint16_t uuid::uuid1(uint64_t node, uint16_t clock_seq)
|
|||
|
||||
|
||||
/**
|
||||
* @brief uuid::uuid4
|
||||
* @brief Version 4 (RANDOM) UUID
|
||||
*
|
||||
* create this UUID as a Version 4 (RANDOM) UUID
|
||||
* a very low quality random
|
||||
*/
|
||||
void uuid::uuid4() {
|
||||
type_ = RFC4122;
|
||||
|
|
|
@ -36,10 +36,10 @@ namespace UUID {
|
|||
* @brief The Type enum
|
||||
*/
|
||||
enum Type {
|
||||
NCS, // Reserved, NCS backward compatibility.
|
||||
RFC4122, // The variant specified in this document.
|
||||
MS, // Reserved, Microsoft Corporation backward compatibility
|
||||
RESVERED, // Reserved for future definition.
|
||||
NCS, //!< Reserved, NCS backward compatibility.
|
||||
RFC4122, //!< The variant specified in this document.
|
||||
MS, //!< Reserved, Microsoft Corporation backward compatibility
|
||||
RESVERED, //!< Reserved for future definition.
|
||||
NIL
|
||||
};
|
||||
|
||||
|
@ -49,11 +49,11 @@ enum Type {
|
|||
*/
|
||||
enum RFC4122Version {
|
||||
VOID = 0b0000,
|
||||
TIME = 0b0001, // The time-based version specified in this document.
|
||||
DCE = 0b0010, // DCE Security version, with embedded POSIX UIDs.
|
||||
MD5 = 0b0011, // The name-based version that uses MD5 hashing.
|
||||
RAND = 0b0100, // The randomly or pseudo-randomly generated version.
|
||||
SHA1 = 0b0101 // The name-based version that uses SHA-1 hashing.
|
||||
TIME = 0b0001, //!< The time-based version specified in this document.
|
||||
DCE = 0b0010, //!< DCE Security version, with embedded POSIX UIDs.
|
||||
MD5 = 0b0011, //!< The name-based version that uses MD5 hashing.
|
||||
RAND = 0b0100, //!< The randomly or pseudo-randomly generated version.
|
||||
SHA1 = 0b0101 //!< The name-based version that uses SHA-1 hashing.
|
||||
};
|
||||
|
||||
|
||||
|
@ -61,10 +61,10 @@ enum RFC4122Version {
|
|||
* @brief The Namespace enum
|
||||
*/
|
||||
enum Namespace {
|
||||
DNS, // the name string is a fully-qualified domain name.
|
||||
URL, // the name string is a URL.
|
||||
OID, // the name string is an ISO OID.
|
||||
X500 // the name string is an X.500 DN in DER or a text output format.
|
||||
DNS, //!< the name string is a fully-qualified domain name.
|
||||
URL, //!< the name string is a URL.
|
||||
OID, //!< the name string is an ISO OID.
|
||||
X500 //!< the name string is an X.500 DN in DER or a text output format.
|
||||
};
|
||||
|
||||
|
||||
|
@ -72,10 +72,10 @@ enum Namespace {
|
|||
* @brief The NCSFields struct
|
||||
*/
|
||||
struct NCSFields {
|
||||
uint64_t time : 48;
|
||||
uint16_t res;
|
||||
uint8_t family;
|
||||
uint64_t node : 56;
|
||||
uint64_t time : 48; //!< timestamp
|
||||
uint16_t res; //!< res
|
||||
uint8_t family; //!< family
|
||||
uint64_t node : 56; //!< node number
|
||||
}__attribute__((packed));
|
||||
|
||||
|
||||
|
@ -83,13 +83,13 @@ struct NCSFields {
|
|||
* @brief The RFC4122Fields struct
|
||||
*/
|
||||
struct RFC4122Fields {
|
||||
uint32_t time_low;
|
||||
uint16_t time_mid;
|
||||
uint16_t time_hi_version;
|
||||
uint8_t clock_seq_hi_variant;
|
||||
uint8_t clock_seq_low;
|
||||
uint16_t node_low;
|
||||
uint32_t node_high;
|
||||
uint32_t time_low; //!< timestamp low
|
||||
uint16_t time_mid; //!< timestamp mid
|
||||
uint16_t time_hi_version; //!< timestamp high & version
|
||||
uint8_t clock_seq_hi_variant; //!< clock sequence high & variant
|
||||
uint8_t clock_seq_low; //!< clock sequence low
|
||||
uint16_t node_low; //!< node low
|
||||
uint32_t node_high; //!< node high
|
||||
}__attribute__((packed));
|
||||
|
||||
|
||||
|
@ -112,17 +112,17 @@ class uuid {
|
|||
public:
|
||||
uuid();
|
||||
uuid(const uuid&);
|
||||
uuid(const uint8_t * raw) : uuid() { fromArray_(raw); };
|
||||
uuid(const char * c_str) : uuid() { fromCstring_(c_str); };
|
||||
uuid(std::string str) : uuid() { fromString_(str); };
|
||||
uuid(const uint8_t * raw);
|
||||
uuid(const char * c_str);
|
||||
uuid(std::string str);
|
||||
|
||||
// accessors
|
||||
const uint8_t * bytes() const { return raw_; };
|
||||
Type type() const { return type_; };
|
||||
uint16_t version() const { return version_; };
|
||||
uint64_t time() const { return timestamp_; };
|
||||
uint16_t sequence() const { return clock_seq_; };
|
||||
uint64_t node() const { return node_; };
|
||||
const uint8_t* bytes() const;
|
||||
Type type() const;
|
||||
uint16_t version() const;
|
||||
uint64_t time() const;
|
||||
uint16_t sequence() const;
|
||||
uint64_t node() const;
|
||||
|
||||
// output
|
||||
std::string hex() const; // '12345678123456781234567812345678'
|
||||
|
@ -130,19 +130,17 @@ public:
|
|||
std::string urn() const; // 'urn:uuid:12345678-1234-5678-1234-567812345678'
|
||||
|
||||
// creators
|
||||
void setBytes(const uint8_t * raw) { fromArray_(raw); }
|
||||
void setBytes(const uint8_t * raw);
|
||||
virtual uint16_t uuid1(uint64_t node, uint16_t clock_seq);
|
||||
// virtual void uuid3(Namespace, std::string) {};
|
||||
virtual void uuid4(); // very low quality of random
|
||||
// virtual void uuid5(Namespace, std::string) {};
|
||||
virtual void uuid4();
|
||||
|
||||
// operator overloads
|
||||
uuid& operator= (const uuid& other);
|
||||
friend bool operator== (const uuid&, const uuid&);
|
||||
|
||||
// typecast overload
|
||||
operator const uint8_t * () const { return raw_; };
|
||||
operator const std::string () const { return string(); };
|
||||
operator const uint8_t * () const;
|
||||
operator const std::string () const;
|
||||
|
||||
private:
|
||||
uint8_t raw_[UUID_LENGTH] = {0};
|
||||
|
@ -173,10 +171,10 @@ private:
|
|||
|
||||
namespace std
|
||||
{
|
||||
template<>
|
||||
/**
|
||||
* @brief The hash struct specialization for UUID::uuid
|
||||
*/
|
||||
template<>
|
||||
struct hash<UUID::uuid>
|
||||
{
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue