GroupState.cpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #include <GroupState.h>
  2. GroupId::GroupId()
  3. : deviceId(0),
  4. groupId(0),
  5. deviceType(REMOTE_TYPE_UNKNOWN)
  6. { }
  7. GroupId::GroupId(const GroupId &other)
  8. : deviceId(other.deviceId),
  9. groupId(other.groupId),
  10. deviceType(other.deviceType)
  11. { }
  12. GroupId::GroupId(
  13. const uint16_t deviceId, const uint8_t groupId, const MiLightRemoteType deviceType
  14. )
  15. : deviceId(deviceId),
  16. groupId(groupId),
  17. deviceType(deviceType)
  18. { }
  19. void GroupId::operator=(const GroupId &other) {
  20. deviceId = other.deviceId;
  21. groupId = other.groupId;
  22. deviceType = other.deviceType;
  23. }
  24. bool GroupId::operator==(const GroupId &other) {
  25. return deviceId == other.deviceId
  26. && groupId == other.groupId
  27. && deviceType == other.deviceType;
  28. }
  29. GroupState::GroupState() {
  30. _on = 0;
  31. _brightness = 0;
  32. _hue = 0;
  33. _saturation = 0;
  34. _mode = 0;
  35. _bulbMode = 0;
  36. _kelvin = 0;
  37. }
  38. bool GroupState::isOn() { return _on; }
  39. void GroupState::setOn(bool on) { _on = on; }
  40. uint8_t GroupState::getBrightness() const { return _brightness; }
  41. void GroupState::setBrightness(uint8_t brightness) { _brightness = brightness; }
  42. uint8_t GroupState::getHue() { return _hue; }
  43. void GroupState::setHue(uint8_t hue) { _hue = hue; }
  44. uint8_t GroupState::getSaturation() { return _saturation; }
  45. void GroupState::setSaturation(uint8_t saturation) { _saturation = saturation; }
  46. uint8_t GroupState::getMode() { return _mode; }
  47. void GroupState::setMode(uint8_t mode) { _mode = mode; }
  48. uint8_t GroupState::getKelvin() { return _kelvin; }
  49. void GroupState::setKelvin(uint8_t kelvin) { _kelvin = kelvin; }
  50. BulbMode GroupState::getBulbMode() { return static_cast<BulbMode>(_bulbMode); }
  51. void GroupState::setBulbMode(BulbMode bulbMode) { _bulbMode = bulbMode; }