Exemplo n.º 1
0
    def __init__(self, swap_settings=None):
        """
        Class constructor
        
        @param swap_settings: path to the main SWAP configuration file
        @param verbose: Print out SWAP frames or not
        @param monitor: Print out network events or not
        """
       
        # Main configuration file
        self.swap_settings = swap_settings
        # Print SWAP activity
        self._print_swap = False
        
        try:
            self.main_settings = XmlSettings(self.swap_settings)
            # Set log file to trace lagarto exceptions
            LagartoException.error_file = XmlSettings.error_file
            # Superclass call
            SwapInterface.__init__(self, swap_settings)
        except:
            raise

        # Lagarto server constructor
        LagartoServer.__init__(self, working_dir)

        if XmlSettings.debug == 2:
            self._print_swap = True
            
        self.lagarto_config = XmlLagarto(os.path.join(config_dir, "lagarto.xml"))
Exemplo n.º 2
0
    def __init__(self, swap_settings=None):
        """
        Class constructor
        
        @param swap_settings: path to the main SWAP configuration file
        @param verbose: Print out SWAP frames or not
        @param monitor: Print out network events or not
        """
        # MAin configuration file
        self.swap_settings = swap_settings
        # Print SWAP activity
        self._print_swap = False
        
        try:
            # Superclass call
            SwapInterface.__init__(self, swap_settings)
        except:
            raise

        # Lagarto server constructor
        LagartoServer.__init__(self, working_dir)

        if XmlSettings.debug == 2:
            self._print_swap = True
        self.log("Logging enabled")
Exemplo n.º 3
0
    def __init__(self, swap_settings=None, abort_call=None):
        """
        Class constructor
        
        @param swap_settings: path to the main SWAP configuration file
        @param verbose: Print out SWAP frames or not
        @param monitor: Print out network events or not
        @param abort_call: Call in case of abrupt hang mode
        """
        self.parent_abort_call = abort_call
        # MAin configuration file
        self.swap_settings = swap_settings
        # Print SWAP activity
        self._print_swap = False

        try:
            # Superclass call
            SwapInterface.__init__(self, swap_settings, abort_call=self.abort_call)
        except:
            raise

        # Lagarto server constructor
        LagartoServer.__init__(self, working_dir)

        if XmlSettings.debug == 2:
            self._print_swap = True
Exemplo n.º 4
0
 def stop(self):
     """
     Stop SWAP manager
     """
     # Stop SWAP server
     self.server.stop()
     # Stop Lagarto server
     LagartoServer.stop(self)
Exemplo n.º 5
0
 def stop(self):
     """
     Stop SWAP manager
     """
     # Stop SWAP server
     self.server.stop()
     # Stop Lagarto server
     LagartoServer.stop(self)
Exemplo n.º 6
0
    def stop(self, internal=False):
        """
        Stop SWAP manager
        """
        # Stop SWAP server
        self.server.stop()
        # Stop Lagarto server
        LagartoServer.stop(self)

        if internal and self.abort_call:
            self.abort_call()
Exemplo n.º 7
0
    def __init__(self):
        """
        Constructor
        """
        # Read config
        config_file = os.path.join(working_dir, "config", "settings.xml")
        self.general_settings = XmlSettings(config_file)

        # Lagarto server constructor
        LagartoServer.__init__(self, working_dir)

        # Network object containing speech-related endpoints
        self.network = SpeechNetwork(self)

        # Text to speech engine
        self.speech_producer = SpeachProducer(self, self.general_settings.language)
        self.speech_producer.speak(self.general_settings.welcomemsg)
        # Speech Listener
        SpeechListener(self, self.general_settings.language, self.general_settings.keyword)
Exemplo n.º 8
0
    def __init__(self):
        """
        Constructor
        """
        # Read config
        config_file = os.path.join(working_dir, "config", "settings.xml")
        self.general_settings = XmlSettings(config_file)

        # Lagarto server constructor
        LagartoServer.__init__(self, working_dir)

        # Network object containing speech-related endpoints
        self.network = SpeechNetwork(self)

        # Text to speech engine
        self.speech_producer = SpeachProducer(self,
                                              self.general_settings.language)
        self.speech_producer.speak(self.general_settings.welcomemsg)
        # Speech Listener
        SpeechListener(self, self.general_settings.language,
                       self.general_settings.keyword)
Exemplo n.º 9
0
    def __init__(self, swap_settings=None):
        """
        Class constructor
        
        @param swap_settings: path to the main SWAP configuration file
        @param verbose: Print out SWAP frames or not
        @param monitor: Print out network events or not
        """
        # MAin configuration file
        self.swap_settings = swap_settings
        # Print SWAP activity
        self._print_swap = False

        try:
            # Superclass call
            SwapInterface.__init__(self, swap_settings)
        except:
            raise

        # Lagarto server constructor
        LagartoServer.__init__(self, working_dir)

        if XmlSettings.debug == 2:
            self._print_swap = True
Exemplo n.º 10
0
 def abort_call(self):
     LagartoServer.stop(self)
     if self.parent_abort_call:
         self.parent_abort_call()