onkyo_eiscp_ruby 2.1.5 → 2.1.6

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: d35b01beb072ac7058ef54920b734aff8d4d098ecc702eb9edd21ee818ad7ca0
4
- data.tar.gz: f1112ac834d03f1dea2e50aeed301ac8f0e802b55b00b0f317d7802515ffa84e
3
+ metadata.gz: d3dd4eba4824a8b6f5698a427829515653a327f7e7a9a3439b0c66be8ed71ce1
4
+ data.tar.gz: 5e747f4b17191a38c76067df0461f9a59b7e0e116a78f34c6d8507e1ff06b2f2
5
5
  SHA512:
6
- metadata.gz: f3a50446a0df21efd8dc6b2397daeb0cf791a997e7f0c27bb9d01c98b9e08fdc99cd68176b464882b29acc64a5f9cbe0748da690da51269f10f8f41f3d75dfc7
7
- data.tar.gz: 65bafa48d392b8578435f006de9b27b8e58b9f16d7ccd7e2d527b38f23c0e2db187204c79f9c2dfe121021907735b51f73b82cef8fb82789ac362b5c3fec228f
6
+ metadata.gz: c0053cc9c49574d835e967190edeea8519dd99ef25f3c397046274fb3da3d319292719cc5c002f0a839d69d8da271ad274cf4f449cfbab695c8c00acdeb0df42
7
+ data.tar.gz: 60476141723946c9741f957fea30e3b0709c13907155619e559cd403f6d2abf5c88bd693153cf33a35d47f9f3b07d3444ef14880f641b91d8628e83d9232f812
data/README.md CHANGED
@@ -56,7 +56,7 @@ Using the Library
56
56
  `VERSION`)
57
57
 
58
58
  * You can do most everything through the `Receiver` and `Message` objects. If you
59
- want to accept user input you will probably want to use the Parser module. Be
59
+ want to accept user input you will probably want to use the `Parser` module. Be
60
60
  sure to check out the RDocs or dig through the source code. I try to keep it
61
61
  well commented/documented, and there's more functionality to the library than
62
62
  is shown here:
@@ -82,7 +82,7 @@ Using the Library
82
82
  EISCP::Receiver.discover
83
83
  ```
84
84
 
85
- * Create `Receiver` object from first discovered Receiver on the LAN
85
+ * Create `Receiver` object from first discovered receiver on the LAN
86
86
 
87
87
  ```ruby
88
88
  receiver = EISCP::Receiver.new
@@ -104,8 +104,9 @@ Using the Library
104
104
  end
105
105
  ```
106
106
 
107
- * Receivers created without a block will not connect automatically. You can use
108
- the `connect` method to create a socket and connect to the receiver.
107
+ * `Receivers` created without a block will not connect automatically. If you try
108
+ to send a command it will connect transparently, otherwise you can use the
109
+ `connect` method to explicitly open a socket to the receiver.
109
110
 
110
111
  ```ruby
111
112
  receiver.connect
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.5
1
+ 2.1.6
@@ -34,7 +34,6 @@ module EISCP
34
34
  def self.validate(packet)
35
35
  packet.header.header_size.size == packet.command.size
36
36
  end
37
-
38
37
  end
39
38
 
40
39
  class EISCPParserException < RuntimeError; end
@@ -28,21 +28,23 @@ module EISCP
28
28
  # Returns an array of discovered Receiver objects.
29
29
  #
30
30
  def discover(discovery_port = Receiver::ONKYO_PORT)
31
- sock = UDPSocket.new
32
- sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_BROADCAST, true)
33
- sock.send(ONKYO_MAGIC, 0, '<broadcast>', discovery_port)
34
31
  data = []
35
- loop do
36
- msg, addr = sock.recvfrom_nonblock(1024)
37
- data << Receiver.new(addr[2], ecn_string_to_ecn_array(msg))
38
- rescue IO::WaitReadable
39
- io = IO.select([sock], nil, nil, 0.5)
40
- if io.nil?
41
- return data
42
- else
43
- retry
32
+ Socket.ip_address_list.each do | addr |
33
+ if addr.ipv4?
34
+ sock = UDPSocket.new
35
+ sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_BROADCAST, true)
36
+ sock.bind(addr.ip_address, discovery_port)
37
+ sock.send(ONKYO_MAGIC, 0, '<broadcast>', discovery_port)
38
+ loop do
39
+ msg, addr = sock.recvfrom_nonblock(1024)
40
+ data << Receiver.new(addr[2], ecn_string_to_ecn_array(msg))
41
+ rescue IO::WaitReadable
42
+ io = IO.select([sock], nil, nil, 0.5)
43
+ break if io.nil?
44
+ end
44
45
  end
45
46
  end
47
+ return data
46
48
  end
47
49
  end
48
50
  end
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.5'
6
+ VERSION = '2.1.6'
7
7
  end
8
8
 
9
9
  require_relative './eiscp/receiver'
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.5
4
+ version: 2.1.6
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-30 00:00:00.000000000 Z
11
+ date: 2021-11-18 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 "