Class: Milight::RgbwAll
- Inherits:
-
Object
- Object
- Milight::RgbwAll
- Defined in:
- lib/milight/rgbw_all.rb
Constant Summary collapse
- ALL_OFF =
0x41
- ALL_ON =
0x42
- WHITE =
0xC2
- COLOUR =
0x40
- BRIGHTNESS =
0x4E
Instance Method Summary collapse
- #brightness(value) ⇒ Object
- #colour(colour) ⇒ Object
- #hue(hue) ⇒ Object
-
#initialize(commander, colour_helper: Milight::Colour) ⇒ RgbwAll
constructor
A new instance of RgbwAll.
- #off ⇒ Object
- #on ⇒ Object
- #white ⇒ Object
Constructor Details
Instance Method Details
#brightness(value) ⇒ Object
38 39 40 41 42 |
# File 'lib/milight/rgbw_all.rb', line 38 def brightness(value) brightness = Milight::Brightness.new(value) send_brightness_cmd brightness self end |
#colour(colour) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/milight/rgbw_all.rb', line 44 def colour(colour) colour_value = @colour_helper.new(colour) colour_value.greyscale? ? send_white_cmd : send_colour_cmd(colour_value) send_brightness_cmd colour_value self end |
#hue(hue) ⇒ Object
32 33 34 35 36 |
# File 'lib/milight/rgbw_all.rb', line 32 def hue(hue) colour = @colour_helper.new(hue) send_colour_cmd colour self end |
#off ⇒ Object
22 23 24 25 |
# File 'lib/milight/rgbw_all.rb', line 22 def off @commander.send_command ALL_OFF self end |
#on ⇒ Object
17 18 19 20 |
# File 'lib/milight/rgbw_all.rb', line 17 def on @commander.send_command ALL_ON self end |
#white ⇒ Object
27 28 29 30 |
# File 'lib/milight/rgbw_all.rb', line 27 def white send_white_cmd self end |