Class: StrDn2030::Remote::Zone

Inherits:
Object
  • Object
show all
Defined in:
lib/str_dn_2030/zone.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent, zone_id, volume_type = "\x03".b) ⇒ Zone

Returns a new instance of Zone.



4
5
6
7
8
9
# File 'lib/str_dn_2030/zone.rb', line 4

def initialize(parent, zone_id, volume_type = "\x03".b)
  @parent = parent
  @zone_id = zone_id
  @zone = zone_id.chr('ASCII-8BIT').freeze
  @volume_type = volume_type.dup.b.freeze
end

Instance Attribute Details

#parentObject (readonly)

Returns the value of attribute parent.



11
12
13
# File 'lib/str_dn_2030/zone.rb', line 11

def parent
  @parent
end

#volume_typeObject (readonly)

Returns the value of attribute volume_type.



11
12
13
# File 'lib/str_dn_2030/zone.rb', line 11

def volume_type
  @volume_type
end

#zoneObject (readonly)

Returns the value of attribute zone.



11
12
13
# File 'lib/str_dn_2030/zone.rb', line 11

def zone
  @zone
end

#zone_idObject (readonly) Also known as: id

Returns the value of attribute zone_id.



11
12
13
# File 'lib/str_dn_2030/zone.rb', line 11

def zone_id
  @zone_id
end

Instance Method Details

#active_videoObject Also known as: active_input



46
47
48
# File 'lib/str_dn_2030/zone.rb', line 46

def active_video
  parent.active_input_get(zone_id)
end

#active_video=(other) ⇒ Object Also known as: active_input=



50
51
52
# File 'lib/str_dn_2030/zone.rb', line 50

def active_video=(other)
  parent.active_input_set(zone_id, other)
end

#headphone?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/str_dn_2030/zone.rb', line 34

def headphone?
  parent.status_get(zone_id)[:flags][:headphone]
end

#inputsObject



18
19
20
# File 'lib/str_dn_2030/zone.rb', line 18

def inputs
  parent.inputs[zone_id]
end

#mute=(other) ⇒ Object



30
31
32
# File 'lib/str_dn_2030/zone.rb', line 30

def mute=(other)
  parent.mute_set(zone_id, other)
end

#muted?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/str_dn_2030/zone.rb', line 26

def muted?
  parent.status_get(zone_id)[:flags][:mute]
end

#powered_on?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/str_dn_2030/zone.rb', line 22

def powered_on?
  parent.status_get(zone_id)[:flags][:power]
end

#reloadObject



14
15
16
# File 'lib/str_dn_2030/zone.rb', line 14

def reload
  parent.reload; self
end

#volumeObject



38
39
40
# File 'lib/str_dn_2030/zone.rb', line 38

def volume
  parent.volume_get(zone_id, volume_type)[:volume]
end

#volume=(other) ⇒ Object



42
43
44
# File 'lib/str_dn_2030/zone.rb', line 42

def volume=(other)
  parent.volume_set(zone_id, other, volume_type)
end