give all universe callbacks the same signature
This commit is contained in:
parent
738ced6964
commit
5ad7b5505e
|
@ -14,7 +14,7 @@ QSacnUniverse::QSacnUniverse(QObject *parent, std::shared_ptr<sACN::Universe> un
|
|||
return;
|
||||
|
||||
data_change_token = universe_->onDataChange([this](DMX::Universe*){emit dataChanged();});
|
||||
status_change_token = universe_->onStatusChange([this](){emit statusChanged();});
|
||||
status_change_token = universe_->onStatusChange([this](DMX::Universe*){emit statusChanged();});
|
||||
|
||||
if (!universe->isEditable())
|
||||
list_change_token = universe_->onSourceListChange([this](){syncSources();});
|
||||
|
|
|
@ -187,10 +187,10 @@ void Universe::setStatus(uint8_t val)
|
|||
* @param cb
|
||||
* @return
|
||||
*/
|
||||
std::shared_ptr<void> Universe::onStatusChange(std::function<void()> cb)
|
||||
std::shared_ptr<void> Universe::onStatusChange(const std::function<void(Universe*)> cb)
|
||||
{
|
||||
// wrap the callback with a shared pointer
|
||||
auto sp = std::make_shared<std::function<void()>>(std::move(cb));
|
||||
auto sp = std::make_shared<std::function<void(Universe*)>>(std::move(cb));
|
||||
// add callback to list (as a weak pointer)
|
||||
cb_statusChange.push_back(sp);
|
||||
// return token that caller must keep throughout it's scope
|
||||
|
|
|
@ -67,6 +67,7 @@ class Universe {
|
|||
/**
|
||||
* @brief The Status enum
|
||||
*/
|
||||
std::shared_ptr<void> onStatusChange(const std::function<void(Universe*)>);
|
||||
enum Status : uint8_t {
|
||||
DMX_NULL = 0, //!< uninitialized
|
||||
DMX_ACTIVE = 1, //!< actively sending/receiving data
|
||||
|
@ -75,7 +76,6 @@ class Universe {
|
|||
};
|
||||
virtual void setStatus(uint8_t);
|
||||
virtual uint8_t status();
|
||||
virtual std::shared_ptr<void> onStatusChange(std::function<void()>);
|
||||
|
||||
protected:
|
||||
DimmerData null_start_data; //!< NULL Start Code data
|
||||
|
@ -93,8 +93,8 @@ class Universe {
|
|||
const int rx_timeout_period_;
|
||||
|
||||
uint8_t status_; //!< the operating state of the universe
|
||||
std::vector<std::weak_ptr<std::function<void()>>> cb_statusChange;
|
||||
std::vector<std::weak_ptr<DataHandler>> cb_dataChange;
|
||||
std::vector<std::weak_ptr<const std::function<void(Universe*)>>> cb_statusChange;
|
||||
};
|
||||
|
||||
} // namespace DMX
|
||||
|
|
Loading…
Reference in New Issue