noolite.h 830 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef NOOLITE_H
  2. #define NOOLITE_H
  3. #include <vector>
  4. #include <optional>
  5. #include "iusbdevice.h"
  6. namespace noolitelib
  7. {
  8. enum Command
  9. {
  10. Off = 0,
  11. DecraseBrightnes,
  12. On,
  13. IncreaseBrightnes,
  14. Switch,
  15. InvertBrightnes,
  16. Set,
  17. CallScenario,
  18. SaveScenario,
  19. Unbind,
  20. StopColorSelection,
  21. Bind = 15,
  22. // Commands for SD111-180 only
  23. ColorSelection,
  24. ColorSwitch,
  25. ModeSwitch,
  26. EffectSpeed
  27. };
  28. using Params = std::vector<int>;
  29. class Noolite
  30. {
  31. public:
  32. Noolite(IUsbDevice *device = nullptr);
  33. ~Noolite();
  34. bool sendCommand(unsigned char channel, Command command, const Params &params = Params());
  35. private:
  36. IUsbDevice *m_device;
  37. std::optional<Data> composeCommand(unsigned char channel, Command command, const Params &params) const;
  38. };
  39. }
  40. #endif // NOOLITE_H