You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.1 KiB

  1. #pragma once
  2. namespace esphome {
  3. namespace xiaomi {
  4. namespace bslamp2 {
  5. /**
  6. * This is an interface definition that is used to extend the LightState
  7. * class with functionality for disco actions (immediate light updates,
  8. * not publishing or saving the light state).
  9. *
  10. * This interface is required by the DiscoAction class.
  11. */
  12. class LightStateDiscoSupport {
  13. public:
  14. /**
  15. * Stop the disco, by restoring the previously remembered light state.
  16. */
  17. virtual void disco_stop() = 0;
  18. /**
  19. * Do not wait until the next loop() call for the light to write the
  20. * requested state to the light output, but write the new state
  21. * right away.
  22. *
  23. * This allows us to update the state of the light, even when we are
  24. * being called in the middle of another component's loop().
  25. */
  26. virtual void disco_apply() = 0;
  27. /**
  28. * Create a light::LightCall object, with some properties already
  29. * configured for using it as a disco call.
  30. */
  31. virtual light::LightCall make_disco_call(bool save_and_publish) = 0;
  32. };
  33. } // namespace bslamp2
  34. } // namespace xiaomi
  35. } // namespace esphome