MainController.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. from core.JarvisTrigger import JarvisTrigger
  2. from core.OrderListener import OrderListener
  3. from neurons import Say
  4. class MainController:
  5. def __init__(self):
  6. # create an order listener object
  7. self.order_listener = OrderListener(self)
  8. # Wait that the jarvis trigger is pronounced by the user
  9. self.jarvis_triger = JarvisTrigger(self)
  10. def get_order_listenner(self):
  11. return self.order_listener
  12. def start(self):
  13. self.jarvis_triger.start()
  14. def pause_jarvis_trigger(self):
  15. """
  16. The hotwork to wake up jarvis has been detected, we pause the snowboy process
  17. :return:
  18. """
  19. pass
  20. def hotword_detected(self):
  21. """
  22. # we have detected the hotword, we can now pause the Jarvis Trigger for a while
  23. # The user can speak out loud his order during this time.
  24. :return:
  25. """
  26. # pause the snowboy process
  27. self.pause_jarvis_trigger()
  28. print "Start listening for order"
  29. Say("oui monsieur?")
  30. self.order_listener.start()