Class: CanControlsGateway::OscPackage
- Inherits:
-
Object
- Object
- CanControlsGateway::OscPackage
- Defined in:
- lib/osc_package.rb
Constant Summary collapse
- ADDR =
broadcast address
['<broadcast>', OSC_BROADCAST_PORT]
Instance Method Summary collapse
- #broadcast ⇒ Object
-
#initialize(event, station_id) ⇒ OscPackage
constructor
A new instance of OscPackage.
Constructor Details
#initialize(event, station_id) ⇒ OscPackage
Returns a new instance of OscPackage.
11 12 13 14 |
# File 'lib/osc_package.rb', line 11 def initialize event, station_id @event = event @station_id = station_id end |
Instance Method Details
#broadcast ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/osc_package.rb', line 16 def broadcast = = .encode BasicSocket.do_not_reverse_lookup = true my_socket = UDPSocket.new my_socket.setsockopt(Socket::SOL_SOCKET, Socket::SO_BROADCAST, true) my_socket.send(, 0, ADDR[0], ADDR[1]) my_socket.close .to_s end |