示例#1
0
 def configure(self, config):
     AVRNode.configure(self, config)
     set_off = self.base_set_cmd + chr(self.id) + chr(0)
     set_on = self.base_set_cmd + chr(self.id) + chr(1)
     self.get_cmd = self.base_get_cmd + chr(self.id)
     self.set_cmds = [set_off, set_on]
     return
示例#2
0
    def start(self):
        AVRNode.start(self)
        self._start_called = 1
        self.devices, self.device_addresses = self.findall()
        if self.running:
            raise EAlreadyRunning()

        # Inform in msglog the number of devices on the dallas bus and their addresses (CSCtl81599)
        if(self.devices == None ):
            no_of_devices=0
        else:
            no_of_devices=len(self.device_addresses)
        msglog.log('broadway',msglog.types.INFO,'There are %d devices found on "%s" bus' %(no_of_devices, self.name))
        if no_of_devices:
            addr_str=''
            for addr in self.device_addresses:
                dallas_bus_addr=address_to_asciihex(addr)
                addr_str=addr_str+' '+dallas_bus_addr
            msglog.log('broadway',msglog.types.INFO,'The device addresses on "%s" bus : %s\n' %(self.name,addr_str))
        
        # Start the thread to read the dallas bus irrespective for whether the devices are
        # present or not (CSCtl81599)
        self.running = 1
        thread = Thread(name=self.name,target=self._queue_thread,args=())
        self.request(self._convert_temperature_sensor_list)
        thread.start()            
示例#3
0
    def start(self):
        AVRNode.start(self)
        self._start_called = 1
        self.devices, self.device_addresses = self.findall()
        if self.running:
            raise EAlreadyRunning()

        # Inform in msglog the number of devices on the dallas bus and their addresses (CSCtl81599)
        if (self.devices == None):
            no_of_devices = 0
        else:
            no_of_devices = len(self.device_addresses)
        msglog.log(
            'broadway', msglog.types.INFO,
            'There are %d devices found on "%s" bus' %
            (no_of_devices, self.name))
        if no_of_devices:
            addr_str = ''
            for addr in self.device_addresses:
                dallas_bus_addr = address_to_asciihex(addr)
                addr_str = addr_str + ' ' + dallas_bus_addr
            msglog.log(
                'broadway', msglog.types.INFO,
                'The device addresses on "%s" bus : %s\n' %
                (self.name, addr_str))

        # Start the thread to read the dallas bus irrespective for whether the devices are
        # present or not (CSCtl81599)
        self.running = 1
        thread = Thread(name=self.name, target=self._queue_thread, args=())
        self.request(self._convert_temperature_sensor_list)
        thread.start()
示例#4
0
文件: relay.py 项目: mcruse/monotone
 def configure(self, config):
     AVRNode.configure(self, config)
     set_off = self.base_set_cmd + chr(self.id) + chr(0)
     set_on = self.base_set_cmd + chr(self.id) + chr(1)
     self.get_cmd = self.base_get_cmd + chr(self.id)
     self.set_cmds = [set_off, set_on]
     return
示例#5
0
 def __init__(self):
     AVRNode.__init__(self)
     AutoDiscoveredNode.__init__(self)
     self._lock = Lock()
     self.conversion_list = {}
     self._queue = Queue()
     self.debug = 0
     self.running = 0
     self._start_called = 0
     self.devices = ''
     self.device_addresses = []
     self._been_discovered = 0
示例#6
0
 def __init__(self):
     AVRNode.__init__(self)
     AutoDiscoveredNode.__init__(self)
     self._lock = Lock()
     self.conversion_list = {}
     self._queue = Queue()
     self.debug = 0
     self.running = 0
     self._start_called = 0
     self.devices = ''
     self.device_addresses = []
     self._been_discovered = 0
示例#7
0
    def configure(self,config):
        AVRNode.configure(self,config)
        id_chr = chr(self.id)

        # Commands cached in their entirety
        self.reset_cmd = '\x15\x00\x02\x10' + id_chr
        self.scan_cmd = '\x15\x00\x02\xc0' + id_chr
        self.unscan_cmd = '\x15\x00\x02\xd0' + id_chr
        self.convert_cmd = '\x15\x01\x04\x70' + id_chr + '\x01\x44'
        self.readscratch_cmd = '\x15\x00\x04\x70' + id_chr + '\x01\xbe'
        self.readrom_cmd = '\x15\x00\x04\x70' + id_chr + '\x01\x33'
        self.findfirst_cmd = '\x15\x00\x02\x80' + id_chr
        self.findfamily_cmd = '\x15\x00\x02\x81' + id_chr
        self.findnext_cmd = '\x15\x00\x03\x82' + id_chr + '\x00'
        # The beginning of commands of known length.
        self.matchrom_base = '\x15\x00\x0c\x70' + id_chr + '\x09\x55'
        self.skiprom_cmd = '\x15\x00\x04\x70' + id_chr + '\x01\xcc'
        self.readbits_base = '\x15\x00\x03\x40' + id_chr
        self.readbytes_base = '\x15\x00\x03\x50' + id_chr
        # Cached command codes + bus id.
        self.writebits_id = '\x60' + id_chr
        self.writebytes_id = '\x70' + id_chr
        return
示例#8
0
    def configure(self, config):
        AVRNode.configure(self, config)
        id_chr = chr(self.id)

        # Commands cached in their entirety
        self.reset_cmd = '\x15\x00\x02\x10' + id_chr
        self.scan_cmd = '\x15\x00\x02\xc0' + id_chr
        self.unscan_cmd = '\x15\x00\x02\xd0' + id_chr
        self.convert_cmd = '\x15\x01\x04\x70' + id_chr + '\x01\x44'
        self.readscratch_cmd = '\x15\x00\x04\x70' + id_chr + '\x01\xbe'
        self.readrom_cmd = '\x15\x00\x04\x70' + id_chr + '\x01\x33'
        self.findfirst_cmd = '\x15\x00\x02\x80' + id_chr
        self.findfamily_cmd = '\x15\x00\x02\x81' + id_chr
        self.findnext_cmd = '\x15\x00\x03\x82' + id_chr + '\x00'
        # The beginning of commands of known length.
        self.matchrom_base = '\x15\x00\x0c\x70' + id_chr + '\x09\x55'
        self.skiprom_cmd = '\x15\x00\x04\x70' + id_chr + '\x01\xcc'
        self.readbits_base = '\x15\x00\x03\x40' + id_chr
        self.readbytes_base = '\x15\x00\x03\x50' + id_chr
        # Cached command codes + bus id.
        self.writebits_id = '\x60' + id_chr
        self.writebytes_id = '\x70' + id_chr
        return
示例#9
0
 def configure(self, config):
     AVRNode.configure(self, config)
     self.get_cmd = self.base_get_cmd + chr(self.id)
     return
示例#10
0
文件: gpio.py 项目: mcruse/monotone
 def __init__(self):
     AVRNode.__init__(self)
     self.last_value = [3,255,0]
示例#11
0
 def _add_child(self, node):
     AVRNode._add_child(self, node)
     if not self.running and self._start_called:
         self.start()
示例#12
0
 def configuration(self):
     self.devices, self.device_addresses = self.findall()
     self._been_discovered = 0
     config = AVRNode.configuration(self)
     get_attribute(self, 'devices', config)
     return config
示例#13
0
 def __init__(self):
     AVRNode.__init__(self)
     self.last_value = [3, 255, 0]
示例#14
0
 def _add_child(self, node):
     AVRNode._add_child(self, node)
     if not self.running and self._start_called:
         self.start()
示例#15
0
 def __init__(self):
     AVRNode.__init__(self)
示例#16
0
 def configure(self, config):
     AVRNode.configure(self, config)
     self.get_cmd = self.base_get_cmd + chr(self.id)
     self.set_cmds = [self.base_set_cmd + chr(self.id)]
     return
示例#17
0
 def configuration(self):
     self.devices, self.device_addresses = self.findall()
     self._been_discovered = 0
     config = AVRNode.configuration(self)
     get_attribute(self, 'devices', config)
     return config