Exemple #1
0
 def __init__(self, serial_port, parent):
     """Init process."""
     Process.__init__(self)
     self.exit = Event()
     self.serial_port = serial_port
     self.device = Device.get(Device.get_identifier_from_serial(serial_port))
     self.get_port_list()
     self.ser = None
     self.parent = parent
     self.parent.set_datas(self.serial_port, dict(self.value))
Exemple #2
0
    def edit(self, slug):
        """Show configuration form for device."""
        device = Device.get(Device.get_identifier_from_serial(slug))
        cards = Card.get_all()
        sensors = Sensor.get_all()
        if device is None:
            device = Device.get_config(slug)
            if device is None:
                self.redirect(self.redirect_url + '/create', permanent=False)

        settings = dict()
        settings['method'] = 'put'
        settings['cards'] = cards
        settings['card'] = device.card
        settings['sensors'] = sensors
        settings['device'] = device
        settings['method'] = 'put'
        self.render('device/config.html', **settings)
Exemple #3
0
 def show(self, slug):
     """Show device."""
     device = Device.get(Device.get_identifier_from_serial(slug))
     if device is None:
         device = Device.get_config(slug)
         if device is None:
             self.redirect(self.redirect_url + '/create', permanent=False)
         else:
             settings = dict()
             settings['device'] = device
             settings['slug'] = slug
             self.render('device/show.html', **settings)
     else:
         settings = dict()
         settings['port'] = SSL_PORT
         settings['slug'] = slug
         settings['device'] = device
         self.render('device/communicate.html', **settings)