publicly indicate if universe is tx or rx
This commit is contained in:
parent
64046967ce
commit
41686e32af
@ -161,12 +161,25 @@ void Universe::setProvenance(std::shared_ptr<DATA::data_header> source)
|
|||||||
*/
|
*/
|
||||||
bool Universe::isSyncronized() const
|
bool Universe::isSyncronized() const
|
||||||
{
|
{
|
||||||
return (sync_data_ != nullptr);
|
return (!sync_data_);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Universe::isEditable
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
bool Universe::isEditable() const
|
||||||
|
{
|
||||||
|
return (source_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Universe::setValue (const uint16_t address, const uint8_t value)
|
void Universe::setValue (const uint16_t address, const uint8_t value)
|
||||||
{
|
{
|
||||||
|
if (!isEditable())
|
||||||
|
return;
|
||||||
|
|
||||||
// address valid?
|
// address valid?
|
||||||
if (address < 1 || address > null_start_data.size())
|
if (address < 1 || address > null_start_data.size())
|
||||||
return;
|
return;
|
||||||
@ -190,6 +203,9 @@ void Universe::setValue (const uint16_t address, const uint8_t value)
|
|||||||
void Universe::setValue (const uint16_t start, const uint16_t footprint,
|
void Universe::setValue (const uint16_t start, const uint16_t footprint,
|
||||||
const uint8_t* data)
|
const uint8_t* data)
|
||||||
{
|
{
|
||||||
|
if (!isEditable())
|
||||||
|
return;
|
||||||
|
|
||||||
// start and footprint valid?
|
// start and footprint valid?
|
||||||
if (start < 1 || start + footprint >= null_start_data.size())
|
if (start < 1 || start + footprint >= null_start_data.size())
|
||||||
return;
|
return;
|
||||||
@ -328,8 +344,8 @@ void Universe::sACNsend() const
|
|||||||
*/
|
*/
|
||||||
void Universe::tx_loop_()
|
void Universe::tx_loop_()
|
||||||
{
|
{
|
||||||
// rx universes, by definition, won't have a source set
|
// rx universes, by definition, don't need to tx.
|
||||||
if (!source_)
|
if (!isEditable())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// run at least 1 loop
|
// run at least 1 loop
|
||||||
@ -401,11 +417,7 @@ void Universe::tx_loop_()
|
|||||||
|
|
||||||
// sleep before the next cycle
|
// sleep before the next cycle
|
||||||
if (enable)
|
if (enable)
|
||||||
{
|
|
||||||
mtx.lock();
|
|
||||||
tx_request_.wait_for(mtx, sleep);
|
tx_request_.wait_for(mtx, sleep);
|
||||||
mtx.unlock();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,6 +58,8 @@ public:
|
|||||||
virtual bool isSyncronized() const;
|
virtual bool isSyncronized() const;
|
||||||
virtual void synchronize(uint8_t = 0);
|
virtual void synchronize(uint8_t = 0);
|
||||||
|
|
||||||
|
bool isEditable() const;
|
||||||
|
|
||||||
// DMX::Universe overrides
|
// DMX::Universe overrides
|
||||||
void setValue (const uint16_t address, const uint8_t value) override;
|
void setValue (const uint16_t address, const uint8_t value) override;
|
||||||
void setValue (const uint16_t start, const uint16_t footprint,
|
void setValue (const uint16_t start, const uint16_t footprint,
|
||||||
|
Loading…
Reference in New Issue
Block a user