onkyo_eiscp_ruby 2.1.2 → 2.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e9c2fd0e9e79716c2b0a084a6dd7859597732f86fb71c1f4bcd4462c8e9297b
4
- data.tar.gz: df71853616b26d2f62f6490b99f263d2a5bb2590c4de4bc7b1930fab14604ea5
3
+ metadata.gz: 48590d7db6afad487744a9ba5d783b58c3af158c3ba73adb441c23d9f493ea3b
4
+ data.tar.gz: d2c0e99074b3ae9dd9f5b32db926262236c4aea4f640f41fae01e2e13ad04c30
5
5
  SHA512:
6
- metadata.gz: 5377a5163b1219647c708b0d125b1359108d3ebbd91bd4f2c8916a002aa4b83363d2531e0340deddc77a2251e2701cd26cb4fe9ab3b4a4c551a496ed2c20d6b0
7
- data.tar.gz: fabc67566fb94c98b743c1db76173f86e3de03333ccad16dda9e5dbeb09747a2bad4ec62867593de404633065819644f0574e22c2c492e209d6f0bf17a609482
6
+ metadata.gz: e218b06b48938a41c7ce8301c8a7d697a8bae0f04eb9ba6214324ebeb1e115e769516230b48a884c535ffa191e129553d169a22eebce9ec923a8c428efc5ab56
7
+ data.tar.gz: 21113da05277c8e18dc6cfa64a4704f3495f606d6fed666f0100ed4ff457989baa09ac0252e96a403881cd0283d5cd8d919bc811c38a63ef019254fd55fdccc6
data/README.md CHANGED
@@ -3,21 +3,24 @@ onkyo_eiscp_ruby
3
3
  [![Gem Version](https://badge.fury.io/rb/onkyo_eiscp_ruby.png)](http://badge.fury.io/rb/onkyo_eiscp_ruby)
4
4
  [![GitHub version](https://badge.fury.io/gh/mikerodrigues%2Fonkyo_eiscp_ruby.png)](http://badge.fury.io/gh/mikerodrigues%2Fonkyo_eiscp_ruby)
5
5
 
6
- *A Ruby implementation of eISCP for controlling Onkyo receivers.*
6
+ *A Ruby implementation of eISCP (ethernet Integra Serial Control Protocol) for controlling Onkyo receivers.*
7
7
 
8
- **This code is not really still under development and using it might still make you sick.**
8
+ **I'm still sort of updating this code. Please feel free to reach out if there's something you need that it doesn't do, I may be willing to help.**
9
9
 
10
10
  **The python version linked below sees much more activity.**
11
11
 
12
- Automatically discover receivers in the broadcast domain
13
12
 
14
- Send commands to receivers and parse returned messages
13
+ Features
14
+ ---------------
15
+ * Automatically discover receivers in the broadcast domain
16
+
17
+ * Send commands to receivers and parse returned messages
15
18
 
16
- Open a TCP socket to receive solicited and non-solicited status updates.
19
+ * Open a TCP socket to receive solicited and non-solicited status updates.
17
20
 
18
- Mock reciever (currently only responds to discovery)
21
+ * Mock reciever (currently only responds to discovery)
19
22
 
20
- Human-readable commands
23
+ * Human-readable commands
21
24
 
22
25
  **Inspired by https://github.com/miracle2k/onkyo-eiscp
23
26
 
@@ -40,7 +43,11 @@ What's missing?
40
43
 
41
44
  Using the Library
42
45
  -----------------
43
- * require the library
46
+ * Install the library
47
+
48
+ gem install onkyo_eiscp_ruby
49
+
50
+ * Require the library
44
51
 
45
52
  require 'eiscp'
46
53
 
@@ -162,6 +169,11 @@ Using the Library
162
169
 
163
170
  # Set the master volume to 45
164
171
  receiver.master_volume "45"
172
+
173
+ # Change the input to TV/CD
174
+ # Note: when a command value has more than one name (an array in the YAML file)
175
+ # we default to using the first entry. So for `['cd', 'tv', 'cd']` you get:
176
+ receiver.input_selector "cd"
165
177
  ```
166
178
 
167
179
  * Parse ISCP and human readable strings:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.2
1
+ 2.1.4
data/lib/eiscp.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  # Library for controlling Onkyo receivers over TCP/IP.
4
4
  #
5
5
  module EISCP
6
- VERSION = '2.1.2'
6
+ VERSION = '2.1.4'
7
7
  end
8
8
 
9
9
  require_relative './eiscp/receiver'
data/lib/eiscp/message.rb CHANGED
@@ -53,13 +53,11 @@ module EISCP
53
53
  # @param [String] value variable length ISCP command value
54
54
  # @param [String] unit_type_character override default unit type character, optional
55
55
  # @param [String] start_character override default start character, optional
56
- def initialize(command: nil, value: nil, terminator: "\r\n", unit_type: '1', start: '!')
56
+ def initialize(command: nil, value: '', terminator: "\r\n", unit_type: '1', start: '!')
57
57
  unless Dictionary.known_command?(command)
58
58
  # STDERR.puts "Unknown command #{command}"
59
59
  end
60
60
 
61
- raise 'No value specified.' if value.nil?
62
-
63
61
  @command = command
64
62
  @value = value
65
63
  @terminator = terminator
@@ -133,6 +133,9 @@ module EISCP
133
133
  # Sends an EISCP::Message object or string on the network
134
134
  #
135
135
  def send(eiscp)
136
+ if (@socket.nil? || @socket.closed?) then
137
+ connect
138
+ end
136
139
  if eiscp.is_a? EISCP::Message
137
140
  @socket.puts(eiscp.to_eiscp)
138
141
  elsif eiscp.is_a? String
@@ -171,7 +174,7 @@ module EISCP
171
174
  #
172
175
  def human_readable_state
173
176
  hash = {}
174
- @state.each do |c, v|
177
+ @state.dup.each do |c, v|
175
178
  hash[Dictionary.command_to_name(c).to_s] = (Dictionary.command_value_to_value_name(c, v) || v.to_s).to_s
176
179
  end
177
180
  hash
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onkyo_eiscp_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Rodrigues
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-21 00:00:00.000000000 Z
11
+ date: 2021-03-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: "\n Control Onkyo receivers over the network.Use the provided binary
14
14
  or\n require the library for use in your scripts.\n "