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