implement QSacnUniverse in proper body
This commit is contained in:
parent
41686e32af
commit
f3f5aa3d3e
|
@ -21,6 +21,7 @@ target_sources(${PROJECT_NAME}
|
|||
PRIVATE
|
||||
qsacnnode_global.h
|
||||
qsacnnode.cpp
|
||||
qsacnuniverse.cpp
|
||||
universemodel.cpp
|
||||
)
|
||||
|
||||
|
|
|
@ -0,0 +1,155 @@
|
|||
#include "qsacnuniverse.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief QSacnUniverse::QSacnUniverse
|
||||
* @param parent
|
||||
* @param universe
|
||||
*/
|
||||
QSacnUniverse::QSacnUniverse(QObject *parent, sACN::Universe *universe)
|
||||
: QObject(parent)
|
||||
, universe_(universe)
|
||||
{
|
||||
universe_->onData(std::bind(&QSacnUniverse::dataChangedNotifier,
|
||||
this, std::placeholders::_1));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief QSacnUniverse::description
|
||||
* @return
|
||||
*/
|
||||
const QString QSacnUniverse::description() const
|
||||
{
|
||||
return QString::fromUtf8(universe_->provenance()->source_name.c_str());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief QSacnUniverse::number
|
||||
* @return
|
||||
*/
|
||||
uint16_t QSacnUniverse::number() const
|
||||
{
|
||||
return universe_->provenance()->universe;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief QSacnUniverse::priority
|
||||
* @return
|
||||
*/
|
||||
uint8_t QSacnUniverse::priority() const
|
||||
{
|
||||
return universe_->provenance()->priority;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief QSacnUniverse::rxRate
|
||||
* @return
|
||||
*/
|
||||
double QSacnUniverse::rxRate() const
|
||||
{
|
||||
return universe_->rxRate();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief QSacnUniverse::slot
|
||||
* @param slot
|
||||
* @return
|
||||
*/
|
||||
uint8_t QSacnUniverse::slot(const u_int16_t slot) const
|
||||
{
|
||||
return universe_->slot(slot);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief QSacnUniverse::isEditable
|
||||
* @return
|
||||
*/
|
||||
bool QSacnUniverse::isEditable() const
|
||||
{
|
||||
return (universe_->isEditable());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief QSacnUniverse::setDescription
|
||||
* @param desc
|
||||
*/
|
||||
void QSacnUniverse::setDescription(std::string desc)
|
||||
{
|
||||
universe_->provenance()->source_name = desc;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief QSacnUniverse::setOptions
|
||||
* @param o
|
||||
*/
|
||||
void QSacnUniverse::setOptions(sACN::DATA::data_options o)
|
||||
{
|
||||
universe_->provenance()->options = o;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief QSacnUniverse::setPriority
|
||||
* @param p
|
||||
*/
|
||||
void QSacnUniverse::setPriority(uint8_t p)
|
||||
{
|
||||
universe_->provenance()->priority = p;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief QSacnUniverse::setSyncAddress
|
||||
* @param a
|
||||
*/
|
||||
void QSacnUniverse::setSyncAddress(uint16_t a)
|
||||
{
|
||||
universe_->provenance()->sync_address = a;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief QSacnUniverse::setValue
|
||||
* @param addr
|
||||
* @param level
|
||||
*/
|
||||
void QSacnUniverse::setValue (const uint16_t addr, const uint8_t level)
|
||||
{
|
||||
universe_->sACN::Universe::setValue(addr, level);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief QSacnUniverse::setValue
|
||||
* @param addr
|
||||
* @param size
|
||||
* @param profile
|
||||
*/
|
||||
void QSacnUniverse::setValue (const uint16_t addr, const uint16_t size,
|
||||
const uint8_t* profile)
|
||||
{
|
||||
universe_->sACN::Universe::setValue(addr, size, profile);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief QSacnUniverse::dataChangedNotifier
|
||||
* @param universe
|
||||
*/
|
||||
void QSacnUniverse::dataChangedNotifier(DMX::Universe* universe)
|
||||
{
|
||||
Q_UNUSED(universe)
|
||||
emit changed(universe_);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
|
@ -13,83 +13,33 @@ class QT_EXPORT QSacnUniverse
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
friend DMX::Universe; // permit callback to access the private notifier
|
||||
/**
|
||||
* @brief QSacnUniverse
|
||||
* @param parent
|
||||
* @param universe
|
||||
*/
|
||||
friend class DMX::Universe; // permit callback to access the private notifier
|
||||
|
||||
explicit QSacnUniverse(QObject *parent = nullptr,
|
||||
sACN::Universe *universe = nullptr)
|
||||
: QObject(parent)
|
||||
, universe_(universe)
|
||||
{
|
||||
universe_->onData(std::bind(&QSacnUniverse::dataChangedNotifier,
|
||||
this, std::placeholders::_1));
|
||||
};
|
||||
sACN::Universe *universe = nullptr);
|
||||
|
||||
const QString description() const
|
||||
{
|
||||
return QString::fromUtf8(universe_->provenance()->source_name.c_str());
|
||||
}
|
||||
const QString description() const;
|
||||
uint16_t number() const;
|
||||
uint8_t priority() const;
|
||||
double rxRate() const;
|
||||
uint8_t slot(const u_int16_t slot) const;
|
||||
|
||||
uint16_t number() const
|
||||
{
|
||||
return universe_->provenance()->universe;
|
||||
}
|
||||
|
||||
uint8_t priority() const
|
||||
{
|
||||
return universe_->provenance()->priority;
|
||||
}
|
||||
|
||||
double rxRate() const
|
||||
{
|
||||
return universe_->rxRate();
|
||||
}
|
||||
|
||||
uint8_t slot(const u_int16_t slot) const
|
||||
{
|
||||
return universe_->slot(slot);
|
||||
}
|
||||
bool isEditable() const;
|
||||
|
||||
public slots:
|
||||
void setDescription(std::string desc)
|
||||
{
|
||||
universe_->provenance()->source_name = desc;
|
||||
}
|
||||
void setOptions(sACN::DATA::data_options o)
|
||||
{
|
||||
universe_->provenance()->options = o;
|
||||
}
|
||||
void setPriority(uint8_t p)
|
||||
{
|
||||
universe_->provenance()->priority = p;
|
||||
}
|
||||
void setSyncAddress(uint16_t a)
|
||||
{
|
||||
universe_->provenance()->sync_address = a;
|
||||
}
|
||||
void setValue (const uint16_t addr, const uint8_t level)
|
||||
{
|
||||
universe_->DMX::Universe::setValue(addr, level);
|
||||
}
|
||||
void setDescription(std::string desc);
|
||||
void setOptions(sACN::DATA::data_options o);
|
||||
void setPriority(uint8_t p);
|
||||
void setSyncAddress(uint16_t a);
|
||||
void setValue (const uint16_t addr, const uint8_t level);
|
||||
void setValue (const uint16_t addr, const uint16_t size,
|
||||
const uint8_t* profile)
|
||||
{
|
||||
universe_->DMX::Universe::setValue(addr, size, profile);
|
||||
}
|
||||
|
||||
const uint8_t* profile);
|
||||
|
||||
signals:
|
||||
void changed(sACN::Universe*);
|
||||
|
||||
protected:
|
||||
void dataChangedNotifier(DMX::Universe* universe = nullptr)
|
||||
{
|
||||
Q_UNUSED(universe)
|
||||
emit changed(universe_);
|
||||
};
|
||||
void dataChangedNotifier(DMX::Universe* universe = nullptr);
|
||||
|
||||
private:
|
||||
sACN::Universe *universe_;
|
||||
|
|
Loading…
Reference in New Issue