コード例 #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 process constructor
        LagartoProcess.__init__(self, working_dir)

        if XmlSettings.debug == 2:
            self._print_swap = True

        self.lagarto_config = XmlLagarto(
            os.path.join(config_dir, "lagarto.xml"))
コード例 #2
0
ファイル: lagartocomms.py プロジェクト: ntruchsess/panstamp
    def __init__(self, working_dir):
        '''
        Constructor
        
        @param working_dir: Working directory
        '''
        cfg_path = os.path.join(working_dir, "config", "lagarto.xml")
        # Read configuration file
        self.config = XmlLagarto(cfg_path)

        ## Local IP address
        address = self._get_local_ip_address()
        # Save IP address in config file
        if self.config.address != address:
            self.config.address = address
            self.config.save()

        # HTTP server
        self.http_server = LagartoHttpServer(self, self.config, working_dir)
        self.http_server.start()