Module: Sonos::Endpoint::Device
- Included in:
- Device::Speaker
- Defined in:
- lib/sonos/endpoint/device.rb
Constant Summary collapse
- DEVICE_ENDPOINT =
'/DeviceProperties/Control'
- DEVICE_XMLNS =
'urn:schemas-upnp-org:service:DeviceProperties:1'
Instance Method Summary collapse
-
#create_pair_with(right) ⇒ Object
Create a stereo pair of two speakers.
- #separate_pair ⇒ Object
-
#status_light_enabled=(enabled) ⇒ Object
Turn the white status light on or off.
-
#status_light_enabled? ⇒ Boolean
Retrieve the status light state; true if on, false otherwise.
Instance Method Details
#create_pair_with(right) ⇒ Object
Create a stereo pair of two speakers. This does not take into account which type of players support bonding. Currently only S1/S3 (play:1/play:3) support this but future players may gain this abbility too. The speaker on which this method is called is assumed to be the left speaker of the pair.
25 26 27 28 29 |
# File 'lib/sonos/endpoint/device.rb', line 25 def create_pair_with(right) left = self.uid.sub!('uuid:', '') right = right.uid.sub!('uuid:', '') parse_response = ('AddBondedZones', "#{left}:LF,LF;#{right}:RF,RF") end |
#separate_pair ⇒ Object
31 32 33 |
# File 'lib/sonos/endpoint/device.rb', line 31 def separate_pair parse_response = ('RemoveBondedZones', '') end |
#status_light_enabled=(enabled) ⇒ Object
Turn the white status light on or off
15 16 17 |
# File 'lib/sonos/endpoint/device.rb', line 15 def status_light_enabled=(enabled) parse_response ('SetLEDState', enabled ? 'On' : 'Off') end |
#status_light_enabled? ⇒ Boolean
Retrieve the status light state; true if on, false otherwise.
6 7 8 9 10 11 |
# File 'lib/sonos/endpoint/device.rb', line 6 def status_light_enabled? response = ('GetLEDState', '') body = response.body[:get_led_state_response] body[:current_led_state] == 'On' ? true : false end |