arylatt/Quack

Introduce a state caching

Opened this issue · 0 comments

Currently the duck is not state aware. This means that when a user clicks the duck, there system doesn't know if the duck is quacking at the moment or not.
From an end user point of view this is simply a little confusion when the duck spins besides someone else having turned it off. The issue however is when we want to disable the duck. if the duck gets disabled, whilst on, an human(someone in the office) would be unable to turn it off...

You shuold cache the state so that the system knows if the duck is on or off based on when the program is started. The state could also be updated maybe via API to tell the system that it is currently on or off (incase some weirdness happens).

You could take this one step further, and actiuvely monitor the current between the power and the speaker to see if the duck is on or off at any time.