def apply_config(self): """ Apply the configuration actions to the node targeted by this object. After this method has been called the :py:meth:`~devices.xbee.xbee_config_blocks.xbee_config_block.XBeeConfigBlock.is_complete` method will return True. See :py:class:`~devices.xbee.xbee_config_blocks.xbee_config_block.XBeeConfigBlock`. """ # This is called when all the settings have been successfully applied: return AbstractXBeeConfigBlockDDO.apply_config(self)
def apply_config(self): """\ Apply the configuration actions to the node targeted by this object. After this method has been called the :py:meth:`~devices.xbee.xbee_config_blocks.xbee_config_block.XBeeConfigBlock.is_complete` method will return True. See :py:class:`~devices.xbee.xbee_config_blocks.xbee_config_block.XBeeConfigBlock`. """ # This is called when all the settings have been successfully applied: return AbstractXBeeConfigBlockDDO.apply_config(self)
def apply_config(self): """\ Apply the configuration actions to the node targeted by this object. After this method has been called the :py:meth:`~devices.xbee.xbee_config_blocks.xbee_config_block.XBeeConfigBlock.is_complete` method will return True. See :py:class:`~devices.xbee.xbee_config_blocks.xbee_config_block.XBeeConfigBlock`. """ try: if not AbstractXBeeConfigBlockDDO._is_applicable(self): # If the block is not applicable, mark this block as complete: return AbstractXBeeConfigBlockDDO.apply_config(self) except Exception, e: # trace message will be printed by _is_applicable() or # apply_config() upon exception. return False
def apply_config(self): """\ Apply the configuration actions to the node targeted by this object. After this method has been called the :py:meth:`~devices.xbee.xbee_config_blocks.xbee_config_block.XBeeConfigBlock.is_complete` method will return True. See :py:class:`~devices.xbee.xbee_config_blocks.xbee_config_block.XBeeConfigBlock`. """ try: if not AbstractXBeeConfigBlockDDO._is_applicable(self): # If the block is not applicable, mark this block as complete: return AbstractXBeeConfigBlockDDO.apply_config(self) except Exception, e: # trace message will be printed by _is_applicable() or # apply_config() upon exception. return False
def apply_config(self): ''' Apply the configuration actions to the node targeted by this object. After this method has been called the :py:meth:`~devices.xbee.xbee_config_blocks.xbee_config_block.XBeeConfigBlock.is_complete` method will return True. See :py:class:`~devices.xbee.xbee_config_blocks.xbee_config_block.XBeeConfigBlock`. ''' try: if not AbstractXBeeConfigBlockDDO._is_applicable(self): # If the block is not applicable, mark this block as complete: return AbstractXBeeConfigBlockDDO.apply_config(self) except: # Trace messages handled by _is_applicable() and apply_config() return False # Special case: # # Check if sleep mode is unavailable on this module/firmware # combination: if not self.__is_sleep_mode_available(): if self.__sleep_mode == SM_DISABLED: # This sleep block has been filled out with sleeping # disabled however sleep configuration is not available: # mark this block as complete. self.__tracer.debug('sleep mode unsupported and SM_DISABLED' ' given, block complete.') return AbstractXBeeConfigBlockDDO.apply_config(self) else: # We are unable to apply this block, mark it as a # block application failure: self.__tracer.warning('sleep mode unsupported' ' but sleep parameters given,' ' block FAILED. Please disable ' 'sleeping on this device.') return False # Configure the node: pending_mnemonics = self.__pending_parameters.keys() for mnemonic in pending_mnemonics: # NOTE: this message is duplicated in the XBeeConfigBlockDDO source self.__tracer.debug( "Apply_config: trying '%s' = '%s' to '%s'", mnemonic, format_hexrepr(self.__pending_parameters[mnemonic]), AbstractXBeeConfigBlockDDO.ext_addr_get(self)) try: AbstractXBeeConfigBlockDDO.configurator_get(self).\ ddo_set_param( AbstractXBeeConfigBlockDDO.ext_addr_get(self), mnemonic, self.__pending_parameters[mnemonic], retries=DDO_RETRY_ATTEMPTS) except Exception, e: self.__tracer.error( "'%s' = '%s' to '%s' failed (%s)", mnemonic, format_hexrepr(self.__pending_parameters[mnemonic]), AbstractXBeeConfigBlockDDO.ext_addr_get(self), str(e)) return False del (self.__pending_parameters[mnemonic])
mnemonic, self.__pending_parameters[mnemonic], retries=DDO_RETRY_ATTEMPTS) except Exception, e: self.__tracer.error( "'%s' = '%s' to '%s' failed (%s)", mnemonic, format_hexrepr(self.__pending_parameters[mnemonic]), AbstractXBeeConfigBlockDDO.ext_addr_get(self), str(e)) return False del (self.__pending_parameters[mnemonic]) # NOTE: We do NOT apply changes here. All config block # changes will be applied when the final 'WR' is performed # This is called when all the settings have been successfully # applied. return AbstractXBeeConfigBlockDDO.apply_config(self) def sleep_mode_set(self, sleep_mode): """ Set the sleep mode for the adapter. This clears all existing configuration parameters on this config block and resets its state. Valid sleep modes are: * :py:const:`SM_DISABLED`: sleep mode disabled. * :py:const:`SM_PIN_HIBERNATE`: pin hibernation mode * :py:const:`SM_CYCLIC_SLEEP`: cyclic sleep mode * :py:const:`SM_CYCLIC_SLEEP_PIN_WAKE`: cycle sleep mode with pin-wake
def apply_config(self): """\ Apply the configuration actions to the node targeted by this object. After this method has been called the :py:meth:`~devices.xbee.xbee_config_blocks.xbee_config_block.XBeeConfigBlock.is_complete` method will return True. See :py:class:`~devices.xbee.xbee_config_blocks.xbee_config_block.XBeeConfigBlock`. """ try: if not AbstractXBeeConfigBlockDDO._is_applicable(self): # If the block is not applicable, mark this block as complete: return AbstractXBeeConfigBlockDDO.apply_config(self) except: # Trace messages handled by _is_applicable() and apply_config() return False # Special case: # # Check if sleep mode is unavailable on this module/firmware # combination: if not self.__is_sleep_mode_available(): if self.__sleep_mode == SM_DISABLED: # This sleep block has been filled out with sleeping # disabled however sleep configuration is not available: # mark this block as complete. self.__tracer.debug("sleep mode unsupported and SM_DISABLED" + " given, block complete.") return AbstractXBeeConfigBlockDDO.apply_config(self) else: # We are unable to apply this block, mark it as a # block application failure: self.__tracer.warning("sleep mode unsupported" + " but sleep parameters given," + " block FAILED. Please disable " + "sleeping on this" + " device.") return False # Configure the node: pending_mnemonics = self.__pending_parameters.keys() for mnemonic in pending_mnemonics: # NOTE: this message is duplicated in the XBeeConfigBlockDDO source self.__tracer.debug("Apply_config: trying '%s' = '%s' to '%s'", mnemonic, format_hexrepr( self.__pending_parameters[mnemonic]), AbstractXBeeConfigBlockDDO.ext_addr_get(self)) try: AbstractXBeeConfigBlockDDO.configurator_get(self).ddo_set_param( AbstractXBeeConfigBlockDDO.ext_addr_get(self), mnemonic, self.__pending_parameters[mnemonic], retries=DDO_RETRY_ATTEMPTS) except Exception, e: self.__tracer.error("'%s' = '%s' to '%s' failed (%s)", mnemonic, format_hexrepr( self.__pending_parameters[mnemonic]), AbstractXBeeConfigBlockDDO.ext_addr_get(self), str(e)) return False del(self.__pending_parameters[mnemonic])
except Exception, e: self.__tracer.error("'%s' = '%s' to '%s' failed (%s)", mnemonic, format_hexrepr( self.__pending_parameters[mnemonic]), AbstractXBeeConfigBlockDDO.ext_addr_get(self), str(e)) return False del(self.__pending_parameters[mnemonic]) # NOTE: We do NOT apply changes here. All config block # changes will be applied when the final 'WR' is performed # This is called when all the settings have been successfully applied: return AbstractXBeeConfigBlockDDO.apply_config(self) def sleep_mode_set(self, sleep_mode): """ Set the sleep mode for the adapter. This clears all existing configuration parameters on this config block and resets its state. Valid sleep modes are: * :py:const:`SM_DISABLED`: sleep mode disabled. * :py:const:`SM_PIN_HIBERNATE`: pin hibernation mode * :py:const:`SM_CYCLIC_SLEEP`: cyclic sleep mode * :py:const:`SM_CYCLIC_SLEEP_PIN_WAKE`: cycle sleep mode with pin-wake