configurable hold-last-look
This commit is contained in:
parent
7039696807
commit
abbfe6ee0d
|
@ -70,6 +70,7 @@
|
|||
<string>sACN</string>
|
||||
</property>
|
||||
<addaction name="actionDiscovery"/>
|
||||
<addaction name="actionHold_Last_Look"/>
|
||||
</widget>
|
||||
<addaction name="menuNetwork"/>
|
||||
<addaction name="menuEPI_19"/>
|
||||
|
@ -226,6 +227,23 @@
|
|||
<string>Ctrl+D</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionHold_Last_Look">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Hold Last Look</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Retain at least 1 inacitve source.</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
|
|
@ -32,6 +32,7 @@ namespace sACN {
|
|||
ArbitratingUniverse::ArbitratingUniverse()
|
||||
: sACN::Universe()
|
||||
, expectedUniverse(0)
|
||||
, HoldLastLook(true)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -44,6 +45,26 @@ ArbitratingUniverse::~ArbitratingUniverse()
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief ArbitratingUniverse::setHoldLastLook
|
||||
* @param state
|
||||
*/
|
||||
void ArbitratingUniverse::setHoldLastLook(const bool state)
|
||||
{
|
||||
HoldLastLook = state;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief ArbitratingUniverse::getHoldLastLook
|
||||
* @return
|
||||
*/
|
||||
bool ArbitratingUniverse::getHoldLastLook() const
|
||||
{
|
||||
return HoldLastLook;
|
||||
}
|
||||
|
||||
|
||||
const std::vector<DATA::data_header> ArbitratingUniverse::sources() const
|
||||
{
|
||||
std::vector<DATA::data_header> keys;
|
||||
|
@ -246,8 +267,8 @@ std::shared_ptr<Universe> ArbitratingUniverse::dominant_()
|
|||
{
|
||||
auto universe = it->second;
|
||||
|
||||
if (!ret)
|
||||
{ // anything is better than nothing!
|
||||
if (!ret && HoldLastLook)
|
||||
{ // anything is better than nothing
|
||||
++it;
|
||||
ret = universe;
|
||||
continue;
|
||||
|
|
|
@ -61,6 +61,9 @@ public:
|
|||
|
||||
uint16_t expectedUniverse; ///< Expected universe number
|
||||
|
||||
void setHoldLastLook(const bool);
|
||||
bool getHoldLastLook() const;
|
||||
|
||||
// Source universes:
|
||||
void deleteSourceUniverse(const DATA::data_header&);
|
||||
void dataChangedNotifier(DMX::Universe* universe);
|
||||
|
@ -91,6 +94,7 @@ public:
|
|||
private:
|
||||
std::unordered_map<DATA::data_header, std::shared_ptr<Universe>> sources_;
|
||||
std::vector<std::function<void()>> cb_sourceListChange; //!< list of calback functions
|
||||
bool HoldLastLook;
|
||||
|
||||
std::shared_ptr<Universe> dominant_();
|
||||
bool hasSourceUniverse(const DATA::data_header&) const;
|
||||
|
|
|
@ -36,6 +36,7 @@ namespace sACN {
|
|||
*/
|
||||
Receiver::Receiver(UUID::uuid cid)
|
||||
: Component(cid)
|
||||
, HoldLastLook(true)
|
||||
{
|
||||
fctn_ = "OpenLCP sACN Receiver";
|
||||
|
||||
|
@ -56,6 +57,18 @@ Receiver::~Receiver()
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Receiver::setHoldLastLook
|
||||
* @param state
|
||||
*/
|
||||
void Receiver::setHoldLastLook(const bool state)
|
||||
{
|
||||
HoldLastLook = state;
|
||||
for (const auto & [_, universe] : universes_)
|
||||
universe->setHoldLastLook(state);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Receiver::subscribe
|
||||
* @param num
|
||||
|
@ -66,6 +79,7 @@ void Receiver::subscribe(const uint16_t num)
|
|||
return;
|
||||
universes_.emplace(num, std::make_shared<ArbitratingUniverse>());
|
||||
universes_.at(num)->expectedUniverse = num;
|
||||
universes_.at(num)->setHoldLastLook(HoldLastLook);
|
||||
}
|
||||
|
||||
|
||||
|
@ -222,7 +236,11 @@ void Receiver::dataFrameHandler(ACN::PDU::Message<DATA::Pdu> frame) {
|
|||
/// > Any property values in an E1.31 Data Packet containing this bit
|
||||
/// > shall be ignored.
|
||||
if (source->options.stream_terminated)
|
||||
return universes_[source->universe]->deleteSourceUniverse(*source);
|
||||
{
|
||||
auto universe = universes_.at(source->universe);
|
||||
if (universe->sources().size() > 1 || !HoldLastLook)
|
||||
return universes_[source->universe]->deleteSourceUniverse(*source);
|
||||
}
|
||||
|
||||
/// > \cite sACN 6.2.4.1 Synchronization Address Usage in an E1.31 Data Packet
|
||||
/// >
|
||||
|
|
|
@ -69,6 +69,8 @@ public:
|
|||
Receiver(UUID::uuid = UUID::uuid());
|
||||
~Receiver();
|
||||
|
||||
void setHoldLastLook(const bool);
|
||||
|
||||
virtual void subscribe(const uint16_t);
|
||||
virtual void unsubscribe(const uint16_t);
|
||||
std::shared_ptr<Universe> universe(const uint16_t);
|
||||
|
@ -98,6 +100,7 @@ protected:
|
|||
private:
|
||||
std::unordered_map<uint16_t, std::shared_ptr<ArbitratingUniverse>> universes_;
|
||||
std::vector<std::function<void()>> discoveryCallbacks_;
|
||||
bool HoldLastLook;
|
||||
};
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue