1
0
Fork 0

privatize the active data slot variable

This commit is contained in:
Kevin Matz 2022-11-23 14:28:27 -05:00
parent 9e94c406fd
commit 29fd1fc9ed
2 changed files with 15 additions and 15 deletions

View File

@ -33,9 +33,9 @@ namespace sACN {
*/
Universe::Universe(Source* src)
: DMX::Universe(E131_NETWORK_DATA_LOSS_TIMEOUT)
, active_data_slots(1) // start code
, provenance_(std::make_shared<DATA::data_header>())
, source_(src)
, active_data_slots_(1) // start code
, sync_sequence_(0)
, tx_worker_(&Universe::tx_loop_, this)
{
@ -109,7 +109,7 @@ void Universe::set(ACN::PDU::Message<ACN::DMP::Pdu> dmp,
if (range.count < 1 || range.count > 513)
return;
active_data_slots = range.address + range.count;
active_data_slots_ = range.address + range.count;
setProvenance(source);
if (/// > \cite sACN 6.2.4.1 If a receiver is presented with an E1.31 Data
@ -228,7 +228,7 @@ std::shared_ptr<Universe> Universe::addNewSource(const DATA::data_header&)
*/
uint16_t Universe::activeSlots()
{
return active_data_slots;
return active_data_slots_;
}
@ -242,8 +242,8 @@ void Universe::setValue(const uint16_t address, const uint8_t value)
return;
// set active_data_slots to at least this address
if (address >= active_data_slots)
active_data_slots = address + 1; // + start code
if (address >= active_data_slots_)
active_data_slots_ = address + 1; // + start code
// data not changed!
if (slot(address) == value)
@ -268,8 +268,8 @@ void Universe::setValue (const uint16_t start, const uint16_t footprint,
return;
// set active_data_slots to at least end of footprint
if (start + footprint >= active_data_slots)
active_data_slots = start + footprint + 1; // + start code
if (start + footprint >= active_data_slots_)
active_data_slots_ = start + footprint + 1; // + start code
// get a copy of the current values
null_start_mutex.lock();
@ -379,7 +379,7 @@ void Universe::sACNsend() const
ACN::DMP::range pr(*addrtyp);
pr.address = 0;
pr.incriment = 1;
pr.count = (active_data_slots <= 513 ? active_data_slots : 513);
pr.count = (active_data_slots_ <= 513 ? active_data_slots_ : 513);
// property data
std::vector<octet> pd;

View File

@ -98,7 +98,12 @@ public:
protected:
void sACNsend() const;
/**
private:
std::shared_ptr<DATA::data_header> provenance_;
std::vector<uint8_t> * sync_data_ = nullptr;
Source* source_;
/**
* @brief \cite sACN 3.7 Active Data Slots
*
* > When translating ANSI E1.11 DMX512-A \cite DMX to E1.31, the active data
@ -109,12 +114,7 @@ protected:
* > the DMP First Property Address and DMP Property Count fields shown in
* > Table 4-1.
*/
uint16_t active_data_slots;
private:
std::shared_ptr<DATA::data_header> provenance_;
std::vector<uint8_t> * sync_data_ = nullptr;
Source* source_;
uint16_t active_data_slots_;
/// > \cite sACN 6.3.2 E1.31 Synchronization Packet: Sequence Number
/// >