onkyo_eiscp_ruby 0.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +154 -33
- data/VERSION +1 -1
- data/bin/mock_receiver.rb +23 -0
- data/bin/onkyo.rb +50 -23
- data/bin/{onkyo-server.rb → onkyo_server.rb} +1 -1
- data/eiscp-commands.yaml +10329 -10318
- data/lib/eiscp/dictionary/dictionary_generators.rb +67 -0
- data/lib/eiscp/dictionary/dictionary_helpers.rb +118 -0
- data/lib/eiscp/dictionary.rb +54 -0
- data/lib/eiscp/message.rb +97 -73
- data/lib/eiscp/parser/dynamic_value_parser.rb +7 -0
- data/lib/eiscp/parser/eiscp_parser.rb +37 -0
- data/lib/eiscp/parser/human_readable_parser.rb +30 -0
- data/lib/eiscp/parser/iscp_parser.rb +29 -0
- data/lib/eiscp/parser.rb +22 -0
- data/lib/eiscp/receiver/command_methods.rb +29 -0
- data/lib/eiscp/receiver/connection.rb +83 -0
- data/lib/eiscp/receiver/discovery.rb +50 -0
- data/lib/eiscp/receiver.rb +71 -153
- data/lib/eiscp.rb +6 -5
- data/onkyo_eiscp_ruby.gemspec +9 -8
- data/test/tc_dictionary.rb +43 -0
- data/test/tc_message.rb +10 -13
- data/test/tc_parser.rb +33 -0
- data/test/tc_receiver.rb +2 -3
- metadata +27 -14
- data/lib/eiscp/command.rb +0 -99
- data/lib/eiscp/mock_receiver.rb +0 -22
- data/test/tc_command.rb +0 -43
data/lib/eiscp/mock_receiver.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'socket'
|
2
|
-
require 'eiscp/receiver'
|
3
|
-
require 'eiscp/message'
|
4
|
-
|
5
|
-
# Mock server that only responds to ECNQSTN.
|
6
|
-
|
7
|
-
module EISCP
|
8
|
-
class MockReceiver
|
9
|
-
|
10
|
-
ONKYO_DISCOVERY_RESPONSE = Message.new("ECN", "TX-NR609/60128/DX/001122334455")
|
11
|
-
|
12
|
-
# Create/start the server object.
|
13
|
-
|
14
|
-
def initialize
|
15
|
-
Socket.udp_server_loop("255.255.255.255", EISCP::ONKYO_PORT) do |msg, msg_src|
|
16
|
-
msg_src.reply ONKYO_DISCOVERY_RESPONSE.to_eiscp
|
17
|
-
puts msg
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|
data/test/tc_command.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
require_relative "../lib/eiscp/command.rb"
|
2
|
-
require_relative "../lib/eiscp/message.rb"
|
3
|
-
require "test/unit"
|
4
|
-
|
5
|
-
class TestCommand < Test::Unit::TestCase
|
6
|
-
|
7
|
-
def test_command_to_name
|
8
|
-
assert_equal(Command.command_to_name("PWR"), "system-power")
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_command_name_to_command
|
12
|
-
assert_equal(Command.command_name_to_command("system-power"), "PWR")
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_command_value_to_value_name
|
16
|
-
assert_equal(Command.command_value_to_value_name("PWR", "01"), "on")
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_command_value_name_to_value
|
20
|
-
assert_equal(Command.command_value_name_to_value("PWR", "on"), "01")
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_description_from_command_name
|
24
|
-
assert_equal(Command.description_from_command_name("system-power"), "System Power Command")
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_description_from_command
|
28
|
-
assert_equal(Command.description_from_command("PWR"), "System Power Command")
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_parse_system_power
|
32
|
-
assert_equal(Command.parse('system-power on'), EISCP::Message.parse('PWR01'))
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_parse_zone2_system_power
|
36
|
-
assert_equal(Command.parse('zone2 power on'), EISCP::Message.parse('ZPW01'))
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_parse_volume_as_integer
|
40
|
-
assert_equal(Command.parse('main-volume 25'), EISCP::Message.parse('MVL19'))
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|