-
Notifications
You must be signed in to change notification settings - Fork 0
/
notifications.py
44 lines (33 loc) · 918 Bytes
/
notifications.py
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
#for interprocess communication
import smokesignal
from easyNav_pi_dispatcher import DispatcherClient
import json
import speaker
class Notifications(object):
def __init__(self):
self.speaker = speaker.newSpeaker()
#interprocess
self.DISPATCHER_PORT = 9002
self.dispatcherClient = DispatcherClient(port=self.DISPATCHER_PORT)
## Attach event listeners
self.attachEvents(self.speaker)
def start(self):
self.dispatcherClient.start()
def attachEvents(self, mic):
## clear all signals
smokesignal.clear()
text = ""
@smokesignal.on('say')
def onSay(args):
print "Info from Nav"
infoFromNav = eval(args.get('payload'))
print infoFromNav
infotosay = infoFromNav["text"]
print infotosay
print "Info from Nav before Mic"
mic.say(infotosay)
def runMain():
notifications = Notifications()
notifications.start()
if __name__ == '__main__':
runMain()