Sha256: b1a88f6209d665f4eeb1e71d3658f43773e325a0efc6ea7e0b1a334753f7c6de
Contents?: true
Size: 1.32 KB
Versions: 1
Compression:
Stored size: 1.32 KB
Contents
require 'rubygems' require 'socket' require 'osc' require 'time' ADDR = ['<broadcast>', 6567] # broadcast address STATION_ID = 1 DIMENSIONALITY = 2 EVENTS = [ "swipeDown", "swipeUp", "swipeLeft", "swipeRight", "zoomIn", "zoomOut", "cancel", "mouseDown", 'bigSwipe', "mouseMove", 'mouseUp', 'otherunknown' ] UDPSock = UDPSocket.new UDPSock.setsockopt(Socket::SOL_SOCKET, Socket::SO_BROADCAST, true) puts "sending osc packages" while true do #case ['cursor', 'event', 'event_and_cursor', 'invalid'].choice case ['cursor', 'event', 'event_and_cursor', 'invalid'].choice when 'cursor': puts 'cursor' my_message = OSC::Message.new("/cursor/#{STATION_ID}/1/#{DIMENSIONALITY}", 'ff', 0.3, 0.3).encode when 'event': puts 'event' my_message = OSC::Message.new("/cursor/#{STATION_ID}/1/#{DIMENSIONALITY}",'s', EVENTS.choice).encode when 'event_and_cursor': puts 'event_and_cursor' my_message = OSC::Message.new("/cursor/#{STATION_ID}/1/#{DIMENSIONALITY}", 'ffs', 0.3, 0.3, EVENTS.choice).encode when 'invalid'; puts 'invalid' my_message = 'hallo' end puts my_message.inspect UDPSock.send(my_message, 0, ADDR[0], ADDR[1]) sleep 1.0/2.0 # Hz end UDPSock.close puts "good bye"
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tg-can-controls-gateway-0.1.0 | lib/osc_broadcast_sender.rb |