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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 630564090e5fbf436a4384d2aff86c3f51d8dcd60e69e82121730107dcb82deb
4
- data.tar.gz: 4dfffa50df36bf315fb476d472d9de125e01c670c823e1c881b66189e5a5351b
3
+ metadata.gz: 4e48ad0a8b0c004f0e7a931eed8b923bb06329af40db33c7d89b51831591531a
4
+ data.tar.gz: 292b04a8dca57285dbfea326a38b86bc6fb8e67e1ebb60215b49bdb236eecc94
5
5
  SHA512:
6
- metadata.gz: 2abd880200ab09af611fe31b31ca8299d189cf05f1448cc59773972f6c4e8929c120fdc533f2b7c246cde8a3621fbeeb6d562ef18f233b8b1ae63536708c2678
7
- data.tar.gz: f110bb9840aac1b485c8e12f42b34cbb0d4a578d9f6e3852591480b59f450715d08da33b166e3eb4381152139aef3e0b8e09a9fd2a65be31a41183cfd7b4fa70
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Seriamp
4
- VERSION = '0.1.4'
4
+ VERSION = '0.1.5'
5
5
  end
@@ -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
@@ -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
- if %w(. -).include?(value)
84
- method = "#{prefix}_mute"
85
- value = true
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
- method = "#{prefix}_volume_db"
88
- if value[0] == ','
89
- value = value[1..]
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
- value = Float(value)
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)
@@ -66,6 +66,14 @@ module Seriamp
66
66
  set_zone2_volume(value)
67
67
  end
68
68
 
69
+ def main_volume_up
70
+ remote_command('7A1A')
71
+ end
72
+
73
+ def main_volume_down
74
+ remote_command('7A1B')
75
+ end
76
+
69
77
  def zone2_volume_up
70
78
  remote_command('7ADA')
71
79
  end
data/seriamp.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "seriamp"
5
- spec.version = '0.1.4'
5
+ spec.version = '0.1.5'
6
6
  spec.authors = ['Oleg Pudeyev']
7
7
  spec.email = ['code@olegp.name']
8
8
  spec.summary = %q{Serial control for amplifiers & A/V receivers}
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
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-30 00:00:00.000000000 Z
11
+ date: 2022-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: serialport