Class: Chromecast::Channel::Receiver
- Inherits:
-
Base
- Object
- Base
- Chromecast::Channel::Receiver
show all
- Defined in:
- lib/chromecast/channel/receiver.rb
Constant Summary
collapse
- NAMESPACE =
'urn:x-cast:com.google.cast.receiver'
Instance Attribute Summary
Attributes inherited from Base
#connection, #namespace, #type
Instance Method Summary
collapse
Constructor Details
#initialize(connection) ⇒ Receiver
Returns a new instance of Receiver.
6
7
8
9
|
# File 'lib/chromecast/channel/receiver.rb', line 6
def initialize connection
super(connection, NAMESPACE, :json)
@request_id = 0
end
|
Instance Method Details
#get_app_availability(apps) ⇒ Object
23
24
25
|
# File 'lib/chromecast/channel/receiver.rb', line 23
def get_app_availability apps
send(type: 'GET_APP_AVAILABILITY', appId: [apps].flatten)
end
|
#get_status ⇒ Object
19
20
21
|
# File 'lib/chromecast/channel/receiver.rb', line 19
def get_status
send(type: 'GET_STATUS')
end
|
#launch(app_id) ⇒ Object
11
12
13
|
# File 'lib/chromecast/channel/receiver.rb', line 11
def launch app_id
send(type: 'LAUNCH', appId: app_id)
end
|
#mute ⇒ Object
31
32
33
|
# File 'lib/chromecast/channel/receiver.rb', line 31
def mute
send(type: 'SET_VOLUME', volume: {muted: true})
end
|
#set_volume(level) ⇒ Object
27
28
29
|
# File 'lib/chromecast/channel/receiver.rb', line 27
def set_volume level
send(type: 'SET_VOLUME', volume: {level: level})
end
|
#stop(session_id) ⇒ Object
15
16
17
|
# File 'lib/chromecast/channel/receiver.rb', line 15
def stop session_id
send(type: 'STOP', sessionId: session_id)
end
|
#unmute ⇒ Object
35
36
37
|
# File 'lib/chromecast/channel/receiver.rb', line 35
def unmute
send(type: 'SET_VOLUME', volume: {muted: false})
end
|