python-osc for python3
Esse commit está contido em:
Arquivo normal → Arquivo executável
+11
-13
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
# requires pyosc
|
# requires python-osc
|
||||||
from OSC import OSCClient, OSCMessage
|
from pythonosc import osc_message_builder
|
||||||
|
from pythonosc import udp_client
|
||||||
import plugin_interface as plugintypes
|
import plugin_interface as plugintypes
|
||||||
|
|
||||||
# Use OSC protocol to broadcast data (UDP layer), using "/openbci" stream. (NB. does not check numbers of channel as TCP server)
|
# Use OSC protocol to broadcast data (UDP layer), using "/openbci" stream. (NB. does not check numbers of channel as TCP server)
|
||||||
@@ -31,26 +32,23 @@ class StreamerOSC(plugintypes.IPluginExtended):
|
|||||||
if len(self.args) > 2:
|
if len(self.args) > 2:
|
||||||
self.address = self.args[2]
|
self.address = self.args[2]
|
||||||
# init network
|
# init network
|
||||||
print "Selecting OSC streaming. IP: ", self.ip, ", port: ", self.port, ", address: ", self.address
|
print("Selecting OSC streaming. IP: " + self.ip + ", port: " + str(self.port) + ", address: " + self.address)
|
||||||
self.client = OSCClient()
|
self.client = udp_client.SimpleUDPClient(self.ip, self.port)
|
||||||
self.client.connect( (self.ip, self.port) )
|
|
||||||
|
|
||||||
# From IPlugin: close connections, send message to client
|
# From IPlugin: close connections, send message to client
|
||||||
def deactivate(self):
|
def deactivate(self):
|
||||||
self.client.send(OSCMessage("/quit") )
|
self.client.send_message("/quit")
|
||||||
|
|
||||||
# send channels values
|
# send channels values
|
||||||
def __call__(self, sample):
|
def __call__(self, sample):
|
||||||
mes = OSCMessage(self.address)
|
|
||||||
mes.append(sample.channel_data)
|
|
||||||
# silently pass if connection drops
|
# silently pass if connection drops
|
||||||
try:
|
try:
|
||||||
self.client.send(mes)
|
self.client.send_message(self.address, sample.channel_data)
|
||||||
except:
|
except:
|
||||||
return
|
return
|
||||||
|
|
||||||
def show_help(self):
|
def show_help(self):
|
||||||
print """Optional arguments: [ip [port [address]]]
|
print("""Optional arguments: [ip [port [address]]]
|
||||||
\t ip: target IP address (default: 'localhost')
|
\t ip: target IP address (default: 'localhost')
|
||||||
\t port: target port (default: 12345)
|
\t port: target port (default: 12345)
|
||||||
\t address: select target address (default: '/openbci')"""
|
\t address: select target address (default: '/openbci')""")
|
||||||
|
|||||||
Arquivo normal → Arquivo executável
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
numpy==1.9.2
|
numpy==1.9.2
|
||||||
pylsl==1.10.4
|
pylsl==1.10.4
|
||||||
pyOSC==0.3.5b-5294
|
python-osc==1.6.3
|
||||||
pyserial==2.7
|
pyserial==2.7
|
||||||
requests==2.7.0
|
requests==2.7.0
|
||||||
six==1.9.0
|
six==1.9.0
|
||||||
|
|||||||
Referência em uma Nova Issue
Bloquear um usuário