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.

56 lines
1.6 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 to inspect LightTransformer data from
  8. * within other classes.
  9. *
  10. * This interface is required for the ColorTransitionHandler, so it can
  11. * check whether or not a light color transition is in progress.
  12. */
  13. class LightStateTransformerInspector {
  14. public:
  15. virtual bool is_active() = 0;
  16. virtual bool is_transition() = 0;
  17. virtual light::LightColorValues get_end_values() = 0;
  18. virtual float get_progress() = 0;
  19. };
  20. /**
  21. * This is an interface definition that is used to extend the LightState
  22. * class with functionality for disco actions (immediate light updates,
  23. * not publishing or saving the light state).
  24. *
  25. * This interface is required by the DiscoAction class.
  26. */
  27. class LightStateDiscoSupport {
  28. public:
  29. /**
  30. * Stop the disco, by restoring the previously remembered light state.
  31. */
  32. virtual void disco_stop() = 0;
  33. /**
  34. * Do not wait until the next loop() call for the light to write the
  35. * requested state to the light output, but write the new state
  36. * right away.
  37. *
  38. * This allows us to update the state of the light, even when we are
  39. * being called in the middle of another component's loop().
  40. */
  41. virtual void disco_apply() = 0;
  42. /**
  43. * Create a light::LightCall object, with some properties already
  44. * configured for using it as a disco call.
  45. */
  46. virtual light::LightCall make_disco_call(bool save_and_publish) = 0;
  47. };
  48. } // namespace bslamp2
  49. } // namespace xiaomi
  50. } // namespace esphome