lib/runner.rb in tg-can-controls-gateway-0.1.0 vs lib/runner.rb in tg-can-controls-gateway-0.1.1
- old
+ new
@@ -13,14 +13,12 @@
:port => nil,
:valve => :closed,
}
include OAttr
- oattr :incoming_osc_port, :device
+ oattr :incoming_osc_port, :device, :valve
- attr_reader :valve
-
def self.instance
@@instance
end
def initialize path, options = {}
@@ -33,10 +31,11 @@
STATION['port'] = Integer(incoming_osc_port)
STATION['device'] = device
STATION['rci_uri'] = device_rci_uri
puts " -- STATION info: #{STATION.inspect}"
+ @options[:valve] = valve.to_sym # type fixing the GOM string
init_gnp
end
def device_rci_uri
@device_rci_uri ||= connection.read "#{device}:rci_uri.txt"
@@ -65,12 +64,12 @@
)
@sub.callback = lambda { |*args| valve_update(*args) }
connection.subscribe @sub
end
- def valve_update op, attribute
- @valve = attribute["value"].to_sym
- puts " -- can-controls-valve now: #{@valve}"
+ def valve_update _, attribute
+ @options[:valve] = attribute["value"].to_sym
+ puts " -- can-controls-valve now: #{valve}"
end
end
__END__