Class: Druzy::Protocol::Renderer

Inherits:
Device
  • Object
show all
Defined in:
lib/druzy/protocol/device.rb

Instance Attribute Summary collapse

Attributes inherited from Device

#icon, #identifier, #name, #protocol

Instance Method Summary collapse

Methods inherited from Device

#==

Constructor Details

#initialize(identifier, protocol, name, icon, duration = Time.at(0).utc, time_position = Time.at(0).utc, volume = 100, volume_min = 0, volume_max = 100, mute = false) ⇒ Renderer

Returns a new instance of Renderer.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/druzy/protocol/device.rb', line 30

def initialize(identifier, protocol, name, icon, duration=Time.at(0).utc, time_position=Time.at(0).utc,volume=100,volume_min=0,volume_max=100,mute=false)
  super(identifier,protocol,name,icon)
  @duration = duration
  @time_position = time_position
  @volume = volume
  @volume_min = volume_min
  @volume_max = volume_max
  @mute = mute
  @current_file = nil
  @play = false
  @pause = false
  @stop = true
  
  add_property_change_listener(Druzy::MVC::PropertyChangeListener.new do |event|
    if event.property_name == "play"
      if event.new_value == true
        stop = false
        pause = false
      end
    elsif event.property_name == "pause"
      if event.new_value == true
        pause = false
        stop = false
      end
    elsif event.property_name == "stop"
      if event.new_value == true
        play = false
        pause = false
      end
    end
  end)
end

Instance Attribute Details

#current_fileObject

Returns the value of attribute current_file.



28
29
30
# File 'lib/druzy/protocol/device.rb', line 28

def current_file
  @current_file
end

#durationObject

Returns the value of attribute duration.



28
29
30
# File 'lib/druzy/protocol/device.rb', line 28

def duration
  @duration
end

#muteObject

Returns the value of attribute mute.



28
29
30
# File 'lib/druzy/protocol/device.rb', line 28

def mute
  @mute
end

#time_positionObject

Returns the value of attribute time_position.



28
29
30
# File 'lib/druzy/protocol/device.rb', line 28

def time_position
  @time_position
end

#volumeObject

Returns the value of attribute volume.



28
29
30
# File 'lib/druzy/protocol/device.rb', line 28

def volume
  @volume
end

#volume_maxObject

Returns the value of attribute volume_max.



28
29
30
# File 'lib/druzy/protocol/device.rb', line 28

def volume_max
  @volume_max
end

#volume_minObject

Returns the value of attribute volume_min.



28
29
30
# File 'lib/druzy/protocol/device.rb', line 28

def volume_min
  @volume_min
end

Instance Method Details

#pauseObject



116
117
# File 'lib/druzy/protocol/device.rb', line 116

def pause
end

#pause=(pause) ⇒ Object



103
104
105
106
# File 'lib/druzy/protocol/device.rb', line 103

def pause=(pause)
  @pause, old = pause, @pause
  fire_property_change(Druzy::MVC::PropertyChangeEvent.new(self,"pause",old,@pause))
end

#playObject



113
114
# File 'lib/druzy/protocol/device.rb', line 113

def play
end

#play=(play) ⇒ Object



98
99
100
101
# File 'lib/druzy/protocol/device.rb', line 98

def play=(play)
  @play, old = play, @play
  fire_property_change(Druzy::MVC::PropertyChangeEvent.new(self,"play",old,@play))
end

#send(file) ⇒ Object



122
123
# File 'lib/druzy/protocol/device.rb', line 122

def send(file)
end

#stopObject



119
120
# File 'lib/druzy/protocol/device.rb', line 119

def stop
end

#stop=(stop) ⇒ Object



108
109
110
111
# File 'lib/druzy/protocol/device.rb', line 108

def stop=(stop)
  @stop, old = stop, @stop
  fire_property_change(Druzy::MVC::PropertyChangeEvent.new(self,"stop",old,@stop))
end