1
0
Fork 0

virtual method for getting active slot count

This commit is contained in:
Kevin Matz 2021-09-03 17:43:50 -04:00
parent bbe4432737
commit e538cc74d3
6 changed files with 61 additions and 28 deletions

View File

@ -1,6 +1,5 @@
#include "qsacnuniverse.h"
/**
* @brief QSacnUniverse::QSacnUniverse
* @param parent
@ -21,7 +20,7 @@ QSacnUniverse::QSacnUniverse(QObject *parent, sACN::Universe *universe)
*/
const QString QSacnUniverse::description() const
{
return QString::fromUtf8(universe_->provenance()->source_name.c_str());
return QString::fromUtf8(universe_->provenance()->source_name.c_str());
}
@ -31,7 +30,7 @@ const QString QSacnUniverse::description() const
*/
uint16_t QSacnUniverse::number() const
{
return universe_->provenance()->universe;
return universe_->provenance()->universe;
}
@ -41,7 +40,7 @@ uint16_t QSacnUniverse::number() const
*/
uint8_t QSacnUniverse::priority() const
{
return universe_->provenance()->priority;
return universe_->provenance()->priority;
}
@ -51,7 +50,7 @@ uint8_t QSacnUniverse::priority() const
*/
double QSacnUniverse::rxRate() const
{
return universe_->rxRate();
return universe_->rxRate();
}
@ -62,7 +61,7 @@ double QSacnUniverse::rxRate() const
*/
uint8_t QSacnUniverse::slot(const u_int16_t slot) const
{
return universe_->slot(slot);
return universe_->slot(slot);
}
@ -76,13 +75,23 @@ bool QSacnUniverse::isEditable() const
}
/**
* @brief QSacnUniverse::activeSlots
* @return
*/
uint16_t QSacnUniverse::activeSlots() const
{
return universe_->activeSlots();
}
/**
* @brief QSacnUniverse::setDescription
* @param desc
*/
void QSacnUniverse::setDescription(std::string desc)
{
universe_->provenance()->source_name = desc;
universe_->provenance()->source_name = desc;
}
@ -92,7 +101,7 @@ void QSacnUniverse::setDescription(std::string desc)
*/
void QSacnUniverse::setOptions(sACN::DATA::data_options o)
{
universe_->provenance()->options = o;
universe_->provenance()->options = o;
}
@ -102,7 +111,7 @@ void QSacnUniverse::setOptions(sACN::DATA::data_options o)
*/
void QSacnUniverse::setPriority(uint8_t p)
{
universe_->provenance()->priority = p;
universe_->provenance()->priority = p;
}
@ -112,7 +121,7 @@ void QSacnUniverse::setPriority(uint8_t p)
*/
void QSacnUniverse::setSyncAddress(uint16_t a)
{
universe_->provenance()->sync_address = a;
universe_->provenance()->sync_address = a;
}
@ -123,7 +132,7 @@ void QSacnUniverse::setSyncAddress(uint16_t a)
*/
void QSacnUniverse::setValue (const uint16_t addr, const uint8_t level)
{
universe_->sACN::Universe::setValue(addr, level);
universe_->sACN::Universe::setValue(addr, level);
}
@ -136,7 +145,7 @@ void QSacnUniverse::setValue (const uint16_t addr, const uint8_t level)
void QSacnUniverse::setValue (const uint16_t addr, const uint16_t size,
const uint8_t* profile)
{
universe_->sACN::Universe::setValue(addr, size, profile);
universe_->sACN::Universe::setValue(addr, size, profile);
}
@ -146,8 +155,8 @@ void QSacnUniverse::setValue (const uint16_t addr, const uint16_t size,
*/
void QSacnUniverse::dataChangedNotifier(DMX::Universe* universe)
{
Q_UNUSED(universe)
emit changed(universe_);
Q_UNUSED(universe)
emit changed(universe_);
};

View File

@ -25,6 +25,7 @@ public:
uint8_t slot(const u_int16_t slot) const;
bool isEditable() const;
uint16_t activeSlots() const;
public slots:
void setDescription(std::string desc);

View File

@ -193,6 +193,15 @@ bool ArbitratingUniverse::isEditable() const {
}
uint16_t ArbitratingUniverse::activeSlots() const
{
auto universe = dominant_();
if (!universe)
return 0;
return universe->activeSlots();
}
/**
* @brief MergeProxyUniverse::slot
* @param s

View File

@ -75,6 +75,7 @@ public:
bool isSyncronized() const override;
void synchronize(uint8_t = 0) override;
bool isEditable() const override;
uint16_t activeSlots() const override;
// DMX::Universe Overrides:
uint8_t slot(const uint16_t) const override;

View File

@ -175,7 +175,17 @@ bool Universe::isEditable() const
}
void Universe::setValue (const uint16_t address, const uint8_t value)
/**
* @brief Universe::activeSlots
* @return
*/
uint16_t Universe::activeSlots() const
{
return active_data_slots;
}
void Universe::setValue(const uint16_t address, const uint8_t value)
{
if (!isEditable())
return;

View File

@ -59,6 +59,7 @@ public:
virtual void synchronize(uint8_t = 0);
virtual bool isEditable() const;
virtual uint16_t activeSlots() const;
// DMX::Universe overrides
void setValue (const uint16_t address, const uint8_t value) override;
@ -72,22 +73,24 @@ public:
*/
ipAddress destination;
protected:
/**
* @brief \cite sACN 3.7 Active Data Slots
*
* > When translating ANSI E1.11 DMX512-A \cite DMX to E1.31, the active data
* > slots are defined as ranging from data slot 1 to the maximum data slot in
* > the most recently received packet with the corresponding START Code.
* >
* > Devices originating E1.31 shall define their active data slots using
* > the DMP First Property Address and DMP Property Count fields shown in
* > Table 4-1.
*/
uint16_t active_data_slots;
protected:
void sACNsend() const;
/**
* @brief \cite sACN 3.7 Active Data Slots
*
* > When translating ANSI E1.11 DMX512-A \cite DMX to E1.31, the active data
* > slots are defined as ranging from data slot 1 to the maximum data slot in
* > the most recently received packet with the corresponding START Code.
* >
* > Devices originating E1.31 shall define their active data slots using
* > the DMP First Property Address and DMP Property Count fields shown in
* > Table 4-1.
*/
uint16_t active_data_slots;
private:
std::shared_ptr<DATA::data_header> provenance_;
std::vector<uint8_t> * sync_data_ = nullptr;