예제 #1
0
    def configure(self, config):
        CompositeNode.configure(self, config)
        set_attribute(self, 'dev', REQUIRED, config)
        set_attribute(self, 'parity', parity_to_int('none'), config,
                      parity_to_int)
        set_attribute(self, 'baud', 9600, config, str)
        if self.baud == 'Custom':
            self.baud = -1  # flag for later processing of custom_baud
        else:
            self.baud = int(self.baud)  # normal path
        set_attributes(self, (('bits', 8), ('stop_bits', 1), ('debug', 0),
                              ('dump_cpl', 16)), config, int)
        set_attribute(self, 'custom_baud', 76800, config, int)
        set_attribute(self, 'flow_control', flowctl_to_int('none'), config,
                      flowctl_to_int)
        set_attribute(self, 'lock_directory', properties.get('VAR_LOCK'),
                      config, str)

        set_attribute(self, 'VINTR', '\x03', config, str)
        set_attribute(self, 'VQUIT', '\x1c', config, str)
        set_attribute(self, 'VERASE', '\x7f', config, str)
        set_attribute(self, 'VKILL', '\x15', config, str)
        set_attribute(self, 'VEOF', '\x04', config, str)
        set_attribute(self, 'VTIME', 0, config, int)
        set_attribute(self, 'VMIN', 1, config, int)
        set_attribute(self, 'VSWTC', '\x00', config, str)
        set_attribute(self, 'VSTART', '\x11', config, str)
        set_attribute(self, 'VSTOP', '\x13', config, str)
        set_attribute(self, 'VSUSP', '\x1a', config, str)
        set_attribute(self, 'VEOL', '\x00', config, str)
        set_attribute(self, 'VREPRINT', '\x12', config, str)
        set_attribute(self, 'VDISCARD', '\x0f', config, str)
        set_attribute(self, 'VWERASE', '\x17', config, str)
        set_attribute(self, 'VLNEXT', '\x16', config, str)
        set_attribute(self, 'VEOL2', '\x00', config, str)
        set_attribute(self, 'cc17', '\x00', config, str)
        set_attribute(self, 'cc18', '/', config, str)
        set_attribute(self, 'cc19', '\x00', config, str)
        set_attribute(self, 'cc20', '\x00', config, str)
        set_attribute(self, 'cc21', '\x00', config, str)
        set_attribute(self, 'cc22', '\x00', config, str)
        set_attribute(self, 'cc23', '\x00', config, str)
        set_attribute(self, 'cc24', '\x00', config, str)
        set_attribute(self, 'cc25', '\x00', config, str)
        set_attribute(self, 'cc26', '\x00', config, str)
        set_attribute(self, 'cc27', '\x00', config, str)
        set_attribute(self, 'cc28', '\x00', config, str)
        set_attribute(self, 'cc29', '\x00', config, str)
        set_attribute(self, 'cc30', '\x00', config, str)
        set_attribute(self, 'cc31', '\x00', config, str)

        self._devlock = DeviceLock(self.dev, self.lock_directory)

        if self.is_open():
            self._set_serial()
        return