1
0
Fork 0

publicly indicate if universe is tx or rx

This commit is contained in:
Kevin Matz 2021-09-02 13:17:47 -04:00
parent 64046967ce
commit 41686e32af
2 changed files with 22 additions and 8 deletions

View File

@ -161,12 +161,25 @@ void Universe::setProvenance(std::shared_ptr<DATA::data_header> source)
*/
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)
{
if (!isEditable())
return;
// address valid?
if (address < 1 || address > null_start_data.size())
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,
const uint8_t* data)
{
if (!isEditable())
return;
// start and footprint valid?
if (start < 1 || start + footprint >= null_start_data.size())
return;
@ -328,8 +344,8 @@ void Universe::sACNsend() const
*/
void Universe::tx_loop_()
{
// rx universes, by definition, won't have a source set
if (!source_)
// rx universes, by definition, don't need to tx.
if (!isEditable())
return;
// run at least 1 loop
@ -401,11 +417,7 @@ void Universe::tx_loop_()
// sleep before the next cycle
if (enable)
{
mtx.lock();
tx_request_.wait_for(mtx, sleep);
mtx.unlock();
}
tx_request_.wait_for(mtx, sleep);
}
}

View File

@ -58,6 +58,8 @@ public:
virtual bool isSyncronized() const;
virtual void synchronize(uint8_t = 0);
bool isEditable() const;
// DMX::Universe overrides
void setValue (const uint16_t address, const uint8_t value) override;
void setValue (const uint16_t start, const uint16_t footprint,