1
0
Fork 0

add a property to track the operating state of the universe

This commit is contained in:
Kevin Matz 2022-11-21 13:24:21 -05:00
parent 718a3dd22f
commit e76fd2f603
2 changed files with 25 additions and 0 deletions

View File

@ -32,6 +32,7 @@ namespace DMX {
*/
Universe::Universe(int timeout_period)
: null_start_data({0})
, status_(Status::DMX_NULL)
, rx_timeout_period_(timeout_period)
{
}
@ -158,6 +159,26 @@ void Universe::altSCdata(const std::vector<uint8_t> & data)
}
/**
* @brief Universe::status
* @return
*/
uint8_t Universe::status() const
{
return status_;
}
/**
* @brief Universe::setStatus
* @param val
*/
void Universe::setStatus(uint8_t val)
{
status_ = val;
}
/**
* @brief Universe::setValue
* @param address

View File

@ -72,6 +72,8 @@ class Universe {
DMX_ACTIVE = 1, //!< actively sending/receiving data
DMX_LOST = 2 //!< no activity in E111_DATA_LOSS_TIMEOUT
};
virtual uint8_t status() const;
virtual void setStatus(uint8_t);
protected:
DimmerData null_start_data; //!< NULL Start Code data
@ -80,6 +82,8 @@ class Universe {
std::vector<std::weak_ptr<DataHandler>> callbacks_; //!< list of calback functions
void doDataCallbacks(); //!< execute valid callbacks
uint8_t status_; //!< the operating state of the universe
private:
std::queue<std::chrono::time_point<std::chrono::system_clock>> rx_times_;