예제 #1
0
	def __init__(self, _name, _description):
		
		try:
			#Initialize empty dictionary for physical devices
			self.dictPhysicalDevices = {}
			self.dictVirtualSwitches = {}
			self._dictRuleProxies = {} 
			self.arrConditionalItems = []
			self.description = _description
			BaseCore.__init__(self, _name)
			
			
			# Create Housekeeping Cron Job
			#ruleCronMaintain = CronRuleFactory("IntelliSwitch - {} (Maintenance)".format(_name), _description, self)
			#ruleCronMaintain.AddCronTrigger(EVERY_MINUTE)
			#self._ruleCronMaintain = ruleCronMaintain
			
			# TODO:: Fix Startup Rule - Considder if it is really needed
			self._ruleCronMaintain = None
			self._ruleStartup = None 

			#StartupRuleFactory(_name, _description, self)
			#self._dictRuleProxies = {} 
		except:
			LogException()
    def __init__(self, name, description, arrTriggerItems, arrOutputItems,
                 arrConditions):
        try:
            self.requestedTriggeredState = False
            self.actualTriggeredState = False

            BaseCore.__init__(self, name)
            self._description = description
            self._configValid = True
            self._mgr = None
            self._proxyHandler = None
            self._conditionMgr = ConditionManager()

            self._arrRequiredService = []
            self._arrVirtualTriggers = {}
            self._arrVirtualSwitches = {}

            self._arrOutputItems = arrOutputItems
            self._arrTriggerItems = arrTriggerItems
            self._conditionMgr.Add(arrConditions)

            getLogger().debug((
                "Created new rule '{}' - Triggers='{}', Outputs='{}', Conditions='{}'"
            ).format(name, self._arrTriggerItems, self._arrOutputItems,
                     arrConditions))
        except:
            LogException()
예제 #3
0
    def __init__(self, begin, end):
        try:
            self._begin = begin
            self._end = end

            BaseCore.__init__(self, "")
        except:
            LogException()
 def __init__(self, itemName, stateActivated, stateDeactivated,
              activateDelay, deactivateDelay):
     try:
         BaseCore.__init__(self, itemName)
         self._stateActivated = stateActivated
         self._stateDeactivated = stateDeactivated
         self.delayActivate = activateDelay
         self.delayDeactivate = deactivateDelay
     except:
         LogException()
예제 #5
0
	def __init__(self, name):
		try:
			self._state = None
			self.usageCount = 0
			self.callbacks = {}

			#Create Synchronization object
			self.lock = threading.Lock()

			BaseCore.__init__(self, name)

		except:
			LogException()
예제 #6
0
	def __init__(self, name, physicalDevice, eventCallback):
		try:
			
			BaseCore.__init__(self, name)
			
			#Initialization
			self._activated = False
			self._physicalDevice = None
			self._eventCallback = eventCallback
			#Validation
			if (physicalDevice is not None):
				if (isinstance(physicalDevice, PhysicalDevice)==False):
					getLogger().error("Instance of PhysicalDevice not instance of class 'PhysicalDevice'. Actual instance is '" + getClassName(physicalDevice) + "'")
					#TODO:: Raise Exception
				
				self._physicalDevice = physicalDevice
		except:
			LogException()
예제 #7
0
 def __init__(self):
     try:
         BaseCore.__init__(self, "")
         self.conditions = []
     except:
         LogException()
예제 #8
0
 def __init__(self):
     BaseCore.__init__(self, "")
     self.event = ""
 def __init__(self, name=""):
     try:
         BaseCore.__init__(self, name)
     except:
         LogException()