-
Notifications
You must be signed in to change notification settings - Fork 1
/
cec.rb
37 lines (34 loc) · 949 Bytes
/
cec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
class CEC < EM::Connection
include MyOperations
def initialize(common)
@common = common
end
def receive_data data
case data
when /Key ([a-zA-Z0-9 \(\)]+):/
key = $1
emulated_key =
case key
when "select" then :enter
when "setup menu" then :network_setup
when "exit", "clear" then :mode
when "red", "F2 (red)" then :call
when "green", "F3 (green)" then :add
when "blue", "F1 (blue)" then :clear
when "Fast forward" then :next
when "rewind" then :previous
when "backward" then :rewind
when "backward" then :rewind
when "play" then :play!
when "pause" then :pause!
when "channel up" then :seek_forward
when "channel down" then :seek_backward
else key.to_sym
end
puts "CEC #{$1}"
@common.denon.on_network_button(emulated_key)
else
puts data
end
end
end