Class: Arcenciel::Hub
- Inherits:
-
Object
- Object
- Arcenciel::Hub
- Defined in:
- lib/arcenciel/manager/hub.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#serial_port ⇒ Object
readonly
Returns the value of attribute serial_port.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
-
#server_port ⇒ Object
readonly
Returns the value of attribute server_port.
Instance Method Summary collapse
-
#initialize ⇒ Hub
constructor
A new instance of Hub.
- #listen(path, &blk) ⇒ Object
- #run! ⇒ Object
- #send(command) ⇒ Object
Constructor Details
#initialize ⇒ Hub
Returns a new instance of Hub.
11 12 13 14 15 16 17 |
# File 'lib/arcenciel/manager/hub.rb', line 11 def initialize @serial_port = 12002 @server_port = 10210 @client = OSC::Client.new('localhost', serial_port) @server = OSC::Server.new(server_port) end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
8 9 10 |
# File 'lib/arcenciel/manager/hub.rb', line 8 def client @client end |
#serial_port ⇒ Object (readonly)
Returns the value of attribute serial_port.
5 6 7 |
# File 'lib/arcenciel/manager/hub.rb', line 5 def serial_port @serial_port end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
9 10 11 |
# File 'lib/arcenciel/manager/hub.rb', line 9 def server @server end |
#server_port ⇒ Object (readonly)
Returns the value of attribute server_port.
6 7 8 |
# File 'lib/arcenciel/manager/hub.rb', line 6 def server_port @server_port end |
Instance Method Details
#listen(path, &blk) ⇒ Object
29 30 31 |
# File 'lib/arcenciel/manager/hub.rb', line 29 def listen(path, &blk) server.add_method(path, &blk) end |
#run! ⇒ Object
19 20 21 22 23 |
# File 'lib/arcenciel/manager/hub.rb', line 19 def run! Thread.start do server.run end end |
#send(command) ⇒ Object
25 26 27 |
# File 'lib/arcenciel/manager/hub.rb', line 25 def send(command) client.send(OSC::Message.new(command, 'localhost', server_port)) end |