Class: MachineHead::Device
- Inherits:
-
Object
- Object
- MachineHead::Device
- Defined in:
- lib/machine_head/device.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#tuners ⇒ Object
readonly
Returns the value of attribute tuners.
Class Method Summary collapse
Instance Method Summary collapse
- #get(command) ⇒ Object
-
#initialize(id = 'FFFFFFFF') ⇒ Device
constructor
A new instance of Device.
- #set(command, data) ⇒ Object
Constructor Details
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/machine_head/device.rb', line 3 def id @id end |
#tuners ⇒ Object (readonly)
Returns the value of attribute tuners.
3 4 5 |
# File 'lib/machine_head/device.rb', line 3 def tuners @tuners end |
Class Method Details
.discover ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/machine_head/device.rb', line 25 def self.discover devices = [] `#{TOOL_PATH} discover`.each_line do |line| device = line.match(/^hdhomerun device ([0-9A-F]{8}) found/) devices << self.new(device[1]) if device end devices end |
Instance Method Details
#get(command) ⇒ Object
11 12 13 |
# File 'lib/machine_head/device.rb', line 11 def get(command) `#{TOOL_PATH} #{id} get #{command}` end |
#set(command, data) ⇒ Object
15 16 17 |
# File 'lib/machine_head/device.rb', line 15 def set(command, data) `#{TOOL_PATH} #{id} set #{command} #{data}` end |