GroupState.cpp 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. _isSetOn = 0;
  38. _isSetHue = 0;
  39. _isSetBrightness = 0;
  40. _isSetSaturation = 0;
  41. _isSetMode = 0;
  42. _isSetKelvin = 0;
  43. _isSetBulbMode = 0;
  44. }
  45. bool GroupState::isSetOn() const { return _isSetOn; }
  46. bool GroupState::isOn() const { return _on; }
  47. void GroupState::setOn(bool on) { _on = on; }
  48. bool GroupState::isSetBrightness() const { return _isSetBrightness; }
  49. uint8_t GroupState::getBrightness() const { return _brightness; }
  50. void GroupState::setBrightness(uint8_t brightness) { _brightness = brightness; }
  51. bool GroupState::isSetHue() const { return _isSetHue; }
  52. uint8_t GroupState::getHue() const { return _hue; }
  53. void GroupState::setHue(uint8_t hue) { _hue = hue; }
  54. bool GroupState::isSetSaturation() const { return _isSetSaturation; }
  55. uint8_t GroupState::getSaturation() const { return _saturation; }
  56. void GroupState::setSaturation(uint8_t saturation) { _saturation = saturation; }
  57. bool GroupState::isSetMode() const { return _isSetMode; }
  58. uint8_t GroupState::getMode() const { return _mode; }
  59. void GroupState::setMode(uint8_t mode) { _mode = mode; }
  60. bool GroupState::isSetKelvin() const { return _isSetKelvin; }
  61. uint8_t GroupState::getKelvin() const { return _kelvin; }
  62. void GroupState::setKelvin(uint8_t kelvin) { _kelvin = kelvin; }
  63. bool GroupState::isSetBulbMode() const { return _isSetBulbMode; }
  64. BulbMode GroupState::getBulbMode() const { return static_cast<BulbMode>(_bulbMode); }
  65. void GroupState::setBulbMode(BulbMode bulbMode) { _bulbMode = bulbMode; }