forked from federicocorrao/Nao-Computer-Vision-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_prova_gestione_eventi.py
More file actions
46 lines (33 loc) · 1.04 KB
/
_prova_gestione_eventi.py
File metadata and controls
46 lines (33 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from naoqi import ALProxy
from naoqi import ALBroker
from naoqi import ALModule
IP = '127.0.0.1'
Port = 9559
MemoryProxy = None
Manager = None
class EventManagerModule(ALModule):
# Constuctor
# MemoryProxy = None
def __init__(self, name):
# Base
ALModule.__init__(self, name)
#global MemoryProxy
#self.MemoryProxy = ALProxy('ALMemory', IP, Port)
#MemoryProxy = ALProxy('ALMemory')
#
def subscribeToEvent(self, event, callback_name, callback_body):
setattr(self, callback_name, callback_body)
global MemoryProxy #self.
MemoryProxy = ALProxy("ALMemory")
MemoryProxy.subscribeToEvent(
event, 'Manager', callback_name)
#
#
def ciao(self, *_args):
print "red ball detected callback"
rbprox = ALProxy("ALRedBallDetection", IP, Port)
rbprox.subscribe("prova")
myBroker = ALBroker("myBroker", "0.0.0.0", 0, IP, Port)
Manager = EventManagerModule('Manager')
Manager.subscribeToEvent("redBallDetected", "rbd_callback", ciao)
print "done"