def __init__(self, swap_settings=None): """ Class constructor @param file_name: name of the HEX file @param swap_settings: path to the main SWAP configuration file """ # Main configuration file self.swap_settings = swap_settings # Print SWAP activity self._print_swap = False # Server started flag self.server_started = False try: # Superclass call SwapInterface.__init__(self, swap_settings) except SwapException as ex: ex.display() except: pass # Disable verbose self.server.verbose = False self.verbose = False # Firmware image self.hexfile = None # Progress bar self.progress = None # Number of line being queried self.hexfile_line = 0 # Address of node being programmed self.prog_address = None
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"))
def __init__(self, settings=None): """ Class constructor @param settings: path to the main configuration file """ # Callbacks not being used self.registerValueChanged = None # wxPython app self.app = wx.App(False) # Start SWAP server try: # Superclass call SwapInterface.__init__(self, settings, False) # Clear error file SwapException.clear() except SwapException as ex: ex.display() ex.log() # Open SWAP Device Management Tool self.dmtframe = MainFrame("SWAP Device Management Tool", self, server=self.server) #self.dmtframe.SetSize(wx.Size(370,500)) self.app.SetTopWindow(self.dmtframe) self.dmtframe.CenterOnScreen() self.dmtframe.Show(True) self.app.MainLoop()
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"))
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
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")
def __init__(self, swap_settings=None): """ Class constructor @param swap_settings: path to the main SWAP configuration file """ # MAin configuration file self.swap_settings = swap_settings # Print SWAP activity DEBUG = False #Setup MQTT client self.mqttc = mosquitto.Mosquitto("LIB-PI_"+str(MQTT.pi_id)+str(random.randrange(10000))) self.mqttc.on_connect = self.on_connect self.mqttc.on_publish = self.on_publish self.mqttc.on_message = self.on_message self.mqttc.connect(MQTT.server, 1883) try: # Superclass call SwapInterface.__init__(self, swap_settings) # Start MQTT client loop self.mqttc.loop_forever() except: e = sys.exc_info()[0] print ("<__init__> Error: %s" % e ) self.shell_command("sudo svc -t /etc/service/lib/")
def __init__(self, *args, **kwargs): self.log = logging.getLogger(type(self).__name__) # needed as this does not require a new thread self.server = None # Prepare config files try: tmp = re.sub('<port>(.*)</port>', '<port>%s</port>' % self.config.get('serial'), open(os.path.join(Swap.baseDir, 'serial.xml')).read()) open(os.path.join(Swap.baseDir, 'serial.xml'), 'w').write(tmp) SwapInterface.__init__(self, *args, settings=os.path.join(Swap.baseDir, 'settings.xml'), start=False, **kwargs) self.server.setDaemon(True) except Exception, E: self.log.error('Cannot initialize: %s' % E.message)
def __init__(self, verbose=False, monitor=False): """ Class constructor 'verbose' Print out SWAP frames or not 'monitor' Print out network events or not """ # Superclass call SwapInterface.__init__(self, None, verbose) # Print SWAP activity self._printSWAP = monitor # Mote address in SYNC mode self._addrInSyncMode = None
def __init__(self, *args, **kwargs): self.log = logging.getLogger(type( self).__name__) # needed as this does not require a new thread self.server = None # Prepare config files try: tmp = re.sub('<port>(.*)</port>', '<port>%s</port>' % self.config.get('serial'), open(os.path.join(Swap.baseDir, 'serial.xml')).read()) open(os.path.join(Swap.baseDir, 'serial.xml'), 'w').write(tmp) SwapInterface.__init__(self, *args, settings=os.path.join( Swap.baseDir, 'settings.xml'), start=False, **kwargs) self.server.setDaemon(True) except Exception, E: self.log.error('Cannot initialize: %s' % E.message)
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
def __init__(self, verbose=False): """ Class constructor """ SwapInterface.__init__(self, verbose)