seriamp 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +41 -0
- data/lib/seriamp/version.rb +1 -1
- data/lib/seriamp/yamaha/app.rb +33 -0
- data/lib/seriamp/yamaha/cmd.rb +21 -13
- data/lib/seriamp/yamaha/protocol/methods.rb +8 -0
- data/seriamp.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e48ad0a8b0c004f0e7a931eed8b923bb06329af40db33c7d89b51831591531a
|
4
|
+
data.tar.gz: 292b04a8dca57285dbfea326a38b86bc6fb8e67e1ebb60215b49bdb236eecc94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb8b19b6288bfe4b248aaaa1dffe26f801b64729af28923a8501222e05c8978747337c9d61b22d2794c2d6f33ebc16e831272569add01420c24ac9786674c5cd
|
7
|
+
data.tar.gz: f1fe372b20b6bd95f33637c3157d6cc210d03c3cd7e6047061657095ef07abc891c6a38b85c9788d0329898ff7e4506687cc9661ca411de0582c0367a9c5f6df
|
data/README.md
CHANGED
@@ -1,5 +1,46 @@
|
|
1
1
|
# Yamaha Receiver Serial Control Ruby Library
|
2
2
|
|
3
|
+
## Hardware Requirements
|
4
|
+
|
5
|
+
I used USB to serial adapters with both Prolific PL2303 and FTDI chips.
|
6
|
+
Both chipsets work under Linux. The FTDI chipset appears to buffer the
|
7
|
+
incoming data - when reading from the device, it returns more than one
|
8
|
+
character at a time, whereas with the Prolific chipset only one character at
|
9
|
+
a time is returned. This means the FTDI chip can possibly offer faster
|
10
|
+
communication. Adapters based on the FTDI chip are also more expensive.
|
11
|
+
|
12
|
+
On Windows, FTDI provides drivers for at least Windows 7, however they
|
13
|
+
are not signed. Windows can be booted with the option to skip driver
|
14
|
+
signing enforcement, which makes the adapter work. I couldn't locate a
|
15
|
+
working Prolific driver for Windows 7.
|
16
|
+
|
17
|
+
These USB to serial adapters all have male connection on the RS232 end.
|
18
|
+
As such, no additional cable is needed if communicating with a receiver
|
19
|
+
that requires a straight cable and has a female terminal (such as the
|
20
|
+
Denon AVR-2308CI). For other receivers a gender changer or a cable is
|
21
|
+
necessary.
|
22
|
+
|
23
|
+
### Sonance Sonamp 875D / 875D MK II
|
24
|
+
|
25
|
+
- 3-pin cable should be sufficient according to manual
|
26
|
+
- Null-modem cable required
|
27
|
+
- Receiver socket is female
|
28
|
+
|
29
|
+
### Yamaha RX-V**00
|
30
|
+
|
31
|
+
- 5-pin cable required (with RTS pin connected)
|
32
|
+
- Null-modem cable required
|
33
|
+
- Receiver socket is male
|
34
|
+
|
35
|
+
### Denon AVR-2308CI
|
36
|
+
|
37
|
+
- Straight cable required
|
38
|
+
- Receiver socket is female
|
39
|
+
|
40
|
+
### Integra DTR
|
41
|
+
|
42
|
+
- Straight cable required
|
43
|
+
|
3
44
|
## Protocol Notes
|
4
45
|
|
5
46
|
### RX-V1500 Power Values
|
data/lib/seriamp/version.rb
CHANGED
data/lib/seriamp/yamaha/app.rb
CHANGED
@@ -42,6 +42,34 @@ module Seriamp
|
|
42
42
|
empty_response
|
43
43
|
end
|
44
44
|
|
45
|
+
post "/#{zone}/volume/up" do
|
46
|
+
client.public_send("#{zone}_volume_up")
|
47
|
+
client.public_send("#{zone}_volume_up")
|
48
|
+
plain_response client.main_volume_db
|
49
|
+
end
|
50
|
+
|
51
|
+
post "/#{zone}/volume/up/:step" do |step|
|
52
|
+
client.public_send("#{zone}_volume_up")
|
53
|
+
step.to_i.times do
|
54
|
+
client.public_send("#{zone}_volume_up")
|
55
|
+
end
|
56
|
+
plain_response client.main_volume_db
|
57
|
+
end
|
58
|
+
|
59
|
+
post "/#{zone}/volume/down" do
|
60
|
+
client.public_send("#{zone}_volume_down")
|
61
|
+
client.public_send("#{zone}_volume_down")
|
62
|
+
plain_response client.main_volume_db
|
63
|
+
end
|
64
|
+
|
65
|
+
post "/#{zone}/volume/down/:step" do |step|
|
66
|
+
client.public_send("#{zone}_volume_down")
|
67
|
+
step.to_i.times do
|
68
|
+
client.public_send("#{zone}_volume_down")
|
69
|
+
end
|
70
|
+
plain_response client.main_volume_db
|
71
|
+
end
|
72
|
+
|
45
73
|
put "/#{zone}/input" do
|
46
74
|
value = request.body.read
|
47
75
|
client.public_send("set_#{zone}_input", value)
|
@@ -71,6 +99,11 @@ module Seriamp
|
|
71
99
|
def empty_response
|
72
100
|
render_json({})
|
73
101
|
end
|
102
|
+
|
103
|
+
def plain_response(data)
|
104
|
+
headers['content-type'] = 'text/plain'
|
105
|
+
data.to_s
|
106
|
+
end
|
74
107
|
end
|
75
108
|
end
|
76
109
|
end
|
data/lib/seriamp/yamaha/cmd.rb
CHANGED
@@ -74,26 +74,34 @@ module Seriamp
|
|
74
74
|
when 'volume'
|
75
75
|
which = args.shift
|
76
76
|
if %w(main zone2 zone3).include?(which)
|
77
|
-
prefix = "set_#{which}"
|
78
77
|
value = args.shift
|
79
78
|
else
|
80
|
-
prefix = 'set_main'
|
81
79
|
value = which
|
80
|
+
which = 'main'
|
82
81
|
end
|
83
|
-
|
84
|
-
|
85
|
-
|
82
|
+
prefix = "set_#{which}"
|
83
|
+
value = value.downcase
|
84
|
+
if value == 'up'
|
85
|
+
# Just like with remote, the first volume up or down command
|
86
|
+
# doesn't do anything.
|
87
|
+
client.public_send("#{which}_volume_up")
|
88
|
+
client.public_send("#{which}_volume_up")
|
89
|
+
elsif value == 'down'
|
90
|
+
client.public_send("#{which}_volume_down")
|
91
|
+
client.public_send("#{which}_volume_down")
|
86
92
|
else
|
87
|
-
|
88
|
-
|
89
|
-
value =
|
93
|
+
if %w(. -).include?(value)
|
94
|
+
method = "#{prefix}_mute"
|
95
|
+
value = true
|
96
|
+
else
|
97
|
+
method = "#{prefix}_volume_db"
|
98
|
+
if value[0] == ','
|
99
|
+
value = value[1..]
|
100
|
+
end
|
101
|
+
value = Float(value)
|
90
102
|
end
|
91
|
-
|
103
|
+
client.public_send(method, value)
|
92
104
|
end
|
93
|
-
client.public_send(method, value)
|
94
|
-
p client.get_main_volume_text
|
95
|
-
p client.get_zone2_volume_text
|
96
|
-
p client.get_zone3_volume_text
|
97
105
|
when 'input'
|
98
106
|
which = args.shift&.downcase
|
99
107
|
if %w(main zone2 zone3).include?(which)
|
data/seriamp.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seriamp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleg Pudeyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: serialport
|