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()
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()
def _discover_children(self, force=0): if force: self._been_discovered = 0 if self.running == 1 and not self._been_discovered: # do a find_all irrespective of whether there are ny devices found previously (CSCtl81599) self.devices, self.device_addresses = self.findall() # get a list of addresses in existing children existing = self.children_nodes(auto_discover=0) existing = filter(lambda dev : hasattr(dev,'address'), existing) existing = [dev.address for dev in existing] for addr in self.device_addresses: if addr not in existing and not self._nascent_children.get(address_to_asciihex(addr), None): if ord(addr[0]) in (0x28,0x10): # need to add new types # add a new instance to the _nascent children t = Temperature() t.address = addr t.model = _models[family_name[ord(addr[0])]] self._nascent_children[address_to_asciihex(addr)] = t # self._been_discovered = 1 #disabled to allow new objects to be discovered return self._nascent_children
def _discover_children(self, force=0): if force: self._been_discovered = 0 if self.running == 1 and not self._been_discovered: if not self.device_addresses: self.devices, self.device_addresses = self.findall() # get a list of addresses in existing children existing = self.children_nodes(auto_discover=0) # filter out any non-dallas nodes, like calculators or periodic drivers existing = filter(lambda dev : hasattr(dev,'address'), existing) existing = [dev.address for dev in existing] for addr in self.device_addresses: if addr not in existing and not self._nascent_children.get(address_to_asciihex(addr), None): # look for temperature sensors if ord(addr[0]) in (0x28,0x10): # need to add new types # add a new instance to the _nascent children t = Temperature() t.address = addr t.model = _models[family_name[ord(addr[0])]] self._nascent_children[address_to_asciihex(addr)] = t # self._been_discovered = 1 #disabled to allow new objects to be discovered return self._nascent_children
def _discover_children(self, force=0): if force: self._been_discovered = 0 if self.running == 1 and not self._been_discovered: # do a find_all irrespective of whether there are ny devices found previously (CSCtl81599) self.devices, self.device_addresses = self.findall() # get a list of addresses in existing children existing = self.children_nodes(auto_discover=0) existing = filter(lambda dev: hasattr(dev, 'address'), existing) existing = [dev.address for dev in existing] for addr in self.device_addresses: if addr not in existing and not self._nascent_children.get( address_to_asciihex(addr), None): if ord(addr[0]) in (0x28, 0x10): # need to add new types # add a new instance to the _nascent children t = Temperature() t.address = addr t.model = _models[family_name[ord(addr[0])]] self._nascent_children[address_to_asciihex(addr)] = t # self._been_discovered = 1 #disabled to allow new objects to be discovered return self._nascent_children
def _discover_children(self, force=0): if force: self._been_discovered = 0 if self.running == 1 and not self._been_discovered: if not self.device_addresses: self.devices, self.device_addresses = self.findall() # get a list of addresses in existing children existing = self.children_nodes(auto_discover=0) # filter out any non-dallas nodes, like calculators or periodic drivers existing = filter(lambda dev: hasattr(dev, 'address'), existing) existing = [dev.address for dev in existing] for addr in self.device_addresses: if addr not in existing and not self._nascent_children.get( address_to_asciihex(addr), None): # look for temperature sensors if ord(addr[0]) in (0x28, 0x10): # need to add new types # add a new instance to the _nascent children t = Temperature() t.address = addr t.model = _models[family_name[ord(addr[0])]] self._nascent_children[address_to_asciihex(addr)] = t # self._been_discovered = 1 #disabled to allow new objects to be discovered return self._nascent_children